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