The string pool is maintained both in core, and in a second tmp file.
[unix-history] / usr / src / old / as.vax / as.h
index 75f1ea5..f9e7dbb 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *     Copyright (c) 1982 Regents of the University of California
 /*
  *     Copyright (c) 1982 Regents of the University of California
- *     @(#)as.h 4.11 %G%
+ *     @(#)as.h 4.15 %G%
  */
 #ifdef VMS
 # define       vax     1
  */
 #ifdef VMS
 # define       vax     1
 #define        NHASH           1103    /* hash table is dynamically extended */
 #define        TNAMESIZE       32      /* maximum length of temporary file names */
 #define        NLOC            4       /* number of location ctrs */
 #define        NHASH           1103    /* hash table is dynamically extended */
 #define        TNAMESIZE       32      /* maximum length of temporary file names */
 #define        NLOC            4       /* number of location ctrs */
-
+/*
+ *     Sizes for character buffers.
+ *     what                    size #define name       comments
+ *
+ *     source file reads       ASINBUFSIZ              integral of BUFSIZ
+ *     string assembly         NCPString               large for .stabs
+ *     name assembly           NCPName                 depends on FLEXNAMES
+ *     string save             STRPOOLDALLOP   
+ *
+ *
+ *     -source file reads should be integral of BUFSIZ for efficient reads
+ *     -string saving is a simple first fit
+ */
+#ifndef ASINBUFSIZ
+#      define  ASINBUFSIZ      4096
+#endif not ASINBUFSIZ
+#ifndef STRPOOLDALLOP
+#      define STRPOOLDALLOP    8192
+#endif not STRPOOLDALLOP
+#ifndef NCPString
+#      define  NCPString       4080
+#endif not NCPString
+
+#define        NCPName NCPS
 #ifdef UNIX
 #ifdef UNIX
-# ifndef       FLEXNAMES
-#      ifndef  NCPS
-#              define  NCPS    8       /* number of characters per symbol*/
-#      endif
-# else
-#      ifdef NCPS
-#              undef   NCPS
-#      endif
-#      define  NCPS    4096    /* needed to allocate yytext */
-# endif
+# ifndef FLEXNAMES
+#      ifndef NCPS
+#              undef   NCPName
+#              define  NCPName 8
+#      endif not NCPS
+# else FLEXNAMES
+#      ifndef NCPS
+#              undef   NCPName
+#              define  NCPName 4096
+#      endif not NCPS
+# endif FLEXNAMES
 # endif UNIX
 
 # ifdef VMS
 # endif UNIX
 
 # ifdef VMS
-# ifdef NCPS
-#      undef   NCPS
-# endif NCPS
-#      define  NCPS    15
+#      define  NCPName 15
 # endif VMS
 
 # endif VMS
 
+/*
+ *     Check sizes, and compiler error if sizes botch
+ */
+#if ((STRPOOLDALLOP < NCPString) || (STRPOOLDALLOP < NCPName))
+       $$$botch with definition sizes
+#endif test botches
 /*
  * Symbol types
  */
 /*
  * Symbol types
  */
@@ -132,10 +159,6 @@ extern     char    *ty_string[];   /* {TYPB..TYPH} ==> printable */
 #define        DW      0x7
 #define        OW      0xF
 
 #define        DW      0x7
 #define        OW      0xF
 
-#ifdef UNIX
-#  include <pagsiz.h>
-#endif UNIX
-
 #ifdef VMS
 #  define PAGRND       0x1FFL
 #endif VMS
 #ifdef VMS
 #  define PAGRND       0x1FFL
 #endif VMS
