date and time created 88/07/22 16:08:01 by bostic
[unix-history] / usr / src / old / as.vax / as.h
index 75f1ea5..5f8f091 100644 (file)
@@ -1,36 +1,16 @@
 /*
 /*
- *     Copyright (c) 1982 Regents of the University of California
- *     @(#)as.h 4.11 %G%
+ * Copyright (c) 1982 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ *     @(#)as.h        5.3 (Berkeley) %G%
  */
  */
-#ifdef VMS
-# define       vax     1
-# define       VAX     1
-#endif VMS
 
 #define        reg     register
 
 #include <sys/types.h>
 
 #define        reg     register
 
 #include <sys/types.h>
-#ifdef UNIX
-
-#ifdef FLEXNAMES
-#  include <a.out.h>
-#  include <stab.h>
-#else not FLEXNAMES
-#  define ONLIST
-#  include "a.out.h"
-#  include <stab.h>
-#endif FLEXNAMES
-
-#endif UNIX 
-#ifdef VMS
-
-#ifdef UNIXDEVEL
-#  include <a.out.h>
-#else not UNIXDEVEL
-#  include <aout.h>
-#endif not UNIXDEVEL
-
-#endif VMS
+#include <a.out.h>
+#include <stab.h>
 
 #define readonly
 #define        NINST           300
 
 #define readonly
 #define        NINST           300
 #define        NEXP            20      /* max number of expr. terms per instruction */
 #define        NARG            6       /* max number of args per instruction */
 #define        NHASH           1103    /* hash table is dynamically extended */
 #define        NEXP            20      /* max number of expr. terms per instruction */
 #define        NARG            6       /* max number of args per instruction */
 #define        NHASH           1103    /* hash table is dynamically extended */
-#define        TNAMESIZE       32      /* maximum length of temporary file names */
+#define        TNAMESIZE       256     /* maximum length of temporary file names */
 #define        NLOC            4       /* number of location ctrs */
 #define        NLOC            4       /* number of location ctrs */
-
-#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
-# endif UNIX
-
-# ifdef VMS
-# ifdef NCPS
-#      undef   NCPS
-# endif NCPS
-#      define  NCPS    15
-# endif VMS
-
+/*
+ *     Sizes for character buffers.
+ *     what                    size #define name       comments
+ *
+ *     name assembly           NCPName 
+ *     name save               STRPOOLDALLOP   
+ *
+ *     -name saving is a simple first fit
+ */
+#ifndef STRPOOLDALLOP
+#      define STRPOOLDALLOP    8192
+#endif not STRPOOLDALLOP
+
+#define        NCPName NCPS
+#ifndef NCPS
+#      undef   NCPName
+#      define  NCPName 4096
+#endif not NCPS
+/*
+ *     Check sizes, and compiler error if sizes botch
+ */
+#if STRPOOLDALLOP < NCPName
+       $$$botch with definition sizes
+#endif test botches
 /*
  * Symbol types
  */
 /*
  * Symbol types
  */
@@ -76,7 +59,7 @@
 #define        XFORW   0x20    /* Was forward-referenced when undefined */
 
 #define        ERR     (-1)
 #define        XFORW   0x20    /* Was forward-referenced when undefined */
 
 #define        ERR     (-1)
-#define        NBPW    32      /* Bits per word */
+#define        NBWD    32      /* Bits per word */
 
 #define        AMASK   017
 
 
 #define        AMASK   017
 
@@ -132,14 +115,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
-
 #define        round(x,y)      (((x)+(y)) & ~(y))
 
 #define        STABTYPS        0340
 #define        round(x,y)      (((x)+(y)) & ~(y))
 
 #define        STABTYPS        0340
@@ -210,7 +185,7 @@ struct symtab{
                u_char  s_jxoveralign;  /* if a JXXX, jumped over align */
                short   s_index;        /* which segment */
                struct  symtab *s_dest; /* if JXXX, where going to */
                u_char  s_jxoveralign;  /* if a JXXX, jumped over align */
                short   s_index;        /* which segment */
                struct  symtab *s_dest; /* if JXXX, where going to */
-#ifdef DJXXX
+#ifdef DEBUG
                short   s_jxline;       /* source line of the jump from */
 #endif
 };
                short   s_jxline;       /* source line of the jump from */
 #endif
 };
