date and time created 88/10/21 13:47:49 by bostic
[unix-history] / usr / src / old / as.vax / asscan1.c
index b9a8618..5d55fff 100644 (file)
@@ -1,13 +1,16 @@
 /*
 /*
- *     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[] = "@(#)asscan1.c 4.2 %G%";
+static char sccsid[] = "@(#)asscan1.c  5.1 (Berkeley) %G%";
 #endif not lint
 
 #include "asscanl.h"
 
 #endif not lint
 
 #include "asscanl.h"
 
-inittmpfile()
+inittokfile()
 {
        if (passno == 1){
                if (useVM){
 {
        if (passno == 1){
                if (useVM){
@@ -27,7 +30,7 @@ inittmpfile()
        tokub = 0;
 }
 
        tokub = 0;
 }
 
-closetmpfile()
+closetokfile()
 {
        if (passno == 1){
                if (useVM){
 {
        if (passno == 1){
                if (useVM){
@@ -38,7 +41,7 @@ closetmpfile()
                         *      written out yet
                         */
                        if (tokbuf[bufno ^ 1].tok_count >= 0){
                         *      written out yet
                         */
                        if (tokbuf[bufno ^ 1].tok_count >= 0){
-                               if (writeTEST((char *)&tokbuf[bufno ^ 1], sizeof *emptybuf, 1, tmpfil)){
+                               if (writeTEST((char *)&tokbuf[bufno ^ 1], sizeof *emptybuf, 1, tokfile)){
                                  badwrite:
                                        yyerror("Unexpected end of file writing the interpass tmp file");
                                exit(2);
                                  badwrite:
                                        yyerror("Unexpected end of file writing the interpass tmp file");
                                exit(2);
@@ -50,7 +53,7 @@ closetmpfile()
                         *      in the argument list
                         */
                        tokbuf[bufno].toks[tokbuf[bufno].tok_count++] = PARSEEOF;
                         *      in the argument list
                         */
                        tokbuf[bufno].toks[tokbuf[bufno].tok_count++] = PARSEEOF;
-                       if (writeTEST((char *)&tokbuf[bufno], sizeof *emptybuf, 1, tmpfil))
+                       if (writeTEST((char *)&tokbuf[bufno], sizeof *emptybuf, 1, tokfile))
                                goto badwrite;
                }
        }       /*end of being pass 1*/
                                goto badwrite;
                }
        }       /*end of being pass 1*/
@@ -125,14 +128,6 @@ inttoktype yylex()
                case    VOID:   
                                goto top;
                case    STRING:
                case    VOID:   
                                goto top;
                case    STRING:
-                               strptr = &strbuf[strno ^= 1];
-                               strptr->str_lg = *((lgtype *)bufptr);
-                               movestr(&strptr->str[0],
-                                       (char *)bufptr + sizeof(lgtype),
-                                       strptr->str_lg);
-                               eatstrlg(bufptr);
-                               yylval = (int)strptr;
-                               break;
                case    ISTAB:
                case    ISTABSTR:
                case    ISTABNONE:
                case    ISTAB:
                case    ISTABSTR:
                case    ISTABNONE:
@@ -156,7 +151,7 @@ inttoktype yylex()
                case    BIGNUM: bignumprint(((struct exp*)yylval)->e_number);
                                break;
                case    NAME:   printf("\"%.8s\"",
                case    BIGNUM: bignumprint(((struct exp*)yylval)->e_number);
                                break;
                case    NAME:   printf("\"%.8s\"",
-                                       ((struct symtab *)yylval)->s_name);
+                                       FETCHNAME((struct symtab *)yylval));
                                break;
                case    REG:    printf(" r%d",
                                        yylval);
                                break;
                case    REG:    printf(" r%d",
                                        yylval);
@@ -164,15 +159,22 @@ inttoktype yylex()
                case    IJXXX:
                case    INST0:  
                case    INSTn:  if (ITABCHECK(yyopcode))
                case    IJXXX:
                case    INST0:  
                case    INSTn:  if (ITABCHECK(yyopcode))
-                                       printf("%.8s", ITABFETCH(yyopcode)->s_name);
+                                       printf("%.8s",
+                                               FETCHNAME(ITABFETCH(yyopcode)));
                                else
                                        printf("IJXXX or INST0 or INSTn can't get into the itab\n");
                                break;
                                else
                                        printf("IJXXX or INST0 or INSTn can't get into the itab\n");
                                break;
-               case    STRING: printf("length %d ",
-                                       ((struct strdesc *)yylval)->str_lg);
-                               printf("value\"%s\"",
-                                       ((struct strdesc *)yylval)->str);
-                               break;
+               case    STRING:
+                       printf("length %d, seekoffset %d, place 0%o ",
+                               ((struct strdesc *)yylval)->sd_strlen,
+                               ((struct strdesc *)yylval)->sd_stroff,
+                               ((struct strdesc *)yylval)->sd_place
+                               );
+                       if (((struct strdesc *)yylval)->sd_place & STR_CORE)
+                               printf("value\"%*s\"",
+                                       ((struct strdesc *)yylval)->sd_strlen,
+                                       ((struct strdesc *)yylval)->sd_string);
+                       break;
                }               /*end of the debug switch*/
                printf("\n");
                }
                }               /*end of the debug switch*/
                printf("\n");
                }
@@ -216,14 +218,14 @@ inttoktype yylex()
                         *      out at all
                         */
                        if (emptybuf->tok_count >= 0){
                         *      out at all
                         */
                        if (emptybuf->tok_count >= 0){
-                           if (writeTEST((char *)emptybuf, sizeof *emptybuf, 1, tmpfil)){
+                           if (writeTEST((char *)emptybuf, sizeof *emptybuf, 1, tokfile)){
                                yyerror("Unexpected end of file writing the interpass tmp file");
                                exit(2);
                            }
                        }
                        scan_dot_s(emptybuf);
                } else {        /*pass 2*/
                                yyerror("Unexpected end of file writing the interpass tmp file");
                                exit(2);
                            }
                        }
                        scan_dot_s(emptybuf);
                } else {        /*pass 2*/
-                   if (readTEST((char *)emptybuf, sizeof *emptybuf, 1, tmpfil)){
+                   if (readTEST((char *)emptybuf, sizeof *emptybuf, 1, tokfile)){
                         badread:
                             yyerror("Unexpected end of file while reading the interpass tmp file");
                             exit(1);
                         badread:
                             yyerror("Unexpected end of file while reading the interpass tmp file");
                             exit(1);
@@ -301,13 +303,15 @@ buildskip(from, to)
 }
 
 movestr(to, from, lg)
 }
 
 movestr(to, from, lg)
-       register        char    *to, *from;
-       register        int     lg;
+       char    *to;    /* 4(ap) */ 
+       char    *from;  /* 8(ap) */
+       int     lg;     /* 12(ap) */
 {
 {
-       if (lg <= 0) return;
-       do
-               *to++ = *from++;
-       while (--lg);
+       if (lg <= 0)
+               return;
+       ;
+       asm("movc3      12(ap),*8(ap),*4(ap)");
+       ;
 }
 
 new_dot_s(namep)
 }
 
 new_dot_s(namep)
@@ -319,3 +323,8 @@ new_dot_s(namep)
        lineno = 1;
        scanlineno = 1;
 }
        lineno = 1;
        scanlineno = 1;
 }
+
+min(a, b)
+{
+       return(a < b ? a : b);
+}