-- file CommandUtil.Mesa
-- last modified by Satterthwaite, December 10, 1982 10:32 am
-- last edit by Russ Atkinson, 19-Dec-80 13:22:44

DIRECTORY
  ExecOps: TYPE USING [Command],
  Stream: TYPE USING [Handle],
  Strings: TYPE USING [String, SubString];

CommandUtil: DEFINITIONS = {

  Command: TYPE = ExecOps.Command;
  CommandObject: TYPE = RECORD [pos, len: CARDINAL, data: Command];
  CommandPtr: TYPE = POINTER TO CommandObject;

  PairList: TYPE [SIZE[LONG POINTER]];

  CopyString: PROC [s: Strings.String, extra: CARDINAL←0] RETURNS [Strings.String];
  Echo: PROC [
	d: Stream.Handle,
	operator: Strings.String,
	argList, resultList: PairList,
	switches: Strings.String];
  FreePairList: PROC [PairList] RETURNS [PairList];
  FreeString: PROC [Strings.String] RETURNS [Strings.String];
  GetNthPair: PROC [list: PairList, n: CARDINAL, delete: BOOL←FALSE]
      RETURNS [key,value: Strings.String];
  GetNth: PROC [list: PairList, n: CARDINAL, delete: BOOL←FALSE]
        RETURNS [Strings.String] = INLINE {
      RETURN [GetNthPair[list, n, delete].value]};
  KeyValue: PROC [key: Strings.SubString, list: PairList, delete: BOOL←FALSE]
      RETURNS [Strings.String];
  ListLength: PROC [list: PairList] RETURNS [CARDINAL];
  Parse: PROC [s: CommandPtr, opX, argX, resultX: CARDINAL←0]
      RETURNS [
	operator: Strings.String,
	argList, resultList: PairList,
	switches: Strings.String];
  SetExtension: PROC [root, defaultExt: Strings.String] RETURNS [name: Strings.String];
  SkipNonBlank: PROC [s: Stream.Handle, n: CARDINAL←1];

  Failed: ERROR;

  }.