popt.h | popt.h | |||
---|---|---|---|---|
skipping to change at line 20 | skipping to change at line 20 | |||
#define H_POPT | #define H_POPT | |||
#include <stdio.h> /* for FILE * */ | #include <stdio.h> /* for FILE * */ | |||
#define POPT_OPTION_DEPTH 10 | #define POPT_OPTION_DEPTH 10 | |||
/** \ingroup popt | /** \ingroup popt | |||
* \name Arg type identifiers | * \name Arg type identifiers | |||
*/ | */ | |||
/*@{*/ | /*@{*/ | |||
#define POPT_ARG_NONE 0 /*!< no arg */ | #define POPT_ARG_NONE 0U /*!< no arg */ | |||
#define POPT_ARG_STRING 1 /*!< arg will be saved as st | #define POPT_ARG_STRING 1U /*!< arg will be saved as st | |||
ring */ | ring */ | |||
#define POPT_ARG_INT 2 /*!< arg will be converted to int */ | #define POPT_ARG_INT 2U /*!< arg will be converted to int */ | |||
#define POPT_ARG_LONG 3 /*!< arg will be converted to long * | #define POPT_ARG_LONG 3U /*!< arg will be converted to long * | |||
/ | / | |||
#define POPT_ARG_INCLUDE_TABLE 4 /*!< arg points to table */ | #define POPT_ARG_INCLUDE_TABLE 4U /*!< arg points to table */ | |||
#define POPT_ARG_CALLBACK 5 /*!< table-wide callback... must be | #define POPT_ARG_CALLBACK 5U /*!< table-wide callback... must be | |||
set first in table; arg points | set first in table; arg points | |||
to callback, descrip points to | to callback, descrip points to | |||
callback data to pass */ | callback data to pass */ | |||
#define POPT_ARG_INTL_DOMAIN 6 /*!< set the translation domain | #define POPT_ARG_INTL_DOMAIN 6U /*!< set the translation domain | |||
for this table and any | for this table and any | |||
included tables; arg points | included tables; arg points | |||
to the domain string */ | to the domain string */ | |||
#define POPT_ARG_VAL 7 /*!< arg should take value val */ | #define POPT_ARG_VAL 7U /*!< arg should take value val */ | |||
#define POPT_ARG_FLOAT 8 /*!< arg will be converted t | #define POPT_ARG_FLOAT 8U /*!< arg will be converted t | |||
o float */ | o float */ | |||
#define POPT_ARG_DOUBLE 9 /*!< arg will be converted t | #define POPT_ARG_DOUBLE 9U /*!< arg will be converted t | |||
o double */ | o double */ | |||
#define POPT_ARG_MASK 0x0000FFFF | #define POPT_ARG_MAINCALL 10U /*!< return (*arg) (argc, argv) */ | |||
#define POPT_ARG_MASK 0x0000FFFFU | ||||
/*@}*/ | /*@}*/ | |||
/** \ingroup popt | /** \ingroup popt | |||
* \name Arg modifiers | * \name Arg modifiers | |||
*/ | */ | |||
/*@{*/ | /*@{*/ | |||
#define POPT_ARGFLAG_ONEDASH 0x80000000 /*!< allow -longoption */ | #define POPT_ARGFLAG_ONEDASH 0x80000000U /*!< allow -longoption */ | |||
#define POPT_ARGFLAG_DOC_HIDDEN 0x40000000 /*!< don't show in help/usage * | #define POPT_ARGFLAG_DOC_HIDDEN 0x40000000U /*!< don't show in help/usage | |||
/ | */ | |||
#define POPT_ARGFLAG_STRIP 0x20000000 /*!< strip this arg from argv(on | #define POPT_ARGFLAG_STRIP 0x20000000U /*!< strip this arg from argv(o | |||
ly applies to long args) */ | nly applies to long args) */ | |||
#define POPT_ARGFLAG_OPTIONAL 0x10000000 /*!< arg may be missing | #define POPT_ARGFLAG_OPTIONAL 0x10000000U /*!< arg may be missing | |||
*/ | */ | |||
#define POPT_ARGFLAG_OR 0x08000000 /*!< arg will be or'ed * | #define POPT_ARGFLAG_OR 0x08000000U /*!< arg will be or'ed | |||
/ | */ | |||
#define POPT_ARGFLAG_NOR 0x09000000 /*!< arg will be nor'ed | #define POPT_ARGFLAG_NOR 0x09000000U /*!< arg will be nor'ed | |||
*/ | */ | |||
#define POPT_ARGFLAG_AND 0x04000000 /*!< arg will be and'ed | #define POPT_ARGFLAG_AND 0x04000000U /*!< arg will be and'ed | |||
*/ | */ | |||
#define POPT_ARGFLAG_NAND 0x05000000 /*!< arg will be nand'ed | #define POPT_ARGFLAG_NAND 0x05000000U /*!< arg will be nand'e | |||
*/ | d */ | |||
#define POPT_ARGFLAG_XOR 0x02000000 /*!< arg will be xor'ed | #define POPT_ARGFLAG_XOR 0x02000000U /*!< arg will be xor'ed | |||
*/ | */ | |||
#define POPT_ARGFLAG_NOT 0x01000000 /*!< arg will be negated | #define POPT_ARGFLAG_NOT 0x01000000U /*!< arg will be negate | |||
*/ | d */ | |||
#define POPT_ARGFLAG_LOGICALOPS \ | #define POPT_ARGFLAG_LOGICALOPS \ | |||
(POPT_ARGFLAG_OR|POPT_ARGFLAG_AND|POPT_ARGFLAG_XOR) | (POPT_ARGFLAG_OR|POPT_ARGFLAG_AND|POPT_ARGFLAG_XOR) | |||
#define POPT_BIT_SET (POPT_ARG_VAL|POPT_ARGFLAG_OR) | #define POPT_BIT_SET (POPT_ARG_VAL|POPT_ARGFLAG_OR) | |||
/*!< set arg bit(s) */ | /*!< set arg bit(s) */ | |||
#define POPT_BIT_CLR (POPT_ARG_VAL|POPT_ARGFLAG_NAND) | #define POPT_BIT_CLR (POPT_ARG_VAL|POPT_ARGFLAG_NAND) | |||
/*!< clear arg bit(s) */ | /*!< clear arg bit(s) */ | |||
#define POPT_ARGFLAG_SHOW_DEFAULT 0x00800000 /*!< show default value | #define POPT_ARGFLAG_SHOW_DEFAULT 0x00800000U /*!< show default valu | |||
in --help */ | e in --help */ | |||
#define POPT_ARGFLAG_RANDOM 0x00400000U /*<! random value in [1 | ||||
,arg] */ | ||||
/*@}*/ | /*@}*/ | |||
/** \ingroup popt | /** \ingroup popt | |||
* \name Callback modifiers | * \name Callback modifiers | |||
*/ | */ | |||
/*@{*/ | /*@{*/ | |||
#define POPT_CBFLAG_PRE 0x80000000 /*!< call the callback b | #define POPT_CBFLAG_PRE 0x80000000U /*!< call the callback | |||
efore parse */ | before parse */ | |||
#define POPT_CBFLAG_POST 0x40000000 /*!< call the callback after par | #define POPT_CBFLAG_POST 0x40000000U /*!< call the callback after pa | |||
se */ | rse */ | |||
#define POPT_CBFLAG_INC_DATA 0x20000000 /*!< use data from the include l | #define POPT_CBFLAG_INC_DATA 0x20000000U /*!< use data from the include | |||
ine, | line, | |||
not the subtable */ | not the subtable */ | |||
#define POPT_CBFLAG_SKIPOPTION 0x10000000 /*!< don't callback with option | #define POPT_CBFLAG_SKIPOPTION 0x10000000U /*!< don't callback with option | |||
*/ | */ | |||
#define POPT_CBFLAG_CONTINUE 0x08000000 /*!< continue callbacks with opt | #define POPT_CBFLAG_CONTINUE 0x08000000U /*!< continue callbacks with op | |||
ion */ | tion */ | |||
/*@}*/ | /*@}*/ | |||
/** \ingroup popt | /** \ingroup popt | |||
* \name Error return values | * \name Error return values | |||
*/ | */ | |||
/*@{*/ | /*@{*/ | |||
#define POPT_ERROR_NOARG -10 /*!< missing argument */ | #define POPT_ERROR_NOARG -10 /*!< missing argument */ | |||
#define POPT_ERROR_BADOPT -11 /*!< unknown option */ | #define POPT_ERROR_BADOPT -11 /*!< unknown option */ | |||
#define POPT_ERROR_OPTSTOODEEP -13 /*!< aliases nested too deeply */ | #define POPT_ERROR_OPTSTOODEEP -13 /*!< aliases nested too deeply */ | |||
#define POPT_ERROR_BADQUOTE -15 /*!< error in paramter quoting */ | #define POPT_ERROR_BADQUOTE -15 /*!< error in paramter quoting */ | |||
skipping to change at line 99 | skipping to change at line 102 | |||
#define POPT_ERROR_OVERFLOW -18 /*!< number too large or too small * / | #define POPT_ERROR_OVERFLOW -18 /*!< number too large or too small * / | |||
#define POPT_ERROR_BADOPERATION -19 /*!< mutually exclusive logi cal operations requested */ | #define POPT_ERROR_BADOPERATION -19 /*!< mutually exclusive logi cal operations requested */ | |||
#define POPT_ERROR_NULLARG -20 /*!< opt->arg should not be NULL */ | #define POPT_ERROR_NULLARG -20 /*!< opt->arg should not be NULL */ | |||
#define POPT_ERROR_MALLOC -21 /*!< memory allocation faile d */ | #define POPT_ERROR_MALLOC -21 /*!< memory allocation faile d */ | |||
/*@}*/ | /*@}*/ | |||
/** \ingroup popt | /** \ingroup popt | |||
* \name poptBadOption() flags | * \name poptBadOption() flags | |||
*/ | */ | |||
/*@{*/ | /*@{*/ | |||
#define POPT_BADOPTION_NOALIAS (1 << 0) /*!< don't go into an alias */ | #define POPT_BADOPTION_NOALIAS (1U << 0) /*!< don't go into an alias */ | |||
/*@}*/ | /*@}*/ | |||
/** \ingroup popt | /** \ingroup popt | |||
* \name poptGetContext() flags | * \name poptGetContext() flags | |||
*/ | */ | |||
/*@{*/ | /*@{*/ | |||
#define POPT_CONTEXT_NO_EXEC (1 << 0) /*!< ignore exec expansions */ | #define POPT_CONTEXT_NO_EXEC (1U << 0) /*!< ignore exec expansions */ | |||
#define POPT_CONTEXT_KEEP_FIRST (1 << 1) /*!< pay attention to argv | #define POPT_CONTEXT_KEEP_FIRST (1U << 1) /*!< pay attention to arg | |||
[0] */ | v[0] */ | |||
#define POPT_CONTEXT_POSIXMEHARDER (1 << 2) /*!< options can't follow args | #define POPT_CONTEXT_POSIXMEHARDER (1U << 2) /*!< options can't follow args | |||
*/ | */ | |||
#define POPT_CONTEXT_ARG_OPTS (1 << 4) /*!< return args as options with va | #define POPT_CONTEXT_ARG_OPTS (1U << 4) /*!< return args as options with v | |||
lue 0 */ | alue 0 */ | |||
/*@}*/ | /*@}*/ | |||
/** \ingroup popt | /** \ingroup popt | |||
*/ | */ | |||
struct poptOption { | struct poptOption { | |||
/*@observer@*/ /*@null@*/ | /*@observer@*/ /*@null@*/ | |||
const char * longName; /*!< may be NULL */ | const char * longName; /*!< may be NULL */ | |||
char shortName; /*!< may be NUL */ | char shortName; /*!< may be NUL */ | |||
int argInfo; | unsigned int argInfo; | |||
/*@shared@*/ /*@null@*/ | /*@shared@*/ /*@null@*/ | |||
void * arg; /*!< depends on argInfo */ | void * arg; /*!< depends on argInfo */ | |||
int val; /*!< 0 means don't return, just update flag */ | int val; /*!< 0 means don't return, just update flag */ | |||
/*@observer@*/ /*@null@*/ | /*@observer@*/ /*@null@*/ | |||
const char * descrip; /*!< description for autohelp -- may be NULL */ | const char * descrip; /*!< description for autohelp -- may be NULL */ | |||
/*@observer@*/ /*@null@*/ | /*@observer@*/ /*@null@*/ | |||
const char * argDescrip; /*!< argument description for autohelp */ | const char * argDescrip; /*!< argument description for autohelp */ | |||
}; | }; | |||
/** \ingroup popt | /** \ingroup popt | |||
skipping to change at line 157 | skipping to change at line 160 | |||
/*@owned@*/ | /*@owned@*/ | |||
const char ** argv; /*!< (alias) args, must be free()abl e. */ | const char ** argv; /*!< (alias) args, must be free()abl e. */ | |||
} * poptItem; | } * poptItem; | |||
/*@=exporttype@*/ | /*@=exporttype@*/ | |||
/** \ingroup popt | /** \ingroup popt | |||
* \name Auto-generated help/usage | * \name Auto-generated help/usage | |||
*/ | */ | |||
/*@{*/ | /*@{*/ | |||
#if !defined(N_) | ||||
#define N_(foo) foo | ||||
#endif | ||||
/** | /** | |||
* Empty table marker to enable displaying popt alias/exec options. | * Empty table marker to enable displaying popt alias/exec options. | |||
*/ | */ | |||
/*@-exportvar@*/ | /*@-exportvar@*/ | |||
/*@unchecked@*/ /*@observer@*/ | /*@unchecked@*/ /*@observer@*/ | |||
extern struct poptOption poptAliasOptions[]; | extern struct poptOption poptAliasOptions[]; | |||
/*@=exportvar@*/ | /*@=exportvar@*/ | |||
#define POPT_AUTOALIAS { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptAliasOptio ns, \ | #define POPT_AUTOALIAS { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptAliasOptio ns, \ | |||
0, "Options implemented via popt alias/exec:", NULL }, | 0, N_("Options implemented via popt alias/exec:"), N ULL }, | |||
/** | /** | |||
* Auto help table options. | * Auto help table options. | |||
*/ | */ | |||
/*@-exportvar@*/ | /*@-exportvar@*/ | |||
/*@unchecked@*/ /*@observer@*/ | /*@unchecked@*/ /*@observer@*/ | |||
extern struct poptOption poptHelpOptions[]; | extern struct poptOption poptHelpOptions[]; | |||
/*@=exportvar@*/ | /*@=exportvar@*/ | |||
/*@-exportvar@*/ | /*@-exportvar@*/ | |||
/*@unchecked@*/ /*@observer@*/ | /*@unchecked@*/ /*@observer@*/ | |||
extern struct poptOption * poptHelpOptionsI18N; | extern struct poptOption * poptHelpOptionsI18N; | |||
/*@=exportvar@*/ | /*@=exportvar@*/ | |||
#define POPT_AUTOHELP { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptHelpOptions , \ | #define POPT_AUTOHELP { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptHelpOptions , \ | |||
0, "Help options:", NULL }, | 0, N_("Help options:"), NULL }, | |||
#define POPT_TABLEEND { NULL, '\0', 0, NULL, 0, NULL, NULL } | #define POPT_TABLEEND { NULL, '\0', 0, NULL, 0, NULL, NULL } | |||
/*@}*/ | /*@}*/ | |||
/** \ingroup popt | /** \ingroup popt | |||
*/ | */ | |||
/*@-exporttype@*/ | /*@-exporttype@*/ | |||
typedef /*@abstract@*/ struct poptContext_s * poptContext; | typedef /*@abstract@*/ struct poptContext_s * poptContext; | |||
/*@=exporttype@*/ | /*@=exporttype@*/ | |||
/** \ingroup popt | /** \ingroup popt | |||
*/ | */ | |||
#ifndef __cplusplus | #ifndef __cplusplus | |||
/*@-exporttype -typeuse@*/ | /*@-exporttype -typeuse@*/ | |||
typedef struct poptOption * poptOption; | typedef struct poptOption * poptOption; | |||
/*@=exporttype =typeuse@*/ | /*@=exporttype =typeuse@*/ | |||
#endif | #endif | |||
/** \ingroup popt | ||||
*/ | ||||
/*@-exportconst@*/ | /*@-exportconst@*/ | |||
enum poptCallbackReason { | enum poptCallbackReason { | |||
POPT_CALLBACK_REASON_PRE = 0, | POPT_CALLBACK_REASON_PRE = 0, | |||
POPT_CALLBACK_REASON_POST = 1, | POPT_CALLBACK_REASON_POST = 1, | |||
POPT_CALLBACK_REASON_OPTION = 2 | POPT_CALLBACK_REASON_OPTION = 2 | |||
}; | }; | |||
/*@=exportconst@*/ | /*@=exportconst@*/ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
skipping to change at line 243 | skipping to change at line 252 | |||
* @param argv argument array | * @param argv argument array | |||
* @param options address of popt option table | * @param options address of popt option table | |||
* @param flags or'd POPT_CONTEXT_* bits | * @param flags or'd POPT_CONTEXT_* bits | |||
* @return initialized popt context | * @return initialized popt context | |||
*/ | */ | |||
/*@only@*/ /*@null@*/ | /*@only@*/ /*@null@*/ | |||
poptContext poptGetContext( | poptContext poptGetContext( | |||
/*@dependent@*/ /*@keep@*/ const char * name, | /*@dependent@*/ /*@keep@*/ const char * name, | |||
int argc, /*@dependent@*/ /*@keep@*/ const char ** argv, | int argc, /*@dependent@*/ /*@keep@*/ const char ** argv, | |||
/*@dependent@*/ /*@keep@*/ const struct poptOption * options , | /*@dependent@*/ /*@keep@*/ const struct poptOption * options , | |||
int flags) | unsigned int flags) | |||
/*@*/; | /*@*/; | |||
/** \ingroup popt | /** \ingroup popt | |||
* Reinitialize popt context. | * Reinitialize popt context. | |||
* @param con context | * @param con context | |||
*/ | */ | |||
/*@unused@*/ | /*@unused@*/ | |||
void poptResetContext(/*@null@*/poptContext con) | void poptResetContext(/*@null@*/poptContext con) | |||
/*@modifies con @*/; | /*@modifies con @*/; | |||
skipping to change at line 306 | skipping to change at line 315 | |||
const char ** poptGetArgs(/*@null@*/poptContext con) | const char ** poptGetArgs(/*@null@*/poptContext con) | |||
/*@modifies con @*/; | /*@modifies con @*/; | |||
/** \ingroup popt | /** \ingroup popt | |||
* Return the option which caused the most recent error. | * Return the option which caused the most recent error. | |||
* @param con context | * @param con context | |||
* @param flags | * @param flags | |||
* @return offending option | * @return offending option | |||
*/ | */ | |||
/*@observer@*/ | /*@observer@*/ | |||
const char * poptBadOption(/*@null@*/poptContext con, int flags) | const char * poptBadOption(/*@null@*/poptContext con, unsigned int flags) | |||
/*@*/; | /*@*/; | |||
/** \ingroup popt | /** \ingroup popt | |||
* Destroy context. | * Destroy context. | |||
* @param con context | * @param con context | |||
* @return NULL always | * @return NULL always | |||
*/ | */ | |||
/*@null@*/ | /*@null@*/ | |||
poptContext poptFreeContext( /*@only@*/ /*@null@*/ poptContext con) | poptContext poptFreeContext( /*@only@*/ /*@null@*/ poptContext con) | |||
/*@modifies con @*/; | /*@modifies con @*/; | |||
skipping to change at line 539 | skipping to change at line 548 | |||
/** | /** | |||
* Save a long, performing logical operation with value. | * Save a long, performing logical operation with value. | |||
* @warning Alignment check may be too strict on certain platorms. | * @warning Alignment check may be too strict on certain platorms. | |||
* @param arg integer pointer, aligned on int boundary. | * @param arg integer pointer, aligned on int boundary. | |||
* @param argInfo logical operation (see POPT_ARGFLAG_*) | * @param argInfo logical operation (see POPT_ARGFLAG_*) | |||
* @param aLong value to use | * @param aLong value to use | |||
* @return 0 on success, POPT_ERROR_NULLARG/POPT_ERROR_BADOPERA TION | * @return 0 on success, POPT_ERROR_NULLARG/POPT_ERROR_BADOPERA TION | |||
*/ | */ | |||
/*@-incondefs@*/ | /*@-incondefs@*/ | |||
/*@unused@*/ | /*@unused@*/ | |||
int poptSaveLong(/*@null@*/ long * arg, int argInfo, long aLong) | int poptSaveLong(/*@null@*/ long * arg, unsigned int argInfo, long aLong) | |||
/*@modifies *arg @*/ | /*@globals internalState @*/ | |||
/*@modifies *arg, internalState @*/ | ||||
/*@requires maxSet(arg) >= 0 /\ maxRead(arg) == 0 @*/; | /*@requires maxSet(arg) >= 0 /\ maxRead(arg) == 0 @*/; | |||
/*@=incondefs@*/ | /*@=incondefs@*/ | |||
/** | /** | |||
* Save an integer, performing logical operation with value. | * Save an integer, performing logical operation with value. | |||
* @warning Alignment check may be too strict on certain platorms. | * @warning Alignment check may be too strict on certain platorms. | |||
* @param arg integer pointer, aligned on int boundary. | * @param arg integer pointer, aligned on int boundary. | |||
* @param argInfo logical operation (see POPT_ARGFLAG_*) | * @param argInfo logical operation (see POPT_ARGFLAG_*) | |||
* @param aLong value to use | * @param aLong value to use | |||
* @return 0 on success, POPT_ERROR_NULLARG/POPT_ERROR_BADOPERA TION | * @return 0 on success, POPT_ERROR_NULLARG/POPT_ERROR_BADOPERA TION | |||
*/ | */ | |||
/*@-incondefs@*/ | /*@-incondefs@*/ | |||
/*@unused@*/ | /*@unused@*/ | |||
int poptSaveInt(/*@null@*/ int * arg, int argInfo, long aLong) | int poptSaveInt(/*@null@*/ int * arg, unsigned int argInfo, long aLong) | |||
/*@modifies *arg @*/ | /*@globals internalState @*/ | |||
/*@modifies *arg, internalState @*/ | ||||
/*@requires maxSet(arg) >= 0 /\ maxRead(arg) == 0 @*/; | /*@requires maxSet(arg) >= 0 /\ maxRead(arg) == 0 @*/; | |||
/*@=incondefs@*/ | /*@=incondefs@*/ | |||
/*@=type@*/ | /*@=type@*/ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 20 change blocks. | ||||
63 lines changed or deleted | 75 lines changed or added | |||