Line data Source code
1 : /* -*- buffer-read-only: t -*- vi: set ro: 2 : * 3 : * DO NOT EDIT THIS FILE (rsstats-opts.h) 4 : * 5 : * It has been AutoGen-ed 6 : * From the definitions rsstats-opts.def 7 : * and the template file options 8 : * 9 : * Generated from AutoOpts 42:1:17 templates. 10 : * 11 : * AutoOpts is a copyrighted work. This header file is not encumbered 12 : * by AutoOpts licensing, but is provided under the licensing terms chosen 13 : * by the rsstats author or copyright holder. AutoOpts is 14 : * licensed under the terms of the LGPL. The redistributable library 15 : * (``libopts'') is licensed under the terms of either the LGPL or, at the 16 : * users discretion, the BSD license. See the AutoOpts and/or libopts sources 17 : * for details. 18 : * 19 : * The rsstats program is copyrighted and licensed 20 : * under the following terms: 21 : * 22 : * Copyright (C) 2024 Francois Cerbelle, all rights reserved. 23 : * This is free software. It is licensed for use, modification and 24 : * redistribution under the terms of the GNU General Public License, 25 : * version 3 or later <http://gnu.org/licenses/gpl.html> 26 : * 27 : * rsstats is free software: you can redistribute it and/or modify it 28 : * under the terms of the GNU General Public License as published by the 29 : * Free Software Foundation, either version 3 of the License, or 30 : * (at your option) any later version. 31 : * 32 : * rsstats is distributed in the hope that it will be useful, but 33 : * WITHOUT ANY WARRANTY; without even the implied warranty of 34 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 35 : * See the GNU General Public License for more details. 36 : * 37 : * You should have received a copy of the GNU General Public License along 38 : * with this program. If not, see <http://www.gnu.org/licenses/>. 39 : */ 40 : /** 41 : * This file contains the programmatic interface to the Automated 42 : * Options generated for the rsstats program. 43 : * These macros are documented in the AutoGen info file in the 44 : * "AutoOpts" chapter. Please refer to that doc for usage help. 45 : */ 46 : #ifndef AUTOOPTS_RSSTATS_OPTS_H_GUARD 47 : #define AUTOOPTS_RSSTATS_OPTS_H_GUARD 1 48 : #include "config.h" 49 : #include <autoopts/options.h> 50 : #include <stdarg.h> 51 : #include <stdnoreturn.h> 52 : 53 : /** 54 : * Ensure that the library used for compiling this generated header is at 55 : * least as new as the version current when the header template was released 56 : * (not counting patch version increments). Also ensure that the oldest 57 : * tolerable version is at least as old as what was current when the header 58 : * template was released. 59 : */ 60 : #define AO_TEMPLATE_VERSION 172033 61 : #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ 62 : || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) 63 : # error option template version mismatches autoopts/options.h header 64 : Choke Me. 65 : #endif 66 : 67 : #if GCC_VERSION > 40400 68 : #define NOT_REACHED __builtin_unreachable(); 69 : #else 70 : #define NOT_REACHED 71 : #endif 72 : 73 : /** 74 : * Enumeration of each option type for rsstats 75 : */ 76 : typedef enum { 77 : INDEX_OPT_INPUT = 0, 78 : INDEX_OPT_OUTPUT = 1, 79 : INDEX_OPT_CLUSTERS = 2, 80 : INDEX_OPT_REPORTS = 3, 81 : INDEX_OPT_VERSION = 4, 82 : INDEX_OPT_HELP = 5, 83 : INDEX_OPT_MORE_HELP = 6, 84 : INDEX_OPT_SAVE_OPTS = 7, 85 : INDEX_OPT_LOAD_OPTS = 8 86 : } teOptIndex; 87 : /** count of all options for rsstats */ 88 : #define OPTION_CT 9 89 : /** rsstats version */ 90 : #define RSSTATS_VERSION "0.0.1" 91 : /** Full rsstats version text */ 92 : #define RSSTATS_FULL_VERSION "rsstats 0.0.1" 93 : 94 : /** 95 : * Interface defines for all options. Replace "n" with the UPPER_CASED 96 : * option name (as in the teOptIndex enumeration above). 97 : * e.g. HAVE_OPT(INPUT) 98 : */ 99 : #define DESC(n) (rsstatsOptions.pOptDesc[INDEX_OPT_## n]) 100 : /** 'true' if an option has been specified in any way */ 101 : #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) 102 : /** The string argument to an option. The argument type must be \"string\". */ 103 : #define OPT_ARG(n) (DESC(n).optArg.argString) 104 : /** Mask the option state revealing how an option was specified. 105 : * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET, 106 : * \a OPTST_DEFINED, \a OPTST_RESET or zero. 107 : */ 108 : #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) 109 : /** Count of option's occurrances *on the command line*. */ 110 : #define COUNT_OPT(n) (DESC(n).optOccCt) 111 : /** mask of \a OPTST_SET and \a OPTST_DEFINED. */ 112 : #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) 113 : /** 'true' if \a HAVE_OPT would yield 'false'. */ 114 : #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n))) 115 : /** 'true' if OPTST_DISABLED bit not set. */ 116 : #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n))) 117 : /** number of stacked option arguments. 118 : * Valid only for stacked option arguments. */ 119 : #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) 120 : /** stacked argument vector. 121 : * Valid only for stacked option arguments. */ 122 : #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) 123 : /** Reset an option. */ 124 : #define CLEAR_OPT(n) STMTS( \ 125 : DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ 126 : if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \ 127 : DESC(n).fOptState |= OPTST_DISABLED; \ 128 : DESC(n).optCookie = NULL ) 129 : /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 130 : /** 131 : * Enumeration of rsstats exit codes 132 : */ 133 : typedef enum { 134 : RSSTATS_EXIT_SUCCESS = 0, 135 : RSSTATS_EXIT_FAILURE = 1, 136 : RSSTATS_EXIT_USAGE_ERROR = 64, 137 : RSSTATS_EXIT_NO_CONFIG_INPUT = 66, 138 : RSSTATS_EXIT_LIBOPTS_FAILURE = 70 139 : } rsstats_exit_code_t; 140 : /** 141 : * Interface defines for specific options. 142 : * @{ 143 : */ 144 : #define VALUE_OPT_INPUT 'i' 145 : #define VALUE_OPT_OUTPUT 'o' 146 : #define VALUE_OPT_CLUSTERS 'c' 147 : #define VALUE_OPT_REPORTS 'r' 148 : 149 : #define REPORTS_BDBS 0x1UL 150 : #define REPORTS_CLUSTER 0x2UL 151 : #define REPORTS_MEMBERSHIP_MASK 0x3UL 152 : #define OPT_VALUE_REPORTS ((uintptr_t)DESC(REPORTS).optCookie) 153 : #define OPT_MEMLST_REPORTS optionMemberList(&DESC(REPORTS)) 154 : /** option flag (value) for help-value option */ 155 : #define VALUE_OPT_HELP 'h' 156 : /** option flag (value) for more-help-value option */ 157 : #define VALUE_OPT_MORE_HELP 'H' 158 : /** option flag (value) for version-value option */ 159 : #define VALUE_OPT_VERSION 'v' 160 : /** option flag (value) for save-opts-value option */ 161 : #define VALUE_OPT_SAVE_OPTS '>' 162 : /** option flag (value) for load-opts-value option */ 163 : #define VALUE_OPT_LOAD_OPTS '<' 164 : #define SET_OPT_SAVE_OPTS(a) STMTS( \ 165 : DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \ 166 : DESC(SAVE_OPTS).fOptState |= OPTST_SET; \ 167 : DESC(SAVE_OPTS).optArg.argString = (char const*)(a)) 168 : /* 169 : * Interface defines not associated with particular options 170 : */ 171 : #define ERRSKIP_OPTERR STMTS(rsstatsOptions.fOptSet &= ~OPTPROC_ERRSTOP) 172 : #define ERRSTOP_OPTERR STMTS(rsstatsOptions.fOptSet |= OPTPROC_ERRSTOP) 173 : #define RESTART_OPT(n) STMTS( \ 174 : rsstatsOptions.curOptIdx = (n); \ 175 : rsstatsOptions.pzCurOpt = NULL ) 176 : #define START_OPT RESTART_OPT(1) 177 : #define USAGE(c) (*rsstatsOptions.pUsageProc)(&rsstatsOptions, c) 178 : 179 : #ifdef __cplusplus 180 : extern "C" { 181 : #endif 182 : 183 : 184 : /* * * * * * 185 : * 186 : * Declare the rsstats option descriptor. 187 : */ 188 : extern tOptions rsstatsOptions; 189 : 190 : #if defined(ENABLE_NLS) 191 : # ifndef _ 192 : # include <stdio.h> 193 : # ifndef HAVE_GETTEXT 194 : extern char * gettext(char const *); 195 : # else 196 : # include <libintl.h> 197 : # endif 198 : 199 : # ifndef ATTRIBUTE_FORMAT_ARG 200 : # define ATTRIBUTE_FORMAT_ARG(_a) 201 : # endif 202 : 203 : static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1); 204 854 : static inline char* aoGetsText(char const* pz) { 205 854 : if (pz == NULL) return NULL; 206 854 : return (char*)gettext(pz); 207 : } 208 : # define _(s) aoGetsText(s) 209 : # endif /* _() */ 210 : 211 : # define OPT_NO_XLAT_CFG_NAMES STMTS(rsstatsOptions.fOptSet |= \ 212 : OPTPROC_NXLAT_OPT_CFG;) 213 : # define OPT_NO_XLAT_OPT_NAMES STMTS(rsstatsOptions.fOptSet |= \ 214 : OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) 215 : 216 : # define OPT_XLAT_CFG_NAMES STMTS(rsstatsOptions.fOptSet &= \ 217 : ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) 218 : # define OPT_XLAT_OPT_NAMES STMTS(rsstatsOptions.fOptSet &= \ 219 : ~OPTPROC_NXLAT_OPT;) 220 : 221 : #else /* ENABLE_NLS */ 222 : # define OPT_NO_XLAT_CFG_NAMES 223 : # define OPT_NO_XLAT_OPT_NAMES 224 : 225 : # define OPT_XLAT_CFG_NAMES 226 : # define OPT_XLAT_OPT_NAMES 227 : 228 : # ifndef _ 229 : # define _(_s) _s 230 : # endif 231 : #endif /* ENABLE_NLS */ 232 : 233 : 234 : #ifdef __cplusplus 235 : } 236 : #endif 237 : #endif /* AUTOOPTS_RSSTATS_OPTS_H_GUARD */ 238 : 239 : /* rsstats-opts.h ends here */