Main Page Modules Data Structures File List Data Fields Globals Related Pages

# popt/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     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 /*@dependent@*/ /*@null@*/
    00086     poptItem doExec;
    00087 /*@only@*/
    00088     const char * execPath;
    00089     int execAbsolute;
    00090 /*@only@*/
    00091     const char * otherHelp;
    00092 /*@null@*/
    00093     pbm_set * arg_strip;
    00094 };
    00095
    00096 #ifdef HAVE_LIBINTL_H
    00097 #include <libintl.h>
    00098 #endif
    00099
    00100 #if defined(HAVE_GETTEXT) && !defined(__LCLINT__)
    00101 #define _(foo) gettext(foo)
    00102 #else
    00103 #define _(foo) foo
    00104 #endif
    00105
    00106 #if defined(HAVE_DCGETTEXT) && !defined(__LCLINT__)
    00107 #define D_(dom, str) dgettext(dom, str)
    00108 #define POPT_(foo) D_("popt", foo)
    00109 #else
    00110 #define D_(dom, str) str
    00111 #define POPT_(foo) foo
    00112 #endif
    00113
    00114 #define N_(foo) foo
    00115
    00116 #endif