--File ParserTypeDefs.mesa
--
March 5, 1980 4:57 PM
--
September 5, 1980 4:18 PM by MN

ParserTypeDefs: DEFINITIONS =

BEGIN

Point: TYPE = RECORD [x,y: LONG INTEGER];
LinkedPoint: TYPE = RECORD [value: Point, next: POINTER TO LinkedPoint];
Path: TYPE = POINTER TO PathRecord;
PathRecord: TYPE = RECORD [first, last: POINTER TO LinkedPoint, length: CARDINAL];

TType: TYPE = {Mirror, Translate, Rotate};
TEntry: TYPE = RECORD [
SELECT type: TType FROM
Mirror => [coords: {X,Y}],
Translate => [x, y: LONG INTEGER],
Rotate => [xRot, yRot: LONG INTEGER],
ENDCASE];
LinkedTEntry: TYPE = RECORD [value: TEntry, next: POINTER TO LinkedTEntry];
TList: TYPE = POINTER TO TRecord;
TRecord: TYPE = RECORD [first, last: POINTER TO LinkedTEntry,length: CARDINAL];

-- Should be called once before using any of the path procedures below
InitTypes: PROCEDURE RETURNS [BOOLEAN];
FinishTypes: PROCEDURE RETURNS [BOOLEAN];

-- The following routines support access to Paths, which are essentially queues. AllocatePath returns a brand new, empty path. FreePath frees all storage used by a path (a path that has been freed can no longer be used, i.e. you must use AllocatePath to get another). AppendPoint and RemovePoint add and delete points from their respective ends.

AllocatePath: PROCEDURE RETURNS [Path];
FreePath: PROCEDURE [Path];

AppendPoint: PROCEDURE [Path, Point];
RemovePoint: PROCEDURE [Path] RETURNS [BOOLEAN, Point];
CopyPath: PROCEDURE[from,to: Path];

PathLength: PROCEDURE [Path] RETURNS [CARDINAL];

AllocateUserNode: PROCEDURE[nwords: CARDINAL] RETURNS [POINTER];
FreeUserNode: PROCEDURE [address: POINTER];

-- The following routines support access to TLists, which are essentially queues. AllocateTList returns a brand new, empty TList. FreeTList frees all storage used by a TList (a TList that has been freed can no longer be used, i.e. you must use AllocateTList to get another). AppendTList and RemoveTList add and delete LinkedTEntries from their respective ends.

AllocateTList: PROCEDURE RETURNS [TList];
FreeTList: PROCEDURE [TList];

AppendTList: PROCEDURE [TList, TEntry];
RemoveTList: PROCEDURE [TList] RETURNS [BOOLEAN, TEntry];

TListLength: PROCEDURE [TList] RETURNS [CARDINAL];

END.