-- last edited by Barth, December 6, 1981  5:35 PM
-- lasted edited by Chi Yung Fu, March 26, 1982  3:10 PM
-- lasted edited by Chi Yung Fu, April 30, 1982  2:37 PM
-- lasted edited by Chi Yung Fu, September 1, 1983  11:31 AM
-- lasted edited by JWhite, 29-Apr-85  9:41:27

DIRECTORY
  vmD: FROM "VirtualMgrDefs";

MachineParseDefs: DEFINITIONS =
BEGIN

-- Types --

Nibble: TYPE = [0..15];

ParseHandle: TYPE = POINTER TO ParseData;

ParseData: TYPE = RECORD[
  breakSet: STRING,
  blankSet: STRING,
  currentChar: vmD.CharIndex,
  message: vmD.VirtualMessagePtr,
  userData: POINTER];

ParseFault: ERROR [why:STRING, pfBegin:vmD.CharIndex, pfEnd:vmD.CharIndex];

FieldRec: TYPE = RECORD[
  name: STRING,
  parseProc: FieldParseProc,
  found: BOOLEAN ← FALSE,
  mustExist: BOOLEAN ← TRUE];

MaxFieldNameLength: CARDINAL = 50;

FieldParseProc: TYPE = PROCEDURE[ph:ParseHandle];

-- Exported by MachineParse

ParseMessage: PROCEDURE [ph:ParseHandle,
  fields:DESCRIPTOR FOR ARRAY OF FieldRec];
IsBlank: PROCEDURE [ph:ParseHandle, c:CHARACTER] RETURNS [BOOLEAN];
IsBreak: PROCEDURE [ph:ParseHandle, c:CHARACTER] RETURNS [BOOLEAN];
CheckChar: PROCEDURE[ph:ParseHandle, c:CHARACTER];
ParseChar: PROCEDURE[ph:ParseHandle] RETURNS [c:CHARACTER];
ParseCharIfCharIs: PROCEDURE[ph:ParseHandle, c:CHARACTER] RETURNS [BOOLEAN];
ParseToEndOfField: PROCEDURE[ph:ParseHandle];
ParseToEndOfLine: PROCEDURE[ph:ParseHandle];
ParseToNonWhite: PROCEDURE[ph:ParseHandle];
ParseToLeadingChar: PROCEDURE[ph:ParseHandle] RETURNS[isThere: BOOLEAN];
ParseToLeadingCharOnLine: PROCEDURE[ph:ParseHandle] RETURNS[isThere: BOOLEAN];
ParseWord: PROCEDURE[ph:ParseHandle, s:STRING];
ParseDecimal: PROCEDURE [ph:ParseHandle, lBound:CARDINAL ← 0,
  uBound:CARDINAL ← LAST[CARDINAL]] RETURNS [n:CARDINAL];
ParseInteger: PROCEDURE [ph:ParseHandle, lBound:INTEGER ← FIRST[INTEGER],
  uBound:INTEGER ← LAST[INTEGER]] RETURNS [n:INTEGER];
ParseScaledNumber: PROCEDURE[ph:ParseHandle, scale:INTEGER ← 0,
lBound:CARDINAL ← 0,  uBound:CARDINAL ← LAST[CARDINAL]] RETURNS [n:CARDINAL 
  ← 0, NumberOfDigitsAndDecimal: CARDINAL ← 0];
AppendScaleNumber: PROCEDURE[n: CARDINAL, scale: CARDINAL, 
  OutOfBoundString:STRING];
MissingValueCheck: PROCEDURE[ph:ParseHandle];
ParseNibble: PROCEDURE [ph:ParseHandle, lBound:CARDINAL, uBound:CARDINAL,
  nullOK:BOOLEAN ← TRUE] RETURNS [n:Nibble];
ParseBinary: PROCEDURE[ph:ParseHandle] RETURNS[n:CARDINAL];
ParseTime: PROCEDURE[ph:ParseHandle] RETURNS[h,m,s:CARDINAL];

END.