File: XMesaCmplr16.mesa - created by PJ. Last edit:
Mna, April 17, 1991 3:20 pm PDT
Copyright (C) 1987 by Xerox Corporation. All rights reserved.
DIRECTORY
NSFile,
OSOps,
RunRegressions,
XMesaProcs,
XMesaCmplr16DefsA,
XMesaCmplr16DefsB,
XMesaCmplr16DefsC;
XMesaCmplr16: MONITOR
IMPORTS RunRegressions, OSOps, XMesaProcs,
XMesaCmplr16DefsA, XMesaCmplr16DefsB, XMesaCmplr16DefsC
EXPORTS XMesaCmplr16DefsA=
{
filename: LONG STRING = "XMesaCmplr16"L;
GreenwichMeanTime: TYPE = RECORD[LONG CARDINAL];
XMesaCall16: PROCEDURE = {
XMesaProcs.PrintS[filename];
XMesaProcs.PrintCR;
XMesa16a[];
XMesa16b[];
XMesa16c[];
XMesa16d[];
XMesa16e[];
XMesa16f[];
XMesa16g[];
XMesa16h[];
XMesa16i[];
XMesa16j[];
XMesa16k[];
XMesa16l[];
XMesa16m[];
XMesa16n[];
XMesa16o[];
XMesa16p[];
XMesa16q[];
XMesa16r[];
XMesa16s[];
XMesa16t[];
XMesa16u[];
XMesa16v[];
XMesa16w[];
XMesa16x[];
XMesa16y[];
XMesa16z[];
XMesa16aa[];
XMesa16ab[];
XMesa16ac[];
XMesa16ad[];
XMesa16ae[];
XMesa16af[];
XMesa16ag[];
XMesa16ah[];
XMesa16ai[];
XMesa16aj[];
XMesa16ak[];
XMesa16al[];
XMesa16am[];
XMesa16an[];
XMesa16ao[];
XMesa16ap[];
XMesa16aq[];
XMesa16ar[];
XMesa16as[];
XMesa16at[];
XMesa16au[];
XMesa16av[];
XMesa16aw[];
XMesa16ax[];
XMesa16ay[];
XMesa16az[];
XMesa16ba[];
XMesa16bb[];
XMesa16bc[];
XMesa16bd[];
XMesa16be[];
<<XMesa16bf[];>>
XMesa16bg[];
XMesa16bh[];
XMesa16bi[];
XMesa16bj[];
XMesa16bk[];
XMesa16bl[];
XMesa16bm[];
XMesa16bn[];
XMesa16bo[];
XMesa16bp[];
XMesa16bq[];
XMesa16br[];
XMesa16bs[];
XMesa16bt[];
XMesa16bu[0];
XMesa16bu[7];
XMesa16bv[0];
XMesa16bv[7];
XMesa16bw[0];
XMesa16bw[7];
XMesa16bx[];
XMesa16by[];
XMesa16bz[];
XMesa16ca[];
[] ← XMesa16cb[[125132], 14115];
[] ← XMesa16cc[[125132], 14115];
[] ← XMesa16cd[[125132], 14115];
XMesa16ce[];
XMesa16ci[];
XMesaProcs.PrintS["Done with XMesa16"L];
XMesaProcs.PrintCR;
}; --end of XMesaCall16
XMesa16a: PROCEDURE = { -- from AR 292
Error: PUBLIC ERROR [why: INT] = CODE;
Family: TYPE = {century, frutiger, titan, pica, trojan, vintage, elite, master, cubic, roman, scientific, gothic, ocrB, spokesman, xeroxLogo, centuryThin, helvetica, helveticaCondensed, optima, baskerville, spartan, bodoni, palatino, memphis, excelsior, olympian, univers, trend, boxPS, terminal, ocrA, logo1, logo3, geneva2, times2, square3, courier, prestige, aLLetterGothic, centurySchoolBook, lastUnused, backstop};
GetFamily: PROCEDURE [f: LONG POINTER TO Family] =
BEGIN
string: STRING ← [32];
SELECT string FROM
"century"L => f^ ← century;
"frutiger"L => f^ ← frutiger;
"titan"L => f^ ← titan;
"pica"L => f^ ← pica;
"trojan"L => f^ ← trojan;
"vintage"L => f^ ← vintage;
"elite"L => f^ ← elite;
"master"L => f^ ← master;
"cubic"L => f^ ← cubic;
"roman"L => f^ ← roman;
"scientific"L => f^ ← scientific;
"gothic"L => f^ ← gothic;
"ocrB"L => f^ ← ocrB;
"spokesman"L => f^ ← spokesman;
"xeroxLogo"L => f^ ← xeroxLogo;
"centuryThin"L => f^ ← centuryThin;
"helvetica"L => f^ ← helvetica;
"helveticaCondensed"L => f^ ← helveticaCondensed;
"optima"L => f^ ← optima;
"baskerville"L => f^ ← baskerville;
"spartan"L => f^ ← spartan;
"bodoni"L => f^ ← bodoni;
"palatino"L => f^ ← palatino;
"memphis"L => f^ ← memphis;
"excelsior"L => f^ ← excelsior;
"olympian"L => f^ ← olympian;
"univers"L => f^ ← univers;
"trend"L => f^ ← trend;
"boxPS"L => f^ ← boxPS;
"terminal"L => f^ ← terminal;
"ocrA"L => f^ ← ocrA;
"logo1"L => f^ ← logo1;
"logo3"L => f^ ← logo3;
"geneva2"L => f^ ← geneva2;
"times2"L => f^ ← times2;
"square3"L => f^ ← square3;
"courier"L => f^ ← courier;
"prestige"L => f^ ← prestige;
"aLLetterGothic"L => f^ ← aLLetterGothic;
"centurySchoolBook"L => f^ ← centurySchoolBook;
"lastUnused"L => f^ ← lastUnused;
"backstop"L => f^ ← backstop;
ENDCASE => ERROR Error[3];
END;
};
XMesa16b: PROCEDURE = { -- from AR 86
Month: TYPE = [1..12];
Color: TYPE = {red, white, blue};
PA1: TYPE = PACKED ARRAY [1..3] OF CHARACTER;
PA2: TYPE = PACKED ARRAY [1..4) OF Month;
PA3: TYPE = PACKED ARRAY (0..3] OF BOOLEAN;
PA4: TYPE = PACKED ARRAY (0..4) OF Color;
PA5: TYPE = PACKED ARRAY [1..3] OF PA1;
PointerSizeRec: TYPE = RECORD [ int: INTEGER, ch1: CHAR, ch2: CHAR ];
PSRPointer: TYPE = LONG POINTER TO PointerSizeRec;
ArrayOfPSR: TYPE = ARRAY [1..3] OF PointerSizeRec;
InlineRetPSR: PROCEDURE [r: PointerSizeRec]
RETURNS [r1: PointerSizeRec] = INLINE {RETURN [r];};
PackedRec: TYPE = RECORD [
arm1: PA1,
arm2: PA2,
arm3: PA3,
arm4: PA4,
arm5: PA5];
SimpleRec: TYPE = RECORD [
a: CHARACTER,
b: BOOLEAN,
c: Color,
p: PackedRec];
RecOfRec: TYPE = RECORD [
arm1: BOOLEAN,
arm2: PackedRec,
arm3: SimpleRec];
filename: LONG STRING ← "ModH compiler tests."L;
ModHCall: PROCEDURE =
BEGIN
PrintCR[];
PrintS[filename];
PrintCR[];
ModHb[]; --RECORD constructors
ModHc[]; --RECORD extractors
PrintS["Done."L];
PrintCR[];
END;
Getchar: PROCEDURE RETURNS[CHAR] = {RETURN['b]};
ModHb: PROCEDURE =
BEGIN
aBoringPR: PackedRec ← [
-- arm1 -- [' ,' ,' ],
-- arm2 -- [1,1,1],
-- arm3 -- [TRUE,TRUE,TRUE],
-- arm4 -- [white,white,white],
-- arm5 -- [[' ,' ,' ],[' ,' ,' ],[' ,' ,' ]]
];
all1PR: PackedRec ← [
-- arm1 -- ALL['a],
-- arm2 -- ALL[2],
-- arm3 -- ALL[FALSE],
-- arm4 -- ALL[red],
-- arm5 -- ALL[ALL['x]]
];
all2PR: PackedRec ← [
arm1: ALL[Getchar[]],
arm2: all1PR.arm2,
arm3: all1PR.arm3,
arm4: all1PR.arm4,
arm5: [ALL['x], ALL['y], ALL['z]]
];
aBoringRofR: RecOfRec ← [
-- arm1 -- TRUE,
-- arm2 -- aBoringPR,
-- arm3 -- [' , TRUE, white, aBoringPR]
];
aRofR: RecOfRec ← [
-- arm1 -- FALSE,
-- arm2 -- [
['c,'c,'c],
[3,3,3],
[FALSE,FALSE,FALSE],
[blue,blue,blue],
[['j,'j,'j], ['k,'k,'k], ['h,'h,'h]]
],
-- arm3 -- [
-- a -- 'm,
-- b -- FALSE,
-- c -- red,
-- PackedRec -- [
-- arm1 -- ['n,'n,'n],
-- arm2 -- [5,5,5],
-- arm3 -- [TRUE,TRUE,FALSE],
-- arm4 -- [red,white,blue],
-- arm5 -- [['k,'e,'v],['i,'n,'&],['t,'w,'o]]
]
]
];
thePR: PackedRec ← aBoringPR;
theRofR: RecOfRec ← aBoringRofR;
IF thePR.arm2[1] # 1 THEN PutFailMessage["702", "ModHb"L];
IF thePR.arm2[3] # 1 THEN PutFailMessage["703", "ModHb"L];
thePR ← all2PR;
Now testing theRofR which was initialized to aBoringRofR above.
IF theRofR.arm2.arm2[1] # 1 THEN PutFailMessage["742", "ModHb"L];
IF theRofR.arm2.arm2[3] # 1 THEN PutFailMessage["743", "ModHb"L];
IF theRofR.arm3.p.arm2[1] # 1 THEN PutFailMessage["752", "ModHb"L];
IF theRofR.arm3.p.arm2[3] # 1 THEN PutFailMessage["753", "ModHb"L];
END;
ModHc: PROCEDURE =
BEGIN
aPSR: PointerSizeRec ← [2, 'b, 'e];
bPSR: PointerSizeRec ← [4, 'd, 'j];
aPSRPointer: PSRPointer ← @aPSR;
arrayOfPSR: ArrayOfPSR ← ALL[bPSR];
aBoringPR: PackedRec ← [
-- arm1 -- [' ,' ,' ],
-- arm2 -- [1,1,1],
-- arm3 -- [TRUE,TRUE,TRUE],
-- arm4 -- [white,white,white],
-- arm5 -- [[' ,' ,' ],[' ,' ,' ],[' ,' ,' ]]
];
aBoringRofR: RecOfRec ← [
-- arm1 -- TRUE,
-- arm2 -- aBoringPR,
-- arm3 -- [' , TRUE, white, aBoringPR]
];
a1,a2,a11: PA1;
a3,a4,a12: PA2;
a5,a6,a13: PA3;
a7,a14: PA4;
a9,a15: PA5;
b1,b2,b3,b4: BOOLEAN;
c1,c2: Color;
ch1,ch2: CHAR;
r1,r2,r3: PackedRec;
ReturnPSR: PROCEDURE RETURNS [r: PointerSizeRec] = {
RETURN [aPSR];
};
RetPSRPoint: PROCEDURE RETURNS [p: PSRPointer] = {
RETURN [aPSRPointer];
};
ReturnBoringPR: PROCEDURE RETURNS [r: PackedRec] = {
RETURN [aBoringPR];
};
left hand side emphasis
[a1, a3, a5, a7, a9] ← aBoringPR;
[b1, r1, [ch1, b2, c1, r2]] ← aBoringRofR;
[b3, r3, [ch2, b4, c2, [a2, a4, a6]]] ← aBoringRofR;
IF a3[1] # 1 THEN PutFailMessage["801", "ModHc"L];
IF r1.arm2[1] # 1 THEN PutFailMessage["812", "ModHc"L];
IF r2.arm2[1] # 1 THEN PutFailMessage["821", "ModHc"L];
IF r3.arm2[1] # 1 THEN PutFailMessage["832", "ModHc"L];
IF a4[1] # 1 THEN PutFailMessage["841", "ModHc"L];
right hand side emphasis
[[a11, a12, a13, a14, a15]] ← ReturnBoringPR[];
check for aBoringPR
IF a12[1] # 1 THEN PutFailMessage["851", "ModHc"L];
END;
ModHCall[];
};
PutFailMessage: PROCEDURE [x: LONG STRING, modname: LONG STRING] =
{
PrintS["Test "];
PrintS[x];
PrintS[" in module "];
PrintS[modname];
PrintS[" failed; "L];
PrintCR[];};
PrintCR: PROCEDURE = {
PutChar[12C]};
PrintS: PROCEDURE [s: LONG STRING] = {
FOR i: CARDINAL IN [0..s.length) DO
PutChar[s[i]];
ENDLOOP;
};
PutChar: PUBLIC PROCEDURE [ch: CHAR] = {
CharInner: PROC [ch: CHAR] = TRUSTED MACHINE CODE {
"XR�ugPutChar"
};
CharInner[ch];
};
XMesa16c: PROCEDURE = { -- from AR 448
Error: ERROR [erType: ErrorType] = CODE;
ErrorType: TYPE = {a, b, c};
GetNode: PROC RETURNS [POINTER] =
BEGIN
errorType: ErrorType;
BEGIN
ENABLE
BEGIN
Error => {errorType := a; GOTO ReturnWithError};
UNWIND => NULL;
END;
RETURN[NIL]
EXITS ReturnWithError => RETURN WITH ERROR Error[errorType];
END;
END;
};
XMesa16d: PROCEDURE = { -- from AR 413
PoolTableEntry: TYPE = RECORD [
post: CARDINAL
];
PoolTable: TYPE = RECORD [
elements: SEQUENCE ct: CARDINAL OF PoolTableEntry
];
z: UNCOUNTED ZONE ← OSOps.GetSystemUZone[];
poolTable: LONG POINTER TO PoolTable ← z.NEW[PoolTable[2]];
x: CARDINAL ← 1;
poolTable[1].post ← IF x = 0 THEN 1 ELSE 2;
};
XMesa16e: PROCEDURE = { -- from AR 301
bitsPerWord: CARD = 32;
logBitsPerWord: CARD = 5;
BitAddress: TYPE = WORD32 MSBIT MACHINE DEPENDENT RECORD [
word (0): POINTER TO UNSPECIFIED,
bit (1:0..logBitsPerWord.PRED): [0..bitsPerWord),
reserved (1:logBitsPerWord..bitsPerWord.PRED):
[0..LAST[WORD]/bitsPerWord) ← 0];
TestProc: PROC = {
ba: BitAddress;
ba.bit ← 0;
ba.bit ← 31;
};
TestProc[];
};
XMesa16f: PROCEDURE = { -- from AR 456
ByteBlock: TYPE = RECORD [
blockPointer: POINTER TO PACKED ARRAY [0..0) OF BYTE,
length: CARD32];
nullByteBlock: ByteBlock = [NIL, 0];
Byte: TYPE = BYTE;
ReadOnlyBytes: TYPE = POINTER TO READONLY ByteSequence;
ByteSequence: TYPE = RECORD [
PACKED SEQUENCE COMPUTED CARD16 OF Byte];
Context: TYPE = MSBIT WORD16 MACHINE DEPENDENT RECORD [
suffixSize(0): [1..2],
homogeneous(1:0..7): BOOLEAN,
prefix(1:8..15): BYTE];
Reader: TYPE = POINTER TO ReaderBody;
ReaderBody: TYPE = PRIVATE RECORD [
context: Context,
limit: CARDINAL,
offset: CARDINAL,
bytes: ReadOnlyBytes];
Field: TYPE = RECORD [
sortDirection: SortDirection,
variant: SELECT type: FieldType FROM
card16 => [data: CARD16],
card32 => [data: CARD32],
string => [data: --XString.--ReaderBody],
array8 => [data: --Environment.--ByteBlock]
ENDCASE];
FieldUse: TYPE = MACHINE DEPENDENT {key(0), value(1)};
FieldType: TYPE = MACHINE DEPENDENT {
card16(0), card32(1), string(2), array8(3), (15)};
SortDirection: TYPE = MACHINE DEPENDENT {ascending(0), descending(1)};
card16Count: CARDINAL = 10;
card16s: ARRAY [0..card16Count) OF CARD16 := [6, 12, 99, 4, 866, 83, 77, 456, 0, 9];
card32Count: CARDINAL = 10;
card32s: ARRAY [0..card32Count) OF CARD32 := [100012, 6, 99, 300004, 866, 400083, 77, 200456, 0, 600009];
fields: ARRAY [0..4) OF Field;
vanillaContext: Context = [
suffixSize: 1, homogeneous: FALSE, prefix: 0];
nullReaderBody: ReaderBody = [
limit: 0, offset: 0, bytes: NIL, context: vanillaContext];
tempType: FieldType ← card16;
tempVariant: CARD32 ← 23;
fields := [
[descending, string[--XString.--nullReaderBody]], [
ascending, array8[--Environment.--nullByteBlock]], [
ascending, card16[card16s[0]]], [
ascending, card32[card32s[0]]]];
tempType ← fields[3].type;
tempVariant ← NARROW[fields[3], card32 Field].data;
XMesaProcs.IsCardequal[ORD[FieldType[card32]],ORD[tempType],456,filename];
XMesaProcs.IsLongCardEqual[100012,tempVariant,456,filename];
};
XMesa16g: PROCEDURE = { -- from AR 460
displayDesktopBackground: PROCEDURE [CARDINAL] ← DisplayDesktopBackground;
DisplayDesktopBackground: PROCEDURE [window: CARDINAL] = {
fourGray: ARRAY [0..3] OF CARDINAL ← [104210B, 104210B, 021042B, 021042B];
IF window # 0 THEN window ← window + 3;
};
};
ClientID: PUBLIC TYPE = CARDINAL [0..20]; -- from AR 496
XMesa16h: PROCEDURE = { -- from AR 512.2
Byte: TYPE = [0..255];
Block: TYPE = RECORD [
blockPointer: LONG POINTER TO PACKED ARRAY [0..0) OF Byte,
startIndex, stopIndexPlusOne: LONG CARDINAL];
b: Block;
byteArray: PACKED ARRAY INTEGER [0..2) OF Byte;
b ← [BASE[byteArray], 0, 1];
};
XMesa16i: PROCEDURE = { -- from AR 536/550
Exception: SIGNAL = CODE;
exception: BOOLEANFALSE;
Status: TYPE = {ok, error};
status: Status;
GetStatus: PROCEDURE RETURNS [s: Status] =
BEGIN
IF exception THEN SIGNAL Exception;
RETURN[ok];
END; -- Of GetStatus[]
status ← GetStatus[! Exception => status ← error];
};
XMesa16j: PROCEDURE = { -- from AR 9
MAXDOUBLE: LONG REAL = 1.79769313486231470E+308;
};
XMesa16k: PROCEDURE = { -- from AR 28
XMesaCmplr16DefsA.ThisProc[];
};
XMesa16l: PROCEDURE = { -- from AR 38
UID: TYPE = XMesaCmplr16DefsA.UniversalID; -- TYPE [10]
Value: PRIVATE TYPE = RECORD [a, b, c: UNSPECIFIED];
SanityCheck: BOOLEAN [TRUE..TRUE] = (SIZE[UID] = SIZE[Value]);
};
XMesa16m: PROCEDURE = { -- From AR 77
LinkObject: TYPE = MACHINE DEPENDENT RECORD
[
loName(0: 0 .. 31): LONG INTEGER,
loLibrary(1: 0 .. 0): CARD16 [0 .. 2),
loUnused(1: 1 .. 31): CARDINAL [0 .. 2**31),
loMajor(2: 0 .. 15): INT16,
loMinor(2: 16 .. 31): INT16,
loNext(3: 0 .. 31): LONG INTEGER
];
LinkMap: TYPE = MACHINE DEPENDENT RECORD
[
lmAddr(0: 0 .. 31): POINTER TO CHARACTER,
lmName(1: 0 .. 31): POINTER TO CHARACTER,
lmNext(2: 0 .. 31): POINTER TO LinkMap,
lmLop(3: 0 .. 31): POINTER TO LinkObject,
lmLob(4: 0 .. 31): POINTER TO CHARACTER,
lmRwt(5: 0 .. 0): CARD16 [0 .. 2),
unused1 (5: 1 .. 15): CARD16 [0 .. 2**15),
lmLd(5: 16 .. 47): POINTER,
lmLpd(6: 16 .. 47): POINTER TO CHARACTER
,unused2 (7: 16 .. 31): CARD16 [0 .. 2**16) -- workaround
];
};
XMesa16n: PROCEDURE = { -- from AR 78
KERNELBASE: INTEGER = (0B-(128*1024*1024));
SYSBASE: INTEGER = (0B-(16*1024*1024));
};
XMesa16o: PROCEDURE = { -- from AR 83
courierNSNameOverheadInWords: CARDINAL = 5;
maxNSNameSizeInWords: CARDINAL = courierNSNameOverheadInWords +
RoundBytesToWords[XMesaCmplr16DefsA.maxOrgLength] +
RoundBytesToWords[XMesaCmplr16DefsA.maxDomainLength] +
RoundBytesToWords[XMesaCmplr16DefsA.maxLocalLength];
RoundBytesToWords: PROC [bytes: CARDINAL] RETURNS [CARDINAL] = INLINE {
RETURN[(bytes+(XMesaCmplr16DefsA.bytesPerWord-1)) / XMesaCmplr16DefsA.bytesPerWord]};
};
XMesa16p: PROCEDURE = { -- from AR 205
ISTR: CARDINAL = XMesaCmplr16DefsA.IOWR[SIZE[INTEGER]];
};
XMesa16q: PROCEDURE = { -- From AR 220
Card16: TYPE = CARDINAL [0..177777B];
STRecord: TYPE = PACKED RECORD [
link: MSTIndex,
cases: SELECT kind: * FROM
master => [string: PACKED SEQUENCE maxLength: Card16 OF CHAR],
ENDCASE];
Base: TYPE = LONG ORDERED BASE POINTER;
stb: Base; 
MSTIndex: TYPE = Base RELATIVE LONG POINTER TO STRecord.master;
stb ← NIL;
};
XMesa16r: PROCEDURE = { -- from AR 236
ReadOnlyBytes: TYPE = POINTER;
Context: TYPE = MSBIT WORD16 MACHINE DEPENDENT RECORD [
suffixSize(0:0..6): [1..2],
homogeneous(0:7..7): BOOLEAN,
prefix(0:8..15): BYTE];
ReaderBody: TYPE = PRIVATE MSBIT WORD16 MACHINE DEPENDENT RECORD [
context(0): Context,
limit(1): CARD16,
offset(2): CARD16,
bytes(3): ReadOnlyBytes];
Bitmap: TYPE = RECORD [
height, width: CARDINAL,
bitsPerLine: CARDINAL,
bits: CARDINAL];
ChoiceItemType: TYPE = {string, bitmap, wrapIndicator};
ChoiceIndex: TYPE = CARDINAL [0..37777B];
ChoiceItem: TYPE = RECORD [
var: SELECT type: ChoiceItemType FROM
string => [choiceNumber: ChoiceIndex, string: ReaderBody],
bitmap => [choiceNumber: ChoiceIndex, bitmap: Bitmap],
wrapIndicator => NULL,
ENDCASE];
MakeCreateDesktopItems: PROC =
BEGIN
falseTag: ReaderBody ← [[1, FALSE, 2], 3, 4, NIL];
trueTag: ReaderBody ← [[2, TRUE, 1], 4, 5, NIL];
items: ARRAY CARDINAL [0..1] OF ChoiceItem ← [[string[0, trueTag]], [string[1, falseTag]]];
END;
};
XMesa16s: PROCEDURE = { -- from AR 256
z: UNCOUNTED ZONE = OSOps.GetSystemUZone[];
s: STRING ← z.NEW[StringBody[100]];
XMesaProcs.Isequal [0, s.length, 256, filename];
};
XMesa16t: PROCEDURE = { -- from AR 258
StringRecord: TYPE = RECORD [bytes: POINTER TO PACKED ARRAY CARDINAL OF BYTE, length: CARDINAL ← 0, maxlength: CARDINAL ← 0];
NameRecord: TYPE = RECORD [org: StringRecord, domain: StringRecord, local: StringRecord];
NetworkAddress: TYPE = PRIVATE MSBIT WORD16 MACHINE DEPENDENT RECORD [
net (0): CARD16, host (1): CARD32, socket (3): CARD16];
ServiceRecord: TYPE = RECORD [name: NameRecord, systemElement: NetworkAddress];
BigRecord: TYPE = RECORD [
service: POINTER TO ServiceRecord,
sizeInBytes: CARDINAL,
sizeInPages: CARDINAL,
isDirectory: BOOLEAN,
isTemporary: BOOLEAN,
numberOfChildren: CARDINAL];
CallBackProc: TYPE = PROCEDURE[attributes: POINTER TO BigRecord, clientData: POINTER] RETURNS [continue: BOOLEANTRUE];
AttributeType: TYPE = MACHINE DEPENDENT {checksum, childrenUniquelyNamed, createdBy, createdOn, fileID, isDirectory, isTemporary, modifiedBy, modifiedOn, name, numberOfChildren, ordering, parentID, position, readBy, readOn, sizeInBytes, type, version, accessList, defaultAccessList, pathname, service, backedUpOn, filedBy, filedOn, sizeInPages, subtreeSize, subtreeSizeLimit, extended};
ExtendedAttributeType: TYPE = CARDINAL;
Selections: TYPE = RECORD [PACKED ARRAY AttributeType OF BOOLEANALL[FALSE], DESCRIPTOR FOR ARRAY CARDINAL OF ExtendedAttributeType];
List: PROCEDURE [pointer: POINTER TO UNSPECIFIED, callBack: CallBackProc, sel: Selections] = {
[] ← callBack [NIL, NIL];
};
BEGIN
standalone: BOOLEANTRUE;
extendedSelections: ARRAY CARDINAL [0..1) OF ExtendedAttributeType ← [4604];
selections: Selections ← [ALL[FALSE], DESCRIPTOR[extendedSelections]];
desktopCatalog: POINTERNIL;
EachDesktop: CallBackProc =
BEGIN
RETURN;
END;
IF ~standalone THEN selections ← [ALL[TRUE], DESCRIPTOR[extendedSelections]];
List [desktopCatalog, EachDesktop, selections ];
END;
};
XMesa16u: PROCEDURE = { -- from AR 297
Reference: TYPE = WORD16 MSBIT MACHINE DEPENDENT RECORD [
uid(0:0..79): UID ← nullUID,
refType(5): RefType ← nullType,
location(6): LocationInfo ← nullLoc];
null: Reference = [nullUID, nullType, nullLoc];
refSize: CARDINAL = BYTES[Reference]; -- use BYTES rather than SIZE because this is a MACHINE DEPENDENT RECORD and we want the number of units in a packed record.
UID Stuff
HostNumber: TYPE = MACHINE DEPENDENT RECORD [
a, b, c, d, e, f: [0..256)];
UID: TYPE = MSBIT WORD16 MACHINE DEPENDENT RECORD [
processor(0:0..47): HostNumber, sequence(3:0..31): LONG CARDINAL];
nullIDRep: MACHINE DEPENDENT RECORD [a, b, c, d, e: WORD16] = [0, 0, 0, 0, 0];
never returned by GetUniversalID
nullUID: UID = LOOPHOLE[nullIDRep];
RefType Stuff
RefType: TYPE = WORD8 MSBIT MACHINE DEPENDENT RECORD [
superType(0): RefSuperType ← nullSuperType,
subType(1): RefSubType ← nullSubType];
TypeElement: TYPE = BYTE;
RefSuperType: TYPE = WORD8 MSBIT MACHINE DEPENDENT RECORD [TypeElement];
RefSubType: TYPE = WORD8 MSBIT MACHINE DEPENDENT RECORD [TypeElement];
nullType: RefType = [nullSuperType, nullSubType];
nullSuperType: RefSuperType = [LAST[TypeElement]];
nullSubType: RefSubType = [LAST[TypeElement]];
Location Information
LocationInfo: TYPE = WORD16 MSBIT MACHINE DEPENDENT RECORD [
locale(0:0..15): Site ← nullSite];
Site: TYPE = CARD16;
nullLoc: LocationInfo = [nullSite];
nullSite: Site = LAST[Site];
RefPtr: TYPE = POINTER TO Reference;
GlobalRef1: Reference ← null;
GlobalRef2: Reference ← null;
CopyRefVal: PROC = {
PROCEDURE [val: Val, z: UNCOUNTED ZONE] RETURNS [Val]
toRef: RefPtr ← @GlobalRef1; --z.NEW[Reference.Reference];
fromRef: RefPtr ← @GlobalRef2; --z.NEW[Reference.Reference];
toRef^ ← fromRef^};
};
XMesa16v: PROCEDURE = { --from AR 299
FOR count: INT16 DECREASING IN [-10..32) DO
XMesaProcs.PrintD[count];
ENDLOOP;
};
XMesa16w: PROCEDURE = { -- from AR 302
FontHandle: TYPE = POINTER TO FontRecord;
FontRecord: TYPE = RECORD [
flags: FlagsArray,
height: CARD16];
FlagsArray: TYPE = POINTER TO PACKED ARRAY BYTE OF Flags;
Flags: TYPE = MSBIT MACHINE DEPENDENT RECORD [
pad(0:0..0): BOOLEAN, stop(0:1..1): BOOLEAN];
Stop: PROC [font: FontHandle, char: BYTE] RETURNS [BOOLEAN] = INLINE {
RETURN[font.flags[char].stop]};
TEXTBLT: PROCEDURE =
BEGIN
font: FontHandle ← NIL;
char: BYTE ← 0;
result: INT ← 0;
IF Stop[font, char] THEN result ← 3;
END;
};
XMesa16x: PROCEDURE = { -- from AR 333 + 1048
Bit: TYPE = [0..1];
Rec32: TYPE = RECORD [
SELECT OVERLAID * FROM
by1 => [bit: PACKED ARRAY [1..32] OF Bit]
ENDCASE];
Rec64: TYPE = RECORD [
SELECT OVERLAID * FROM
by1 => [bit: PACKED ARRAY [1..64] OF Bit]
ENDCASE];
PermPC1: PROC =
BEGIN
in: POINTER TO Rec64;
temp: Rec64;
in ← @temp;
in.bit ← ALL[0];
{
outC: POINTER TO Rec32;
temp2: Rec32;
outC ← @temp2;
outC.bit ← [
in.bit[57], --1
in.bit[49], --2
in.bit[41], --3
in.bit[33], --4
in.bit[25], --5
in.bit[17], --6
in.bit[9], --7
in.bit[1], --8
in.bit[58], --9
in.bit[50], --10
in.bit[42], --11
in.bit[34], --12
in.bit[26], --13
in.bit[18], --14
in.bit[10], --15
in.bit[2], --16
in.bit[59], --17
in.bit[51], --18
in.bit[43], --19
in.bit[35], --20
in.bit[27], --21
in.bit[19], --22
in.bit[11], --23
in.bit[3], --24
in.bit[60], --25
in.bit[52], --26
in.bit[44], --27
in.bit[36], , , , ]; --28
};
END;
PermPC1[];
};
Font: PUBLIC TYPE = RECORD[ v1,v2: CARDINAL]; -- from AR 538
XMesa16y: PROCEDURE = { -- from AR 584 and 1035
TestProc: PROC = {
ENABLE Error => GOTO exit;
BEGIN
ENABLE UNWIND => {};
file: Handle ← TRASH;
file ← OpenByReference[! Error => {file ← NIL ; CONTINUE}];
END;
EXITS exit =>{};
};
Handle: TYPE = POINTER;
OpenByReference: PROC RETURNS [Handle] = { RETURN[NIL]};
Error: ERROR = CODE;
};
XMesa16z: PROCEDURE = { -- from AR 264
PrintD: PROCEDURE [n: LONG INTEGER] = {
s: LONG STRING ← [34];
AppendLongNumber[s, n, 10];
FormatNumber[s: s];};
AppendLongNumber: PROCEDURE [
s: LONG STRING, n: LONG UNSPECIFIED, radix: CARDINAL] = {
ps: POINTER TO LONG STRING = @s;
xn: PROCEDURE [n: LONG CARDINAL] =
BEGIN
lr: LONG CARDINAL ← n MOD radix;
r: CARDINAL;
n ← n/radix;
IF n # 0 THEN xn[n];
IF (r ← CARDINAL[lr]) > 9 THEN r ← r + 'A - '0 - 10;
AppendChar[s, r + '0];
END;
xn[n];
}; --AppendLongNumber--
FormatNumber: PROCEDURE [
s: LONG STRING] = {
neg: BOOLEANFALSE;
l: CARDINAL;
fill: LONG STRING ← [8];
fillChar: CHARACTER ← ' ;
FOR i: CARDINAL IN [0..8) DO fill[i] ← fillChar; ENDLOOP;
IF neg THEN l ← s.length + 1 ELSE l ← s.length;
IF l < 4 THEN
BEGIN
fillChars: CARDINAL ← 4 - l;
THROUGH [0..fillChars/8) DO
PrintS[fill];
ENDLOOP;
IF neg THEN PutChar['-];
END
ELSE IF neg THEN PutChar['-];
PrintS[s];};
AppendChar: PROCEDURE [s: LONG STRING, c: CHARACTER] = {
s[s.length] ← c;
s.length ← s.length + 1;
RETURN};
PrintS: PROCEDURE [s: LONG STRING] = {
FOR i: CARDINAL IN [0..s.length) DO
PutChar[s[i]];
ENDLOOP;
};
PutChar: PROCEDURE [ch: CHAR] = {
CharInner: PROC [ch: CHAR] = TRUSTED MACHINE CODE {
"XR�ugPutChar"
};
CharInner[ch];
};
DoIt: PROC = {
z: UNCOUNTED ZONE ← OSOps.GetSystemUZone[];
s: STRING ← z.NEW[StringBody[100]];
PrintS["s.length = "];
PrintD[s.length];
PrintS[" and s.maxlength = "];
PrintD[s.maxlength];
PrintS["\n"];
};
DoIt[];
};
XMesa16aa: PROCEDURE = { -- from AR 554
SomeProc: PROC = {};
Proc: PROC = BEGIN
BEGIN ENABLE UNWIND => NULL;
SomeProc [!
ABORTED => { CONTINUE};
XMesaCmplr16DefsB.Error => { CONTINUE};
XMesaCmplr16DefsA.FError => { CONTINUE};
XMesaCmplr16DefsA.Signal => { RESUME }
];
END;
END;
};
InsufficientRoom: PUBLIC SIGNAL [needsMoreRoom: XMesaCmplr16DefsA.Writer, amountNeeded: CARDINAL] = CODE;
XMesa16ab: PROCEDURE = { -- from AR 557
Character: TYPE = CARD;
GetWordOrTileToken: PROC = {
AppendChToWordAndUpdateWordFlags: PROC = INLINE {
AppendChar[c: Q2XChar[] ! XMesaCmplr16DefsA.InsufficientRoom => CONTINUE;];
};
AppendChToWordAndUpdateWordFlags[];
AppendChToWordAndUpdateWordFlags[];
};
Q2XChar: PROC RETURNS [Character] = {
c: Character;
c ← 43;
RETURN[c];
};
AppendChar: PROC [c: Character] = {};
};
XMesa16ac: PROCEDURE = { -- from AR 560
i: INTEGER ← 1;
j: INTEGER ← 3;
XMesaProcs.Isequal[-(i/j),-i/j,560,filename];
XMesaProcs.Isequal[-i/j,i/-j,560,filename];
};
XMesa16ad: PROCEDURE = { -- from AR 922
AttributeType: TYPE = MACHINE DEPENDENT{
checksum(0), subtreeSize(27)};
Attribute: TYPE = RECORD [
var: SELECT type: AttributeType FROM
subtreeSize => [value: CARD32],
ENDCASE];
AttributeFromAttributeType: PROCEDURE = {
attribute: NSFile.Attribute;
attributeType: NSFile.AttributeType ← subtreeSize;
b: BOOLTRUE;
SELECT attributeType FROM
subtreeSize => IF b THEN
attribute ← [subtreeSize[0]] ELSE attribute ← [subtreeSize[0]];
attribute ← IF b THEN [subtreeSize[0]] ELSE [subtreeSize[0]];
ENDCASE;
};
};
XMesa16ae: PROCEDURE = { -- from AR 637
ResultA : XMesaCmplr16DefsA.Dummy ← [a: 258, b: 772, c: 1286];
mdRecord: XMesaCmplr16DefsA.MDRecord;
mdRecordPtr: POINTER TO XMesaCmplr16DefsA.MDRecord ← @mdRecord;
mdRecordPtr^ ← [a: XMesaCmplr16DefsA.valueA, b: XMesaCmplr16DefsA.valueB];
IF ResultA.a # LOOPHOLE[mdRecord.a, XMesaCmplr16DefsA.Dummy].a OR
ResultA.b # LOOPHOLE[mdRecord.a, XMesaCmplr16DefsA.Dummy].b OR
ResultA.c # LOOPHOLE[mdRecord.a, XMesaCmplr16DefsA.Dummy].c THEN {
XMesaProcs.PrintS["Test for AR 637 failed"L];
XMesaProcs.PrintCR;
};
};
XMesa16af: PROCEDURE = { -- from AR 771
pointPerSpace: REAL64 = 6;
Units: TYPE = MACHINE DEPENDENT {inch, mm, cm, mica, point, pixel, pica, didotPoint, cicero, seventySecondOfAnInch, last(15)};
Convert: PROC [n: REAL64, inputUnits, outputUnits: Units] RETURNS [REAL64] = {
RETURN ConvertReal[n*pointPerSpace, seventySecondOfAnInch,
ConvertUnits[outputUnits]];
};
ConvertReal: PROC [n: DREAL, inputUnits: Units, outputUnits: Units]
RETURNS [DREAL] = { RETURN[3.0];
};
ConvertUnits: PROC [u: Units] RETURNS [Units] = {
RETURN [cm];
};
};
XMesa16ag: PROCEDURE = { -- from AR 818
b: DREAL;
b ← 1;
};
XMesa16ah: PROCEDURE = { -- from AR 852
s: LONG STRING ← [10];
objp: POINTER TO LONG STRING ← @s;
block: REF TEXTLOOPHOLE[objp.text[0]];
};
XMesa16ai: PROCEDURE = { -- from AR 854
Types
Byte: TYPE = CHAR;
ReadOnlyBytes: TYPE = POINTER TO READONLY ByteSequence;
ByteSequence: TYPE = RECORD [PACKED SEQUENCE COMPUTED CARDINAL OF Byte];
Context: TYPE = MSBIT WORD16 MACHINE DEPENDENT RECORD [
suffixSize(0): [1..2],
homogeneous(1:0..7): BOOLEAN,
prefix(1:8..15): BYTE];
Reader: TYPE = POINTER TO ReaderBody;
ReaderBody: TYPE = PRIVATE RECORD [
context: Context,
limit: CARDINAL,
offset: CARDINAL,
bytes: ReadOnlyBytes];
CHARPtr: TYPE = RECORD [ptr: POINTER TO RawChars ← NIL];
RawChars: TYPE = RECORD [PACKED SEQUENCE COMPUTED CARD OF CHAR];
stdout: INT = -3;
Constants
emptyContext: Context = [
suffixSize: 1, homogeneous: TRUE, prefix: 0];
vanillaContext: Context = [
suffixSize: 1, homogeneous: FALSE, prefix: 0];
nullReaderBody: ReaderBody = [
limit: 0, offset: 0, bytes: NIL, context: vanillaContext];
FromSTRING: PROC [
s: STRING, homogeneous: BOOLEANFALSE] RETURNS [ReaderBody] = {
offset: CARDINAL = SIZE[StringBody];
IF s = NIL THEN RETURN[nullReaderBody];
RETURN[[
limit: s.length + offset, offset: offset, bytes: LOOPHOLE[s],
context: IF homogeneous THEN emptyContext ELSE vanillaContext]]};
Str: PROC[s: STRING, r: Reader] RETURNS [Reader] = INLINE {
r^ ← FromSTRING[s];
RETURN[r]};
MyProc: PROC[] = {
rb: ARRAY [0..5) OF ReaderBody;
r: Reader;
r ← Str[ "AbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstu1"L, @rb[0]];
r ← Str[ "AbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstu2"L, @rb[1]];
r ← Str[ "AbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstu3"L, @rb[2]];
r ← Str[
"AbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstu4"L, @rb[3]];
r ← Str[ "AbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstuvwxyzAbcdefghijklmnopqrstu5"L, @rb[4]];
PrintS["Printing contents of rb: \n rb[0] = "];
PrintXString[@rb[0]];
PrintS["\n rb[1] = "];
PrintXString[@rb[1]];
PrintS["\n rb[2] = "];
PrintXString[@rb[2]];
PrintS["\n rb[3] = "];
PrintXString[@rb[3]];
PrintS["\n rb[4] = "];
PrintXString[@rb[4]];
PrintS["\n"];
}; --MyProc
Printing utilities
PrintXString: PROC [x: Reader] = {
c: CHAR;
FOR i: CARD IN [0..x.limit) DO
c ← x.bytes[i];
PutChar[c];
ENDLOOP;
};
PrintS: PROCEDURE [s: LONG STRING] = {
FOR i: CARDINAL IN [0..s.length) DO
PutChar[s[i]];
ENDLOOP;
};
PutChar: PROCEDURE [ch: CHAR] = {
CharInner: PROC [fildes: INT, buf: CHARPtr, nBytes: INT] =
TRUSTED MACHINE CODE {"XR←Write"};
s: STRING ← [4];
buf: CHARPtr;
s[0] ← ch;
s[1] ← 0C;
s[2] ← 0C;
s[3] ← 0C;
buf ← LOOPHOLE[LOOPHOLE[s, CARD]+UNITS[TEXT[0]]];
CharInner[fildes: stdout, buf: buf, nBytes: 1];
};
Main line code:
MyProc[];
};
XMesa16aj: PROCEDURE = { -- from AR 877
Fielddesc: TYPE = RECORD [
attributeType: CARD32,
emptyUnits: CARD16,
offsetBeyond: CARD16
];
VarfieldType: TYPE = {name};
varfieldTypeToIndex: ARRAY VarfieldType OF CARDINAL = [name: 0];
VpdescRep: TYPE = RECORD [
length: CARD32, entries: ARRAY VarfieldType OF Fielddesc];
emptyVpdesc: VpdescRep = [
length: LENGTH[emptyVpdesc.entries],
entries: [
name: [0, 0, 0]
]
];
};
XMesa16ak: PROCEDURE = { -- from AR 343
Access: TYPE = PACKED ARRAY AccessType OF BooleanFalseDefault;
AccessType: TYPE = MACHINE DEPENDENT{
read(0), write(1), owner(2),
add(3), remove(4)};
BooleanFalseDefault: TYPE = BOOLEANFALSE;
AndAccess: PROCEDURE [acc1, acc2: Access] RETURNS [Access] =
INLINE {RETURN[XMesaCmplr16DefsA.BITAND[acc1, acc2]]};
};
XMesa16al: PROCEDURE = { -- from AR 396
foo: INT16 = LAST[INT16];
XMesaProcs.Isequal[foo, 32767, 396, filename];
};
XMesa16am: PROCEDURE = { -- from AR 421
AccessEntries: TYPE = LONG DESCRIPTOR FOR ARRAY OF Access;
Access: TYPE = PACKED ARRAY [0..20) OF BOOLEAN;
uniqueAccessEntries: ARRAY [0..20) OF Access;
P: PROCEDURE = {
a: AccessEntries ← DESCRIPTOR[@uniqueAccessEntries[2], 2];
};
};
XMesa16an: PROCEDURE = { -- from AR 424
c: CARDINALLAST[CARDINAL];
i: INT16LOOPHOLE[c];
};
XMesa16ao: PROCEDURE = { -- from AR 631
DblSizeExpander: PROC = {
dblSizeFactor: NATURAL = 2;
bitsPerChunk: CARDINAL = 8;
bitsPerDblWidth: CARDINAL = dblSizeFactor*bitsPerChunk;
bitsPerWord: CARDINAL = BITS[WORD];
isdesignproblem1: BOOLEAN = bitsPerWord # bitsPerChunk * dblSizeFactor;
ix0, ix2, end, start: CARDINAL ← 0;
IF isdesignproblem1 THEN ERROR;
FOR ix0 IN [start..end) DO
ix2 ← ix2 + 1;
ENDLOOP;
};
};
XMesa16ap: PROCEDURE = { -- from AR 694
ErrorRecord: TYPE = RECORD [
a1:CARD, a2: CARD];
InvalidNameList: TYPE = RECORD [
a1:CARD, a2: CARD];
Error: ERROR [error: ErrorRecord] = CODE;
InvalidRecipients: ERROR [nameList: InvalidNameList] = CODE;
AnotherError: ERROR [nameList: InvalidNameList] = CODE;
Call: PROC = {
ENABLE {
ABORTED => NULL;
Error => {GOTO problem};
InvalidRecipients => {GOTO problem};
AnotherError => {GOTO problem};
};
EXITS problem => NULL;
};
};
XMesa16aq: PROCEDURE = { -- from AR 705
windowBorder: CARDINAL = 0;
tc: CARDINAL ← windowBorder;
tc2: CARDINAL ← 2*tc;
};
AR 742
THandle: PUBLIC TYPE = POINTER TO HandleRecord;
HandleRecord: TYPE = RECORD [
unixFileName: CString
];
CStringBody: TYPE = RECORD [PACKED SEQUENCE COMPUTED CARDINAL OF CHAR];
CString: TYPE = POINTER TO CStringBody;
defaultID: ID = 0;
ID: TYPE = CARD16;
PageNumber: TYPE = CARD32;
PageCount: TYPE = CARD32;
Origin: TYPE = RECORD [
file: XMesaCmplr16DefsA.THandle, base: PageNumber, count: PageCount,
segment: ID ← defaultID];
AR 742
XMesa16ar: PROCEDURE = { -- from AR 742
StringFromCString: PROCEDURE [charStar: CString, z: UNCOUNTED ZONE, extra: CARDINAL ← 0] RETURNS [p: STRING] = {RETURN[NIL];};
Map1: PROCEDURE [origin: Origin] = {
temp1: XMesaCmplr16DefsA.THandle ← origin.file;
temp: CString ← origin.file.unixFileName;
stringFile: STRING ← StringFromCString[charStar: temp, z: NIL];
};
};
XMesa16as: PROCEDURE = { -- from AR 877
Fielddesc: TYPE = RECORD [
attributeType: CARD32,
emptyUnits: CARD16,
offsetBeyond: CARD16
];
VarfieldType: TYPE = {name};
varfieldTypeToIndex: ARRAY VarfieldType OF CARDINAL = [name: 0];
VpdescRep: TYPE = RECORD [
length: CARD32, entries: ARRAY VarfieldType OF Fielddesc];
emptyVpdesc: VpdescRep = [
length: LENGTH[emptyVpdesc.entries],
entries: [ name: [0, 0, 0]]
];
};
XMesa16at: PROCEDURE = { -- from AR 54
ReferenceDotReference: TYPE = LONG CARDINAL;
ReferenceDotNull: ReferenceDotReference = 0;
TemplateInternalHandle: TYPE = LONG POINTER TO TemplateInternalObject;
TemplateInternalObject: TYPE = RECORD [
ref: ReferenceDotReference ← ReferenceDotNull,
domain: ReferenceDotReference ← ReferenceDotNull,
sets: ReferenceDotReference ← ReferenceDotNull,
functions: ReferenceDotReference ← ReferenceDotNull,
name: LONG STRING];
DomainInternalHandle: TYPE = LONG POINTER TO DomainInternalObject;
DomainInternalObject: TYPE = MACHINE DEPENDENT RECORD [
count: CARDINAL ← 0,
ref: ReferenceDotReference ← ReferenceDotNull,
zone: UNCOUNTED ZONENIL,
vals: SEQUENCE COMPUTED CARDINAL OF DomainElement];
DomainElement: TYPE = LONG POINTER;
JDataXferDotTemplateObjectV0: TYPE = RECORD [
ref: ReferenceDotReference, domain: JDataXferDotTemplateStringDomain,
sets: SetsBinding, functions: FunctionsBinding,
name: LONG STRING];
SetsBinding: TYPE = RECORD [ref: ReferenceDotReference, bindingObject: SetsBindingObject];
SetsBindingObject: TYPE = RECORD [count: CARDINAL, left: JDataXferDotTemplateStringDomain, right: TemplateSetRefDomain, vals: BindingValueList];
TemplateSetRefDomain: TYPE = RECORD [ref: ReferenceDotReference, domainObject: TemplateSetRefDomainObject];
TemplateSetRefDomainObject: TYPE = RECORD [count: CARDINAL, sorted:
IndexSet, vals: TemplateSetRefDomainValueList];
TemplateSetRefDomainValueList: TYPE = LONG DESCRIPTOR FOR ARRAY TemplateSetRefDomainValueListIndex OF TemplateSet;
TemplateSetRefDomainValueListIndex: TYPE = CARDINAL;
TemplateSet: TYPE = RECORD [ref: ReferenceDotReference, setObject: TemplateSetObject];
TemplateSetObject: TYPE = RECORD [size: CARDINAL, set: IndexSet];
DomainIndex: TYPE = CARDINAL;
IndexSet: TYPE = LONG DESCRIPTOR FOR ARRAY IndexSetIndex OF DomainIndex;
IndexSetIndex: TYPE = CARDINAL;
BindingValueList: TYPE = LONG DESCRIPTOR FOR ARRAY BindingValueListIndex OF DomainIndex;
BindingValueListIndex: TYPE = CARDINAL;
FunctionsBinding: TYPE = RECORD [ref: ReferenceDotReference, bindingObject: FunctionsBindingObject];
FunctionsBindingObject: TYPE = RECORD [count: CARDINAL, left: JDataXferDotTemplateStringDomain, right: TemplateFunctionRefDomain, vals: BindingValueList];
TemplateFunctionRefDomain: TYPE = RECORD [ref: ReferenceDotReference, domainObject: TemplateFunctionRefDomainObject];
TemplateFunctionRefDomainObject: TYPE = RECORD [count: CARDINAL, sorted: IndexSet, vals: TemplateFunctionRefDomainValueList];
TemplateFunctionRefDomainValueList: TYPE = LONG DESCRIPTOR FOR ARRAY TemplateFunctionRefDomainValueListIndex OF TemplateFunction;
TemplateFunctionRefDomainValueListIndex: TYPE = CARDINAL;
TemplateFunction: TYPE = RECORD [ref: ReferenceDotReference, functionObject: TemplateFunctionObject];
TemplateFunctionObject: TYPE = RECORD [count: CARDINAL, lhs: IndexSet, rhs: SetOfIndexSet];
SetOfIndexSet: TYPE = LONG DESCRIPTOR FOR ARRAY SetOfIndexSetIndex OF IndexSet;
SetOfIndexSetIndex: TYPE = CARDINAL;
JDataXferDotTemplateStringDomain: TYPE = RECORD [
count: CARDINAL, ref: ReferenceDotReference, sorted: IndexSet, vals: StringValueList];
StringValueList: TYPE = LONG DESCRIPTOR FOR ARRAY StringValueListIndex OF LONG STRING;
StringValueListIndex: TYPE = CARDINAL;
ConvertFromV0: PROC [
externalTemplate: JDataXferDotTemplateObjectV0, z: UNCOUNTED ZONE]
RETURNS [tHandle: TemplateInternalHandle] =
BEGIN
ConvertFromExtStringDomain: PROC [ -- OK
extDomain: JDataXferDotTemplateStringDomain]
RETURNS [domainRef: ReferenceDotReference ← ReferenceDotNull] =
BEGIN
domainHandle: DomainInternalHandle ← z.NEW[
DomainInternalObject[extDomain.count]];
END; -- of ConvertFromExtStringDomain
tHandle ← z.NEW[TemplateInternalObject];
END;
};
XMesa16au: PROCEDURE = { -- from AR 74
ErrorType: TYPE = {bad, reallybad};
Error: ERROR [error: ErrorType] = CODE;
DummyRef: TYPE = RECORD [a: INT, b: CARD, c: NAT];
nullDummyRef: DummyRef = [a: 0, b: 0, c: 0];
InlineSave: PROC [ref: DummyRef] RETURNS [DummyRef ← nullDummyRef] = {};
Save: PROC [ref: DummyRef] RETURNS [DummyRef ← nullDummyRef] = INLINE {
RETURN InlineSave[ref]};
DuplicateTest: PROC = {
caughtError: BOOLEANFALSE;
caughtError ← FALSE;
[] ← Save[
nullDummyRef ! Error => {caughtError ← TRUE; CONTINUE}];
};
};
XMesa16av: PROCEDURE = { -- from AR 436
r1: REAL ← 231.9;
r2: REALMIN[1, MAX[0, r1]];
};
XMesa16aw: PROCEDURE = { -- from AR 476
const1: INTEGER = const2*2;
const2: INTEGER = 6;
};
XMesa16ax: PROCEDURE = { -- from AR 679
sameName: CARDINAL = XMesaCmplr16DefsA.sameName;
};
XMesa16ay: PROCEDURE = { -- from AR 758
Flags: TYPE = MACHINE DEPENDENT RECORD [bit0, bit1: BIT];
Proc: PROC [flags: POINTER TO PACKED ARRAY BYTE OF Flags, i: BYTE] = {
flags[i].bit1 ← 1;
};
};
XMesa16az: PROCEDURE = { -- from AR 369
FontObject: TYPE = CARDINAL;
Font: PUBLIC TYPE = LONG POINTER TO FontObject;
FaceRecord: TYPE = CARDINAL;
Face: TYPE = LONG POINTER TO FaceRecord;
Family: TYPE = MACHINE DEPENDENT {Classic(0), Modern(1), null(4095)};
FontTableArray: TYPE = ARRAY Family OF Face;
fontTable: FontTableArray;
ClientSetsIndex: TYPE = CARDINAL[0..4);
clientSets: ARRAY ClientSetsIndex OF BYTE;
clientSet: BYTE;
temp: FaceRecord;
clientSet ← BYTE[0];
clientSets[0] ← BYTE[1];
fontTable[Modern] ← @temp;
};
SomeProc: PROC [ls: LONG STRING] = {};
XMesa16ba: PROCEDURE = { -- from AR 1024
ENABLE UNWIND => SomeProc["This is a test"L];
};
XMesa16bb: PROCEDURE = { -- from AR 1053
Izn: TYPE = UNSPEC16; -- NewMesaDefs.UNSPEC16
FiledZoneDotHandle: TYPE = LONG POINTER TO FiledZoneDotObject;
FiledZoneDotObject: TYPE = RECORD [whatever: CARDINAL];
SomeProc: PROC [tileBacking: Izn, stringBacking: FiledZoneDotHandle]
RETURNS [BOOLEAN] = {
RETURN[tileBacking = stringBacking];
};
};
XMesa16bc: PROCEDURE = { -- from AR 1062
u: UNSPECIFIED;
rgwd: DESCRIPTOR FOR ARRAY OF UNSPECIFIED;
rgwd ← DESCRIPTOR [u];
};
XMesa16bd: PROCEDURE = {
tFormatctxt: XMesaCmplr16DefsA.Formatctxt ¬ [ixline: 0];
tLineSeqBody: XMesaCmplr16DefsA.LineSeqBody ¬ [ix: 0];
temp: XMesaCmplr16DefsA.AqPaginationContext ¬ [
htOfFramesInText: 0, aqline: [htLineComp: 0],
formatctxt: @tFormatctxt, lineSeq: @tLineSeqBody];
context: XMesaCmplr16DefsA.PaginationContext ← @temp;
context.htOfFramesInText ← context.aqline.htLineComp ←
context.formatctxt.ixline ← context.lineSeq.ix ← 0;
};
XMesa16be: PROCEDURE = { -- from AR 1086
a:INTEGER = -2;
b: CARDINAL ¬ ABS[a];
};
<< XMesa16bf: PROCEDURE = { -- from AR 1064
MediaHandle: PUBLIC TYPE = XMesaCmplr16DefsB.MediaHandle;
ControlProc: TYPE = PROC [mediaH: MediaHandle, code: CARD16];
ControlL: PROCEDURE [mediaH: XMesaCmplr16DefsA.MediaHandle] = {
control: ControlProc ← mediaH.control;
};
};
>>
XMesa16bg: PROCEDURE = { -- from AR 1105
s: STRINGLOOPHOLE["This string".length];
};
XMesa16bh: PROCEDURE = { -- from AR 1106
s: STRING = ["This string".length];
};
XMesa16bi: PROCEDURE = { -- from AR 1109
i: LONG INTEGER;
i ← -54321;
i ← -254321;
};
XMesa16bj: PROCEDURE = { -- from AR 1119
Atom: TYPE = CARDINAL;
true: BOOLEANTRUE;
false: BOOLEANFALSE;
open,
props,
delete,
canYouTakeSelection, canYouTakeSelectionBackground: Atom ← 0;
GenericProc: PROC [atom: Atom, data, context: POINTER]
RETURNS [POINTER] = {
SELECT atom FROM
open => RETURN [IF data= context THEN @true ELSE @false];
props => RETURN [OpenPropSheet[data]];
canYouTakeSelection, canYouTakeSelectionBackground => RETURN[@false];
delete => RETURN [IF Delete[data] THEN @true ELSE @false];
ENDCASE => RETURN [SomeOtherProc[atom, data, context]];
}; -- of GenericProc
SomeOtherProc: PROC [atom: Atom, data, context: POINTER]
RETURNS [POINTER] = {
RETURN[@false];
};
OpenPropSheet: PROCEDURE [
data: POINTER]
RETURNS [pSheetShell: POINTERNIL] = {
NOP
}; --of OpenPSheet
Delete: PROCEDURE [
data: POINTER]
RETURNS [ok: BOOLEANFALSE] = {
IF data = NIL THEN RETURN [FALSE] ELSE
RETURN [TRUE];
}; -- of Delete
Init: PROCEDURE = {
open ← 1;
props ← 2;
delete ← 3;
canYouTakeSelection ← 4;
canYouTakeSelectionBackground ← 5;
};
<< MAINLINE >>
Init[];
};
XMesa16bk : PROCEDURE = { -- from AR 1185
NegativeSteepLine: PUBLIC ENTRY PROC [window: XMesaCmplr16DefsA.Handle2] = {
ENABLE UNWIND => NULL;
IF NOT window.inTree THEN RETURN;
};
};
XMesa16bl : PROCEDURE = { -- from AR 1185
ModelHandleRecord: TYPE = RECORD [
filtersSatisfied: FilterSelections];
ModelFilter: TYPE = RECORD [
SELECT type: ModelFilterType FROM
primitive => [which: FilterSelections],
ENDCASE];
ModelFilterType: TYPE = {primitive, and, or, not};
FilterSelections: TYPE = PACKED ARRAY [0..16) OF BOOL;
model: ARRAY [0..10 + 2) OF ModelHandleRecord ← [
[[TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE]],
[[TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE]],
[[TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE]],
[[TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE]],
[[TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE]],
[[TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE]],
[[TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE]],
[[TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE]],
[[TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE]],
[[TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE]],
[[TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE]],
[[TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE]]
];
List: PROC = {
cStatus: CARDINAL ← 0;
ModelMatchesFilter: PROC [x: ModelFilter] RETURNS [match: BOOLEAN] = {
match ← TRUE;
WITH m: x SELECT FROM
primitive =>
match ← XMesaCmplr16DefsA.BITAND2[model[cStatus].filtersSatisfied, m.which] =
m.which;
ENDCASE => match ← FALSE;
};
};
};
XMesa16bm : PROCEDURE = { -- from AR1186
GlobalData: TYPE = POINTER TO GlobalDataObject;
GlobalDataObject: TYPE = RECORD [
var: SELECT action: Action FROM
move => [box: Box],
ENDCASE];
Box: TYPE = RECORD[place: Place, dims: Dims];
Place: TYPE = RECORD[x: INTEGER, y: INTEGER];
Dims: TYPE = RECORD[w: INTEGER, h: INTEGER];
Action: TYPE = {move, grow, drag, topBottom};
globals: GlobalData ← NIL;
GetBox: PROC [] RETURNS [box: Box] = {ERROR};
BoxPlaceForMove: PROCEDURE RETURNS [absPlace: Place] = {ERROR};
DrawBox: PROCEDURE [box: Box] = {};
StartMove: PROCEDURE [place: Place] = {
WITH g: globals SELECT FROM
move => DrawBox [g.box ← [place: BoxPlaceForMove[], dims: GetBox[].dims]];
ENDCASE => ERROR;
};
};
XMesa16bn : PROCEDURE = { -- from AR 1307
ColorPrintDesc: TYPE = PACKED RECORD [
y: FixedPointNat,
e, s: FixedPointReal];
FixedPointReal: TYPE = INT16;
FixedPointNat: TYPE = INT16[0..10000];
ColorSeqPtr: TYPE = LONG POINTER TO ColorSeq;
ColorSeq: TYPE = RECORD [
SEQUENCE COMPUTED CARDINAL OF ColorPrintDesc];
FiledColorPrintDesc: TYPE = WORD16 MSBIT MACHINE DEPENDENT RECORD [
y: INT16,
e: INT16,
s: INT16];
StoredColorRec: TYPE = RECORD [
desc: FiledColorPrintDesc,
unused: CARD16 ¬ 0];
EncodeColorPrintDesc: PROC RETURNS[filed: FiledColorPrintDesc] = {
realDesc: ColorPrintDesc ← [1, 2, 3];
filed ¬ [y: INT16[realDesc.y], e: INT16[realDesc.e], s: INT16[realDesc.s]];
};
};
XMesa16bo : PROCEDURE = { -- from AR 1258
Range: TYPE = [1..102];
Proc1: PROC [start: CARDINAL ← 0] =
BEGIN
XMesaProcs.PrintS["XMesa16bo: Should print the numbers from 1 to 101 \n"];
FOR p: Range IN (start..LAST[Range]) DO
XMesaProcs.PrintD[p];
ENDLOOP;
XMesaProcs.PrintS["\n"];
END;
Proc1[];
};
XMesa16bp: PROCEDURE = { -- from AR 1400
bType:TYPE = ARRAY[0..2) OF CARDINAL;
b:bType;
bConstant:bType = [1,2];
b ← bConstant;
b ← bConstant; -- taking this out makes it compile fine
};
XMesa16bq: PROCEDURE = { -- from AR 1220
shellPIDChar: CHAR ← '5;
a: CARDINAL ← 1;
IF ~(shellPIDChar IN ['0..'9])
THEN a ← 2
ELSE a ← 3;
};
XMesa16br: PROCEDURE = { -- from AR 1177
P: PROC [p: LONG POINTER] = {
WITH p SELECT FROM
b: LONG POINTER TO INTEGER => NULL;
ENDCASE => ERROR;
};
};
XMesa16bs: PROCEDURE = { -- from AR 1162 and 849
v1: DREAL ← 2;
v2: DCARD ← 6;
int: INTEGER ← 1;
result: DREAL;
v2 ← v2 + 1;
IF v1 > FIRST[INTEGER] AND v1 < LAST[INTEGER] THEN
result ← v1 * int;
};
XMesa16bt: PROC [] = { -- from AR 721
CheckIn: PROC = {
BEGIN
ENABLE {
XMesaCmplr16DefsB.Error => GOTO error;
XMesaCmplr16DefsC.Error => GOTO error;
XMesaCmplr16DefsA.Error => GOTO error;
ANY => GOTO error;
};
EXITS
error => NULL;
END;
}; -- of CheckIn
};
Range1: TYPE = [1..100];
XMesa16bu: PROC [runs: NAT] = {
Test simple increasing loops
count: NAT ← 0;
FOR c: CARD16 IN [0..runs) DO
IF count # c THEN PutFailMessage["1", "XMesa16bu"];
count ← count + 1;
ENDLOOP;
IF count # runs THEN PutFailMessage["2", "XMesa16bu"];
count ← 0;
FOR c: CARD16 IN (0..runs] DO
count ← count + 1;
IF count # c THEN PutFailMessage["3", "XMesa16bu"];
ENDLOOP;
IF count # runs THEN PutFailMessage["4", "XMesa16bu"];
count ← 0;
FOR c: CARD16 IN [0..runs] DO
IF count # c THEN PutFailMessage["5", "XMesa16bu"];
count ← count + 1;
ENDLOOP;
IF count # runs+1 THEN PutFailMessage["6", "XMesa16bu"];
count ← 0;
FOR c: CARD16 IN (0..runs) DO
count ← count + 1;
IF count # c THEN PutFailMessage["7", "XMesa16bu"];
ENDLOOP;
IF runs > 0 AND count+1 # runs THEN PutFailMessage["8", "XMesa16bu"];
IF runs = 0 AND count # 0 THEN PutFailMessage["9", "XMesa16bu"];
};
XMesa16bv: PROC [runs: NAT] = {
Test simple decreasing loops
count: INT ← runs;
FOR c: CARD16 DECREASING IN [0..runs) DO
count ← count - 1;
IF c # count THEN PutFailMessage["1", "XMesa16bv"];
ENDLOOP;
IF count # 0 THEN PutFailMessage["2", "XMesa16bv"];
count ← runs;
FOR c: CARD16 DECREASING IN (0..runs] DO
IF c # count THEN PutFailMessage["2", "XMesa16bv"];
count ← count - 1;
ENDLOOP;
IF count # 0 THEN PutFailMessage["3", "XMesa16bv"];
count ← runs;
FOR c: CARD16 DECREASING IN [0..runs] DO
IF c # count THEN PutFailMessage["4", "XMesa16bv"];
count ← count - 1;
ENDLOOP;
IF count # -1 THEN PutFailMessage["5", "XMesa16bv"];
count ← runs;
FOR c: CARD16 DECREASING IN (0..runs) DO
count ← count - 1;
IF c # count THEN PutFailMessage["6", "XMesa16bv"];
ENDLOOP;
IF runs > 0 AND count # 1 THEN PutFailMessage["7", "XMesa16bv"];
IF runs = 0 AND count # 0 THEN PutFailMessage["8", "XMesa16bv"];
};
XMesa16bw: PROC [start: CARDINAL] = {
Test a specially nasty case involving biased subranges
count: NAT ← 0;
first: CARDINAL ← Range1.FIRST;
last: CARDINAL ← Range1.FIRST;
FOR p: Range1 IN (start..LAST[Range1]) DO
IF count = 0 THEN first ← p;
count ← count + 1;
last ← p;
ENDLOOP;
IF first # start+1 THEN PutFailMessage["1", "XMesa16bw"];
IF last # Range1.LAST-1 THEN PutFailMessage["2", "XMesa16bw"];
IF count # last-first+1 THEN PutFailMessage["3", "XMesa16bw"];
};
XMesa16bx: PROC = {
Test a special case involving a loop with fixed bounds
count: NAT ← 0;
FOR i: NAT IN [0..10] DO
IF i # count THEN PutFailMessage["1", "XMesa16bx"];
count ← count + 1;
ENDLOOP;
IF count # 11 THEN PutFailMessage["2", "XMesa16bx"];
count ← 0;
FOR i: NAT IN [0..10) DO
IF i # count THEN PutFailMessage["3", "XMesa16bx"];
count ← count + 1;
ENDLOOP;
IF count # 10 THEN PutFailMessage["4", "XMesa16bx"];
count ← 0;
FOR i: NAT IN (0..10] DO
count ← count + 1;
IF i # count THEN PutFailMessage["5", "XMesa16bx"];
ENDLOOP;
IF count # 10 THEN PutFailMessage["6", "XMesa16bx"];
count ← 0;
FOR i: NAT IN (0..10) DO
count ← count + 1;
IF i # count THEN PutFailMessage["7", "XMesa16bx"];
ENDLOOP;
IF count # 9 THEN PutFailMessage["8", "XMesa16bx"];
count ← 0;
THROUGH [0..10] DO count ← count + 1; ENDLOOP;
IF count # 11 THEN PutFailMessage["9", "XMesa16bx"];
count ← 0;
THROUGH [0..10) DO count ← count + 1; ENDLOOP;
IF count # 10 THEN PutFailMessage["10", "XMesa16bx"];
count ← 0;
THROUGH (0..10] DO count ← count + 1; ENDLOOP;
IF count # 10 THEN PutFailMessage["11", "XMesa16bx"];
count ← 0;
THROUGH (0..10) DO count ← count + 1; ENDLOOP;
IF count # 9 THEN PutFailMessage["12", "XMesa16bx"];
};
XMesa16by: PROC = {
Pair: TYPE = PACKED RECORD [int: INT16, card: CARD16];
count: NAT ← 0;
pair: Pair ← [-17, 17];
FOR i: INT16 IN [0..pair.int] DO PutFailMessage["1", "XMesa16by"]; ENDLOOP;
FOR i: INT16 IN [-19..pair.int] DO
IF i # count - 19 THEN PutFailMessage["2", "XMesa16by"];
count ← count + 1;
ENDLOOP;
IF count # 3 THEN PutFailMessage["3", "XMesa16by"];
count ← 0;
FOR i: INT16 IN [0..pair.card] DO
IF count # i THEN PutFailMessage["4", "XMesa16by"];
count ← count + 1;
ENDLOOP;
IF count # pair.card+1 THEN PutFailMessage["5", "XMesa16by"];
count ← 0;
};
XMesa16bz: PROC = {
RT: TYPE = MACHINE DEPENDENT RECORD [
SELECT OVERLAID * FROM
int => [int: INT],
card => [card: CARD],
ENDCASE];
r6: RT ← [int[6]];
r7: RT ← [card[7]];
r6x: RT ← [int[r6.int]];
r7x: RT ← [card[r7.card]];
IF r6 # r6x THEN PutFailMessage["1", "XMesa16bz"];
IF r7 # r7x THEN PutFailMessage["2", "XMesa16bz"];
};
XMesa16ca: PROC = { -- from AR 1502
innerAR1502a: PROC [lo, hi: CARD] = {
i: CARD;
count: CARD ← 0;
delta: CARDIF hi > lo THEN hi-lo ELSE 0;
FOR i IN [lo..hi) DO
i ← i + 1;
count ← count + 1;
ENDLOOP;
IF count # (delta+1)/2 THEN PutFailMessage["1", "XMesa16ca"];
};
innerAR1502b: PROC [lo, hi: INT] = {
i: INT;
count: INT ← 0;
delta: INTIF hi > lo THEN hi-lo ELSE 0;
FOR i IN [lo..hi) DO
i ← i + 1;
count ← count + 1;
ENDLOOP;
IF count # (delta+1)/2 THEN PutFailMessage["2", "XMesa16ca"];
};
innerAR1502a[4, 7];
innerAR1502a[4, 8];
innerAR1502b[4, 7];
innerAR1502b[4, 8];
};
XMesa16cb: PROCEDURE [gmt: GreenwichMeanTime, delta: INT32]
RETURNS [adjusted: GreenwichMeanTime] =
BEGIN
a: CARD64 ¬ gmt + delta;
IF a > CARD64[CARD32.LAST] THEN a ¬ a - CARD32.LAST;
adjusted ¬ [CARD32[a]];
RETURN[adjusted] END;
XMesa16cc: PROCEDURE [gmt: GreenwichMeanTime, delta: INT32]
RETURNS [adjusted: GreenwichMeanTime] =
BEGIN
a: CARD64 ¬ gmt + delta;
last32: CARD64 ¬ CARD32.LAST;
IF a > last32 THEN a ¬ a - CARD32.LAST;
adjusted ¬ [CARD32[a]];
RETURN[adjusted] END;
XMesa16cd: PROCEDURE [gmt: GreenwichMeanTime, delta: INT32]
RETURNS [adjusted: GreenwichMeanTime] =
BEGIN
a: CARD64 ¬ gmt + delta;
last32: CARD64 ¬ CARD64[CARD32.LAST];
IF a > last32 THEN a ¬ a - CARD64[CARD32.LAST];
adjusted ¬ [CARD32[a]];
RETURN[adjusted] END;
XMesa16ce: PROCEDURE = { --from AR 1648
ConvertFloppyItem: PROC = {
s: StringBody;
name: STRINGNIL;
s[0] ← LOOPHOLE[name[0]]
};
};
XMesa16cf: PROCEDURE = { -- from AR 1575
bitsPerWord: NAT = BITS[WORD];
LongNumber: TYPE = MACHINE DEPENDENT RECORD [
SELECT OVERLAID * FROM
real => [real: REAL],
ptr => [ptr: POINTER],
card => [card: CARD32],
int => [int: INT32],
pair => [hi, lo: CARD16],
bytes => [hh, hl, lh, ll: BYTE],
bits => [bits: PACKED ARRAY [0..bitsPerWord) OF BOOL],
ENDCASE
];
VersionStamp: TYPE = ARRAY [0..1] OF CARD;
MyStamp: TYPE = MACHINE DEPENDENT RECORD [lo, num, hi, extra: CARD16];
MyStampToVersionStamp: PROC[stamp: MyStamp] RETURNS[vStamp: VersionStamp] = {
vStamp[0] ← 0;
LOOPHOLE[vStamp[1], LongNumber].hi ← stamp.num;
LOOPHOLE[vStamp[1], LongNumber].lo ← stamp.lo;
};
};
XMesa16cg: PROC = { -- from AR 1531
SetDefaultString: PROCEDURE = {
IsItAReservedDefault[];
};
SetFixedLengthDefaultString: PROCEDURE = {
IsItAReservedDefault[];
};
IsItAReservedDefault: PROCEDURE = INLINE {
GetName: PROCEDURE = {};
};
};
XMesa16ch: PROC = { -- from AR 1505
Data: TYPE = ARRAY [0..10) OF DataObject;
DataObject: TYPE = MONITORED RECORD [
c: CARD];
temp: Data;
data: POINTER TO Data ¬ @temp;
};
XMesa16ci: PROC = { -- from AR 1502
Bytes: TYPE = POINTER TO ByteSequence;
ReadOnlyBytes: TYPE = POINTER TO READONLY ByteSequence;
ByteSequence: TYPE = RECORD [PACKED SEQUENCE COMPUTED CARDINAL OF BYTE];
Context: TYPE = MSBIT WORD16 MACHINE DEPENDENT RECORD [
suffixSize(0): [1..2],
homogeneous(1:0..7): BOOLEAN,
prefix(1:8..15): BYTE];
escapeChar: Character = LOOPHOLE['', WORD16];
Character: TYPE = WORD16;
Lop: PROC [r: Reader] RETURNS [c: Character ← LOOPHOLE['a, WORD16]] = { RETURN[c]};
CharacterLength: PROC [r: Reader, countAccentBaseAsOneChar: BOOLEANFALSE]
RETURNS [nChars: CARDINAL ← 5] = { RETURN[nChars]};
Reader: TYPE = POINTER TO ReaderBody;
ReaderBody: TYPE = PRIVATE RECORD [
context: Context,
limit: CARDINAL,
offset: CARDINAL,
bytes: ReadOnlyBytes];
i: CARD;
r: Reader ← NIL;
tempRB: ReaderBody;
check: BOOLEANFALSE;
checkIndex : CARD ← 1;
FOR i IN [0..CharacterLength[r]) DO
IF Lop[@tempRB] = escapeChar THEN {
i ← i + 1;
IF i >= CharacterLength[r] THEN GOTO invalid;
[] ← Lop[@tempRB];
};
IF (check = TRUE) THEN {
IF (i # checkIndex + 3) THEN {
XMesaProcs.PutFailMessage[1, "XMesa16ci"L];
};
check := FALSE;
};
IF (i = checkIndex) THEN {
check := TRUE;
i := i + 2;
};
ENDLOOP;
EXITS invalid => {};
};
XMesa16cj: PROC = { -- from AR 1499
Rational: TYPE = RECORD [
a, b: CARDINAL];
BmData: TYPE = WORD16 MSBIT MACHINE DEPENDENT RECORD [
signature(0): INT16,
xScale(1): Rational,
yScale(5): Rational,
xDim(9): CARD16,
yDim(10): CARD16,
bpl(11): CARD16,
pages(12): CARDINAL,
bits(14): PACKED ARRAY [0..0) OF BYTE];
BmInfo: TYPE = RECORD[
data: LONG POINTER TO BmData ← NIL,
file: POINTER]; --NSFile.Handle ← NSFile.nullHandle];
bmInfo: BmInfo;
x: Rational ← bmInfo.data.xScale;
y: Rational ← bmInfo.data.yScale;
b: BOOL ← bmInfo.data.xScale = bmInfo.data.yScale;
b: BOOL ← x = y;
};
XMesa16ck: PROC = { -- from ar 1485
DS: TYPE = POINTER;
InternalError: ERROR = CODE;
AbortStream1: PROCEDURE [] = {InitiateAbort[GetActiveDS[! ABORTED => CONTINUE]]};
InitiateAbort: PROCEDURE [ds: DS] = {};
GetActiveDS: PROCEDURE RETURNS [ds: DS] = INLINE {
ds ← NIL;
ActivateDS[ds]
};
ActivateDS: PROCEDURE [ds: DS] = {};
};
XMesa16cl: PROC = { -- from ar 1477
HexDigit: TYPE = [0..16);
OctalDigit: TYPE = [0..8);
Format: TYPE = MSBIT WORD16 MACHINE DEPENDENT RECORD [var(0): SELECT OVERLAID * FROM
real => [
unused(0:0..7): BYTE ← 0,
protection(0:8..8): BOOLEANFALSE,
type(0:9..11): OctalDigit,
special(0:12..15): HexDigit],
bytes => [
hi(0:0..7): BYTE ← 0,
lo(0:8..15): BYTE ← 0],
ENDCASE];
format: Format ← [real[unused: 0, protection: TRUE, type: 7, special: 0]];
b: CARD;
SELECT format.type FROM
0 => b ← 2;
7 => b ← 1;
ENDCASE => NULL;
};
XMesa16cm: PROC = { -- from AR 1474
ErrorType: TYPE = {volumeLocked, fullScavengeRequired};
Handle: TYPE = XMesaCmplr16DefsA.HHandle;
ScavContext: TYPE = POINTER TO ScavContextRecord;
ScavContextRecord: TYPE = RECORD [
volumePath: ReaderBody := nullReaderBody,
z: UNCOUNTED ZONE := NIL];
ReadOnlyBytes: TYPE = POINTER TO READONLY ByteSequence;
ByteSequence: TYPE = RECORD [PACKED SEQUENCE COMPUTED CARDINAL OF BYTE];
Reader: TYPE = POINTER TO ReaderBody;
ReaderBody: TYPE = PRIVATE RECORD [
context: Context,
limit: CARDINAL,
offset: CARDINAL,
bytes: ReadOnlyBytes];
Bytes: TYPE = POINTER TO ByteSequence;
WriterBody: TYPE = PRIVATE RECORD [
context: Context,
limit: CARDINAL,
offset: CARDINAL,
bytes: Bytes,
maxLimit: CARDINAL,
endContext: Context,
zone: UNCOUNTED ZONE];
Context: TYPE = MSBIT WORD16 MACHINE DEPENDENT RECORD [
suffixSize(0): [1..2],
homogeneous(1:0..7): BOOLEAN,
prefix(1:8..15): BYTE];
nullReaderBody: ReaderBody = [limit: 0, offset: 0, bytes: NIL, context: unknownContext];
unknownContext: Context = [suffixSize: 1, homogeneous: FALSE, prefix: 377B];
Error: ERROR [type: ErrorType] = CODE;
ScavengeInternal: PROCEDURE [context: ScavContext] = {
errorToRaise: ErrorType;
{ -- scope of EXITS
ENABLE
Error => errorToRaise := type;
IF context = NIL THEN GOTO errorExit;
EXITS
errorExit =>
{
ENABLE Error => CONTINUE;
ERROR Error[errorToRaise]
};
};
}; -- of ScavengeInternal
CreateTable: PROC [context: ScavContext] = {};
DeleteTable: PROC [context: ScavContext] = {};
CopyToNewWriterBody: PROCEDURE [
r: Reader, z: UNCOUNTED ZONE, endContext: Context ← unknownContext,
extra: CARDINAL ← 0]
RETURNS [
w: WriterBody ← [[1, FALSE, 0], 0, 0, NIL, 0, [1, FALSE, 0], NIL]]
= {
RETURN[w]
};
ByteLength: PROC [r: Reader] RETURNS [CARDINAL] = INLINE {
RETURN[IF r = NIL THEN 0 ELSE r.limit - r.offset]};
NormalScavenge: PROCEDURE [context: ScavContext] = {
volPath: WriterBody := CopyToNewWriterBody[
@context.volumePath, context.z, ,
1024 - ByteLength[@context.volumePath]];
{ENABLE UNWIND => NULL;
FOR i: CARDINAL IN [0..10 ) DO
{
ENABLE UNWIND => NULL;
pathnameError: ERROR = CODE;
basic: Handle ← LOOPHOLE[0, Handle];
Acquire: PROCEDURE []
RETURNS [file: Handle] = {RETURN[basic]};
GetPathname[! pathnameError => LOOP];
};
ENDLOOP;
};
};
CheckTmpDir: PROCEDURE [context: ScavContext] = {};
GetPathname: PROC = {};
};
XMesa16cn: PROC = { -- from AR 1459
caseOffset: NAT = 'a - 'A;
Upper: PROC [ch: CHAR] RETURNS [CHAR] = INLINE {
RETURN [IF ch IN ['a..'z] THEN ch - caseOffset ELSE ch]
};
Proc: PROC = {
c1: CHAR ← 'a;
b: BOOL ← c1 # Upper[c1];
};
};
XMesa16co: PROC = {
VersionKind: TYPE = {numeric, none, lowest, highest, next, all};
Version: TYPE = RECORD [
versionKind: VersionKind,
version: CARDINAL ← 0
];
InfoKind: TYPE ~ { caseHint, file, subdirectory };
Info: TYPE ~ RECORD [
name: CARD, -- ROPE,
kind: InfoKind,
version: Version
];
InfoSet: TYPE ~ REF InfoSetObject;
InfoSetObject: TYPE ~ RECORD [
size: CARDINAL,
info: SEQUENCE maxSize: CARDINAL OF Info
];
maxMaxSize: CARDINAL ← (CARDINAL.LAST - SIZE[InfoSetObject[0]] - 10) / SIZE[Info];
};
mainline
RunRegressions.RegisterTest[XMesaCall16, "test16"];
}...