DIRECTORY Commander USING [CommandProc, Register], IO USING [int, PutFR], Graph USING [GraphHandle, ValueList], GraphOps USING [AddCrossSection, EnlistEntity, Lock, NewGraph, SaveGraph, Unlock], RealFns USING [Sin]; WavesImpl: CEDAR PROGRAM IMPORTS Commander, IO, GraphOps, RealFns = BEGIN Waves: Commander.CommandProc = { -- plot five sinusoidal curves. numberOfCurves: INT = 5; p : REAL = 3.14159; PhaseShift: REAL = p/12.0; timeIncrement: REAL = 4.0/100.0; -- 100 time increments in 4p graphHandle: Graph.GraphHandle _ NIL; groupId: INT; [graphHandle, groupId] _ GraphOps.NewGraph[ fileName: "Waves.graph", bounds: [xmin: 0.0, ymin: -1.0, xmax: 4.0, ymax: 1.0] ]; IF graphHandle # NIL THEN { t, angle: REAL _ 0.0; GraphOps.Lock[graphHandle]; FOR i: INT IN [1..numberOfCurves] DO [] _ GraphOps.EnlistEntity[handle: graphHandle, groupId: groupId, name: IO.PutFR["Wave # %g", IO.int[i]]]; ENDLOOP; WHILE t <= 4.0 DO values: Graph.ValueList _ NIL; -- LIST OF REAL angle _ t*p; FOR i: INT IN [1..numberOfCurves] DO values _ CONS[RealFns.Sin[angle], values]; angle _ angle - PhaseShift; ENDLOOP; GraphOps.AddCrossSection[handle: graphHandle, x: t, yvalues: values, groupId: groupId]; t _ t + timeIncrement; ENDLOOP; msg _ GraphOps.SaveGraph[graphHandle]; GraphOps.Unlock[graphHandle]; }; }; -- Waves Commander.Register["Waves", Waves, "An application of the GraphOps interface."]; END. LOG. Chen, July 29, 1985 6:19:35 pm PDT, created. ΒWavesImpl.mesa Sweetsun Chen, November 21, 1985 10:57:12 pm PST -- some constants -- create the graph. -- lock it -- initialize curves. -- append x and y values. -- save and unlock it. Κ>˜™Icode™0—J™šΟk ˜ Jšœ œ˜(Jšœœ˜Jšœœ˜%Jšœ œD˜RJšœœ˜J˜—šœ œ˜Jšœ œ˜+—Jš˜J™šœ!Οc˜@J™Jšœœ˜JšΟgΠgkœ Ÿ˜Jšœ œŸœ˜JšœœžΠgi˜=J˜Jšœ™Jšœ!œ˜%Jšœ œ˜ šœ+˜+Jšœ˜Jšœ5˜5J˜—J˜šœœœ˜Jšœ œ˜J™ Jšœ˜J˜Jšœ™šœœœ˜$šœ/˜/Jšœœœ ˜:—Jšœ˜—J™Jšœ™šœ˜Jš œœžžž˜.Jšœ Ÿœ˜ šœœœ˜$Jšœ œ˜*Jšœ˜Jšœ˜—JšœW˜WJšœ˜Jšœ˜—J˜J™Jšœ&˜&Jšœ˜J˜—Jšœž˜ J˜—JšœP˜PJ˜Jšœ˜J˜šœ˜J˜,——…—€€