StdCorpse1.mesa
Copyright Ó 1993 by Xerox Corporation. All rights reserved.
Spreitze, October 2, 1990 8:01 am PDT
Laurie Horton, September 17, 1992 9:12 am PDT
DIRECTORY Commander, IO, Rope;
StdCorpse1: CEDAR PROGRAM
IMPORTS Commander, IO, Rope=
BEGIN
ROPE: TYPE ~ Rope.ROPE;
rgv1: ROPE ¬ "rgv1";
rgv2: ROPE ¬ "rgv 2";
rag1: REF ANY ¬ $AnAtom;
ag1: ATOM ¬ $AnotherAtom;
rSeven: REF INT ¬ NEW [INT ¬ 7];
rEight: REF INT ¬ NEW [INT ¬ 8];
int16a: INT16 ¬ 32767;
int16b: INT16 ¬ -32768;
int16c: INT16 ¬ 5;
int16d: INT16 ¬ 20;
int16e: INT16 ¬ -10;
Die: Commander.CommandProc = {
rlv: ROPE ¬ cmd.commandLine;
out: IO.STREAM ¬ cmd.out;
five: INT ¬ 5;
rSix: REF INT ¬ NEW [INT ¬ 6];
out.PutRope["Deth here.\n"];
ERROR;
};
Die2: Commander.CommandProc = {
rlv: ROPE ¬ cmd.commandLine;
out: IO.STREAM ¬ cmd.out;
five: INT ¬ 5;
rSix: REF INT ¬ NEW [INT ¬ 6];
out.PutRope["Deth2 here.\n"];
ERROR;
};
Die3: Commander.CommandProc = {
rlv: ROPE ¬ cmd.commandLine;
out: IO.STREAM ¬ cmd.out;
five: INT ¬ 5;
rSix: REF INT ¬ NEW [INT ¬ 6];
sum: INT ¬ IntAdd[five, rSix­];
out.PutRope["Deth2 here.\n"];
ERROR;
};
IntAdd: PROC [a, b: INT] RETURNS [c: INT] ~ {
c ¬ a + b;
RETURN;
};
Cat: PROC [r1, r2: ROPE] RETURNS [ROPE]
~ {RETURN r1.Concat[r2]};
AnaRope: PROC [r: ROPE] RETURNS [len: INT, chars: ARRAY [0 .. 9] OF CHAR ¬ ALL[' ]] ~ {
len ¬ r.Length[];
FOR i: INT IN [0 .. MIN[len, 10]) DO chars[i] ¬ r.Fetch[i] ENDLOOP;
RETURN};
FromChar: PROC [CHAR] RETURNS [ROPE] ¬ Rope.FromChar;
Commander.Register["StdCorpse1.Die", Die, "Raise the unnamed ERROR"];
Commander.Register["StdCorpse1.Die2", Die2, "Raise the unnamed ERROR"];
Commander.Register["StdCorpse1.Die3", Die3, "Raise the unnamed ERROR"];
END.