;	c/table/NOTABLE/
	.TITLE STAK
	.IDENT /30JN7A/
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;
; global symbol definitions
; these may be adjusted without much worry
;
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
maxsym==30.             ;maximum number of symbols
extmac==90.             ;maximum number of mac lib macros
sz.mtext==7500.         ;size of the macro libr text area
dm.mtext==420.          ;max number of lines in macro library
stksiz=60.		;number of entries allowed in string stack (even only)
stkbyt=400.		;size in bytes of string stack
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	.enabl lc

inreg:: .asciz /(r5)/           ;string appended to var on #@{arg}
				;if arg is in symbol table
	.even
.LIST TTM
.MACRO TABLE A
.PNT = .PNT + 1
.ASCIZ /A/
.ENDM

.MACRO NOTABLE A
.PNT = .PNT + 1
.BYTE 1,0
.ENDM
 
	.MCALL MAC,GCMLB$,EXIT$S
	MAC S
	RSET
	GLOBCK OFF
	GLOBCK STACKOFF
	STACK
	ESTACK
	FDB ,MAC,MPP,4		;2 FILES PLUS THE GET-CMD-LINE PROCESSOR
$LIN$::	.WORD	0	;STORE LAST LINE READ ADDRESS
IN::	FILE INPUT 3
OUT::	FILE OUTPUT 4
M.LB::	FILE INPUT 5		;macro lib input
NOLIB::	.WORD	0		;flag used by init and mcall
LIB.FLAG::	.WORD 0		;flag indication of lib read in
PPLEV::		.WORD 0		;pretty printer level
PPFLG::		.WORD 0		;pretty printer flag (set after the entry)
LNUMBER::	.WORD 0		;line number
	.PSECT STAK
;
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; define the variable symbol table
; and the type array (for each symbol).
; also the pointers.  when a symbol is looked up it's
; location in the symbol table is effectively swapped
; with the preceding symbol in the table. the pointers are
; swapped instead of the symbols. (the search is sequential but 
; the order is defined by the pointer array . This is probably
; no longer implemented.)
;
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	DEF.STR <..SYMBOLS , MAXSYM*10.+20. , MAXSYM>
..TYPES::	.BLKW MAXSYM
..SPOINT::	.BLKW MAXSYM	;THE POINTERS FOR LOOKUP
..NSYM::	.WORD 0		;THE NUMBER OF ENTRIES INTO THE
				;SYMBOL TABLE
STKOVR::		;STACK OVERFLOW ENTRY
PRI R0 <STACK OVFLOW  RE-TKB BIGGER>
EXIT$S
.PNT=0
.OPCODES::
	NOTABLE	XEQ
	NOTABLE	SET
	NOTABLE	IF
	TABLE	**
	NOTABLE	BEGIN
	NOTABLE	END
	TABLE	S%OPT	;SET OPTIMIZE TABLE ENTRIES
	NOTABLE	SETB
	NOTABLE	IFB
	NOTABLE	*VR*
	NOTABLE	*DS*
	NOTABLE	*PM*
	NOTABLE	STACK
	NOTABLE	SUBROUTINE
	NOTABLE	GLOBCK
	TABLE	.MACRO
	NOTABLE	ADDR
	NOTABLE	MOVEB
	NOTABLE	SET$
STR$==.PNT	;BEGINNING OF STRNGS OPCODES
	NOTABLE 	$$$FIND
	NOTABLE	$$$REPLACE
	NOTABLE	$$$APPEND
	NOTABLE	$$$PNT
	NOTABLE	LINPUT
	TABLE	I%DOUT
	TABLE	I%IN
	TABLE	I%ERR
	NOTABLE	CONVERT
	TABLE	E%S	;ENTER SYMBOL
	TABLE T%YP
	TABLE I%B
	TABLE I%NB
	TABLE I%IDN
	TABLE I%DF
	TABLE I%SW	;IF SWITCH IS SET
	TABLE S%SW	;SET/RESET SWITCH
	TABLE D%SYM	;DUMP SYMBOLS (MAY NOT REFERENCE STRINGS)
