<> <> <> <> DIRECTORY Rope USING [ROPE], SafeStorage USING [Type, nullType], WorldVM USING [World]; AMTypes: CEDAR DEFINITIONS = BEGIN OPEN Rope, WorldVM; <> <> <> <<>> <> <<>> Type: TYPE = SafeStorage.Type; nullType: Type = SafeStorage.nullType; TypedVariable: TYPE = REF ANY; TV: TYPE = TypedVariable; <> Status: TYPE = {mutable, readOnly, const}; <> <> <> <> Index: TYPE = NAT; <> Class: TYPE = { definition, <> cardinal, longCardinal, integer, longInteger, real, character, <> atom, rope, list, ref, pointer, longPointer, descriptor, longDescriptor, basePointer, relativePointer, <
> procedure, signal, error, program, port, <> enumerated, <> subrange, <> union, sequence, <> record, structure, <> <> array, <> countedZone, uncountedZone, <> nil, <> unspecified, <> process, <> type, <> opaque, <> any, <> globalFrame, localFrame <> <> }; <<>> <> <<>> Error: ERROR[ reason: ErrorReason, msg: ROPE _ NIL, type: Type _ nullType, -- used with TypeFault, IncompatibleTypes otherType: Type _ nullType -- used with IncompatibleTypes ]; ErrorReason: TYPE = { noSymbols, -- msg has moduleName notImplemented, -- mostly DefaultInitialValue cases incompatibleTypes, -- raised by Assign rangeFault, -- e.g. empty subrange, Apply bounds check notMutable, -- raised by (e.g.) Assign internalTV, -- raised by (e.g.) RefFromTV badName, -- raised by NameToIndex badIndex, -- raised by (e.g.) IndexToType typeFault -- general applicability violation }; <<>> <

