00001
00005
00006
00007
00008
00009 #ifndef H_POPTINT
00010 #define H_POPTINT
00011
00012
00013 typedef unsigned int __pbm_bits;
00014 #define __PBM_NBITS (8 * sizeof (__pbm_bits))
00015 #define __PBM_IX(d) ((d) / __PBM_NBITS)
00016 #define __PBM_MASK(d) ((__pbm_bits) 1 << ((d) % __PBM_NBITS))
00017 typedef struct {
00018 __pbm_bits bits[1];
00019 } pbm_set;
00020 #define __PBM_BITS(set) ((set)->bits)
00021
00022 #define PBM_ALLOC(d) calloc(__PBM_IX (d) + 1, sizeof(__pbm_bits))
00023 #define PBM_FREE(s) free(s);
00024 #define PBM_SET(d, s) (__PBM_BITS (s)[__PBM_IX (d)] |= __PBM_MASK (d))
00025 #define PBM_CLR(d, s) (__PBM_BITS (s)[__PBM_IX (d)] &= ~__PBM_MASK (d))
00026 #define PBM_ISSET(d, s) ((__PBM_BITS (s)[__PBM_IX (d)] & __PBM_MASK (d)) != 0)
00027
00028 struct optionStackEntry {
00029 int argc;
00030 const char ** argv;
00031 pbm_set * argb;
00032 int next;
00033 const char * nextArg;
00034 const char * nextCharArg;
00035 struct poptAlias * currAlias;
00036 int stuffed;
00037 };
00038
00039 struct execEntry {
00040 const char * longName;
00041 char shortName;
00042 const char * script;
00043 };
00044
00045 struct poptContext_s {
00046 struct optionStackEntry optionStack[POPT_OPTION_DEPTH];
00047 struct optionStackEntry * os;
00048 const char ** leftovers;
00049 int numLeftovers;
00050 int nextLeftover;
00051 const struct poptOption * options;
00052 int restLeftover;
00053 const char * appName;
00054 struct poptAlias * aliases;
00055 int numAliases;
00056 int flags;
00057 struct execEntry * execs;
00058 int numExecs;
00059 const char ** finalArgv;
00060 int finalArgvCount;
00061 int finalArgvAlloced;
00062 struct execEntry * doExec;
00063 const char * execPath;
00064 int execAbsolute;
00065 const char * otherHelp;
00066 pbm_set * arg_strip;
00067 };
00068
00069 #ifdef HAVE_LIBINTL_H
00070 #include <libintl.h>
00071 #endif
00072
00073 #if defined(HAVE_GETTEXT) && !defined(__LCLINT__)
00074 #define _(foo) gettext(foo)
00075 #else
00076 #define _(foo) (foo)
00077 #endif
00078
00079 #if defined(HAVE_DGETTEXT) && !defined(__LCLINT__)
00080 #define D_(dom, str) dgettext(dom, str)
00081 #define POPT_(foo) D_("popt", foo)
00082 #else
00083 #define D_(dom, str) (str)
00084 #define POPT_(foo) (foo)
00085 #endif
00086
00087 #define N_(foo) (foo)
00088
00089 #endif