<> <> <> <> <> <<>> DIRECTORY NodeStyle USING [FontUnderlining], NodeStyleOps USING [defaultStyleName, InitializeDefaultStyle, LoadStyle], NodeStyleWorks USING [AddRealError, attachmentsDict, bindingDict, colorOps, defaultFrame, DoStyleOp, get, GetCommand, glueOps, InitDict, load, LoadProc, NameError, OpsRec, Param, ParamRec, PercentError, realOps, RegisterStyleCommand, RegisterStyleLiteral, RegisterWorks1, RegisterWorks2, RegisterWorks3, run, SetNameProc, StoreError, styledict, StyleError, stylesDicts, sysdict, TypeCheckDict, userdict], Rope USING [ROPE], TJaM USING [Any, AtomFromRope, AttachDict, Begin, CommandProc, CvX, DictTop, End, Execute, Frame, NewFrame, Pop, PopBool, Push, PushRope, TryToLoad]; NodeStyleWorks4Impl: CEDAR PROGRAM IMPORTS NodeStyleOps, NodeStyleWorks, TJaM EXPORTS NodeStyleWorks ~ BEGIN OPEN NodeStyleWorks; Frame: TYPE ~ TJaM.Frame; ROPE: TYPE ~ Rope.ROPE; <> <> <<>> opsList: LIST OF RECORD[name: ATOM, op: TJaM.CommandProc] _ NIL; Preregister: PROC [param: Param, op: TJaM.CommandProc] RETURNS [Param] ~ INLINE --gfi saver-- { opsList _ CONS[[param.opName, op], opsList]; RETURN [param]; }; <<>> RegisterWorks4: PUBLIC PROC [frame: Frame] ~ { WHILE opsList # NIL DO RegisterStyleCommand[frame, opsList.first.name, opsList.first.op]; opsList _ opsList.rest; ENDLOOP; TJaM.Execute[frame, TJaM.CvX[prolog]]; }; <> <> <<>> prolog: ROPE _ " (firstFolio) 1 StyleParam <> (firstVisibleFolio) 1 StyleParam <> (lastDropFolio) 1 StyleParam <> (firstHeaders) 0 StyleParam <> (maxVerticalExpansion) 3 StyleParam <> (maxHorizontalExpansion) 1 fil StyleParam <> (sided) 1 StyleParam <> (keep) 0 pt StyleParam <> (keepStretch) 1 fil StyleParam <> (columnGap) 0.5 in StyleParam <> (topIndentStretch) 0 StyleParam <> (bottomIndentStretch) 0 StyleParam <> (hyphenation) (No) StyleParam <> (hyphenCode) 45 StyleParam <> (pageRotation) 0 StyleParam <> (pageRotationVerso) 0 StyleParam <> (mediumColor) {mediumBrightness mediumSaturation mediumHue} .cvx .def <> (mediumHue) 0 StyleParam (mediumSaturation) 0 StyleParam (mediumBrightness) 1 StyleParam (textNamedColor) (nil) StyleParam <> (areaNamedColor) (nil) StyleParam <> (backgroundNamedColor) (nil) StyleParam <> (outlineBoxNamedColor) (nil) StyleParam <> (underlineNamedColor) (nil) StyleParam <> (strikeoutNamedColor) (nil) StyleParam <> "; <> UnderliningOp: TJaM.CommandProc ~ { DoStyleOp[frame, underliningParam] }; underliningParam: Param _ Preregister[NEW [misc ParamRec _ [NEW [OpsRec _ [UnderliningLoad, StoreError, AddRealError, PercentError, UnderliningSetName]], $underlining, misc[]]], UnderliningOp]; UnderliningLoad: LoadProc ~ { TJaM.Push[frame, SELECT style.underlining FROM None => $none, LettersAndDigits => lettersAndDigits, Visible => $visible, All => $all, ENDCASE => ERROR] }; lettersAndDigits: ATOM ~ TJaM.AtomFromRope["letters+digits"]; UnderliningSetName: SetNameProc ~ { Error: PROC RETURNS [NodeStyle.FontUnderlining] ~ INLINE --gfi saver-- { NameError[frame, name, p]; RETURN [None] }; style.underlining _ SELECT name FROM $none => None, lettersAndDigits => LettersAndDigits, $visible => Visible, $all => All, ENDCASE => Error[]; }; <> StrikeoutOp: TJaM.CommandProc ~ { DoStyleOp[frame, strikeoutParam] }; strikeoutParam: Param _ Preregister[NEW [misc ParamRec _ [NEW [OpsRec _ [StrikeoutLoad, StoreError, AddRealError, PercentError, StrikeoutSetName]], $strikeout, misc[]]], StrikeoutOp]; StrikeoutLoad: LoadProc ~ { TJaM.Push[frame, SELECT style.strikeout FROM None => $none, LettersAndDigits => lettersAndDigits, Visible => $visible, All => $all, ENDCASE => ERROR] }; StrikeoutSetName: SetNameProc ~ { Error: PROC RETURNS [NodeStyle.FontUnderlining] ~ INLINE --gfi saver-- { NameError[frame, name, p]; RETURN [None] }; style.strikeout _ SELECT name FROM $none => None, lettersAndDigits => LettersAndDigits, $visible => Visible, $all => All, ENDCASE => Error[]; }; <> LetterspacingOp: TJaM.CommandProc ~ { DoStyleOp[frame, letterspacingParam] }; letterspacingParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $letterspacing, real[letterspacing]]], LetterspacingOp]; LetterspacingStretchOp: TJaM.CommandProc ~ { DoStyleOp[frame, letterspacingStretchParam] }; letterspacingStretchParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $letterspacingStretch, real[letterspacingStretch]]], LetterspacingStretchOp]; LetterspacingShrinkOp: TJaM.CommandProc ~ { DoStyleOp[frame, letterspacingShrinkParam] }; letterspacingShrinkParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $letterspacingShrink, real[letterspacingShrink]]], LetterspacingShrinkOp]; LetterspacingGlueOp: TJaM.CommandProc ~ { DoStyleOp[frame, letterspacingGlueParam] }; letterspacingGlueParam: Param _ Preregister[NEW[glue ParamRec _ [glueOps, $letterspacingGlue, glue[letterspacing, letterspacingStretch, letterspacingShrink]]], LetterspacingGlueOp]; <> PagebreakOp: TJaM.CommandProc ~ { DoStyleOp[frame, pagebreakParam] }; pagebreakParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $pagebreak, real[pagebreak]]], PagebreakOp]; PagebreakStretchOp: TJaM.CommandProc ~ { DoStyleOp[frame, pagebreakStretchParam] }; pagebreakStretchParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $pagebreakStretch, real[pagebreakStretch]]], PagebreakStretchOp]; PagebreakShrinkOp: TJaM.CommandProc ~ { DoStyleOp[frame, pagebreakShrinkParam] }; pagebreakShrinkParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $pagebreakShrink, real[pagebreakShrink]]], PagebreakShrinkOp]; PagebreakGlueOp: TJaM.CommandProc ~ { DoStyleOp[frame, pagebreakGlueParam] }; pagebreakGlueParam: Param _ Preregister[NEW[glue ParamRec _ [glueOps, $pagebreakGlue, glue[pagebreak, pagebreakStretch, pagebreakShrink]]], PagebreakGlueOp]; <> UnderlineThicknessOp: TJaM.CommandProc ~ { DoStyleOp[frame, underlineThicknessParam] }; underlineThicknessParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $underlineThickness, real[underlineThickness]]], UnderlineThicknessOp]; UnderlineDescentOp: TJaM.CommandProc ~ { DoStyleOp[frame, underlineDescentParam] }; underlineDescentParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $underlineDescent, real[underlineDescent]]], UnderlineDescentOp]; UnderlineHueOp: TJaM.CommandProc ~ { DoStyleOp[frame, underlineHueParam] }; underlineHueParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $underlineHue, real[underlineHue]]], UnderlineHueOp]; UnderlineSaturationOp: TJaM.CommandProc ~ { DoStyleOp[frame, underlineSaturationParam] }; underlineSaturationParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $underlineSaturation, real[underlineSaturation]]], UnderlineSaturationOp]; UnderlineBrightnessOp: TJaM.CommandProc ~ { DoStyleOp[frame, underlineBrightnessParam] }; underlineBrightnessParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $underlineBrightness, real[underlineBrightness]]], UnderlineBrightnessOp]; UnderlineColorOp: TJaM.CommandProc ~ { DoStyleOp[frame, underlineColorParam] }; underlineColorParam: Param _ Preregister[NEW[color ParamRec _ [colorOps, $underlineColor, color[underlineHue, underlineSaturation, underlineBrightness]]], UnderlineColorOp]; <> StrikeoutThicknessOp: TJaM.CommandProc ~ { DoStyleOp[frame, strikeoutThicknessParam] }; strikeoutThicknessParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $strikeoutThickness, real[strikeoutThickness]]], StrikeoutThicknessOp]; StrikeoutAscentOp: TJaM.CommandProc ~ { DoStyleOp[frame, strikeoutAscentParam] }; strikeoutAscentParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $strikeoutAscent, real[strikeoutAscent]]], StrikeoutAscentOp]; StrikeoutHueOp: TJaM.CommandProc ~ { DoStyleOp[frame, strikeoutHueParam] }; strikeoutHueParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $strikeoutHue, real[strikeoutHue]]], StrikeoutHueOp]; StrikeoutSaturationOp: TJaM.CommandProc ~ { DoStyleOp[frame, strikeoutSaturationParam] }; strikeoutSaturationParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $strikeoutSaturation, real[strikeoutSaturation]]], StrikeoutSaturationOp]; StrikeoutBrightnessOp: TJaM.CommandProc ~ { DoStyleOp[frame, strikeoutBrightnessParam] }; strikeoutBrightnessParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $strikeoutBrightness, real[strikeoutBrightness]]], StrikeoutBrightnessOp]; StrikeoutColorOp: TJaM.CommandProc ~ { DoStyleOp[frame, strikeoutColorParam] }; strikeoutColorParam: Param _ Preregister[NEW[color ParamRec _ [colorOps, $strikeoutColor, color[strikeoutHue, strikeoutSaturation, strikeoutBrightness]]], StrikeoutColorOp]; <> OutlineBoxThicknessOp: TJaM.CommandProc ~ { DoStyleOp[frame, outlineBoxThicknessParam] }; outlineBoxThicknessParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $outlineBoxThickness, real[outlineboxThickness]]], OutlineBoxThicknessOp]; OutlineBoxBearoffOp: TJaM.CommandProc ~ { DoStyleOp[frame, outlineBoxBearoffParam] }; outlineBoxBearoffParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $outlineBoxBearoff, real[outlineboxBearoff]]], OutlineBoxBearoffOp]; OutlineBoxHueOp: TJaM.CommandProc ~ { DoStyleOp[frame, outlineBoxHueParam] }; outlineBoxHueParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $outlineBoxHue, real[outlineboxHue]]], OutlineBoxHueOp]; OutlineBoxSaturationOp: TJaM.CommandProc ~ { DoStyleOp[frame, outlineBoxSaturationParam] }; outlineBoxSaturationParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $outlineBoxSaturation, real[outlineboxSaturation]]], OutlineBoxSaturationOp]; OutlineBoxBrightnessOp: TJaM.CommandProc ~ { DoStyleOp[frame, outlineBoxBrightnessParam] }; outlineBoxBrightnessParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $outlineBoxBrightness, real[outlineboxBrightness]]], OutlineBoxBrightnessOp]; OutlineBoxColorOp: TJaM.CommandProc ~ { DoStyleOp[frame, outlineBoxColorParam] }; outlineBoxColorParam: Param _ Preregister[NEW[color ParamRec _ [colorOps, $outlineBoxColor, color[outlineboxHue, outlineboxSaturation, outlineboxBrightness]]], OutlineBoxColorOp]; <> BackgroundAscentOp: TJaM.CommandProc ~ { DoStyleOp[frame, backgroundAscentParam] }; backgroundAscentParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $backgroundAscent, real[backgroundAscent]]], BackgroundAscentOp]; BackgroundDescentOp: TJaM.CommandProc ~ { DoStyleOp[frame, backgroundDescentParam] }; backgroundDescentParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $backgroundDescent, real[backgroundDescent]]], BackgroundDescentOp]; BackgroundHueOp: TJaM.CommandProc ~ { DoStyleOp[frame, backgroundHueParam] }; backgroundHueParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $backgroundHue, real[backgroundHue]]], BackgroundHueOp]; BackgroundSaturationOp: TJaM.CommandProc ~ { DoStyleOp[frame, backgroundSaturationParam] }; backgroundSaturationParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $backgroundSaturation, real[backgroundSaturation]]], BackgroundSaturationOp]; BackgroundBrightnessOp: TJaM.CommandProc ~ { DoStyleOp[frame, backgroundBrightnessParam] }; backgroundBrightnessParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $backgroundBrightness, real[backgroundBrightness]]], BackgroundBrightnessOp]; BackgroundColorOp: TJaM.CommandProc ~ { DoStyleOp[frame, backgroundColorParam] }; backgroundColorParam: Param _ Preregister[NEW[color ParamRec _ [colorOps, $backgroundColor, color[backgroundHue, backgroundSaturation, backgroundBrightness]]], BackgroundColorOp]; <> AreaHueOp: TJaM.CommandProc ~ { DoStyleOp[frame, areaHueParam] }; areaHueParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $areaHue, real[areaHue]]], AreaHueOp]; AreaSaturationOp: TJaM.CommandProc ~ { DoStyleOp[frame, areaSaturationParam] }; areaSaturationParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $areaSaturation, real[areaSaturation]]], AreaSaturationOp]; AreaBrightnessOp: TJaM.CommandProc ~ { DoStyleOp[frame, areaBrightnessParam] }; areaBrightnessParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $areaBrightness, real[areaBrightness]]], AreaBrightnessOp]; AreaColorOp: TJaM.CommandProc ~ { DoStyleOp[frame, areaColorParam] }; areaColorParam: Param _ Preregister[NEW[color ParamRec _ [colorOps, $areaColor, color[areaHue, areaSaturation, areaBrightness]]], AreaColorOp]; <> OutlineHueOp: TJaM.CommandProc ~ { DoStyleOp[frame, outlineHueParam] }; outlineHueParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $outlineHue, real[outlineHue]]], OutlineHueOp]; OutlineSaturationOp: TJaM.CommandProc ~ { DoStyleOp[frame, outlineSaturationParam] }; outlineSaturationParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $outlineSaturation, real[outlineSaturation]]], OutlineSaturationOp]; OutlineBrightnessOp: TJaM.CommandProc ~ { DoStyleOp[frame, outlineBrightnessParam] }; outlineBrightnessParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $outlineBrightness, real[outlineBrightness]]], OutlineBrightnessOp]; OutlineColorOp: TJaM.CommandProc ~ { DoStyleOp[frame, outlineColorParam] }; outlineColorParam: Param _ Preregister[NEW[color ParamRec _ [colorOps, $outlineColor, color[outlineHue, outlineSaturation, outlineBrightness]]], OutlineColorOp]; <> FIOp: TJaM.CommandProc ~ { <> truePart: TJaM.Any _ TJaM.Pop[frame]; falsePart: TJaM.Any _ NIL; body: TJaM.Any _ NIL; elseOrThen: TJaM.Any _ TJaM.Pop[frame]; if: TJaM.Any _ NIL; IF elseOrThen = $ELSE THEN { falsePart _ truePart; truePart _ TJaM.Pop[frame]; elseOrThen _ TJaM.Pop[frame]; }; IF elseOrThen = $THEN THEN { condition: BOOL ~ TJaM.PopBool[frame]; body _ IF condition THEN truePart ELSE falsePart; if _ TJaM.Pop[frame]; }; IF if # $IF THEN {TJaM.PushRope[frame, "Mismatched IF construct"]; StyleError[frame, 1]}; IF body # NIL THEN TJaM.Execute[frame, TJaM.CvX[body]]; }; <> <> <> <<>> RunFile: PROC [frame: Frame, name: ATOM, fileName: ROPE] RETURNS [ran: BOOL] ~ { <> 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[]; <<>> <> get _ GetCommand[frame, TJaM.AtomFromRope[".get"]]; run _ GetCommand[frame, TJaM.AtomFromRope[".run"]]; load _ GetCommand[frame, TJaM.AtomFromRope[".load"]]; <> TJaM.Execute[frame, TJaM.AtomFromRope[".sysdict"]]; sysdict _ TypeCheckDict[TJaM.Pop[frame]]; <> <> IF NOT RunFile[frame, $user ,"start.jam"] THEN TJaM.Execute[frame, TJaM.AtomFromRope[".start"]]; <> userdict _ TJaM.DictTop[frame]; <> styledict _ InitDict[$TiogaStylesDictionary]; TJaM.AttachDict[styledict, userdict]; <<>> <> TJaM.End[frame]; TJaM.Begin[frame, styledict]; <> stylesDicts[base] _ InitDict[$TiogaBaseStylesDictionary]; stylesDicts[print] _ InitDict[$TiogaPrintStylesDictionary]; stylesDicts[screen] _ InitDict[$TiogaScreenStylesDictionary]; bindingDict _ InitDict[$TiogaBindingDictionary, 200]; attachmentsDict _ InitDict[$TiogaAttachedStylesDictionary]; <> [] _ RunFile[frame, $StyleError, "TiogaUtils.jam"]; <> RegisterWorks1[frame]; RegisterWorks2[frame]; RegisterWorks3[frame]; RegisterWorks4[frame]; <> <> <<>> <> <> RegisterStyleLiteral[frame, $the]; RegisterStyleLiteral[frame, $smaller]; RegisterStyleLiteral[frame, $bigger]; RegisterStyleLiteral[frame, $percent]; <<>> <> 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"]]; <<>> <> RegisterStyleLiteral[frame, TJaM.AtomFromRope["caps+lowercase"]]; RegisterStyleLiteral[frame, TJaM.AtomFromRope["caps+smallcaps"]]; RegisterStyleLiteral[frame, $lowercase]; RegisterStyleLiteral[frame, $caps]; <<>> <> RegisterStyleLiteral[frame, $all]; RegisterStyleLiteral[frame, $visible]; RegisterStyleLiteral[frame, TJaM.AtomFromRope["letters+digits"]]; RegisterStyleLiteral[frame, $none]; <> RegisterStyleLiteral[frame, $justified]; RegisterStyleLiteral[frame, $flush]; RegisterStyleLiteral[frame, $flushLeft]; RegisterStyleLiteral[frame, $flushRight]; RegisterStyleLiteral[frame, $centered]; <<>> <> RegisterStyleLiteral[frame, $filled]; RegisterStyleLiteral[frame, $outlined]; RegisterStyleLiteral[frame, $filled]; RegisterStyleLiteral[frame, TJaM.AtomFromRope["filled+outlined"]]; <<>> <> RegisterStyleLiteral[frame, $fixed]; RegisterStyleLiteral[frame, $relative]; <<>> <> 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]; <> RegisterStyleLiteral[frame, $IF]; RegisterStyleLiteral[frame, $THEN]; RegisterStyleLiteral[frame, $ELSE]; RegisterStyleCommand[frame, $FI, FIOp]; <<>> <> NodeStyleOps.InitializeDefaultStyle["Cedar"]; [] _ NodeStyleOps.LoadStyle[NodeStyleOps.defaultStyleName]; }; StartTheWorks[!]; END.