summaryrefslogtreecommitdiff
path: root/web/reduce/rweb/underscore.web
blob: b04b90c5e609a3e53db422625b70481399b47b6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
% Copyright (c) 1991: Marcel Roelofs and Peter Gragert
%                     University of Twente, Enschede, The Netherlands
% @@(#) underscore.web (91/03/11)

@* Filter to remove underscores from REDUCE source. REDUCE does not
allow sole underscores in identifiers. However, underscores preceded
by an exclamation mark are allowed. Also REDUCE strings may contain
underscores. The following C program is a filter that removes the
forbidden underscores.

@u
#include <stdio.h>

main (ac, av)
char **av;
{
char c;
while ((c=getc(stdin)) != EOF) 
   if (c=='!') { 
      putc(c,stdout); 
      c=getc(stdin);
      putc(c,stdout);
   }
   else 
      if (c=='\"') { 
         while (putc(c,stdout), (c=getc(stdin)) != '\"') ;
         putc(c,stdout);
      }
      else 
         if (c != '_') putc(c,stdout);
}