DIRECTORY Graphics USING[Context]; Misc: CEDAR DEFINITIONS = BEGIN MiscOneOf: TYPE = {empty, point, interval, rect}; Window: TYPE = REF WindowRep; WindowRep: TYPE = RECORD[span: Interval, curtains: LIST OF Interval]; WindCreate: PROC[min, max: INT] RETURNS [Window]; WindAddCurtain: PROC[w: Window, curtain: Interval]; WindIsClosed: PROC[w: Window] RETURNS [BOOL]; WindPassesIntl: PROC[w: Window, intl: Interval] RETURNS [BOOL]; WindCurtainsCoverIntl: PROC[w: Window, intl: Interval] RETURNS [BOOL]; Rect: TYPE = REF RectRep; RectRep: TYPE = RECORD[x, y: Interval]; RectSubtractFailure: ERROR [r1, r2: Rect]; RectCreate: PROC[xMin, yMin, xMax, yMax: INT] RETURNS[Rect]; RectCopy: PROC [r: Rect] RETURNS [Rect]; RectOneOf: PROC[r: Rect] RETURNS[MiscOneOf]; RectIntersect: PROC[r1, r2: Rect] RETURNS[Rect]; RectContainp: PROC[r1, r2: Rect] RETURNS[BOOL]; RectContainPt: PROC[r: Rect, xCoord, yCoord: INT] RETURNS [BOOL]; RectArea: PROC[r: Rect] RETURNS[NAT]; RectMakeBRect: PROC[r1, r2: Rect] RETURNS[Rect]; RectSubtract: PROC[r1, r2: Rect] RETURNS[Rect]; RectPaint: PROC[r: Rect, context: Graphics.Context, xOffset, yOffset: REAL, scaleFactor: REAL _ 1.0, stipple: CARDINAL, noFill: BOOL _ FALSE]; x: PROC[r: Rect] RETURNS [Misc.Interval]; y: PROC[r: Rect] RETURNS [Misc.Interval]; xMin: PROC[r: Rect] RETURNS[INT]; yMin: PROC[r: Rect] RETURNS[INT]; xMax: PROC[r: Rect] RETURNS[INT]; yMax: PROC[r: Rect] RETURNS[INT]; Interval: TYPE = REF IntervalRep; IntervalRep: TYPE = RECORD[min, max: INT]; IntlSubtractFailure: ERROR[i1, i2: Interval]; IntlCreate: PROC[min, max: INT] RETURNS[Interval]; IntlCopy: PROC[i: Interval] RETURNS[Interval]; IntlOneOf: PROC[i: Interval] RETURNS[MiscOneOf]; IntlMakeBIntl: PROC[i1, i2: Interval] RETURNS[Interval]; IntlContainp: PROC[i1, i2: Interval] RETURNS[BOOL]; IntlContainPt: PROC[i: Interval, p: INT] RETURNS[BOOL]; IntlIntersect: PROC[i1, i2: Interval] RETURNS[Interval]; IntlLength: PROC[i: Interval] RETURNS[NAT]; IntlSubtract: PROC[i1, i2: Interval] RETURNS[Interval]; min: PROC [i: Interval] RETURNS [INT]; max: PROC[i: Interval] RETURNS [INT]; END. ^-- File: Misc.mesa -- Last Edited by: CSChow, February 1, 1985 0:42:39 am PST --Intro: This interface was initially created to solve the problem of defining/constructing -- channels for a set of components (ie. mapping into topological domain.) --NB: All (unless stated otherwise) operations in this package return a copy of the object that is -- TOTALLY independent (doesn't share) of their inputs (objects.) This is costly but -- avoids a lot of possible obscure bugs from the confusion of objects sharing common subparts --This is the window abstraction --This is the rectangle abstractions: -- ! ERROR RectSubtractFailure if result is not a Rectangle -- -- = {RETURN [IF r = NIL THEN NIL ELSE r.x]} -- = {RETURN [IF r = NIL THEN NIL ELSE r.y]}; --This is the interval abstractions --! ERROR IntlSubtractFailure if the result is not an Interval- Κ˜Jšœ™Jšœ:™:J˜šΟk ˜ Jšœ œ ˜J˜—šœœ œ˜J˜Jšœ œ"˜1—J˜J™[J™JJ™J™cJ™TJ™^J™J™™ Jšœœœ ˜Jš œ œœœœ ˜EJ˜IcodešΟn œœ œœ ˜2Kšžœœ˜3Kšž œœ œœ˜-Kšžœœœœ˜?Kšžœœœœ˜FK˜—J™J™J™šœ%™%J˜Jšœœœ ˜Jšœ œœ˜'J˜J˜Jšœœ˜*Jšž œœœœ˜™>Jšž œœ7œœœ œœ˜Žšœœ˜*Jš œœœœœœœ™,—šœœ˜*Kš œœœœœœœ™-—Jšœœ œœ˜!Jšœœ œœ˜!Jšœœ œœ˜!Jšœœ œœ˜"K˜K˜J˜—J˜J˜J˜šœ#™#Jšœ œœ ˜!Jšœ œœ œ˜*J˜Jšœœ˜-J˜Jšž œœ œœ ˜2Jšžœœœ ˜.Jšž œœœ ˜0Jšž œœœ ˜8Jšž œœœœ˜3Jš ž œœœœœ˜7Kšž œœœ ˜8Kšž œœœœ˜+Kšž œœœ ˜7Jšœ ž œ)™?J˜Jšœœœœ˜&Kšœœœœ˜%K˜J˜J˜Jšœ˜——…—F²