genshell.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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 17, 2005 at 11:55:00 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-2005 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. * 59 Temple Place - Suite 330,
  34. * Boston, MA 02111-1307, USA.
  35. */
  36. #include <autoopts/options.h>
  37. /*
  38. * Enumeration of each option:
  39. */
  40. typedef enum {
  41. INDEX_OPT_SCRIPT = 0,
  42. INDEX_OPT_SHELL = 1,
  43. INDEX_OPT_VERSION = 2,
  44. INDEX_OPT_HELP = 3,
  45. INDEX_OPT_MORE_HELP = 4
  46. } teOptIndex;
  47. #define OPTION_CT 5
  48. #define GENSHELLOPT_VERSION "1"
  49. #define GENSHELLOPT_FULL_VERSION "genshellopt - Generate Shell Option Processing Script - Ver. 1"
  50. /*
  51. * Interface defines for all options. Replace "n" with
  52. * the UPPER_CASED option name (as in the teOptIndex
  53. * enumeration above). e.g. HAVE_OPT( SCRIPT )
  54. */
  55. #define DESC(n) genshelloptOptions.pOptDesc[INDEX_OPT_ ## n]
  56. #define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
  57. #define OPT_ARG(n) (DESC(n).pzLastArg)
  58. #define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
  59. #define COUNT_OPT(n) (DESC(n).optOccCt)
  60. #define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
  61. #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
  62. #define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
  63. #define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
  64. #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
  65. #define CLEAR_OPT(n) STMTS( \
  66. DESC(n).fOptState &= OPTST_PERSISTENT; \
  67. if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
  68. DESC(n).fOptState |= OPTST_DISABLED; \
  69. DESC(n).optCookie = NULL )
  70. /*
  71. * Interface defines for specific options.
  72. */
  73. #define VALUE_OPT_SCRIPT 'o'
  74. #define VALUE_OPT_SHELL 's'
  75. #define VALUE_OPT_VERSION 'v'
  76. #define VALUE_OPT_HELP '?'
  77. #define VALUE_OPT_MORE_HELP '!'
  78. /*
  79. * Interface defines not associated with particular options
  80. */
  81. #define ERRSKIP_OPTERR STMTS( genshelloptOptions.fOptSet &= ~OPTPROC_ERRSTOP )
  82. #define ERRSTOP_OPTERR STMTS( genshelloptOptions.fOptSet |= OPTPROC_ERRSTOP )
  83. #define RESTART_OPT(n) STMTS( \
  84. genshelloptOptions.curOptIdx = (n); \
  85. genshelloptOptions.pzCurOpt = NULL )
  86. #define START_OPT RESTART_OPT(1)
  87. #define USAGE(c) (*genshelloptOptions.pUsageProc)( &genshelloptOptions, c )
  88. /* extracted from opthead.tpl near line 246 */
  89. /* * * * * *
  90. *
  91. * Declare the genshellopt option descriptor.
  92. */
  93. #ifdef __cplusplus
  94. extern "C" {
  95. #endif
  96. extern tOptions genshelloptOptions;
  97. #ifndef _
  98. # if ENABLE_NLS
  99. # include <stdio.h>
  100. static inline char* aoGetsText( const char* pz ) {
  101. if (pz == NULL) return NULL;
  102. return (char*)gettext( pz );
  103. }
  104. # define _(s) aoGetsText(s)
  105. # else /* ENABLE_NLS */
  106. # define _(s) s
  107. # endif /* ENABLE_NLS */
  108. #endif
  109. #ifdef __cplusplus
  110. }
  111. #endif
  112. #endif /* AUTOOPTS_GENSHELL_H_GUARD */