Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.9
 
1.10
 
MAIN:ragge:20021210221325
 
trees.c
_>843843 }
 844844 
 845845 NODE *
<>846 -stref( p ) register NODE *p; {
 847 -
  846+stref(NODE *p)
  847+{
848848         TWORD t;
 849849         int d, s, dsc, align;
 850850         OFFSZ off;
     
 !
856856         q = &stab[p->in.right->tn.rval];
 857857         p->in.right->in.op = FREE;
 858858         p->in.op = FREE;
<>859 -        p = pconvert( p->in.left );
  859+        p = pconvert(p->in.left);
860860 
 861861         /* make p look like ptr to x */
 862862 
<>863 -        if( !ISPTR(p->in.type)){
  863+        if (!ISPTR(p->in.type))
864864                 p->in.type = PTR+UNIONTY;
<>865 -                }
866865 
<>867 -        t = INCREF( q->stype );
  866+        t = INCREF(q->stype);
868867         d = q->dimoff;
 869868         s = q->sizoff;
 870869 
<>871 -        p = makety( p, t, d, s );
  870+        p = makety(p, t, d, s);
872871 
 873872         /* compute the offset to be added */
 874873 
 875874         off = q->offset;
 876875         dsc = q->sclass;
 877876 
<>878 -        if( dsc & FIELD ) {  /* normalize offset */
  877+        if (dsc & FIELD) {  /* normalize offset */
879878                 align = ALINT;
 880879                 s = INT;
 881880                 off = (off/align)*align;
<>882 -                }
 883 -        if( off != 0 ) p = clocal( block( PLUS, p, offcon( off, t, d, s ), t, d, s ) );
  881+        }
  882+        if (off != 0)
  883+                p = clocal(block(PLUS, p, offcon(off, t, d, s), t, d, s));
884884 
<>885 -        p = buildtree( UNARY MUL, p, NIL );
  885+        p = buildtree(UNARY MUL, p, NIL);
886886 
 887887         /* if field, build field info */
 888888 
<>889 -        if( dsc & FIELD ){
 890 -                p = block( FLD, p, NIL, q->stype, 0, q->sizoff );
 891 -                p->tn.rval = PKFIELD( dsc&FLDSIZ, q->offset%align );
 892 -                }
 893 -
 894 -        return( clocal(p) );
  889+        if (dsc & FIELD) {
  890+                p = block(FLD, p, NIL, q->stype, 0, q->sizoff);
  891+                p->tn.rval = PKFIELD(dsc&FLDSIZ, q->offset%align);
895892         }
 896893 
<> 894+        return(clocal(p));
  895+}
  896+
897897 int
 898898 notlval(p) register NODE *p; {
 899899 
     
 !
937937         }
 938938 
 939939 NODE *
<>940 -bpsize(p) register NODE *p; {
 941 -        return( offcon( psize(p), p->in.type, p->fn.cdim, p->fn.csiz ) );
 942 -        }
  940+bpsize(NODE *p)
  941+{
  942+        return(offcon(psize(p), p->in.type, p->fn.cdim, p->fn.csiz));
  943+}
943944 
<> 945+/*
  946+ * p is a node of type pointer; psize returns the
  947+ * size of the thing pointed to
  948+ */
944949 OFFSZ
<>945 -psize( p ) NODE *p; {
 946 -        /* p is a node of type pointer; psize returns the
 947 -           size of the thing pointed to */
  950+psize(NODE *p)
  951+{
948952 
<>949 -        if( !ISPTR(p->in.type) ){
 950 -                uerror( "pointer required");
 951 -                return( SZINT );
 952 -                }
 953 -        /* note: no pointers to fields */
 954 -        return( tsize( DECREF(p->in.type), p->fn.cdim, p->fn.csiz ) );
  953+        if (!ISPTR(p->in.type)) {
  954+                uerror("pointer required");
  955+                return(SZINT);
955956         }
<> 957+        /* note: no pointers to fields */
  958+        return(tsize(DECREF(p->in.type), p->fn.cdim, p->fn.csiz));
  959+}
956960 
<> 961+/*
  962+ * convert an operand of p
  963+ * f is either CVTL or CVTR
  964+ * operand has type int, and is converted by the size of the other side
  965+ */
957966 NODE *
<>958 -convert( p, fregister NODE *p; {
 959 -        /convert an operand of p
 960 -            f is either CVTL or CVTR
 961 -            operand has type int, and is converted by the size of the other side
 962 -            */
  967+convert(NODE *p, int f)
  968+{
  969+        NODE *q, *r, *s;
963970 
<>964 -        register NODE *q, *r;
  971+        q = (f == CVTL) ? p->in.left : p->in.right;
965972 
<>966 -        q = (f==CVTL)?p->in.left:p->in.right;
 967 -
 968 -        r = block( PMCONV,
 969 -                q, bpsize(f==CVTL?p->in.right:p->in.left), INT, 0, INT );
  973+        s = bpsize(f == CVTL ? p->in.right : p->in.left);
  974+        r = block(PMCONV, q, s, INT, 0, INT);
970975         r = clocal(r);
<>971 -        if( f == CVTL )
  976+        if (f == CVTL)
972977                 p->in.left = r;
 973978         else
 974979                 p->in.right = r;
 975980         return(p);
<> 981+}
976982 
<>977 -        }
 978 -
979983 #ifndef econvert
 980984 void
 981985 econvert( p ) register NODE *p; {
     
 !
13091313         return(val);
 13101314 }
 13111315 
<>1312 -/*      the intent of this table is to examine the
 1313 -        operators, and to check them for
 1314 -        correctness.
  1316+/*
  1317+ * the intent of this table is to examine the
  1318+ * operators, and to check them for
  1319+ * correctness.
  1320+ *
  1321+ * The table is searched for the op and the
  1322+ * modified type (where this is one of the
  1323+ * types INT (includes char and short), LONG,
  1324+ * DOUBLE (includes FLOAT), and POINTER
  1325+ *
  1326+ * The default action is to make the node type integer
  1327+ *
  1328+ * The actions taken include:
  1329+ *      PUN       check for puns
  1330+ *      CVTL      convert the left operand
  1331+ *      CVTR      convert the right operand
  1332+ *      TYPL      the type is determined by the left operand
  1333+ *      TYPR      the type is determined by the right operand
  1334+ *      TYMATCH   force type of left and right to match,by inserting conversions
  1335+ *      PTMATCH   like TYMATCH, but for pointers
  1336+ *      LVAL      left operand must be lval
  1337+ *      CVTO      convert the op
  1338+ *      NCVT      do not convert the operands
  1339+ *      OTHER     handled by code
  1340+ *      NCVTR     convert the left operand, not the right...
  1341+ *
  1342+ */
13151343 
<>1316 -        The table is searched for the op and the
 1317 -        modified type (where this is one of the
 1318 -        types INT (includes char and short), LONG,
 1319 -        DOUBLE (includes FLOAT), and POINTER
  1344+# define MINT 01        /* integer */
  1345+# define MDBI 02        /* integer or double */
  1346+# define MSTR 04        /* structure */
  1347+# define MPTR 010       /* pointer */
  1348+# define MPTI 020       /* pointer or integer */
  1349+# define MENU 040       /* enumeration variable or member */
  1350+# define MVOID 0100000  /* void type */
13201351 
<>1321 -        The default action is to make the node type integer
 1322 -
 1323 -        The actions taken include:
 1324 -                PUN       check for puns
 1325 -                CVTL      convert the left operand
 1326 -                CVTR      convert the right operand
 1327 -                TYPL      the type is determined by the left operand
 1328 -                TYPR      the type is determined by the right operand
 1329 -                TYMATCH   force type of left and right to match, by inserting conversions
 1330 -                PTMATCH   like TYMATCH, but for pointers
 1331 -                LVAL      left operand must be lval
 1332 -                CVTO      convert the op
 1333 -                NCVT      do not convert the operands
 1334 -                OTHER     handled by code
 1335 -                NCVTR     convert the left operand, not the right...
 1336 -
 1337 -        */
 1338 -
 1339 -# define MINT 01  /* integer */
 1340 -# define MDBI 02   /* integer or double */
 1341 -# define MSTR 04  /* structure */
 1342 -# define MPTR 010  /* pointer */
 1343 -# define MPTI 020  /* pointer or integer */
 1344 -# define MENU 040 /* enumeration variable or member */
 1345 -# define MVOID 0100000 /* void type */
 1346 -
13471352 int
<>1348 -opact( p )  NODE *p; {
 1349 -
  1353+opact(NODE *p)
  1354+{
13501355         int mt12, mt1, mt2, o;
 13511356 
 13521357         mt1 = mt2 = mt12 = 0;
 13531358 
<>1354 -        switch( optype(o=p->in.op) ){
 1355 -
  1359+        switch (optype(o = p->in.op)) {
13561360         case BITYPE:
<>1357 -                mt2 = moditype( p->in.right->in.type );
  1361+                mt2 = moditype(p->in.right->in.type);
13581362         case UTYPE:
<>1359 -                mt1 = moditype( p->in.left->in.type );
  1363+                mt1 = moditype(p->in.left->in.type);
13601364                 break;
<> 1365+        }
13611366 
<>1362 -                }
 1363 -
13641367         if( ((mt1 | mt2) & MVOID) &&
 13651368             o != COMOP &&
 13661369             o != COLON &&
 13671370             !(o == QUEST && (mt1 & MVOID) == 0) &&
 13681371             !(o == CAST && (mt1 & MVOID)) ){
 13691372                 /* if lhs of RETURN is void, grammar will complain */
<>1370 -                if( o != RETURN )
 1371 -                        uerror( "value of void expression used" );
  1373+                if (o != RETURN)
  1374+                        uerror("value of void expression used");
13721375                 return( NCVT );
<>1373 -                }
  1376+        }
13741377         mt12 = mt1 & mt2;
 13751378 
 13761379         switch( o ){
     
 !
14891492         case ASG AND:
 14901493         case ASG OR:
 14911494         case ASG ER:
<>1492 -                if( mt12 & MINT ) return( LVAL+TYMATCH );
  1495+                if (mt12 & MINT)
  1496+                        return(LVAL+TYMATCH);
14931497                 break;
 14941498 
 14951499         case ASG PLUS:
 14961500         case ASG MINUS:
 14971501         case INCR:
 14981502         case DECR:
<>1499 -                if( mt12 & MDBI ) return( TYMATCH+LVAL );
 1500 -                else if( (mt1&MPTR) && (mt2&MINT) ) return( TYPL+LVAL+CVTR );
  1503+                if (mt12 & MDBI)
  1504+                        return(TYMATCH+LVAL);
  1505+                else if ((mt1&MPTR) && (mt2&MINT))
  1506+                        return(TYPL+LVAL+CVTR);
15011507                 break;
 15021508 
 15031509         case MINUS:
<>1504 -                if( mt12 & MPTR ) return( CVTO+PTMATCH+PUN );
 1505 -                if( mt2 & MPTR ) break;
  1510+                if (mt12 & MPTR)
  1511+                        return(CVTO+PTMATCH+PUN);
  1512+                if (mt2 & MPTR)
  1513+                        break;
  1514+                /* FALLTHROUGH */
15061515         case PLUS:
<>1507 -                if( mt12 & MDBI ) return( TYMATCH );
 1508 -                else if( (mt1&MPTR) && (mt2&MINT) ) return( TYPL+CVTR );
 1509 -                else if( (mt1&MINT) && (mt2&MPTR) ) return( TYPR+CVTL );
  1516+                if (mt12 & MDBI)
  1517+                        return(TYMATCH);
  1518+                else if ((mt1&MPTR) && (mt2&MINT))
  1519+                        return(TYPL+CVTR);
  1520+                else if ((mt1&MINT) && (mt2&MPTR))
  1521+                        return(TYPR+CVTL);
15101522 
<>1511 -                }
 1512 -        if( mt12 == MSTR )
 1513 -                uerror( "%s is not a permitted struct/union operation", opst[o] );
 1514 -        else
 1515 -                uerror( "operands of %s have incompatible types", opst[o] );
 1516 -        return( NCVT );
15171523         }
<> 1524+        if (mt12 == MSTR)
  1525+                uerror("%s is not a permitted struct/union operation", opst[o]);
  1526+        else
  1527+                uerror("operands of %s have incompatible types", opst[o]);
  1528+        return(NCVT);
  1529+}
15181530 
 15191531 int
<>1520 -moditype( ty ) TWORD ty; {
  1532+moditype(TWORD ty)
  1533+{
  1534+        switch (ty) {
15211535 
<>1522 -        switch( ty ){
 1523 -
15241536         case UNDEF:
 15251537                 return( MVOID );
 15261538         case ENUMTY:
     
 !
15491561         default:
 15501562                 return( MPTR|MPTI );
 15511563 
<>1552 -                }
15531564         }
<> 1565+}
<_15541566 
 15551567 NODE *
 15561568 doszof( pregister NODE *p; {
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-11-01 12:15 +0100