+/*
+ * Magic layout macros
+ */
+#define MINBYTE -128
+#define MAXBYTE 127
+#define MINWORD -32768
+#define MAXWORD 32767
+
+#define LITFLTMASK 0x000043F0 /*really magic*/
+/*
+ * Is the floating point double word in xp a
+ * short literal floating point number?
+ */
+#define slitflt(xp) \
+ ( (xp->doub_LSW == 0) \
+ && ( (xp->doub_MSW & LITFLTMASK) \
+ == xp->doub_MSW) )
+/*
+ * If it is a slitflt, then extract the 6 interesting bits
+ */
+#define extlitflt(xp) \
+ xp->doub_MSW >> 4
+
+ 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*/
+ /*
+ * Communication between the scanner and the jxxx handlers.
+ * lastnam: the last name seen on the input
+ * lastjxxx: pointer to the last symbol table entry for
+ * a jump from
+ */
+ 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
+ * references to if, lgensym[i]-1 is for ib.
+ * genref[i] is set when the label is referenced before
+ * it is defined (i.e. 2f) so that we can be sure these
+ * labels are always defined to avoid weird diagnostics
+ * from the loader later.
+ */
+ 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 exec hdr; /* a.out header */
+ extern u_long tsize; /* total text size */
+ extern u_long dsize; /* total data size */
+ extern u_long trsize; /* total text relocation size */
+ extern u_long drsize; /* total data relocation size */
+ extern u_long datbase; /* base of the data segment */
+ /*
+ * Bitoff and bitfield keep track of the packing into
+ * bytes mandated by the expression syntax <expr> ':' <expr>
+ */
+ extern int bitoff;
+ extern long bitfield;
+
+ /*
+ * The lexical analyzer builds up symbols in yytext. Lookup
+ * expects its argument in this buffer
+ */
+ extern char yytext[NCPS+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*/
+
+ extern FILE *tmpfil; /* interpass communication*/
+
+ extern int passno; /* 1 or 2 */
+
+ extern int anyerrs; /*errors assembling arguments*/
+ extern int silent; /*don't mention the errors*/
+ extern int savelabels; /*save labels in a.out*/
+ extern int orgwarn; /* questionable origin ? */
+ extern int useVM; /*use virtual memory temp file*/
+ extern int jxxxJUMP; /*use jmp instead of brw for jxxx */
+ extern int readonlydata; /*initialized data into text space*/
+#ifdef DEBUG
+ extern int debug;
+ extern int toktrace;
+#endif
+ /*
+ * Information about the instructions
+ */
+ extern struct instab *itab[NINST]; /*maps opcodes to instructions*/
+ extern readonly struct Instab instab[];
+
+ extern int curlen; /*current literal storage size*/
+ extern int d124; /*current pointer storage size*/
+
+ struct symtab **lookup(); /*argument in yytext*/
+ struct symtab *symalloc();
+
+#define outb(val) {dotp->e_xvalue++; if (passno==2) bputc((val), (txtfil));}
+
+#define outs(cp, lg) dotp->e_xvalue += (lg); if (passno == 2) bwrite((cp), (lg), (txtfil))
+
+/*
+ * Most of the time, the argument to flushfield is a power of two constant,
+ * the calculations involving it can be optimized to shifts.
+ */
+#define flushfield(n) if (bitoff != 0) Flushfield( ( (bitoff+n-1) /n ) * n)
+
+/*
+ * The biobuf structure and associated routines are used to write
+ * into one file at several places concurrently. Calling bopen
+ * with a biobuf structure sets it up to write ``biofd'' starting
+ * at the specified offset. You can then use ``bwrite'' and/or ``bputc''
+ * to stuff characters in the stream, much like ``fwrite'' and ``fputc''.
+ * Calling bflush drains all the buffers and MUST be done before exit.
+ */
+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 */
+ char b_buf[BUFSIZ]; /* The buffer itself */
+ off_t b_off; /* Current file offset */
+ struct biobuf *b_link; /* Link in chain for bflush() */