DIRECTORY CD, Rope; PWDescr: CEDAR DEFINITIONS = BEGIN ROPE: TYPE = Rope.ROPE; allOnes: INT = LAST[INT]; -- same as 2B10-1=2147483647 Descriptor: TYPE = REF DescriptorRec; DescriptorRec: TYPE = RECORD[ genRef: REF, items: SEQUENCE size: CARDINAL OF Item]; -- which generator to use Item: TYPE = REF ItemRec; ItemRec: TYPE = RECORD [ name: ROPE _ NIL, -- name of the field, e.g. cAdr data: REF _ NIL, -- think of it as a property specificRef: REF _ NIL]; BitRef: TYPE = REF BitRec; -- coded on one wire BitRec: TYPE = RECORD[val: BOOL _ FALSE]; BoolRef: TYPE = REF BoolRec; -- coded on two wires BoolRec: TYPE = RECORD[val0, val1: BOOL]; IntRef: TYPE = REF IntRec; -- every bit is coded as a boolean IntRec: TYPE = RECORD[val, mask: INT, bools: SEQUENCE nbBits: CARDINAL OF BoolRef]; PadRef: TYPE = REF PadRec; -- no value, but positions PadRec: TYPE = RECORD[SEQUENCE size: CARDINAL OF INT]; RopesToDescr: PUBLIC PROC [names: LIST OF ROPE, genRef: REF _ NIL] RETURNS [descr: Descriptor]; SetTypeBit: PUBLIC PROC [descr: Descriptor, name: ROPE, initVal: BOOL _ FALSE, data: REF _ NIL]; SetTypeBool: PUBLIC PROC [descr: Descriptor, name: ROPE, initVal: BOOL _ FALSE, complement: BOOL _ FALSE, data: REF _ NIL]; SetTypeInt: PUBLIC PROC [descr: Descriptor, name: ROPE, nbBits: INT, initVal: INT _ 0, complement: INT _ 0, data: REF _ NIL]; SetTypePad: PUBLIC PROC [descr: Descriptor, name: ROPE, padRef: PadRef, data: REF _ NIL]; SetBit: PUBLIC PROC [descr: Descriptor, name: ROPE, val: BOOL]; SetBool: PUBLIC PROC [descr: Descriptor, name: ROPE, val: BOOL, complement: BOOL _ TRUE]; SetInt: PUBLIC PROC [descr: Descriptor, name: ROPE, val: INT, complement: INT _ allOnes]; SetData: PUBLIC PROC [descr: Descriptor, name: ROPE, data: REF]; NameToItem: PUBLIC PROC [descr: Descriptor, name: ROPE] RETURNS [item: Item]; IsInDescr: PUBLIC PROC [descr: Descriptor, name: ROPE] RETURNS [yes: BOOL]; ForEachItemProc: TYPE = PROC [item: Item]; EnumerateItems: PUBLIC PROC [descr: Descriptor, forEachItemDo: ForEachItemProc]; END. ŠPWDescr.mesa Copyright c 1984 by Xerox Corporation. All rights reversed. Created by Louis Monier, July 19, 1985 11:55:35 am PDT Last Edited by: Monier, May 29, 1985 9:58:30 am PDT Bertrand Serlet November 26, 1985 11:47:40 am PST -- Types for describing control parts -- Specific refs -- A single bit (clock) -- A pair of bits (usually complementary values) -- A sequence of booleans, high order bit=0 "on the left" -- A set of "things" --Turn a list of ropes in a vanilla descriptor of the appropriate size -- Set the type of an item, with an initial value if you wish and a data (usually an atom) -- Set the value of an item; complement has to be interpeted bitwise as follows: if set to TRUE, then [val0, val1] _ [val, ~val], otherwise [val0, val1] _ [val, val] SetMask: PUBLIC PROC [descr: Descriptor, name: ROPE, mask: INT]; -- Find an item by name -- Enumeration procs (the order matters) ΚΖ˜– "Cedar" stylešœ ™ Jšœ Οmœ1™Jš œžœžœ žœ žœ žœžœ ˜SJ™JšŸœžœžœ  ˜6Jš œžœžœžœžœžœžœ˜6—J™šŸœD™FJšŸ œž œ žœžœžœžœžœžœ˜_—™ZJšŸ œž œžœ žœžœžœžœŸ˜`JšŸ œžœžœžœ žœžœ žœžœžœžœ˜{JšŸ œžœžœžœ žœ žœžœ žœžœ˜}Jš Ÿ œžœžœžœžœžœ˜Y—šœ¦™¦Jš Ÿœžœžœžœžœ˜?JšŸœžœžœžœžœžœžœ˜YJš Ÿœž œžœžœžœ ˜YJšŸœž œžœžœ™@JšŸœž œžœžœ˜@—™Jš Ÿ œžœžœžœžœ˜MJš Ÿ œžœžœžœžœžœ˜K—™(JšŸœžœžœ˜*JšŸœž œ5˜P—J˜J˜—Jšžœ˜—…—τD