DIRECTORY Commander, CommanderOps, IO, PFS, Profiles, Rope; TestProfiles: CEDAR PROGRAM IMPORTS Commander, CommanderOps, IO, PFS, Profiles ~ BEGIN ROPE: TYPE = Rope.ROPE; profile: Profiles.Profile ¬ NIL; CreateProfile: Commander.CommandProc ~ { tokens: LIST OF ROPE ¬ CommanderOps.ParseToList[cmd: cmd].list; IF tokens=NIL THEN RETURN[$Failure, "Can't find any filenames\n"]; profile ¬ Profiles.Create[tokens ! PFS.Error => {msg ¬ error.explanation ; GOTO Oops} ]; EXITS Oops => RETURN [$Failure]; }; ProfileLine: Commander.CommandProc ~ { IF profile=NIL THEN RETURN [$Failure, "Can't find profile on property list"]; FOR tokens: LIST OF ROPE ¬ CommanderOps.ParseToList[cmd: cmd].list, tokens.rest UNTIL tokens=NIL DO IO.PutF[stream: cmd.out, format: "Key: %g, Value: %g\n", v1: [rope[tokens.first]], v2: [rope[Profiles.Line[profile, tokens.first, "(not found)"]]]]; ENDLOOP; }; Init: PROC ~ { Commander.Register[key: "CreateProfile", proc: CreateProfile, doc: "Create a profile from the list of filenames on the command line\n"]; Commander.Register[key: "ProfileLine", proc: ProfileLine, doc: "Look up the keys on the command line in the profile stored on the command tool's property list\n"]; }; Init[]; END. : TestProfiles.mesa Copyright Σ 1988, 1989, 1990, 1991 by Xerox Corporation. All rights reserved. Dave Rumph, January 18, 1990 10:28:37 am PST Michael Plass, November 25, 1991 11:24 am PST PROC [cmd: Handle] RETURNS [result: REF _ NIL, msg: ROPE _ NIL] profile: Profiles.Profile _ NIL; cmd.propertyList _ CommanderOps.PutLocalProperty[key: $TestProfile, val: profile, aList: cmd.propertyList, origList: cmd.propertyList]; PROC [cmd: Handle] RETURNS [result: REF _ NIL, msg: ROPE _ NIL] profile: Profiles.Profile _ NARROW[CommanderOps.GetProp[cmd, $TestProfile]]; Κt–(cedarcode) style•NewlineDelimiter ™code™Kšœ ΟeœC™NK™,K™-K™KšΟk œžœžœ˜;K˜—šΟn œžœž˜Kšžœžœžœ˜2Kšœž˜K˜Kšžœžœžœ˜K˜Kšœžœ˜ —K˜šŸ œ˜(Kš žœžœ žœžœžœžœ™?Kšœžœ™ K•StartOfExpansionI[cmd: Commander.Handle, starExpand: BOOL _ FALSE, switchChar: CHAR]šœžœžœžœ+˜?Kšžœžœžœžœ)˜B–[error: FS.ErrorDesc]šœ"˜"Kšžœ%žœ˜2Kšœ˜—Kšœ‡™‡Kšžœ žœ ˜ K˜K˜—šŸ œ˜&Kš žœžœ žœžœžœžœ™?Kšœžœ*™LK–I[cmd: Commander.Handle, starExpand: BOOL _ FALSE, switchChar: CHAR]šžœ žœžœžœ3˜Mš žœ žœžœžœ8žœžœž˜cK–―[stream: STREAM, format: ROPE _ NIL, v1: IO.Value _ [null[]], v2: IO.Value _ [null[]], v3: IO.Value _ [null[]], v4: IO.Value _ [null[]], v5: IO.Value _ [null[]]]šžœ’˜”Kšžœ˜—K˜K˜—šŸœžœ˜K–x[key: ROPE, proc: Commander.CommandProc, doc: ROPE _ NIL, clientData: REF ANY _ NIL, interpreted: BOOL _ TRUE]˜ˆK–x[key: ROPE, proc: Commander.CommandProc, doc: ROPE _ NIL, clientData: REF ANY _ NIL, interpreted: BOOL _ TRUE]˜£Kšœ˜K˜—K˜K˜K˜Kšžœ˜—…—Δ r