$save nolist /* *============================================================================ * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE * * Permission to use for any purpose, modify, copy, and make enhancements * and derivative works of the software is granted if attribution is given to * R.M. Gillmore, dba the ACME Software Deli, as the author * * While the ACME Software Deli does not work for money, there is nonetheless * a significant amount of work involved. The ACME Software Deli maintains the * rights to all code written, though it may be used and distributed as long as * the following conditions are maintained. * * 1. The copyright statement at the top of each code block is maintained in * your distribution. * 2. You do not identify yourself as the ACME Software Deli * 3. Any changes made to the software are sent to the ACME Software Deli *============================================================================ */ /* * $Id: cmdArgs.ext 1157 2025-05-05 00:35:39Z rmgillmore $ */ /* * ============================================================================ * name: cmdArgs.ext * * description: * publish the API which will interpret the command arguments * * revision history: * x001 rmg Thu 24 Jan 16:55:12 2019 * initial coding * ============================================================================ */ $if not CMDARGS_EXT_INCLUDED $set (CMDARGS_EXT_INCLUDED) $include (..\lib\comnDefs.ext) declare optionType_t literally 'integer', /* * existence of the command switch is reported (boolean_t result) */ EXISTS literally '0', /* * get the next arg, and store the string in "storeResultsHere" */ NEXT_ARG literally '1', /* * if there is a command argument with no associated switch, store the * string in this parameter. There can be any number of these. The * strings are stored in the order received, so the order specified * remains significant to the caller */ NO_SWITCH literally '2'; declare commandOption_t literally ' structure ( optionType optionType_t, resultsStorePtr pointer, shortSwitchChars pointer, longSwitchChars pointer, descriptionString pointer )'; declare commandOptionDefinition_t literally ' structure ( numberOptions integer, /* length of the commandOptions array */ commandOptions pointer, /* your commandOption_t array */ delimiterChar char /* one used for short switches, two for long */ )'; $if not CMDARGS_IMPLEMENTATION /* * The first argument is argv[ 0 ], the second is the optionsList that is passed * to getOptions as a pointer */ reportCmdOptions: procedure ( firstCommandArgument, optionsListPtr ) external; declare firstCommandArgument pointer, optionsListPtr pointer, optionsList based optionsListPtr commandOptionDefinition_t; end reportCmdOptions; /* * The first parameter is the number of argument strings in the array that was * created by parsing the command line. The number includes the name of the * application. * * The second parameter is an array of pointers to the argument strings * * The third parameter is the command definition array that defines the options */ getCmdOptions: procedure ( numberArguments, argumentListPtr, optionsListPtr ) integer external; declare numberArguments integer, argumentListPtr pointer, argumentArray based argumentListPtr (*) pointer, optionsListPtr pointer, optionsList based optionsListPtr commandOptionDefinition_t; end getCmdOptions; $endif $endif $restore