DIRECTORY Ascii USING [Lower], Commander USING [CommandProc, Register, Handle], CommandTool USING [ArgumentVector, Parse, Failed], DFInternal USING [DefaultInteractionProc], DFOperations USING [BringOver, BringOverAction, BringOverFilter, SModel, SModelAction, Verify], IO USING [PutF, STREAM], Rope USING [Compare, Concat, Fetch, Find, Length, Match, ROPE, Substr]; DFCommands: CEDAR PROGRAM IMPORTS Ascii, Commander, CommandTool, DFInternal, DFOperations, IO, Rope = BEGIN ROPE: TYPE = Rope.ROPE; STREAM: TYPE = IO.STREAM; DoBringover: Commander.CommandProc = { errors, warnings, filesActedUpon: INT; oSwitch: BOOL _ FALSE; out: STREAM = cmd.out; filter: DFOperations.BringOverFilter _ [filterA: $all, filterB: $all, filterC: $all, list: NIL]; action: DFOperations.BringOverAction _ $enter; argv: CommandTool.ArgumentVector _ CommandTool.Parse[cmd ! CommandTool.Failed => {msg _ errorMsg; GO TO fail}]; IF argv = NIL OR argv.argc < 2 THEN {msg _ bringoverHelpText; GO TO fail}; FOR i: NAT IN [1..argv.argc) DO arg: ROPE = argv[i]; IF Rope.Match["-*", arg] THEN { FOR j: INT IN [1..Rope.Length[arg]) DO c: CHAR _ Ascii.Lower[Rope.Fetch[arg, j]]; SELECT c FROM 'b => filter.filterA _ $derived; 'f => action _ $fetch; 'o => {oSwitch _ TRUE; filter.list _ NIL}; 'p => filter.filterB _ $public; 'r => filter.filterC _ $imported; 's => filter.filterA _ $source; 'u => {filter _ [filterA: $all, filterB: $all, filterC: $all, list: NIL]; action _ $enter}; 'v => action _ $check; 'w => filter.filterC _ $defining; 'x => oSwitch _ FALSE; ENDCASE; ENDLOOP; LOOP; }; IF oSwitch AND i < argv.argc-1 THEN { filter.list _ CONS[arg, filter.list]; LOOP; }; [errors, warnings, filesActedUpon] _ DFOperations.BringOver[ dfFile: CompleteDFFileName[arg], filter: filter, action: action, interact: DFInternal.DefaultInteractionProc, clientData: NIL, log: out]; filter.list _ NIL; oSwitch _ FALSE; IF errors + warnings # 0 THEN IO.PutF[out, "%g errors, %g warnings, %g files acted upon\n", [integer[errors]], [integer[warnings]], [integer[filesActedUpon]]] ELSE IO.PutF[out, "%g files acted upon\n", [integer[filesActedUpon]]]; ENDLOOP; EXITS fail => result _ $Failure; }; DoSModel: Commander.CommandProc = { errors, warnings, filesActedUpon: INT; oSwitch: BOOL _ FALSE; out: STREAM = cmd.out; action: DFOperations.SModelAction _ [remoteCheck: TRUE, storeChanged: TRUE]; argv: CommandTool.ArgumentVector _ CommandTool.Parse[cmd ! CommandTool.Failed => {msg _ errorMsg; GO TO fail}]; IF argv = NIL OR argv.argc < 2 THEN {msg _ smodelHelpText; GO TO fail}; FOR i: NAT IN [1..argv.argc) DO arg: ROPE = argv[i]; IF Rope.Match["-*", arg] THEN { FOR j: INT IN [1..Rope.Length[arg]) DO c: CHAR _ Ascii.Lower[Rope.Fetch[arg, j]]; SELECT c FROM 'd => action.remoteCheck _ FALSE; 'n => action.storeChanged _ FALSE; 'u => action.storeChanged _ action.remoteCheck _ TRUE; ENDCASE; ENDLOOP; LOOP; }; [errors, warnings, filesActedUpon] _ DFOperations.SModel[ dfFile: CompleteDFFileName[arg], action: action, interact: DFInternal.DefaultInteractionProc, clientData: NIL, log: out]; IF errors + warnings # 0 THEN IO.PutF[out, "%g errors, %g warnings, %g files acted upon\n", [integer[errors]], [integer[warnings]], [integer[filesActedUpon]]] ELSE IO.PutF[out, "%g files acted upon\n", [integer[filesActedUpon]]]; ENDLOOP; EXITS fail => result _ $Failure; }; DoVerifyDF: Commander.CommandProc = { errors, warnings, filesActedUpon: INT; oSwitch: BOOL _ FALSE; out: STREAM = cmd.out; argv: CommandTool.ArgumentVector _ CommandTool.Parse[cmd ! CommandTool.Failed => {msg _ errorMsg; GO TO fail}]; IF argv = NIL OR argv.argc < 2 THEN {msg _ verifydfHelpText; GO TO fail}; FOR i: NAT IN [1..argv.argc) DO arg: ROPE = argv[i]; IF Rope.Match["-*", arg] THEN LOOP; [errors, warnings, filesActedUpon] _ DFOperations.Verify[ dfFile: CompleteDFFileName[arg], interact: DFInternal.DefaultInteractionProc, clientData: NIL, log: out]; IF errors + warnings # 0 THEN IO.PutF[out, "%g errors, %g warnings, %g files acted upon\n", [integer[errors]], [integer[warnings]], [integer[filesActedUpon]]] ELSE IO.PutF[out, "%g files acted upon\n", [integer[filesActedUpon]]]; ENDLOOP; EXITS fail => result _ $Failure; }; CompleteDFFileName: PROC [dfFileName: ROPE] RETURNS [ROPE] = { length: INT = dfFileName.Length[]; IF length < 4 OR (Rope.Compare[Rope.Substr[dfFileName, length - 3, 3], ".df", FALSE] # equal AND Rope.Find[dfFileName, "!"] = -1) THEN RETURN[Rope.Concat[dfFileName, ".df"]] ELSE RETURN[dfFileName]; }; bringoverHelpText: ROPE = "Usage: Bringover {-p (access: public), -s (origin: source), -b (origin: derived), -r (reference: imported), -w (reference: defining), -v (action: check), -f (action: fetch), -o list-of-files (selected files: list-of-files) -u (use defaults)} dfFile\nUnless changed by switches, Bringover uses (Auto-Confirm: yes, access: all, origin: all, reference: all, selected files: (no filtering), action: enter).\n"; smodelHelpText: ROPE = "Usage: SModel {-d (Check on server: no),\n\t-n (Store changed files: no)} dfFile\nUnless changed by switches, SModel uses (Auto-Confirm: yes, Check existence on server: yes, Store changed files: yes).\n"; verifydfHelpText: ROPE = "Usage: VerifyDF dfFile\nVerifyDF uses (Auto-Confirm: yes).\n"; Commander.Register["Bringover", DoBringover, bringoverHelpText]; Commander.Register["SModel", DoSModel, smodelHelpText]; Commander.Register["VerifyDF", DoVerifyDF, verifydfHelpText]; END. 0DFCommands.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Russ Atkinson (RRA) January 21, 1985 6:41:18 pm PST PROC [cmd: Commander.Handle] RETURNS [result: REF _ NIL, msg: Rope.ROPE _ NIL] just add this file to the filter list At this point we can do the bringover of the file. PROC [cmd: Commander.Handle] RETURNS [result: REF _ NIL, msg: ROPE _ NIL] At this point we can do the smodel of the file. PROC [cmd: Commander.Handle] RETURNS [result: REF _ NIL, msg: Rope.ROPE _ NIL] At this point we can do the verification of the file. Κ'˜šœ™Jšœ Οmœ1™Kšœžœ˜"šžœ žœ>žœ ˜\Kšžœ!˜$Kšžœžœ ˜+—Kšžœžœ ˜K˜K˜—Kšœžœš˜±KšœžœΠ˜δKšœžœB˜XK˜Kšœ@˜@Kšœ7˜7Kšœ=˜=Iunitšžœ˜J˜—…—"y