1181834Sroberto/* -*- buffer-read-only: t -*- vi: set ro: 2285612Sdelphij * 3181834Sroberto * DO NOT EDIT THIS FILE (genshell.h) 4285612Sdelphij * 5285612Sdelphij * It has been AutoGen-ed 6181834Sroberto * From the definitions genshell.def 7181834Sroberto * and the template file options 8181834Sroberto * 9285612Sdelphij * Generated from AutoOpts 41:0:16 templates. 10181834Sroberto * 11285612Sdelphij * AutoOpts is a copyrighted work. This header file is not encumbered 12285612Sdelphij * by AutoOpts licensing, but is provided under the licensing terms chosen 13285612Sdelphij * by the genshellopt author or copyright holder. AutoOpts is 14285612Sdelphij * licensed under the terms of the LGPL. The redistributable library 15285612Sdelphij * (``libopts'') is licensed under the terms of either the LGPL or, at the 16285612Sdelphij * users discretion, the BSD license. See the AutoOpts and/or libopts sources 17285612Sdelphij * for details. 18181834Sroberto * 19285612Sdelphij * The genshellopt program is copyrighted and licensed 20285612Sdelphij * under the following terms: 21181834Sroberto * 22285612Sdelphij * Copyright (C) 1999-2014 Bruce Korb, all rights reserved. 23285612Sdelphij * This is free software. It is licensed for use, modification and 24285612Sdelphij * redistribution under the terms of the GNU Lesser General Public License, 25285612Sdelphij * version 2 or later <http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html> 26285612Sdelphij * 27285612Sdelphij * The genshellopt library is free software; you can redistribute it and/or 28285612Sdelphij * modify it under the terms of the GNU Library General Public License as 29285612Sdelphij * published by the Free Software Foundation; either version 2 of the 30285612Sdelphij * License, or (at your option) any later version. 31285612Sdelphij * 32285612Sdelphij * This library is distributed in the hope that it will be useful, but 33285612Sdelphij * WITHOUT ANY WARRANTY; without even the implied warranty of 34285612Sdelphij * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 35285612Sdelphij * Library General Public License for more details. 36285612Sdelphij * 37285612Sdelphij * You should have received a copy of the GNU Library General Public 38285612Sdelphij * License along with this library; if not, see 39285612Sdelphij * <http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html> 40181834Sroberto */ 41285612Sdelphij/** 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 48285612Sdelphij#define AUTOOPTS_GENSHELL_H_GUARD 1 49181834Sroberto#include <autoopts/options.h> 50181834Sroberto 51285612Sdelphij/** 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 */ 58285612Sdelphij#define AO_TEMPLATE_VERSION 167936 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 65285612Sdelphij/** 66285612Sdelphij * Enumeration of each option type for genshellopt 67181834Sroberto */ 68181834Srobertotypedef enum { 69285612Sdelphij INDEX_GENSHELL_OPT_SCRIPT = 0, 70285612Sdelphij INDEX_GENSHELL_OPT_SHELL = 1, 71285612Sdelphij INDEX_GENSHELL_OPT_VERSION = 2, 72285612Sdelphij INDEX_GENSHELL_OPT_HELP = 3, 73285612Sdelphij INDEX_GENSHELL_OPT_MORE_HELP = 4 74285612Sdelphij} teGenshell_OptIndex; 75285612Sdelphij/** count of all options for genshellopt */ 76285612Sdelphij#define GENSHELL_OPTION_CT 5 77285612Sdelphij/** genshellopt version */ 78181834Sroberto#define GENSHELLOPT_VERSION "1" 79285612Sdelphij/** Full genshellopt version text */ 80285612Sdelphij#define GENSHELLOPT_FULL_VERSION "genshellopt 1" 81181834Sroberto 82285612Sdelphij/** 83181834Sroberto * Interface defines for all options. Replace "n" with the UPPER_CASED 84285612Sdelphij * option name (as in the teGenshell_OptIndex enumeration above). 85285612Sdelphij * e.g. HAVE_GENSHELL_OPT(SCRIPT) 86181834Sroberto */ 87285612Sdelphij#define GENSHELL_DESC(n) (genshelloptOptions.pOptDesc[INDEX_GENSHELL_OPT_## n]) 88285612Sdelphij/** 'true' if an option has been specified in any way */ 89285612Sdelphij#define HAVE_GENSHELL_OPT(n) (! UNUSED_OPT(& GENSHELL_DESC(n))) 90285612Sdelphij/** The string argument to an option. The argument type must be \"string\". */ 91285612Sdelphij#define GENSHELL_OPT_ARG(n) (GENSHELL_DESC(n).optArg.argString) 92285612Sdelphij/** Mask the option state revealing how an option was specified. 93285612Sdelphij * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET, 94285612Sdelphij * \a OPTST_DEFINED, \a OPTST_RESET or zero. 95285612Sdelphij */ 96285612Sdelphij#define STATE_GENSHELL_OPT(n) (GENSHELL_DESC(n).fOptState & OPTST_SET_MASK) 97285612Sdelphij/** Count of option's occurrances *on the command line*. */ 98285612Sdelphij#define COUNT_GENSHELL_OPT(n) (GENSHELL_DESC(n).optOccCt) 99285612Sdelphij/** mask of \a OPTST_SET and \a OPTST_DEFINED. */ 100285612Sdelphij#define ISSEL_GENSHELL_OPT(n) (SELECTED_OPT(&GENSHELL_DESC(n))) 101285612Sdelphij/** 'true' if \a HAVE_OPT would yield 'false'. */ 102285612Sdelphij#define ISUNUSED_GENSHELL_OPT(n) (UNUSED_OPT(& GENSHELL_DESC(n))) 103285612Sdelphij/** 'true' if OPTST_DISABLED bit not set. */ 104285612Sdelphij#define ENABLED_GENSHELL_OPT(n) (! DISABLED_OPT(& GENSHELL_DESC(n))) 105285612Sdelphij/** number of stacked option arguments. 106285612Sdelphij * Valid only for stacked option arguments. */ 107285612Sdelphij#define STACKCT_GENSHELL_OPT(n) (((tArgList*)(GENSHELL_DESC(n).optCookie))->useCt) 108285612Sdelphij/** stacked argument vector. 109285612Sdelphij * Valid only for stacked option arguments. */ 110285612Sdelphij#define STACKLST_GENSHELL_OPT(n) (((tArgList*)(GENSHELL_DESC(n).optCookie))->apzArgs) 111285612Sdelphij/** Reset an option. */ 112285612Sdelphij#define CLEAR_GENSHELL_OPT(n) STMTS( \ 113285612Sdelphij GENSHELL_DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ 114285612Sdelphij if ((GENSHELL_DESC(n).fOptState & OPTST_INITENABLED) == 0) \ 115285612Sdelphij GENSHELL_DESC(n).fOptState |= OPTST_DISABLED; \ 116285612Sdelphij GENSHELL_DESC(n).optCookie = NULL ) 117285612Sdelphij/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 118285612Sdelphij/** 119285612Sdelphij * Enumeration of genshellopt exit codes 120285612Sdelphij */ 121285612Sdelphijtypedef enum { 122285612Sdelphij GENSHELLOPT_EXIT_SUCCESS = 0, 123285612Sdelphij GENSHELLOPT_EXIT_FAILURE = 1, 124285612Sdelphij GENSHELLOPT_EXIT_USAGE_ERROR = 64, 125285612Sdelphij GENSHELLOPT_EXIT_LIBOPTS_FAILURE = 70 126285612Sdelphij} genshellopt_exit_code_t; 127285612Sdelphij/** 128181834Sroberto * Interface defines for specific options. 129285612Sdelphij * @{ 130181834Sroberto */ 131285612Sdelphij#define VALUE_GENSHELL_OPT_SCRIPT 'o' 132285612Sdelphij#define VALUE_GENSHELL_OPT_SHELL 's' 133285612Sdelphij/** option flag (value) for help-value option */ 134285612Sdelphij#define VALUE_GENSHELL_OPT_HELP '?' 135285612Sdelphij/** option flag (value) for more-help-value option */ 136285612Sdelphij#define VALUE_GENSHELL_OPT_MORE_HELP '!' 137285612Sdelphij/** option flag (value) for version-value option */ 138285612Sdelphij#define VALUE_GENSHELL_OPT_VERSION 'v' 139181834Sroberto/* 140181834Sroberto * Interface defines not associated with particular options 141181834Sroberto */ 142285612Sdelphij#define ERRSKIP_GENSHELL_OPTERR STMTS(genshelloptOptions.fOptSet &= ~OPTPROC_ERRSTOP) 143285612Sdelphij#define ERRSTOP_GENSHELL_OPTERR STMTS(genshelloptOptions.fOptSet |= OPTPROC_ERRSTOP) 144285612Sdelphij#define RESTART_GENSHELL_OPT(n) STMTS( \ 145181834Sroberto genshelloptOptions.curOptIdx = (n); \ 146181834Sroberto genshelloptOptions.pzCurOpt = NULL ) 147285612Sdelphij#define START_GENSHELL_OPT RESTART_GENSHELL_OPT(1) 148285612Sdelphij#define GENSHELL_USAGE(c) (*genshelloptOptions.pUsageProc)(&genshelloptOptions, c) 149181834Sroberto 150285612Sdelphij#ifdef __cplusplus 151285612Sdelphijextern "C" { 152285612Sdelphij#endif 153285612Sdelphij 154285612Sdelphij 155181834Sroberto/* * * * * * 156181834Sroberto * 157181834Sroberto * Declare the genshellopt option descriptor. 158181834Sroberto */ 159285612Sdelphijextern tOptions genshelloptOptions; 160181834Sroberto 161285612Sdelphij#if defined(ENABLE_NLS) 162285612Sdelphij# ifndef _ 163285612Sdelphij# include <stdio.h> 164285612Sdelphij# ifndef HAVE_GETTEXT 165285612Sdelphij extern char * gettext(char const *); 166285612Sdelphij# else 167285612Sdelphij# include <libintl.h> 168285612Sdelphij# endif 169181834Sroberto 170285612Sdelphij# ifndef ATTRIBUTE_FORMAT_ARG 171285612Sdelphij# define ATTRIBUTE_FORMAT_ARG(_a) 172285612Sdelphij# endif 173181834Sroberto 174285612Sdelphijstatic inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1); 175285612Sdelphijstatic inline char* aoGetsText(char const* pz) { 176285612Sdelphij if (pz == NULL) return NULL; 177285612Sdelphij return (char*)gettext(pz); 178285612Sdelphij} 179285612Sdelphij# define _(s) aoGetsText(s) 180285612Sdelphij# endif /* _() */ 181285612Sdelphij 182285612Sdelphij# define OPT_NO_XLAT_CFG_NAMES STMTS(genshelloptOptions.fOptSet |= \ 183285612Sdelphij OPTPROC_NXLAT_OPT_CFG;) 184285612Sdelphij# define OPT_NO_XLAT_OPT_NAMES STMTS(genshelloptOptions.fOptSet |= \ 185285612Sdelphij OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) 186285612Sdelphij 187285612Sdelphij# define OPT_XLAT_CFG_NAMES STMTS(genshelloptOptions.fOptSet &= \ 188285612Sdelphij ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) 189285612Sdelphij# define OPT_XLAT_OPT_NAMES STMTS(genshelloptOptions.fOptSet &= \ 190285612Sdelphij ~OPTPROC_NXLAT_OPT;) 191285612Sdelphij 192285612Sdelphij#else /* ENABLE_NLS */ 193285612Sdelphij# define OPT_NO_XLAT_CFG_NAMES 194285612Sdelphij# define OPT_NO_XLAT_OPT_NAMES 195285612Sdelphij 196285612Sdelphij# define OPT_XLAT_CFG_NAMES 197285612Sdelphij# define OPT_XLAT_OPT_NAMES 198285612Sdelphij 199285612Sdelphij# ifndef _ 200285612Sdelphij# define _(_s) _s 201285612Sdelphij# endif 202285612Sdelphij#endif /* ENABLE_NLS */ 203285612Sdelphij 204181834Sroberto#ifdef __cplusplus 205181834Sroberto} 206181834Sroberto#endif 207181834Sroberto#endif /* AUTOOPTS_GENSHELL_H_GUARD */ 208285612Sdelphij 209181834Sroberto/* genshell.h ends here */ 210