GraphUtil.mesa, Copyright © 1985 by Xerox Corporation. All rights reserved.
Last edited:
Sweetsun Chen, November 23, 1985 5:57:10 pm PST
DIRECTORY
Buttons USING [Button],
Graph USING [BackgroundIndex, Chart, ColorIndex, Controller, Entity, EntityGroup, EntityGroupList, EntityList, GraphHandle, NullRect, NullVec, OutputType, ROPE, SegmentDataList, Text, Texts, ValueList, Viewer, XY],
Imager USING [Box, ConstantColor, Rectangle, VEC],
ImagerColor USING [RGB],
ImagerColorDefs USING [ConstantColor],
ImagerFont USING [Font];
GraphUtil:
CEDAR
DEFINITIONS = {
OPEN Graph;
error checking
Error: SIGNAL[atom: ATOM, info: ROPE ← NIL];
RaiseError: PROC [atom: ATOM, msg: ROPE ← NIL];
BlinkMsg: PROC [msg: ROPE ← NIL];
HandleNotNil: PROC [handle: GraphHandle, msg: ROPE ← NIL, debug: BOOL ← FALSE] RETURNS [ok: BOOL];
ChartNotNil: PROC [chart: Chart, msg: ROPE ← NIL, debug: BOOL ← FALSE] RETURNS [ok: BOOL];
ViewerNotNil: PROC [viewer: Viewer, msg: ROPE ← NIL, debug: BOOL ← FALSE] RETURNS [ok: BOOL];
GraphViewerExits: PROC [handle: GraphHandle, msg: ROPE ← NIL, debug: BOOL ← FALSE] RETURNS [ok: BOOL];
ControllerNotNil: PROC [c: Controller, msg: ROPE ← NIL, debug: BOOL ← FALSE] RETURNS [ok: BOOL];
ControllerViewerExits: PROC [handle: GraphHandle, msg: ROPE ← NIL, debug: BOOL ← FALSE] RETURNS [ok: BOOL];
BoundsValid: PROC [box: Imager.Box] RETURNS [BOOL];
DivisionsValid: PROC [divX, divY: INT] RETURNS [BOOL];
RectangleValid: PROC[rect: Imager.Rectangle ← NullRect] RETURNS [BOOL];
colors
ColorValueOk: PROC [value: REAL ← 0.0, blinkMsg: BOOL ← TRUE] RETURNS [ok: BOOL ← TRUE];
ForegroundColor: PROC [background: BackgroundIndex ← white, output: OutputType ← screen] RETURNS [Imager.ConstantColor];
BackgroundColor: PROC [background: BackgroundIndex ← white, output: OutputType ← screen] RETURNS [Imager.ConstantColor];
UseMyColors: PROC [handle: GraphHandle];
SetColor: PROC [index: ColorIndex ← 0, rgb: ImagerColor.RGB ← [0, 0, 0]] RETURNS [ImagerColorDefs.ConstantColor];
UseDefaultColors: PROC [handle: GraphHandle ← NIL];
UseCedarColors: PROC [];
SetCursorForBackgroundIndex: PROC [bkgnd: BackgroundIndex ← white];
UseDefaultFonts:
PROC [handle: GraphHandle];
handle must not be nil !!
UseMyFonts:
PROC [handle: GraphHandle];
handle can not be nil !! display is not altered.
coordinates and coordinates transformation
InViewer: PROC [viewer: Viewer, x, y: INTEGER] RETURNS [BOOL];
CrossSegment: PROC [xseg, yseg: SegmentDataList, at: REAL] RETURNS [ok: BOOL, v1, v2: Imager.VEC];
InterOrExtraPolate: PROC [v1, v2: Imager.VEC, x: REAL] RETURNS [REAL];
Crosssection: PROC [xseg, yseg: SegmentDataList, at: REAL] RETURNS [ok: BOOL, value: REAL];
RealToScreen: PROC [handle: GraphHandle, r: REAL, xy: XY ← x] RETURNS [REAL];
RealToScreenI: PROC [handle: GraphHandle, r: REAL, xy: XY ← x] RETURNS [INTEGER];
RealToScreenRel: PROC [handle: GraphHandle, r: REAL, xy: XY ← x] RETURNS [REAL];
RealVecToScreenVec: PROC [handle: GraphHandle, vec: Imager.VEC] RETURNS [Imager.VEC];
ScreenToReal: PROC [handle: GraphHandle, s: REAL, xy: XY ← x] RETURNS [REAL];
ScreenIToReal: PROC [handle: GraphHandle, s: INTEGER, xy: XY ← x] RETURNS [REAL];
ScreenIToRealVec: PROC [handle: GraphHandle, sx, sy: INTEGER] RETURNS [Imager.VEC];
TextPosToChartPos: PROC [axesRect: Imager.Rectangle, textPos: Imager.VEC] RETURNS [x, y: INTEGER];
ChartPosToTextPos: PROC [axesRect: Imager.Rectangle, chartPos: Imager.VEC] RETURNS [textPos: Imager.VEC];
TextRect: PROC[text: Text ← NIL, font: ImagerFont.Font ← NIL, axesRect: Imager.Rectangle ← NullRect] RETURNS [rect: Imager.Rectangle ← NullRect, hotPoint: Imager.VEC ← NullVec];
panel fields
SetToggleColor: PROC[switch: Buttons.Button ← NIL, on: BOOL ← TRUE, paint: BOOL ← TRUE] RETURNS [BOOL];
SetIntField: PROC [field: Viewer ← NIL, value: INT ← 0];
GetIntField: PROC [field: Viewer ← NIL, showMsg: BOOL ← TRUE] RETURNS [msg: ROPE ← NIL, int: INT ← 0];
SetRealField: PROC [field: Viewer ← NIL, value: REAL ← 0.0];
GetRealField: PROC [field: Viewer ← NIL, showMsg: BOOL ← TRUE] RETURNS [msg: ROPE ← NIL, real: REAL ← 0.0];
text and entity
FullName: PROC [entity: Entity] RETURNS [fullName: ROPE];
FontHeight: PROC [font: ImagerFont.Font] RETURNS [height: REAL];
RopeSize: PROC [rope: ROPE, font: ImagerFont.Font] RETURNS [width, height: REAL];
RemoveTextFromList: PROC [text: Text, texts: Texts];
RemoveEntityFromList: PROC [entity: Entity, entityList: EntityList];
TextFromId: PROC [texts: Texts, id: INT] RETURNS [text: Text];
EntityFromId: PROC [entityList: EntityList, id: INT] RETURNS [entity: Entity];
SpecIndexedText: PROC [controller: Controller, texts: Texts] RETURNS [text: Text];
SpecIndexedEntity:
PROC [controller: Controller, ref:
REF
ANY ←
NIL]
RETURNS [entity: Entity];
killOld below only "partially" kills the old list.
ReverseTexts: PROC [old: Texts, killOld: BOOL ← TRUE] RETURNS [new: Texts];
ReverseEntityList: PROC [old: EntityList, killOld: BOOL ← TRUE] RETURNS [new: EntityList];
ReverseValueList: PROC [old: ValueList, killOld: BOOL ← TRUE] RETURNS [new, last: ValueList];
CopyValueList: PUBLIC PROC [old: ValueList, killOld: BOOL ← TRUE] RETURNS [new, last: ValueList];
ReverseSDL: PROC [old: SegmentDataList, killOld: BOOL ← TRUE] RETURNS [new, last: SegmentDataList ← NIL]; -- killOld only "partially" kill the old.
InitSegEnd: PROC [entity: Entity];
SetSegments: PUBLIC PROC [entity: Entity]; -- called when x and y's segment.end's are intialized.
InitSegAll: PROC [entity: Entity];
UpdateSegEnd: PROC [entity: Entity, values: ValueList];
UpdateSegAll: PROC [entity: Entity, values: ValueList];
LengthOfVL: PROC [valueList: ValueList] RETURNS [INT];
LengthOfEL: PROC [entityList: EntityList, group: EntityGroup ← NIL] RETURNS [INT];
LengthOfSDL: PROC [segmentDataList: SegmentDataList ← NIL] RETURNS [INT];
AppendX: PROC [xEntity: Entity, newx: REAL] RETURNS [oldx: REAL];
AppendY: PROC [entity: Entity, y, x1, x2: REAL] RETURNS [oldy: REAL];
AppendTexts: PROC [first, second: Texts] RETURNS [new: Texts];
AppendEntityList: PROC [first, second: EntityList] RETURNS [new: EntityList];
AppendEGL: PROC [first, second: EntityGroupList] RETURNS [new: EntityGroupList];
NewTextId: PROC [handle: GraphHandle, tryId: INT] RETURNS [newId: INT];
NewEntityId: PROC [handle: GraphHandle, tryId: INT] RETURNS [newId: INT];
NewGroupId: PROC [handle: GraphHandle, tryId: INT] RETURNS [newId: INT];
graph
MergeGraph: PROC [handle: GraphHandle, graph: GRAPH, paint: BOOL ← TRUE];
ReplaceGraph: PROC[handle: GraphHandle, graph: GRAPH, paint: BOOL ← TRUE];
strings
FileFromSelection: PROC [wDir: ROPE ← NIL] RETURNS [file, msg: ROPE ← NIL];
ReplaceFileExt: PROC [file: ROPE, extension: ROPE ← NIL] RETURNS [new: ROPE];
WDirOfViewer: PROC [viewer: Viewer] RETURNS [wDir: ROPE ← NIL];
viewer, handle, properties
HandleFromViewer: PROC [viewer: Viewer ← NIL] RETURNS [GraphHandle];
VanillaHandle: PROC [] RETURNS [GraphHandle];
Cleanup: PROC [handle: GraphHandle, full: BOOL ← TRUE] RETURNS [GraphHandle];
AddProp: PROC [object: REF ANY, prop: ATOM, val: REF ANY];
FetchProp: PROC [object: REF ANY, prop: ATOM] RETURNS [val: REF ANY];
misc
Almost: PROC [p, q: REAL] RETURNS [a: BOOL ← TRUE];
DataBounds: PROC [entityList: EntityList, old: Imager.Box] RETURNS [Imager.Box];
Print: PROC[handle: GraphHandle, file: ROPE] RETURNS [msg: ROPE ← NIL];
NotANumber:
PROC [r:
REAL]
RETURNS [
BOOL] =
INLINE {
RETURN[LOOPHOLE[r, LONG CARDINAL] = 17740000001B]};
NotANan:
PROC [r:
REAL]
RETURNS [
BOOL] =
INLINE {
RETURN[LOOPHOLE[r, LONG CARDINAL] # 17740000001B]};
}.
LOG.
SChen, August 14, 1985 7:30:22 pm PDT, created.