@@ -225,12 +200,13 @@ struct symtab{
  *     one saves typing, and so that they conform 
  *     with the old naming conventions.
  */
  *     one saves typing, and so that they conform 
  *     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        STRPLACE(sp)    (((struct strdesc *)(sp)->s_name)->sd_place)
 #define        s_nmx   s_nm.n_un.n_strx        /* string table index */
 #define        s_nmx   s_nm.n_un.n_strx        /* string table index */
-#else  not FLEXNAMES
-#define        s_name  s_nm.n_name
-#endif
 #define        s_type  s_nm.n_type             /* type of the symbol */
 #define        s_other s_nm.n_other            /* other information for sdb */
 #define        s_desc  s_nm.n_desc             /* type descriptor */
 #define        s_type  s_nm.n_type             /* type of the symbol */
 #define        s_other s_nm.n_other            /* other information for sdb */
 #define        s_desc  s_nm.n_desc             /* type descriptor */
@@ -300,11 +276,7 @@ struct Opcode{
 #define        ITABFETCH(o)    itab[o.Op_eopcode][o.Op_popcode]
 
 struct Instab{
 #define        ITABFETCH(o)    itab[o.Op_eopcode][o.Op_popcode]
 
 struct Instab{
-#ifdef FLEXNAMES
        char    *I_name;
        char    *I_name;
-#else not FLEXNAMES
-       char    I_name[NCPS];
-#endif
        u_char  I_popcode;              /* basic op code */
        char    I_nargs;
        char    I_args[6];
        u_char  I_popcode;              /* basic op code */
        char    I_nargs;
        char    I_args[6];
@@ -358,7 +330,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*/
@@ -370,13 +368,6 @@ struct     exp {
         */
        extern  struct  symtab  *lastnam;
        extern  struct  symtab  *lastjxxx;      
         */
        extern  struct  symtab  *lastnam;
        extern  struct  symtab  *lastjxxx;      
-
-#ifdef VMS
-       extern  char    *vms_obj_ptr;           /* object buffer pointer */
-       extern  char    sobuf[];                /* object buffer         */
-       extern  int     objfil;                 /* VMS object file descriptor */
-#endif VMS
-
        /*
         *      Lgensym is used to make up funny names for local labels.
         *      lgensym[i] is the current funny number to put after
        /*
         *      Lgensym is used to make up funny names for local labels.
         *      lgensym[i] is the current funny number to put after
@@ -389,7 +380,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 +400,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 */
 
@@ -444,6 +438,7 @@ struct      exp {
 
        extern  int     curlen;                 /*current literal storage size*/
        extern  int     d124;                   /*current pointer storage size*/
 
        extern  int     curlen;                 /*current literal storage size*/
        extern  int     d124;                   /*current pointer storage size*/
+       extern  int     maxalign;               /*maximum .align allowed*/
        
        struct  symtab  **lookup();             /*argument in yytext*/
        struct  symtab  *symalloc();
        
        struct  symtab  **lookup();             /*argument in yytext*/
        struct  symtab  *symalloc();
@@ -455,14 +450,7 @@ struct     exp {
 
 #define outs(cp, lg) dotp->e_xvalue += (lg); if (passno == 2) bwrite((cp), (lg), (txtfil))
 
 
 #define outs(cp, lg) dotp->e_xvalue += (lg); if (passno == 2) bwrite((cp), (lg), (txtfil))
 
-#ifdef UNIX
 #define        Outb(o) outb(o)
 #define        Outb(o) outb(o)
-#endif UNIX
-
-#ifdef VMS
-#define        Outb(o) {*vms_obj_ptr++=-1;*vms_obj_ptr++=(char)o;dotp->e_xvalue+=1;}
-#endif VMS
-
 /*
  *     Most of the time, the argument to flushfield is a power of two constant,
  *     the calculations involving it can be optimized to shifts.
 /*
  *     Most of the time, the argument to flushfield is a power of two constant,
  *     the calculations involving it can be optimized to shifts.
@@ -481,7 +469,7 @@ struct      biobuf {
        short   b_nleft;                /* Number free spaces left in b_buf */
 /* Initialize to be less than BUFSIZ initially, to boundary align in file */
        char    *b_ptr;                 /* Next place to stuff characters */
        short   b_nleft;                /* Number free spaces left in b_buf */
 /* Initialize to be less than BUFSIZ initially, to boundary align in file */
        char    *b_ptr;                 /* Next place to stuff characters */
-       char    b_buf[BUFSIZ];          /* The buffer itself */
+       char    *b_buf;                 /* Pointer to the buffer */
        off_t   b_off;                  /* Current file offset */
        struct  biobuf *b_link;         /* Link in chain for bflush() */
 };
        off_t   b_off;                  /* Current file offset */
        struct  biobuf *b_link;         /* Link in chain for bflush() */
 };
@@ -491,6 +479,7 @@ struct      biobuf {
 
        extern  BFILE   *biobufs;       /* head of the block I/O buffer chain */
        extern  int     biofd;          /* file descriptor for block I/O file */
 
        extern  BFILE   *biobufs;       /* head of the block I/O buffer chain */
        extern  int     biofd;          /* file descriptor for block I/O file */
+       extern  int     biobufsize;     /* optimal block size for I/O */
        extern  off_t   boffset;        /* physical position in logical file */
 
        /*
        extern  off_t   boffset;        /* physical position in logical file */
 
        /*