| 1 | /* |
| 2 | * Legal Notice |
| 3 | * |
| 4 | * This document and associated source code (the "Work") is a part of a |
| 5 | * benchmark specification maintained by the TPC. |
| 6 | * |
| 7 | * The TPC reserves all right, title, and interest to the Work as provided |
| 8 | * under U.S. and international laws, including without limitation all patent |
| 9 | * and trademark rights therein. |
| 10 | * |
| 11 | * No Warranty |
| 12 | * |
| 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION |
| 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE |
| 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER |
| 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, |
| 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, |
| 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR |
| 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF |
| 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. |
| 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, |
| 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT |
| 23 | * WITH REGARD TO THE WORK. |
| 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO |
| 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE |
| 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS |
| 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, |
| 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, |
| 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT |
| 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD |
| 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. |
| 32 | * |
| 33 | * Contributors: |
| 34 | * Gradient Systems |
| 35 | */ |
| 36 | |
| 37 | #ifndef R_PARAMS_H |
| 38 | #define R_PARAMS_H |
| 39 | #define OPT_NONE 0x00 |
| 40 | #define OPT_FLG 0x01 /* option is a flag; no parameter */ |
| 41 | #define OPT_INT 0x02 /* argument is an integer */ |
| 42 | #define OPT_STR 0x04 /* argument is a string */ |
| 43 | #define OPT_NOP 0x08 /* flags non-operational options */ |
| 44 | #define OPT_SUB 0x10 /* sub-option defined */ |
| 45 | #define OPT_ADV 0x20 /* advanced option */ |
| 46 | #define OPT_SET 0x40 /* not changeable -- used for default/file/command precedence */ |
| 47 | #define OPT_DFLT 0x80 /* param set to non-zero default */ |
| 48 | #define OPT_MULTI 0x100 /* param may be set repeatedly */ |
| 49 | #define OPT_HIDE 0x200 /* hidden option -- not listed in usage */ |
| 50 | #define TYPE_MASK 0x07 |
| 51 | |
| 52 | typedef struct OPTION_T { |
| 53 | const char *name; |
| 54 | int flags; |
| 55 | int index; |
| 56 | const char *usage; |
| 57 | int (*action)(char *szPName, char *optarg); |
| 58 | const char *dflt; |
| 59 | } option_t; |
| 60 | #endif |
| 61 | /* |
| 62 | * function declarations |
| 63 | */ |
| 64 | int process_options(int count, char **args); |
| 65 | char *get_str(char *var); |
| 66 | void set_str(char *param, char *value); |
| 67 | int get_int(char *var); |
| 68 | void set_int(char *var, char *val); |
| 69 | int is_set(char *flag); |
| 70 | void clr_flg(char *flag); |
| 71 | int find_table(char *szParamName, char *tname); |
| 72 | int read_file(char *param_name, char *arg); |
| 73 | int usage(char *param_name, char *msg); |
| 74 | char *GetParamName(int nParam); |
| 75 | char *GetParamValue(int nParam); |
| 76 | int load_param(int nParam, char *value); |
| 77 | int fnd_param(char *name); |
| 78 | int init_params(void); |
| 79 | int set_option(char *pname, char *value); |
| 80 | void load_params(void); |
| 81 | int IsIntParam(char *szName); |
| 82 | int IsStrParam(char *szName); |
| 83 | |