DIRECTORY NodeStyle, NodeStyleExtra, NodeStyleObject, NodeStyleStart USING [], TextNode USING [Ref], TextLooks, NameSymbolTable, Real, TJaMOps, TJaMBasic; NodeStyle2Impl: CEDAR MONITOR IMPORTS NodeStyle, NodeStyleExtra, NodeStyleObject, NameSymbolTable, Real, TJaMOps EXPORTS NodeStyleExtra, NodeStyleObject, NodeStyleStart = BEGIN OPEN R:Real, NodeStyle, NodeStyleExtra, NodeStyleObject; TextRotationOp: PROC [frame: Frame] = { DoStyleOperation[frame,textRotationParam] }; textRotationParam: Param; LineWeightOp: PROC [frame: Frame] = { DoStyleOperation[frame,lineWeightParam] }; lineWeightParam: Param; PageWidthOp: PROC [frame: Frame] = { DoStyleOperation[frame,pageWidthParam] }; pageWidthParam: Param; PageLengthOp: PROC [frame: Frame] = { DoStyleOperation[frame,pageLengthParam] }; pageLengthParam: Param; LeftMarginOp: PROC [frame: Frame] = { DoStyleOperation[frame,leftMarginParam] }; leftMarginParam: Param; RightMarginOp: PROC [frame: Frame] = { DoStyleOperation[frame,rightMarginParam] }; rightMarginParam: Param; TopMarginOp: PROC [frame: Frame] = { DoStyleOperation[frame,topMarginParam] }; topMarginParam: Param; BottomMarginOp: PROC [frame: Frame] = { DoStyleOperation[frame,bottomMarginParam] }; bottomMarginParam: Param; HeaderMarginOp: PROC [frame: Frame] = { DoStyleOperation[frame,headerMarginParam] }; headerMarginParam: Param; FooterMarginOp: PROC [frame: Frame] = { DoStyleOperation[frame,footerMarginParam] }; footerMarginParam: Param; BindingMarginOp: PROC [frame: Frame] = { DoStyleOperation[frame,bindingMarginParam] }; bindingMarginParam: Param; LineLengthOp: PROC [frame: Frame] = { DoStyleOperation[frame,lineLengthParam] }; lineLengthParam: Param; ColumnOp: PROC [frame: Frame] = { DoStyleOperation[frame,columnParam] }; columnParam: Param; AreaHueOp: PROC [frame: Frame] = { DoStyleOperation[frame,areaHueParam] }; areaHueParam: Param; AreaSaturationOp: PROC [frame: Frame] = { DoStyleOperation[frame,areaSaturationParam] }; areaSaturationParam: Param; AreaBrightnessOp: PROC [frame: Frame] = { DoStyleOperation[frame,areaBrightnessParam] }; areaBrightnessParam: Param; AreaColorOp: PROC [frame: Frame] = { DoStyleOperation[frame,areaColorParam] }; areaColorParam: Param; OutlineHueOp: PROC [frame: Frame] = { DoStyleOperation[frame,outlineHueParam] }; outlineHueParam: Param; OutlineSaturationOp: PROC [frame: Frame] = { DoStyleOperation[frame,outlineSaturationParam] }; outlineSaturationParam: Param; OutlineBrightnessOp: PROC [frame: Frame] = { DoStyleOperation[frame,outlineBrightnessParam] }; outlineBrightnessParam: Param; OutlineColorOp: PROC [frame: Frame] = { DoStyleOperation[frame,outlineColorParam] }; outlineColorParam: Param; TextHueOp: PROC [frame: Frame] = { DoStyleOperation[frame,textHueParam] }; textHueParam: Param; TextSaturationOp: PROC [frame: Frame] = { DoStyleOperation[frame,textSaturationParam] }; textSaturationParam: Param; TextBrightnessOp: PROC [frame: Frame] = { DoStyleOperation[frame,textBrightnessParam] }; textBrightnessParam: Param; TextColorOp: PROC [frame: Frame] = { DoStyleOperation[frame,textColorParam] }; textColorParam: Param; PageBreakPenaltyOp: PROC [frame: Frame] = { DoStyleOperation[frame,pageBreakPenaltyParam] }; pageBreakPenaltyParam: Param; PageBreakPenalty2Op: PROC [frame: Frame] = { DoStyleOperation[frame,pageBreakPenalty2Param] }; pageBreakPenalty2Param: Param; PageBreakPenalty3Op: PROC [frame: Frame] = { DoStyleOperation[frame,pageBreakPenalty3Param] }; pageBreakPenalty3Param: Param; PageBreakPenalty4Op: PROC [frame: Frame] = { DoStyleOperation[frame,pageBreakPenalty4Param] }; pageBreakPenalty4Param: Param; PageBreakPenalty5Op: PROC [frame: Frame] = { DoStyleOperation[frame,pageBreakPenalty5Param] }; pageBreakPenalty5Param: Param; FontAlphabetsOp: PROC [frame: Frame] = { DoStyleOperation[frame,fontAlphabetsParam] }; fontAlphabetsOps: Ops; fontAlphabetsParam: Param; FontAlphabetsLoad: LoadProc = { PushName[frame, SELECT style.fontAlphabets FROM CapsAndLower => capsAndLower, CapsAndSmallCaps => capsAndSmallCaps, LowerOnly => lowerOnly, CapsOnly => capsOnly, ENDCASE => ERROR] }; FontAlphabetsSetName: SetNameProc = { Error: PROC RETURNS [FontAlphabets] = { NameError[frame,name,p]; RETURN [CapsAndLower] }; style.fontAlphabets _ SELECT name FROM capsAndLower => CapsAndLower, capsAndSmallCaps => CapsAndSmallCaps, lowerOnly => LowerOnly, capsOnly => CapsOnly, ENDCASE => Error[]; }; StrikeoutOp: PROC [frame: Frame] = { DoStyleOperation[frame,strikeoutParam] }; strikeoutOps: Ops; strikeoutParam: Param; StrikeoutLoad: LoadProc = { PushName[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[]; }; UnderliningOp: PROC [frame: Frame] = { DoStyleOperation[frame,underliningParam] }; underliningOps: Ops; underliningParam: Param; UnderliningLoad: LoadProc = { PushName[frame, SELECT style.underlining FROM None => none, LettersAndDigits => lettersAndDigits, Visible => visible, All => all, ENDCASE => ERROR] }; 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[]; }; PathTypeOp: PROC [frame: Frame] = { DoStyleOperation[frame,pathTypeParam] }; pathTypeOps: Ops; pathTypeParam: Param; PathTypeLoad: LoadProc = { PushName[frame, SELECT style.pathType FROM Filled => filled, Outlined => outlined, FilledAndOutlined => filledAndOutlined, ENDCASE => ERROR] }; PathTypeSetName: SetNameProc = { Error: PROC RETURNS [PathType] = { NameError[frame,name,p]; RETURN [Filled] }; style.pathType _ SELECT name FROM filled => Filled, outlined => Outlined, filledAndOutlined => FilledAndOutlined, ENDCASE => Error[]; }; colorOps: Ops; ColorOpLoad: LoadProc = { Get: PROC [param: RealParam] = { PushReal[frame,GetReal[style,param]]; }; x: REF ParamRec.color = NARROW[p]; Get[x.hue]; Get[x.saturation]; Get[x.brightness]; }; ColorOpSetReal: StoreProc = { Set: PROC [param: RealParam] = { SetReal[style,param,PopReal[frame]]; }; x: REF ParamRec.color = NARROW[p]; Set[x.brightness]; Set[x.saturation]; Set[x.hue]; }; ColorOpAddReal: AddRealProc = { Add: PROC [param: RealParam] = { SetReal[style,param,GetReal[style,param]+inc]; }; x: REF ParamRec.color = NARROW[p]; Add[x.hue]; Add[x.saturation]; Add[x.brightness]; }; ColorOpPercent: PercentProc = { Set: PROC [param: RealParam] = { val: REAL _ GetReal[style,param]; SetReal[style, param, (percent/100)*val]; }; x: REF ParamRec.color = NARROW[p]; Set[x.hue]; Set[x.saturation]; Set[x.brightness]; }; glueOps: Ops; GlueOpLoad: LoadProc = { Get: PROC [param: RealParam] = { PushReal[frame,GetReal[style,param]] }; x: REF ParamRec.glue = NARROW[p]; Get[x.size]; Get[x.stretch]; Get[x.shrink]; }; GlueOpSetReal: StoreProc = { Set: PROC [param: RealParam] = { SetReal[style,param,PopReal[frame]] }; x: REF ParamRec.glue = NARROW[p]; Set[x.shrink]; Set[x.stretch]; Set[x.size]; }; GlueOpAddReal: AddRealProc = { Add: PROC [param: RealParam] = { SetReal[style,param,GetReal[style,param]+inc] }; x: REF ParamRec.glue = NARROW[p]; Add[x.size]; Add[x.stretch]; Add[x.shrink]; }; GlueOpPercent: PercentProc = { Set: PROC [param: RealParam] = { val: REAL _ GetReal[style,param]; SetReal[style, param, (percent/100)*val]; }; x: REF ParamRec.glue = NARROW[p]; Set[x.size]; Set[x.stretch]; Set[x.shrink]; }; LineLeadingStretchOp: PROC [frame: Frame] = { DoStyleOperation[frame,lineLeadingStretchParam] }; lineLeadingStretchParam: Param; LineLeadingShrinkOp: PROC [frame: Frame] = { DoStyleOperation[frame,lineLeadingShrinkParam] }; lineLeadingShrinkParam: Param; LineLeadingGlueOp: PROC [frame: Frame] = { DoStyleOperation[frame,lineLeadingGlueParam] }; lineLeadingGlueParam: Param; TopLeadingStretchOp: PROC [frame: Frame] = { DoStyleOperation[frame,topLeadingStretchParam] }; topLeadingStretchParam: Param; TopLeadingShrinkOp: PROC [frame: Frame] = { DoStyleOperation[frame,topLeadingShrinkParam] }; topLeadingShrinkParam: Param; TopLeadingGlueOp: PROC [frame: Frame] = { DoStyleOperation[frame,topLeadingGlueParam] }; topLeadingGlueParam: Param; BottomLeadingStretchOp: PROC [frame: Frame] = { DoStyleOperation[frame,bottomLeadingStretchParam] }; bottomLeadingStretchParam: Param; BottomLeadingShrinkOp: PROC [frame: Frame] = { DoStyleOperation[frame,bottomLeadingShrinkParam] }; bottomLeadingShrinkParam: Param; BottomLeadingGlueOp: PROC [frame: Frame] = { DoStyleOperation[frame,bottomLeadingGlueParam] }; bottomLeadingGlueParam: Param; styleFreeVarName: Name; -- for the first REAL valued free variable realFreeVars: LIST OF RealFreeVarRec; RealFreeVarRec: TYPE = RECORD [ key: Name, eval: PROC [node: TextNode.Ref] RETURNS [REAL]]; objFreeVars: LIST OF ObjFreeVarRec; ObjFreeVarRec: TYPE = RECORD [ key: Name, eval: PROC [node: TextNode.Ref] RETURNS [TJaMBasic.Object]]; EvalFreeVars: PUBLIC PROC [style: Ref, node: TextNode.Ref] = { key: Name; SetVal: PROC [value: TJaMBasic.Object] = { FOR x: DataList _ style.dataList, x.next UNTIL x=NIL DO -- see if already has this value xx: REF DataEntry.object = NARROW[x]; IF xx.name=key THEN { ob: NameSymbolTable.Object _ LOOPHOLE[value]; IF xx.object=ob THEN RETURN ELSE EXIT }; ENDLOOP; style.dataList _ NEW[DataEntry _ [style.dataList, object[key,LOOPHOLE[value]]]] }; FOR lst: LIST OF RealFreeVarRec _ realFreeVars, lst.rest UNTIL lst=NIL DO value: Real _ lst.first.eval[node]; key _ lst.first.key; IF key=styleFreeVarName THEN SetReal[style,freeVar,value] -- this one is special ELSE SetVal[[L, real[value]]]; ENDLOOP; FOR lst: LIST OF ObjFreeVarRec _ objFreeVars, lst.rest UNTIL lst=NIL DO key _ lst.first.key; SetVal[lst.first.eval[node]]; ENDLOOP; }; UnregisterStyleFreeVar: PROC [name: Name] = { prev: LIST OF RealFreeVarRec _ realFreeVars; prevObj: LIST OF ObjFreeVarRec _ objFreeVars; key: Name _ StyleParamKey[name]; IF styleFreeVarName=key THEN styleFreeVarName _ NameSymbolTable.nullName; IF realFreeVars=NIL THEN NULL ELSE IF realFreeVars.first.key=key THEN realFreeVars _ realFreeVars.rest ELSE FOR lst: LIST OF RealFreeVarRec _ realFreeVars, lst.rest UNTIL lst=NIL DO IF lst.first.key=key THEN { prev.rest _ lst.rest; EXIT }; prev _ lst; ENDLOOP; IF objFreeVars=NIL THEN NULL ELSE IF objFreeVars.first.key=key THEN objFreeVars _ objFreeVars.rest ELSE FOR lst: LIST OF ObjFreeVarRec _ objFreeVars, lst.rest UNTIL lst=NIL DO IF lst.first.key=key THEN { prevObj.rest _ lst.rest; EXIT }; prevObj _ lst; ENDLOOP; }; GetFreeVarOp: PROC [frame: Frame] = { style: Ref _ StyleForFrame[frame]; key: Name _ PopName[frame]; -- key name for the free var IF key=styleFreeVarName THEN { PushReal[frame, GetReal[style, freeVar]]; RETURN }; PushFreeVar[frame, style, key]; }; GetFreeVarObjOp: PROC [frame: Frame] = { style: Ref _ StyleForFrame[frame]; key: Name _ PopName[frame]; -- key name for the free var PushFreeVar[frame, style, key]; }; PushFreeVar: PROC [frame: Frame, style: Ref, key: Name] = { FOR x: DataList _ style.dataList, x.next UNTIL x=NIL DO xx: REF DataEntry.object = NARROW[x]; IF xx.name = key THEN { PushObject[frame, LOOPHOLE[xx.object]]; RETURN }; ENDLOOP; PushText[frame,"not defined as a free variable?"L]; PushName[frame,key]; StyleError[frame,3]; }; getFreeVarOp, getFreeVarObjOp: Object; RegisterStyleFreeVar: PUBLIC PROC [ name: Name, eval: PROC [node: TextNode.Ref] RETURNS [REAL]] = TRUSTED { key: Name; array: array Object; [key, array] _ SpecialOpArray[name, getFreeVarOp]; TJaMOps.Put[styledict,NameToObject[name],array]; -- store the definition UnregisterStyleFreeVar[name]; IF styleFreeVarName=NameSymbolTable.nullName THEN styleFreeVarName _ key; realFreeVars _ CONS[[key, eval], realFreeVars]; }; RegisterStyleFreeObjVar: PUBLIC PROC [ name: Name, eval: PROC [node: TextNode.Ref] RETURNS [TJaMBasic.Object]] = TRUSTED { key: Name; array: array Object; [key, array] _ SpecialOpArray[name, getFreeVarObjOp]; TJaMOps.Put[styledict,NameToObject[name],array]; -- store the definition UnregisterStyleFreeVar[name]; objFreeVars _ CONS[[key, eval], objFreeVars]; }; DefineSpecial: PUBLIC PROC [name: Name, initialValue: Real] = { DefineSpecialObj[name, [L,real[initialValue]]]; }; DefineSpecialObj: PUBLIC PROC [name: Name, initialValue: TJaMBasic.Object] = TRUSTED { key: Name; array: array Object; [key, array] _ SpecialOpArray[name, specialOp]; TJaMOps.Put[styledict,NameToObject[name],array]; -- store the definition TJaMOps.Put[styledict,NameToObject[key],initialValue]; -- store the initial value }; nonNumeric: PUBLIC ERROR = CODE; GetSpecial: PUBLIC PROC [s: Ref, name: Name] RETURNS [r: Real] = { obj: Object = GetSpecialObj[s, name]; WITH x:obj SELECT FROM real => r _ x.rvalue; integer => r _ x.ivalue; ENDCASE => ERROR nonNumeric; }; GetSpecialI: PUBLIC PROC [s: Ref, name: Name] RETURNS [val: INTEGER] = { obj: Object = GetSpecialObj[s, name]; WITH x:obj SELECT FROM real => val _ R.RoundI[x.rvalue]; integer => val _ x.ivalue; ENDCASE => ERROR nonNumeric; }; GetSpecialObj: PUBLIC PROC [s: Ref, name: Name] RETURNS [obj: Object] = TRUSTED { key: Name _ StyleParamKey[name]; FOR x: DataList _ s.dataList, x.next UNTIL x=NIL DO xx: REF DataEntry.object = NARROW[x]; IF xx.name = key THEN RETURN [LOOPHOLE[xx.object]]; ENDLOOP; RETURN [TJaMOps.Get[styledict,NameToObject[key]]]; }; text: REF TEXT _ NEW[TEXT[64]]; -- to hold the name for StyleParamKey SpecialOpArray: PROC [name: Name, op: Object] RETURNS [key: Name, array: array Object] = TRUSTED { key _ StyleParamKey[name]; array _ TJaMOps.Array[2]; -- create a 2 element array array.tag _ X; -- make it executable TJaMOps.APut[array,0,CVLit[NameToObject[key]]]; TJaMOps.APut[array,1,CVX[op]]; }; StyleParamKey: ENTRY PROC [name: Name] RETURNS [key: Name] = TRUSTED { ENABLE UNWIND => NULL; text.length _ 0; NameSymbolTable.FromName[name, text]; FOR i:NAT DECREASING IN [0..text.length) DO -- make room for prefix text[i+2] _ text[i]; ENDLOOP; text[0] _ text[1] _ '!; -- prefix for keys is double bang text.length _ text.length+2; key _ MakeName[LOOPHOLE[text, REF READONLY TEXT]]; }; StyleParam: PROC [frame: Frame] = TRUSTED { -- called to declare a special style parameter object: Object _ PopObject[frame]; -- the initial value name: Name _ PopName[frame]; -- the parameter name key: Name; array: array Object; [key, array] _ SpecialOpArray[name, specialOp]; TJaMOps.Def[frame,NameToObject[name],array]; -- store the definition TJaMOps.Def[frame,NameToObject[key],object]; -- store the initial value }; GetStyleParam: PUBLIC PROC [s: Ref, name: Name, styleName: Name, kind: OfStyle] RETURNS [obj: Object] = TRUSTED { frame: Frame; key: Name _ StyleParamKey[name]; FOR x: DataList _ s.dataList, x.next UNTIL x=NIL DO xx: REF DataEntry.object = NARROW[x]; IF xx.name = key THEN RETURN [LOOPHOLE[xx.object]]; ENDLOOP; frame _ GetFrame[s, styleName, kind]; PushName[frame,key]; TJaMOps.Execute[frame,load]; -- get the initial value obj _ LOOPHOLE[PopObject[frame]]; FreeFrame[frame, styleName, kind]; RETURN [obj]; }; SpecialOp: PROC [frame: Frame] = { -- like DoStyleOperation, but for special parameters nameflag: BOOL; name: Name; var: Name; style: Ref _ StyleForFrame[frame]; Error: PROC = { PushName[frame,name]; PushText[frame,"has illegal qualifier:"L]; PushName[frame,var]; StyleError[frame,3]; }; FindObject: PROC RETURNS [NameSymbolTable.Object] = TRUSTED { FOR x: DataList _ style.dataList, x.next UNTIL x=NIL DO xx: REF DataEntry.object = NARROW[x]; IF xx.name = var THEN RETURN [xx.object]; ENDLOOP; PushName[frame,var]; TJaMOps.Execute[frame,load]; -- get the initial value RETURN [LOOPHOLE[PopObject[frame]]]; }; Store: PROC [ob: NameSymbolTable.Object] = { style.dataList _ NEW[DataEntry _ [style.dataList, object[var,ob]]]; }; Load: PROC = { PushObject[frame,LOOPHOLE[FindObject[]]] }; AddReal: PROC [inc: REAL] = { value: REAL; Load; value _ PopReal[frame]; SetReal[value+inc]; }; SetReal: PROC [x: REAL] = { PushReal[frame,x]; Store[LOOPHOLE[PopObject[frame]]]; }; SetName: PROC [n: Name] = { PushName[frame,n]; Store[LOOPHOLE[PopObject[frame]]]; }; Percent: PROC [percent: REAL] = { value: REAL; Load; value _ PopReal[frame]; SetReal[(percent/100)*value]; }; var _ PopName[frame]; -- the name of the special parameter [name, nameflag] _ TryToPopName[frame]; IF ~nameflag THEN Store[LOOPHOLE[PopObject[frame]]] ELSE SELECT name FROM the => Load[]; bigger => BEGIN [name, nameflag] _ TryToPopName[frame]; IF ~nameflag THEN AddReal[PopReal[frame]] ELSE IF name=percent THEN Percent[100+PopReal[frame]] ELSE { Error; RETURN }; END; smaller => BEGIN [name, nameflag] _ TryToPopName[frame]; IF ~nameflag THEN AddReal[-PopReal[frame]] ELSE IF name=percent THEN Percent[100-PopReal[frame]] ELSE { Error; RETURN }; END; percent => Percent[PopReal[frame]]; ENDCASE => SetName[name]; }; DefineSpecialOp: PROC [ frame: Frame, text: REF READONLY TEXT, proc: PROC [Frame]] RETURNS [op: Object] = TRUSTED { TJaMOps.RegisterExplicit[frame,LOOPHOLE[text, LONG STRING],proc]; PushName[frame,MakeName[text]]; TJaMOps.Execute[frame,load]; op _ PopObject[frame]; }; specialOp: Object; DefineColorOp: PROC [ frame: Frame, text: REF READONLY TEXT, proc: PROC [Frame], hue, saturation, brightness: RealParam] RETURNS [Param] = { name: Name = StyleCommand[frame,text,proc]; RETURN [NEW [color ParamRec _ [colorOps, name, color[hue, saturation, brightness]]]]; }; DefineGlueOp: PROC [ frame: Frame, text: REF READONLY TEXT, proc: PROC [Frame], size, stretch, shrink: RealParam] RETURNS [Param] = { name: Name = StyleCommand[frame,text,proc]; RETURN [NEW [glue ParamRec _ [glueOps, name, glue[size, stretch, shrink]]]]; }; DefineRealOp: PROC [ frame: Frame, text: REF READONLY TEXT, proc: PROC [Frame], param: RealParam] RETURNS [Param] = { name: Name = StyleCommand[frame,text,proc]; RETURN [NEW [real ParamRec _ [realOps, name, real[param]]]]; }; nameOps: Ops; DefineNameOp: PROC [ frame: Frame, text: REF READONLY TEXT, proc: PROC [Frame], param: NameParam] RETURNS [Param] = { name: Name = StyleCommand[frame,text,proc]; RETURN [NEW [name ParamRec _ [nameOps, name, name[param]]]]; }; realOps: Ops; fontFaceOps: Ops; lineFormattingOps: Ops; the, smaller, bigger, percent, regular, bold, italic, bolditalic, plusbold, plusitalic, minusbold, minusitalic, capsAndLower, capsAndSmallCaps, lowerOnly, capsOnly, none, lettersAndDigits, visible, all, flush, centered, flushLeft, flushRight, justified, filled, outlined, filledAndOutlined, fixed, relative, looks, breakIfPast, spaceIfPast, blank, leaders, rule, rules, aligned, congruent: PUBLIC Name; startCount: CARDINAL _ 0; StartImpl2: PUBLIC PROC = TRUSTED { -- exported to NodeStyleStart frame: Frame; PointsPerInch: REAL = 1.0/0.0138370; startCount _ startCount+1; frame _ TJaMOps.defaultFrame; defaultStyle.name[style] _ defaultStyleName; defaultStyle.name[fontFamily] _ MakeName["Helvetica"]; SetReal[defaultStyle,fontSize,10]; SetReal[defaultStyle,leading,12]; SetReal[defaultStyle,tabStops,4]; SetReal[defaultStyle,pageWidth,8.5*PointsPerInch]; SetReal[defaultStyle,pageLength,11*PointsPerInch]; SetReal[defaultStyle,leftMargin,1*PointsPerInch]; SetReal[defaultStyle,rightMargin,1*PointsPerInch]; SetReal[defaultStyle,topMargin,1*PointsPerInch]; SetReal[defaultStyle,bottomMargin,1*PointsPerInch]; SetReal[defaultStyle,lineLength,6.5*PointsPerInch]; specialOp _ DefineSpecialOp[frame,"SpecialOp",SpecialOp]; getFreeVarOp _ DefineSpecialOp[frame,"GetFreeVarOp",GetFreeVarOp]; getFreeVarObjOp _ DefineSpecialOp[frame,"GetFreeVarObjOp",GetFreeVarObjOp]; TJaMOps.RegisterExplicit[frame,"StyleParam",StyleParam]; TJaMOps.RegisterExplicit[frame,"isComment",IsComment]; TJaMOps.RegisterExplicit[frame,"isPrint",IsPrint]; TJaMOps.RegisterExplicit[frame,"nestingLevel",NestingLevel]; the _ StyleLiteral[frame,"the"]; smaller _ StyleLiteral[frame,"smaller"]; bigger _ StyleLiteral[frame,"bigger"]; percent _ StyleLiteral[frame,"percent"]; regular _ StyleLiteral[frame,"regular"]; bold _ StyleLiteral[frame,"bold"]; italic _ StyleLiteral[frame,"italic"]; bolditalic _ StyleLiteral[frame,"bold+italic"]; plusbold _ StyleLiteral[frame,"+bold"]; plusitalic _ StyleLiteral[frame,"+italic"]; minusbold _ StyleLiteral[frame,"-bold"]; minusitalic _ StyleLiteral[frame,"-italic"]; capsAndLower _ StyleLiteral[frame,"caps+lowercase"]; capsAndSmallCaps _ StyleLiteral[frame,"caps+smallcaps"]; lowerOnly _ StyleLiteral[frame,"lowercase"]; capsOnly _ StyleLiteral[frame,"caps"]; all _ StyleLiteral[frame,"all"]; visible _ StyleLiteral[frame,"visible"]; lettersAndDigits _ StyleLiteral[frame,"letters+digits"]; none _ StyleLiteral[frame,"none"]; justified _ StyleLiteral[frame,"justified"]; flush _ StyleLiteral[frame,"flush"]; flushLeft _ StyleLiteral[frame,"flushLeft"]; flushRight _ StyleLiteral[frame,"flushRight"]; filled _ StyleLiteral[frame,"filled"]; outlined _ StyleLiteral[frame,"outlined"]; filled _ StyleLiteral[frame,"filled"]; filledAndOutlined _ StyleLiteral[frame,"filled+outlined"]; centered _ StyleLiteral[frame,"centered"]; fixed _ StyleLiteral[frame,"fixed"]; relative _ StyleLiteral[frame,"relative"]; looks _ StyleLiteral[frame,"looks"]; breakIfPast _ StyleLiteral[frame,"breakIfPast"]; spaceIfPast _ StyleLiteral[frame,"spaceIfPast"]; blank _ StyleLiteral[frame,"blank"]; leaders _ StyleLiteral[frame,"leaders"]; rule _ StyleLiteral[frame,"rule"]; rules _ StyleLiteral[frame,"rules"]; aligned _ StyleLiteral[frame,"aligned"]; congruent _ StyleLiteral[frame,"congruent"]; fontFaceOps _ NEW [OpsRec _ [FontFaceLoad, StoreError, AddRealError, PercentError, FontFaceSetName]]; fontFaceParam _ NEW[misc ParamRec _ [fontFaceOps, StyleCommand[frame,"face",FontFaceOp], misc[]]]; fontAlphabetsOps _ NEW [OpsRec _ [FontAlphabetsLoad, StoreError, AddRealError, PercentError, FontAlphabetsSetName]]; fontAlphabetsParam _ NEW[misc ParamRec _ [fontAlphabetsOps, StyleCommand[frame,"alphabets",FontAlphabetsOp], misc[]]]; underliningOps _ NEW [OpsRec _ [UnderliningLoad, StoreError, AddRealError, PercentError, UnderliningSetName]]; underliningParam _ NEW [misc ParamRec _ [underliningOps, StyleCommand[frame,"underlining",UnderliningOp], misc[]]]; strikeoutOps _ NEW [OpsRec _ [StrikeoutLoad, StoreError, AddRealError, PercentError, StrikeoutSetName]]; strikeoutParam _ NEW [misc ParamRec _ [strikeoutOps, StyleCommand[frame,"strikeout",StrikeoutOp], misc[]]]; lineFormattingOps _ NEW [OpsRec _ [LineFormattingLoad, StoreError, AddRealError, PercentError, LineFormattingSetName]]; lineFormattingParam _ NEW [misc ParamRec _ [lineFormattingOps, StyleCommand[frame,"lineFormatting",LineFormattingOp], misc[]]]; pathTypeOps _ NEW [OpsRec _ [PathTypeLoad, StoreError, AddRealError, PercentError, PathTypeSetName]]; pathTypeParam _ NEW [misc ParamRec _ [pathTypeOps, StyleCommand[frame,"pathType",PathTypeOp], misc[]]]; nameOps _ NEW [OpsRec _ [LoadNameParam, StoreError, AddRealError, PercentError, SetNameParam]]; styleParam _ DefineNameOp[frame, "style", StyleNameOp, style]; fontFamilyParam _ DefineNameOp[frame, "family", FontFamilyOp, fontFamily]; realOps _ NEW [OpsRec _ [RealOpLoad, RealOpSetReal, RealOpAddReal, RealOpPercent, SetNameError]]; glueOps _ NEW [OpsRec _ [GlueOpLoad, GlueOpSetReal, GlueOpAddReal, GlueOpPercent, SetNameError]]; colorOps _ NEW [OpsRec _ [ColorOpLoad, ColorOpSetReal, ColorOpAddReal, ColorOpPercent, SetNameError]]; fontSizeParam _ DefineRealOp[frame, "size", FontSizeOp, fontSize]; leftIndentParam _ DefineRealOp[frame, "leftIndent", LeftIndentOp, leftIndent]; rightIndentParam _ DefineRealOp[frame, "rightIndent", RightIndentOp, rightIndent]; firstIndentParam _ DefineRealOp[frame, "firstIndent", FirstIndentOp, firstIndent]; restIndentParam _ DefineRealOp[frame, "restIndent", RestIndentOp, restIndent]; topIndentParam _ DefineRealOp[frame, "topIndent", TopIndentOp, topIndent]; bottomIndentParam _ DefineRealOp[frame, "bottomIndent", BottomIndentOp, bottomIndent]; lineLeadingSizeParam _ DefineRealOp[frame, "leading", LineLeadingSizeOp, leading]; lineLeadingStretchParam _ DefineRealOp[frame, "leadingStretch", LineLeadingStretchOp, leadingStretch]; lineLeadingShrinkParam _ DefineRealOp[frame, "leadingShrink", LineLeadingShrinkOp, leadingShrink]; lineLeadingGlueParam _ DefineGlueOp[frame, "leadingGlue", LineLeadingGlueOp, leading, leadingStretch, leadingShrink]; topLeadingSizeParam _ DefineRealOp[frame, "topLeading", TopLeadingSizeOp, topLeading]; topLeadingStretchParam _ DefineRealOp[frame, "topLeadingStretch", TopLeadingStretchOp, topLeadingStretch]; topLeadingShrinkParam _ DefineRealOp[frame, "topLeadingShrink", TopLeadingShrinkOp, topLeadingShrink]; topLeadingGlueParam _ DefineGlueOp[frame, "topLeadingGlue", TopLeadingGlueOp, topLeading, topLeadingStretch, topLeadingShrink]; bottomLeadingSizeParam _ DefineRealOp[frame, "bottomLeading", BottomLeadingSizeOp, bottomLeading]; bottomLeadingStretchParam _ DefineRealOp[frame, "bottomLeadingStretch", BottomLeadingStretchOp, bottomLeadingStretch]; bottomLeadingShrinkParam _ DefineRealOp[frame, "bottomLeadingShrink", BottomLeadingShrinkOp, bottomLeadingShrink]; bottomLeadingGlueParam _ DefineGlueOp[frame, "bottomLeadingGlue", BottomLeadingGlueOp, bottomLeading, bottomLeadingStretch, bottomLeadingShrink]; vshiftParam _ DefineRealOp[frame, "vShift", VShiftOp, vshift]; tabStopsParam _ DefineRealOp[frame, "tabStops", TabStopsOp, tabStops]; minLineGapParam _ DefineRealOp[frame, "minLineGap", MinLineGapOp, minLineGap]; lineWeightParam _ DefineRealOp[frame, "lineWeight", LineWeightOp, lineWeight]; pageWidthParam _ DefineRealOp[frame, "pageWidth", PageWidthOp, pageWidth]; pageLengthParam _ DefineRealOp[frame, "pageLength", PageLengthOp, pageLength]; leftMarginParam _ DefineRealOp[frame, "leftMargin", LeftMarginOp, leftMargin]; rightMarginParam _ DefineRealOp[frame, "rightMargin", RightMarginOp, rightMargin]; topMarginParam _ DefineRealOp[frame, "topMargin", TopMarginOp, topMargin]; bottomMarginParam _ DefineRealOp[frame, "bottomMargin", BottomMarginOp, bottomMargin]; headerMarginParam _ DefineRealOp[frame, "headerMargin", HeaderMarginOp, headerMargin]; footerMarginParam _ DefineRealOp[frame, "footerMargin", FooterMarginOp, footerMargin]; bindingMarginParam _ DefineRealOp[frame, "bindingMargin", BindingMarginOp, bindingMargin]; lineLengthParam _ DefineRealOp[frame, "lineLength", LineLengthOp, lineLength]; columnParam _ DefineRealOp[frame, "column", ColumnOp, column]; textRotationParam _ DefineRealOp[frame, "textRotation", TextRotationOp, textRotation]; areaHueParam _ DefineRealOp[frame, "areaHue", AreaHueOp, areaHue]; areaSaturationParam _ DefineRealOp[frame, "areaSaturation", AreaSaturationOp, areaSaturation]; areaBrightnessParam _ DefineRealOp[frame, "areaBrightness", AreaBrightnessOp, areaBrightness]; areaColorParam _ DefineColorOp[frame, "areaColor", AreaColorOp, areaHue, areaSaturation, areaBrightness]; outlineHueParam _ DefineRealOp[frame, "outlineHue", OutlineHueOp, outlineHue]; outlineSaturationParam _ DefineRealOp[frame, "outlineSaturation", OutlineSaturationOp, outlineSaturation]; outlineBrightnessParam _ DefineRealOp[frame, "outlineBrightness", OutlineBrightnessOp, outlineBrightness]; outlineColorParam _ DefineColorOp[frame, "outlineColor", OutlineColorOp, outlineHue, outlineSaturation, outlineBrightness]; textHueParam _ DefineRealOp[frame, "textHue", TextHueOp, textHue]; textSaturationParam _ DefineRealOp[frame, "textSaturation", TextSaturationOp, textSaturation]; textBrightnessParam _ DefineRealOp[frame, "textBrightness", TextBrightnessOp, textBrightness]; textColorParam _ DefineColorOp[frame, "textColor", TextColorOp, textHue, textSaturation, textBrightness]; pageBreakPenaltyParam _ DefineRealOp[frame, "pageBreakPenalty", PageBreakPenaltyOp, pageBreakPenalty]; pageBreakPenalty2Param _ DefineRealOp[frame, "pageBreakAfterFirstLinePenalty", PageBreakPenalty2Op, pageBreakAfterFirstLinePenalty]; pageBreakPenalty3Param _ DefineRealOp[frame, "pageBreakAfterLastLinePenalty", PageBreakPenalty3Op, pageBreakAfterLastLinePenalty]; pageBreakPenalty4Param _ DefineRealOp[frame, "pageBreakBeforeFirstLinePenalty", PageBreakPenalty4Op, pageBreakBeforeFirstLinePenalty]; pageBreakPenalty5Param _ DefineRealOp[frame, "pageBreakBeforeLastLinePenalty", PageBreakPenalty5Op, pageBreakBeforeLastLinePenalty]; TJaMOps.End[frame]; -- replace sysdict by userdict TJaMOps.Begin[frame,userdict]; }; END. ΔNodeStyle2Impl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Written by Bill Paxton, January 1981 Last changed by Bill Paxton, December 21, 1982 3:12 pm Last Edited by: Maxwell, January 6, 1983 10:18 am Russ Atkinson (RRA) March 7, 1985 3:35:19 am PST Plass, March 1, 1985 4:32:29 pm PST Doug Wyatt, March 5, 1985 10:55:36 am PST Implements TJaM commands for style rules and commands to load styles. **** Text Rotation **** **** Line Weight **** **** Page Width **** **** Page Length **** **** Left Margin **** **** Right Margin **** **** Top Margin **** **** Bottom Margin **** **** Header Margin **** **** Footer Margin **** **** Binding Margin **** **** Line Length **** **** Column **** **** Area Color **** **** Outline Color **** **** Text Color **** **** Penalty Parameters **** Font Alphabets **** **** Strikeout **** **** Underlining **** **** Path Type **** **** Color Parameters **** **** Glue Parameters **** **** LineLeading **** **** Top Leading **** **** Bottom Leading **** **** Free Variables **** **** Special Parameters **** Special Parameters store the object as new value Initialization initialize the params Note: StartImpl2 is called explicitly by NodeStyleImpl. - DKW Κ·˜codešœ™Kšœ Οmœ1™Kšœ ˜ š œžœ˜*š žœ&žœžœžœ‘ ˜XKšœžœžœ˜%šžœ žœ˜Kšœžœ˜-Kš žœžœžœžœžœ˜(—Kšžœ˜—Kšœžœ)žœ ˜R—š žœžœžœ)žœžœž˜IK˜#Kšœ˜Kšžœžœ‘˜PKšžœ žœ˜Kšžœ˜—š žœžœžœ'žœžœž˜GKšœ˜Kšœ˜Kšžœ˜—˜K˜——š œžœ˜-Kšœžœžœ˜,Kšœ žœžœ˜-K˜ Kšžœžœ-˜IKšžœžœžœž˜Kšžœžœžœ!˜Hš žœžœžœžœ)žœžœž˜NKšžœžœžœ˜9K˜ Kšžœ˜—Kšžœ žœžœž˜Kšžœžœžœ˜Eš žœžœžœžœ'žœžœž˜LKšžœžœžœ˜K˜@K˜—šœžœ%˜6K˜.—šœžœ˜2K˜4K˜—šœ žœ&˜3K˜+—K˜>K˜JK˜šœ žœ ˜K˜I—šœ žœ ˜K˜I—šœ žœ ˜K˜MK˜—K˜BK˜NK˜RK˜RK˜NK˜J˜K˜BK˜—˜K˜;—˜K˜L—˜K˜I—˜9K˜