-- TexTokenDefs.mesa

-- last written by Doug Wyatt, August 20, 1979  2:58 PM

DIRECTORY
	TexCmdDefs: FROM "TexCmdDefs" USING[Cmd],
	TexDefs: FROM "TexDefs" USING[Char],
	TexHashDefs: FROM "TexHashDefs" USING[HashIndex];

TexTokenDefs: DEFINITIONS =
BEGIN

TokCmd: TYPE = TexCmdDefs.Cmd[undefined..endv];

Token: TYPE = RECORD
	[
	SELECT cmd: TokCmd FROM
		ctrlseq => [index: TexHashDefs.HashIndex],
		outpar => [paramnum: [1..9]],
		match => [matchcode: {par, end}],
		macprm,lbrace,rbrace,mathbr,tabmrk,
		 supmrk,submrk,spacer,letter,otherchar => [char: TexDefs.Char],
		undefined,parend,endv => NULL,
		ENDCASE
	];

TokenLEntry: TYPE = RECORD
	[
	link: TokenPtr,
	token: Token
	];
TokenPtr: TYPE = POINTER TO TokenLEntry;
nilTokenLEntry: TokenLEntry=[NIL,[undefined[]]];

TokenRefCount: TYPE = CARDINAL;
TokenLHead: TYPE = RECORD
	[
	link: TokenPtr,
	refs: TokenRefCount
	];
TokenListPtr: TYPE = POINTER TO TokenLHead;

MakeTokenLEntry: PROCEDURE[Token] RETURNS[TokenPtr];
MakeTokenLHead: PROCEDURE[TokenPtr] RETURNS[TokenListPtr];
FreeTokenLEntry: PROCEDURE[TokenPtr];
FreeTokenLHead: PROCEDURE[TokenListPtr];

StoreTok: PROCEDURE[POINTER TO TokenPtr, Token];

DsList: PROCEDURE[TokenPtr];
AddRCLink: PROCEDURE[TokenListPtr];
DelRCLink: PROCEDURE[TokenListPtr];

TokChar: PROCEDURE[Token] RETURNS[TexDefs.Char];


TexToken: PROGRAM;

END.