NodeStyleWorks.mesa
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Written by Bill Paxton, January 1981
Last changed by Bill Paxton, December 21, 1982 9:49 am
Last Edited by: Maxwell, January 6, 1983 8:08 am
Michael Plass, March 26, 1985 9:33:58 am PST
Rick Beach, March 27, 1985 9:38:55 am PST
Doug Wyatt, September 2, 1986 1:17:18 pm PDT
This is where the style machinery lives.
DIRECTORY
NodeStyle USING [NameParam, RealParam, Style],
NodeStyleOps USING [OfStyle],
Rope USING [ROPE],
TextLooks USING [Looks],
TJaM USING [Cmd, CommandProc, Dict, Array, Frame, Object];
NodeStyleWorks: CEDAR DEFINITIONS
~ BEGIN OPEN NodeStyle;
ROPE: TYPE ~ Rope.ROPE;
Object: TYPE ~ TJaM.Object;
OfStyle: TYPE ~ NodeStyleOps.OfStyle;
Execution Frames for Style Machinery
Frame: TYPE ~ TJaM.Frame;
defaultFrame: Frame;
GetFrame: PROC [style: Style, styleName: ATOM, kind: OfStyle] RETURNS [frame: Frame];
FreeFrame: PROC [frame: Frame, styleName: ATOM, kind: OfStyle];
StyleForFrame: PROC [frame: Frame] RETURNS [style: Style];
Style Dictionaries
InitDict: PROC [name: ATOM, size: CARDINAL ← 100] RETURNS [dictionary: TJaM.Dict];
Create a dictionary and name it in the system dictionary, .sysdict
GetStyleDict: PROC [frame: Frame, styleName: ATOM, kind: OfStyle, def: Rope.ROPENIL]
RETURNS
[d: TJaM.Dict];
BadStyleFile: PROC [frame: Frame, styleName: ATOM];
RunStyle: PROC [frame: Frame, styleName: ATOM] RETURNS [ok: BOOL];
RunStyleString: PROC [frame: Frame, styleName: ATOM, def: Rope.ROPE] RETURNS [ok: BOOL];
sysdict: TJaM.Dict; -- system dictionary
userdict: TJaM.Dict; -- user dictionary with helpful stuff and errordefs
styledict: TJaM.Dict; -- style dictionary has Tioga style machinery names
stylesDictsNames: REF ARRAY OfStyle OF ATOM;
names are TiogaBaseStylesDictionary, TiogaPrintStylesDictionary, TiogaScreenStylesDictionary
stylesDicts: REF ARRAY OfStyle OF TJaM.Dict;
bindingDictName: ATOM; -- TiogaBindingDictionary
bindingDict: TJaM.Dict;
attachmentsDictName: ATOM; -- TiogaAttachedStylesDictionary
attachmentsDict: TJaM.Dict;
styledictName: ATOM;
ForEachAttachedStyle: PROC [dictName: ATOM,
proc: PROC [attached: ATOM] RETURNS [stop: BOOL]
];
Executing Style Rules
ExecuteName: PROC [frame: Frame, name: ATOM] RETURNS [ok: BOOL];
ExecuteNameInStyle: PROC [ref: Style, kind: OfStyle, styleRule: ATOM] RETURNS [ok: BOOL];
ExecuteObjectInStyle: PROC [ref: Style, kind: OfStyle, object: Object] RETURNS [ok: BOOL];
ExecuteLooksInStyle: PROC [ref: Style, kind: OfStyle, looks: TextLooks.Looks]
RETURNS [ok: BOOL];
executingName: ATOM; -- for debugging
StyleError: PROC [frame: Frame, num: INTEGER]; -- number of things to print
load: TJaM.Cmd;
get: TJaM.Cmd;
run: TJaM.Cmd;
Types for Implementing Style Commands
LoadProc: TYPE ~ PROC [frame: Frame, p: Param, style: Style];
StoreProc: TYPE ~ PROC [frame: Frame, p: Param, style: Style];
AddRealProc: TYPE ~ PROC [frame: Frame, inc: REAL, p: Param, style: Style];
PercentProc: TYPE ~ PROC [frame: Frame, percent: REAL, p: Param, style: Style];
SetNameProc: TYPE ~ PROC [frame: Frame, name: ATOM, p: Param, style: Style];
Param: TYPE ~ REF ParamRec;
ParamRec: TYPE ~ RECORD [
ops: Ops,
opName: ATOM,
data: SELECT kind: OfParam FROM
name => [ param: NameParam ],
real => [ param: RealParam ],
glue => [ size, stretch, shrink: RealParam ],
color => [ hue, saturation, brightness: RealParam ],
misc => [],
ENDCASE
];
OfParam: TYPE ~ { name, real, glue, color, misc };
Ops: TYPE ~ REF OpsRec;
OpsRec: TYPE ~ RECORD [
Load: LoadProc, Store: StoreProc, AddReal: AddRealProc,
Percent: PercentProc, SetName: SetNameProc
];
Implementing Style Operations
DoStyleOp: PROC [frame: Frame, p: Param];
StoreError: StoreProc;
AddRealError: AddRealProc;
PercentError: PercentProc;
SetNameError: SetNameProc;
Named Attribute Parameter Operations
nameOps: Ops;
LoadNameParam: LoadProc;
SetNameParam: SetNameProc;
NameError: PROC [frame: Frame, name: ATOM, p: Param];
Real Parameter Operations
realOps: Ops;
RealOpLoad: LoadProc;
RealOpSetReal: StoreProc;
RealOpAddReal: AddRealProc;
RealOpPercent: PercentProc;
Glue Parameter Operations
glueOps: Ops;
GlueOpLoad: LoadProc;
GlueOpSetReal: StoreProc;
GlueOpAddReal: AddRealProc;
GlueOpPercent: PercentProc;
Color Parameter Operations
colorOps: Ops;
ColorOpLoad: LoadProc;
ColorOpSetReal: StoreProc;
ColorOpAddReal: AddRealProc;
ColorOpPercent: PercentProc;
Support Procs
GetCommand: PROC [frame: Frame, name: ATOM] RETURNS [TJaM.Cmd];
ForceLowerName: PUBLIC PROC [n: ATOM] RETURNS [ATOM];
ForceLowerRope: PUBLIC PROC [r: ROPE] RETURNS [ROPE];
PopName: PROC [frame: Frame] RETURNS [name: ATOM];
TryToPopName: PROC [frame: Frame] RETURNS [name: ATOM, ok: BOOL];
TryToPopReal: PROC [frame: Frame] RETURNS [value: REAL ← 0.0, ok: BOOL];
TryToPopRope: PROC [frame: Frame] RETURNS [rope: ROPE, ok: BOOL];
TypeCheckName: PROC [obj: Object] RETURNS [ATOM];
TypeCheckDict: PROC [obj: Object] RETURNS [TJaM.Dict];
TypeCheckCommand: PROC [obj: Object] RETURNS [TJaM.Cmd];
Support for initializing style parameters
SpecialOpArray: PROC [name: ATOM, op: Object] RETURNS [key: ATOM, array: TJaM.Array];
StyleParamKey: PROC [name: ATOM] RETURNS [key: ATOM];
RegisterStyleCommand: PROC [frame: Frame, name: ATOM, proc: TJaM.CommandProc];
RegisterStyleLiteral: PROC [frame: Frame, name: ATOM];
RegisterWorks1: PROC [frame: Frame];
RegisterWorks2: PROC [frame: Frame];
RegisterWorks3: PROC [frame: Frame];
RegisterWorks4: PROC [frame: Frame];
StartTheWorks: PROC;
END.