genshell.h 5.2 KB

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