LCOV - code coverage report
Current view: top level - src - rsstats-opts.h (source / functions) Hit Total Coverage
Test: mkernel.info Lines: 3 3 100.0 %
Date: 2024-12-05 21:00:54 Functions: 1 1 100.0 %

          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_SAMPLE           0x1UL
     150             : #define REPORTS_BDBS             0x2UL
     151             : #define REPORTS_CLUSTER          0x4UL
     152             : #define REPORTS_MEMBERSHIP_MASK  0x7UL
     153             : #define OPT_VALUE_REPORTS        ((uintptr_t)DESC(REPORTS).optCookie)
     154             : #define OPT_MEMLST_REPORTS       optionMemberList(&DESC(REPORTS))
     155             : /** option flag (value) for help-value option */
     156             : #define VALUE_OPT_HELP          'h'
     157             : /** option flag (value) for more-help-value option */
     158             : #define VALUE_OPT_MORE_HELP     'H'
     159             : /** option flag (value) for version-value option */
     160             : #define VALUE_OPT_VERSION       'v'
     161             : /** option flag (value) for save-opts-value option */
     162             : #define VALUE_OPT_SAVE_OPTS     '>'
     163             : /** option flag (value) for load-opts-value option */
     164             : #define VALUE_OPT_LOAD_OPTS     '<'
     165             : #define SET_OPT_SAVE_OPTS(a)   STMTS( \
     166             :         DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
     167             :         DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
     168             :         DESC(SAVE_OPTS).optArg.argString = (char const*)(a))
     169             : /*
     170             :  *  Interface defines not associated with particular options
     171             :  */
     172             : #define ERRSKIP_OPTERR  STMTS(rsstatsOptions.fOptSet &= ~OPTPROC_ERRSTOP)
     173             : #define ERRSTOP_OPTERR  STMTS(rsstatsOptions.fOptSet |= OPTPROC_ERRSTOP)
     174             : #define RESTART_OPT(n)  STMTS( \
     175             :                 rsstatsOptions.curOptIdx = (n); \
     176             :                 rsstatsOptions.pzCurOpt  = NULL )
     177             : #define START_OPT       RESTART_OPT(1)
     178             : #define USAGE(c)        (*rsstatsOptions.pUsageProc)(&rsstatsOptions, c)
     179             : 
     180             : #ifdef  __cplusplus
     181             : extern "C" {
     182             : #endif
     183             : 
     184             : 
     185             : /* * * * * *
     186             :  *
     187             :  *  Declare the rsstats option descriptor.
     188             :  */
     189             : extern tOptions rsstatsOptions;
     190             : 
     191             : #if defined(ENABLE_NLS)
     192             : # ifndef _
     193             : #   include <stdio.h>
     194             : #   ifndef HAVE_GETTEXT
     195             :       extern char * gettext(char const *);
     196             : #   else
     197             : #     include <libintl.h>
     198             : #   endif
     199             : 
     200             : # ifndef ATTRIBUTE_FORMAT_ARG
     201             : #   define ATTRIBUTE_FORMAT_ARG(_a)
     202             : # endif
     203             : 
     204             : static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
     205        3172 : static inline char* aoGetsText(char const* pz) {
     206        3172 :     if (pz == NULL) return NULL;
     207        3172 :     return (char*)gettext(pz);
     208             : }
     209             : #   define _(s)  aoGetsText(s)
     210             : # endif /* _() */
     211             : 
     212             : # define OPT_NO_XLAT_CFG_NAMES  STMTS(rsstatsOptions.fOptSet |= \
     213             :                                     OPTPROC_NXLAT_OPT_CFG;)
     214             : # define OPT_NO_XLAT_OPT_NAMES  STMTS(rsstatsOptions.fOptSet |= \
     215             :                                     OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
     216             : 
     217             : # define OPT_XLAT_CFG_NAMES     STMTS(rsstatsOptions.fOptSet &= \
     218             :                                   ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
     219             : # define OPT_XLAT_OPT_NAMES     STMTS(rsstatsOptions.fOptSet &= \
     220             :                                   ~OPTPROC_NXLAT_OPT;)
     221             : 
     222             : #else   /* ENABLE_NLS */
     223             : # define OPT_NO_XLAT_CFG_NAMES
     224             : # define OPT_NO_XLAT_OPT_NAMES
     225             : 
     226             : # define OPT_XLAT_CFG_NAMES
     227             : # define OPT_XLAT_OPT_NAMES
     228             : 
     229             : # ifndef _
     230             : #   define _(_s)  _s
     231             : # endif
     232             : #endif  /* ENABLE_NLS */
     233             : 
     234             : 
     235             : #ifdef  __cplusplus
     236             : }
     237             : #endif
     238             : #endif /* AUTOOPTS_RSSTATS_OPTS_H_GUARD */
     239             : 
     240             : /* rsstats-opts.h ends here */

Generated by: LCOV version 1.16