OpenMPI  0.1.1
cmd_line.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
3  * University Research and Technology
4  * Corporation. All rights reserved.
5  * Copyright (c) 2004-2005 The University of Tennessee and The University
6  * of Tennessee Research Foundation. All rights
7  * reserved.
8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9  * University of Stuttgart. All rights reserved.
10  * Copyright (c) 2004-2005 The Regents of the University of California.
11  * All rights reserved.
12  * Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
13  * $COPYRIGHT$
14  *
15  * Additional copyrights may follow
16  *
17  * $HEADER$
18  */
19 
20 /**
21  * @file
22  *
23  * General command line parsing facility for use throughout Open MPI.
24  *
25  * This scheme is inspired by the GNU getopt package. Command line
26  * options are registered. Each option can have up to three different
27  * matching tokens: a "short" name, a "single dash" name, and a "long"
28  * name. Each option can also take 0 or more arguments. Finally,
29  * each option can be repeated on the command line an arbitrary number
30  * of times.
31  *
32  * The "short" name can only be a single letter, and will be found
33  * after a single dash (e.g., "-a"). Multiple "short" names can be
34  * combined into a single command line argument (e.g., "-abc" can be
35  * equivalent to "-a -b -c").
36  *
37  * The "single dash" name is a multi-character name that only
38  * requires a single dash. This only exists to provide backwards
39  * compatibility for some well-known command line options in prior
40  * MPI implementations (e.g., "mpirun -np 3"). It should be used
41  * sparingly.
42  *
43  * The "long" name is a multi-character name that is found after a
44  * pair of dashes. For example, "--some-option-name".
45  *
46  * A command line option is a combination of 1 or more of a short
47  * name, single dash name, and a long name. Any of the names may be
48  * used on the command line; they are treated as synonyms. For
49  * example, say the following was used in for an executable named
50  * "foo":
51  *
52  * \code
53  * opal_cmd_line_make_opt3(cmd, 'a', NULL, 'add', 1, "Add a user");
54  * \endcode
55  *
56  * In this case, the following command lines are exactly equivalent:
57  *
58  * \verbatim
59  * shell$ foo -a jsmith
60  * shell$ foo --add jsmith
61  * \endverbatim
62  *
63  * Note that this interface can also track multiple invocations of the
64  * same option. For example, the following is both legal and able to
65  * be retrieved through this interface:
66  *
67  * \verbatim
68  * shell$ foo -a jsmith -add bjones
69  * \endverbatim
70  *
71  * The caller to this interface creates a command line handle
72  * (opal_cmd_line_t) with OBJ_NEW() and then uses it to register the
73  * desired parameters via opal_cmd_line_make_opt3() (or the deprecated
74  * opal_cmd_line_make_opt()). Once all the parameters have been
75  * registered, the user invokes opal_cmd_line_parse() with the command
76  * line handle and the argv/argc pair to be parsed (typically the
77  * arguments from main()). The parser will examine the argv and find
78  * registered options and parameters. It will stop parsing when it
79  * runs into an recognized string token or the special "--" token.
80  *
81  * After the parse has occurred, various accessor functions can be
82  * used to determine which options were selected, what parameters were
83  * passed to them, etc.:
84  *
85  * - opal_cmd_line_get_usage_msg() returns a string suitable for "help"
86  * kinds of messages.
87  * - opal_cmd_line_is_taken() returns a true or false indicating
88  * whether a given command line option was found on the command
89  * line.
90  * - opal_cmd_line_get_argc() returns the number of tokens parsed on
91  * the handle.
92  * - opal_cmd_line_get_argv() returns any particular string from the
93  * original argv.
94  * - opal_cmd_line_get_ninsts() returns the number of times a
95  * particular option was found on a command line.
96  * - opal_cmd_line_get_param() returns the Nth parameter in the Mth
97  * instance of a given parameter.
98  * - opal_cmd_line_get_tail() returns an array of tokens not parsed
99  * (i.e., if the parser ran into "--" or an unrecognized token).
100  *
101  * Note that a shortcut to creating a large number of options exists
102  * -- one can make a table of opal_cmd_line_init_t instances and the
103  * table to opal_cmd_line_create(). This creates an opal_cmd_line_t
104  * handle that is pre-seeded with all the options from the table
105  * without the need to repeatedly invoke opal_cmd_line_make_opt3() (or
106  * equivalent). This opal_cmd_line_t instance is just like any other;
107  * it is still possible to add more options via
108  * opal_cmd_line_make_opt3(), etc.
109  */
110 
111 #ifndef OPAL_CMD_LINE_H
112 #define OPAL_CMD_LINE_H
113 
114 #include "opal_config.h"
115 
116 #include "opal/class/opal_object.h"
117 #include "opal/class/opal_list.h"
118 #include "opal/threads/mutex.h"
119 
120 BEGIN_C_DECLS
121  /**
122  * \internal
123  *
124  * Main top-level handle. This interface should not be used by users!
125  */
127  /** Make this an OBJ handle */
129 
130  /** Thread safety */
132 
133  /** List of cmd_line_option_t's (defined internally) */
135 
136  /** Duplicate of argc from opal_cmd_line_parse() */
137  int lcl_argc;
138  /** Duplicate of argv from opal_cmd_line_parse() */
139  char **lcl_argv;
140 
141  /** Parsed output; list of cmd_line_param_t's (defined internally) */
143 
144  /** List of tail (unprocessed) arguments */
146  /** List of tail (unprocessed) arguments */
148  };
149  /**
150  * \internal
151  *
152  * Convenience typedef
153  */
154  typedef struct opal_cmd_line_t opal_cmd_line_t;
155 
156  /**
157  * Data types supported by the parser
158  */
160  OPAL_CMD_LINE_TYPE_NULL,
161  OPAL_CMD_LINE_TYPE_STRING,
162  OPAL_CMD_LINE_TYPE_INT,
163  OPAL_CMD_LINE_TYPE_SIZE_T,
164  OPAL_CMD_LINE_TYPE_BOOL,
165 
166  OPAL_CMD_LINE_TYPE_MAX
167  };
168  /**
169  * \internal
170  *
171  * Convenience typedef
172  */
174 
175  /**
176  * Datatype used to construct a command line handle; see
177  * opal_cmd_line_create().
178  */
180  /** If want to set an MCA parameter, set its type name here.
181  WARNING: This MCA tuple (type, component, param) will
182  eventually be replaced with a single name! */
183  const char *ocl_mca_type_name;
184  /** If want to set an MCA parameter, set its component name
185  here. WARNING: This MCA tuple (type, component, param)
186  will eventually be replaced with a single name! */
188  /** If want to set an MCA parameter, set its parameter name
189  here. WARNING: This MCA tuple (type, component, param)
190  will eventually be replaced with a single name! */
191  const char *ocl_mca_param_name;
192 
193  /** "Short" name (i.e., "-X", where "X" is a single letter) */
195  /** "Single dash" name (i.e., "-foo"). The use of these are
196  discouraged. */
198  /** Long name (i.e., "--foo"). */
199  const char *ocl_cmd_long_name;
200 
201  /** Number of parameters that this option takes */
203 
204  /** If this parameter is encountered, its *first* parameter it
205  saved here. If the parameter is encountered again, the
206  value is overwritten. */
208  /** If an ocl_variable_dest is given, its datatype must be
209  supplied as well. */
211 
212  /** Description of the command line option, to be used with
213  opal_cmd_line_get_usage_msg(). */
214  const char *ocl_description;
215  };
216  /**
217  * \internal
218  *
219  * Convenience typedef
220  */
222 
223  /**
224  * Top-level command line handle.
225  *
226  * This handle is used for accessing all command line functionality
227  * (i.e., all opal_cmd_line*() functions). Multiple handles can be
228  * created and simultaneously processed; each handle is independant
229  * from others.
230  *
231  * The opal_cmd_line_t handles are [simplisticly] thread safe;
232  * processing is guaranteed to be mutually exclusive if multiple
233  * threads invoke functions on the same handle at the same time --
234  * access will be serialized in an unspecified order.
235  *
236  * Once finished, handles should be released with OBJ_RELEASE(). The
237  * destructor for opal_cmd_line_t handles will free all memory
238  * associated with the handle.
239  */
240  OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_cmd_line_t);
241 
242  /**
243  * Make a command line handle from a table of initializers.
244  *
245  * @param cmd OPAL command line handle.
246  * @param table Table of opal_cmd_line_init_t instances for all
247  * the options to be included in the resulting command line
248  * handler.
249  *
250  * @retval OPAL_SUCCESS Upon success.
251  *
252  * This function takes a table of opal_cmd_line_init_t instances
253  * to pre-seed an OPAL command line handle. The last instance in
254  * the table must have '\0' for the short name and NULL for the
255  * single-dash and long names. The handle is expected to have
256  * been OBJ_NEW'ed or OBJ_CONSTRUCT'ed already.
257  *
258  * Upon return, the command line handle is just like any other. A
259  * sample using this syntax:
260  *
261  * \code
262  * opal_cmd_line_init_t cmd_line_init[] = {
263  * { NULL, NULL, NULL, 'h', NULL, "help", 0,
264  * &orterun_globals.help, OPAL_CMD_LINE_TYPE_BOOL,
265  * "This help message" },
266  *
267  * { NULL, NULL, NULL, '\0', NULL, "wd", 1,
268  * &orterun_globals.wd, OPAL_CMD_LINE_TYPE_STRING,
269  * "Set the working directory of the started processes" },
270  *
271  * { NULL, NULL, NULL, '\0', NULL, NULL, 0,
272  * NULL, OPAL_CMD_LINE_TYPE_NULL, NULL }
273  * };
274  * \endcode
275  */
276  OPAL_DECLSPEC int opal_cmd_line_create(opal_cmd_line_t *cmd,
277  opal_cmd_line_init_t *table);
278 
279  /**
280  * Create a command line option.
281  *
282  * @param cmd OPAL command line handle.
283  * @param entry Command line entry to add to the command line.
284  *
285  * @retval OPAL_SUCCESS Upon success.
286  *
287  */
288  OPAL_DECLSPEC int opal_cmd_line_make_opt_mca(opal_cmd_line_t *cmd,
289  opal_cmd_line_init_t entry);
290 
291  /**
292  * \deprecated
293  *
294  * Create a command line option.
295  *
296  * This function is an older [deprecated] form of
297  * opal_cmd_line_make_opt3(). It is exactly equivalent to
298  * opal_cmd_line_make_opt3(cmd, short_name, NULL, long_name,
299  * num_params, desc).
300  */
301  OPAL_DECLSPEC int opal_cmd_line_make_opt(opal_cmd_line_t *cmd,
302  char short_name,
303  const char *long_name,
304  int num_params,
305  const char *desc) __opal_attribute_deprecated__;
306 
307  /**
308  * Create a command line option.
309  *
310  * @param cmd OPAL command line handle.
311  * @param short_name "Short" name of the command line option.
312  * @param sd_name "Single dash" name of the command line option.
313  * @param long_name "Long" name of the command line option.
314  * @param num_params How many parameters this option takes.
315  * @param dest Short string description of this option.
316  *
317  * @retval OPAL_ERR_OUT_OF_RESOURCE If out of memory.
318  * @retval OPAL_ERR_BAD_PARAM If bad parameters passed.
319  * @retval OPAL_SUCCESS Upon success.
320  *
321  * Adds a command line option to the list of options that a a OPAL
322  * command line handle will accept. The short_name may take the
323  * special value '\0' to not have a short name. Likewise, the
324  * sd_name and long_name may take the special value NULL to not have
325  * a single dash or long name, respectively. However, one of the
326  * three must have a name.
327  *
328  * num_params indicates how many parameters this option takes. It
329  * must be greater than or equal to 0.
330  *
331  * Finally, desc is a short string description of this option. It is
332  * used to generate the output from opal_cmd_line_get_usage_msg().
333  *
334  */
335  OPAL_DECLSPEC int opal_cmd_line_make_opt3(opal_cmd_line_t *cmd,
336  char short_name,
337  const char *sd_name,
338  const char *long_name,
339  int num_params,
340  const char *desc);
341 
342  /**
343  * Parse a command line according to a pre-built OPAL command line
344  * handle.
345  *
346  * @param cmd OPAL command line handle.
347  * @param ignore_unknown Whether to print an error message upon
348  * finding an unknown token or not
349  * @param argc Length of the argv array.
350  * @param argv Array of strings from the command line.
351  *
352  * @retval OPAL_SUCCESS Upon success.
353  * @retval OPAL_ERR_SILENT If an error message was printed. This
354  * value will only be returned if the command line was not
355  * successfully parsed.
356  *
357  * Parse a series of command line tokens according to the option
358  * descriptions from a OPAL command line handle. The OPAL command line
359  * handle can then be queried to see what options were used, what
360  * their parameters were, etc.
361  *
362  * If an unknown token is found in the command line (i.e., a token
363  * that is not a parameter or a registered option), the parsing will
364  * stop (see below). If ignore_unknown is false, an error message
365  * is displayed. If ignore_unknown is true, the error message is
366  * not displayed.
367  *
368  * Error messages are always displayed (to stderr, and
369  * OPAL_ERR_SILENT is returned) if a token was encountered that
370  * required N parameters, but <N parameters were found (e.g., "cmd
371  * --param foo", but --param was registered to require 2 option
372  * tokens).
373  *
374  * The contents of argc and argv are not changed during parsing.
375  * argv[0] is assumed to be the executable name, and is ignored during
376  * parsing, except when printing error messages.
377  *
378  * Parsing will stop in the following conditions:
379  *
380  * - all argv tokens are processed
381  * - the token "--" is found
382  * - an unrecognized token is found
383  * - a parameter registered with an integer type option finds a
384  * non-integer option token
385  * - a parameted registered N option tokens, but finds less then
386  * <N tokens available
387  *
388  * Upon any of these conditions, any remaining tokens will be placed
389  * in the "tail" (and therefore not examined by the parser),
390  * regardless of the value of ignore_unknown. The set of tail
391  * tokens is available from the opal_cmd_line_get_tail() function.
392  *
393  * Note that "--" is ignored if it is found in the middle an expected
394  * number of arguments. For example, if "--foo" is expected to have 3
395  * arguments, and the command line is:
396  *
397  * executable --foo a b -- other arguments
398  *
399  * This will result in an error, because "--" will be parsed as the
400  * third parameter to the first instance of "foo", and "other" will be
401  * an unrecognized option.
402  *
403  * Invoking this function multiple times on different sets of argv
404  * tokens is safe, but will erase any previous parsing results.
405  */
406  OPAL_DECLSPEC int opal_cmd_line_parse(opal_cmd_line_t *cmd,
407  bool ignore_unknown,
408  int argc, char **argv);
409 
410  /**
411  * Return a consolidated "usage" message for a OPAL command line handle.
412  *
413  * @param cmd OPAL command line handle.
414  *
415  * @retval str Usage message.
416  *
417  * Returns a formatted string suitable for printing that lists the
418  * expected usage message and a short description of each option on
419  * the OPAL command line handle. Options that passed a NULL
420  * description to opal_cmd_line_make_opt() will not be included in the
421  * display (to allow for undocumented options).
422  *
423  * This function is typically only invoked internally by the
424  * opal_show_help() function.
425  *
426  * This function should probably be fixed up to produce prettier
427  * output.
428  *
429  * The returned string must be freed by the caller.
430  */
431  OPAL_DECLSPEC char *opal_cmd_line_get_usage_msg(opal_cmd_line_t *cmd) __opal_attribute_malloc__ __opal_attribute_warn_unused_result__;
432 
433  /**
434  * Test if a given option was taken on the parsed command line.
435  *
436  * @param cmd OPAL command line handle.
437  * @param opt Short or long name of the option to check for.
438  *
439  * @retval true If the command line option was found during
440  * opal_cmd_line_parse().
441  *
442  * @retval false If the command line option was not found during
443  * opal_cmd_line_parse(), or opal_cmd_line_parse() was not invoked on
444  * this handle.
445  *
446  * This function should only be called after opal_cmd_line_parse().
447  *
448  * The function will return true if the option matching opt was found
449  * (either by its short or long name) during token parsing.
450  * Otherwise, it will return false.
451  */
452  OPAL_DECLSPEC bool opal_cmd_line_is_taken(opal_cmd_line_t *cmd,
453  const char *opt) __opal_attribute_nonnull__(1) __opal_attribute_nonnull__(2);
454 
455  /**
456  * Return the number of arguments parsed on a OPAL command line handle.
457  *
458  * @param cmd A pointer to the OPAL command line handle.
459  *
460  * @retval OPAL_ERROR If cmd is NULL.
461  * @retval argc Number of arguments previously added to the handle.
462  *
463  * Arguments are added to the handle via the opal_cmd_line_parse()
464  * function.
465  */
466  OPAL_DECLSPEC int opal_cmd_line_get_argc(opal_cmd_line_t *cmd) __opal_attribute_unused__;
467 
468  /**
469  * Return a string argument parsed on a OPAL command line handle.
470  *
471  * @param cmd A pointer to the OPAL command line handle.
472  * @param index The nth argument from the command line (0 is
473  * argv[0], etc.).
474  *
475  * @retval NULL If cmd is NULL or index is invalid
476  * @retval argument String of original argv[index]
477  *
478  * This function returns a single token from the arguments parsed
479  * on this handle. Arguments are added bia the
480  * opal_cmd_line_parse() function.
481  *
482  * What is returned is a pointer to the actual string that is on
483  * the handle; it should not be modified or freed.
484  */
485  OPAL_DECLSPEC char *opal_cmd_line_get_argv(opal_cmd_line_t *cmd,
486  int index);
487 
488  /**
489  * Return the number of instances of an option found during parsing.
490  *
491  * @param cmd OPAL command line handle.
492  * @param opt Short or long name of the option to check for.
493  *
494  * @retval num Number of instances (to include 0) of a given potion
495  * found during opal_cmd_line_parse().
496  *
497  * @retval OPAL_ERR If the command line option was not found during
498  * opal_cmd_line_parse(), or opal_cmd_line_parse() was not invoked on
499  * this handle.
500  *
501  * This function should only be called after opal_cmd_line_parse().
502  *
503  * The function will return the number of instances of a given option
504  * (either by its short or long name) -- to include 0 -- or OPAL_ERR if
505  * either the option was not specified as part of the OPAL command line
506  * handle, or opal_cmd_line_parse() was not invoked on this handle.
507  */
508  OPAL_DECLSPEC int opal_cmd_line_get_ninsts(opal_cmd_line_t *cmd,
509  const char *opt) __opal_attribute_nonnull__(1) __opal_attribute_nonnull__(2);
510 
511  /**
512  * Return a specific parameter for a specific instance of a option
513  * from the parsed command line.
514  *
515  * @param cmd OPAL command line handle.
516  * @param opt Short or long name of the option to check for.
517  * @param instance_num Instance number of the option to query.
518  * @param param_num Which parameter to return.
519  *
520  * @retval param String of the parameter.
521  * @retval NULL If any of the input values are invalid.
522  *
523  * This function should only be called after opal_cmd_line_parse().
524  *
525  * This function returns the Nth parameter for the Ith instance of a
526  * given option on the parsed command line (both N and I are
527  * zero-indexed). For example, on the command line:
528  *
529  * executable --foo bar1 bar2 --foo bar3 bar4
530  *
531  * The call to opal_cmd_line_get_param(cmd, "foo", 1, 1) would return
532  * "bar4". opal_cmd_line_get_param(cmd, "bar", 0, 0) would return
533  * NULL, as would opal_cmd_line_get_param(cmd, "foo", 2, 2);
534  *
535  * The returned string should \em not be modified or freed by the
536  * caller.
537  */
538  OPAL_DECLSPEC char *opal_cmd_line_get_param(opal_cmd_line_t *cmd,
539  const char *opt,
540  int instance_num,
541  int param_num);
542 
543  /**
544  * Return the entire "tail" of unprocessed argv from a OPAL
545  * command line handle.
546  *
547  * @param cmd A pointer to the OPAL command line handle.
548  * @param tailc Pointer to the output length of the null-terminated
549  * tail argv array.
550  * @param tailv Pointer to the output null-terminated argv of all
551  * unprocessed arguments from the command line.
552  *
553  * @retval OPAL_ERROR If cmd is NULL or otherwise invalid.
554  * @retval OPAL_SUCCESS Upon success.
555  *
556  * The "tail" is all the arguments on the command line that were
557  * not processed for some reason. Reasons for not processing
558  * arguments include:
559  *
560  * \sa The argument was not recognized
561  * \sa The argument "--" was seen, and therefore all arguments
562  * following it were not processed
563  *
564  * The output tailc parameter will be filled in with the integer
565  * length of the null-terminated tailv array (length including the
566  * final NULL entry). The output tailv parameter will be a copy
567  * of the tail parameters, and must be freed (likely with a call
568  * to opal_argv_free()) by the caller.
569  */
570  OPAL_DECLSPEC int opal_cmd_line_get_tail(opal_cmd_line_t *cmd, int *tailc,
571  char ***tailv) __opal_attribute_nonnull__(1) __opal_attribute_nonnull__(2);
572 
573 END_C_DECLS
574 
575 
576 #endif /* OPAL_CMD_LINE_H */
opal_mutex_t lcl_mutex
Thread safety.
Definition: cmd_line.h:131
const char * ocl_cmd_single_dash_name
"Single dash" name (i.e., "-foo").
Definition: cmd_line.h:197
OPAL_DECLSPEC char * opal_cmd_line_get_argv(opal_cmd_line_t *cmd, int index)
Return a string argument parsed on a OPAL command line handle.
Definition: cmd_line.c:856
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_cmd_line_t)
Top-level command line handle.
OPAL_DECLSPEC int opal_cmd_line_make_opt_mca(opal_cmd_line_t *cmd, opal_cmd_line_init_t entry)
Create a command line option.
Definition: cmd_line.c:190
int ocl_num_params
Number of parameters that this option takes.
Definition: cmd_line.h:202
const char * ocl_mca_param_name
If want to set an MCA parameter, set its parameter name here.
Definition: cmd_line.h:191
OPAL_DECLSPEC char * opal_cmd_line_get_usage_msg(opal_cmd_line_t *cmd) __opal_attribute_malloc__ __opal_attribute_warn_unused_result__
Return a consolidated "usage" message for a OPAL command line handle.
Definition: cmd_line.c:537
OPAL_DECLSPEC int opal_cmd_line_make_opt3(opal_cmd_line_t *cmd, char short_name, const char *sd_name, const char *long_name, int num_params, const char *desc)
Create a command line option.
Definition: cmd_line.c:235
char ** lcl_argv
Duplicate of argv from opal_cmd_line_parse()
Definition: cmd_line.h:139
Definition: mutex_unix.h:53
OPAL_DECLSPEC bool opal_cmd_line_is_taken(opal_cmd_line_t *cmd, const char *opt) __opal_attribute_nonnull__(1) __opal_attribute_nonnull__(2)
Test if a given option was taken on the parsed command line.
Definition: cmd_line.c:746
OPAL_DECLSPEC int opal_cmd_line_get_argc(opal_cmd_line_t *cmd) __opal_attribute_unused__
Return the number of arguments parsed on a OPAL command line handle.
Definition: cmd_line.c:847
const char * ocl_description
Description of the command line option, to be used with opal_cmd_line_get_usage_msg().
Definition: cmd_line.h:214
const char * ocl_mca_type_name
If want to set an MCA parameter, set its type name here.
Definition: cmd_line.h:183
The opal_list_t interface is used to provide a generic doubly-linked list container for Open MPI...
OPAL_DECLSPEC int opal_cmd_line_create(opal_cmd_line_t *cmd, opal_cmd_line_init_t *table)
Make a command line handle from a table of initializers.
Definition: cmd_line.c:146
const char * ocl_cmd_long_name
Long name (i.e., "--foo").
Definition: cmd_line.h:199
int lcl_argc
Duplicate of argc from opal_cmd_line_parse()
Definition: cmd_line.h:137
OPAL_DECLSPEC int opal_cmd_line_get_tail(opal_cmd_line_t *cmd, int *tailc, char ***tailv) __opal_attribute_nonnull__(1) __opal_attribute_nonnull__(2)
Return the entire "tail" of unprocessed argv from a OPAL command line handle.
Definition: cmd_line.c:867
OPAL_DECLSPEC char * opal_cmd_line_get_param(opal_cmd_line_t *cmd, const char *opt, int instance_num, int param_num)
Return a specific parameter for a specific instance of a option from the parsed command line...
Definition: cmd_line.c:796
Definition: cmd_line.h:126
OPAL_DECLSPEC int opal_cmd_line_make_opt(opal_cmd_line_t *cmd, char short_name, const char *long_name, int num_params, const char *desc) __opal_attribute_deprecated__
Definition: cmd_line.c:207
opal_cmd_line_type_t ocl_variable_type
If an ocl_variable_dest is given, its datatype must be supplied as well.
Definition: cmd_line.h:210
OPAL_DECLSPEC int opal_cmd_line_parse(opal_cmd_line_t *cmd, bool ignore_unknown, int argc, char **argv)
Parse a command line according to a pre-built OPAL command line handle.
Definition: cmd_line.c:264
void * ocl_variable_dest
If this parameter is encountered, its first parameter it saved here.
Definition: cmd_line.h:207
const char * ocl_mca_component_name
If want to set an MCA parameter, set its component name here.
Definition: cmd_line.h:187
opal_list_t lcl_params
Parsed output; list of cmd_line_param_t's (defined internally)
Definition: cmd_line.h:142
opal_list_t lcl_options
List of cmd_line_option_t's (defined internally)
Definition: cmd_line.h:134
char ** lcl_tail_argv
List of tail (unprocessed) arguments.
Definition: cmd_line.h:147
Base object.
Definition: opal_object.h:182
Definition: opal_list.h:147
Datatype used to construct a command line handle; see opal_cmd_line_create().
Definition: cmd_line.h:179
opal_object_t super
Make this an OBJ handle.
Definition: cmd_line.h:128
char ocl_cmd_short_name
"Short" name (i.e., "-X", where "X" is a single letter)
Definition: cmd_line.h:194
opal_cmd_line_type_t
Data types supported by the parser.
Definition: cmd_line.h:159
int lcl_tail_argc
List of tail (unprocessed) arguments.
Definition: cmd_line.h:145
OPAL_DECLSPEC int opal_cmd_line_get_ninsts(opal_cmd_line_t *cmd, const char *opt) __opal_attribute_nonnull__(1) __opal_attribute_nonnull__(2)
Return the number of instances of an option found during parsing.
Definition: cmd_line.c:755
Mutual exclusion functions.
A simple C-language object-oriented system with single inheritance and ownership-based memory managem...