NodeStyleWorksStartImpl.mesa
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Michael Plass, April 22, 1986 10:27:46 am PST
Rick Beach, June 11, 1985 11:03:31 am PDT
Doug Wyatt, September 24, 1986 12:17:22 pm PDT
The starting process for the Tioga style machinery is somewhat magical.
This should be the only NodeStyle module that executes any initialization code.
We orchestrate the start up sequence from here.
DIRECTORY
NodeStyleOps USING [defaultStyleName, InitializeDefaultStyle, LoadStyle],
NodeStyleWorks USING [attachmentsDict, bindingDict, defaultFrame, FreeFrame, get, GetCommand, GetFrame, InitDict, load, RegisterStyleLiteral, RegisterWorks1, RegisterWorks2, RegisterWorks3, RegisterWorks4, run, styledict, stylesDicts, sysdict, TypeCheckDict, userdict],
Rope USING [ROPE],
TJaM USING [AtomFromRope, AttachDict, Begin, DictTop, End, Execute, Frame, NewFrame, Pop, Push, TryToLoad];
NodeStyleWorksStartImpl: CEDAR PROGRAM
IMPORTS NodeStyleOps, NodeStyleWorks, TJaM
EXPORTS NodeStyleWorks
~ BEGIN OPEN NodeStyleWorks;
ROPE: TYPE ~ Rope.ROPE;
Frame: TYPE ~ TJaM.Frame;
RunFile: PROC [frame: Frame, name: ATOM, fileName: ROPE] RETURNS [ran: BOOL] ~ {
if name is unknown in the current frame, then run the named file
known: BOOL;
[known, ] ← TJaM.TryToLoad[frame, name];
IF known THEN RETURN [FALSE];
TJaM.Push[frame, fileName];
TJaM.Execute[frame, run];
RETURN [TRUE];
};
StartTheWorks: PUBLIC PROC ~ {
frame: Frame ← defaultFrame ← TJaM.NewFrame[];
Some JaM commands needed to run the style machinery
get ← GetCommand[frame, TJaM.AtomFromRope[".get"]];
run ← GetCommand[frame, TJaM.AtomFromRope[".run"]];
load ← GetCommand[frame, TJaM.AtomFromRope[".load"]];
Remember the system dictionary, since the style machinery manipulates the dictionary stack
TJaM.Execute[frame, TJaM.AtomFromRope[".sysdict"]];
sysdict ← TypeCheckDict[TJaM.Pop[frame]];
Check if we have run the start jam code: (start.jam) .run
This provides a user dictionary into which start.jam loads util.jam and errordefs.jam
IF NOT RunFile[frame, $user ,"start.jam"] THEN
TJaM.Execute[frame, TJaM.AtomFromRope[".start"]];
Remember the user dictionary pointer
userdict ← TJaM.DictTop[frame];
Create the dicitionary of Tioga style names
styledict ← InitDict[$TiogaStylesDictionary];
TJaM.AttachDict[styledict, userdict];
Replace userdict by styledict for rest of startup
TJaM.End[frame];
TJaM.Begin[frame, styledict];
Create and register dictionaries for style rules, name bindings, and attached styles
stylesDicts[base] ← InitDict[$TiogaBaseStylesDictionary];
stylesDicts[print] ← InitDict[$TiogaPrintStylesDictionary];
stylesDicts[screen] ← InitDict[$TiogaScreenStylesDictionary];
bindingDict ← InitDict[$TiogaBindingDictionary, 200];
attachmentsDict ← InitDict[$TiogaAttachedStylesDictionary];
Check if have run the Tioga utility jam code: (TiogaUtils.jam) .run
[] ← RunFile[frame, $StyleError, "TiogaUtils.jam"];
Register various style and JaM commands implemented elsewhere
RegisterWorks1[frame];
RegisterWorks2[frame];
RegisterWorks3[frame];
RegisterWorks4[frame];
TJaM.Register[frame, $GetFreeVarOp, NodeStyleObsolete.GetFreeVarOp];
TJaM.Register[frame, $GetFreeVarObjOp, NodeStyleObsolete.GetFreeVarObjOp];
Register various literals used by the style machinery as keywords
numeric style attributes
RegisterStyleLiteral[frame, $the];
RegisterStyleLiteral[frame, $smaller];
RegisterStyleLiteral[frame, $bigger];
RegisterStyleLiteral[frame, $percent];
font attributes
RegisterStyleLiteral[frame, $regular];
RegisterStyleLiteral[frame, $bold];
RegisterStyleLiteral[frame, $italic];
RegisterStyleLiteral[frame, TJaM.AtomFromRope["bold+italic"]];
RegisterStyleLiteral[frame, TJaM.AtomFromRope["+bold"]];
RegisterStyleLiteral[frame, TJaM.AtomFromRope["+italic"]];
RegisterStyleLiteral[frame, TJaM.AtomFromRope["-bold"]];
RegisterStyleLiteral[frame, TJaM.AtomFromRope["-italic"]];
font alphabets
RegisterStyleLiteral[frame, TJaM.AtomFromRope["caps+lowercase"]];
RegisterStyleLiteral[frame, TJaM.AtomFromRope["caps+smallcaps"]];
RegisterStyleLiteral[frame, $lowercase];
RegisterStyleLiteral[frame, $caps];
underlining and strikeout
RegisterStyleLiteral[frame, $all];
RegisterStyleLiteral[frame, $visible];
RegisterStyleLiteral[frame, TJaM.AtomFromRope["letters+digits"]];
RegisterStyleLiteral[frame, $none];
line formatting
RegisterStyleLiteral[frame, $justified];
RegisterStyleLiteral[frame, $flush];
RegisterStyleLiteral[frame, $flushLeft];
RegisterStyleLiteral[frame, $flushRight];
RegisterStyleLiteral[frame, $centered];
graphical paths
RegisterStyleLiteral[frame, $filled];
RegisterStyleLiteral[frame, $outlined];
RegisterStyleLiteral[frame, $filled];
RegisterStyleLiteral[frame, TJaM.AtomFromRope["filled+outlined"]];
tab stop positioning
RegisterStyleLiteral[frame, $fixed];
RegisterStyleLiteral[frame, $relative];
tab stop attributes
RegisterStyleLiteral[frame, $looks];
RegisterStyleLiteral[frame, $breakIfPast];
RegisterStyleLiteral[frame, $spaceIfPast];
RegisterStyleLiteral[frame, $blank];
RegisterStyleLiteral[frame, $leaders];
RegisterStyleLiteral[frame, $rule];
RegisterStyleLiteral[frame, $rules];
RegisterStyleLiteral[frame, $aligned];
RegisterStyleLiteral[frame, $congruent];
Initialize the small cache of frames by allocating and freeing some
{
frame: ARRAY [0..4) OF Frame;
FOR i: NAT IN [0..4) DO frame[i] ← GetFrame[NIL, NIL, screen] ENDLOOP;
FOR i: NAT IN [0..4) DO FreeFrame[frame[i], NIL, screen] ENDLOOP;
};
Initialize the default style
NodeStyleOps.InitializeDefaultStyle["Cedar"];
[] ← NodeStyleOps.LoadStyle[NodeStyleOps.defaultStyleName];
};
StartTheWorks[!];
END.