airopt.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00021
00022 #ifndef _AIR_AIROPT_H_
00023 #define _AIR_AIROPT_H_
00024
00025 #include <airframe/autoinc.h>
00026
00027 #if USE_GOPTION
00028
00029 typedef GOptionEntry AirOptionEntry;
00030
00041 #define AF_OPTION(longname, shortname, flag, type, var, desc, vardesc) \
00042 { longname, shortname, flag, type, var, desc, vardesc }
00043
00047 #define AF_OPTION_END { NULL }
00048
00052 #define AF_OPTION_EMPTY(option) ( option.long_name == NULL )
00053
00055 #define AF_OPT_TYPE_NONE G_OPTION_ARG_NONE
00056
00058 #define AF_OPT_TYPE_INT G_OPTION_ARG_INT
00059
00061 #define AF_OPT_TYPE_STRING G_OPTION_ARG_STRING
00062
00064 #define AF_OPT_TYPE_DOUBLE G_OPTION_ARG_DOUBLE
00065
00066 #elif USE_POPT
00067
00068 #include <popt.h>
00069
00070 typedef struct poptOption AirOptionEntry;
00071
00082 #define AF_OPTION(longname, shortname, flag, type, var, desc, vardesc) \
00083 { longname, shortname, type, var, flag, desc, vardesc }
00084
00088 #define AF_OPTION_END POPT_TABLEEND
00089
00093 #define AF_OPTION_EMPTY(option) \
00094 ( option.longName == NULL \
00095 && option.shortName == '\0' \
00096 && option.argInfo == 0 )
00097
00099 #define AF_OPT_TYPE_NONE POPT_ARG_NONE
00100
00102 #define AF_OPT_TYPE_INT POPT_ARG_INT
00103
00105 #define AF_OPT_TYPE_STRING POPT_ARG_STRING
00106
00108 #define AF_OPT_TYPE_DOUBLE POPT_ARG_DOUBLE
00109
00110 #else
00111
00112 #error A suitable GLib or popt library was not found for options processing.
00113
00114 #endif
00115
00119 typedef struct _AirOptionCtx AirOptionCtx;
00120
00129 void air_opterr(
00130 const char *fmt,
00131 ...);
00132
00142 AirOptionCtx *air_option_context_new(
00143 const char *helpstr,
00144 int *argc,
00145 char ***argv,
00146 AirOptionEntry *entries);
00147
00158 gboolean air_option_context_add_group(
00159 AirOptionCtx *aoctx,
00160 const char *shortname,
00161 const char *longname,
00162 const char *description,
00163 AirOptionEntry *entries);
00164
00174 void air_option_context_parse(
00175 AirOptionCtx *aoctx);
00176
00183 void air_option_context_set_help_enabled(
00184 AirOptionCtx *aoctx);
00185
00192 void air_option_context_usage(
00193 AirOptionCtx *aoctx);
00194
00200 void air_option_context_free(
00201 AirOptionCtx *aoctx);
00202
00203
00204
00205
00206 #endif
00207