1: #include "r.h"
2:
3: char outbuf[80];
4: int outp 0;
5: int cont 0;
6:
7: outcode(p) char *p; {
8: int i,j,c,c1;
9: char *q;
10: if( p == 0 ){
11: outbuf[outp] = '\0';
12: printf("%s\n", outbuf);
13: outp = cont = 0;
14: return;
15: }
16: while( (c = *p++) ){
17: c1 = *p;
18: switch(c){
19:
20: case '"':
21: case '\'':
22: for( q=p; *q != c; q++ );
23: outnum(q-p);
24: ptc('h');
25: while( p != q )
26: ptc(*p++);
27: p++;
28: break;
29: case '>':
30: if( c1=='=' ){
31: pts(".ge."); p++;
32: } else
33: pts(".gt.");
34: break;
35: case '<':
36: if( c1=='=' ){
37: pts(".le."); p++;
38: } else if( c1=='>' ){
39: pts(".ne."); p++;
40: } else
41: pts(".lt.");
42: break;
43: case '=':
44: if( c1=='=' ){
45: pts(".eq."); p++;
46: } else
47: ptc('=');
48: break;
49: case '!':
50: if( c1=='=' ){
51: pts(".ne."); p++;
52: } else
53: pts(".not.");
54: break;
55: case '&':
56: if( c1=='&' )
57: p++;
58: pts(".and.");
59: break;
60: case '|':
61: if( c1=='|' )
62: p++;
63: pts(".or.");
64: break;
65: case '\t':
66: tabs();
67: break;
68: case '\n':
69: ptc(' ');
70: break;
71: default:
72: ptc(c);
73: break;
74: }
75: }
76: }
77:
78: ptc(c) char c; {
79: if( outp > 71 )
80: contcard();
81: outbuf[outp++] = c;
82: }
83:
84: pts(s) char *s; {
85: while(*s)
86: ptc(*s++);
87: }
88:
89: int contfld 0;
90:
91: contcard(){
92: outbuf[outp] = '\0';
93: printf("%s\n", outbuf);
94: for( outp=0; outp<contfld-1; outbuf[outp++] = ' ' );
95: outbuf[outp++] = '&';
96: }
97:
98: tabs(){
99: ptc(' ');
100: while( outp<7 )
101: ptc(' ');
102: while( outp%3 != 1)
103: ptc(' ');
104: }
105:
106: outnum(n) int n; {
107: int a;
108: if( a = n/10 )
109: outnum(a);
110: ptc(n%10 + '0');
111: }
112:
113: outcont(n) int n; {
114: if( n > 0 )
115: outnum(n);
116: outcode("\tcontinue");
117: outcode(0);
118: }
119:
120: outgoto(n) int n; {
121: outcode("\tgoto ");
122: outnum(n);
123: outcode(0);
124: }
Defined functions
outcode
defined in line
7; used 31 times
ptc
defined in line
78; used 10 times
pts
defined in line
84; used 10 times
tabs
defined in line
98; used 1 times
Defined variables
cont
defined in line
5; used 1 times
outbuf
defined in line
3; used 7 times
outp
defined in line
4; used 11 times