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