home *** CD-ROM | disk | FTP | other *** search
-
- #ifdef COMMENT
- /*
- /* This file describes the use of files: argparse.h, argbegin.h, argloop.h,
- /* and argend.h. Those files make a more portable implementation of the
- /* macros defined and described in the file argpar.h.
- /* The most important difference is that macros ArgBEGIN(), ArgLOOP, and
- /* ArgEND have been replaced with include files argbegin.h, argloop.h, and
- /* argend.h. Text of those macros exceeds buffer sizes of C preprocessors
- /* on micro-computers.
- /*
- /* Macros described in this file can be used to parse command line
- /* as it is passed to the main program. Macro MAIN
- /* can be used to produce the header of the function "main()".
- /* Other macros should be used within the body of the function
- /* main(). Includes argbegin.h, argloop.h, and argend.h must be used to
- /* sandwich in the macros.
- /*
- /* Command arguments can be positional or key letter arguments.
- /* Key letter arguments start with a trigger character. Any
- /* character can be specified as trigger character.
- /* The default trigger character is '-'.
- /*
- /* Key letter arguments can be defined as either flag or text
- /* arguments.
- /*
- /* Flag argument consists of a single key letter that
- /* follows the trigger character. No text is expected after the
- /* flag key letter. If any text follows a flag key letter without
- /* a white space it is interpreted as additional key letters.
- /* If any text follows a flag key letter after a white space
- /* it is interpreted as another argument. Several flag key letters
- /* may follow one trigger character.
- /*
- /* Text argument consists of a single key letter immediately
- /* following a trigger character and followed by text either
- /* immediately or after a white space.
- /*
- /* Positional arguments can be processed either after all
- /* key letter arguments have been processed, or all arguments
- /* can be processed in order, intermixing positional arguments
- /* with key arguments. Double trigger character can be used
- /* to signal the end of key letter arguments. Another mode
- /* is provided, but not recommended, in which the first
- /* positional argument terminates key letter arguments.
- /*
- /*
- /* For both Flag and Text arguments two macros exist:
- /* one that Sets a variable and another that Calls a user
- /* defined function.
- /*
- /* Following flags are predefined and can not be redefined:
- /* '?' Output tutorial information to stderr.
- /* '!' Output debugging information to stderr.
- /* '-' (i.e. trigger character) end of key letter arguments.
- /*
- /*
- /* Macros:
- /*
- /* @(#) ArgTutor( ... ) -- used internally.
- /* Print tutorial message from string array 'tutorial'
- /* to stderr and exit abnormally.
- /*
- /* @(#) MAIN()
- /* Defines header for function main(argc, argv, envp).
- /*
- /* @(#) #define ArgCount argc
- /* @(#) #define ArgVector argv
- /* @(#) #include 'argbegin.h'
- /* Begins sandwich that parses command arguments.
- /* Macros described before argloop.h are optional.
- /* If present, they must be coded between argbegin.h
- /* and argloop.h. Those macros override provided defaults.
- /* Each of them should be coded only once, if at all.
- /* Macros described between argloop.h and argend.h should
- /* also be coded between argloop.h and argend.h.
- /* One of those macros must be coded for each key letter
- /* argument.
- /*
- /* @(#) ArgTrigger( TriggerCharacter )
- /* TriggerCharacter is used to recognize key letter arguments.
- /* Default is '-'.
- /*
- /* @(#) ArgDescription( DescriptionStringArray )
- /* Provides text to be printed after an error is detected
- /* while parsing arguments.
- /* char * tutorial[] = { 'Command', 'summary', 0 };
- /*
- /* @(#) ArgKeyLeading
- /* If this macro is coded key arguments must precede positional
- /* arguments. After the first positional argument is recognized,
- /* all following arguments are treated as positional.
- /* This mode is not recommended. It is provided just for the
- /* sake of completeness (many programs parse arguments this way).
- /*
- /* @(#) ArgPosCall( FunctionName )
- /* FunctionName is called for each positional argument.
- /* If positional arguments are to be processed after all
- /* key letter arguments, this macro should be left out.
- /* It defaults to the dummy function "argPos()"
- /* defined in this file. Otherwise a function
- /* should be defined as:
- /* char * functionName( keyCharacter, textString )
- /* char keyCharacter; /* Always contains '\0'. */
- /* char * textString; /* Points to positional argument. */
- /* { ... }
- /*
- /* @(#) ArgMin( MinPositionals )
- /* MinPositionals is minimum number of positional arguments.
- /* If this macro is not coded, the check is not performed.
- /*
- /* @(#) ArgMax( MaxPositionals )
- /* MaxPositionals is maximum number of positional arguments.
- /* If this macro is not coded, the check is not performed.
- /*
- /* @(#) #include 'argloop.h'
- /* This macro marks the end of default override macros.
- /* It is followed by macros describing key letter arguments.
- /*
- /* @(#) ArgFlagSet( KeyLetter, CounterVariable )
- /* Increment counter for this flag.
- /* CounterVariable should be initially zero.
- /*
- /* @(#) ArgTextSet( KeyLetter, PointerVariable )
- /* Set pointer to text argument.
- /*
- /* @(#) ArgFlagCall( KeyLetter, FunctionName )
- /* @(#) ArgTextCall( KeyLetter, FunctionName )
- /* Call user defined function to process key letter argument.
- /* Function must be defined as:
- /* char * functionName( keyCharacter, textString )
- /* char keyCharacter; /* Key letter. */
- /* char * textString; /* NULL for flag, or points to text. */
- /* { ... }
- /* If pointer returned by this function is not NULL,
- /* the tutorial message will be printed to stderr
- /* and abnormal exit will be taken.
- /*
- /* @(#) #include 'argend.h'
- /* Ends sandwich that parses command arguments.
- /*
- /* Example of use: See end of file argparse.h.
- */
- #endif COMMENT
-
-