genshell.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /* -*- buffer-read-only: t -*- vi: set ro:
  2. *
  3. * DO NOT EDIT THIS FILE (genshell.h)
  4. *
  5. * It has been AutoGen-ed Wednesday December 31, 2008 at 07:07:16 PM PST
  6. * From the definitions genshell.def
  7. * and the template file options
  8. *
  9. * Generated from AutoOpts 32:0:7 templates.
  10. */
  11. /*
  12. * This file was produced by an AutoOpts template. AutoOpts is a
  13. * copyrighted work. This header file is not encumbered by AutoOpts
  14. * licensing, but is provided under the licensing terms chosen by the
  15. * genshellopt author or copyright holder. AutoOpts is licensed under
  16. * the terms of the LGPL. The redistributable library (``libopts'') is
  17. * licensed under the terms of either the LGPL or, at the users discretion,
  18. * the BSD license. See the AutoOpts and/or libopts sources for details.
  19. *
  20. * This source file is copyrighted and licensed under the following terms:
  21. *
  22. * genshellopt copyright 1999-2007 Bruce Korb - all rights reserved
  23. *
  24. * genshellopt is free software: you can redistribute it and/or modify it
  25. * under the terms of the GNU General Public License as published by the
  26. * Free Software Foundation, either version 3 of the License, or
  27. * (at your option) any later version.
  28. *
  29. * genshellopt is distributed in the hope that it will be useful, but
  30. * WITHOUT ANY WARRANTY; without even the implied warranty of
  31. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  32. * See the GNU General Public License for more details.
  33. *
  34. * You should have received a copy of the GNU General Public License along
  35. * with this program. If not, see <http://www.gnu.org/licenses/>.
  36. */
  37. /*
  38. * This file contains the programmatic interface to the Automated
  39. * Options generated for the genshellopt program.
  40. * These macros are documented in the AutoGen info file in the
  41. * "AutoOpts" chapter. Please refer to that doc for usage help.
  42. */
  43. #ifndef AUTOOPTS_GENSHELL_H_GUARD
  44. #define AUTOOPTS_GENSHELL_H_GUARD 1
  45. #include <autoopts/options.h>
  46. /*
  47. * Ensure that the library used for compiling this generated header is at
  48. * least as new as the version current when the header template was released
  49. * (not counting patch version increments). Also ensure that the oldest
  50. * tolerable version is at least as old as what was current when the header
  51. * template was released.
  52. */
  53. #define AO_TEMPLATE_VERSION 131072
  54. #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
  55. || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
  56. # error option template version mismatches autoopts/options.h header
  57. Choke Me.
  58. #endif
  59. /*
  60. * Enumeration of each option:
  61. */
  62. typedef enum {
  63. INDEX_OPT_SCRIPT = 0,
  64. INDEX_OPT_SHELL = 1,
  65. INDEX_OPT_VERSION = 2,
  66. INDEX_OPT_HELP = 3,
  67. INDEX_OPT_MORE_HELP = 4
  68. } teOptIndex;
  69. #define OPTION_CT 5
  70. #define GENSHELLOPT_VERSION "1"
  71. #define GENSHELLOPT_FULL_VERSION "genshellopt - Generate Shell Option Processing Script - Ver. 1"
  72. /*
  73. * Interface defines for all options. Replace "n" with the UPPER_CASED
  74. * option name (as in the teOptIndex enumeration above).
  75. * e.g. HAVE_OPT( SCRIPT )
  76. */
  77. #define DESC(n) (genshelloptOptions.pOptDesc[INDEX_OPT_## n])
  78. #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
  79. #define OPT_ARG(n) (DESC(n).optArg.argString)
  80. #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
  81. #define COUNT_OPT(n) (DESC(n).optOccCt)
  82. #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
  83. #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
  84. #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
  85. #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
  86. #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
  87. #define CLEAR_OPT(n) STMTS( \
  88. DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
  89. if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
  90. DESC(n).fOptState |= OPTST_DISABLED; \
  91. DESC(n).optCookie = NULL )
  92. /* * * * * *
  93. *
  94. * Interface defines for specific options.
  95. */
  96. #define VALUE_OPT_SCRIPT 'o'
  97. #define VALUE_OPT_SHELL 's'
  98. #define VALUE_OPT_HELP '?'
  99. #define VALUE_OPT_MORE_HELP '!'
  100. #define VALUE_OPT_VERSION 'v'
  101. /*
  102. * Interface defines not associated with particular options
  103. */
  104. #define ERRSKIP_OPTERR STMTS( genshelloptOptions.fOptSet &= ~OPTPROC_ERRSTOP )
  105. #define ERRSTOP_OPTERR STMTS( genshelloptOptions.fOptSet |= OPTPROC_ERRSTOP )
  106. #define RESTART_OPT(n) STMTS( \
  107. genshelloptOptions.curOptIdx = (n); \
  108. genshelloptOptions.pzCurOpt = NULL )
  109. #define START_OPT RESTART_OPT(1)
  110. #define USAGE(c) (*genshelloptOptions.pUsageProc)( &genshelloptOptions, c )
  111. /* extracted from opthead.tpl near line 415 */
  112. /* * * * * *
  113. *
  114. * Declare the genshellopt option descriptor.
  115. */
  116. #ifdef __cplusplus
  117. extern "C" {
  118. #endif
  119. extern tOptions genshelloptOptions;
  120. #if defined(ENABLE_NLS)
  121. # ifndef _
  122. # include <stdio.h>
  123. static inline char* aoGetsText( char const* pz ) {
  124. if (pz == NULL) return NULL;
  125. return (char*)gettext( pz );
  126. }
  127. # define _(s) aoGetsText(s)
  128. # endif /* _() */
  129. # define OPT_NO_XLAT_CFG_NAMES STMTS(genshelloptOptions.fOptSet |= \
  130. OPTPROC_NXLAT_OPT_CFG;)
  131. # define OPT_NO_XLAT_OPT_NAMES STMTS(genshelloptOptions.fOptSet |= \
  132. OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
  133. # define OPT_XLAT_CFG_NAMES STMTS(genshelloptOptions.fOptSet &= \
  134. ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
  135. # define OPT_XLAT_OPT_NAMES STMTS(genshelloptOptions.fOptSet &= \
  136. ~OPTPROC_NXLAT_OPT;)
  137. #else /* ENABLE_NLS */
  138. # define OPT_NO_XLAT_CFG_NAMES
  139. # define OPT_NO_XLAT_OPT_NAMES
  140. # define OPT_XLAT_CFG_NAMES
  141. # define OPT_XLAT_OPT_NAMES
  142. # ifndef _
  143. # define _(_s) _s
  144. # endif
  145. #endif /* ENABLE_NLS */
  146. #ifdef __cplusplus
  147. }
  148. #endif
  149. #endif /* AUTOOPTS_GENSHELL_H_GUARD */
  150. /* genshell.h ends here */