popt 1.13
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     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 #ifdef HAVE_ICONV
00118 #include <iconv.h>
00119 #if defined(__LCLINT__)
00120 /*@-declundef -incondefs @*/
00121 extern /*@only@*/ iconv_t iconv_open(const char *__tocode, const char *__fromcode)
00122         /*@*/;
00123 
00124 extern size_t iconv(iconv_t __cd, /*@null@*/ char ** __inbuf,
00125                     /*@out@*/ size_t * __inbytesleft,
00126                     /*@out@*/ char ** __outbuf,
00127                     /*@out@*/ size_t * __outbytesleft)
00128         /*@modifies __cd,
00129                 *__inbuf, *__inbytesleft, *__outbuf, *__outbytesleft @*/;
00130 
00131 extern int iconv_close(/*@only@*/ iconv_t __cd)
00132         /*@modifies __cd @*/;
00133 /*@=declundef =incondefs @*/
00134 #endif
00135 #endif
00136 
00137 #ifdef HAVE_LANGINFO_H
00138 #include <langinfo.h>
00139 #if defined(__LCLINT__)
00140 /*@-declundef -incondefs @*/
00141 extern char *nl_langinfo (nl_item __item)
00142         /*@*/;
00143 /*@=declundef =incondefs @*/
00144 #endif
00145 #endif
00146 
00147 char *POPT_prev_char (/*@returned@*/ const char *str)
00148         /*@*/;
00149 
00150 char *POPT_next_char (/*@returned@*/ const char *str)
00151         /*@*/;
00152 
00153 int   POPT_fprintf (FILE* stream, const char *format, ...)
00154         /*@globals fileSystem @*/
00155         /*@modifies stream, fileSystem @*/;
00156 
00157 #endif

Generated for popt by  doxygen 1.7.4