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