Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.4
 
1.5
 
MAIN:ragge:20020326195648
 
reader.c
_>66 
 77 /*      some storage declarations */
 88 
<>9 -# define NOMAIN
 10 -
119 int nrecur;
 1210 int lflag;
 1311 #ifdef FORT
     
 !
117115 
 118116 }
 119117 
<>120 -# ifndef NOMAIN
 121 -
 122 -unsigned int caloff();
 123 -unsigned int offsz;
 124 -mainp2( argc, argv ) char *argv[]; {
 125 -        register files;
 126 -        register temp;
 127 -        register c;
 128 -        register char *cp;
 129 -        register NODE *p;
 130 -
 131 -        offsz = caloff();
 132 -        files = p2init( argc, argv );
 133 -        tinit();
 134 -
 135 -        reread:
 136 -
 137 -        if( files ){
 138 -                while( files < argc && argv[files][0] == '-' ) {
 139 -                        ++files;
 140 -                        }
 141 -                if( files > argc ) return( nerrors );
 142 -                freopen( argv[files], "r", stdin );
 143 -                }
 144 -        while( (c=getchar()) > 0 ) switch( c ){
 145 -        case ')':
 146 -        default:
 147 -                /* copy line unchanged */
 148 -                if ( c != ')' )
 149 -                        PUTCHAR( c );  /*  initial tab  */
 150 -                while( (c=getchar()) > 0 ){
 151 -                        PUTCHAR(c);
 152 -                        if( c == '\n' ) break;
 153 -                        }
 154 -                continue;
 155 -
 156 -        case BBEG:
 157 -                /* beginning of a block */
 158 -                temp = rdin(10);  /* ftnno */
 159 -                tmpoff = baseoff = (unsigned int) rdin(10); /* autooff for block gives max offset of autos in block */
 160 -                maxtreg = rdin(10);
 161 -                if( getchar() != '\n' ) cerror( "intermediate file format error");
 162 -
 163 -                if( temp != ftnno ){ /* beginning of function */
 164 -                        maxoff = baseoff;
 165 -                        ftnno = temp;
 166 -                        maxtemp = 0;
 167 -                        }
 168 -                else {
 169 -                        if( baseoff > maxoff ) maxoff = baseoff;
 170 -                        /* maxoff at end of ftn is max of autos and temps
 171 -                           over all blocks in the function */
 172 -                        }
 173 -                setregs();
 174 -                continue;
 175 -
 176 -        case BEND/* end of block */
 177 -                SETOFF( maxoff, ALSTACK );
 178 -                eobl2();
 179 -                while( (c=getchar()) != '\n' ){
 180 -                        if( c <= 0 ) cerror( "intermediate file format eof" );
 181 -                        }
 182 -                continue;
 183 -
 184 -        case EXPR:
 185 -                /* compile code for an expression */
 186 -                lineno = rdin( 10 );
 187 -                for( cp=filename; (*cp=getchar()) != '\n'; ++cp ) ; /* VOID, reads filename */
 188 -                *cp = '\0';
 189 -                if( lflag ) lineid( lineno, filename );
 190 -
 191 -                tmpoff = baseoff/* expression at top level reuses temps */
 192 -                p = eread();
 193 -
 194 -# ifndef BUG4
 195 -                if( edebug ) fwalk( p, eprint, 0 );
 196 -# endif
 197 -
 198 -# ifdef MYREADER
 199 -                MYREADER(p);  /* do your own laundering of the input */
 200 -# endif
 201 -
 202 -                nrecur = 0;
 203 -                delay( p );  /* expression statement  throws out results */
 204 -                reclaim( p, RNULL, 0 );
 205 -
 206 -                allchk();
 207 -                tcheck();
 208 -                continue;
 209 -
 210 -                }
 211 -
 212 -        /* EOF */
 213 -        if( files ) goto reread;
 214 -        return(nerrors);
 215 -
 216 -        }
 217 -
 218 -# endif
 219 -
220118 void
 221119 p2compile(NODE *p)
 222120 {
     
 !
11281026 }
 11291027 # endif
 11301028 
<>1131 -# ifndef NOMAIN
 1132 -NODE *
 1133 -eread()
 1134 -{
 1135 -
 1136 -        /* call eread recursively to get subtrees, if any */
 1137 -
 1138 -        register NODE *p;
 1139 -        register i, c;
 1140 -        register char *pc;
 1141 -        register j;
 1142 -
 1143 -        i = rdin( 10 );
 1144 -
 1145 -        p = talloc();
 1146 -
 1147 -        p->in.op = i;
 1148 -
 1149 -        i = optype(i);
 1150 -
 1151 -        if( i == LTYPE ) p->tn.lval = rdin( 10 );
 1152 -        if( i != BITYPE ) p->tn.rval = rdin( 10 );
 1153 -
 1154 -        p->in.type = rdin(8 );
 1155 -        p->in.rall = NOPREF/* register allocation information */
 1156 -
 1157 -        if( p->in.op == STASG || p->in.op == STARG || p->in.op == STCALL || p->in.op == UNARY STCALL ){
 1158 -                p->stn.stsize = (rdin( 10 ) + (SZCHAR-1) )/SZCHAR;
 1159 -                p->stn.stalign = rdin(10) / SZCHAR;
 1160 -                if( getchar() != '\n' ) cerror( "illegal \n" );
 1161 -                }
 1162 -        else {   /* usual case */
 1163 -                if( p->in.op == REG ) rbusy( p->tn.rval, p->in.type );  /* non usually, but sometimes justified */
 1164 -                { char buf[BUFSIZ];
 1165 -                for( pc=buf,j=0; ( c = getchar() ) != '\n'; ++j ){
 1166 -                        if( j < BUFSIZ ) *pc++ = c;
 1167 -                        }
 1168 -                if( j < BUFSIZ ) *pc = '\0';
 1169 -                p->in.name = tstr(buf);
 1170 -                }
 1171 -                }
 1172 -
 1173 -        /* now, recursively read descendents, if any */
 1174 -
 1175 -        if( i != LTYPE ) p->in.left = eread();
 1176 -        if( i == BITYPE ) p->in.right = eread();
 1177 -
 1178 -        return( p );
 1179 -
 1180 -        }
 1181 -
 1182 -CONSZ
 1183 -rdin( base ){
 1184 -        register sign, c;
 1185 -        CONSZ val;
 1186 -
 1187 -        sign = 1;
 1188 -        val = 0;
 1189 -
 1190 -        while( (c=getchar()) > 0 ) {
 1191 -                if( c == '-' ){
 1192 -                        if( val != 0 ) cerror( "illegal -");
 1193 -                        sign = -sign;
 1194 -                        continue;
 1195 -                        }
 1196 -                if( c == '\t' ) break;
 1197 -                if( c>='0' && c<='9' ) {
 1198 -                        val *= base;
 1199 -                        if( sign > 0 )
 1200 -                                val += c-'0';
 1201 -                        else
 1202 -                                val -= c-'0';
 1203 -                        continue;
 1204 -                        }
 1205 -                cerror( "illegal character `%c' on intermediate file", c );
 1206 -                break;
 1207 -                }
 1208 -
 1209 -        if( c <= 0 ) {
 1210 -                cerror( "unexpected EOF");
 1211 -                }
 1212 -        return( val );
 1213 -        }
 1214 -# endif
 1215 -
<_12161029 #ifndef FIELDOPS
 12171030         /* do this if there is no special hardware support for fields */
 12181031 
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-10-02 14:30 +0200