@@ -226,10 +249,16 @@ struct symtab{
  *     with the old naming conventions.
  */
 #ifdef FLEXNAMES
  *     with the old naming conventions.
  */
 #ifdef FLEXNAMES
-#define        s_name  s_nm.n_un.n_name        /* name pointer */
+#define        s_name  s_nm.n_un.n_name
+#define        i_name  s_name
+#define        FETCHNAME(sp)   (((struct strdesc *)(sp)->s_name)->sd_string)
+#define        STRLEN(sp)      (((struct strdesc *)(sp)->s_name)->sd_strlen)
+#define        STROFF(sp)      (((struct strdesc *)(sp)->s_name)->sd_stroff)
 #define        s_nmx   s_nm.n_un.n_strx        /* string table index */
 #else  not FLEXNAMES
 #define        s_name  s_nm.n_name
 #define        s_nmx   s_nm.n_un.n_strx        /* string table index */
 #else  not FLEXNAMES
 #define        s_name  s_nm.n_name
+#define        i_name  s_name
+#define        FETCHNAME(sp)   ((sp)->s_name)
 #endif
 #define        s_type  s_nm.n_type             /* type of the symbol */
 #define        s_other s_nm.n_other            /* other information for sdb */
 #endif
 #define        s_type  s_nm.n_type             /* type of the symbol */
 #define        s_other s_nm.n_other            /* other information for sdb */
@@ -303,7 +332,7 @@ struct      Instab{
 #ifdef FLEXNAMES
        char    *I_name;
 #else not FLEXNAMES
 #ifdef FLEXNAMES
        char    *I_name;
 #else not FLEXNAMES
-       char    I_name[NCPS];
+       char    I_name[NCPName];
 #endif
        u_char  I_popcode;              /* basic op code */
        char    I_nargs;
 #endif
        u_char  I_popcode;              /* basic op code */
        char    I_nargs;
@@ -358,7 +387,33 @@ struct     exp {
 #define                ISUBYTE(x)      (((x) >= MINUBYTE) && ((x) <= MAXUBYTE))
 #define                ISWORD(x)       (((x) >= MINWORD) && ((x) <= MAXWORD))
 #define                ISUWORD(x)      (((x) >= MINUWORD) && ((x) <= MAXUWORD))
 #define                ISUBYTE(x)      (((x) >= MINUBYTE) && ((x) <= MAXUBYTE))
 #define                ISWORD(x)       (((x) >= MINWORD) && ((x) <= MAXWORD))
 #define                ISUWORD(x)      (((x) >= MINUWORD) && ((x) <= MAXUWORD))
+/*
+ *     Definitions for strings.
+ *
+ *     Strings are stored in the string pool; see strsave(str, length)
+ *     Strings are known by their length and values.
+ *     A string pointer points to the beginning of the value bytes;
+ *
+ *     If this structure is changed, change insts also.
+ */
+struct strdesc{
+       int     sd_stroff;      /* offset into string file */
+       short   sd_place;       /* where string is */
+       u_short sd_strlen;      /* string length */
+       char    sd_string[1];   /* the string itself, flexible length */
+};
+/*
+ *     Where a string can be.  If these are changed, also change instrs.
+ */
+#define        STR_FILE        0x1
+#define        STR_CORE        0x2
+#define        STR_BOTH        0x3
 
 
+struct strdesc *savestr();
+\f
+/*
+ *     Global variables
+ */
        extern  struct  arg     arglist[NARG];  /*building operands in instructions*/
        extern  struct  exp     explist[NEXP];  /*building up a list of expressions*/
        extern  struct  exp     *xp;            /*current free expression*/
        extern  struct  arg     arglist[NARG];  /*building operands in instructions*/
        extern  struct  exp     explist[NEXP];  /*building up a list of expressions*/
        extern  struct  exp     *xp;            /*current free expression*/
@@ -389,7 +444,6 @@ struct      exp {
        extern  int     lgensym[10];
        extern  char    genref[10];
 
        extern  int     lgensym[10];
        extern  char    genref[10];
 
-       extern  char    tmpn1[TNAMESIZE];       /* Interpass temporary */
        extern  struct  exp     *dotp;          /* the current dot location */
        extern  int     loctr;
 
        extern  struct  exp     *dotp;          /* the current dot location */
        extern  int     loctr;
 
@@ -410,14 +464,18 @@ struct    exp {
         *      The lexical analyzer builds up symbols in yytext.  Lookup
         *      expects its argument in this buffer
         */
         *      The lexical analyzer builds up symbols in yytext.  Lookup
         *      expects its argument in this buffer
         */
-       extern  char    yytext[NCPS+2];         /* text buffer for lexical */
+       extern  char    yytext[NCPName+2];      /* text buffer for lexical */
        /*
         *      Variables to manage the input assembler source file
         */
        extern  int     lineno;                 /*the line number*/
        extern  char    *dotsname;              /*the name of the as source*/
 
        /*
         *      Variables to manage the input assembler source file
         */
        extern  int     lineno;                 /*the line number*/
        extern  char    *dotsname;              /*the name of the as source*/
 
-       extern  FILE    *tmpfil;                /* interpass communication*/
+       extern  FILE    *tokfile;               /* temp token communication*/
+       extern  FILE    *strfile;               /* temp string file*/
+       extern  char    tokfilename[TNAMESIZE]; /* token file name */
+       extern  char    strfilename[TNAMESIZE]; /* string file name */
+       extern  int     strfilepos;             /* position in string file */
 
        extern  int     passno;                 /* 1 or 2 */
 
 
        extern  int     passno;                 /* 1 or 2 */