<> <> <> <<>> <<>> DIRECTORY AMBridge, AMTypes, Convert, DM, DragOpsCrossUtils, IO, PrintTV, Rope; <<>> <<>> DMImpl: CEDAR PROGRAM IMPORTS AMBridge, Convert, DragOpsCrossUtils, IO, PrintTV EXPORTS DM = BEGIN OPEN DM; Apply: PUBLIC PROC [component: Component, action: Action] = { IF component#NIL THEN component.action[action][component] }; ListApply: PUBLIC PROC [componentList: ComponentList, action: Action] = { <> FOR cl: ComponentList _ componentList, cl.rest WHILE cl#NIL DO cl.first.action[action][cl.first] ENDLOOP }; ConsHistory: PUBLIC PROC [phase: Action, data: REF ANY, history: LIST OF HistoryElement] RETURNS [newHistory: LIST OF HistoryElement] = { he: HistoryElement _ NEW [HistoryElementRec _ [phase: phase, data: data]]; newHistory _ CONS[he, history] }; PrintHistory: PUBLIC PROC [c: DM.Component, out: IO.STREAM] = { tv: AMTypes.TV; <> out.PutF["Component: %g\n", [rope[Convert.RopeFromAtom[c.componentType]]]]; FOR h: LIST OF HistoryElement _ Reverse[c.history], h.rest WHILE h#NIL DO TRUSTED{tv _ AMBridge.TVForReferent[h.first]}; PrintTV.Print[tv: tv, put: out, depth: 1000, width: 1000, verbose: FALSE]; out.PutF["\n"] ENDLOOP; out.PutF["\n"]; <> FOR cl: DM.ComponentList _ c.subComponents, cl.rest WHILE cl#NIL DO PrintHistory[cl.first, out] ENDLOOP }; Reverse: PROC [list: LIST OF HistoryElement] RETURNS [rev: LIST OF HistoryElement] = { rev _ NIL; WHILE list#NIL DO rev _ CONS[list.first, rev]; list _ list.rest ENDLOOP; }; PrintWord: PrintTV.TVPrintProc = { <<[tv: TV, data: REF ANY, stream: STREAM, depth: INT _ 4, width: INT _ 32, verbose: BOOL _ FALSE] RETURNS [useOld: BOOL _ FALSE]>> wdRef: REF Word; TRUSTED{wdRef _ NARROW[AMBridge.SomeRefFromTV[tv]]}; stream.Put[[integer[DragOpsCrossUtils.WordToInt[wdRef^]]]] }; PrintTV.RegisterTVPrintProc[type: CODE[Word], proc: PrintWord]; END.