DIRECTORY IO USING [STREAM], List USING [AList], Rope USING [ROPE]; Commander: CEDAR DEFINITIONS = BEGIN CommandProc: TYPE = PROC [cmd: Handle] RETURNS [result: REF _ NIL, msg: Rope.ROPE _ NIL]; Register: PROC[key: Rope.ROPE, proc: CommandProc _ NIL, doc: Rope.ROPE _ NIL, clientData: REF ANY _ NIL]; Handle: TYPE = REF CommandObject; CommandObject: TYPE = RECORD [ in, out, err: IO.STREAM _ NIL, commandLine: Rope.ROPE, command: Rope.ROPE _ NIL, propertyList: List.AList _ NIL, procData: CommandProcHandle _ NIL ]; CommandProcHandle: TYPE = REF CommandProcObject; CommandProcObject: TYPE = RECORD [ proc: Commander.CommandProc _ NIL, doc: Rope.ROPE _ NIL, clientData: REF ANY _ NIL ]; Enumerate: PROC[PROC[key: Rope.ROPE, procData: CommandProcHandle] RETURNS[stop: BOOL]] RETURNS [key: Rope.ROPE, procData: CommandProcHandle]; Lookup: PROC[key: Rope.ROPE] RETURNS [procData: CommandProcHandle]; PutProperty: PUBLIC PROCEDURE [key: REF ANY, val: REF ANY, aList: List.AList] RETURNS [List.AList]; GetProperty: PROCEDURE [key: REF ANY, aList: List.AList] RETURNS [val: REF ANY]; END. àCommander.mesa; Last Modified by McGregor on 7-Dec-81 10:53:03 Last Modified On March 22, 1983 12:25 pm By Paul Rovner Last Modified On September 9, 1983 11:40 am By L. Stewart A CommandProc represents a function which a user can invoke from a CommandTool. The result will be stored in the CommandTool property list under the key $Result for the possible use by the suceeding command. Any result other than the ATOM $Failure is deemed to indicate some sort of success. A command may be unregistered by registering proc: NIL with the appropriate key. Case is ignored for keys. in and out may be redirected. err is a bidirectional stream which always allows communication with the user. UserAbort is indicated only by in.UserAborted[]. commandLine is the command line with the first "token" (as defined by IO.GetCedarToken) removed; commandLine ends with CR The first token on the command line, used as a key to select this CommandProc. This rope will be the key under which the command was registered, rather than the (possibly) prefix of that string by which the command was invoked. Name value pairs. The key $Result will be associated with the result of the previous command. The command line unprocessed by the CommandTool will be found under $OriginalCommandLine. A CommandProc may alter the property list either by appending to it, in which case the changes are permanent (seen by later commands), or by prepending, in which case the changes will be discarded when the CommandProc returns. Changes made to the value fields of existing properties are always permanent. This field contains the information registered with the CommandProc, doc and clientData may be useful to the authors of commands. Commands are not enumerated in any particular order. The following procedures are useful for manipulating propertyLists. PutProperty is like List.PutAssoc, except that it works correctly if the key is a ROPE. GetProperty is like List.Assoc, except that it works correctly if the key is a ROPE. Ê€˜šœ™Jšœ.™.Jšœ7™7Jšœ9™9J˜šÏk ˜ Jšœœœ˜Jšœœ ˜Jšœœœ˜——J˜Jšœ œ œ˜$J˜šÏn œœœœ œœ œœ˜Y™OJ™Ô—J™—šžœœ œœ œœœœœ˜iJ™kJ˜—Jšœœœ˜!J˜šœœœ˜šœœœœ˜J™Ÿ—šœœ˜Jšœy™y—šœœœ˜Jšœä™ä—šœœ˜J™ì—šœ˜!J™—Jšœ˜—J˜Jšœœœ˜0J˜šœœœ˜"Jšœœ˜"Jšœ œœ˜Jšœ œœ˜Jšœ˜—J˜šž œœœ œœœœ œ˜J™4—J˜Jšžœœ œœ˜CJ˜J™CJ™JšœW™WJ™Jšž œœ œœœœœœ˜cJ˜JšœT™TJ™šž œ œœœœœœ˜PJ˜—Jšœ˜—…—H¨