> <<>> <> Size: PROC [type: Type, length: CARDINAL _ 0] RETURNS [words: INT]; <<... returns the # of words for the given type. For sequences only, the # of elements must be supplied as well. For unions, the max # of words will be returned.>> DefaultInitialValue: PROC [type: Type] RETURNS [TV]; <<... returns the default initialization for the type. This is useless for record components, since the default initialization is usually associated with the component instead of the type, so use IndexToDefaultInitialValue instead in that case. There are a lot of initial values that the compiler can handle but AMTypes cannot handle, especially initialization to variables or procedure calls (can raise Error[notImplemented]).>> IndexToDefaultInitialValue: PROC [type: Type, index: Index] RETURNS [TV]; <> <<... returns the initial value associated with the given component of the type.>> TypeClass: PROC [type: Type] RETURNS [Class]; <> UnderClass: PROC [type: Type] RETURNS [Class]; <> IsPainted: PROC [type: Type] RETURNS [BOOL]; <> <<>> <> TVType: PROC [tv: TV] RETURNS [Type]; <> TVStatus: PROC [tv: TV] RETURNS [Status]; <> TVSize: PROC [tv: TV] RETURNS [words: INT]; <> <<>> GetEmptyTV: PROC RETURNS [TV]; <> <<>> <> New: PROC [type: Type, status: Status _ mutable, world: World _ NIL, tag: TV _ NIL] RETURNS [TV]; <> <<... creates and returns a cleared object of a give type for the given world (if remote, this is a copied remote object). tag has meaning only for union or sequence-containing record types. See DefaultInitialValue. If world = NIL, then WorldVM.LocalWorld[] is used.>> Copy: PROC [tv: TV] RETURNS [TV]; <> <<... returns a copy of the TV (in the same world). This generates a new variable. The returned TV will have mutable status.>> Assign: PROC [lhs, rhs: TV]; <> <> <<... assigns the value of rhs to lhs; will raise Error[notMutable] if TVStatus[lhs] # mutable >> AssignNew: PROC [lhs, rhs: TV]; <<... assigns the value of rhs to lhs for initialization only; will raise Error[notMutable] if TVStatus[lhs] # mutable>> <<>> TVEq: PROC [tv1, tv2: TV] RETURNS [BOOL]; <> TVEqual: PROC [tv1, tv2: TV] RETURNS [BOOL]; <> <<>> <> NComponents: PROC [type: Type] RETURNS [Index]; <> <<... returns the # of components for the type>> VariableType: PROC [type: Type] RETURNS [v: Type, c: Class]; <> <> <> IndexToTV: PROC [tv: TV, index: Index] RETURNS [TV]; <> <> IndexToType: PROC [type: Type, index: Index] RETURNS [Type]; <> <<... returns the specified component of the type (SPECIAL CASE for union types: index = 0 gets you the tag type>> NameToIndex: PROC [type: Type, name: ROPE] RETURNS [CARDINAL]; <> <<... returns the name associated with the given component (raises Error[badName] if no such named component)>> IndexToName: PROC [type: Type, index: CARDINAL] RETURNS [ROPE]; <> <<... returns the name associated with the given component (SPECIAL CASE for union types: index = 0 gets you the tag name)>> TVToType: PROC [tv: TV] RETURNS [Type]; <> <<... returns the type that tv holds (NOT the type of the value that TV holds)>> TVToName: PROC [tv: TV] RETURNS [ans: ROPE]; <> Tag: PROC [tv: TV] RETURNS [TV]; <> <> Variant: PROC [tv: TV] RETURNS [TV]; <> <> IsOverlaid: PROC [type: Type] RETURNS [BOOL]; <> IsMachineDependent: PROC [type: Type] RETURNS [BOOL]; <> Domain: PROC [type: Type] RETURNS [Type]; <> <<(not atom, rope)>> <> Range: PROC [type: Type] RETURNS [Type]; <> <> IsPacked: PROC [type: Type] RETURNS [BOOL]; <> IsComputed: PROC [type: Type] RETURNS [BOOL]; <> Apply: PROC [mapper: TV, arg: TV] RETURNS [TV]; <> <<>> Length: PROC [tv: TV] RETURNS [INT]; <> <> Fetch: PROC [tv: TV, index: INT] RETURNS [CHAR]; <> <> Referent: PROC [tv: TV, base: TV _ NIL] RETURNS [TV]; <> <> <> ConcreteRef: PROC [tv: TV] RETURNS [TV]; <> <. NIL -> NIL. ConcreteRef is implemented only for REFs that are really ATOM, LIST or ROPE guys (Error[reason: notImplemented] is raised otherwise)>> ReferentStatus: PROC [type: Type--address (not basePointer, atom)--] RETURNS [Status]; <> IsRefAny: PROC [type: Type] RETURNS [BOOL]; <> IsInterface: PROC [type: Type] RETURNS [BOOL]; <> IsAtom: PROC [tv: TV] RETURNS [BOOL]; <> IsRope: PROC [tv: TV] RETURNS [BOOL]; <> IsNil: PROC [tv: TV] RETURNS [BOOL]; <> IsOrdered: PROC [type: Type] RETURNS [BOOL]; <> PropertyList: PROC [tv: TV] RETURNS [TV]; <> <> Coerce: PROC [tv: TV, targetType: Type] RETURNS [TV]; <> TypeToName: PROC [type: Type, moduleName: REF ROPE _ NIL, fileName: REF ROPE _ NIL] RETURNS [ROPE]; <> Ground: PROC [type: Type] RETURNS [Type]; <> GroundStar: PROC [type: Type] RETURNS [Type]; <> UnderType: PROC [type: Type] RETURNS [Type]; <> InRange: PROC [type: Type, groundTV: TV] RETURNS [BOOL]; <> <> First: PROC [type: Type] RETURNS [TV]; <> Last: PROC [type: Type] RETURNS [TV]; <> Next: PROC [tv: TV] RETURNS [TV]; <> <> <<>> Prev: PROC [tv: TV] RETURNS [TV]; <> <> NValues: PROC [type: Type] RETURNS [INT]; <> Value: PROC [type: Type, index: CARDINAL] RETURNS [TV]; <> <> StaticParent: PROC [tv: TV] RETURNS [TV]; <> <> <> Locals: PROC [tv: TV] RETURNS [TV]; <> <> EnclosingBody: PROC [tv: TV] RETURNS [TV]; <> <> Argument: PROC [tv: TV, index: Index] RETURNS [TV]; <> <> Result: PROC [tv: TV, index: Index] RETURNS [TV]; <> <> Procedure: PROC [tv: TV--localFrame--] RETURNS [TV--procedure--]; <> <> Signal: PROC [tv: TV--catch frame--] RETURNS [TV--signal descriptor--]; <> <> IsCatch: PROC [tv: TV] RETURNS [BOOL]; <> <<... returns TRUE iff the TV is for a catch frame (and therefore should work if given to Signal). This is useful when trying to print a local frame.>> DynamicParent: PROC [tv: TV] RETURNS [TV]; <> <> GlobalParent: PROC [tv: TV] RETURNS [TV]; <> <> Globals: PROC [tv: TV] RETURNS [TV]; <> <> END.