1181834Sroberto/* -*- buffer-read-only: t -*- vi: set ro: 2181834Sroberto * 3181834Sroberto * DO NOT EDIT THIS FILE (genshell.h) 4181834Sroberto * 5181834Sroberto * It has been AutoGen-ed Saturday May 5, 2007 at 12:02:35 PM PDT 6181834Sroberto * From the definitions genshell.def 7181834Sroberto * and the template file options 8181834Sroberto * 9181834Sroberto * Generated from AutoOpts 29:0:4 templates. 10181834Sroberto */ 11181834Sroberto 12181834Sroberto/* 13181834Sroberto * This file was produced by an AutoOpts template. AutoOpts is a 14181834Sroberto * copyrighted work. This header file is not encumbered by AutoOpts 15181834Sroberto * licensing, but is provided under the licensing terms chosen by the 16181834Sroberto * genshellopt author or copyright holder. AutoOpts is licensed under 17181834Sroberto * the terms of the LGPL. The redistributable library (``libopts'') is 18181834Sroberto * licensed under the terms of either the LGPL or, at the users discretion, 19181834Sroberto * the BSD license. See the AutoOpts and/or libopts sources for details. 20181834Sroberto * 21181834Sroberto * This source file is copyrighted and licensed under the following terms: 22181834Sroberto * 23181834Sroberto * genshellopt copyright 1999-2007 Bruce Korb - all rights reserved 24181834Sroberto * 25181834Sroberto * genshellopt is free software; you can redistribute it and/or 26181834Sroberto * modify it under the terms of the GNU Lesser General Public 27181834Sroberto * License as published by the Free Software Foundation; either 28181834Sroberto * version 2.1 of the License, or (at your option) any later version. 29181834Sroberto * 30181834Sroberto * genshellopt is distributed in the hope that it will be useful, 31181834Sroberto * but WITHOUT ANY WARRANTY; without even the implied warranty of 32181834Sroberto * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 33181834Sroberto * Lesser General Public License for more details. 34181834Sroberto * 35181834Sroberto * You should have received a copy of the GNU Lesser General Public 36181834Sroberto * License along with genshellopt. If not, write to: 37181834Sroberto * The Free Software Foundation, Inc., 38181834Sroberto * 51 Franklin Street, Fifth Floor 39181834Sroberto * Boston, MA 02110-1301, USA. 40181834Sroberto */ 41181834Sroberto/* 42181834Sroberto * This file contains the programmatic interface to the Automated 43181834Sroberto * Options generated for the genshellopt program. 44181834Sroberto * These macros are documented in the AutoGen info file in the 45181834Sroberto * "AutoOpts" chapter. Please refer to that doc for usage help. 46181834Sroberto */ 47181834Sroberto#ifndef AUTOOPTS_GENSHELL_H_GUARD 48181834Sroberto#define AUTOOPTS_GENSHELL_H_GUARD 49181834Sroberto#include <autoopts/options.h> 50181834Sroberto 51181834Sroberto/* 52181834Sroberto * Ensure that the library used for compiling this generated header is at 53181834Sroberto * least as new as the version current when the header template was released 54181834Sroberto * (not counting patch version increments). Also ensure that the oldest 55181834Sroberto * tolerable version is at least as old as what was current when the header 56181834Sroberto * template was released. 57181834Sroberto */ 58181834Sroberto#define AO_TEMPLATE_VERSION 118784 59181834Sroberto#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ 60181834Sroberto || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) 61181834Sroberto# error option template version mismatches autoopts/options.h header 62181834Sroberto Choke Me. 63181834Sroberto#endif 64181834Sroberto 65181834Sroberto/* 66181834Sroberto * Enumeration of each option: 67181834Sroberto */ 68181834Srobertotypedef enum { 69181834Sroberto INDEX_OPT_SCRIPT = 0, 70181834Sroberto INDEX_OPT_SHELL = 1, 71181834Sroberto INDEX_OPT_VERSION = 2, 72181834Sroberto INDEX_OPT_HELP = 3, 73181834Sroberto INDEX_OPT_MORE_HELP = 4 74181834Sroberto} teOptIndex; 75181834Sroberto 76181834Sroberto#define OPTION_CT 5 77181834Sroberto#define GENSHELLOPT_VERSION "1" 78181834Sroberto#define GENSHELLOPT_FULL_VERSION "genshellopt - Generate Shell Option Processing Script - Ver. 1" 79181834Sroberto 80181834Sroberto/* 81181834Sroberto * Interface defines for all options. Replace "n" with the UPPER_CASED 82181834Sroberto * option name (as in the teOptIndex enumeration above). 83181834Sroberto * e.g. HAVE_OPT( SCRIPT ) 84181834Sroberto */ 85181834Sroberto#define DESC(n) (genshelloptOptions.pOptDesc[INDEX_OPT_## n]) 86181834Sroberto#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) 87181834Sroberto#define OPT_ARG(n) (DESC(n).optArg.argString) 88181834Sroberto#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) 89181834Sroberto#define COUNT_OPT(n) (DESC(n).optOccCt) 90181834Sroberto#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) 91181834Sroberto#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n))) 92181834Sroberto#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n))) 93181834Sroberto#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) 94181834Sroberto#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) 95181834Sroberto#define CLEAR_OPT(n) STMTS( \ 96181834Sroberto DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ 97181834Sroberto if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \ 98181834Sroberto DESC(n).fOptState |= OPTST_DISABLED; \ 99181834Sroberto DESC(n).optCookie = NULL ) 100181834Sroberto 101181834Sroberto/* 102181834Sroberto * Interface defines for specific options. 103181834Sroberto */ 104181834Sroberto#define VALUE_OPT_SCRIPT 'o' 105181834Sroberto#define VALUE_OPT_SHELL 's' 106181834Sroberto 107181834Sroberto#define VALUE_OPT_VERSION 'v' 108181834Sroberto#define VALUE_OPT_HELP '?' 109181834Sroberto#define VALUE_OPT_MORE_HELP '!' 110181834Sroberto/* 111181834Sroberto * Interface defines not associated with particular options 112181834Sroberto */ 113181834Sroberto#define ERRSKIP_OPTERR STMTS( genshelloptOptions.fOptSet &= ~OPTPROC_ERRSTOP ) 114181834Sroberto#define ERRSTOP_OPTERR STMTS( genshelloptOptions.fOptSet |= OPTPROC_ERRSTOP ) 115181834Sroberto#define RESTART_OPT(n) STMTS( \ 116181834Sroberto genshelloptOptions.curOptIdx = (n); \ 117181834Sroberto genshelloptOptions.pzCurOpt = NULL ) 118181834Sroberto#define START_OPT RESTART_OPT(1) 119181834Sroberto#define USAGE(c) (*genshelloptOptions.pUsageProc)( &genshelloptOptions, c ) 120181834Sroberto/* extracted from opthead.tpl near line 360 */ 121181834Sroberto 122181834Sroberto/* * * * * * 123181834Sroberto * 124181834Sroberto * Declare the genshellopt option descriptor. 125181834Sroberto */ 126181834Sroberto#ifdef __cplusplus 127181834Srobertoextern "C" { 128181834Sroberto#endif 129181834Sroberto 130181834Srobertoextern tOptions genshelloptOptions; 131181834Sroberto 132181834Sroberto#ifndef _ 133181834Sroberto# if ENABLE_NLS 134181834Sroberto# include <stdio.h> 135181834Sroberto static inline char* aoGetsText( char const* pz ) { 136181834Sroberto if (pz == NULL) return NULL; 137181834Sroberto return (char*)gettext( pz ); 138181834Sroberto } 139181834Sroberto# define _(s) aoGetsText(s) 140181834Sroberto# else /* ENABLE_NLS */ 141181834Sroberto# define _(s) s 142181834Sroberto# endif /* ENABLE_NLS */ 143181834Sroberto#endif 144181834Sroberto 145181834Sroberto#ifdef __cplusplus 146181834Sroberto} 147181834Sroberto#endif 148181834Sroberto#endif /* AUTOOPTS_GENSHELL_H_GUARD */ 149181834Sroberto/* genshell.h ends here */ 150