|
static int | ParseOpt (int *, char ***, int *, char ***, PLOptionTable *) |
|
static int | ProcessOpt (char *, PLOptionTable *, int *, char ***, int *) |
|
static int | GetOptarg (char **, int *, char ***, int *) |
|
static void | Help (void) |
|
static void | Syntax (void) |
|
static int | opt_h (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_v (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_verbose (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_debug (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_hack (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_dev (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_o (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_geo (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_a (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_jx (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_jy (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_mar (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_ori (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_freeaspect (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_portrait (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_width (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_bg (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_ncol0 (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_ncol1 (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_fam (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_fsiz (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_fbeg (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_finc (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_fflen (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_bufmax (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_nopixmap (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_db (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_np (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_px (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_py (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_wplt (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_drvopt (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_plserver (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_plwindow (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_auto_path (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_server_name (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_tk_file (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_dpi (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_dev_compression (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_cmap0 (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_cmap1 (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_locale (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_eofill (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_mfo (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
static int | opt_mfi (PLCHAR_VECTOR, PLCHAR_VECTOR, void *) |
|
PLINT | c_plsetopt (PLCHAR_VECTOR opt, PLCHAR_VECTOR opt_arg) |
|
PLINT | plMergeOpts (PLOptionTable *options, PLCHAR_VECTOR name, PLCHAR_VECTOR *notes) |
|
void | plClearOpts (void) |
|
void | plResetOpts (void) |
|
PLINT | c_plparseopts (int *p_argc, char **argv, PLINT mode) |
|
void | plSetUsage (PLCHAR_VECTOR program_string, PLCHAR_VECTOR usage_string) |
|
void | plOptUsage (void) |
|
int | plParseDrvOpts (DrvOpt *acc_opt) |
|
void | plHelpDrvOpts (DrvOpt *acc_opt) |
|
void | plP_FreeDrvOpts () |
|
static int | opt_h (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
|
static int | opt_v (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
|
static int | opt_verbose (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
|
static int | opt_debug (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
|
static int | opt_hack (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
|
static int | opt_dev (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_o (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_mar (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_a (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_jx (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_jy (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_ori (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_freeaspect (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
|
static int | opt_portrait (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
|
static int | opt_width (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_bg (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_ncol0 (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_ncol1 (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_wplt (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_drvopt (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_fam (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
|
static int | opt_fsiz (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_fbeg (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_finc (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_fflen (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_np (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
|
static int | opt_nopixmap (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
|
static int | opt_db (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
|
static int | opt_bufmax (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_server_name (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_plserver (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_plwindow (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_auto_path (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_px (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_py (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_geo (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_tk_file (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_dpi (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_dev_compression (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_cmap0 (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_cmap1 (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_locale (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
|
static int | opt_eofill (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR PL_UNUSED(opt_arg), void *PL_UNUSED(client_data)) |
|
static int | opt_mfo (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
static int | opt_mfi (PLCHAR_VECTOR PL_UNUSED(opt), PLCHAR_VECTOR opt_arg, void *PL_UNUSED(client_data)) |
|
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:
- Tag your option with PL_OPT_NODELETE
- Give it an option handler that uses a return code of 1.
- 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.
PLPLOT options data structure definition.
The table is defined as follows
typedef struct { PLCHAR_VECTOR opt; int (*handler) (PLCHAR_VECTOR, PLCHAR_VECTOR, void *); void *client_data; void *var; long mode; PLCHAR_VECTOR syntax; PLCHAR_VECTOR desc; } PLOptionTable;
where each entry has the following meaning:
opt option string handler pointer to function for processing the option and (optionally) its argument client_data pointer to data that gets passed to (*handler) var address of variable to set based on "mode" mode governs handling of option (see below) syntax short syntax description desc long syntax description
The syntax and or desc strings can be NULL if the option is never to be described. Usually this is only used for obsolete arguments; those we just wish to hide from normal use are better made invisible (which are made visible by either specifying -showall first or PL_PARSE_SHOWALL).
The mode bits are:
PL_OPT_ARG Option has an argument PL_OPT_NODELETE Don't delete after processing PL_OPT_INVISIBLE Make invisible (usually for debugging) PL_OPT_DISABLED Ignore this option
The following mode bits cause the option to be processed as specified:
PL_OPT_FUNC Call function handler (opt, opt_arg) PL_OPT_BOOL Set *var=1 PL_OPT_INT Set *var=atoi(opt_arg) PL_OPT_FLOAT Set *var=atof(opt_arg) PL_OPT_STRING Set *var=opt_arg
where opt points to the option string and opt_arg points to the argument string.
Definition at line 237 of file plargs.c.