Annotation of researchv9/jerq/sgs/ld/expr0.c, revision 1.1.1.1

1.1       root        1: static char ID[] = "@(#) expr0.c: 1.3 3/13/83";
                      2: #include "system.h"
                      3: 
                      4: #include <stdio.h>
                      5: #include "structs.h"
                      6: #include "extrns.h"
                      7: #include "sgsmacros.h"
                      8: #include "y.tab.h"
                      9: #include "ldmacros.h"
                     10: /*eject*/
                     11: ENODE *
                     12: buildtree(op,l,r)
                     13: int op;
                     14: ENODE *l,*r; 
                     15: {
                     16:  
                     17: /*
                     18:  * Build a node in the expression tree and
                     19:  * return a pointer to it
                     20:  */
                     21: 
                     22:        register ENODE *p;
                     23: 
                     24:        p = (ENODE *) myalloc(sizeof(ENODE));
                     25: 
                     26:        p->gnode.exop = op;
                     27:        p->gnode.exleft = l;
                     28:        p->gnode.exright = r;
                     29:        return(p);
                     30: }
                     31: /*eject*/
                     32: ENODE *
                     33: symnode(symp)
                     34: char *symp;
                     35: {
                     36: 
                     37: /*
                     38:  * Build an expression node for NAME or DOT
                     39:  */
                     40: 
                     41:        register ENODE *p;
                     42: 
                     43: #if ONEPROC
                     44:        SYMENT sym;
                     45: #endif
                     46: 
                     47:        p = (ENODE *) myalloc(sizeof(ENODE));
                     48: 
                     49:        if( symp == NULL ) {            /* special DOT symbol */
                     50:                p->pnnode.exop = DOT;
                     51:                }
                     52:        else {
                     53: #if ONEPROC
                     54:                p->nnode.exop = NAME;
                     55:                zero( (char *) &sym, SYMESZ );
                     56: #if FLEXNAMES
                     57:                if (strlen(symp) > 8) {
                     58:                        sym.n_zeroes = 0L;
                     59:                        sym.n_nptr = symp;
                     60:                        }
                     61:                else
                     62: #endif
                     63:                        copy(sym.n_name,symp,8);
                     64:                sym.n_type = T_INT;
                     65:                sym.n_sclass = C_EXT;
                     66:                p->nnode.exsymptr = putsym(makesym(&sym, NULL),1);
                     67: #else
                     68:                p->pnnode.exop = NAME;
                     69:                copy(p->pnnode.symbol,symp,8);
                     70: #endif
                     71:                }
                     72: 
                     73:        return(p);
                     74: }
                     75: /*eject*/
                     76: ENODE *
                     77: cnstnode(val)
                     78: long val;
                     79: {
                     80: 
                     81: /*
                     82:  * Build an expression node for a constant
                     83:  */
                     84: 
                     85:        register ENODE *p;
                     86: 
                     87:        p = (ENODE *) myalloc(sizeof(ENODE));
                     88: 
                     89:        p->vnode.exop = INT;
                     90:        p->vnode.exvalue = val;
                     91: 
                     92:        return(p);
                     93: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.