(*======================================================================*)
(*                          Support routines                            *)
(*======================================================================*)
(*      Version: 1.00           Author : Dennis Brueni                  *)
(*      Date   : 07-23-91       Changes: Original                       *)
(*======================================================================*)

DEFINITION MODULE Args;

CONST MaxArg     = 127;
      MaxArgSize = 511;

(*----------------------------------------------------------------------*)
(* 'argc' indicates the number of arguments parsed so far. 'argv' is an *)
(* array of pointers to strings. These strings are the actual           *)
(* arguments. argv[0] points to the current program's filename.         *)
(*----------------------------------------------------------------------*)

VAR argc : CARDINAL;
    argv : ARRAY [0..MaxArg] OF POINTER TO ARRAY [0..MaxArgSize] OF CHAR;

(*----------------------------------------------------------------------*)
(* ADDARGS    - This procedure will parse a string and add the args     *)
(*              found in it to the 'argv' array, and increment 'argc'   *)
(*              as appropriate.  A special charactoristic of this is    *)
(*              that special charactors !,#,$,%,&,',(,),*,+,comma,- are *)
(*              parsed out into separate one-charactor strings.  This   *)
(*              simplifies the writing of parsers built on top of this  *)
(*              module.                                                 *)
(*            - As usual, Inter-argument spacing and tabs are removed.  *)
(*            - If an argument is contained in double quotes, the       *)
(*              quotes are stripped away.  A double quote may be placed *)
(*              in an argument by using \"                              *)
(*            - Storage for copies of the arguments is dynamically      *)
(*              allocated.                                              *)
(*                                                                      *)
(* EXAMPLE      string = 'Wow!,this is "great""\""+2                    *)
(*              argv[oldargc+0] = '                                     *)
(*              argv[oldargc+1] = Wow                                   *)
(*              argv[oldargc+2] = !                                     *)
(*              argv[oldargc+3] = ,                                     *)
(*              argv[oldargc+4] = this                                  *)
(*              argv[oldargc+5] = is                                    *)
(*              argv[oldargc+6] = great                                 *)
(*              argv[oldargc+7] = "                                     *)
(*              argv[oldargc+8] = +                                     *)
(*              argv[oldargc+9] = 2                                     *)
(*              argc = oldargc+10                                       *)
(*----------------------------------------------------------------------*)

PROCEDURE AddArgs(string: ARRAY OF CHAR);

(*----------------------------------------------------------------------*)
(* TERMPROC     Cleanup code (reply to WBMsg for Amiga).                *)
(*----------------------------------------------------------------------*)

PROCEDURE TermProc;

END Args.
