BSD 4 release
[unix-history] / usr / src / cmd / as / asscan.h
index 71e8d4c..61dc627 100644 (file)
@@ -1,43 +1,30 @@
-/* Copyright (c) 1979 Regents of the University of California */
-
+/* Copyright (c) 1980 Regents of the University of California */
+/* "@(#)asscan.h 4.3 8/15/80" */
 /*
  *     The character scanner is called to fill up one token buffer
  *
 /*
  *     The character scanner is called to fill up one token buffer
  *
- *     In the first pass, the tokens in this buffer may be overwriten
- *     to eliminate .stabs, and to change fully assemblable instructions
- *     into ascii strings.  However, once the tokens are filled up by the
+ *     However, once the tokens are filled up by the
  *     character scanner, they are used in both the first and the second
  *     character scanner, they are used in both the first and the second
- *     pass.  Holes created by .stab removal and preassembly are replaced
+ *     pass.  Holes created by .stab removal are replaced
  *     with 'skip' tokens that direct the second pass to ignore the
  *     following tokens.
  *     with 'skip' tokens that direct the second pass to ignore the
  *     following tokens.
- *
- *     While the first pass could write a second version of the intermediate
- *     file and really purge the .stabs and such, the buffering required
- *     to do this seems to be too complex and too slow.
  */
 
  */
 
-#define TOKBUFLG               2*BUFSIZ
+#define TOKBUFLG               BUFSIZ
 #define MAXVAX                 32              
 #define MAXVAX                 32              
-#define SAFETY                 2*NCPS
+#define SAFETY                 16
 
 #define AVAILTOKS              TOKBUFLG -\
 
 #define AVAILTOKS              TOKBUFLG -\
-               sizeof(short) -\
+               sizeof(int) -\
                sizeof (struct tokbufdesc *) -\
                MAXVAX - SAFETY
 
 struct tokbufdesc{
                sizeof (struct tokbufdesc *) -\
                MAXVAX - SAFETY
 
 struct tokbufdesc{
-       short           tok_count;              /*absolute byte length*/
+       int             tok_count;              /*absolute byte length*/
        struct          tokbufdesc *tok_next;
        char            toks[AVAILTOKS];
        char            bufovf[MAXVAX + SAFETY];
 };
        struct          tokbufdesc *tok_next;
        char            toks[AVAILTOKS];
        char            bufovf[MAXVAX + SAFETY];
 };
-
-/*
- *     All variables handling these resources are local to astmpfil.c;
- *     we must have the structure defnitions here so that
- *     asscan.c can touch the stuff in a token buffer
- */
-
 /*
  *     Definitions for handling tokens in the intermediate file
  *     buffers.
 /*
  *     Definitions for handling tokens in the intermediate file
  *     buffers.
@@ -62,11 +49,11 @@ typedef short lgtype;                       /*for storing length of strings or skiping*/
 #define        puchar(ptr,val)         *ptr++  = val
 
 #define        pshort(ptr,val)         *(short *)ptr=val,      ptr += sizeof(short)
 #define        puchar(ptr,val)         *ptr++  = val
 
 #define        pshort(ptr,val)         *(short *)ptr=val,      ptr += sizeof(short)
-#define        pushort(ptr,val)        *(unsigned short *)ptr=val, ptr += sizeof(short)
+#define        pushort(ptr,val)        *(unsigned short *)ptr=val,     ptr += sizeof(short)
 #define        pint(ptr,val)           *(int *)ptr  = val,     ptr += sizeof(int)
 #define        pint(ptr,val)           *(int *)ptr  = val,     ptr += sizeof(int)
-#define        puint(ptr,val)          *(unsigned int *)ptr=val, ptr += sizeof(int)
+#define        puint(ptr,val)          *(unsigned int *)ptr=val,       ptr += sizeof(int)
 #define        plong(ptr,val)          *(long *)ptr  = val,    ptr += sizeof(long)
 #define        plong(ptr,val)          *(long *)ptr  = val,    ptr += sizeof(long)
-#define        pulong(ptr,val)         *(unsigned long *)ptr=val,ptr += sizeof(long)
+#define        pulong(ptr,val)         *(unsigned long *)ptr=val,      ptr += sizeof(long)
 #define        pfloat(ptr,val)         *(float *)ptr  = val,   ptr += sizeof (float)
 #define        pdouble(ptr,val)        *(double *)ptr  = val,  ptr += sizeof (double)
 #define        pptr(ptr,val)           *(int *)ptr  = (val),   ptr += sizeof(ptrall)
 #define        pfloat(ptr,val)         *(float *)ptr  = val,   ptr += sizeof (float)
 #define        pdouble(ptr,val)        *(double *)ptr  = val,  ptr += sizeof (double)
 #define        pptr(ptr,val)           *(int *)ptr  = (val),   ptr += sizeof(ptrall)
@@ -91,8 +78,8 @@ typedef short lgtype;                 /*for storing length of strings or skiping*/
 #define        gskiplg(val, ptr)       val = *(lgtype *)ptr, ptr += sizeof (short)
 
 
 #define        gskiplg(val, ptr)       val = *(lgtype *)ptr, ptr += sizeof (short)
 
 
-ptrall tokptr; /*the next token to consume, call by copy*/
-ptrall tokub;  /*current upper bound in the current buffer*/
+extern ptrall tokptr;  /*the next token to consume, call by copy*/
+extern ptrall tokub;   /*current upper bound in the current buffer*/
 
 /*
  *     Strings are known for their characters and for their length.
 
 /*
  *     Strings are known for their characters and for their length.
@@ -113,6 +100,7 @@ struct strdesc{
        char            str[MAXSTRLG];
 };
 
        char            str[MAXSTRLG];
 };
 
-struct         strdesc         strbuf[3];
-struct         strdesc         *strptr;        /*points to the current string*/
-int                    strno;          /*the current string being filled*/
+extern struct  strdesc         strbuf[3];
+extern struct  strdesc         *strptr;        /*points to the current string*/
+extern int                     strno;          /*the current string being filled*/
+char   *savestr();