1 /* (C) 1998 Red Hat Software, Inc. -- Licensing details are in the COPYING
2 file accompanying popt source distributions, available from
3 ftp://ftp.redhat.com/pub/code/popt */
9 typedef unsigned int __pbm_bits;
10 #define __PBM_NBITS (8 * sizeof (__pbm_bits))
11 #define __PBM_IX(d) ((d) / __PBM_NBITS)
12 #define __PBM_MASK(d) ((__pbm_bits) 1 << ((d) % __PBM_NBITS))
16 #define __PBM_BITS(set) ((set)->bits)
18 #define PBM_ALLOC(d) calloc(__PBM_IX (d) + 1, sizeof(__pbm_bits))
19 #define PBM_FREE(s) free(s);
20 #define PBM_SET(d, s) (__PBM_BITS (s)[__PBM_IX (d)] |= __PBM_MASK (d))
21 #define PBM_CLR(d, s) (__PBM_BITS (s)[__PBM_IX (d)] &= ~__PBM_MASK (d))
22 #define PBM_ISSET(d, s) ((__PBM_BITS (s)[__PBM_IX (d)] & __PBM_MASK (d)) != 0)
24 struct optionStackEntry {
26 /*@only@*/ const char ** argv;
27 /*@only@*/ pbm_set * argb;
29 /*@only@*/ const char * nextArg;
30 /*@keep@*/ const char * nextCharArg;
31 /*@dependent@*/ struct poptAlias * currAlias;
36 const char * longName;
41 struct poptContext_s {
42 struct optionStackEntry optionStack[POPT_OPTION_DEPTH];
43 /*@dependent@*/ struct optionStackEntry * os;
44 /*@owned@*/ const char ** leftovers;
47 /*@keep@*/ const struct poptOption * options;
49 /*@only@*/ const char * appName;
50 /*@only@*/ struct poptAlias * aliases;
53 struct execEntry * execs;
55 /*@only@*/ const char ** finalArgv;
58 /*@dependent@*/ struct execEntry * doExec;
59 /*@only@*/ const char * execPath;
61 /*@only@*/ const char * otherHelp;
65 #define xfree(_a) free((void *)_a)
71 #if defined(HAVE_GETTEXT) && !defined(__LCLINT__)
72 #define _(foo) gettext(foo)
77 #if defined(HAVE_DGETTEXT) && !defined(__LCLINT__)
78 #define D_(dom, str) dgettext(dom, str)
79 #define POPT_(foo) D_("popt", foo)
81 #define POPT_(foo) (foo)
82 #define D_(dom, str) (str)