date and time created 88/07/22 16:08:01 by bostic
[unix-history] / usr / src / old / as.vax / asparse.c
index 929f910..5ebcefd 100644 (file)
@@ -1,8 +1,11 @@
 /*
 /*
- *     Copyright (c) 1982 Regents of the University of California
+ * Copyright (c) 1982 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
  */
  */
+
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)asparse.c 4.18 %G%";
+static char sccsid[] = "@(#)asparse.c  5.3 (Berkeley) %G%";
 #endif not lint
 
 #include <stdio.h>
 #endif not lint
 
 #include <stdio.h>
@@ -137,7 +140,7 @@ yyparse()
                        }
 restlab:
                        shift;
                        }
 restlab:
                        shift;
-                       flushfield(NBPW/4);
+                       flushfield(NBWD/4);
                        if ((np->s_type&XTYPE)!=XUNDEF) {
                                if (  (np->s_type&XTYPE) != dotp->e_xtype 
                                   || np->s_value != dotp->e_xvalue
                        if ((np->s_type&XTYPE)!=XUNDEF) {
                                if (  (np->s_type&XTYPE) != dotp->e_xtype 
                                   || np->s_value != dotp->e_xvalue
@@ -275,7 +278,7 @@ restlab:
        }
        if (seg_type == IDATA)
                seg_number += NLOC;
        }
        if (seg_type == IDATA)
                seg_number += NLOC;
-       flushfield(NBPW/4);
+       flushfield(NBWD/4);
        dotp = &usedot[seg_number];
        if (passno==2) {        /* go salt away in pass 2*/
                txtfil = usefile[seg_number];
        dotp = &usedot[seg_number];
        if (passno==2) {        /* go salt away in pass 2*/
                txtfil = usefile[seg_number];
@@ -291,10 +294,10 @@ restlab:
         *      exprlist:  empty | exprlist outexpr
         *      outexpr:   <expr> | <expr> : <expr>
         */
         *      exprlist:  empty | exprlist outexpr
         *      outexpr:   <expr> | <expr> : <expr>
         */
-   case IBYTE: curlen = NBPW/4; goto elist;
-   case IWORD: curlen = NBPW/2; goto elist;
-   case IINT:  curlen = NBPW;   goto elist;
-   case ILONG: curlen = NBPW;   goto elist;
+   case IBYTE: curlen = NBWD/4; goto elist;
+   case IWORD: curlen = NBWD/2; goto elist;
+   case IINT:  curlen = NBWD;   goto elist;
+   case ILONG: curlen = NBWD;   goto elist;
 
    elist:
        seg_type = val;
 
    elist:
        seg_type = val;
@@ -335,9 +338,9 @@ restlab:
                        if (bitoff)
                                yyerror("Illegal relocation in field");
                        switch(curlen){
                        if (bitoff)
                                yyerror("Illegal relocation in field");
                        switch(curlen){
-                               case NBPW/4:    reloc_how = TYPB; break;
-                               case NBPW/2:    reloc_how = TYPW; break;
-                               case NBPW:      reloc_how = TYPL; break;
+                               case NBWD/4:    reloc_how = TYPB; break;
+                               case NBWD/2:    reloc_how = TYPW; break;
+                               case NBWD:      reloc_how = TYPL; break;
                        }
                        if (passno == 1){
                                dotp->e_xvalue += ty_nbyte[reloc_how];
                        }
                        if (passno == 1){
                                dotp->e_xvalue += ty_nbyte[reloc_how];
@@ -369,7 +372,7 @@ restlab:
        }       /* there existed an expression at all */
 
        flushfield(curlen);
        }       /* there existed an expression at all */
 
        flushfield(curlen);
-       if ( ( curlen == NBPW/4) && bitoff)
+       if ( ( curlen == NBWD/4) && bitoff)
                dotp->e_xvalue ++;
        break;
        /*end of case IBYTE, IWORD, ILONG, IINT*/
                dotp->e_xvalue ++;
        break;
        /*end of case IBYTE, IWORD, ILONG, IINT*/
@@ -381,7 +384,7 @@ restlab:
                yyerror("Space size not absolute");
        space_value = locxp->e_xvalue;
   ospace:
                yyerror("Space size not absolute");
        space_value = locxp->e_xvalue;
   ospace:
-       flushfield(NBPW/4);
+       flushfield(NBWD/4);
        {
                static char spacebuf[128];
                while (space_value > sizeof(spacebuf)){
        {
                static char spacebuf[128];
                while (space_value > sizeof(spacebuf)){
@@ -414,10 +417,9 @@ restlab:
        expr(locxp, val);
        if (passno == 2 && (locxp->e_xtype & XTYPE) != XABS)    /* tekmdp */
                yyerror("Fill value not absolute");
        expr(locxp, val);
        if (passno == 2 && (locxp->e_xtype & XTYPE) != XABS)    /* tekmdp */
                yyerror("Fill value not absolute");
-       flushfield(NBPW/4);
-       if (passno == 1) {
-               dotp->e_xvalue += fill_rep * fill_size;
-       } else {
+       flushfield(NBWD/4);
+       dotp->e_xvalue += fill_rep * fill_size;
+       if (passno == 2) {
                while(fill_rep-- > 0)
                        bwrite((char *)&locxp->e_xvalue, fill_size, txtfil);
        }
                while(fill_rep-- > 0)
                        bwrite((char *)&locxp->e_xvalue, fill_size, txtfil);
        }
@@ -434,7 +436,7 @@ restlab:
         */
        while (val == STRING){
                int     mystrlen;
         */
        while (val == STRING){
                int     mystrlen;
-               flushfield(NBPW/4);
+               flushfield(NBWD/4);
                if (bitoff)
                        dotp->e_xvalue++;
                stringp = (struct strdesc *)yylval;
                if (bitoff)
                        dotp->e_xvalue++;
                stringp = (struct strdesc *)yylval;
@@ -536,7 +538,11 @@ restlab:
                stpt->s_value = locxp->e_xvalue;
                stpt->s_index = dotp - usedot;
                if (exprisname){
                stpt->s_value = locxp->e_xvalue;
                stpt->s_index = dotp - usedot;
                if (exprisname){
+                       stpt->s_type = locxp->e_xtype;
                        switch(stpt->s_ptype){
                        switch(stpt->s_ptype){
+                               case N_LCSYM:
+                                       stpt->s_dest = (struct symtab *)exprisname;
+                                       stpt->s_type |= STABFLAG;
                                case N_GSYM:
                                case N_FNAME:
                                case N_RSYM:
                                case N_GSYM:
                                case N_FNAME:
                                case N_RSYM: