poptint.h

Go to the documentation of this file.
00001 
00005 /* (C) 1998-2000 Red Hat, Inc. -- Licensing details are in the COPYING
00006    file accompanying popt source distributions, available from 
00007    ftp://ftp.rpm.org/pub/rpm/dist. */
00008 
00009 #ifndef H_POPTINT
00010 #define H_POPTINT
00011 
00017 /*@unused@*/ static inline /*@null@*/ void *
00018 _free(/*@only@*/ /*@null@*/ const void * p)
00019         /*@modifies p @*/
00020 {
00021     if (p != NULL)      free((void *)p);
00022     return NULL;
00023 }
00024 
00025 /* Bit mask macros. */
00026 /*@-exporttype -redef @*/
00027 typedef unsigned int __pbm_bits;
00028 /*@=exporttype =redef @*/
00029 #define __PBM_NBITS             (8 * sizeof (__pbm_bits))
00030 #define __PBM_IX(d)             ((d) / __PBM_NBITS)
00031 #define __PBM_MASK(d)           ((__pbm_bits) 1 << (((unsigned)(d)) % __PBM_NBITS))
00032 /*@-exporttype -redef @*/
00033 typedef struct {
00034     __pbm_bits bits[1];
00035 } pbm_set;
00036 /*@=exporttype =redef @*/
00037 #define __PBM_BITS(set) ((set)->bits)
00038 
00039 #define PBM_ALLOC(d)    calloc(__PBM_IX (d) + 1, sizeof(__pbm_bits))
00040 #define PBM_FREE(s)     _free(s);
00041 #define PBM_SET(d, s)   (__PBM_BITS (s)[__PBM_IX (d)] |= __PBM_MASK (d))
00042 #define PBM_CLR(d, s)   (__PBM_BITS (s)[__PBM_IX (d)] &= ~__PBM_MASK (d))
00043 #define PBM_ISSET(d, s) ((__PBM_BITS (s)[__PBM_IX (d)] & __PBM_MASK (d)) != 0)
00044 
00045 struct optionStackEntry {
00046     int argc;
00047 /*@only@*/ /*@null@*/
00048     const char ** argv;
00049 /*@only@*/ /*@null@*/
00050     pbm_set * argb;
00051     int next;
00052 /*@only@*/ /*@null@*/
00053     const char * nextArg;
00054 /*@observer@*/ /*@null@*/
00055     const char * nextCharArg;
00056 /*@dependent@*/ /*@null@*/
00057     poptItem currAlias;
00058     int stuffed;
00059 };
00060 
00061 struct poptContext_s {
00062     struct optionStackEntry optionStack[POPT_OPTION_DEPTH];
00063 /*@dependent@*/
00064     struct optionStackEntry * os;
00065 /*@owned@*/ /*@null@*/
00066     const char ** leftovers;
00067     int numLeftovers;
00068     int nextLeftover;
00069 /*@keep@*/
00070     const struct poptOption * options;
00071     int restLeftover;
00072 /*@only@*/ /*@null@*/
00073     const char * appName;
00074 /*@only@*/ /*@null@*/
00075     poptItem aliases;
00076     int numAliases;
00077     unsigned int flags;
00078 /*@owned@*/ /*@null@*/
00079     poptItem execs;
00080     int numExecs;
00081 /*@only@*/ /*@null@*/
00082     const char ** finalArgv;
00083     int finalArgvCount;
00084     int finalArgvAlloced;
00085     int (*maincall) (int argc, const char **argv);
00086 /*@dependent@*/ /*@null@*/
00087     poptItem doExec;
00088 /*@only@*/
00089     const char * execPath;
00090     int execAbsolute;
00091 /*@only@*/ /*@relnull@*/
00092     const char * otherHelp;
00093 /*@null@*/
00094     pbm_set * arg_strip;
00095 };
00096 
00097 #ifdef HAVE_LIBINTL_H
00098 #include <libintl.h>
00099 #endif
00100 
00101 #if defined(HAVE_GETTEXT) && !defined(__LCLINT__)
00102 #define _(foo) gettext(foo)
00103 #else
00104 #define _(foo) foo
00105 #endif
00106 
00107 #if defined(HAVE_DCGETTEXT) && !defined(__LCLINT__)
00108 #define D_(dom, str) dgettext(dom, str)
00109 #define POPT_(foo) D_("popt", foo)
00110 #else
00111 #define D_(dom, str) str
00112 #define POPT_(foo) foo
00113 #endif
00114 
00115 #define N_(foo) foo
00116 
00117 int   POPT_fprintf (FILE* steam, const char *format, ...);
00118 char *POPT_prev_char (const char *str);
00119 
00120 #endif

Generated on Thu Aug 30 14:33:19 2007 for popt by  doxygen 1.5.2