<> <> <> DIRECTORY AMTypes, List, Rope, ViewerClasses, VFonts; ViewRec: CEDAR DEFINITIONS IMPORTS VFonts = BEGIN <> ROPE: TYPE = Rope.ROPE; Viewer: TYPE = ViewerClasses.Viewer; TypedVariable: TYPE = AMTypes.TypedVariable; Type: TYPE = AMTypes.Type; <> <> ViewRef: PROC [ agg: REF ANY, specs: BindingList _ NIL, <> label: ROPE _ NIL, <> otherStuff: OtherStuffProc _ NIL, <> toButt: Closure _ [], <<"toButt" is invoked when CONTROL-RETURN is typed in a Value Viewer by the User.>> parent: RecordViewer _ NIL, <> asElement: EltHandle _ NIL, <> sample: BOOL _ TRUE, <<"sample" causes this RecordViewer to be put on a list of RV's to be sampled in the background to keep its display up to date.>> createOptions: CreateOptions _ [], <> viewerInit: ViewerClasses.ViewerRec _ [], <<"viewerInit" is for the usual Viewers initing stuff, except:>> <> <> <> <> <> <> wDir: ROPE _ NIL, <> paint: BOOL _ TRUE <> ] RETURNS [rv: RecordViewer]; NotAnAggregate: ERROR; <> OtherStuffProc: TYPE = PROC [in: Viewer] RETURNS [stuff: LIST OF Viewer]; Closure: TYPE = RECORD [ Proc: PROC [data: REF ANY] _ NIL, data: REF ANY _ NIL ]; EltHandle: TYPE = REF ANY; --type system lets us down <> RecordViewer: TYPE = REF RecordViewerPrivate; RecordViewerPrivate: TYPE; ViewTV: PROC [agg: TypedVariable, specs: BindingList _ NIL, label: ROPE _ NIL, otherStuff: OtherStuffProc _ NIL, toButt: Closure _ [], parent: RecordViewer _ NIL, asElement: EltHandle _ NIL, sample: BOOL _ TRUE, createOptions: CreateOptions _ [], viewerInit: ViewerClasses.ViewerRec _ [], wDir: ROPE _ NIL, paint: BOOL _ TRUE] RETURNS [rv: RecordViewer]; <> ViewInterface: PROC [name: ROPE, specs: BindingList _ NIL, label: ROPE _ NIL, otherStuff: OtherStuffProc _ NIL, toButt: Closure _ [], parent: RecordViewer _ NIL, asElement: EltHandle _ NIL, sample: BOOL _ TRUE, createOptions: CreateOptions _ [], viewerInit: ViewerClasses.ViewerRec _ [], wDir: ROPE _ NIL, paint: BOOL _ TRUE] RETURNS [RecordViewer]; <> ViewSelf: PROC; <> <> <> CreateOptions: TYPE = RECORD [ immProcFont: VFonts.Font _ NIL, --NIL means use Viewers default preProcFont: VFonts.Font _ NIL, --font for prepared procedure names doitFont: VFonts.Font _ NIL, --for the Doit button in Proc's args rec stateFont: VFonts.Font _ NIL, --for the State label in Proc's args rec nameFont: VFonts.Font _ NIL, --for first half of name:value pairs labelFont: VFonts.Font _ NIL, --for the label of the RecordViewer bordElts: BOOL _ FALSE, --draw border around every Name-Value pair bordRecs: BOOL _ TRUE, --border a Value if it is a RECORD bordImmProcs: BOOL _ TRUE, --border immediate PROCEDUREs bordPreProcs: BOOL _ TRUE, --border prepared PROCEDUREs bordDoit: BOOL _ TRUE, --border the Doit button in a Proc's args rec bordState: BOOL _ FALSE, --border the State label in a Proc's args vSep: CARDINAL _ 2, --spacing between lines of stuff hSep: CARDINAL _ 5, --spacing between things on a line vPad: CARDINAL _ 3, --height of Value boxes, beyond font height hPad: CARDINAL _ 1, --width of Value boxes, beyond string width nvSep: CARDINAL _ 3, --seperation between Name and Value vStilts: INTEGER _ 1, --artificially lower the Name Label this much feedBackHeight: CARDINAL _ 40, --how high the FeedBack Window is minFeedBackWidth: CARDINAL _ 100, --unless height is 0, of course minRecordWidth: CARDINAL _ 100, --lower bound for RECORDs defaultTargetWidth: CARDINAL _ 400, relayoutable: BOOL _ TRUE, mayInitiateRelayout: BOOL _ TRUE, maxEltsHeight: CARDINAL _ 290, --limits display for elements maxArgsHeight: CARDINAL _ 310, --limits PROC arg display height doAllRecords: BOOL _ FALSE, --if TRUE, every record is judged simple enough to attempt to display; components will still be judged individually exclusiveProcs: BOOL _ TRUE, --makes procs mutually exclusive holdOff: BOOL _ FALSE, --prevents actually calling PROCs highlightSelectedProc: BOOL _ TRUE, --causes current Proc Button to display Black on Grey other: List.AList _ NIL --for expansion ]; RightFont: PROC [f: VFonts.Font] RETURNS [rf: VFonts.Font] = INLINE {RETURN [IF f = NIL THEN VFonts.defaultFont ELSE f]}; <> <> <> <> <> <> <> <> <> <> <> BindingList: TYPE = LIST OF Binding; Binding: TYPE = RECORD [ name: Id, it: SELECT type: BindingType FROM Value => [val: TypedVariable, visible, editable, dontAssign: BOOL _ FALSE], Notify => [notify: NotifyClientProc, clientData: REF ANY _ NIL], TryRecognizer => [recognizer: Recognizer], Group => [sublist, altSublist: BindingList _ NIL], ENDCASE]; BindingType: TYPE = {Value, Notify, TryRecognizer, Group}; Id: TYPE = REF ANY; --actually UNION [ROPE, REF TEXT, REF INT (origin 1) (negatives mean count from end), all]; BadID: ERROR [id: Id]; <> all: Id; Int: TYPE = REF INT; NotifyClientProc: TYPE = PROC [clientData: REF ANY]; BindAllOfATypeFromTVs: PROC [ aggType, eltType: Type, name: ROPE _ NIL, b: Binding --fill the "it" field with what you want ] RETURNS [BindingList]; <> <> BindAllOfATypeFromRefs: PROC [rec, handle: REF ANY, name: ROPE _ NIL, visible, editable, dontAssign: BOOL _ FALSE] RETURNS [BindingList]; <> BindAllOfANameInType: PROC [agType: Type, name: ROPE, b: Binding] RETURNS [bl: BindingList]; BindAllOfANameFromRef: PROC [agInst: REF ANY, name: ROPE, val: REF ANY, visible, editable, dontAssign: BOOL _ FALSE] RETURNS [bl: BindingList]; BindingListAppend: PROC [a, b: BindingList] RETURNS [c: BindingList]; <> <> GetWorkingDirectory: PROC [rv: RecordViewer] RETURNS [wDir: ROPE]; SetWorkingDirectory: PROC [rv: RecordViewer, new: ROPE] RETURNS [old: ROPE]; ReLayout: PROC [rv: RecordViewer, targetWidth: INTEGER _ 0, paint, forkResize: BOOL]; <> SampleRV: PROC [rv: RecordViewer]; <> RedisplayElt: PROC [eh: REF ANY]; <> CallSelectedProc: PROC [in: RecordViewer] RETURNS [refused: BOOL]; NoSelectedProc: ERROR; DisplayMessage: PROC [rv: RecordViewer, msg: ROPE]; <> clearMessagePlace: READONLY ROPE; <> SetUserAbort: PROC [who: REF ANY, newLevel: CARDINAL _ 100]; <> <> IncrementUserAbort: PROC [who: REF ANY, deltaLevel: INTEGER]; TestUserAbort: PROC [who: REF ANY] RETURNS [abort: CARDINAL]; TestAndMaybeResetUserAbort: PROC [who: REF ANY, threshold: CARDINAL _ 100] RETURNS [abort: CARDINAL --will be 0 or >= threshold--]; <= threshold, it is reset to 0, and the old value returned; otherwise it is left as it was, and 0 is returned.>> ProcessAbort: PROC [who: REF ANY] RETURNS [found: BOOL]; <> GetEltHandle: PROC [rv: RecordViewer, name: Path] RETURNS [eh: EltHandle]; Path: TYPE = LIST OF Id; --outermost first NotFound: ERROR [name: Path]; <> <> RVQuaViewer: PROC [RecordViewer] RETURNS [Viewer]; ViewerIsRV: PROC [Viewer] RETURNS [BOOL]; ViewerQuaRV: PROC [Viewer] RETURNS [RecordViewer]; IsRV: PROC [REF ANY] RETURNS [BOOL]; NarrowToRV: PROC [REF ANY] RETURNS [RecordViewer]; <> Help: PROC; <> GetName: PROC [tv: TypedVariable --record or structure--] RETURNS [name: ROPE]; <> <> <> RegisterRecognizerByType: PROC [r: Recognizer, end: AddPlace, type: Type--unreduced--, reductions: Reductions]; RegisterRecognizerBeforeReductions: PROC [r: Recognizer, end: AddPlace, applyBefore: Reductions]; RegisterRecognizerToApplyAfterAll: PROC [r: Recognizer, end: AddPlace]; Reductions: TYPE = {EquivalenceClass, StripSubranges, TypeClass}; AddPlace: TYPE = {Front, Back--of list of others already there--}; Recognizer: TYPE = PROC [ t: Type, --unreduced onlyRecognize: BOOL, --don't bother to produce the handler and handlerData specs: BindingList, --what will apply to this element createOptions: CreateOptions--for aggregate containing this elt ] RETURNS [ IKnowYou: BOOL, handler: Handler, handlerData: REF ANY _ NIL]; Handler: TYPE = REF ANY; --actually UNION {SimpleHandler, ComplexHandler} SimpleHandler: TYPE = REF SimpleHandlerRep; SimpleHandlerRep: TYPE = RECORD [ Parse: ParseProc, --NIL => read-only operation UnParse: UnParseProc, Max: MaxProc, Butt: ButtProc _ NIL --NIL => can't increment or decrement ]; ParseProc: TYPE = PROC [asRope: ROPE, tv: TypedVariable, targType: Type, handlerData: REF ANY] RETURNS [ok: BOOL]; UnParseProc: TYPE = PROC [tv: TypedVariable, targType: Type, handlerData: REF ANY] RETURNS [asRope: ROPE]; MaxProc: TYPE = PROC [tv: TypedVariable, targType: Type, handlerData: REF ANY] RETURNS [maxWidthNeeded: INTEGER, lines: REAL _ 1]; ButtProc: TYPE = PROC [tv: TypedVariable, targType: Type, handler: SimpleHandler, handlerData: REF ANY, which: {Succ, Pred}] RETURNS [new: TypedVariable, msg: ROPE _ NIL]; ComplexHandler: TYPE = REF ComplexHandlerRep; ComplexHandlerRep: TYPE = RECORD [ producer: ComplexProducer, <> relayouter: ReLayouter _ NIL, updater: Updater, <> elementGiver: ElementGiver _ NIL <> ]; ComplexProducer: TYPE = PROC [tv: TypedVariable, context: Context, handlerData: REF ANY] RETURNS [v: Viewer, clientData: REF ANY, sampleable: BOOL _ TRUE]; ReLayouter: TYPE = PROC [v: Viewer, maxWidth: INTEGER, handlerData, clientData: REF ANY]; Updater: TYPE = PROC [tv: TypedVariable, v: Viewer, handlerData, clientData: REF ANY]; ElementGiver: TYPE = PROC [agg: TypedVariable, which: Id, handlerData, clientData: REF ANY] RETURNS [eh: EltHandle]; Context: TYPE = RECORD [ main: Viewer, for: RecordViewer, maxWidth: INTEGER, name: ROPE, thisElement: EltHandle, createOptions: CreateOptions, notifies: NotifyList, bindings: BindingList, toButt: Closure]; NotifyList: TYPE = LIST OF NotifyRequest; NotifyRequest: TYPE = RECORD [proc: NotifyClientProc, clientData: REF ANY]; FinishPendingBusiness: PROC RETURNS [okToProceed: BOOL]; <> SetPendingBusiness: PROC [proc: FinishProc _ NIL, data: REF ANY _ NIL]; FinishProc: TYPE = PROC [data: REF ANY] RETURNS [okToProceed: BOOL]; RecognizeRope, RecognizeAtom, RecognizeNumber, RecognizeEnumeration, RecognizeRecord, RecognizeSequence--also works on ARRAYs--: Recognizer; <> RecognizeBoolShort: Recognizer; <> <> SimpleEnough: PROC [rt: --an aggregate--Type, specs: BindingList, createOptions: CreateOptions] RETURNS [ok: BOOL, count--of visible elements--: CARDINAL]; <> BehaviorOptions: TYPE = RECORD [ delayParms: DelayParms _ [] --controls delay in sampling process ]; <> DelayParms: TYPE = RECORD [ min: REAL _ 200, max: REAL _ 3000, offset: REAL _ 0, dActive: REAL _ 0, dExtant: REAL _ 0, dElt: REAL _ 0, dMicroseconds: REAL _ 4E-3, --wait 4 times as long as you work priority: DelayPriority _ Normal]; DelayPriority: TYPE = {Normal, Background, Foreground}; delayed: READONLY REAL; --running average of sample time, weights are z**n z: REAL; behavior: BehaviorOptions; <> SetBehavior: PROC [newBehavior: BehaviorOptions _ []]; <> END.