DIRECTORY KipperSupport USING[UnKipperer, UnKipperRef, UnKipperRope, RecordUnKipperedRef, Kipperer, KipperRope, KipperRef], Basics USING[RawBytes], IO USING[STREAM, UnsafeGetBlock, UnsafePutBlock], Rope USING[ROPE], NewParserData USING[], NewParserPrivate USING[TokenTable, TokenCellBody, ParserTable, ParserTableBody, TokenTableBody, ActionTable, ActionTableBody, SymbolTable, SymbolTableBody, ActionCell, SymbolCell, TokenCell, ActionCellBody, SymbolCellBody]; NewParserDataImpl: CEDAR PROGRAM IMPORTS KipperSupport, IO EXPORTS NewParserData = BEGIN OPEN KipperSupport, Basics, IO, Rope, NewParserPrivate; KipperActionCellBodyRef: PUBLIC PROC[kipperer: Kipperer, ActionCellBodyRef: REF ActionCellBody] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; IF KipperRef[kipperer, ActionCellBodyRef] THEN BEGIN UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(ActionCellBodyRef.state), LONG POINTER TO RawBytes], 0, 2]]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(ActionCellBodyRef.terminal), LONG POINTER TO RawBytes], 0, 2]]; word _ ORD[(ActionCellBodyRef.action)]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[LONG[@word], LONG POINTER TO RawBytes], 0, 2]]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(ActionCellBodyRef.nextState), LONG POINTER TO RawBytes], 0, 2]]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(ActionCellBodyRef.ruleNumber), LONG POINTER TO RawBytes], 0, 2]]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(ActionCellBodyRef.leftSide), LONG POINTER TO RawBytes], 0, 2]]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(ActionCellBodyRef.ruleSize), LONG POINTER TO RawBytes], 0, 2]]; KipperActionCell[kipperer, (ActionCellBodyRef.next)]; END; END; UnKipperActionCellBodyRef: PUBLIC PROC[unKipperer: UnKipperer] RETURNS[ActionCellBodyRef: REF ActionCellBody] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; [flag, refAny] _ UnKipperRef[unKipperer]; IF flag THEN BEGIN refAny _ NEW[ActionCellBody]; RecordUnKipperedRef[unKipperer, refAny]; ActionCellBodyRef _ NARROW[refAny]; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(ActionCellBodyRef.state), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(ActionCellBodyRef.terminal), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[LONG[@word], LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; (ActionCellBodyRef.action) _ VAL[word]; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(ActionCellBodyRef.nextState), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(ActionCellBodyRef.ruleNumber), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(ActionCellBodyRef.leftSide), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(ActionCellBodyRef.ruleSize), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; (ActionCellBodyRef.next) _ UnKipperActionCell[unKipperer]; END ELSE ActionCellBodyRef _ NARROW[refAny]; END; KipperActionTableBodyRef: PUBLIC PROC[kipperer: Kipperer, ActionTableBodyRef: REF ActionTableBody] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; IF KipperRef[kipperer, ActionTableBodyRef] THEN BEGIN count: CARDINAL _ ActionTableBodyRef.nSlots; UnsafePutBlock[kipperer.stream, [LOOPHOLE[LONG[@count], LONG POINTER TO RawBytes], 0, 2]]; FOR I: CARDINAL IN[0..(ActionTableBodyRef.nSlots)) DO KipperActionCell[kipperer, (ActionTableBodyRef.actions[I])]; ENDLOOP; END; END; UnKipperActionTableBodyRef: PUBLIC PROC[unKipperer: UnKipperer] RETURNS[ActionTableBodyRef: REF ActionTableBody] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; [flag, refAny] _ UnKipperRef[unKipperer]; IF flag THEN BEGIN count: CARDINAL; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[LONG[@count], LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; refAny _ NEW[ActionTableBody[count]]; RecordUnKipperedRef[unKipperer, refAny]; ActionTableBodyRef _ NARROW[refAny]; FOR I: CARDINAL IN[0..(ActionTableBodyRef.nSlots)) DO (ActionTableBodyRef.actions[I]) _ UnKipperActionCell[unKipperer]; ENDLOOP; END ELSE ActionTableBodyRef _ NARROW[refAny]; END; KipperTokenCellBodyRef: PUBLIC PROC[kipperer: Kipperer, TokenCellBodyRef: REF TokenCellBody] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; IF KipperRef[kipperer, TokenCellBodyRef] THEN BEGIN KipperRope[kipperer, (TokenCellBodyRef.name)]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(TokenCellBodyRef.symbolCode), LONG POINTER TO RawBytes], 0, 2]]; word _ ORD[(TokenCellBodyRef.kind)]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[LONG[@word], LONG POINTER TO RawBytes], 0, 2]]; KipperRope[kipperer, (TokenCellBodyRef.spelling)]; word _ ORD[(TokenCellBodyRef.case)]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[LONG[@word], LONG POINTER TO RawBytes], 0, 2]]; KipperTokenCell[kipperer, (TokenCellBodyRef.next)]; END; END; UnKipperTokenCellBodyRef: PUBLIC PROC[unKipperer: UnKipperer] RETURNS[TokenCellBodyRef: REF TokenCellBody] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; [flag, refAny] _ UnKipperRef[unKipperer]; IF flag THEN BEGIN refAny _ NEW[TokenCellBody]; RecordUnKipperedRef[unKipperer, refAny]; TokenCellBodyRef _ NARROW[refAny]; (TokenCellBodyRef.name)_ UnKipperRope[unKipperer]; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(TokenCellBodyRef.symbolCode), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[LONG[@word], LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; (TokenCellBodyRef.kind) _ VAL[word]; (TokenCellBodyRef.spelling)_ UnKipperRope[unKipperer]; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[LONG[@word], LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; (TokenCellBodyRef.case) _ VAL[word]; (TokenCellBodyRef.next) _ UnKipperTokenCell[unKipperer]; END ELSE TokenCellBodyRef _ NARROW[refAny]; END; KipperTokenTableBodyRef: PUBLIC PROC[kipperer: Kipperer, TokenTableBodyRef: REF TokenTableBody] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; IF KipperRef[kipperer, TokenTableBodyRef] THEN BEGIN count: CARDINAL _ TokenTableBodyRef.nSlots; UnsafePutBlock[kipperer.stream, [LOOPHOLE[LONG[@count], LONG POINTER TO RawBytes], 0, 2]]; KipperTokenCell[kipperer, (TokenTableBodyRef.idToken)]; FOR I: CARDINAL IN[0..(TokenTableBodyRef.nSlots)) DO KipperTokenCell[kipperer, (TokenTableBodyRef.tokens[I])]; ENDLOOP; END; END; UnKipperTokenTableBodyRef: PUBLIC PROC[unKipperer: UnKipperer] RETURNS[TokenTableBodyRef: REF TokenTableBody] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; [flag, refAny] _ UnKipperRef[unKipperer]; IF flag THEN BEGIN count: CARDINAL; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[LONG[@count], LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; refAny _ NEW[TokenTableBody[count]]; RecordUnKipperedRef[unKipperer, refAny]; TokenTableBodyRef _ NARROW[refAny]; (TokenTableBodyRef.idToken) _ UnKipperTokenCell[unKipperer]; FOR I: CARDINAL IN[0..(TokenTableBodyRef.nSlots)) DO (TokenTableBodyRef.tokens[I]) _ UnKipperTokenCell[unKipperer]; ENDLOOP; END ELSE TokenTableBodyRef _ NARROW[refAny]; END; KipperSymbolCellBodyRef: PUBLIC PROC[kipperer: Kipperer, SymbolCellBodyRef: REF SymbolCellBody] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; IF KipperRef[kipperer, SymbolCellBodyRef] THEN BEGIN KipperRope[kipperer, (SymbolCellBodyRef.name)]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(SymbolCellBodyRef.code), LONG POINTER TO RawBytes], 0, 2]]; KipperSymbolCell[kipperer, (SymbolCellBodyRef.next)]; END; END; UnKipperSymbolCellBodyRef: PUBLIC PROC[unKipperer: UnKipperer] RETURNS[SymbolCellBodyRef: REF SymbolCellBody] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; [flag, refAny] _ UnKipperRef[unKipperer]; IF flag THEN BEGIN refAny _ NEW[SymbolCellBody]; RecordUnKipperedRef[unKipperer, refAny]; SymbolCellBodyRef _ NARROW[refAny]; (SymbolCellBodyRef.name)_ UnKipperRope[unKipperer]; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(SymbolCellBodyRef.code), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; (SymbolCellBodyRef.next) _ UnKipperSymbolCell[unKipperer]; END ELSE SymbolCellBodyRef _ NARROW[refAny]; END; KipperSymbolTableBodyRef: PUBLIC PROC[kipperer: Kipperer, SymbolTableBodyRef: REF SymbolTableBody] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; IF KipperRef[kipperer, SymbolTableBodyRef] THEN BEGIN count: CARDINAL _ SymbolTableBodyRef.nSlots; UnsafePutBlock[kipperer.stream, [LOOPHOLE[LONG[@count], LONG POINTER TO RawBytes], 0, 2]]; FOR I: CARDINAL IN[0..(SymbolTableBodyRef.nSlots)) DO KipperSymbolCell[kipperer, (SymbolTableBodyRef.symbols[I])]; ENDLOOP; END; END; UnKipperSymbolTableBodyRef: PUBLIC PROC[unKipperer: UnKipperer] RETURNS[SymbolTableBodyRef: REF SymbolTableBody] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; [flag, refAny] _ UnKipperRef[unKipperer]; IF flag THEN BEGIN count: CARDINAL; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[LONG[@count], LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; refAny _ NEW[SymbolTableBody[count]]; RecordUnKipperedRef[unKipperer, refAny]; SymbolTableBodyRef _ NARROW[refAny]; FOR I: CARDINAL IN[0..(SymbolTableBodyRef.nSlots)) DO (SymbolTableBodyRef.symbols[I]) _ UnKipperSymbolCell[unKipperer]; ENDLOOP; END ELSE SymbolTableBodyRef _ NARROW[refAny]; END; KipperParserTableBodyRef: PUBLIC PROC[kipperer: Kipperer, ParserTableBodyRef: REF ParserTableBody] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; IF KipperRef[kipperer, ParserTableBodyRef] THEN BEGIN KipperSymbolCell[kipperer, (ParserTableBodyRef.unAnalyzedSymbols)]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(ParserTableBodyRef.nSymbols), LONG POINTER TO RawBytes], 0, 2]]; KipperTokenCell[kipperer, (ParserTableBodyRef.unAnalyzedTokens)]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(ParserTableBodyRef.nTokens), LONG POINTER TO RawBytes], 0, 2]]; KipperActionCell[kipperer, (ParserTableBodyRef.unAnalyzedActions)]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(ParserTableBodyRef.nActions), LONG POINTER TO RawBytes], 0, 2]]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(ParserTableBodyRef.startState), LONG POINTER TO RawBytes], 0, 2]]; KipperSymbolTable[kipperer, (ParserTableBodyRef.symbolTable)]; KipperTokenTable[kipperer, (ParserTableBodyRef.tokenTable)]; KipperActionTable[kipperer, (ParserTableBodyRef.actionTable)]; END; END; UnKipperParserTableBodyRef: PUBLIC PROC[unKipperer: UnKipperer] RETURNS[ParserTableBodyRef: REF ParserTableBody] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; [flag, refAny] _ UnKipperRef[unKipperer]; IF flag THEN BEGIN refAny _ NEW[ParserTableBody]; RecordUnKipperedRef[unKipperer, refAny]; ParserTableBodyRef _ NARROW[refAny]; (ParserTableBodyRef.unAnalyzedSymbols) _ UnKipperSymbolCell[unKipperer]; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(ParserTableBodyRef.nSymbols), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; (ParserTableBodyRef.unAnalyzedTokens) _ UnKipperTokenCell[unKipperer]; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(ParserTableBodyRef.nTokens), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; (ParserTableBodyRef.unAnalyzedActions) _ UnKipperActionCell[unKipperer]; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(ParserTableBodyRef.nActions), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(ParserTableBodyRef.startState), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; (ParserTableBodyRef.symbolTable) _ UnKipperSymbolTable[unKipperer]; (ParserTableBodyRef.tokenTable) _ UnKipperTokenTable[unKipperer]; (ParserTableBodyRef.actionTable) _ UnKipperActionTable[unKipperer]; END ELSE ParserTableBodyRef _ NARROW[refAny]; END; KipperActionCell: PUBLIC PROC[kipperer: Kipperer, ActionCellVal: ActionCell] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; IF KipperRef[kipperer, ActionCellVal] THEN BEGIN UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(ActionCellVal.state), LONG POINTER TO RawBytes], 0, 2]]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(ActionCellVal.terminal), LONG POINTER TO RawBytes], 0, 2]]; word _ ORD[(ActionCellVal.action)]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[LONG[@word], LONG POINTER TO RawBytes], 0, 2]]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(ActionCellVal.nextState), LONG POINTER TO RawBytes], 0, 2]]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(ActionCellVal.ruleNumber), LONG POINTER TO RawBytes], 0, 2]]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(ActionCellVal.leftSide), LONG POINTER TO RawBytes], 0, 2]]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(ActionCellVal.ruleSize), LONG POINTER TO RawBytes], 0, 2]]; KipperActionCell[kipperer, (ActionCellVal.next)]; END; END; UnKipperActionCell: PUBLIC PROC[unKipperer: UnKipperer] RETURNS[ActionCellVal: ActionCell] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; [flag, refAny] _ UnKipperRef[unKipperer]; IF flag THEN BEGIN refAny _ NEW[ActionCellBody]; RecordUnKipperedRef[unKipperer, refAny]; ActionCellVal _ NARROW[refAny]; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(ActionCellVal.state), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(ActionCellVal.terminal), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[LONG[@word], LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; (ActionCellVal.action) _ VAL[word]; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(ActionCellVal.nextState), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(ActionCellVal.ruleNumber), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(ActionCellVal.leftSide), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(ActionCellVal.ruleSize), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; (ActionCellVal.next) _ UnKipperActionCell[unKipperer]; END ELSE ActionCellVal _ NARROW[refAny]; END; KipperActionTable: PUBLIC PROC[kipperer: Kipperer, ActionTableVal: ActionTable] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; IF KipperRef[kipperer, ActionTableVal] THEN BEGIN count: CARDINAL _ ActionTableVal.nSlots; UnsafePutBlock[kipperer.stream, [LOOPHOLE[LONG[@count], LONG POINTER TO RawBytes], 0, 2]]; FOR I: CARDINAL IN[0..(ActionTableVal.nSlots)) DO KipperActionCell[kipperer, (ActionTableVal.actions[I])]; ENDLOOP; END; END; UnKipperActionTable: PUBLIC PROC[unKipperer: UnKipperer] RETURNS[ActionTableVal: ActionTable] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; [flag, refAny] _ UnKipperRef[unKipperer]; IF flag THEN BEGIN count: CARDINAL; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[LONG[@count], LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; refAny _ NEW[ActionTableBody[count]]; RecordUnKipperedRef[unKipperer, refAny]; ActionTableVal _ NARROW[refAny]; FOR I: CARDINAL IN[0..(ActionTableVal.nSlots)) DO (ActionTableVal.actions[I]) _ UnKipperActionCell[unKipperer]; ENDLOOP; END ELSE ActionTableVal _ NARROW[refAny]; END; KipperTokenCell: PUBLIC PROC[kipperer: Kipperer, TokenCellVal: TokenCell] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; IF KipperRef[kipperer, TokenCellVal] THEN BEGIN KipperRope[kipperer, (TokenCellVal.name)]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(TokenCellVal.symbolCode), LONG POINTER TO RawBytes], 0, 2]]; word _ ORD[(TokenCellVal.kind)]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[LONG[@word], LONG POINTER TO RawBytes], 0, 2]]; KipperRope[kipperer, (TokenCellVal.spelling)]; word _ ORD[(TokenCellVal.case)]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[LONG[@word], LONG POINTER TO RawBytes], 0, 2]]; KipperTokenCell[kipperer, (TokenCellVal.next)]; END; END; UnKipperTokenCell: PUBLIC PROC[unKipperer: UnKipperer] RETURNS[TokenCellVal: TokenCell] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; [flag, refAny] _ UnKipperRef[unKipperer]; IF flag THEN BEGIN refAny _ NEW[TokenCellBody]; RecordUnKipperedRef[unKipperer, refAny]; TokenCellVal _ NARROW[refAny]; (TokenCellVal.name)_ UnKipperRope[unKipperer]; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(TokenCellVal.symbolCode), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[LONG[@word], LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; (TokenCellVal.kind) _ VAL[word]; (TokenCellVal.spelling)_ UnKipperRope[unKipperer]; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[LONG[@word], LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; (TokenCellVal.case) _ VAL[word]; (TokenCellVal.next) _ UnKipperTokenCell[unKipperer]; END ELSE TokenCellVal _ NARROW[refAny]; END; KipperTokenTable: PUBLIC PROC[kipperer: Kipperer, TokenTableVal: TokenTable] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; IF KipperRef[kipperer, TokenTableVal] THEN BEGIN count: CARDINAL _ TokenTableVal.nSlots; UnsafePutBlock[kipperer.stream, [LOOPHOLE[LONG[@count], LONG POINTER TO RawBytes], 0, 2]]; KipperTokenCell[kipperer, (TokenTableVal.idToken)]; FOR I: CARDINAL IN[0..(TokenTableVal.nSlots)) DO KipperTokenCell[kipperer, (TokenTableVal.tokens[I])]; ENDLOOP; END; END; UnKipperTokenTable: PUBLIC PROC[unKipperer: UnKipperer] RETURNS[TokenTableVal: TokenTable] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; [flag, refAny] _ UnKipperRef[unKipperer]; IF flag THEN BEGIN count: CARDINAL; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[LONG[@count], LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; refAny _ NEW[TokenTableBody[count]]; RecordUnKipperedRef[unKipperer, refAny]; TokenTableVal _ NARROW[refAny]; (TokenTableVal.idToken) _ UnKipperTokenCell[unKipperer]; FOR I: CARDINAL IN[0..(TokenTableVal.nSlots)) DO (TokenTableVal.tokens[I]) _ UnKipperTokenCell[unKipperer]; ENDLOOP; END ELSE TokenTableVal _ NARROW[refAny]; END; KipperSymbolCell: PUBLIC PROC[kipperer: Kipperer, SymbolCellVal: SymbolCell] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; IF KipperRef[kipperer, SymbolCellVal] THEN BEGIN KipperRope[kipperer, (SymbolCellVal.name)]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(SymbolCellVal.code), LONG POINTER TO RawBytes], 0, 2]]; KipperSymbolCell[kipperer, (SymbolCellVal.next)]; END; END; UnKipperSymbolCell: PUBLIC PROC[unKipperer: UnKipperer] RETURNS[SymbolCellVal: SymbolCell] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; [flag, refAny] _ UnKipperRef[unKipperer]; IF flag THEN BEGIN refAny _ NEW[SymbolCellBody]; RecordUnKipperedRef[unKipperer, refAny]; SymbolCellVal _ NARROW[refAny]; (SymbolCellVal.name)_ UnKipperRope[unKipperer]; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(SymbolCellVal.code), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; (SymbolCellVal.next) _ UnKipperSymbolCell[unKipperer]; END ELSE SymbolCellVal _ NARROW[refAny]; END; KipperSymbolTable: PUBLIC PROC[kipperer: Kipperer, SymbolTableVal: SymbolTable] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; IF KipperRef[kipperer, SymbolTableVal] THEN BEGIN count: CARDINAL _ SymbolTableVal.nSlots; UnsafePutBlock[kipperer.stream, [LOOPHOLE[LONG[@count], LONG POINTER TO RawBytes], 0, 2]]; FOR I: CARDINAL IN[0..(SymbolTableVal.nSlots)) DO KipperSymbolCell[kipperer, (SymbolTableVal.symbols[I])]; ENDLOOP; END; END; UnKipperSymbolTable: PUBLIC PROC[unKipperer: UnKipperer] RETURNS[SymbolTableVal: SymbolTable] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; [flag, refAny] _ UnKipperRef[unKipperer]; IF flag THEN BEGIN count: CARDINAL; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[LONG[@count], LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; refAny _ NEW[SymbolTableBody[count]]; RecordUnKipperedRef[unKipperer, refAny]; SymbolTableVal _ NARROW[refAny]; FOR I: CARDINAL IN[0..(SymbolTableVal.nSlots)) DO (SymbolTableVal.symbols[I]) _ UnKipperSymbolCell[unKipperer]; ENDLOOP; END ELSE SymbolTableVal _ NARROW[refAny]; END; KipperParserTable: PUBLIC PROC[kipperer: Kipperer, ParserTableVal: ParserTable] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; IF KipperRef[kipperer, ParserTableVal] THEN BEGIN KipperSymbolCell[kipperer, (ParserTableVal.unAnalyzedSymbols)]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(ParserTableVal.nSymbols), LONG POINTER TO RawBytes], 0, 2]]; KipperTokenCell[kipperer, (ParserTableVal.unAnalyzedTokens)]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(ParserTableVal.nTokens), LONG POINTER TO RawBytes], 0, 2]]; KipperActionCell[kipperer, (ParserTableVal.unAnalyzedActions)]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(ParserTableVal.nActions), LONG POINTER TO RawBytes], 0, 2]]; UnsafePutBlock[kipperer.stream, [LOOPHOLE[@(ParserTableVal.startState), LONG POINTER TO RawBytes], 0, 2]]; KipperSymbolTable[kipperer, (ParserTableVal.symbolTable)]; KipperTokenTable[kipperer, (ParserTableVal.tokenTable)]; KipperActionTable[kipperer, (ParserTableVal.actionTable)]; END; END; UnKipperParserTable: PUBLIC PROC[unKipperer: UnKipperer] RETURNS[ParserTableVal: ParserTable] = TRUSTED BEGIN word: CARDINAL _ 0; doubleWord: LONG CARDINAL _ 0; refAny: REF ANY _ NIL; flag: BOOLEAN _ FALSE; [flag, refAny] _ UnKipperRef[unKipperer]; IF flag THEN BEGIN refAny _ NEW[ParserTableBody]; RecordUnKipperedRef[unKipperer, refAny]; ParserTableVal _ NARROW[refAny]; (ParserTableVal.unAnalyzedSymbols) _ UnKipperSymbolCell[unKipperer]; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(ParserTableVal.nSymbols), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; (ParserTableVal.unAnalyzedTokens) _ UnKipperTokenCell[unKipperer]; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(ParserTableVal.nTokens), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; (ParserTableVal.unAnalyzedActions) _ UnKipperActionCell[unKipperer]; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(ParserTableVal.nActions), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; IF UnsafeGetBlock[unKipperer.stream, [LOOPHOLE[@(ParserTableVal.startState), LONG POINTER TO RawBytes], 0, 2]] # 2 THEN ERROR; (ParserTableVal.symbolTable) _ UnKipperSymbolTable[unKipperer]; (ParserTableVal.tokenTable) _ UnKipperTokenTable[unKipperer]; (ParserTableVal.actionTable) _ UnKipperActionTable[unKipperer]; END ELSE ParserTableVal _ NARROW[refAny]; END; END..