REFBit.mesa
Copyright © 1984 by Xerox Corporation. All rights reserved.
Last edited by Curry, September 21, 1985 4:26:32 pm PDT
This package provides bit level access to the values behind Cedar REFs. `Error' will be raised if you try to twiddle refs, pointers or other non-vanilla items in this way.
DIRECTORY
AMBridge USING [WordSequence],
AMTypes USING [TV, Type],
IO USING [],
Rope USING [ROPE];
REFBit:
CEDAR
DEFINITIONS =
BEGIN
Error: ERROR [msg: ROPE];
REFBitDesc: TYPE = REF REFBitDescRec;
REFBitDescRec:
TYPE =
RECORD [
typeName: ROPE,
tv: TV,
wds: WordSeq,
bitForm: Format,
fieldForm: Format ];
Format: TYPE = REF FormatSeq;
FormatSeq: TYPE = RECORD[SEQUENCE size: CARDINAL OF FormatRec];
FormatList: TYPE = LIST OF FormatRec;
FormatRec:
TYPE =
RECORD[
name: ROPE,
nameInv: ROPE,
type: Type,
firstBit: CARDINAL,
bitSize: CARDINAL ];
WordSeq: TYPE = AMBridge.WordSequence;
ROPE: TYPE = Rope.ROPE;
TV: TYPE = AMTypes.TV;
Type: TYPE = AMTypes.Type;
The Basics - all you really need to get and set bits inside REFs
Size: PROC[ref: REF] RETURNS [index: INT];
Get: PROC[ref: REF, index: INT] RETURNS [val: BOOL];
Set: PROC[ref: REF, index: INT, val: BOOL];
Extra stuff handy for speed, formats, names, printing etc.
ResetCache: PROC;
Desc: PROC[ref: REF] RETURNS [desc: REFBitDesc];
BitNameList: PROC[ref: REF, both: BOOL] RETURNS [list: LIST OF ROPE];
NEWFromName: PROC[record: ROPE] RETURNS [ref: REF];
DescWdsToTV: PROC[desc: REFBitDesc];
TVToDescWds: PROC[desc: REFBitDesc];
FormatListing: PROC[record: REF, bitLevel: BOOL←FALSE] RETURNS [listing: ROPE];
END.