Classes |
struct | PLOptionInfo |
struct | DrvOptCmd |
Defines |
#define | OPTMAX 1024 |
#define | PL_MAX_OPT_TABLES 10 |
Typedefs |
typedef struct DrvOptCmd | DrvOptCmd |
Functions |
static int | ParseOpt (int *, const char ***, int *, const char ***, PLOptionTable *) |
static int | ProcessOpt (const char *, PLOptionTable *, int *, const char ***, int *) |
static int | GetOptarg (const char **, int *, const char ***, int *) |
static void | Help (void) |
static void | Syntax (void) |
int | plSetOpt (const char *opt, const char *opt_arg) |
static int | opt_h (const char *, const char *, void *) |
static int | opt_v (const char *, const char *, void *) |
static int | opt_verbose (const char *, const char *, void *) |
static int | opt_debug (const char *, const char *, void *) |
static int | opt_hack (const char *, const char *, void *) |
static int | opt_dev (const char *, const char *, void *) |
static int | opt_o (const char *, const char *, void *) |
static int | opt_geo (const char *, const char *, void *) |
static int | opt_a (const char *, const char *, void *) |
static int | opt_jx (const char *, const char *, void *) |
static int | opt_jy (const char *, const char *, void *) |
static int | opt_mar (const char *, const char *, void *) |
static int | opt_ori (const char *, const char *, void *) |
static int | opt_freeaspect (const char *, const char *, void *) |
static int | opt_portrait (const char *, const char *, void *) |
static int | opt_width (const char *, const char *, void *) |
static int | opt_bg (const char *, const char *, void *) |
static int | opt_ncol0 (const char *, const char *, void *) |
static int | opt_ncol1 (const char *, const char *, void *) |
static int | opt_fam (const char *, const char *, void *) |
static int | opt_fsiz (const char *, const char *, void *) |
static int | opt_fbeg (const char *, const char *, void *) |
static int | opt_finc (const char *, const char *, void *) |
static int | opt_fflen (const char *, const char *, void *) |
static int | opt_bufmax (const char *, const char *, void *) |
static int | opt_nopixmap (const char *, const char *, void *) |
static int | opt_db (const char *, const char *, void *) |
static int | opt_np (const char *, const char *, void *) |
static int | opt_px (const char *, const char *, void *) |
static int | opt_py (const char *, const char *, void *) |
static int | opt_wplt (const char *, const char *, void *) |
static int | opt_drvopt (const char *, const char *, void *) |
static int | opt_plserver (const char *, const char *, void *) |
static int | opt_plwindow (const char *, const char *, void *) |
static int | opt_auto_path (const char *, const char *, void *) |
static int | opt_server_name (const char *, const char *, void *) |
static int | opt_tk_file (const char *, const char *, void *) |
static int | opt_dpi (const char *, const char *, void *) |
static int | opt_dev_compression (const char *, const char *, void *) |
static int | opt_cmap0 (const char *, const char *, void *) |
static int | opt_cmap1 (const char *, const char *, void *) |
static int | opt_locale (const char *, const char *, void *) |
static int | opt_eofill (const char *, const char *, void *) |
int | c_plsetopt (const char *opt, const char *opt_arg) |
int | plMergeOpts (PLOptionTable *options, const char *name, const char **notes) |
void | plClearOpts (void) |
void | plResetOpts (void) |
int | c_plparseopts (int *p_argc, const char **argv, PLINT mode) |
void | plSetUsage (const char *program_string, const char *usage_string) |
void | plOptUsage (void) |
int | plParseDrvOpts (DrvOpt *acc_opt) |
void | plHelpDrvOpts (DrvOpt *acc_opt) |
void | plP_FreeDrvOpts () |
static int | opt_h (const char *PL_UNUSED(opt), const char *PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
static int | opt_v (const char *PL_UNUSED(opt), const char *PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
static int | opt_verbose (const char *PL_UNUSED(opt), const char *PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
static int | opt_debug (const char *PL_UNUSED(opt), const char *PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
static int | opt_hack (const char *PL_UNUSED(opt), const char *PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
static int | opt_dev (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_o (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_mar (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_a (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_jx (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_jy (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_ori (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_freeaspect (const char *PL_UNUSED(opt), const char *PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
static int | opt_portrait (const char *PL_UNUSED(opt), const char *PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
static int | opt_width (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_bg (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_ncol0 (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_ncol1 (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_wplt (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_drvopt (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_fam (const char *PL_UNUSED(opt), const char *PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
static int | opt_fsiz (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_fbeg (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_finc (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_fflen (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_np (const char *PL_UNUSED(opt), const char *PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
static int | opt_nopixmap (const char *PL_UNUSED(opt), const char *PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
static int | opt_db (const char *PL_UNUSED(opt), const char *PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
static int | opt_bufmax (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_server_name (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_plserver (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_plwindow (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_auto_path (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_px (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_py (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_geo (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_tk_file (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_dpi (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_dev_compression (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_cmap0 (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_cmap1 (const char *PL_UNUSED(opt), const char *opt_arg, void *PL_UNUSED(client_data)) |
static int | opt_locale (const char *PL_UNUSED(opt), const char *PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
static int | opt_eofill (const char *PL_UNUSED(opt), const char *PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
Variables |
static const char * | program = NULL |
static const char * | usage = NULL |
static int | mode_full |
static int | mode_quiet |
static int | mode_nodelete |
static int | mode_showall |
static int | mode_noprogram |
static int | mode_nodash |
static int | mode_skip |
static char | opttmp [OPTMAX] |
static PLOptionTable | ploption_table [] |
static const char * | plplot_notes [] |
PLOptionInfo | ploption_info_default |
PLOptionInfo | ploption_info [PL_MAX_OPT_TABLES] |
static DrvOptCmd | drv_opt = { NULL, NULL, NULL } |
static int | tables = 1 |
This file contains routines to extract & process command flags. The command flags recognized by PLplot are stored in the "ploption_table" structure, along with strings giving the syntax, long help message, and option handler.
The command line parser -- plparseopts() -- removes all recognized flags (decreasing argc accordingly), so that invalid input may be readily detected. It can also be used to process user command line flags. The user can merge an option table of type PLOptionTable into the internal option table info structure using plMergeOpts(). Or, the user can specify that ONLY the external table(s) be parsed by calling plClearOpts() before plMergeOpts().
The default action taken by plparseopts() is as follows:
- Returns with an error if an unrecognized option or badly formed option-value pair are encountered.
- Returns immediately (return code 0) when the first non-option command line argument is found.
- Returns with the return code of the option handler, if one was called.
- Deletes command line arguments from argv list as they are found, and decrements argc accordingly.
- Does not show "invisible" options in usage or help messages.
- Assumes the program name is contained in argv[0].
These behaviors may be controlled through the "mode" argument, which can have the following bits set:
PL_PARSE_FULL -- Full parsing of command line and all error messages enabled, including program exit when an error occurs. Anything on the command line that isn't recognized as a valid option or option argument is flagged as an error.
PL_PARSE_QUIET -- Turns off all output except in the case of errors.
PL_PARSE_NODELETE -- Turns off deletion of processed arguments.
PL_PARSE_SHOWALL -- Show invisible options
PL_PARSE_NOPROGRAM -- Specified if argv[0] is NOT a pointer to the program name.
PL_PARSE_NODASH -- Set if leading dash is NOT required.
PL_PARSE_SKIP -- Set to quietly skip over any unrecognized args.
Note: if you want to have both your option and a PLplot option of the same name processed (e.g. the -v option in plrender), do the following: 1. Tag your option with PL_OPT_NODELETE 2. Give it an option handler that uses a return code of 1. 3. Merge your option table in. By merging your table, your option will be processed before the PLplot one. The PL_OPT_NODELETE ensures that the option string is not deleted from the argv list, and the return code of 1 ensures that the parser continues looking for it.
See plrender.c for examples of actual usage.
Definition in file plargs.c.