123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- #ifndef H_POPTINT
- #define H_POPTINT
- #include <stdint.h>
- static inline void *
- _free( const void * p)
-
- {
- if (p != NULL) free((void *)p);
- return NULL;
- }
- typedef unsigned int __pbm_bits;
- #define __PBM_NBITS (8 * sizeof (__pbm_bits))
- #define __PBM_IX(d) ((d) / __PBM_NBITS)
- #define __PBM_MASK(d) ((__pbm_bits) 1 << (((unsigned)(d)) % __PBM_NBITS))
- typedef struct {
- __pbm_bits bits[1];
- } pbm_set;
- #define __PBM_BITS(set) ((set)->bits)
- #define PBM_ALLOC(d) calloc(__PBM_IX (d) + 1, sizeof(__pbm_bits))
- #define PBM_FREE(s) _free(s);
- #define PBM_SET(d, s) (__PBM_BITS (s)[__PBM_IX (d)] |= __PBM_MASK (d))
- #define PBM_CLR(d, s) (__PBM_BITS (s)[__PBM_IX (d)] &= ~__PBM_MASK (d))
- #define PBM_ISSET(d, s) ((__PBM_BITS (s)[__PBM_IX (d)] & __PBM_MASK (d)) != 0)
- extern void poptJlu32lpair( const void *key, size_t size,
- uint32_t *pc, uint32_t *pb)
- ;
- typedef const char * poptString;
- typedef poptString * poptArgv;
- typedef union poptArg_u {
- void * ptr;
- int * intp;
- short * shortp;
- long * longp;
- long long * longlongp;
- float * floatp;
- double * doublep;
- const char ** argv;
- poptCallbackType cb;
- poptOption opt;
- } poptArg;
- extern unsigned int _poptArgMask;
- extern unsigned int _poptGroupMask;
- #define poptArgType(_opt) ((_opt)->argInfo & _poptArgMask)
- #define poptGroup(_opt) ((_opt)->argInfo & _poptGroupMask)
- #define F_ISSET(_opt, _FLAG) ((_opt)->argInfo & POPT_ARGFLAG_##_FLAG)
- #define LF_ISSET(_FLAG) (argInfo & POPT_ARGFLAG_##_FLAG)
- #define CBF_ISSET(_opt, _FLAG) ((_opt)->argInfo & POPT_CBFLAG_##_FLAG)
- #define poptSubstituteHelpI18N(opt) \
- { \
- if ((opt) == poptHelpOptions) (opt) = poptHelpOptionsI18N; \
- }
- struct optionStackEntry {
- int argc;
-
- poptArgv argv;
-
- pbm_set * argb;
- int next;
-
- char * nextArg;
-
- const char * nextCharArg;
-
- poptItem currAlias;
- int stuffed;
- };
- struct poptContext_s {
- struct optionStackEntry optionStack[POPT_OPTION_DEPTH];
- struct optionStackEntry * os;
-
- poptArgv leftovers;
- int numLeftovers;
- int nextLeftover;
- const struct poptOption * options;
- int restLeftover;
-
- const char * appName;
-
- poptItem aliases;
- int numAliases;
- unsigned int flags;
-
- poptItem execs;
- int numExecs;
-
- poptArgv finalArgv;
- int finalArgvCount;
- int finalArgvAlloced;
- int (*maincall) (int argc, const char **argv);
-
- poptItem doExec;
-
- const char * execPath;
- int execAbsolute;
-
- const char * otherHelp;
- pbm_set * arg_strip;
- };
- #if defined(POPT_fprintf)
- #define POPT_dgettext dgettext
- #else
- #ifdef HAVE_ICONV
- #include <iconv.h>
- #if defined(__LCLINT__)
- extern iconv_t iconv_open(const char *__tocode, const char *__fromcode)
- ;
- extern size_t iconv(iconv_t __cd, char ** __inbuf,
- size_t * __inbytesleft,
- char ** __outbuf,
- size_t * __outbytesleft)
-
- ;
- extern int iconv_close( iconv_t __cd)
- ;
- #endif
- #endif
- #ifdef HAVE_LANGINFO_H
- #include <langinfo.h>
- #if defined(__LCLINT__)
- extern char *nl_langinfo (nl_item __item)
- ;
- #endif
- #endif
- #if defined(HAVE_DCGETTEXT) && !defined(__LCLINT__)
- char *POPT_dgettext(const char * dom, const char * str)
- ;
- #endif
- int POPT_fprintf (FILE* stream, const char *format, ...)
-
- ;
- #endif
- const char *POPT_prev_char ( const char *str)
- ;
- const char *POPT_next_char ( const char *str)
- ;
- #endif
- #if defined(ENABLE_NLS) && defined(HAVE_LIBINTL_H)
- #include <libintl.h>
- #endif
- #if defined(ENABLE_NLS) && defined(HAVE_GETTEXT) && !defined(__LCLINT__)
- #define _(foo) gettext(foo)
- #else
- #define _(foo) foo
- #endif
- #if defined(ENABLE_NLS) && defined(HAVE_DCGETTEXT) && !defined(__LCLINT__)
- #define D_(dom, str) POPT_dgettext(dom, str)
- #define POPT_(foo) D_("popt", foo)
- #else
- #define D_(dom, str) str
- #define POPT_(foo) foo
- #endif
- #define N_(foo) foo
|