<> <> <> <<>> <> <<>> DIRECTORY IO USING [STREAM], IPXerox USING [EncodingValue, SequenceType], Rope USING [ROPE]; IPMaster: CEDAR DEFINITIONS ~ BEGIN <<>> BYTE: TYPE ~ [0..377B]; CARD: TYPE ~ LONG CARDINAL; ROPE: TYPE ~ Rope.ROPE; STREAM: TYPE ~ IO.STREAM; Op: TYPE ~ {nil, <<-- Base language primitives>> get, makeveclu, makevec, shape, openvec, getprop, getp, mergeprop, -- 2.4.3 frame, fget, fset, poolop, pool, pget, pset, env, -- 2.4.4 makepool, nopool, makeco, makesimpleco, do, dosave, dosaveall, -- 2.4.5 dobody, dosavebody, dosaveallbody, dosavesimplebody, makecompiledimage, pop, copy, dup, roll, exch, mark, unmark, unmark0, count, nop, error, -- 2.4.6 if, ifelse, ifcopy, loop, -- 2.4.7 eq, eqname, gt, ge, and, or, not, type, -- 2.4.8 add, sub, neg, abs, floor, ceiling, trunc, round, mul, div, mod, rem, -- 2.4.9 max, min, sqrt, exp, log, sin, cos, atan, <<-- Imaging primitives>> iget, iset, -- 4.2 dround, -- 4.3.5 maket, opent, translate, rotate, scale, scale2, concat, invert, -- 4.4.3 transform, transformvec, roundxy, roundxyvec, -- 4.4.4 concatt, move, trans, -- 4.4.5 show, showandxrel, -- 4.4.6 setxy, setxyrel, setxrel, setyrel, getcp, getcprounded, -- 4.5 makepixelarray, extractpixelarray, joinpixelarrays, -- 4.6 finddecompressor, -- 4.6.1 makegray, findcolor, findcoloroperator, findcolormodeloperator, -- 4.7.1 makesampledcolor, makesampledblack, -- 4.7.2 setgray, -- 4.7.3 moveto, lineto, linetox, linetoy, curveto, conicto, arcto, makeoutline, -- 4.8.1 maskfill, maskfillparity, maskstroke, maskstrokeclosed, maskvector, maskrectangle, -- 4.8.2 startunderline, maskunderline, masktrapezoidx, masktrapezoidy, maskpixel, -- 4.8.3 clipoutline, excludeoutline, cliprectangle, excluderectangle, -- 4.8.4 findfont, findfontvec, -- 4.9.1 modifyfont, setfont, -- 4.9.2 correctmask, correctspace, correct, -- 4.10 setcorrectmeasure, setcorrecttolerance, space, -- 4.10.2 <<-- Symbols>> beginBody, endBody, beginBlock, endBlock, pageInstructions, noPages, metricMaster, environmentMaster }; Primitive: TYPE ~ Op[nil..space]; TypeCode: TYPE ~ MACHINE DEPENDENT {null(0), number(1), identifier(2), vector(3), operator(4), -- Base types transformation(5), pixelArray(6), color(7), trajectory(8), outline(9), -- Image types other(31) }; ImagerVariable: TYPE ~ MACHINE DEPENDENT { DCScpx(0), DCScpy(1), correctMX(2), correctMY(3), T(4), priorityImportant(5), mediumXSize(6), mediumYSize(7), fieldXMin(8), fieldYMin(9), fieldXMax(10), fieldYMax(11), showVec(12), color(13), noImage(14), strokeWidth(15), strokeStyle(16), underlineStart(17), amplifySpace(18), correctPass(19), correctShrink(20), correctTX(21), correctTY(22), strokeDashes(23) }; StrokeStyle: TYPE ~ MACHINE DEPENDENT { square(0), butt(1), round(2), -- standard, all with mitered joints (7) -- room for expansion (round joints, probably) }; TokenType: TYPE ~ {nil, op, number, integer, rational, string, identifier, comment, insertFile, largeVector, packedPixelVector, compressedPixelVector, adaptivePixelVector }; Token: TYPE ~ RECORD[ index: INT _ 0, -- stream index of token's first byte type: TokenType _ nil, -- type of token op: Op _ nil, -- Op value if type=op, nil otherwise number: INTEGER _ 0, -- number value if type=number, 0 otherwise length: INT _ 0 -- number of data bytes following token ]; Body: TYPE ~ REF BodyRep; BodyRep: TYPE ~ RECORD[index, length: INT]; Node: TYPE ~ REF NodeRep; NodeRep: TYPE ~ RECORD[ index, length: INT, pageInstructions: Body, -- may be NIL content: SELECT tag: * FROM body => [body: Body], block => [block: Block], ENDCASE ]; Block: TYPE ~ REF BlockRep; BlockRep: TYPE ~ RECORD[ index, length: INT, noPages: BOOL, preamble: Node, nodes: SEQUENCE size: NAT OF Node ]; Skeleton: TYPE ~ REF SkeletonRep; SkeletonRep: TYPE ~ RECORD[ instructions: Body, -- may be NIL topBlock: Block ]; Error: ERROR[code: ErrorCode, explanation: ROPE]; ErrorCode: TYPE ~ { nil, bug, unimplemented, invalidHeader, invalidSkeleton, invalidToken, invalidRational, invalidIdentifier }; OpFromEncodingValue: PROC[IPXerox.EncodingValue] RETURNS[Op]; <> <<>> EncodingValueFromOp: PROC[Op] RETURNS[IPXerox.EncodingValue]; <> <<>> TokenTypeFromSequenceType: PROC[IPXerox.SequenceType] RETURNS[TokenType]; <> <<>> SequenceTypeFromTokenType: PROC[TokenType] RETURNS[IPXerox.SequenceType]; <> <<>> OpFromRope: PROC[ROPE] RETURNS[Op]; <> <<>> RopeFromOp: PROC[Op] RETURNS[ROPE]; <> <<>> RopeFromImagerVariable: PROC[ImagerVariable] RETURNS[ROPE]; <> GetHeader: PROC[stream: STREAM, prefix: ROPE _ NIL] RETURNS[suffix: ROPE]; <> <> <> <> <> <<>> GetSkeleton: PROC[stream: STREAM] RETURNS[Skeleton]; <> <> <<>> SkipToEndOfBody: PROC[stream: STREAM]; <> <> <<>> SetIndex: PROC[stream: STREAM, index: INT]; <> <<>> CopyBytes: PROC[to: STREAM, from: STREAM, count: INT] RETURNS[copied: INT]; <> <> <<>> CopySegment: PROC[to: STREAM, from: STREAM, start, length: INT]; <> <> <<>> GetToken: PROC[stream: STREAM, flushComments: BOOL _ TRUE] RETURNS[token: Token]; <> <> <> <<>> SkipBytes: PROC[stream: STREAM, length: INT]; <> <<>> GetInteger: PROC[stream: STREAM, length: INT] RETURNS[REAL]; <> <<>> GetRational: PROC[stream: STREAM, length: INT] RETURNS[REAL]; <> <> <> <<>> GetRope: PROC[stream: STREAM, length: INT] RETURNS[ROPE]; <> <<>> GetText: PROC[stream: STREAM, length: NAT, scratch: REF TEXT _ NIL] RETURNS[text: REF TEXT]; <> <> <> <<>> GetByte: PROC[stream: STREAM] RETURNS[BYTE]; <> <<>> GetUnsigned: PROC[stream: STREAM, length: [0..4]] RETURNS[CARD]; <> <<>> GetSigned: PROC[stream: STREAM, length: [0..4]] RETURNS[INT]; <> <> <<>> PutOp: PROC[stream: STREAM, op: Op]; <> <<>> PutInt: PROC[stream: STREAM, n: INT]; <> <<>> PutRational: PROC[stream: STREAM, n, d: INT]; <> <> PutReal: PROC[stream: STREAM, val: REAL]; <> PutIdentifier: PROC[stream: STREAM, rope: ROPE]; <> <> PutString: PROC[stream: STREAM, rope: ROPE]; <> <> <> PutComment: PROC[stream: STREAM, rope: ROPE]; <> PutInsertFile: PROC[stream: STREAM, rope: ROPE]; <> <<>> PutName: PROC[stream: STREAM, name: ROPE]; <> <; "foo" produces < foo 1 MAKEVEC >.>> <> <> PutDescriptor: PROC[stream: STREAM, type: TokenType, length: INT]; <> <<>> PutByte: PROC[stream: STREAM, byte: BYTE]; <> <<>> PutUnsigned: PROC[stream: STREAM, length: [0..4], val: CARD]; <> <<>> PutSigned: PROC[stream: STREAM, length: [0..4], val: INT]; <> <<>> END.