-- NodeStyleExtra.mesa
-- Written by Bill Paxton, January 1981
-- Last changed by Bill Paxton, December 21, 1982 9:49 am
-- Internal defs for NodeStyle modules
Last Edited by: Maxwell, January 6, 1983 8:08 am
DIRECTORY
NodeStyle,
Real,
Rope,
TextNode,
TextLooks,
NameSymbolTable,
JaMInternal,
JaMBasic,
JaMOps;
NodeStyleExtra: CEDAR DEFINITIONS
IMPORTS NameSymbolTable, NodeStyle, JaMOps, Real =
BEGIN OPEN R:Real, NodeStyle;
Object: TYPE = JaMBasic.Object;
LocalStyle: TYPE = REF LocalStyleRec;
LocalStyleRec: TYPE = RECORD [ name: Name, def: Rope.ROPE ];
realTableOverflow: ERROR;
lastIntegerAsReal: Real = LAST[INTEGER];
firstIntegerAsReal: Real = FIRST[INTEGER];
IntegerValue: PROC [value: Real] RETURNS [INTEGER] = INLINE {
RETURN [SELECT value FROM
> lastIntegerAsReal => LAST[INTEGER],
< firstIntegerAsReal => FIRST[INTEGER],
ENDCASE => R.RoundI[value]] };
EnterReal: PROC [value: Real] RETURNS [code: RealCode];
SetReal: PROC [ref: Ref, param: RealParam, value: Real];
Frame: TYPE = JaMInternal.Frame;
GetFrame: PROC [style: Ref, styleName: Name, kind: OfStyle]
RETURNS [frame: Frame];
FreeFrame: PROC [frame: Frame, name: Name, kind: OfStyle];
StyleForFrame: PROC [frame: Frame] RETURNS [style: Ref];
StyleCommand: PROC [frame: Frame, text: REF READONLY TEXT, proc: PROC [Frame]]
RETURNS [name: Name];
StyleLiteral: PROC [frame: Frame, text: REF READONLY TEXT] RETURNS [name: Name];
styleerror: Name;
StyleError: PROC [frame: Frame, num: INTEGER]; -- number of things to print
defaultStyleName: Name;
defaultStyle: Ref;
defaultStylesForExtensions: LIST OF ExtObjPair;
ExtObjPair: TYPE = RECORD [ fileExtension: ATOM, styleObject: NameSymbolTable.Object ];
SetDefaultStyle: PROC [name: Rope.ROPE];
SetExtensionStyles: PROC [value: LIST OF Rope.ROPE];
GetCommand: PROC [frame: Frame, name: Name] RETURNS [command Object];
ForEachAttachedStyle: PROC [dictName: Name, proc: PROC [attached: Name]
RETURNS [stop: BOOLEAN]];
GetStyleParam: PROC [s: Ref, name: Name, styleName: Name, kind: OfStyle] RETURNS [Object];
-- support procs for NodeStyleImpl and NodeStyle2Impl
LoadProc: TYPE = PROC [frame: Frame, p: Param, style: Ref];
StoreProc: TYPE = PROC [frame: Frame, p: Param, style: Ref]; -- gets value from JaM stack
AddRealProc: TYPE = PROC [frame: Frame, inc: REAL, p: Param, style: Ref];
PercentProc: TYPE = PROC [frame: Frame, percent: REAL, p: Param, style: Ref];
SetNameProc: TYPE = PROC [frame: Frame, name: Name, p: Param, style: Ref];
Param: TYPE = REF ParamRec;
ParamRec: TYPE = RECORD [
ops: Ops,
opName: Name,
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 ];
StoreError: StoreProc;
AddRealError: AddRealProc;
PercentError: PercentProc;
SetNameError: SetNameProc;
StyleNameOp: PROC [frame: Frame];
LineFormattingOp: PROC [frame: Frame];
LineFormattingLoad: LoadProc;
LineFormattingSetName: SetNameProc;
FontFamilyOp: PROC [frame: Frame];
FontFaceOp: PROC [frame: Frame];
FontFaceLoad: LoadProc;
FontFaceSetName: SetNameProc;
FontSizeOp: PROC [frame: Frame];
RealOpLoad: LoadProc;
RealOpSetReal: StoreProc;
RealOpAddReal: AddRealProc;
RealOpPercent: PercentProc;
LeftIndentOp: PROC [frame: Frame];
RightIndentOp: PROC [frame: Frame];
FirstIndentOp: PROC [frame: Frame];
RestIndentOp: PROC [frame: Frame];
TopIndentOp: PROC [frame: Frame];
BottomIndentOp: PROC [frame: Frame];
LineLeadingSizeOp: PROC [frame: Frame];
TopLeadingSizeOp: PROC [frame: Frame];
BottomLeadingSizeOp: PROC [frame: Frame];
VShiftOp: PROC [frame: Frame];
RelativeTabStopsOp: PROC [frame: Frame];
DefaultTabStopsOp: PROC [frame: Frame];
TabStopOp: PROC [frame: Frame];
TabStopsOp: PROC [frame: Frame];
MinLineGapOp: PROC [frame: Frame];
LoadNameParam: LoadProc;
SetNameParam: SetNameProc;
NameError: PROC [frame: Frame, name: Name, p: Param];
DoStyleOperation: PROC [frame: Frame, p: Param];
IsComment: PROC [frame: Frame];
IsPrint: PROC [frame: Frame];
NestingLevel: PROC [frame: Frame];
qZone: ZONE;
-- support procs
executingName: Name;
EvalFreeVars: PROC [style: Ref, node: TextNode.Ref];
PushText: PROC [frame: Frame, txt: LONG STRING];
PushObject: PROC [frame: Frame, ob: Object];
PopObject: PROC [frame: Frame] RETURNS [Object];
PushName: PROC [frame: Frame, name: Name];
PopName: PROC [frame: Frame] RETURNS [Name];
PushInteger: PROC [frame: Frame, val: INTEGER] = TRUSTED INLINE {
JaMOps.PushInteger[frame.opstk,val] };
PushReal: PROC [frame: Frame, val: REAL] = TRUSTED INLINE {
JaMOps.PushReal[frame.opstk,val] };
PopReal: PROC [frame: Frame] RETURNS [REAL] = TRUSTED INLINE {
RETURN [JaMOps.PopReal[frame.opstk]] };
TryToPopName: PROC [frame: Frame] RETURNS [name: Name, ok: BOOLEAN];
TryToPopReal: PROC [frame: Frame] RETURNS [value: Real, ok: BOOLEAN];
TryToPopString: PROC [frame: Frame] RETURNS [string: string JaMBasic.Object, ok: BOOLEAN];
MakeName: PROC [txt: REF READONLY TEXT] RETURNS [Name] = INLINE {
RETURN [NameSymbolTable.MakeName[txt]] };
CVX: PROC [obj: Object] RETURNS [Object] = INLINE {
obj.tag ← X; RETURN [obj] };
CVLit: PROC [obj: Object] RETURNS [Object] = INLINE {
obj.tag ← L; RETURN [obj] };
NameToObject: PROC [name: Name] RETURNS [obj: Object] = INLINE {
nameObj: name Object ← [L,name[LOOPHOLE[name]]];
RETURN [nameObj] };
TypeCheckName: PROC [obj: Object] RETURNS [Name];
TypeCheckDict: PROC [obj: Object] RETURNS [dict Object];
TypeCheckCommand: PROC [obj: Object] RETURNS [command Object];
-- ***** Initialization
StartImpl2, StartExtra, StartApply: PROC; -- for initialization only
END.