genshell.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /* -*- buffer-read-only: t -*- vi: set ro:
  2. *
  3. * DO NOT EDIT THIS FILE (genshell.h)
  4. *
  5. * It has been AutoGen-ed Sunday April 9, 2006 at 11:49:19 AM PDT
  6. * From the definitions genshell.def
  7. * and the template file options
  8. */
  9. /*
  10. * This file contains the programmatic interface to the Automated
  11. * Options generated for the genshellopt program.
  12. * These macros are documented in the AutoGen info file in the
  13. * "AutoOpts" chapter. Please refer to that doc for usage help.
  14. */
  15. #ifndef AUTOOPTS_GENSHELL_H_GUARD
  16. #define AUTOOPTS_GENSHELL_H_GUARD
  17. /*
  18. * genshellopt copyright 1999-2006 Bruce Korb - all rights reserved
  19. *
  20. * genshellopt is free software; you can redistribute it and/or
  21. * modify it under the terms of the GNU Lesser General Public
  22. * License as published by the Free Software Foundation; either
  23. * version 2.1 of the License, or (at your option) any later version.
  24. *
  25. * genshellopt is distributed in the hope that it will be useful,
  26. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  27. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  28. * Lesser General Public License for more details.
  29. *
  30. * You should have received a copy of the GNU Lesser General Public
  31. * License along with genshellopt. If not, write to:
  32. * The Free Software Foundation, Inc.,
  33. * 51 Franklin Street, Fifth Floor
  34. * Boston, MA 02110-1301, USA.
  35. */
  36. #include <autoopts/options.h>
  37. /*
  38. * Ensure that the library used for compiling this generated header is at
  39. * least as new as the version current when the header template was released
  40. * (not counting patch version increments). Also ensure that the oldest
  41. * tolerable version is at least as old as what was current when the header
  42. * template was released.
  43. */
  44. #define AO_TEMPLATE_VERSION 110592
  45. #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
  46. || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
  47. # error option template version mismatches autoopts/options.h header
  48. #endif
  49. /*
  50. * Enumeration of each option:
  51. */
  52. typedef enum {
  53. INDEX_OPT_SCRIPT = 0,
  54. INDEX_OPT_SHELL = 1,
  55. INDEX_OPT_VERSION = 2,
  56. INDEX_OPT_HELP = 3,
  57. INDEX_OPT_MORE_HELP = 4
  58. } teOptIndex;
  59. #define OPTION_CT 5
  60. #define GENSHELLOPT_VERSION "1"
  61. #define GENSHELLOPT_FULL_VERSION "genshellopt - Generate Shell Option Processing Script - Ver. 1"
  62. /*
  63. * Interface defines for all options. Replace "n" with
  64. * the UPPER_CASED option name (as in the teOptIndex
  65. * enumeration above). e.g. HAVE_OPT( SCRIPT )
  66. */
  67. #define DESC(n) genshelloptOptions.pOptDesc[INDEX_OPT_ ## n]
  68. #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
  69. #define OPT_ARG(n) (DESC(n).pzLastArg)
  70. #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
  71. #define COUNT_OPT(n) (DESC(n).optOccCt)
  72. #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
  73. #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
  74. #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
  75. #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
  76. #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
  77. #define CLEAR_OPT(n) STMTS( \
  78. DESC(n).fOptState &= OPTST_PERSISTENT; \
  79. if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
  80. DESC(n).fOptState |= OPTST_DISABLED; \
  81. DESC(n).optCookie = NULL )
  82. /*
  83. * Interface defines for specific options.
  84. */
  85. #define VALUE_OPT_SCRIPT 'o'
  86. #define VALUE_OPT_SHELL 's'
  87. #define VALUE_OPT_VERSION 'v'
  88. #define VALUE_OPT_HELP '?'
  89. #define VALUE_OPT_MORE_HELP '!'
  90. /*
  91. * Interface defines not associated with particular options
  92. */
  93. #define ERRSKIP_OPTERR STMTS( genshelloptOptions.fOptSet &= ~OPTPROC_ERRSTOP )
  94. #define ERRSTOP_OPTERR STMTS( genshelloptOptions.fOptSet |= OPTPROC_ERRSTOP )
  95. #define RESTART_OPT(n) STMTS( \
  96. genshelloptOptions.curOptIdx = (n); \
  97. genshelloptOptions.pzCurOpt = NULL )
  98. #define START_OPT RESTART_OPT(1)
  99. #define USAGE(c) (*genshelloptOptions.pUsageProc)( &genshelloptOptions, c )
  100. /* extracted from opthead near line 289 */
  101. /* * * * * *
  102. *
  103. * Declare the genshellopt option descriptor.
  104. */
  105. #ifdef __cplusplus
  106. extern "C" {
  107. #endif
  108. extern tOptions genshelloptOptions;
  109. #ifndef _
  110. # if ENABLE_NLS
  111. # include <stdio.h>
  112. static inline char* aoGetsText( const char* pz ) {
  113. if (pz == NULL) return NULL;
  114. return (char*)gettext( pz );
  115. }
  116. # define _(s) aoGetsText(s)
  117. # else /* ENABLE_NLS */
  118. # define _(s) s
  119. # endif /* ENABLE_NLS */
  120. #endif
  121. #ifdef __cplusplus
  122. }
  123. #endif
  124. #endif /* AUTOOPTS_GENSHELL_H_GUARD */
  125. /*
  126. * Local Variables:
  127. * Mode: C
  128. * c-file-style: "stroustrup"
  129. * indent-tabs-mode: nil
  130. * End:
  131. * options.h ends here */