Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.12
 
1.13
 
MAIN:ragge:20021123160646
 
pftn.c
_>15181518         if( commflag ) commdec( p->tn.rval );
 15191519 }
 15201520 
<> 1521+NODE *
  1522+typenode(NODE *p)
  1523+{
  1524+        int class = 0, adj, noun, sign;
  1525+
  1526+        adj = INT;      /* INT, LONG or SHORT */
  1527+        noun = UNDEF;   /* INT, CHAR or FLOAT */
  1528+        sign = 0;       /* 0, SIGNED or UNSIGNED */
  1529+
  1530+        if (p->in.op == TYPE && p->in.type == UNDEF && p->in.left == NIL)
  1531+                return p; /* For void in prototype t(void); */
  1532+
  1533+        while (p != NIL) {
  1534+                if (p->in.op == QUALIFIER) /* Skip const/volatile */
  1535+                        goto next;
  1536+                if (p->in.op == CLASS) {
  1537+                        if (class != 0)
  1538+                                uerror("too many storage classes");
  1539+                        class = p->in.type;
  1540+                        goto next;
  1541+                }
  1542+                if (p->in.op != TYPE)
  1543+                        cerror("typenode got notype %d", p->in.op);
  1544+                switch (p->in.type) {
  1545+                case SIGNED:
  1546+                case UNSIGNED:
  1547+                        if (sign != 0)
  1548+                                goto bad;
  1549+                        sign = p->in.type;
  1550+                        break;
  1551+                case LONG:
  1552+                        if (adj == LONG) {
  1553+                                adj = LONGLONG;
  1554+                                break;
  1555+                        }
  1556+                        /* FALLTHROUGH */
  1557+                case SHORT:
  1558+                        if (adj != INT)
  1559+                                goto bad;
  1560+                        adj = p->in.type;
  1561+                        break;
  1562+                case INT:
  1563+                case CHAR:
  1564+                case FLOAT:
  1565+                        if (noun != UNDEF)
  1566+                                goto bad;
  1567+                        noun = p->in.type;
  1568+                        break;
  1569+                default:
  1570+                        goto bad;
  1571+                }
  1572+        next:
  1573+                p->in.op = FREE;
  1574+                p = p->in.left;
  1575+        }
  1576+
  1577+        if (noun == UNDEF) {
  1578+                noun = INT;
  1579+        } else if (noun == FLOAT) {
  1580+                if (sign != 0 || adj == SHORT)
  1581+                        goto bad;
  1582+                noun = (adj == LONG ? DOUBLE : FLOAT);
  1583+        } else if (noun == CHAR && adj != INT)
  1584+                goto bad;
  1585+
  1586+        if (adj != INT)
  1587+                noun = adj;
  1588+        if (sign == UNSIGNED)
  1589+                noun += (UNSIGNED-INT);
  1590+
  1591+        p = block(TYPE, NIL, NIL, noun, 0, 0);
  1592+        p->in.su = class;
  1593+        return p;
  1594+
  1595+bad:    uerror("illegal type combination");
  1596+        return mkty(INT, 0, 0);
  1597+}
  1598+
<_15211599 /*
 15221600  * Return a basic type from basic types t1, t2, t3 and t4.
 15231601  */
FishEye: Open Source License registered to PCC.
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-12-20 16:51 +0100