StdCorpse2.mesa
Copyright Ó 1991 by Xerox Corporation. All rights reserved.
Spreitze, December 22, 1991 9:05 pm PST
DIRECTORY Commander, IO, Rope;
StdCorpse2:
CEDAR
PROGRAM
IMPORTS Commander, IO, Rope=
BEGIN
ROPE: TYPE ~ Rope.ROPE;
Recrd:
TYPE ~
RECORD [
i: INT ← 1,
x: REAL ← 1.0];
rgv1: ROPE ← "rgv1";
rgv2: ROPE ← "rgv 2";
ag1: ATOM ← $AnotherAtom;
rSeven: REF INT ← NEW [INT ← 7];
rEight: REF INT ← NEW [INT ← 8];
dz8: DREAL ← 8.0;
din3: DINT ← -3;
dc7: DCARD ← 7;
rag1: REF ANY ← $AnAtom;
rag2: REF ANY ← rSeven;
rag3: REF ANY ← rgv1;
rag4: REF ANY ← NEW[Recrd ← []];
rag5: REF ANY ← NEW[BOOL ← TRUE];
Die: Commander.CommandProc = {
rlv: ROPE ← cmd.commandLine;
out: IO.STREAM ← cmd.out;
ral1: REF ANY ← cmd.out;
five: INT ← 5;
deth: CHAR ~ rlv.Fetch[0];
Mapper:
PROC [c:
CHAR]
RETURNS [quit:
BOOL ←
FALSE]
~ {IF c=deth THEN ERROR ELSE RETURN[]};
rSix: REF INT ← NEW [INT ← 6];
subj: ROPE ← rlv.Substr[1];
out.PutF["Erring at [%g].\n", [character[deth]] ];
[] ← subj.Map[action: Mapper];
RETURN};
Die2: Commander.CommandProc = {
rlv: ROPE ← cmd.commandLine;
out: IO.STREAM ← cmd.out;
five: INT ← 5;
Mapper2:
PROC [c:
CHAR]
RETURNS [quit:
BOOL ←
FALSE]
~ {deth: CHAR ~ rlv.Fetch[0]; IF c=deth THEN ERROR ELSE RETURN[]};
rSix: REF INT ← NEW [INT ← 6];
subj: ROPE ← rlv.Substr[1];
out.PutF["Erring at [%g].\n", [character[rlv.Fetch[0]]] ];
[] ← subj.Map[action: Mapper2];
RETURN};
Die3: Commander.CommandProc = {
rlv: ROPE ← cmd.commandLine;
out: IO.STREAM ← cmd.out;
five: INT ← 5;
Mapper3:
PROC [c:
CHAR]
RETURNS [quit:
BOOL ←
FALSE]
~ {IF c='x THEN ERROR ELSE RETURN[]};
rSix: REF INT ← NEW [INT ← 6];
subj: ROPE ← rlv.Substr[1];
out.PutF["Erring at [x].\n" ];
[] ← subj.Map[action: Mapper3];
RETURN};
Die4: Commander.CommandProc = {
rlv: ROPE ← cmd.commandLine;
out: IO.STREAM ← cmd.out;
five: INT ← 5;
rSix: REF INT ← NEW [INT ← 6];
subj: ROPE ← rlv.Substr[1];
out.PutF["Deth4 here.\n" ];
{ENABLE IO.Error => CONTINUE;
z: REAL ← 3.141592653589793;
four: CARD ← five-1;
Mapper4:
PROC [c:
CHAR]
RETURNS [quit:
BOOL ←
FALSE] ~ {
deth: CHAR ~ rlv.Fetch[0];
IF c=deth OR four=CARD[five] THEN ERROR ELSE RETURN[]};
IF cmd#
NIL
THEN {
x: ROPE ~ subj;
[] ← x.Map[action: Mapper4];
};
};
RETURN};
Die5: Commander.CommandProc = {
ENABLE IO.Error => {result ← $Failure; CONTINUE};
rlv: ROPE ← cmd.commandLine;
out: IO.STREAM ← cmd.out;
five: INT ← 5;
deth: CHAR ~ rlv.Fetch[0];
Mapper5:
PROC [c:
CHAR]
RETURNS [quit:
BOOL ←
FALSE]
~ {IF c=deth THEN ERROR ELSE RETURN[]};
rSix: REF INT ← NEW [INT ← 6];
subj: ROPE ← rlv.Substr[1];
out.PutF["Erring at [%g].\n", [character[deth]] ];
[] ← subj.Map[action: Mapper5];
RETURN};
Croak: PROC ~ {ERROR};
ExternalNames:
PROC =
TRUSTED
MACHINE
CODE {
"^ExternalNames\n";
"Croak Croak\n";
};
ExternalNames[];
Commander.Register["StdCorpse2.Die", Die, "Raise the unnamed ERROR"];
Commander.Register["StdCorpse2.Die2", Die2, "Raise the unnamed ERROR"];
Commander.Register["StdCorpse2.Die3", Die3, "Raise the unnamed ERROR"];
Commander.Register["StdCorpse2.Die4", Die4, "Raise the unnamed ERROR"];
Commander.Register["StdCorpse2.Die5", Die5, "Raise the unnamed ERROR"];
END.