-- TexInpDefs.mesa

-- last written by Doug Wyatt, January 8, 1980  1:44 PM

DIRECTORY
	TexTokenDefs: FROM "TexTokenDefs",
	StreamDefs: FROM "StreamDefs";

TexInpDefs: DEFINITIONS =
BEGIN OPEN TexTokenDefs;

InStackEntry: TYPE = RECORD
	[SELECT mode: {charlist,tokenlist} FROM
		charlist => [	inbuf: STRING,
							ibptr: CARDINAL,
							ibmark: CARDINAL, -- refill inbuf when ibptr+1=ibmark
							filename: STRING,
							state: {newline,midline,skipblanks},
							page: CARDINAL,
							line: CARDINAL,
							channel: StreamDefs.StreamHandle],
		tokenlist => [loc: TokenPtr,
							recovery: RecoveryCode],
	ENDCASE];
RecoveryCode: TYPE = RECORD
	[SELECT rtag:* FROM
		donothing,endulist,endvlist,destroy => [l: TokenPtr],
		prune => [p: ParStackIndex, l: TokenListPtr],
		ENDCASE];

instacksize: CARDINAL=20;
InStack: TYPE = ARRAY [0..instacksize] OF InStackEntry;
instack: READONLY POINTER TO InStack;
inptr: READONLY [0..instacksize];
instate: InStackEntry;

inbufsize: CARDINAL=401;

parsize: CARDINAL=13;
ParStackIndex: TYPE = [0..parsize];
ParStack: TYPE = ARRAY ParStackIndex OF TokenPtr;

parstack,pstack: POINTER TO ParStack;
parptr: ParStackIndex;

PushInput: PROCEDURE;

END.