IPApplyImpl.mesa
Copyright © 1984 Xerox Corporation. All rights reserved.
Doug Wyatt, November 14, 1984 8:56:15 am PST
DIRECTORY
IPBase -- USING everything --,
IPImage -- USING everything --,
IPInterpreter USING [Error, MasterError, Op, State];
IPApplyImpl: CEDAR PROGRAM
IMPORTS IPBase, IPImage, IPInterpreter
EXPORTS IPInterpreter
~ BEGIN OPEN IPInterpreter;
ApplyArray: TYPE ~ ARRAY Op OF Operation;
Operation: TYPE ~ PROC[State] ← -- can't be defaulted
apply: REF ApplyArray ~ NEW[ApplyArray ← [
nil: ApplyBUG,
get: IPBase.ApplyGET,
makeveclu: IPBase.ApplyMAKEVECLU,
makevec: IPBase.ApplyMAKEVEC,
shape: IPBase.ApplySHAPE,
openvec: IPBase.ApplyOPENVEC,
getprop: IPBase.ApplyGETPROP,
getp: IPBase.ApplyGETP,
mergeprop: IPBase.ApplyMERGEPROP,
frame: IPBase.ApplyFRAME,
fget: IPBase.ApplyFGET,
fset: IPBase.ApplyFSET,
poolop: IPBase.ApplyPOOLOP,
pool: IPBase.ApplyPOOL,
pget: IPBase.ApplyPGET,
pset: IPBase.ApplyPSET,
env: IPBase.ApplyENV,
makepool: IPBase.ApplyMAKEPOOL,
nopool: IPBase.ApplyNOPOOL,
makeco: IPBase.ApplyMAKECO,
makesimpleco: IPBase.ApplyMAKESIMPLECO,
do: IPBase.ApplyDO,
dosave: IPBase.ApplyDOSAVE,
dosaveall: IPBase.ApplyDOSAVEALL,
dobody: IPBase.ApplyDOBODY,
dosavebody: IPBase.ApplyDOSAVEBODY,
dosaveallbody: IPBase.ApplyDOSAVEALLBODY,
dosavesimplebody: IPBase.ApplyDOSAVESIMPLEBODY,
makecompiledimage: IPBase.ApplyMAKECOMPILEDIMAGE,
pop: IPBase.ApplyPOP,
copy: IPBase.ApplyCOPY,
dup: IPBase.ApplyDUP,
roll: IPBase.ApplyROLL,
exch: IPBase.ApplyEXCH,
mark: IPBase.ApplyMARK,
unmark: IPBase.ApplyUNMARK,
unmark0: IPBase.ApplyUNMARK0,
count: IPBase.ApplyCOUNT,
nop: IPBase.ApplyNOP,
error: IPBase.ApplyERROR,
if: IPBase.ApplyIF,
ifelse: IPBase.ApplyIFELSE,
ifcopy: IPBase.ApplyIFCOPY,
loop: IPBase.ApplyLOOP,
eq: IPBase.ApplyEQ,
eqname: IPBase.ApplyEQNAME,
gt: IPBase.ApplyGT,
ge: IPBase.ApplyGE,
and: IPBase.ApplyAND,
or: IPBase.ApplyOR,
not: IPBase.ApplyNOT,
type: IPBase.ApplyTYPE,
add: IPBase.ApplyADD,
sub: IPBase.ApplySUB,
neg: IPBase.ApplyNEG,
abs: IPBase.ApplyABS,
floor: IPBase.ApplyFLOOR,
ceiling: IPBase.ApplyCEILING,
trunc: IPBase.ApplyTRUNC,
round: IPBase.ApplyROUND,
mul: IPBase.ApplyMUL,
div: IPBase.ApplyDIV,
mod: IPBase.ApplyMOD,
rem: IPBase.ApplyREM,
max: IPBase.ApplyMAX,
min: IPBase.ApplyMIN,
sqrt: IPBase.ApplySQRT,
exp: IPBase.ApplyEXP,
log: IPBase.ApplyLOG,
sin: IPBase.ApplySIN,
cos: IPBase.ApplyCOS,
atan: IPBase.ApplyATAN,
iget: IPImage.ApplyIGET,
iset: IPImage.ApplyISET,
dround: IPImage.ApplyDROUND,
maket: IPImage.ApplyMAKET,
opent: IPImage.ApplyOPENT,
translate: IPImage.ApplyTRANSLATE,
rotate: IPImage.ApplyROTATE,
scale: IPImage.ApplySCALE,
scale2: IPImage.ApplySCALE2,
concat: IPImage.ApplyCONCAT,
invert: IPImage.ApplyINVERT,
transform: IPImage.ApplyTRANSFORM,
transformvec: IPImage.ApplyTRANSFORMVEC,
roundxy: IPImage.ApplyROUNDXY,
roundxyvec: IPImage.ApplyROUNDXYVEC,
concatt: IPImage.ApplyCONCATT,
move: IPImage.ApplyMOVE,
trans: IPImage.ApplyTRANS,
show: IPImage.ApplySHOW,
showandxrel: IPImage.ApplySHOWANDXREL,
setxy: IPImage.ApplySETXY,
setxyrel: IPImage.ApplySETXYREL,
setxrel: IPImage.ApplySETXREL,
setyrel: IPImage.ApplySETYREL,
getcp: IPImage.ApplyGETCP,
getcprounded: IPImage.ApplyGETCPROUNDED,
makepixelarray: IPImage.ApplyMAKEPIXELARRAY,
extractpixelarray: IPImage.ApplyEXTRACTPIXELARRAY,
joinpixelarrays: IPImage.ApplyJOINPIXELARRAYS,
finddecompressor: IPImage.ApplyFINDDECOMPRESSOR,
makegray: IPImage.ApplyMAKEGRAY,
findcolor: IPImage.ApplyFINDCOLOR,
findcoloroperator: IPImage.ApplyFINDCOLOROPERATOR,
findcolormodeloperator: IPImage.ApplyFINDCOLORMODELOPERATOR,
makesampledcolor: IPImage.ApplyMAKESAMPLEDCOLOR,
makesampledblack: IPImage.ApplyMAKESAMPLEDBLACK,
setgray: IPImage.ApplySETGRAY,
moveto: IPImage.ApplyMOVETO,
lineto: IPImage.ApplyLINETO,
linetox: IPImage.ApplyLINETOX,
linetoy: IPImage.ApplyLINETOY,
curveto: IPImage.ApplyCURVETO,
conicto: IPImage.ApplyCONICTO,
arcto: IPImage.ApplyARCTO,
makeoutline: IPImage.ApplyMAKEOUTLINE,
maskfill: IPImage.ApplyMASKFILL,
maskfillparity: IPImage.ApplyMASKFILLPARITY,
maskstroke: IPImage.ApplyMASKSTROKE,
maskstrokeclosed: IPImage.ApplyMASKSTROKECLOSED,
maskvector: IPImage.ApplyMASKVECTOR,
maskrectangle: IPImage.ApplyMASKRECTANGLE,
startunderline: IPImage.ApplySTARTUNDERLINE,
maskunderline: IPImage.ApplyMASKUNDERLINE,
masktrapezoidx: IPImage.ApplyMASKTRAPEZOIDX,
masktrapezoidy: IPImage.ApplyMASKTRAPEZOIDY,
maskpixel: IPImage.ApplyMASKPIXEL,
clipoutline: IPImage.ApplyCLIPOUTLINE,
cliprectangle: IPImage.ApplyCLIPRECTANGLE,
excludeoutline: IPImage.ApplyEXCLUDEOUTLINE,
excluderectangle: IPImage.ApplyEXCLUDERECTANGLE,
findfont: IPImage.ApplyFINDFONT,
findfontvec: IPImage.ApplyFINDFONTVEC,
modifyfont: IPImage.ApplyMODIFYFONT,
setfont: IPImage.ApplySETFONT,
correctmask: IPImage.ApplyCORRECTMASK,
correctspace: IPImage.ApplyCORRECTSPACE,
correct: IPImage.ApplyCORRECT,
setcorrectmeasure: IPImage.ApplySETCORRECTMEASURE,
setcorrecttolerance: IPImage.ApplySETCORRECTTOLERANCE,
space: IPImage.ApplySPACE,
beginBody: ApplyBUG,
endBody: ApplyBUG,
beginBlock: ApplyBUG,
endBlock: ApplyBUG,
pageInstructions: ApplyBUG,
noPages: ApplyBUG,
metricMaster: ApplyBUG,
environmentMaster: ApplyBUG
]];
ApplyBUG: PROC[self: State] ~ {
MasterError[$bug, "Can't Apply a non-Primitive Op."];
ERROR Error;
};
Apply: PUBLIC PROC[self: State, op: Op] ~ {
apply[op][self];
IF self.stats#NIL THEN self.stats[op] ← self.stats[op]+1;
};
END.