/* * @(#)a.com.h 3.5 * * Declarations common to all of the cross assemblers. */ /* * Version 3.5, 8/20/82. Added extensions for the 8086. * * Version 3.4, 7/5/82. Added scanc() and white() macros. * * Version 3.3, 5/27/82. Added uext switch. * * Version 3.2, 5/22/82. Added define for PDDIR. */ /* * Parameters. */ #define BLKLOG 9 /* log base 2 of disk block size */ #define IISIZ 30 /* size of parse stack in frames */ #define INSIZ 4096 /* size of input stack in bytes */ #define LLERR 3 /* length of error field in listing line */ #define LLLOC 4 /* length of location field in listing line */ #define LLOBJ 8 /* length of object field in listing line */ #define LLPP 58 /* listing lines/page (must be less than 64) */ #define LLSEQ 5 /* length of sequence field in listing line */ #define OBJSIZ 255 /* maximum object block length */ #define OHSHLOG 6 /* log base 2 of opcode hash table size */ #ifndef PDDIR /* following define overridable in cc line */ #define PDDIR "/usr/lib" /* directory containing the predef file */ #endif PDDIR #define SECSIZ 255 /* maximum number of sections including abs */ #define SHSHLOG 9 /* log base 2 of symbol hash table size */ #define SLINSIZ 128 /* maximum source line length */ #define STRSIZ 128 /* maximum string length */ #define SYMSIZ 8 /* maximum symbol length */ #define TITSIZ 47 /* maximum title string length */ /* * Assembler directive numbers. */ #define ADABS 19 /* .abs */ #define ADALIGN 20 /* .align */ #define ADBLOCK 7 /* .block */ #define ADBYTE 4 /* .byte */ #define ADCLIST 9 /* .clist */ #define ADCOM 26 /* .common */ #define ADEJECT 25 /* .eject */ #define ADELSE 15 /* .else */ #define ADEND 1 /* .end */ #define ADENDIF 16 /* .endif */ #define ADENDM 23 /* .endm */ #define ADENDR 28 /* .endr */ #define ADEQU 2 /* .equ */ #define ADERROR 30 /* .error */ #define ADEXIT 31 /* .exit */ #define ADGLOB 18 /* .global */ #define ADIF 17 /* .if */ #define ADINPUT 3 /* .input */ #define ADLIST 14 /* .list */ #define ADLONG 24 /* .long */ #define ADMAC 22 /* .macro */ #define ADORG 8 /* .org */ #define ADREPT 29 /* .repeat */ #define ADSECT 10 /* .sect */ #define ADSET 6 /* .set */ #define ADSPACE 11 /* .space */ #define ADSTITL 12 /* .stitle */ #define ADTITLE 13 /* .title */ #define ADWARN 33 /* .warn */ #define ADWITHN 21 /* .within */ #define ADWORD 5 /* .word */ /* * Parsing constants and flags. */ #define IIAFLG 020000 /* alternate left parts flag */ #define IIDSYM 0377 /* default symbol in scntab */ #define IIESYM 0376 /* error symbol in scntab */ #define IILMSK 0007 /* production length mask */ #define IINFLG 0400 /* nonterminal symbol flag */ #define IIRFLG 040000 /* read and reduce flag */ #define IIXFLG 0100000 /* transition flag */ /* * Input stack frame types (in in_typ). */ #define INFILE 1 /* file */ #define INMAC 2 /* macro expansion */ #define INRPT 3 /* repeat */ #define INARG 4 /* macro argument */ /* * Operand classes. */ #define OCNULL 0x00 /* no operand */ #define OCNEX 0x01 /* nn */ #define OCPEX 0x02 /* (nn) */ #define OCEXP 0x03 /* {nn,(nn)} */ /* * Operand flags (in op_flg and ps_flg). */ #define OFFOR 0x8000 /* operand contains a forward reference */ /* * Opcode types (in oc_typ). */ #define OTUND 0 /* undefined */ #define OTINS 1 /* instruction */ #define OTDIR 2 /* directive */ #define OTMAC 3 /* macro */ /* * Symbol attribute flags (in sy_atr). */ #define SADP2 0001 /* defined in pass 2 */ #define SAMUD 0002 /* multiply defined */ #define SAGLO 0004 /* global */ /* * Symbol types (in sy_typ). */ #define STUND 0 /* undefined */ #define STKEY 1 /* keyword */ #define STSEC 2 /* section */ #define STLAB 3 /* label or equ */ #define STVAR 4 /* variable (redefinable) */ /* * Token types and values returned from the lexical scanner. */ #define TKEOF 0 /* end of file -- must be 0 */ #define TKDOL 1 /* dollar sign */ #define TKSYM 2 /* symbol */ #define TKCON 3 /* constant */ #define TKSTR 4 /* quoted string */ #define TKUNOP 5 /* unary operator */ #define TKMULOP 6 /* multiplicative operator */ #define TVMUL 1 /* multiplication */ #define TVDIV 2 /* division */ #define TVMOD 3 /* modulo */ #define TVSHL 4 /* shift left */ #define TVSHR 5 /* shift right */ #define TKADDOP 7 /* additive operator */ #define TVADD 1 /* addition */ #define TVSUB 2 /* subtraction */ #define TKRELOP 8 /* relational operator */ #define TVEQ 1 /* equal */ #define TVNE 2 /* not equal */ #define TVLT 3 /* less than */ #define TVGT 4 /* greater than */ #define TVLE 5 /* less than or equal */ #define TVGE 6 /* greater than or equal */ #define TKANDOP 9 /* logical and operator */ #define TKXOROP 10 /* exclusive or operator */ #define TKOROP 11 /* inclusive or operator */ #define TKLPAR 12 /* left parenthesis */ #define TKRPAR 13 /* right parenthesis */ #define TKCOM 100 /* comma */ #define TKCOLON 101 /* colon */ #define TKEOL 102 /* end of line */ #define TKSPC 103 /* white space */ #define TKERR 127 /* erroneous token */ /* * Virtual memory buffer flags (in vm_flg). */ #define VMDIR 01 /* dirty bit */ /* * Cross reference masks (in xr_pl). */ #define XRDEF 0100000 /* Symbol defined at this reference */ /* * Type definitions. */ #define exprval long /* expression value */ #define reg register /* abbreviation for good tabbing */ #define uns unsigned /* abbreviation for good tabbing */ #define vmadr unsigned /* virtual memory address */ /* * Pseudo-variables. */ #define ERROR stdout /* ERRORs go to standard output */ FILE *LIST; /* pointer to listing FILE structure */ FILE *OBJECT; /* pointer to object FILE structure */ /* * Pseudo-functions. */ #define scanc() ((ch = *scanpt++)!='\0'&&ch!=escchr ? ch : xscanc()) #define unscanc() (ch = *--scanpt) #define white(c) (c==' ' || c=='\t') /* * Structure declarations. */ struct aside { /* symbol lookaside table entry */ struct aside *as_lnk; /* lru chain link */ vmadr as_sym; /* symbol table entry pointer */ char as_str[SYMSIZ]; /* symbol */ }; struct chent { /* single-character token table entry */ char ch_chr; /* character */ char ch_typ; /* token type */ char ch_val; /* token value */ }; struct input { /* input stack frame */ struct input *in_ofp; /* pointer to previous frame */ char in_typ; /* frame type */ char in_rpt; /* repeat count */ char in_lst; /* listing level */ char *in_ptr; /* pointer to next character */ int in_cnt; /* number of characters left */ int in_fd; /* file descriptor */ uns in_seq; /* line number */ char in_buf[1<