MoberyCommandsImpl.mesa
Copyright Ó 1991 by Xerox Corporation. All rights reserved.
Michael Plass, September 27, 1991 12:12 pm PDT
DIRECTORY Mobery, MobDefs, Commander, CommanderOps, IO, Rope, FS;
MoberyCommandsImpl: CEDAR PROGRAM
IMPORTS Mobery, Commander, CommanderOps, IO, FS
~ BEGIN
MobStampCommand: Commander.CommandProc ~ {
ENABLE {
FS.Error => CommanderOps.Failed[error.explanation];
};
arg: Rope.ROPE ¬ CommanderOps.NextArgument[cmd];
IF arg = NIL THEN CommanderOps.Failed[cmd.procData.doc];
IO.PutF1[cmd.out, "%L", [rope["f"]]];
FOR arg ¬ arg, CommanderOps.NextArgument[cmd] UNTIL arg = NIL DO
stamp: MobDefs.VersionStamp;
name: Rope.ROPE;
[stamp, name] ¬ Mobery.StampAndNameFromFile[arg];
IO.PutF[cmd.out, "%08x%08x %g\n", [cardinal[stamp[0]]], [cardinal[stamp[1]]], [rope[name]]];
ENDLOOP;
IO.PutF1[cmd.out, "%L", [rope["F"]]];
};
MobStampsCommand: Commander.CommandProc ~ {
ENABLE {
FS.Error => CommanderOps.Failed[error.explanation];
};
arg: Rope.ROPE ¬ CommanderOps.NextArgument[cmd];
IF arg = NIL THEN CommanderOps.Failed[cmd.procData.doc];
IO.PutF1[cmd.out, "%L", [rope["f"]]];
FOR arg ¬ arg, CommanderOps.NextArgument[cmd] UNTIL arg = NIL DO
EachStamp: Mobery.EnumerateStampProc ~ {
PROC [name, stampClass: ROPE, stamp: VersionStamp] RETURNS [BOOL]
IO.PutFL[cmd.out, "%08x%08x %g(%g)\n", LIST[[cardinal[stamp[0]]], [cardinal[stamp[1]]], [rope[name]], [rope[stampClass]]]];
RETURN [FALSE]
};
Mobery.EnumerateStampTable[Mobery.ReadStampTable[arg], EachStamp];
IO.PutRope[cmd.out, "\n"];
ENDLOOP;
IO.PutF1[cmd.out, "%L", [rope["F"]]];
};
Commander.Register["MobStamp", MobStampCommand, "Get the mob stamp from .mob or .o files"];
Commander.Register["MobStamps", MobStampsCommand, "Get all mob stamps from .mob or .o files"];
END.