DIRECTORY IO USING [PutFR, int], PlotGraph, Rope USING [ROPE, Cat, Equal], Vector2; PlotGraphTestImpl: CEDAR PROGRAM IMPORTS PlotGraph, IO, Rope ~ BEGIN VEC: TYPE ~ Vector2.VEC; VecList: TYPE ~ LIST OF VEC; DisplayList: TYPE = LIST OF DisplayListRec; DisplayListRec: TYPE = RECORD [ name: Rope.ROPE, analog: BOOLEAN _ TRUE, or: VEC, list: VecList ]; plot: PlotGraph.Plot; txt1, txt2: PlotGraph.PlotText; testGClass: PlotGraph.GraphClass _ NEW[PlotGraph.GraphClassRec _ [ insert: NIL, delete: NIL, enumerate: TestEnum ]]; dummyAxisData: PlotGraph.AxisData _ [1000.0, FALSE, FALSE]; displayList: DisplayList; m: INT; index: CARDINAL _ 0; window: PlotGraph.Rectangle _ [0.0, 0.0, 5000.0, 6400.0]; PointBelongsTo: PROC [pt: VEC, rect: PlotGraph.Rectangle] RETURNS [BOOLEAN _ FALSE] ~ { RETURN[TRUE]; }; TestEnum: PROC [plot: PlotGraph.Plot, graph: PlotGraph.Graph, bounds: PlotGraph.Rectangle, eachPoint: PlotGraph.PointProc, data: REF ANY _ NIL] RETURNS [invalidEnumeration: BOOL _ FALSE] ~ { quit: BOOLEAN _ FALSE; FOR iDisplayList: DisplayList _ displayList, iDisplayList.rest UNTIL iDisplayList=NIL OR quit DO IF Rope.Equal[iDisplayList.first.name, graph.name] THEN FOR iVecList: VecList _ iDisplayList.first.list, iVecList.rest UNTIL iVecList=NIL DO IF PointBelongsTo[iVecList.first, bounds] THEN quit _ eachPoint[iVecList.first.x, iVecList.first.y, data] ENDLOOP; ENDLOOP; }; DataGenerator: PUBLIC PROC [numberOfItems: INT _ 1, length: INT _ 64, x0: REAL _ 0.0, analog: BOOLEAN _ TRUE, yMult: REAL _ 1.0, oldDisplayList: DisplayList _ NIL] RETURNS [displayList: DisplayList] ~ { displayList _ oldDisplayList; FOR n: INT IN [0..numberOfItems) DO displayList _ CONS[[ name: Rope.Cat["n", IO.PutFR["%d", IO.int[index _ SUCC[index]]]], analog: analog, or: [0.0, 0.0], list: NIL], displayList]; FOR i: INT IN [0..length) DO m _ (i /(3+n)) MOD 2; displayList.first.list _ CONS[[x: i*2000.0 + x0, y: 5000.0*yMult*m], displayList.first.list]; ENDLOOP; ENDLOOP; }; plot _ PlotGraph.CreatePlot["Test"]; txt1 _ NEW[PlotGraph.PlotTextRec _ [ contents: "Test of PlotGraph", bounds: [0.1, 0.0, 0.0, 0.0] ]]; txt2 _ NEW[PlotGraph.PlotTextRec _ [ contents: "Justify and Rotate", bounds: [0.1, 0.5, 0.5, 0.1], rotation: 45.0, justifyX: center, justifyY: center ]]; plot.texts _ LIST [txt1, txt2]; plot.lowerBounds _ [0.0, 0.0]; plot.upperBounds _ [64*2000.0, 5000.0]; displayList _ DataGenerator[8]; displayList _ DataGenerator[numberOfItems: 4, analog: FALSE, yMult: 0.031, oldDisplayList: displayList] ; dummyAxisData.visible _ TRUE; FOR iDisplayList: DisplayList _ displayList, iDisplayList.rest UNTIL iDisplayList=NIL DO plot.axis _ CONS[NEW[PlotGraph.AxisRec _ [ graphs: LIST[NEW[PlotGraph.GraphRec _ [ class: testGClass, name: iDisplayList.first.name ]]], bounds: [0.0, 0.0, 64*2000.0, 5000.0], name: "axis name here", style: IF iDisplayList.first.analog THEN analog ELSE hexaH, axisData: [dummyAxisData, dummyAxisData] ]], plot.axis]; ENDLOOP; plot.axis.first.style _ hexaV; PlotGraph.RefreshPlot[plot: plot, within: window, eraseFirst: TRUE]; END. ’PlotGraphTestImpl.mesa Copyright c 1986 by Xerox Corporation. All rights reserved. Christian LeCocq, August 13, 1986 11:51:06 am PDT Barth, August 25, 1986 12:32:39 pm PDT Test of the PlotGraph oscilloscope. Generates data IF pt.xrect.x+rect.w THEN RETURN; IF pt.yrect.y+rect.h THEN RETURN; generate numberOfItems lists of values named n0, n1...np. Κ`˜codešœ™Kšœ Οmœ1™žœ˜DKšžœ˜—…— δζ