<> <> <> <<>> <> <<>> DIRECTORY IO USING [STREAM], Rope USING [ROPE]; IPMaster: CEDAR DEFINITIONS ~ BEGIN BYTE: TYPE ~ [0..377B]; CARD: TYPE ~ LONG CARDINAL; lastNat: NAT ~ NAT.LAST; -- because interpreter can't handle NAT.LAST as a default arg lastInt: INT ~ INT.LAST; -- because interpreter can't handle INT.LAST as a default arg ROPE: TYPE ~ Rope.ROPE; STREAM: TYPE ~ IO.STREAM; ShortNumber: TYPE ~ [-4000..77777B-4000]; -- 15 bits EncodingValue: TYPE = MACHINE DEPENDENT { -- 13 bits nil(0), nop(1), -- 2.0 setxy(10), -- 2.0 setxyrel(11), -- 2.0 setxrel(12), -- 2.0 setyrel(13), -- 2.0 linetox(14), -- 2.0 linetoy(15), -- 2.0 space(16), -- 2.0 get(17), -- 2.0 iget(18), -- 2.0 iset(19), -- 2.0 fget(20), -- 2.0 fset(21), -- 2.0 show(22), -- 2.0 lineto(23), -- 2.0 maskstroke(24), -- 2.0 moveto(25), -- 2.0 metricMaster(100), -- full ? environmentMaster(101), -- full ? beginBlock(102), -- 2.0 endBlock(103), -- 2.0 noPages(104), -- full pageInstructions(105), -- 2.0 beginBody(106), -- 2.0 endBody(107), -- 2.0 correct(110), -- 2.0 makesimpleco(114), -- 2.0 makeco(115), -- full makecompiledimage(116), -- full dosavesimplebody(120), -- 2.0 dobody(121), -- full dosavebody(122), -- full dosaveallbody(123), -- full showandxrel(146), -- 2.0 findfont(147), -- 2.0 modifyfont(148), -- 2.0 finddecompressor(149), -- 2.0 findfontvec(150), -- full setfont(151), -- 2.0 setcorrectmeasure(154), -- 2.0 setcorrecttolerance(155), -- 2.0 correctmask(156), -- 2.0 correctspace(157), -- 2.0 getcp(159), -- 2.0 maket(160), -- full opent(161), -- full translate(162), -- 2.0 rotate(163), -- 2.0 scale(164), -- 2.0 concat(165), -- 2.0 scale2(166), -- 2.0 invert(167), -- full concatt(168), -- 2.0 move(169), -- 2.0 trans(170), -- 2.0 transform(174), -- full transformvec(175), -- full roundxy(176), -- full roundxyvec(177), -- full pop(180), -- 2.0 dup(181), -- 2.0 copy(183), -- 2.0 roll(184), -- 2.0 exch(185), -- 2.0 mark(186), -- 2.0 unmark(187), -- 2.0 count(188), -- 2.0 unmark0(192), -- 2.0 abs(200), -- 2.0 add(201), -- 2.0 and(202), -- 2.0 ceiling(203), -- 2.0 div(204), -- 2.0 eq(205), -- 2.0 floor(206), -- 2.0 ge(207), -- 2.0 gt(208), -- 2.0 mod(209), -- 2.0 mul(210), -- 2.0 neg(211), -- 2.0 not(212), -- 2.0 or(213), -- 2.0 sub(214), -- 2.0 trunc(215), -- 2.0 rem(216), -- 2.0 round(217), -- 2.0 eqname(218), -- full type(220), -- 2.0 atan(221), -- full cos(222), -- full exp(223), -- full log(224), -- full sin(225), -- full sqrt(226), -- full max(227), -- full min(228), -- full do(231), -- 2.0 dosave(232), -- 2.0 dosaveall(233), -- 2.0 if(239), -- 2.0 ifcopy(240), -- 2.0 ifelse(241), -- 2.0 loop(242), -- full frame(250), -- full poolop(253), -- full pool(254), -- full pget(255), -- full pset(256), -- full makepool(257), -- full nopool(258), -- full env(260), -- full makeveclu(282), -- 2.0 makevec(283), -- 2.0 shape(285), -- 2.0 openvec(286), -- full getprop(287), -- 2.0 getp(288), -- full mergeprop(289), -- full dround(300), -- full getcprounded(301), -- full curveto(402), -- full arcto(403), -- full conicto(404), -- full maskfillparity(408), -- full ? maskfill(409), -- 2.0 maskrectangle(410), -- 2.0 masktrapezoidx(411), -- 2.0 masktrapezoidy(412), -- 2.0 startunderline(413), -- 2.0 maskunderline(414), -- 2.0 makeoutline(417), -- 2.0 clipoutline(418), -- full cliprectangle(419), -- full findcoloroperator(421), -- 2.1 findcolormodeloperator(422), -- 2.1 findcolor(423), -- 2.0 setgray(424), -- 2.0 makegray(425), -- 2.0 makesampledblack(426), -- 2.0 makesampledcolor(427), -- 2.1 excludeoutline(430), -- full ? excluderectangle(431), -- full ? maskstrokeclosed(440), -- full maskvector(441), -- 2.0 makepixelarray(450), -- 2.0 extractpixelarray(451), -- 2.1 maskpixel(452), -- 2.0 joinpixelarrays(453), -- full ? error(600), -- 2.1 (17777B) }; SequenceType: TYPE = MACHINE DEPENDENT { -- 5 bits nil(0), sequenceString(1), sequenceInteger(2), sequenceRational(4), sequenceIdentifier(5), sequenceComment(6), sequenceContinued(7), sequenceLargeVector(8), sequencePackedPixelVector(9), sequenceCompressedPixelVector(10), sequenceInsertFile(11), sequenceAdaptivePixelVector(12), -- 2.1 (37B) }; Op: TYPE ~ {nil, -- BASE primitives get, makeveclu, makevec, shape, openvec, getprop, getp, mergeprop, frame, fget, fset, poolop, pool, pget, pset, env, makepool, nopool, makeco, makesimpleco, do, dosave, dosaveall, dobody, dosavebody, dosaveallbody, dosavesimplebody, makecompiledimage, pop, copy, dup, roll, exch, mark, unmark, unmark0, count, nop, error, if, ifelse, ifcopy, loop, eq, eqname, gt, ge, and, or, not, type, add, sub, neg, abs, floor, ceiling, trunc, round, mul, div, mod, rem, max, min, sqrt, exp, log, sin, cos, atan, -- IMAGE primitives iget, iset, dround, maket, opent, translate, rotate, scale, scale2, concat, invert, transform, transformvec, roundxy, roundxyvec, concatt, move, trans, show, showandxrel, setxy, setxyrel, setxrel, setyrel, getcp, getcprounded, makepixelarray, extractpixelarray, joinpixelarrays, finddecompressor, makegray, findcolor, findcoloroperator, findcolormodeloperator, makesampledcolor, makesampledblack, setgray, moveto, lineto, linetox, linetoy, curveto, conicto, arcto, makeoutline, maskfill, maskfillparity, maskstroke, maskstrokeclosed, maskrectangle, maskvector, startunderline, maskunderline, masktrapezoidx, masktrapezoidy, maskpixel, clipoutline, excludeoutline, cliprectangle, excluderectangle, findfont, findfontvec, modifyfont, setfont, correctmask, correctspace, correct, setcorrectmeasure, setcorrecttolerance, space, -- Symbols beginBody, endBody, beginBlock, endBlock, pageInstructions, noPages, metricMaster, environmentMaster }; 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 (CARDINAL.LAST) }; 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 (CARDINAL.LAST) -- room for expansion (round joints, probably) }; 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 ]; Version: TYPE ~ RECORD[major, minor: CARDINAL]; -- Interpress version number currentVersion: Version ~ [3, 0]; -- latest version supported by this interface ErrorCode: TYPE ~ {nil, bug, unimplemented, overflow, invalidHeader, invalidVersion, invalidSkeleton, invalidToken, invalidRational, invalidIdentifier, invalidString }; Error: ERROR[code: ErrorCode, explanation: ROPE]; OpFromEvArray: TYPE ~ PACKED ARRAY EncodingValue OF Op; GetOpFromEv: PROC RETURNS[REF READONLY OpFromEvArray]; EvFromOpArray: TYPE ~ PACKED ARRAY Op OF EncodingValue; GetEvFromOp: PROC RETURNS[REF READONLY EvFromOpArray]; EncodingValueFromOp: PROC[Op] RETURNS[EncodingValue]; <> <<>> OpFromEncodingValue: PROC[EncodingValue] RETURNS[Op]; <> <<>> RopeFromOp: PROC[Op] RETURNS[ROPE]; <> <<>> OpFromRope: PROC[ROPE] RETURNS[Op]; <> <<>> RopeFromImagerVariable: PROC[ImagerVariable] RETURNS[ROPE]; <> ValidIdentifier: PROC[rope: ROPE, start: INT _ 0, len: INT _ lastInt] RETURNS[BOOL]; ValidString: PROC[rope: ROPE, start: INT _ 0, len: INT _ lastInt] RETURNS[BOOL]; ValidName: PROC[rope: ROPE, start: INT _ 0, len: INT _ lastInt] RETURNS[BOOL]; ValidVersion: PROC[rope: ROPE, start: INT _ 0, len: INT _ lastInt] RETURNS[BOOL]; MapName: PROC[rope: ROPE, start: INT _ 0, len: INT _ lastInt, action: PROC[base: ROPE, start, len: INT] RETURNS[quit: BOOL _ FALSE]] RETURNS[BOOL]; <> <> <> ListFromName: PROC[rope: ROPE, start: INT _ 0, len: INT _ lastInt] RETURNS[LIST OF ROPE]; <> VersionFromRope: PROC[rope: ROPE, start: INT _ 0, len: INT _ lastInt] RETURNS[Version]; <> GetHeader: PROC[stream: STREAM, prefix: ROPE _ NIL, maxLength: INT _ 100] RETURNS[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]; <> <> <<>> <<>> TokenType: TYPE ~ {nil, num, op, seq}; Token: TYPE ~ RECORD[ index: INT _ 0, type: TokenType _ nil, num: ShortNumber _ ShortNumber.FIRST, ev: EncodingValue _ nil, seq: SequenceType _ nil, len: INT _ 0 ]; GetToken: PROC[stream: STREAM, flushComments: BOOL _ TRUE] RETURNS[Token]; <> <> <<>> SkipBytes: PROC[stream: STREAM, len: INT]; <> <<>> IntFromData: PROC[text: REF READONLY TEXT, start: NAT _ 0, len: NAT _ lastNat] RETURNS[INT]; RealFromData: PROC[text: REF READONLY TEXT, start: NAT _ 0, len: NAT _ lastNat] RETURNS[REAL]; <> <<>> PutOp: PROC[stream: STREAM, op: Op]; <> <<>> PutInt: PROC[stream: STREAM, n: INT]; <> <<>> PutBool: PROC[stream: STREAM, bool: BOOL]; <> <<>> PutRational: PROC[stream: STREAM, n, d: INT]; <> <> PutReal: PROC[stream: STREAM, val: REAL]; <> PutIdentifier: PROC[stream: STREAM, rope: ROPE, start: INT _ 0, len: INT _ lastInt]; <> <> PutString: PROC[stream: STREAM, rope: ROPE, start: INT _ 0, len: INT _ lastInt]; <> <> <> PutComment: PROC[stream: STREAM, rope: ROPE, start: INT _ 0, len: INT _ lastInt]; <> PutInsertFile: PROC[stream: STREAM, rope: ROPE, start: INT _ 0, len: INT _ lastInt]; <> <<>> PutName: PROC[stream: STREAM, rope: ROPE, start: INT _ 0, len: INT _ lastInt]; <> <; "foo" produces < foo 1 MAKEVEC >.>> <> <> PutBits: PROC[stream: STREAM, base: LONG POINTER, wordsPerLine: NAT, sMin, fMin, sSize, fSize: NAT]; <> PutDescriptor: PROC[stream: STREAM, seq: SequenceType, len: INT]; <> PutShortNumber: PROC[stream: STREAM, n: ShortNumber]; <> PutShortOp: PROC[stream: STREAM, ev: EncodingValue[VAL[0]..VAL[37B]]]; PutLongOp: PROC[stream: STREAM, ev: EncodingValue]; <> PutShortSequence: PROC[stream: STREAM, seq: SequenceType, len: [0..377B]]; PutLongSequence: PROC[stream: STREAM, seq: SequenceType, len: INT--[0..77777777B]--]; <> <<>> PutUnsigned: PROC[stream: STREAM, len: [0..4], val: CARD]; <> <<>> PutSigned: PROC[stream: STREAM, len: [0..4], val: INT]; <> <<>> END.