PLAOps.mesa
Copyright © 1984 by Xerox Corporation. All rights reserved.
Last edited by Curry, April 4, 1986 2:33:25 pm PST
DIRECTORY IO, Basics, BasicTime, REFBit;
PLAOps: CEDAR DEFINITIONS IMPORTS IO =
BEGIN
PLA:   TYPE = REF PLARec;
PLARec:  TYPE = RECORD [
mask, data, out:  REF,
time:      BasicTime.GMT,
termList:     TermList,
term:      Term,
validTerm:    BOOLFALSE ]; -- for caching reads
BoolExpr:   TYPE = TermList; -- only inputs inportant - all outs are true
Format:   TYPE = REFBit.Format;
FormatSeq:  TYPE = REFBit.FormatSeq;
FormatRec:  TYPE = REFBit.FormatRec;
TermListSeq:  TYPE = REF TermListSeqRec;
TermListSeqRec: TYPE = RECORD[SEQUENCE size: CARDINAL OF TermList];
TermList:  TYPE = REF TermListRec;
TermListRec: TYPE = RECORD[
begin:  Term ← NIL,
end:  Term ← NIL,
length: NAT ← 0,
inBits: NAT ← 0,
outBits: NAT ← 0];
Term:  TYPE = REF TermRec ← NIL;
TermRec: TYPE = RECORD [
use: Use  ← avail,
old: Use  ← avail,
best: Use  ← avail,
kin: TList  ← NIL,
kkin: Term  ← NIL,
last: Term  ← NIL,
next: Term  ← NIL,
in:  QWSeq ← NIL,
out: QWSeq ← NIL ];
TList:    TYPE = LIST OF Term;
TermSeqRec:  TYPE = RECORD[SEQUENCE size: CARDINAL OF Term];
UseSeqRec:  TYPE = RECORD[SEQUENCE size: CARDINAL OF Use];
Use:    TYPE = {avail, skip, used, ess, del} ← avail;
QWSeq:   TYPE = REF QWSeqRec;
QWSeqRec:  TYPE = RECORD[SEQUENCE wdSize: CARDINAL OF QrtWord];
Qrt:    TYPE = {zero, one, dontcare, undefined};
QrtWord:   TYPE = RECORD[m, d: CARDINAL];
initInQrtWdc: QrtWord = [m: 0B, d: 0]; -- init to dontcare
initOutQrtWz: QrtWord = [m: 177777B, d: 0]; -- init to zero
initOutQrtWo: QrtWord = [m: 177777B, d: 177777B]; -- init to one
Trace:   BOOL;
FinishMin: BOOL;
FinishCS:  BOOL;
Abort:   BOOL;
Aborted:    SIGNAL;
InvalidTermRope: SIGNAL[rope: IO.ROPE];
NewPLA:  PROC [inRef, outRef: REF]           RETURNS[pla: PLA];
ReadPLAFile: PROC [fileName: IO.ROPE, log: IO.STREAMIO.noWhereStream] RETURNS[pla: PLA];
WritePLAFile: PROC [fileName: IO.ROPE, log: IO.STREAMIO.noWhereStream,    pla: PLA];
PLAHeader:   PROC[pla: PLA, fileName: IO.ROPENIL] RETURNS[header: IO.ROPE];
DefaultCMDLine:  PROC[cmdLine, default: IO.ROPE] RETURNS[IO.ROPE];
GetBEForDataMask: PROC[pla: PLA] RETURNS[be: BoolExpr];
SetOutForBE:   PROC[pla: PLA, be: BoolExpr];
GetOutForData:  PROC[pla: PLA];
CopyPLASubFields: PROC [refPla: PLA, outRef: REF] RETURNS[newPla: PLA];
NewTerm:  PROC[inBitSize, outBitSize: CARDINAL] RETURNS[new: Term];
CopyTerm:  PROC[ref: Term] RETURNS[new: Term];
AppendTerm: PROC[ref: Term, list: TermList];
ACopy:   PROC[ref: Term, list: TermList]; -- only if significant
DeleteTerm: PROC[old: Term, list: TermList];
SaveTerm:  PROC[old: Term] = INLINE {old.next ← SavedTerms; SavedTerms ← old };
SaveListTerms: PROC[list: TermList] = INLINE {
IF list.end = NIL OR list.begin = NIL THEN RETURN;
list.end.next←SavedTerms; SavedTerms←list.begin; list.begin←list.end←NIL; list.length𡤀};
SavedTerms: Term;
AndTrue: TermList;   -- Only used as default arg for And
OrFalse: TermList = NIL; -- Only used as default arg for Or
Intersection: PROC[ref, test, intersection: Term] RETURNS[valid: BOOL];
Add: PROC[tl1, tl2, tl3, tl4, tl5: TermList ← NIL   ] RETURNS[new: TermList];
And: PROC[tl1, tl2, tl3, tl4, tl5: TermList ← AndTrue] RETURNS[new: TermList];
Or: PROC[tl1, tl2, tl3, tl4, tl5: TermList ← OrFalse  ] RETURNS[new: TermList];
Not: PROC[tl:      TermList     ] RETURNS[new: TermList];
SetInQrt: PROC[q: Qrt, t: Term, index: CARDINAL];
SetOutQrt: PROC[q: Qrt, t: Term, index: CARDINAL];
GetInQrt: PROC[term:Term, index:CARDINAL] RETURNS[q: Qrt];
GetOutQrt: PROC[term:Term, index:CARDINAL] RETURNS[q: Qrt];
InsUsed: PROC[list: TermList] RETURNS[count: CARDINAL];
GetTermVal: PROC[term: Term, list: TermList];
RopeToFormat: PROC[
rope: IO.ROPE]
RETURNS[iFormat, oFormat: Format];
RopeToTerm: PROC[
rope:   IO.ROPE,
list:   TermList,
iFormat:  Format ← NIL,
oFormat:  Format ← NIL]
RETURNS[term: Term];
TermToRope: PROC[
term:   Term,
list:   TermList,
showUse:  BOOLFALSE,
iFormat:  Format ← NIL,
oFormat:  Format ← NIL]
RETURNS[rope: IO.ROPE];
CopyTermList: PROC[
list:  TermList,
firstOut: CARDINAL ← 0,
lastOut: CARDINAL ← 177777B]
RETURNS[newList: TermList];
CopyTermListForField: PROC[
list:  TermList,
firstBit: CARDINAL,
bitSize: CARDINAL ]
RETURNS[newList: TermList];
ListTermList: PROC[
list:   TermList,
showUse:  BOOLFALSE,
omitDeletes: BOOLFALSE,
log:   IO.STREAMIO.noWhereStream,
iFormat:  Format ← NIL,
oFormat:  Format ← NIL];
SortTermList: PROC[
list:  TermList,
bigFirst: BOOLTRUE];
ConvertTermListToCompleteSum: PROC[
list:    TermList,
addMerges:  BOOL,
addConsensus: BOOL,
log:    IO.STREAMIO.noWhereStream]
RETURNS[unfinished: BOOL];
UpdateCompleteSumWithTerm: PROC [
sum:    TermList,
term:    Term,
addMerges:  BOOL,
addConsensus: BOOL,
log:    IO.STREAMIO.noWhereStream]
RETURNS[unfinished: BOOL];
FindAMinimalCover: PROC[
list: TermList,
time: CARDINAL,
log: IO.STREAMIO.noWhereStream]
RETURNS[initEss, initDel, bestCov: CARDINAL, unfinished: BOOL];
TimeOut:  PROC[minutes: CARDINAL];
TimeOutReset: PROC;
TimeOutQuit: PROC;
END.