1*4887Schin /*********************************************************************** 2*4887Schin * * 3*4887Schin * This software is part of the ast package * 4*4887Schin * Copyright (c) 1985-2007 AT&T Knowledge Ventures * 5*4887Schin * and is licensed under the * 6*4887Schin * Common Public License, Version 1.0 * 7*4887Schin * by AT&T Knowledge Ventures * 8*4887Schin * * 9*4887Schin * A copy of the License is available at * 10*4887Schin * http://www.opensource.org/licenses/cpl1.0.txt * 11*4887Schin * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) * 12*4887Schin * * 13*4887Schin * Information and Software Systems Research * 14*4887Schin * AT&T Research * 15*4887Schin * Florham Park NJ * 16*4887Schin * * 17*4887Schin * Glenn Fowler <gsf@research.att.com> * 18*4887Schin * David Korn <dgk@research.att.com> * 19*4887Schin * Phong Vo <kpv@research.att.com> * 20*4887Schin * * 21*4887Schin ***********************************************************************/ 22*4887Schin #pragma prototyped 23*4887Schin /* 24*4887Schin * Glenn Fowler 25*4887Schin * AT&T Research 26*4887Schin * 27*4887Schin * command line option parser and usage formatter private definitions 28*4887Schin */ 29*4887Schin 30*4887Schin #ifndef _OPTLIB_H 31*4887Schin #define _OPTLIB_H 32*4887Schin 33*4887Schin #include <ast.h> 34*4887Schin #include <cdt.h> 35*4887Schin 36*4887Schin #define OPT_cache 0x01 37*4887Schin #define OPT_functions 0x02 38*4887Schin #define OPT_ignore 0x04 39*4887Schin #define OPT_long 0x08 40*4887Schin #define OPT_old 0x10 41*4887Schin #define OPT_plus 0x20 42*4887Schin #define OPT_proprietary 0x40 43*4887Schin 44*4887Schin #define OPT_cache_flag 0x01 45*4887Schin #define OPT_cache_invert 0x02 46*4887Schin #define OPT_cache_numeric 0x04 47*4887Schin #define OPT_cache_optional 0x08 48*4887Schin #define OPT_cache_string 0x10 49*4887Schin 50*4887Schin #define OPT_CACHE 128 51*4887Schin #define OPT_FLAGS "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" 52*4887Schin 53*4887Schin struct Optdisc_s; 54*4887Schin 55*4887Schin typedef struct Optpass_s 56*4887Schin { 57*4887Schin char* opts; 58*4887Schin char* oopts; 59*4887Schin char* catalog; 60*4887Schin unsigned char version; 61*4887Schin unsigned char prefix; 62*4887Schin unsigned char flags; 63*4887Schin unsigned char section; 64*4887Schin } Optpass_t; 65*4887Schin 66*4887Schin typedef struct Optcache_s 67*4887Schin { 68*4887Schin struct Optcache_s* next; 69*4887Schin Optpass_t pass; 70*4887Schin int caching; 71*4887Schin unsigned char flags[sizeof(OPT_FLAGS)]; 72*4887Schin } Optcache_t; 73*4887Schin 74*4887Schin typedef struct Optstate_s 75*4887Schin { 76*4887Schin Sfio_t* mp; /* opt_info.msg string stream */ 77*4887Schin Sfio_t* vp; /* translation string stream */ 78*4887Schin Sfio_t* xp; /* translation string stream */ 79*4887Schin Sfio_t* cp; /* compatibility string stream */ 80*4887Schin Optpass_t pass[8]; /* optjoin() list */ 81*4887Schin char* argv[2]; /* initial argv copy */ 82*4887Schin char* strv[3]; /* optstr() argv */ 83*4887Schin char* str; /* optstr() string */ 84*4887Schin Sfio_t* strp; /* optstr() stream */ 85*4887Schin int force; /* force this style */ 86*4887Schin int pindex; /* prev index for backup */ 87*4887Schin int poffset; /* prev offset for backup */ 88*4887Schin int npass; /* # optjoin() passes */ 89*4887Schin int join; /* optjoin() pass # */ 90*4887Schin int plus; /* + ok */ 91*4887Schin int style; /* default opthelp() style */ 92*4887Schin int width; /* format line width */ 93*4887Schin int flags; /* display flags */ 94*4887Schin int emphasis; /* ansi term emphasis ok */ 95*4887Schin Dtdisc_t msgdisc; /* msgdict discipline */ 96*4887Schin Dt_t* msgdict; /* default ast.id catalog msgs */ 97*4887Schin Optcache_t* cache; /* OPT_cache cache */ 98*4887Schin } Optstate_t; 99*4887Schin 100*4887Schin #define _OPT_PRIVATE_ \ 101*4887Schin char pad[2*sizeof(void*)]; \ 102*4887Schin Optstate_t* state; 103*4887Schin 104*4887Schin #include <error.h> 105*4887Schin 106*4887Schin #endif 107