NodeStyleApplyImpl.Mesa
written by Bill Paxton, January 1981
Paxton, December 21, 1982 9:55 am
Maxwell, January 6, 1983 9:50 am
Russ Atkinson, July 25, 1983 5:22 pm
DIRECTORY
Basics,
NodeStyleExtra,
NodeStyle,
NodeStyleObject,
TextNode,
TextLooks,
EditNotify,
NodeProps,
NameSymbolTable,
JaMOps;
NodeStyleApplyImpl:
CEDAR MONITOR
IMPORTS
Basics, JaMOps, TextNode, EditNotify, NodeProps, NodeStyle, NodeStyleExtra, NameSymbolTable
EXPORTS NodeStyle, NodeStyleExtra
= BEGIN OPEN NodeStyle, NodeStyleExtra;
-- Apply operations
defaultStyle: PUBLIC Ref;
defaultName, rootName: Name;
ApplyAll:
PUBLIC
PROC [ref: Ref, node: TextNode.Ref, kind: OfStyle ← screen] = {
[] ← DoApplyAll[ref,node,kind] };
DoApplyAll:
PROC [ref: Ref, node: TextNode.Ref, kind: OfStyle]
RETURNS [depth:
CARDINAL] = {
found: BOOLEAN;
parent: TextNode.Ref;
alt: Name;
IF node=NIL THEN { ref^ ← defaultStyle^; RETURN [0] };
[found,depth] ← FindInApplyAllCache[ref,node,kind];
IF found THEN RETURN [depth+1];
parent ← TextNode.Parent[node];
alt ← IF parent=NIL THEN rootName ELSE defaultName;
depth ← DoApplyAll[ref,parent,kind];
ApplyForNode[ref,node,alt,kind];
EnterInApplyAllCache[ref,node,depth];
RETURN [depth+1] };
applyCacheInfo: REF ApplyCacheRecord ← TextNode.pZone.NEW[ApplyCacheRecord];
ApplyCacheRecord:
TYPE =
RECORD [
applyCacheDepth: CARDINAL ← 0, -- next free entry
applyCacheResults: REF ApplyCacheResults,
applyCacheNodes: REF ApplyCacheNodes,
applyCacheProbes, applyCacheHits, applyCacheSaves: INT ← 0 ];
applyCacheSize: CARDINAL = 8; -- number of levels deep in tree
ApplyCacheNodes: TYPE = ARRAY [0..applyCacheSize) OF TextNode.Ref;
ApplyCacheResults: TYPE = ARRAY [0..applyCacheSize) OF StyleBody;
InitApplyCacheRecord:
PROC = {
OPEN applyCacheInfo;
applyCacheResults ← TextNode.pZone.NEW[ApplyCacheResults];
applyCacheNodes ← TextNode.pZone.NEW[ApplyCacheNodes] };
RemoveAllFromApplyAllCache:
PUBLIC
PROC = { FlushApplyAllCache[] };
FlushApplyAllCache:
PUBLIC ENTRY
PROC [init:
BOOLEAN ←
FALSE] = {
ENABLE UNWIND => NULL;
ClearApplyAllCache[init] };
ClearApplyAllCache:
PROC [init:
BOOLEAN] = {
OPEN applyCacheInfo;
nodes: REF ApplyCacheNodes ← applyCacheNodes;
-- when clearing, go all the way to applyCacheSize rather than stopping at applyCacheDepth
FOR i:CARDINAL IN [0..applyCacheSize) DO nodes[i] ← NIL; ENDLOOP;
applyCacheDepth ← 0 };
RemoveNodeFromApplyAllCache:
PUBLIC ENTRY
PROC [node: TextNode.Ref] = {
OPEN applyCacheInfo;
ENABLE UNWIND => NULL;
nodes: REF ApplyCacheNodes ← applyCacheNodes;
FOR i:
CARDINAL
IN [0..applyCacheDepth)
DO
IF nodes[i]=node
THEN {
-- clear from here on
FOR j:
CARDINAL
IN [i..applyCacheSize)
DO
nodes[j] ← NIL; ENDLOOP;
applyCacheDepth ← i; EXIT };
ENDLOOP };
FindInApplyAllCache:
ENTRY
PROC [ref: Ref, node: TextNode.Ref, kind: OfStyle]
RETURNS [found: BOOLEAN, depth: CARDINAL] = { OPEN applyCacheInfo;
ENABLE UNWIND => NULL;
nodes: REF ApplyCacheNodes ← applyCacheNodes;
print: BOOL = (kind=print); -- if true, then find result with print true also
applyCacheProbes ← applyCacheProbes+1;
FOR i:
CARDINAL
DECREASING
IN [0..applyCacheDepth)
DO
IF nodes[i]=node
AND print=applyCacheResults[i].print
THEN {
-- found it
applyCacheHits ← applyCacheHits+1;
applyCacheSaves ← applyCacheSaves+i+1;
ref^ ← applyCacheResults[i];
RETURN [TRUE, i] };
ENDLOOP;
RETURN [FALSE, 0] };
EnterInApplyAllCache:
ENTRY
PROC [ref: Ref, node: TextNode.Ref, depth:
CARDINAL] = {
OPEN applyCacheInfo;
ENABLE UNWIND => NULL;
nodes: REF ApplyCacheNodes ← applyCacheNodes;
IF depth >= applyCacheSize THEN RETURN;
nodes[depth] ← node;
applyCacheResults[depth] ← ref^;
FOR i:CARDINAL IN [depth+1..applyCacheSize) DO nodes[i] ← NIL; ENDLOOP;
applyCacheDepth ← depth+1 };
prefixAtom: ATOM = NodeProps.PrefixAtom[];
postfixAtom: ATOM = NodeProps.PostfixAtom[];
Notify:
PROC [change:
REF
READONLY EditNotify.Change] =
TRUSTED {
-- if change invalidates one node only, remove that node
-- else clear entire cache
DoNode:
PROC [node: TextNode.Ref] =
TRUSTED {
IF TextNode.FirstChild[node] # NIL THEN FlushApplyAllCache
ELSE RemoveNodeFromApplyAllCache[node] };
WITH x:change SELECT FROM
InsertingNode => IF TextNode.FirstChild[x.new] # NIL THEN FlushApplyAllCache;
MovingNodes => FlushApplyAllCache;
NodeNesting =>
IF x.first = x.last
-- only changing one node
AND TextNode.FirstChild[x.first] = NIL -- node has no children
THEN
SELECT x.change
FROM
1 =>
-- increasing nesting in tree
IF TextNode.Next[x.first] = NIL THEN RemoveNodeFromApplyAllCache[x.first]
ELSE FlushApplyAllCache;
-1 =>
-- decreasing nesting in tree
RemoveNodeFromApplyAllCache[x.first];
ENDCASE => FlushApplyAllCache
ELSE FlushApplyAllCache;
ChangingType => DoNode[x.node];
ChangingProp =>
SELECT x.propAtom
FROM
prefixAtom, postfixAtom, $Comment, $StyleDef => DoNode[x.node];
ENDCASE;
ENDCASE => ERROR; -- not expecting notify for any other kinds of changes
};
ApplyForNode:
PUBLIC
PROC [ref: Ref, node: TextNode.Ref, alt: Name, kind: OfStyle] = {
text: TextNode.RefTextNode = TextNode.NarrowToTextNode[node];
ext: ATOM;
ref.isComment ← IF text # NIL THEN text.comment ELSE FALSE;
ref.print ← (kind=print);
ref.nestingLevel ← MIN[TextNode.Level[node], MaxNestingLevel];
EvalFreeVars[ref, node];
IF node.hasstyledef
THEN {
localStyle: LocalStyle ← NARROW[NodeProps.GetProp[node, $StyleDef]];
IF localStyle # NIL THEN ref.name[style] ← localStyle.name };
IF node.hasprefix THEN ApplyObject[ref, NodeProps.GetPrefixObject[node], kind]
ELSE
IF ref.nestingLevel=0
-- root node --
AND
-- check for file extension default
(ext ← NARROW[NodeProps.GetProp[node, $FileExtension]])#NIL THEN
FOR list:
LIST
OF ExtObjPair ← defaultStylesForExtensions, list.rest
UNTIL list=
NIL
DO
IF list.first.fileExtension # ext THEN LOOP;
ApplyObject[ref, list.first.styleObject, kind];
EXIT;
ENDLOOP;
ApplyType[ref, node.typename, alt, kind];
IF node.haspostfix
THEN ApplyObject[ref,NodeProps.GetPostfixObject[node],kind] };
ApplyType:
PUBLIC
PROC [ref: Ref, name, alt: Name, kind: OfStyle ← screen] = {
OPEN ruleCacheInfo;
names: REF RuleCacheNames ← ruleCacheNames;
inputs: REF RuleCacheBodies ← ruleCacheInputs;
input: StyleBody;
initloc, loc: CARDINAL;
FindInRuleCache:
ENTRY
PROC
RETURNS [
BOOLEAN] = {
ENABLE UNWIND => NULL;
ruleCacheProbes ← ruleCacheProbes+1;
DO
-- search cache
SELECT names[loc]
FROM
name =>
IF inputs[loc] = ref^
THEN {
ref^ ← ruleCacheResults[loc];
ruleCacheHits ← ruleCacheHits+1;
RETURN [TRUE] };
TextNode.nullTypeName => RETURN [FALSE]; -- this is an unused entry
ENDCASE;
SELECT (loc ← loc+1)
FROM
ruleCacheSize => IF (loc ← 0)=initloc THEN RETURN [FALSE];
initloc => RETURN [FALSE];
ENDCASE;
ENDLOOP };
PutInRuleCache:
ENTRY
PROC = {
ENABLE UNWIND => NULL;
IF ruleCacheCount = ruleCacheMax THEN ClearRuleCache[];
loc ← initloc;
DO
-- search cache for place to put the entry
SELECT names[loc]
FROM
name => IF inputs[loc] = input THEN RETURN; -- already in cache
TextNode.nullTypeName => EXIT; -- this is an unused entry
ENDCASE;
SELECT (loc ← loc+1)
FROM
ruleCacheSize => IF (loc ← 0)=initloc THEN ERROR; -- cache full
initloc => ERROR; -- cache full
ENDCASE;
ENDLOOP;
ruleCacheCount ← ruleCacheCount+1;
inputs[loc] ← input;
ruleCacheResults[loc] ← ref^;
names[loc] ← name };
ok: BOOLEAN;
frame: Frame ← NIL;
styleName: Name;
IF name = TextNode.nullTypeName
AND
(name ← alt) = TextNode.nullTypeName THEN RETURN;
loc ← initloc ← Basics.BITXOR[LOOPHOLE[name,CARDINAL],Hash[ref]] MOD ruleCacheSize;
IF FindInRuleCache[] THEN RETURN;
frame ← GetFrame[ref, styleName ← ref.name[style], kind];
input ← ref^; -- save the input value of the record
ok ← ExecuteName[frame,name];
FreeFrame[frame,styleName,kind]; frame ← NIL;
IF ok THEN PutInRuleCache[] -- save results in cache
ELSE IF name # alt THEN ApplyType[ref,alt,TextNode.nullTypeName] };
ruleCacheInfo: REF RuleCacheInfoRecord ← TextNode.pZone.NEW[RuleCacheInfoRecord];
RuleCacheInfoRecord:
TYPE =
RECORD [
ruleCacheCount: CARDINAL ← 0, -- number of entries currently in use
ruleCacheNames: REF RuleCacheNames,
ruleCacheInputs: REF RuleCacheBodies,
ruleCacheResults: REF RuleCacheBodies,
ruleCacheProbes, ruleCacheHits: INT ← 0 ];
ruleCacheSize: CARDINAL = 64; -- should be a power of 2
ruleCacheMax: CARDINAL = (ruleCacheSize*4)/5; -- don't fill too full
RuleCacheNames: TYPE = ARRAY [0..ruleCacheSize) OF TextNode.TypeName;
RuleCacheBodies: TYPE = ARRAY [0..ruleCacheSize) OF StyleBody;
InitRuleCacheInfo:
PROC = {
OPEN ruleCacheInfo;
ruleCacheNames ← TextNode.pZone.NEW[RuleCacheNames];
ruleCacheInputs ← TextNode.pZone.NEW[RuleCacheBodies];
ruleCacheResults ← TextNode.pZone.NEW[RuleCacheBodies] };
FlushRuleCache:
ENTRY
PROC [init:
BOOLEAN ←
FALSE] = {
ENABLE UNWIND => NULL;
ClearRuleCache[] };
ClearRuleCache:
PROC [init:
BOOLEAN ←
FALSE] = {
OPEN ruleCacheInfo;
names: REF RuleCacheNames ← ruleCacheNames;
IF ~init AND ruleCacheCount = 0 THEN RETURN;
ruleCacheCount ← 0;
FOR i:
CARDINAL
IN [0..ruleCacheSize)
DO
names[i] ← TextNode.nullTypeName; ENDLOOP };
Hash:
PROC [ref: Ref]
RETURNS [
CARDINAL] = {
RETURN [
LOOPHOLE[
Basics.
BITXOR[
LOOPHOLE[ref.name[style]],
Basics.
BITXOR[
LOOPHOLE[ref.name[fontFamily],
CARDINAL],
Basics.
BITXOR[ref.real[fontSize],
Basics.
BITXOR[ref.real[leftIndent],
ref.real[leading]]]]],CARDINAL]] };
ApplyLooks:
PUBLIC
PROC [ref: Ref, looks: TextLooks.Looks, kind: OfStyle] = {
OPEN looksCacheInfo;
lks: REF LooksCacheLooks ← looksCacheLooks;
inputs: REF LooksCacheBodies ← looksCacheInputs;
initloc, loc: CARDINAL;
input: StyleBody;
FindInLooksCache:
ENTRY
PROC
RETURNS [
BOOLEAN] = {
ENABLE UNWIND => NULL;
looksCacheProbes ← looksCacheProbes+1;
DO
-- search cache
SELECT lks[loc]
FROM
looks =>
IF inputs[loc] = ref^
THEN {
ref^ ← looksCacheResults[loc];
looksCacheHits ← looksCacheHits+1;
RETURN [TRUE] };
TextLooks.noLooks => RETURN [FALSE]; -- this is an unused entry
ENDCASE;
SELECT (loc ← loc+1)
FROM
looksCacheSize => IF (loc ← 0)=initloc THEN RETURN [FALSE];
initloc => RETURN [FALSE];
ENDCASE;
ENDLOOP };
PutInLooksCache:
ENTRY
PROC = {
ENABLE UNWIND => NULL;
IF looksCacheCount = looksCacheMax THEN ClearLooksCache[];
loc ← initloc;
DO
-- search cache
SELECT lks[loc]
FROM
looks => IF inputs[loc] = input THEN RETURN; -- already in cache
TextLooks.noLooks => EXIT; -- this is an unused entry
ENDCASE;
SELECT (loc ← loc+1)
FROM
looksCacheSize => IF (loc ← 0)=initloc THEN ERROR; -- cache full
initloc => ERROR; -- cache full
ENDCASE;
ENDLOOP;
looksCacheResults[loc] ← ref^;
lks[loc] ← looks;
inputs[loc] ← input;
looksCacheCount ← looksCacheCount+1 };
frame: Frame ← NIL;
styleName: Name;
IF looks = TextLooks.noLooks THEN RETURN;
loc ← initloc ←
Basics.
BITXOR[
LOOPHOLE[looks, TextLooks.LooksBytes].byte0,
Basics.
BITXOR[
LOOPHOLE[looks, TextLooks.LooksBytes].byte1,
Basics.
BITXOR[
LOOPHOLE[looks, TextLooks.LooksBytes].byte2,
Hash[ref]]]] MOD looksCacheSize;
IF FindInLooksCache[] THEN RETURN;
frame ← GetFrame[ref, styleName ← ref.name[style], kind];
input ← ref^; -- save the input value of the record
FOR c:
CHARACTER
IN TextLooks.Look
DO
IF looks[c] THEN [] ← ExecuteName[frame,lookNames[c]]
ENDLOOP;
FreeFrame[frame,styleName,kind]; frame ← NIL;
PutInLooksCache[] };
looksCacheInfo: REF LooksCacheInfoRecord ← TextNode.pZone.NEW[LooksCacheInfoRecord];
LooksCacheInfoRecord:
TYPE =
RECORD [
looksCacheCount: CARDINAL ← 0,
looksCacheLooks: REF LooksCacheLooks,
looksCacheInputs: REF LooksCacheBodies,
looksCacheResults: REF LooksCacheBodies,
looksCacheProbes, looksCacheHits: INT ← 0 ];
looksCacheSize: CARDINAL = 16; -- should be a power of 2
looksCacheMax: CARDINAL = (looksCacheSize*4)/5; -- don't fill too full
LooksCacheLooks: TYPE = ARRAY [0..looksCacheSize) OF TextLooks.Looks;
LooksCacheBodies: TYPE = ARRAY [0..looksCacheSize) OF StyleBody;
InitLooksCacheInfo:
PROC = {
OPEN looksCacheInfo;
looksCacheLooks ← TextNode.pZone.NEW[LooksCacheLooks];
looksCacheInputs ← TextNode.pZone.NEW[LooksCacheBodies];
looksCacheResults ← TextNode.pZone.NEW[LooksCacheBodies];
};
lookNames: ARRAY TextLooks.Look OF Name;
FlushLooksCache:
ENTRY
PROC [init:
BOOLEAN ←
FALSE] = {
ENABLE UNWIND => NULL;
ClearLooksCache[] };
ClearLooksCache:
PROC [init:
BOOLEAN ←
FALSE] = {
OPEN looksCacheInfo;
IF ~init AND looksCacheCount = 0 THEN RETURN;
looksCacheCount ← 0;
FOR i:
CARDINAL
IN [0..looksCacheSize)
DO
looksCacheLooks[i] ← TextLooks.noLooks; ENDLOOP };
nullObject: NameSymbolTable.Object = NameSymbolTable.NullObject[];
ApplyObject:
PUBLIC
PROC [ref: Ref, object: NameSymbolTable.Object, kind: OfStyle ← screen] = {
OPEN objectCacheInfo;
objects: REF ObjectCacheObjects ← objectCacheObjects;
inputs: REF ObjectCacheBodies ← objectCacheInputs;
input: StyleBody;
initloc, loc: CARDINAL;
initDepth, finalDepth: CARDINAL;
obj: Object ← LOOPHOLE[object];
FindInObjectCache:
ENTRY
PROC
RETURNS [
BOOLEAN] = {
ENABLE UNWIND => NULL;
objectCacheProbes ← objectCacheProbes+1;
DO
-- search cache
SELECT objects[loc]
FROM
object =>
IF inputs[loc] = ref^
THEN {
ref^ ← objectCacheResults[loc];
objectCacheHits ← objectCacheHits+1;
RETURN [TRUE] };
nullObject => RETURN [FALSE]; -- this is an unused entry
ENDCASE;
SELECT (loc ← loc+1)
FROM
objectCacheSize => IF (loc ← 0)=initloc THEN RETURN [FALSE];
initloc => RETURN [FALSE];
ENDCASE;
ENDLOOP };
PutInObjectCache:
ENTRY
PROC = {
ENABLE UNWIND => NULL;
IF objectCacheCount = objectCacheMax THEN ClearObjectCache[];
loc ← initloc;
DO
-- search cache for place to put the entry
SELECT objects[loc]
FROM
object => IF inputs[loc] = input THEN RETURN; -- already in cache
nullObject => EXIT; -- this is an unused entry
ENDCASE;
SELECT (loc ← loc+1)
FROM
objectCacheSize => IF (loc ← 0)=initloc THEN ERROR; -- cache full
initloc => ERROR; -- cache full
ENDCASE;
ENDLOOP;
objectCacheCount ← objectCacheCount+1;
inputs[loc] ← input;
objectCacheResults[loc] ← ref^;
objects[loc] ← object };
HashObject:
PROC
RETURNS [
CARDINAL] = {
ob: RECORD [ a, b, c, d: CARDINAL ] ← LOOPHOLE[object];
RETURN [ob.b] };
frame: Frame ← NIL;
styleName: Name;
IF object = nullObject THEN RETURN;
loc ← initloc ← Basics.BITXOR[HashObject[],Hash[ref]] MOD objectCacheSize;
IF FindInObjectCache[] THEN RETURN;
frame ← GetFrame[ref, styleName ← ref.name[style], kind];
input ← ref^; -- save the input value of the record
TRUSTED {initDepth ← JaMOps.CountStack[frame.opstk];
JaMOps.Execute[frame,CVX[obj]];
IF (finalDepth ← JaMOps.CountStack[frame.opstk]) # initDepth
THEN {
PushObject[frame,obj];
PushText[frame,"Failed to leave stack at same depth after execution.
"];
StyleError[frame,2] }
ELSE PutInObjectCache[]};
FreeFrame[frame,styleName,kind]; frame ← NIL };
objectCacheInfo: REF ObjectCacheInfoRecord ← TextNode.pZone.NEW[ObjectCacheInfoRecord];
ObjectCacheInfoRecord:
TYPE =
RECORD [
objectCacheCount: CARDINAL,
objectCacheObjects: REF ObjectCacheObjects,
objectCacheInputs: REF ObjectCacheBodies,
objectCacheResults: REF ObjectCacheBodies,
objectCacheProbes, objectCacheHits: INT ← 0 ];
objectCacheSize: CARDINAL = 16; -- should be a power of 2
objectCacheMax: CARDINAL = (objectCacheSize*4)/5; -- don't fill too full
ObjectCacheObjects: TYPE = ARRAY [0..objectCacheSize) OF NameSymbolTable.Object;
ObjectCacheBodies: TYPE = ARRAY [0..objectCacheSize) OF StyleBody;
InitObjectCacheInfo:
PROC = {
OPEN objectCacheInfo;
objectCacheObjects ← TextNode.pZone.NEW[ObjectCacheObjects];
objectCacheInputs ← TextNode.pZone.NEW[ObjectCacheBodies];
objectCacheResults ← TextNode.pZone.NEW[ObjectCacheBodies] };
FlushObjectCache:
ENTRY
PROC [init:
BOOLEAN ←
FALSE] = {
ENABLE UNWIND => NULL;
ClearObjectCache[] };
ClearObjectCache:
PROC [init:
BOOLEAN ←
FALSE] = {
OPEN objectCacheInfo;
IF ~init AND objectCacheCount = 0 THEN RETURN;
objectCacheCount ← 0;
FOR i:
CARDINAL
IN [0..objectCacheSize)
DO
objectCacheObjects[i] ← nullObject; ENDLOOP };
FlushCaches:
PUBLIC
ENTRY
PROC = {
ENABLE UNWIND => NULL;
ClearCaches[FALSE] };
ClearCaches:
PROC [init:
BOOLEAN] = {
ClearApplyAllCache[init]; ClearRuleCache[init];
ClearLooksCache[init]; ClearObjectCache[init] };
-- ***** Execute
executingName: PUBLIC Name;
ExecuteName:
PROC [frame: Frame, name: Name]
RETURNS [ok:
BOOLEAN] =
TRUSTED {
-- makes sure that same stack depth after execute
initDepth: CARDINAL ← JaMOps.CountStack[frame.opstk];
finalDepth: CARDINAL;
nameObj: Object;
[ok,] ← JaMOps.TryToLoad[frame, nameObj ← NameToObject[name]];
IF ~ok THEN RETURN;
executingName ← name;
JaMOps.Execute[frame,CVX[nameObj]];
executingName ← NameSymbolTable.nullName;
IF (finalDepth ← JaMOps.CountStack[frame.opstk]) # initDepth
THEN {
PushText[frame,"failed to leave stack at same depth after execution."];
PushName[frame,name];
StyleError[frame,2] }};
StyleError:
PUBLIC
PROC [frame: Frame, num:
INTEGER] =
TRUSTED {
PushInteger[frame,num];
JaMOps.Execute[frame,CVX[NameToObject[styleerror]]] };
-- ***** Miscellaneous
StyleNameForNode:
PUBLIC
PROC [node: TextNode.Ref]
RETURNS [name: Name] = {
-- does an ApplyAll and then returns the style name
s: Ref ← Alloc[];
ApplyAll[s, node];
name ← GetStyleName[s];
Free[s] };
-- Initialization
started: BOOLEAN ← FALSE;
InitLookNames:
PROC =
TRUSTED {
-- names are "look.a", "look.b", "look.c", etc.
txt: STRING ← [6];
txt[0] ← 'l; txt[1] ← txt[2] ← 'o; txt[3] ← 'k; txt[4] ← '.; txt.length ← 6;
FOR c:
CHARACTER
IN TextLooks.Look
DO
txt[5] ← c;
lookNames[c] ← MakeName[LOOPHOLE[LONG[txt],REF READONLY TEXT]];
ENDLOOP};
StartApply:
PUBLIC
PROCEDURE =
BEGIN
changeSet: EditNotify.ChangeSet;
frame: Frame ← NIL;
IF started THEN RETURN; started ← TRUE;
frame ← JaMOps.defaultFrame;
changeSet[ChangingProp] ← TRUE;
changeSet[ChangingType] ← TRUE;
changeSet[MovingNodes] ← TRUE;
changeSet[NodeNesting] ← TRUE;
changeSet[InsertingNode] ← TRUE;
EditNotify.AddNotifyProc[Notify,after,high,changeSet];
defaultStyle ← Create[];
defaultName ← MakeName["default"];
rootName ← MakeName["root"];
InitLookNames[];
InitApplyCacheRecord[];
InitRuleCacheInfo[];
InitLooksCacheInfo[];
InitObjectCacheInfo[];
ClearCaches[TRUE];
SetDefaultStyle["Cedar"];
END;
StartApply;
END.