Mixe for Privacy and Anonymity in the Internet
poptint.h
Go to the documentation of this file.
00001 /* (C) 1998 Red Hat Software, Inc. -- Licensing details are in the COPYING
00002    file accompanying popt source distributions, available from 
00003    ftp://ftp.redhat.com/pub/code/popt */
00004 
00005 #ifndef H_POPTINT
00006 #define H_POPTINT
00007 
00008 /* Bit mask macros. */
00009 typedef unsigned int __pbm_bits;
00010 #define __PBM_NBITS   (8 * sizeof (__pbm_bits))
00011 #define __PBM_IX(d)   ((d) / __PBM_NBITS)
00012 #define __PBM_MASK(d)   ((__pbm_bits) 1 << ((d) % __PBM_NBITS))
00013 typedef struct {
00014     __pbm_bits bits[1];
00015 } pbm_set;
00016 #define __PBM_BITS(set) ((set)->bits)
00017 
00018 #define PBM_ALLOC(d)  calloc(__PBM_IX (d) + 1, sizeof(__pbm_bits))
00019 #define PBM_FREE(s) free(s);
00020 #define PBM_SET(d, s)   (__PBM_BITS (s)[__PBM_IX (d)] |= __PBM_MASK (d))
00021 #define PBM_CLR(d, s)   (__PBM_BITS (s)[__PBM_IX (d)] &= ~__PBM_MASK (d))
00022 #define PBM_ISSET(d, s) ((__PBM_BITS (s)[__PBM_IX (d)] & __PBM_MASK (d)) != 0)
00023 
00024 struct optionStackEntry {
00025     int argc;
00026     /*@only@*/ const char ** argv;
00027     /*@only@*/ pbm_set * argb;
00028     int next;
00029     /*@only@*/ const char * nextArg;
00030     /*@keep@*/ const char * nextCharArg;
00031     /*@dependent@*/ struct poptAlias * currAlias;
00032     int stuffed;
00033 };
00034 
00035 struct execEntry {
00036     const char * longName;
00037     char shortName;
00038     const char * script;
00039 };
00040 
00041 struct poptContext_s {
00042     struct optionStackEntry optionStack[POPT_OPTION_DEPTH];
00043     /*@dependent@*/ struct optionStackEntry * os;
00044     /*@owned@*/ const char ** leftovers;
00045     int numLeftovers;
00046     int nextLeftover;
00047     /*@keep@*/ const struct poptOption * options;
00048     int restLeftover;
00049     /*@only@*/ const char * appName;
00050     /*@only@*/ struct poptAlias * aliases;
00051     int numAliases;
00052     int flags;
00053     struct execEntry * execs;
00054     int numExecs;
00055     /*@only@*/ const char ** finalArgv;
00056     int finalArgvCount;
00057     int finalArgvAlloced;
00058     /*@dependent@*/ struct execEntry * doExec;
00059     /*@only@*/ const char * execPath;
00060     int execAbsolute;
00061     /*@only@*/ const char * otherHelp;
00062     pbm_set * arg_strip;
00063 };
00064 
00065 #define xfree(_a) free((void *)_a)
00066 
00067 #ifdef HAVE_LIBINTL_H
00068 #include <libintl.h>
00069 #endif
00070 
00071 #if defined(HAVE_GETTEXT) && !defined(__LCLINT__)
00072 #define _(foo) gettext(foo)
00073 #else
00074 #define _(foo) (foo)
00075 #endif
00076 
00077 // #if defined(HAVE_DGETTEXT) && !defined(__LCLINT__)
00078 // #define D_(dom, str) dgettext(dom, str)
00079 // #define POPT_(foo) D_("popt", foo)
00080 // #else
00081 #define POPT_(foo) (foo)
00082 #define D_(dom, str) (str)
00083 // #endif
00084 
00085 #define N_(foo) (foo)
00086 
00087 #endif