NBNOPS=.-.OPCODES
EXTTAB:	.BLKB	EXTMAC*5.
.EVEN
.LOPCODES::	.WORD	NBNOPS
EXTPNT:	
.EVEN
.NOPCODES::	.WORD	.PNT
MACENT==.PNT		;OPCODE NUMBER OF LAST BUILT-IN OPCODE
YS=TRUE
NO=FALSE
$OPTABLE::
;             1  2  3  4  5  6  7  8  9  10 11 12 13 14 15
;	      16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
	.BYTE NO,NO,NO,YS,NO,NO,YS,NO,NO,YS,YS,YS,NO,NO,NO ;1-15
	.BYTE YS,NO,NO,NO,NO,NO,NO,NO,NO,YS,YS,YS,NO,NO,NO ;16-30
	.BYTE YS,YS,YS,YS,YS,YS,YS,YS			   ;31-38
.EVEN
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; the macro library data structures
; they include:
;	1. mnames	string array for names
;	2. mtext	string array for macro text
;	3. mfst		word array for pointer of first string in mtext
;	4. mlst		word array for pointer of last  string in mtext
;	5. mlcnt	word containing the number of macros read in
;	6. mlnum	word containing the line number of macro text
; their lengths are computed using the label "extmac"
; also see labels "sz.mtext" and "dm.mtext" which define mtext sizes
; 
; note that the opcode table and the pointer table are extended at
; run time to include the macro library names.  each "macro" from the
; libr is added to these tables but point to the same function code
; so that processing is faster.  if it is a macro then the macro
; is looked up in the mnames array by the macro processor.
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	DEF.STR <MNAMES,EXTMAC*5.+30.,EXTMAC>
	DEF.STR <MTEXT,SZ.MTEXT,DM.MTEXT>
MFST::	.BLKW	EXTMAC
MLST::	.BLKW	EXTMAC
txpnt::	.word 0
	.BLKW DM.MTEXT-1		;pointer to each line in macro text
MLCNT::	.WORD	0
MLNUM::	.WORD	0
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; switch tables:
;	swtab points to the ascii two letter switches
;	swval points to the words set/reset on presence of flags
;	nsw   is the number of switches
; switches may be added here by placing a two letter switch in the
; table (swtab's ascii statement) and adding a word in the corresponding
; position below swval and placing a global label on the word.
; the subroutine init.mac processes the command line and sets these
; flags where a switch is set.
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SWTAB:: .ASCII /NLDAISMEMLOPTRNIMDPP/   ;SWITCHES CAN'T HAVE SUBSTRINGS IN TABLE
	.ASCII/UNX2X3X4X5X6X7X8X9X0/
	.ASCII/Y1Y2Y3Y4Y5Y6Y7Y8Y9Y0/
	.ASCII/LM/			;ONE MORE
NSW==<.-SWTAB>/2
SWVAL::
NLIS::	.WORD 0		;no .print statements
DBUGER::.WORD 0		;not used inside pre-processor (for user macros)
ISTRNG:: 	.WORD 0	;indirect strings switch
ME.SWITCH::	.WORD 0	;macro expansion switch
LOCLIB::	.WORD 0 ;use local macro library (in user uic not [1,1])
OP.SWITCH::	.WORD 0 ;compile only non-optimised functions
DE.SWITCH::	.WORD 0	;debugger switch (for use by this pre-processor)
NI.SWITCH::	.WORD 0 ;no internal macros included
MD.SWITCH::	.WORD 0 ;macro call dump
PP.SWITCH::	.WORD 0	;pretty printer 
XX.SWITCH::	.WORD 0,0,0,0,0,0,0,0,0,0 ;all 20 switches used by macro libs
XY.SWITCH::	.WORD 0,0,0,0,0,0,0,0,0,0 ;10 more
LM.SWITCH::	.WORD 0	;local macros switch
..CNT:: .WORD 0
.EVEN
;
; macro arg string stack and pointer
;
	DEF.STR <$STACK,STKBYT,STKSIZ>
	.EVEN
$.CNT::	.WORD -1	;-1 means need to init $stack
$.CNT2:: .WORD -1	;-1 means need to init $stack
$CNT2==STKSIZ/2		;initial value of second stack
CS:: GCMLB$ 1,MPP
	.EVEN
.END
