QCard:
CEDAR
DEFINITIONS =
BEGIN
QCARD: TYPE = ARRAY [0..4) OF CARDINAL ← ALL[0];
CARD: TYPE = LONG CARDINAL;
QCError: SIGNAL[desc: IO.ROPE];
QCZero: PROC[x: QCARD ] RETURNS[z: BOOL ];
QCComp: PROC[x, y: QCARD ] RETURNS[c: Compare];
QCSftLt: PROC[x: QCARD, in, size: CARDINAL ] RETURNS[z: QCARD, out: CARDINAL];
QCSftRt: PROC[x: QCARD, in, size: CARDINAL ] RETURNS[z: QCARD, out: CARDINAL];
QCAdd: PROC[x, y: QCARD, cIn: CARDINAL ] RETURNS[cOut: CARDINAL, sum: QCARD];
QCSub: PROC[x, y: QCARD, cIn: CARDINAL ] RETURNS[cOut: CARDINAL, dif: QCARD];
QCDiv: PROC[num: QCARD, den: CARDINAL] RETURNS[qRes: QCARD, mRes: CARDINAL];
QCDivDbl: PROC[numH,numL, den: QCARD] RETURNS[qRes: QCARD, mRes: QCARD];
QCMul: PROC[x: QCARD, y: CARDINAL ] RETURNS[carry: CARDINAL, prod: QCARD];
QCMulDbl: PROC[x: QCARD, y: QCARD ] RETURNS[ prodH, prodL: QCARD];
QCOut: PROC[card: CARD] RETURNS[qcard: QCARD];
QCIn: PROC[qcard: QCARD] RETURNS[card: CARD];
QCFromRope: PROC[rope: IO.ROPE, base: [2..36] ← 10] RETURNS[qcard: QCARD];
QCToRope:
PROC[
qcard: QCARD,
just: Justification ← right,
fieldWidth: CARDINAL ← 0,
base: [2..36] ← 10]
RETURNS[rope: IO.ROPE];
Justification: TYPE = {right, zerofill, left} ← right;
Compare: TYPE = {eq, gr, ls} ← eq;
END.