IPBasic.mesa
The most basic Interpress types.
Last edited by:
Doug Wyatt, July 7, 1983 3:13 pm
DIRECTORY
Rope USING [ROPE];
IPBasic: CEDAR DEFINITIONS
= BEGIN
ValueType: TYPE = MACHINE DEPENDENT {nil(0),
number(1), identifier(2), vector(3), operator(4),
transformation(5), pixelArray(6), color(7), trajectory(8), outline(9),
(LAST[CARDINAL])};
maxInteger: INT = 16777215; -- 2^24 - 1
Integer: TYPE = INT--[0..maxInteger]--;
Rational: TYPE = RECORD[num, den: INT];
Number: TYPE = RECORD[SELECT tag: * FROM
int => [i: Integer], -- a Number known to be an Integer
real => [r: REAL], -- any Number (note that Integers have two equivalent representations)
ENDCASE
];
zero: Number = [int[0]];
Any: TYPE = RECORD[type: ValueType, ref: REFNIL, number: Number ← zero];
nullAny: Any = [type: nil, ref: NIL, number: zero];
ROPE: TYPE = Rope.ROPE;
Identifier: TYPE = ATOM;
Marker: TYPE = LONG CARDINAL; -- a unique mark value associated with a context
nullMarker: Marker = 0;
Vec: TYPE = REF VecRep; -- a constructed vector, from MAKEVEC or MAKEVECLU
VecRep: TYPE = RECORD[
shape: VectorShape,
array: SEQUENCE size: NAT OF Any
];
VectorShape: TYPE = RECORD[l, n: Integer]; -- l is lower bound, n is number of elements
Vector: TYPE = REF; -- currently: Vec, ROPE, or Font
PrimitiveOrSymbol: TYPE = {nil, -- a primitive operator or symbol
Vectors:
get, makeveclu, makevec, shape, openvec, getprop, getp, mergeprop,
Frames:
fget, fset, frame, poolop, pool, pget, pset, env,
Operators:
makesimpleco, makeco, makecompiledimage, makepool, nopool,
do, dosave, dosaveall, dosavesimplebody, dobody, dosavebody, dosaveallbody,
Stack:
pop, copy, dup, roll, exch, mark, unmark, unmark0, count, nop,
Control:
if, ifelse, ifcopy, loop,
Test:
eq, eqn, gt, ge, and, or, not, type,
Arithmetic:
add, sub, neg, abs, trunc, round, floor, ceiling, mul, div, mod, rem,
max, min, sqrt, exp, log, sin, cos, atan,
Imager state:
iget, iset,
Coordinate systems:
dround,
Transformations:
maket, opent, translate, rotate, scale, scale2, concat, invert,
transform, transformvec, roundxy, roundxyvec,
concatt, move, trans, show, showandxrel,
Current position:
setxy, setxyrel, setxrel, setyrel, getcp, getcprounded,
Pixel arrays:
makepixelarray, finddecompressor,
Color:
findcolor, findcoloroperator, findcolormodeloperator,
makegray, setgray, makesampledblack, makesampledcolor,
Masks:
moveto, lineto, linetox, linetoy, curveto, arcto, conicto, makeoutline,
maskfill, maskstroke, maskstrokeclosed, maskvector, maskrectangle,
startunderline, maskunderline, masktrapezoidx, masktrapezoidy, maskpixel,
clipoutline, cliprectangle,
Characters:
findfont, findfontvec, modifyfont, setfont,
Corrected masks:
correctmask, correctspace, setcorrectmeasure, setcorrecttolerance, space,
correct,
Symbols:
beginBody, endBody, beginBlock, endBlock, pageInstructions, noPages,
beginVec, comma, endVec -- for written form only
};
PrimitiveOp: TYPE = PrimitiveOrSymbol[nil..correct];
Operator: TYPE = REF OperatorRep;
ComposedOp: TYPE = REF OperatorRep[composed]; -- a composed operator, from MAKECO, ...
InternalOp: TYPE = REF OperatorRep[internal]; -- an internal operator
OperatorRep: TYPE = RECORD[
SELECT tag: * FROM
composed => [start: Index, initialFrame: Vec],
internal => [proc: PROC[State, REF], data: REF],
ENDCASE
];
Index: TYPE = INT; -- a byte position in the master
nullIndex: Index = -1;
SaveType: TYPE = {nil, save, saveAll}; -- parameter to DO and friends
State: TYPE = REF StateRep; -- access to the interpreter state
StateRep: TYPE; -- see IPState
END.