DIRECTORY Ascii USING [Lower], NodeStyle USING [FontAlphabets, FontFace, FontUnderlining, GetFontSize, GetPrintSpaceWidth, GetScreenSpaceWidth, GetTabLoc, GetTabRealCode, LeaderTabStop, LineFormatting, PointsPerCentimeter, PointsPerDidot, PointsPerFil, PointsPerFill, PointsPerFilll, PointsPerInch, PointsPerMillimeter, PointsPerPica, Style, RulesTabStop, RuleTabStop, TabAlign, TabArrayRec, TabStop, TabStopRec], NodeStyleWorks USING [AddRealError, colorOps, DoStyleOp, glueOps, LoadProc, NameError, nameOps, OpsRec, Param, ParamRec, PercentError, realOps, RegisterStyleCommand, SetNameProc, StoreError, StyleError, StyleForFrame, TryToPopName, TryToPopReal, TryToPopRope], Rope USING [ActionType, Fetch, IsEmpty, Length, Map, ROPE], Tioga USING [Looks, noLooks], TJaM USING [AGet, Array, AtomFromRope, CommandProc, Frame, PopArray, PopReal, PopRope, Push, PushReal, PushRope]; NodeStyleWorks3Impl: CEDAR MONITOR IMPORTS Ascii, NodeStyle, NodeStyleWorks, Rope, TJaM EXPORTS NodeStyleWorks ~ BEGIN OPEN NodeStyle, NodeStyleWorks; Frame: TYPE ~ TJaM.Frame; ROPE: TYPE ~ Rope.ROPE; OpsListItem: TYPE ~ RECORD [name: ATOM, op: TJaM.CommandProc]; OpsList: TYPE ~ LIST OF OpsListItem; opsList: OpsList _ NIL; Preregister: PROC [param: Param, op: TJaM.CommandProc] RETURNS [Param] ~ { opsList _ CONS[[param.opName, op], opsList]; RETURN [param]; }; RegisterWorks3: PUBLIC PROC [frame: Frame] ~ { FOR list: OpsList _ opsList, list.rest UNTIL list=NIL DO RegisterStyleCommand[frame, list.first.name, list.first.op]; ENDLOOP; RegisterStyleCommand[frame, $clearTabStops, ClearTabStopsOp]; RegisterStyleCommand[frame, $tabStop, TabStopOp]; RegisterStyleCommand[frame, $defaultTabStops, DefaultTabStopsOp]; RegisterStyleCommand[frame, $tabStopLocations, RelativeTabStopsOp]; RegisterStyleCommand[frame, $pt, PointsOp]; RegisterStyleCommand[frame, $pc, PicasOp]; RegisterStyleCommand[frame, $in, InchesOp]; RegisterStyleCommand[frame, $cm, CentimetersOp]; RegisterStyleCommand[frame, $mm, MillimetersOp]; RegisterStyleCommand[frame, $dd, DidotPointsOp]; RegisterStyleCommand[frame, $em, EmsOp]; RegisterStyleCommand[frame, $en, EnsOp]; RegisterStyleCommand[frame, $screensp, ScreenSpacesOp]; RegisterStyleCommand[frame, $printsp, PrintSpacesOp]; RegisterStyleCommand[frame, $fil, FilOp]; RegisterStyleCommand[frame, $fill, FillOp]; RegisterStyleCommand[frame, $filll, FilllOp]; }; StyleNameOp: TJaM.CommandProc ~ { DoStyleOp[frame, styleNameParam] }; styleNameParam: Param _ Preregister[NEW [name ParamRec _ [nameOps, $style, name[style]]], StyleNameOp]; FontPrefixOp: TJaM.CommandProc ~ { DoStyleOp[frame, fontPrefixParam] }; fontPrefixParam: Param _ Preregister[NEW [name ParamRec _ [nameOps, $fontPrefix, name[fontPrefix]]], FontPrefixOp]; FontFamilyOp: TJaM.CommandProc ~ { DoStyleOp[frame, fontFamilyParam] }; fontFamilyParam: Param _ Preregister[NEW [name ParamRec _ [nameOps, $family, name[fontFamily]]], FontFamilyOp]; FontSizeOp: TJaM.CommandProc ~ { DoStyleOp[frame, fontSizeParam] }; fontSizeParam: Param _ Preregister[NEW [real ParamRec _ [realOps, $size, real[fontSize]]], FontSizeOp]; FontFaceOp: TJaM.CommandProc ~ { DoStyleOp[frame, fontFaceParam] }; fontFaceParam: Param _ Preregister[NEW[misc ParamRec _ [NEW [OpsRec _ [FontFaceLoad, StoreError, AddRealError, PercentError, FontFaceSetName]], $face, misc[]]], FontFaceOp]; FontFaceLoad: LoadProc ~ { TJaM.Push[frame, SELECT style.fontFace FROM Regular => $regular, Bold => $bold, Italic => $italic, BoldItalic => bolditalic, ENDCASE => ERROR] }; FontFaceSetName: SetNameProc ~ { Error: PROC RETURNS [FontFace] ~ { NameError[frame, name, p]; RETURN [Regular]; }; FontFaceArray: TYPE ~ ARRAY FontFace OF FontFace; minusBold: FontFaceArray ~ [Regular, Regular, Italic, Italic]; minusItalic: FontFaceArray ~ [Regular, Bold, Regular, Bold]; plusBold: FontFaceArray ~ [Bold, Bold, BoldItalic, BoldItalic]; plusItalic: FontFaceArray ~ [Italic, BoldItalic, Italic, BoldItalic]; style.fontFace _ SELECT name FROM $regular => Regular, $bold => Bold, $italic => Italic, bolditalic => BoldItalic, plusbold => plusBold[style.fontFace], plusitalic => plusItalic[style.fontFace], minusbold => minusBold[style.fontFace], minusitalic => minusItalic[style.fontFace], ENDCASE => Error[]; }; bolditalic: ATOM ~ TJaM.AtomFromRope["bold+italic"]; plusbold: ATOM ~ TJaM.AtomFromRope["+bold"]; plusitalic: ATOM ~ TJaM.AtomFromRope["+italic"]; minusbold: ATOM ~ TJaM.AtomFromRope["-bold"]; minusitalic: ATOM ~ TJaM.AtomFromRope["-italic"]; FontAlphabetsOp: TJaM.CommandProc ~ { DoStyleOp[frame, fontAlphabetsParam] }; fontAlphabetsParam: Param _ Preregister[NEW[misc ParamRec _ [NEW [OpsRec _ [FontAlphabetsLoad, StoreError, AddRealError, PercentError, FontAlphabetsSetName]], $alphabets, misc[]]], FontAlphabetsOp]; FontAlphabetsLoad: LoadProc ~ { TJaM.Push[frame, SELECT style.fontAlphabets FROM CapsAndLower => capsAndLower, CapsAndSmallCaps => capsAndSmallCaps, LowerOnly => $lowercase, CapsOnly => $caps, ENDCASE => ERROR] }; FontAlphabetsSetName: SetNameProc ~ { Error: PROC RETURNS [FontAlphabets] ~ { NameError[frame, name, p]; RETURN [CapsAndLower]; }; style.fontAlphabets _ SELECT name FROM capsAndLower => CapsAndLower, capsAndSmallCaps => CapsAndSmallCaps, $lowercase => LowerOnly, $caps => CapsOnly, ENDCASE => Error[]; }; capsAndLower: ATOM ~ TJaM.AtomFromRope["caps+lowercase"]; capsAndSmallCaps: ATOM ~ TJaM.AtomFromRope["caps+smallcaps"]; TextRotationOp: TJaM.CommandProc ~ { DoStyleOp[frame, textRotationParam] }; textRotationParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $textRotation, real[textRotation]]], TextRotationOp]; LeftIndentOp: TJaM.CommandProc ~ { DoStyleOp[frame, leftIndentParam] }; leftIndentParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $leftIndent, real[leftIndent]]], LeftIndentOp]; RightIndentOp: TJaM.CommandProc ~ { DoStyleOp[frame, rightIndentParam] }; rightIndentParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $rightIndent, real[rightIndent]]], RightIndentOp]; FirstIndentOp: TJaM.CommandProc ~ { DoStyleOp[frame, firstIndentParam] }; firstIndentParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $firstIndent, real[firstIndent]]], FirstIndentOp]; FirstIndentRightOp: TJaM.CommandProc ~ { DoStyleOp[frame, firstIndentRightParam] }; firstIndentRightParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $firstIndentRight, real[firstIndentRight]]], FirstIndentRightOp]; RestIndentOp: TJaM.CommandProc ~ { DoStyleOp[frame, restIndentParam] }; restIndentParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $restIndent, real[restIndent]]], RestIndentOp]; RunaroundLeftOp: TJaM.CommandProc ~ { DoStyleOp[frame, runaroundLeftParam] }; runaroundLeftParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $runaroundLeft, real[runaroundLeft]]], RunaroundLeftOp]; RunaroundRightOp: TJaM.CommandProc ~ { DoStyleOp[frame, runaroundRightParam] }; runaroundRightParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $runaroundRight, real[runaroundRight]]], RunaroundRightOp]; TopIndentOp: TJaM.CommandProc ~ { DoStyleOp[frame, topIndentParam] }; topIndentParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $topIndent, real[topIndent]]], TopIndentOp]; BottomIndentOp: TJaM.CommandProc ~ { DoStyleOp[frame, bottomIndentParam] }; bottomIndentParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $bottomIndent, real[bottomIndent]]], BottomIndentOp]; LineLeadingOp: TJaM.CommandProc ~ { DoStyleOp[frame, lineLeadingParam]; }; lineLeadingParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $leading, real[leading]]], LineLeadingOp]; LineLeadingStretchOp: TJaM.CommandProc ~ { DoStyleOp[frame, lineLeadingStretchParam] }; lineLeadingStretchParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $leadingStretch, real[leadingStretch]]], LineLeadingStretchOp]; LineLeadingShrinkOp: TJaM.CommandProc ~ { DoStyleOp[frame, lineLeadingShrinkParam] }; lineLeadingShrinkParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $leadingShrink, real[leadingShrink]]], LineLeadingShrinkOp]; LineLeadingGlueOp: TJaM.CommandProc ~ { DoStyleOp[frame, lineLeadingGlueParam] }; lineLeadingGlueParam: Param _ Preregister[NEW[glue ParamRec _ [glueOps, $leadingGlue, glue[leading, leadingStretch, leadingShrink]]], LineLeadingGlueOp]; TopLeadingOp: TJaM.CommandProc ~ { DoStyleOp[frame, topLeadingParam]; }; topLeadingParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $topLeading, real[topLeading]]], TopLeadingOp]; TopLeadingStretchOp: TJaM.CommandProc ~ { DoStyleOp[frame, topLeadingStretchParam] }; topLeadingStretchParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $topLeadingStretch, real[topLeadingStretch]]], TopLeadingStretchOp]; TopLeadingShrinkOp: TJaM.CommandProc ~ { DoStyleOp[frame, topLeadingShrinkParam] }; topLeadingShrinkParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $topLeadingShrink, real[topLeadingShrink]]], TopLeadingShrinkOp]; TopLeadingGlueOp: TJaM.CommandProc ~ { DoStyleOp[frame, topLeadingGlueParam] }; topLeadingGlueParam: Param _ Preregister[NEW[glue ParamRec _ [glueOps, $topLeadingGlue, glue[topLeading, topLeadingStretch, topLeadingShrink]]], TopLeadingGlueOp]; BottomLeadingOp: TJaM.CommandProc ~ { DoStyleOp[frame, bottomLeadingParam]; }; bottomLeadingParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $bottomLeading, real[bottomLeading]]], BottomLeadingOp]; BottomLeadingStretchOp: TJaM.CommandProc ~ { DoStyleOp[frame, bottomLeadingStretchParam] }; bottomLeadingStretchParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $bottomLeadingStretch, real[bottomLeadingStretch]]], BottomLeadingStretchOp]; BottomLeadingShrinkOp: TJaM.CommandProc ~ { DoStyleOp[frame, bottomLeadingShrinkParam] }; bottomLeadingShrinkParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $bottomLeadingShrink, real[bottomLeadingShrink]]], BottomLeadingShrinkOp]; BottomLeadingGlueOp: TJaM.CommandProc ~ { DoStyleOp[frame, bottomLeadingGlueParam] }; bottomLeadingGlueParam: Param _ Preregister[NEW[glue ParamRec _ [glueOps, $bottomLeadingGlue, glue[bottomLeading, bottomLeadingStretch, bottomLeadingShrink]]], BottomLeadingGlueOp]; LineFormattingOp: TJaM.CommandProc ~ { DoStyleOp[frame, lineFormattingParam]; }; lineFormattingParam: Param _ Preregister[NEW [misc ParamRec _ [NEW [OpsRec _ [LineFormattingLoad, StoreError, AddRealError, PercentError, LineFormattingSetName]], $lineFormatting, misc[]]], LineFormattingOp]; LineFormattingLoad: LoadProc ~ { TJaM.Push[frame, SELECT style.lineFormatting FROM Justified => $justified, FlushLeft => $flushLeft, FlushRight => $flushRight, Centered => $centered, ENDCASE => ERROR] }; LineFormattingSetName: SetNameProc ~ { Error: PROC RETURNS [LineFormatting] ~ { NameError[frame, name, p]; RETURN [FlushLeft] }; style.lineFormatting _ SELECT name FROM $justified => Justified, $flushLeft => FlushLeft, $flushRight => FlushRight, $centered => Centered, ENDCASE => Error[]; }; LastLineFormattingOp: TJaM.CommandProc ~ { DoStyleOp[frame, lastLineFormattingParam]; }; lastLineFormattingParam: Param _ Preregister[NEW [misc ParamRec _ [NEW [OpsRec _ [LastLineFormattingLoad, StoreError, AddRealError, PercentError, LastLineFormattingSetName]], $lastLineFormatting, misc[]]], LastLineFormattingOp]; LastLineFormattingLoad: LoadProc ~ { TJaM.Push[frame, SELECT style.lastLineFormatting FROM Justified => $justified, FlushLeft => $flushLeft, FlushRight => $flushRight, Centered => $centered, ENDCASE => ERROR] }; LastLineFormattingSetName: SetNameProc ~ { Error: PROC RETURNS [LineFormatting] ~ { NameError[frame, name, p]; RETURN [FlushLeft] }; style.lastLineFormatting _ SELECT name FROM $justified => Justified, $flushLeft => FlushLeft, $flushRight => FlushRight, $centered => Centered, ENDCASE => Error[]; }; 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 [FontUnderlining] ~ { 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 [FontUnderlining] ~ { NameError[frame, name, p]; RETURN [None] }; style.strikeout _ SELECT name FROM $none => None, lettersAndDigits => LettersAndDigits, $visible => Visible, $all => All, ENDCASE => Error[]; }; HShiftOp: TJaM.CommandProc ~ { DoStyleOp[frame, hshiftParam] }; hshiftParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $hShift, real[hshift]]], HShiftOp]; VShiftOp: TJaM.CommandProc ~ { DoStyleOp[frame, vshiftParam] }; vshiftParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $vShift, real[vshift]]], VShiftOp]; MinLineGapOp: TJaM.CommandProc ~ { DoStyleOp[frame, minLineGapParam]; }; minLineGapParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $minLineGap, real[minLineGap]]], MinLineGapOp]; TabStopsOp: TJaM.CommandProc ~ { DoStyleOp[frame, tabStopsParam]; }; tabStopsParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $tabStops, real[tabStops]]], TabStopsOp]; LineWeightOp: TJaM.CommandProc ~ { DoStyleOp[frame, lineWeightParam] }; lineWeightParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $lineWeight, real[lineWeight]]], LineWeightOp]; PageWidthOp: TJaM.CommandProc ~ { DoStyleOp[frame, pageWidthParam] }; pageWidthParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $pageWidth, real[pageWidth]]], PageWidthOp]; PageLengthOp: TJaM.CommandProc ~ { DoStyleOp[frame, pageLengthParam] }; pageLengthParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $pageLength, real[pageLength]]], PageLengthOp]; LeftMarginOp: TJaM.CommandProc ~ { DoStyleOp[frame, leftMarginParam] }; leftMarginParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $leftMargin, real[leftMargin]]], LeftMarginOp]; RightMarginOp: TJaM.CommandProc ~ { DoStyleOp[frame, rightMarginParam] }; rightMarginParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $rightMargin, real[rightMargin]]], RightMarginOp]; TopMarginOp: TJaM.CommandProc ~ { DoStyleOp[frame, topMarginParam] }; topMarginParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $topMargin, real[topMargin]]], TopMarginOp]; BottomMarginOp: TJaM.CommandProc ~ { DoStyleOp[frame, bottomMarginParam] }; bottomMarginParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $bottomMargin, real[bottomMargin]]], BottomMarginOp]; HeaderMarginOp: TJaM.CommandProc ~ { DoStyleOp[frame, headerMarginParam] }; headerMarginParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $headerMargin, real[headerMargin]]], HeaderMarginOp]; FooterMarginOp: TJaM.CommandProc ~ { DoStyleOp[frame, footerMarginParam] }; footerMarginParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $footerMargin, real[footerMargin]]], FooterMarginOp]; BindingMarginOp: TJaM.CommandProc ~ { DoStyleOp[frame, bindingMarginParam] }; bindingMarginParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $bindingMargin, real[bindingMargin]]], BindingMarginOp]; LineLengthOp: TJaM.CommandProc ~ { DoStyleOp[frame, lineLengthParam] }; lineLengthParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $lineLength, real[lineLength]]], LineLengthOp]; ColumnOp: TJaM.CommandProc ~ { DoStyleOp[frame, columnParam] }; columnParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $column, real[columns]]], ColumnOp]; TextHueOp: TJaM.CommandProc ~ { DoStyleOp[frame, textHueParam] }; textHueParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $textHue, real[textHue]]], TextHueOp]; TextSaturationOp: TJaM.CommandProc ~ { DoStyleOp[frame, textSaturationParam] }; textSaturationParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $textSaturation, real[textSaturation]]], TextSaturationOp]; TextBrightnessOp: TJaM.CommandProc ~ { DoStyleOp[frame, textBrightnessParam] }; textBrightnessParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $textBrightness, real[textBrightness]]], TextBrightnessOp]; TextColorOp: TJaM.CommandProc ~ { DoStyleOp[frame, textColorParam] }; textColorParam: Param _ Preregister[NEW[color ParamRec _ [colorOps, $textColor, color[textHue, textSaturation, textBrightness]]], TextColorOp]; PageBreakPenaltyOp: TJaM.CommandProc ~ { DoStyleOp[frame, pageBreakPenaltyParam] }; pageBreakPenaltyParam: Param _ Preregister[NEW[real ParamRec _ [realOps, $pageBreakPenalty, real[pageBreakPenalty]]], PageBreakPenaltyOp]; PageBreakPenalty2Op: TJaM.CommandProc ~ { DoStyleOp[frame, pageBreakPenalty2Param] }; pageBreakPenalty2Param: Param _ Preregister[NEW[real ParamRec _ [realOps, $pageBreakAfterFirstLinePenalty, real[pageBreakAfterFirstLinePenalty]]], PageBreakPenalty2Op]; PageBreakPenalty3Op: TJaM.CommandProc ~ { DoStyleOp[frame, pageBreakPenalty3Param] }; pageBreakPenalty3Param: Param _ Preregister[NEW[real ParamRec _ [realOps, $pageBreakAfterLastLinePenalty, real[pageBreakAfterLastLinePenalty]]], PageBreakPenalty3Op]; PageBreakPenalty4Op: TJaM.CommandProc ~ { DoStyleOp[frame, pageBreakPenalty4Param] }; pageBreakPenalty4Param: Param _ Preregister[NEW[real ParamRec _ [realOps, $pageBreakBeforeFirstLinePenalty, real[pageBreakBeforeFirstLinePenalty]]], PageBreakPenalty4Op]; PageBreakPenalty5Op: TJaM.CommandProc ~ { DoStyleOp[frame, pageBreakPenalty5Param] }; pageBreakPenalty5Param: Param _ Preregister[NEW[real ParamRec _ [realOps, $pageBreakBeforeLastLinePenalty, real[pageBreakBeforeLastLinePenalty]]], PageBreakPenalty5Op]; ClearTabStopsOp: TJaM.CommandProc ~ { ref: Style _ StyleForFrame[frame]; ref.tabStops _ NIL; ref.numTabStops _ 0; }; TabStopOp: TJaM.CommandProc ~ { ref: Style _ StyleForFrame[frame]; tabStop: TabStop _ TabSpec[ref, frame]; loc: REAL _ 0.0; tabStop.loc _ GetTabRealCode[ref, tabStop, loc, TJaM.PopReal[frame]]; loc _ GetTabLoc[tabStop, ref]; ref.numTabStops _ ref.numTabStops+1; IF ref.tabStops = NIL OR GetTabLoc[ref.tabStops.first, ref] <= loc THEN ref.tabStops _ CONS[tabStop, ref.tabStops] ELSE { -- copy list up to first with smaller loc old: LIST OF TabStop _ ref.tabStops; new: LIST OF TabStop _ CONS[old.first, NIL]; ref.tabStops _ new; FOR lst: LIST OF TabStop _ old.rest, lst.rest DO IF lst=NIL OR GetTabLoc[lst.first, ref] <= loc THEN { -- insert here new.rest _ CONS[tabStop, lst]; EXIT; }; new.rest _ CONS[lst.first, NIL]; new _ new.rest; ENDLOOP; }; }; RelativeTabStopsOp: TJaM.CommandProc ~ { ref: Style _ StyleForFrame[frame]; name: ATOM; ok: BOOL; [name, ok] _ TryToPopName[frame]; IF NOT ok THEN { -- restore name to stack and return default TJaM.PushRope[frame, "illegal value for tabStops: should be fixed or relative"]; StyleError[frame, 1]; }; SELECT name FROM $fixed => ref.fixedTabs _ TRUE; $relative => ref.fixedTabs _ FALSE; ENDCASE => { -- restore name to stack and return default TJaM.Push[frame, name]; TJaM.PushRope[frame, "illegal value for tabStops: should be fixed or relative"]; StyleError[frame, 2]; }; }; DefaultTabStopsOp: TJaM.CommandProc ~ { ref: Style _ StyleForFrame[frame]; tabStop: TabStop _ TabSpec[ref, frame]; tabStop.loc _ GetTabRealCode[ref, tabStop, loc, TJaM.PopReal[frame]]; ref.defaultTabStops _ tabStop; }; TabSpec: PROC [ref: Style, frame: Frame] RETURNS [tabStop: TabStop] ~ { -- parse tab specs looks: Tioga.Looks _ TabLooksSpec[frame]; breakIfPast: BOOL _ TabPastSpec[frame]; tabStop _ TabPattern[ref, frame]; tabStop.looks _ looks; tabStop.breakIfPast _ breakIfPast; TabAlign[tabStop, frame]; }; TabLooksSpec: PROC [frame: Frame] RETURNS [lks: Tioga.Looks] ~ { name: ATOM; ok: BOOL; SetLookBit: Rope.ActionType ~ { c _ Ascii.Lower[c]; IF c IN ['a..'z] THEN lks[c] _ TRUE; RETURN [FALSE]; }; lks _ Tioga.noLooks; [name, ok] _ TryToPopName[frame]; IF NOT ok THEN RETURN; IF name # $looks THEN { TJaM.Push[frame, name]; RETURN }; [] _ Rope.Map[base~TJaM.PopRope[frame], action~SetLookBit]; }; TabPastSpec: PROC [frame: Frame] RETURNS [break: BOOL] ~ { name: ATOM; ok: BOOL; [name, ok] _ TryToPopName[frame]; IF NOT ok THEN RETURN; SELECT name FROM $breakIfPast => break _ TRUE; $spaceIfPast => break _ FALSE; ENDCASE => { -- restore name to stack and return default TJaM.Push[frame, name]; break _ FALSE; }; }; TabPattern: PROC [ref: Style, frame: Frame] RETURNS [tabStop: TabStop] ~ { name: ATOM; ok: BOOL; [name, ok] _ TryToPopName[frame]; IF NOT ok THEN { tabStop _ NEW[blank TabStopRec]; RETURN }; SELECT name FROM $blank => tabStop _ NEW[blank TabStopRec]; $leaders => { leaderRope: ROPE; value: REAL _ 0.0; ldrStop: LeaderTabStop _ NEW[leaders TabStopRec]; tabStop _ ldrStop; [name, ok] _ TryToPopName[frame]; IF NOT ok THEN ldrStop.congruent _ TRUE ELSE SELECT name FROM $centered => ldrStop.congruent _ FALSE; $congruent => ldrStop.congruent _ TRUE; ENDCASE => { TJaM.Push[frame, name]; TJaM.PushRope[frame, "is not legal as value for tab leaders: congruent or centered"]; StyleError[frame, 2]; }; [value, ok] _ TryToPopReal[frame]; ldrStop.spacing _ GetTabRealCode[ref, tabStop, spacing, IF ok THEN value ELSE 0.0]; [leaderRope, ok] _ TryToPopRope[frame]; IF ok AND NOT leaderRope.IsEmpty THEN { IF leaderRope.Length > 1 THEN { TJaM.PushRope[frame, "Cannot specify more than one character for tab leaders"]; StyleError[frame, 1]; } ELSE ldrStop.char _ leaderRope.Fetch[0]; } ELSE { TJaM.PushRope[frame, "Must specify character for tab leaders"]; StyleError[frame, 1]; }; }; $rule => { ruleStop: RuleTabStop _ NEW[rule TabStopRec]; tabStop _ ruleStop; ruleStop.vshift _ GetTabRealCode[ref, tabStop, vshift, TJaM.PopReal[frame]]; ruleStop.weight _ GetTabRealCode[ref, tabStop, weight, TJaM.PopReal[frame]]; }; $rules => { array: TJaM.Array _ TJaM.PopArray[frame]; rulesStop: RulesTabStop _ NEW[rules TabStopRec]; tabStop _ rulesStop; rulesStop.rules _ NEW[TabArrayRec[array.len]]; FOR i: NAT IN [0..array.len/2) DO TJaM.Push[frame, TJaM.AGet[array, 2*i]]; rulesStop.rules.array[i].weight _ GetTabRealCode[ref, tabStop, weight, TJaM.PopReal[frame]]; TJaM.Push[frame, TJaM.AGet[array, 2*i+1]]; rulesStop.rules.array[i].vshift _ GetTabRealCode[ref, tabStop, vshift, TJaM.PopReal[frame]]; ENDLOOP; }; ENDCASE => { TJaM.Push[frame, name]; tabStop _ NEW[blank TabStopRec]; }; }; MissingChar: PROC [frame: Frame] ~ { TJaM.PushRope[frame, "Cannot specify more than one character for tab alignment"]; StyleError[frame, 1]; }; TabAlign: PROC [tabStop: TabStop, frame: Frame] ~ { name: ATOM; ok: BOOL; [name, ok] _ TryToPopName[frame]; IF NOT ok THEN { tabStop.alignment _ FlushLeft; RETURN }; SELECT name FROM $flushLeft => tabStop.alignment _ FlushLeft; $flushRight => tabStop.alignment _ FlushRight; $centered => tabStop.alignment _ Centered; $aligned => { alignRope: ROPE; tabStop.alignment _ Character; [alignRope, ok] _ TryToPopRope[frame]; IF ok AND NOT alignRope.IsEmpty THEN { IF alignRope.Length = 1 THEN tabStop.alignmentChar _ alignRope.Fetch[0] ELSE { TJaM.PushRope[frame, "Cannot specify more than one character for tab alignment"]; StyleError[frame, 1]; } } ELSE { TJaM.PushRope[frame, "Must specify character for tab alignment"]; StyleError[frame, 1]; }; }; ENDCASE => { TJaM.Push[frame, name]; tabStop.alignment _ FlushLeft; }; }; PointsOp: TJaM.CommandProc ~ { }; -- no change needed to convert to points pointsPerBigPoint: REAL _ 72.27/72; BigPointsOp: TJaM.CommandProc ~ {TJaM.PushReal[frame, TJaM.PopReal[frame]*pointsPerBigPoint]}; PicasOp: TJaM.CommandProc ~ { TJaM.PushReal[frame, TJaM.PopReal[frame]*PointsPerPica] }; InchesOp: TJaM.CommandProc ~ { TJaM.PushReal[frame, TJaM.PopReal[frame]*PointsPerInch] }; CentimetersOp: TJaM.CommandProc ~ { TJaM.PushReal[frame, TJaM.PopReal[frame]*PointsPerCentimeter] }; MillimetersOp: TJaM.CommandProc ~ { TJaM.PushReal[frame, TJaM.PopReal[frame]*PointsPerMillimeter] }; DidotPointsOp: TJaM.CommandProc ~ { TJaM.PushReal[frame, TJaM.PopReal[frame]*PointsPerDidot] }; EmsOp: TJaM.CommandProc ~ { oneEm: REAL ~ GetFontSize[StyleForFrame[frame]]; -- should really be width of "M" in current font TJaM.PushReal[frame, TJaM.PopReal[frame]*oneEm]; }; EnsOp: TJaM.CommandProc ~ { oneEn: REAL ~ GetFontSize[StyleForFrame[frame]]/2; -- should really be width of "N" in current font TJaM.PushReal[frame, TJaM.PopReal[frame]*oneEn]; }; ScreenSpacesOp: TJaM.CommandProc ~ { spaces: REAL ~ TJaM.PopReal[frame]; width: REAL ~ GetScreenSpaceWidth[StyleForFrame[frame]]; TJaM.PushReal[frame, spaces*width]; }; PrintSpacesOp: TJaM.CommandProc ~ { spaces: REAL ~ TJaM.PopReal[frame]; width: REAL ~ GetPrintSpaceWidth[StyleForFrame[frame]]; TJaM.PushReal[frame, spaces*width]; }; FilOp: TJaM.CommandProc ~ { TJaM.PushReal[frame, TJaM.PopReal[frame]*PointsPerFil] }; FillOp: TJaM.CommandProc ~ { TJaM.PushReal[frame, TJaM.PopReal[frame]*PointsPerFill] }; FilllOp: TJaM.CommandProc ~ { TJaM.PushReal[frame, TJaM.PopReal[frame]*PointsPerFilll] }; END. ϊNodeStyleWorks3Impl.mesa Copyright c 1985, 1986 by Xerox Corporation. All rights reserved. Written by Bill Paxton, January 1981 Bill Paxton, December 1, 1982 7:38 am Maxwell, January 6, 1983 8:46 am Russ Atkinson, March 7, 1985 3:34:46 am PST Doug Wyatt, September 24, 1986 6:34:00 pm PDT Michael Plass, March 14, 1986 11:02:57 am PST Rick Beach, June 3, 1985 5:26:48 pm PDT Implements JaM commands for style rules and commands to load styles. Initialization This must be first to pick up the Preregister calls in the start code. Style Name Font Parameters Font Prefix Font Family Font Size Font Face Font Alphabets Text Rotation Indents Left Indent Right Indent First Indent First Indent on the Right Rest Indent Runaround Left Runaround Right Top Indent Bottom Indent Leading Parameters Line Leading Glue Top Leading Glue Bottom Leading Glue Line Formatting Underlining Strikeout Miscellaneous Positioning Parameters TabStops Line Weight Page Layout Parameters Page Width Text Color Page Break Penalty Parameters Fancy Tabs Insert in list of tab stops. kept sorted by decreasing location, i.e., from right to left on page this may result in a slight decrease in efficiency for the formatters, but it substantially reduces allocations during the creation of the list since styles tend to define tab stops in increasing order, so can add to start of list and list additions must be non-destructive of the previous list PROC [c: CHAR] RETURNS [quit: BOOL _ FALSE] restore name to stack and return default Dimensions ΚC˜codešœ™Kšœ Οmœ7™BKšœ$™$Kšœ%™%K™ K™+K™-K™-J™'—K˜KšœD™DK™šΟk ˜ Kšœžœ ˜Kšœ žœο˜ώKšœžœπ˜„Kšœžœ+žœ˜;Kšœžœ˜Kšœžœg˜q—K˜KšΠblœžœž˜"Kšžœ-˜4Kšžœ˜šœžœžœ˜'K˜Kšœžœ˜Kšžœžœžœ˜—headšœ™K™FK™Kšœ žœžœžœ˜>Kšœ žœžœžœ ˜$šœžœ˜K˜—šΟn œžœ&žœ ˜JJšœ žœ˜,Jšžœ ˜J˜J™—š œžœžœ˜.šžœ$žœžœž˜8Kšœ<˜˜MKšœ(žœžœ†˜ΖK˜š œ˜šœžœž˜0K˜K˜%Kšœ˜Kšœ˜Kšžœžœ˜—˜K˜——š œ˜%š œžœžœ˜'Kšœ˜Kšžœ˜Kšœ˜—šœžœž˜&K˜K˜%Kšœ˜Kšœ˜Kšžœ ˜—Kšœ˜—Kšœžœ'˜9Kšœžœ'˜=—šœ ™ Kš œ=˜KKšœ'žœP˜z——™šœ ™ Kš  œ;˜GKšœ%žœJ˜r—šœ ™ Kš  œ<˜IKšœ&žœM˜v—šœ ™ Kš  œ<˜IKšœ&žœM˜v—šœ™Kš œA˜SKšœ+žœ\˜Š—šœ ™ Kš  œ;˜GKšœ%žœJ˜r—™Kš œ>˜MKšœ(žœS˜~—™Kš œ?˜OKšœ)žœV˜‚—šœ ™ Kš  œ:˜EKšœ$žœG˜n—šœ ™ Kš œ=˜KKšœ'žœP˜z——™šœ™Kš  œ=˜JKšœ&žœE˜nK˜Kš œC˜WKšœ-žœZ˜ŠK˜Kš œB˜UKšœ,žœW˜†K˜Kš œ@˜QKšœ*žœl˜™K˜—šœ™Kš  œ<˜HKšœ%žœJ˜rK˜Kš œB˜UKšœ,žœ_˜ŽK˜Kš œA˜SKšœ+žœ\˜ŠK˜Kš œ?˜OKšœ)žœw˜£K˜—šœ™Kš œ?˜NKšœ(žœS˜~K˜Kš œE˜[Kšœ/žœh˜šK˜Kš œD˜YKšœ.žœe˜–K˜Kš œB˜UKšœ,žœ†˜΅——šœ™Kš œ@˜PKšœ)žœžœŽ˜ΠK˜š œ˜ šœžœž˜1K˜K˜K˜K˜Kšžœžœ˜K˜K˜——š œ˜&š œžœžœ˜(Kšœžœ˜0—šœžœž˜'K˜K˜K˜K˜Kšžœ ˜—Kšœ˜K˜—Kš œD˜XKšœ-žœžœž˜δK˜š œ˜$šœžœž˜5K˜K˜K˜K˜Kšžœžœ˜K˜K˜——š œ˜*š œžœžœ˜(Kšœžœ˜0—šœžœž˜+K˜K˜K˜K˜Kšžœ ˜—Kšœ˜——šœ ™ Kš  œ<˜IKšœ&žœžœ‚˜ΑK˜š œ˜šœžœž˜.K˜K˜%K˜K˜ Kšžœžœ˜—K˜—Kšœžœ'˜=˜K˜—š œ˜#Kš œžœžœ2žœ ˜Ušœžœž˜$K˜K˜%K˜K˜ Kšžœ ˜—Kšœ˜——šœ ™ Kš  œ:˜EKšœ$žœžœz˜·K˜š  œ˜šœžœž˜,K˜K˜%K˜K˜ Kšžœžœ˜—˜K˜——š œ˜!Kš œžœžœ2žœ ˜Ušœžœž˜"K˜K˜%K˜K˜ Kšžœ ˜—Kšœ˜——™$Kš œ7˜?Kšœ!žœ>˜bK˜Kš œ7˜?Kšœ!žœ>˜bK˜Kš  œ<˜HKšœ%žœJ˜r—šœ™Kš  œ:˜DKšœ#žœD˜j—šœ ™ Kš  œ;˜GKšœ%žœJ˜r—™šœ ™ Kš  œ:˜EKšœ$žœG˜nK˜Kš  œ;˜GKšœ%žœJ˜rK˜Kš  œ;˜GKšœ%žœJ˜rK˜Kš  œ<˜IKšœ&žœM˜vK˜Kš  œ:˜EKšœ$žœG˜nK˜Kš œ=˜KKšœ'žœP˜zK˜Kš œ=˜KKšœ'žœP˜zK˜Kš œ=˜KKšœ'žœP˜zK˜Kš œ>˜MKšœ(žœS˜~K˜Kš  œ;˜GKšœ%žœJ˜rK˜Kš œ7˜?Kšœ!žœ?˜c——šœ ™ Kš  œ8˜AKšœ"žœA˜fK˜Kš œ?˜OKšœ)žœV˜‚K˜Kš œ?˜OKšœ)žœV˜‚K˜Kš  œ:˜EKšœ$žœh˜—šœ™Kš œA˜SKšœ+žœ\˜ŠK˜Kš œB˜UKšœ,žœy˜¨K˜Kš œB˜UKšœ,žœw˜¦K˜Kš œB˜UKšœ,žœ{˜ͺK˜Kš œB˜UKšœ,žœy˜¨—™ š œ˜%Kšœ"˜"Kšœžœ˜(Kšœ˜K˜—š  œ˜K˜"Kšœ'˜'Kšœžœ˜K˜Ešœb™bKšœ¦™¦—K˜Kšœ$˜$šžœžœžœ+ž˜GKšœžœ˜*—šžœΟc)˜0Kšœžœžœ˜$Kš œžœžœ žœ žœ˜,Kšœ˜šžœžœžœž˜0š žœžœžœ"žœ‘˜DKšœ žœ˜Kšžœ˜Kšœ˜—Kšœ žœ žœ˜ K˜Kšžœ˜Kšœ˜—Kšœ˜—K˜—š œ˜(K˜"Kšœžœ˜ Kšœžœ˜ K˜!šžœžœžœ‘+˜