14887Schin /*********************************************************************** 24887Schin * * 34887Schin * This software is part of the ast package * 4*8462SApril.Chin@Sun.COM * Copyright (c) 1985-2008 AT&T Intellectual Property * 54887Schin * and is licensed under the * 64887Schin * Common Public License, Version 1.0 * 7*8462SApril.Chin@Sun.COM * by AT&T Intellectual Property * 84887Schin * * 94887Schin * A copy of the License is available at * 104887Schin * http://www.opensource.org/licenses/cpl1.0.txt * 114887Schin * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) * 124887Schin * * 134887Schin * Information and Software Systems Research * 144887Schin * AT&T Research * 154887Schin * Florham Park NJ * 164887Schin * * 174887Schin * Glenn Fowler <gsf@research.att.com> * 184887Schin * David Korn <dgk@research.att.com> * 194887Schin * Phong Vo <kpv@research.att.com> * 204887Schin * * 214887Schin ***********************************************************************/ 224887Schin #pragma prototyped 234887Schin /* 244887Schin * Glenn Fowler 254887Schin * AT&T Research 264887Schin * 274887Schin * command line option parser and usage formatter private definitions 284887Schin */ 294887Schin 304887Schin #ifndef _OPTLIB_H 314887Schin #define _OPTLIB_H 324887Schin 334887Schin #include <ast.h> 344887Schin #include <cdt.h> 354887Schin 364887Schin #define OPT_cache 0x01 374887Schin #define OPT_functions 0x02 384887Schin #define OPT_ignore 0x04 394887Schin #define OPT_long 0x08 40*8462SApril.Chin@Sun.COM #define OPT_numeric 0x10 41*8462SApril.Chin@Sun.COM #define OPT_old 0x20 42*8462SApril.Chin@Sun.COM #define OPT_plus 0x40 43*8462SApril.Chin@Sun.COM #define OPT_proprietary 0x80 444887Schin 454887Schin #define OPT_cache_flag 0x01 464887Schin #define OPT_cache_invert 0x02 474887Schin #define OPT_cache_numeric 0x04 484887Schin #define OPT_cache_optional 0x08 494887Schin #define OPT_cache_string 0x10 504887Schin 514887Schin #define OPT_CACHE 128 524887Schin #define OPT_FLAGS "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" 534887Schin 544887Schin struct Optdisc_s; 554887Schin 564887Schin typedef struct Optpass_s 574887Schin { 584887Schin char* opts; 594887Schin char* oopts; 604887Schin char* catalog; 614887Schin unsigned char version; 624887Schin unsigned char prefix; 634887Schin unsigned char flags; 644887Schin unsigned char section; 654887Schin } Optpass_t; 664887Schin 674887Schin typedef struct Optcache_s 684887Schin { 694887Schin struct Optcache_s* next; 704887Schin Optpass_t pass; 714887Schin int caching; 724887Schin unsigned char flags[sizeof(OPT_FLAGS)]; 734887Schin } Optcache_t; 744887Schin 754887Schin typedef struct Optstate_s 764887Schin { 774887Schin Sfio_t* mp; /* opt_info.msg string stream */ 784887Schin Sfio_t* vp; /* translation string stream */ 794887Schin Sfio_t* xp; /* translation string stream */ 804887Schin Sfio_t* cp; /* compatibility string stream */ 814887Schin Optpass_t pass[8]; /* optjoin() list */ 824887Schin char* argv[2]; /* initial argv copy */ 834887Schin char* strv[3]; /* optstr() argv */ 844887Schin char* str; /* optstr() string */ 854887Schin Sfio_t* strp; /* optstr() stream */ 864887Schin int force; /* force this style */ 874887Schin int pindex; /* prev index for backup */ 884887Schin int poffset; /* prev offset for backup */ 894887Schin int npass; /* # optjoin() passes */ 904887Schin int join; /* optjoin() pass # */ 914887Schin int plus; /* + ok */ 924887Schin int style; /* default opthelp() style */ 934887Schin int width; /* format line width */ 944887Schin int flags; /* display flags */ 954887Schin int emphasis; /* ansi term emphasis ok */ 964887Schin Dtdisc_t msgdisc; /* msgdict discipline */ 974887Schin Dt_t* msgdict; /* default ast.id catalog msgs */ 984887Schin Optcache_t* cache; /* OPT_cache cache */ 994887Schin } Optstate_t; 1004887Schin 1014887Schin #define _OPT_PRIVATE_ \ 1024887Schin char pad[2*sizeof(void*)]; \ 1034887Schin Optstate_t* state; 1044887Schin 1054887Schin #include <error.h> 1064887Schin 1074887Schin #endif 108