|
@ -52,6 +52,18 @@ extern "C" { |
|
|
/* bit masks for arg_hdr.flag */ |
|
|
/* bit masks for arg_hdr.flag */ |
|
|
enum { ARG_TERMINATOR = 0x1, ARG_HASVALUE = 0x2, ARG_HASOPTVALUE = 0x4 }; |
|
|
enum { ARG_TERMINATOR = 0x1, ARG_HASVALUE = 0x2, ARG_HASOPTVALUE = 0x4 }; |
|
|
|
|
|
|
|
|
|
|
|
#if defined(_WIN32) |
|
|
|
|
|
#if defined(argtable3_EXPORTS) |
|
|
|
|
|
#define ARG_EXTERN __declspec(dllexport) |
|
|
|
|
|
#elif defined(argtable3_IMPORTS) |
|
|
|
|
|
#define ARG_EXTERN __declspec(dllimport) |
|
|
|
|
|
#else |
|
|
|
|
|
#define ARG_EXTERN |
|
|
|
|
|
#endif |
|
|
|
|
|
#else |
|
|
|
|
|
#define ARG_EXTERN |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
typedef struct _internal_arg_dstr* arg_dstr_t; |
|
|
typedef struct _internal_arg_dstr* arg_dstr_t; |
|
|
typedef void* arg_cmd_itr_t; |
|
|
typedef void* arg_cmd_itr_t; |
|
|
|
|
|
|
|
@ -161,31 +173,31 @@ typedef struct arg_cmd_info { |
|
|
|
|
|
|
|
|
/**** arg_xxx constructor functions *********************************/ |
|
|
/**** arg_xxx constructor functions *********************************/ |
|
|
|
|
|
|
|
|
struct arg_rem* arg_rem(const char* datatype, const char* glossary); |
|
|
ARG_EXTERN struct arg_rem* arg_rem(const char* datatype, const char* glossary); |
|
|
|
|
|
|
|
|
struct arg_lit* arg_lit0(const char* shortopts, const char* longopts, const char* glossary); |
|
|
ARG_EXTERN struct arg_lit* arg_lit0(const char* shortopts, const char* longopts, const char* glossary); |
|
|
struct arg_lit* arg_lit1(const char* shortopts, const char* longopts, const char* glossary); |
|
|
ARG_EXTERN struct arg_lit* arg_lit1(const char* shortopts, const char* longopts, const char* glossary); |
|
|
struct arg_lit* arg_litn(const char* shortopts, const char* longopts, int mincount, int maxcount, const char* glossary); |
|
|
ARG_EXTERN struct arg_lit* arg_litn(const char* shortopts, const char* longopts, int mincount, int maxcount, const char* glossary); |
|
|
|
|
|
|
|
|
struct arg_key* arg_key0(const char* keyword, int flags, const char* glossary); |
|
|
ARG_EXTERN struct arg_key* arg_key0(const char* keyword, int flags, const char* glossary); |
|
|
struct arg_key* arg_key1(const char* keyword, int flags, const char* glossary); |
|
|
ARG_EXTERN struct arg_key* arg_key1(const char* keyword, int flags, const char* glossary); |
|
|
struct arg_key* arg_keyn(const char* keyword, int flags, int mincount, int maxcount, const char* glossary); |
|
|
ARG_EXTERN struct arg_key* arg_keyn(const char* keyword, int flags, int mincount, int maxcount, const char* glossary); |
|
|
|
|
|
|
|
|
struct arg_int* arg_int0(const char* shortopts, const char* longopts, const char* datatype, const char* glossary); |
|
|
ARG_EXTERN struct arg_int* arg_int0(const char* shortopts, const char* longopts, const char* datatype, const char* glossary); |
|
|
struct arg_int* arg_int1(const char* shortopts, const char* longopts, const char* datatype, const char* glossary); |
|
|
ARG_EXTERN struct arg_int* arg_int1(const char* shortopts, const char* longopts, const char* datatype, const char* glossary); |
|
|
struct arg_int* arg_intn(const char* shortopts, const char* longopts, const char* datatype, int mincount, int maxcount, const char* glossary); |
|
|
ARG_EXTERN struct arg_int* arg_intn(const char* shortopts, const char* longopts, const char* datatype, int mincount, int maxcount, const char* glossary); |
|
|
|
|
|
|
|
|
struct arg_dbl* arg_dbl0(const char* shortopts, const char* longopts, const char* datatype, const char* glossary); |
|
|
ARG_EXTERN struct arg_dbl* arg_dbl0(const char* shortopts, const char* longopts, const char* datatype, const char* glossary); |
|
|
struct arg_dbl* arg_dbl1(const char* shortopts, const char* longopts, const char* datatype, const char* glossary); |
|
|
ARG_EXTERN struct arg_dbl* arg_dbl1(const char* shortopts, const char* longopts, const char* datatype, const char* glossary); |
|
|
struct arg_dbl* arg_dbln(const char* shortopts, const char* longopts, const char* datatype, int mincount, int maxcount, const char* glossary); |
|
|
ARG_EXTERN struct arg_dbl* arg_dbln(const char* shortopts, const char* longopts, const char* datatype, int mincount, int maxcount, const char* glossary); |
|
|
|
|
|
|
|
|
struct arg_str* arg_str0(const char* shortopts, const char* longopts, const char* datatype, const char* glossary); |
|
|
ARG_EXTERN struct arg_str* arg_str0(const char* shortopts, const char* longopts, const char* datatype, const char* glossary); |
|
|
struct arg_str* arg_str1(const char* shortopts, const char* longopts, const char* datatype, const char* glossary); |
|
|
ARG_EXTERN struct arg_str* arg_str1(const char* shortopts, const char* longopts, const char* datatype, const char* glossary); |
|
|
struct arg_str* arg_strn(const char* shortopts, const char* longopts, const char* datatype, int mincount, int maxcount, const char* glossary); |
|
|
ARG_EXTERN struct arg_str* arg_strn(const char* shortopts, const char* longopts, const char* datatype, int mincount, int maxcount, const char* glossary); |
|
|
|
|
|
|
|
|
struct arg_rex* arg_rex0(const char* shortopts, const char* longopts, const char* pattern, const char* datatype, int flags, const char* glossary); |
|
|
ARG_EXTERN struct arg_rex* arg_rex0(const char* shortopts, const char* longopts, const char* pattern, const char* datatype, int flags, const char* glossary); |
|
|
struct arg_rex* arg_rex1(const char* shortopts, const char* longopts, const char* pattern, const char* datatype, int flags, const char* glossary); |
|
|
ARG_EXTERN struct arg_rex* arg_rex1(const char* shortopts, const char* longopts, const char* pattern, const char* datatype, int flags, const char* glossary); |
|
|
struct arg_rex* arg_rexn(const char* shortopts, |
|
|
ARG_EXTERN struct arg_rex* arg_rexn(const char* shortopts, |
|
|
const char* longopts, |
|
|
const char* longopts, |
|
|
const char* pattern, |
|
|
const char* pattern, |
|
|
const char* datatype, |
|
|
const char* datatype, |
|
@ -194,70 +206,69 @@ struct arg_rex* arg_rexn(const char* shortopts, |
|
|
int flags, |
|
|
int flags, |
|
|
const char* glossary); |
|
|
const char* glossary); |
|
|
|
|
|
|
|
|
struct arg_file* arg_file0(const char* shortopts, const char* longopts, const char* datatype, const char* glossary); |
|
|
ARG_EXTERN struct arg_file* arg_file0(const char* shortopts, const char* longopts, const char* datatype, const char* glossary); |
|
|
struct arg_file* arg_file1(const char* shortopts, const char* longopts, const char* datatype, const char* glossary); |
|
|
ARG_EXTERN struct arg_file* arg_file1(const char* shortopts, const char* longopts, const char* datatype, const char* glossary); |
|
|
struct arg_file* arg_filen(const char* shortopts, const char* longopts, const char* datatype, int mincount, int maxcount, const char* glossary); |
|
|
ARG_EXTERN struct arg_file* arg_filen(const char* shortopts, const char* longopts, const char* datatype, int mincount, int maxcount, const char* glossary); |
|
|
|
|
|
|
|
|
struct arg_date* arg_date0(const char* shortopts, const char* longopts, const char* format, const char* datatype, const char* glossary); |
|
|
ARG_EXTERN struct arg_date* arg_date0(const char* shortopts, const char* longopts, const char* format, const char* datatype, const char* glossary); |
|
|
struct arg_date* arg_date1(const char* shortopts, const char* longopts, const char* format, const char* datatype, const char* glossary); |
|
|
ARG_EXTERN struct arg_date* arg_date1(const char* shortopts, const char* longopts, const char* format, const char* datatype, const char* glossary); |
|
|
struct arg_date* |
|
|
ARG_EXTERN struct arg_date* arg_daten(const char* shortopts, const char* longopts, const char* format, const char* datatype, int mincount, int maxcount, const char* glossary); |
|
|
arg_daten(const char* shortopts, const char* longopts, const char* format, const char* datatype, int mincount, int maxcount, const char* glossary); |
|
|
|
|
|
|
|
|
|
|
|
struct arg_end* arg_end(int maxerrors); |
|
|
ARG_EXTERN struct arg_end* arg_end(int maxerrors); |
|
|
|
|
|
|
|
|
#define ARG_DSTR_STATIC ((arg_dstr_freefn*)0) |
|
|
#define ARG_DSTR_STATIC ((arg_dstr_freefn*)0) |
|
|
#define ARG_DSTR_VOLATILE ((arg_dstr_freefn*)1) |
|
|
#define ARG_DSTR_VOLATILE ((arg_dstr_freefn*)1) |
|
|
#define ARG_DSTR_DYNAMIC ((arg_dstr_freefn*)3) |
|
|
#define ARG_DSTR_DYNAMIC ((arg_dstr_freefn*)3) |
|
|
|
|
|
|
|
|
/**** other functions *******************************************/ |
|
|
/**** other functions *******************************************/ |
|
|
int arg_nullcheck(void** argtable); |
|
|
ARG_EXTERN int arg_nullcheck(void** argtable); |
|
|
int arg_parse(int argc, char** argv, void** argtable); |
|
|
ARG_EXTERN int arg_parse(int argc, char** argv, void** argtable); |
|
|
void arg_print_option(FILE* fp, const char* shortopts, const char* longopts, const char* datatype, const char* suffix); |
|
|
ARG_EXTERN void arg_print_option(FILE* fp, const char* shortopts, const char* longopts, const char* datatype, const char* suffix); |
|
|
void arg_print_syntax(FILE* fp, void** argtable, const char* suffix); |
|
|
ARG_EXTERN void arg_print_syntax(FILE* fp, void** argtable, const char* suffix); |
|
|
void arg_print_syntaxv(FILE* fp, void** argtable, const char* suffix); |
|
|
ARG_EXTERN void arg_print_syntaxv(FILE* fp, void** argtable, const char* suffix); |
|
|
void arg_print_glossary(FILE* fp, void** argtable, const char* format); |
|
|
ARG_EXTERN void arg_print_glossary(FILE* fp, void** argtable, const char* format); |
|
|
void arg_print_glossary_gnu(FILE* fp, void** argtable); |
|
|
ARG_EXTERN void arg_print_glossary_gnu(FILE* fp, void** argtable); |
|
|
void arg_print_errors(FILE* fp, struct arg_end* end, const char* progname); |
|
|
ARG_EXTERN void arg_print_errors(FILE* fp, struct arg_end* end, const char* progname); |
|
|
void arg_print_option_ds(arg_dstr_t ds, const char* shortopts, const char* longopts, const char* datatype, const char* suffix); |
|
|
ARG_EXTERN void arg_print_option_ds(arg_dstr_t ds, const char* shortopts, const char* longopts, const char* datatype, const char* suffix); |
|
|
void arg_print_syntax_ds(arg_dstr_t ds, void** argtable, const char* suffix); |
|
|
ARG_EXTERN void arg_print_syntax_ds(arg_dstr_t ds, void** argtable, const char* suffix); |
|
|
void arg_print_syntaxv_ds(arg_dstr_t ds, void** argtable, const char* suffix); |
|
|
ARG_EXTERN void arg_print_syntaxv_ds(arg_dstr_t ds, void** argtable, const char* suffix); |
|
|
void arg_print_glossary_ds(arg_dstr_t ds, void** argtable, const char* format); |
|
|
ARG_EXTERN void arg_print_glossary_ds(arg_dstr_t ds, void** argtable, const char* format); |
|
|
void arg_print_glossary_gnu_ds(arg_dstr_t ds, void** argtable); |
|
|
ARG_EXTERN void arg_print_glossary_gnu_ds(arg_dstr_t ds, void** argtable); |
|
|
void arg_print_errors_ds(arg_dstr_t ds, struct arg_end* end, const char* progname); |
|
|
ARG_EXTERN void arg_print_errors_ds(arg_dstr_t ds, struct arg_end* end, const char* progname); |
|
|
void arg_freetable(void** argtable, size_t n); |
|
|
ARG_EXTERN void arg_freetable(void** argtable, size_t n); |
|
|
|
|
|
|
|
|
arg_dstr_t arg_dstr_create(); |
|
|
ARG_EXTERN arg_dstr_t arg_dstr_create(); |
|
|
void arg_dstr_destroy(arg_dstr_t ds); |
|
|
ARG_EXTERN void arg_dstr_destroy(arg_dstr_t ds); |
|
|
void arg_dstr_reset(arg_dstr_t ds); |
|
|
ARG_EXTERN void arg_dstr_reset(arg_dstr_t ds); |
|
|
void arg_dstr_free(arg_dstr_t ds); |
|
|
ARG_EXTERN void arg_dstr_free(arg_dstr_t ds); |
|
|
void arg_dstr_set(arg_dstr_t ds, char* str, arg_dstr_freefn* free_proc); |
|
|
ARG_EXTERN void arg_dstr_set(arg_dstr_t ds, char* str, arg_dstr_freefn* free_proc); |
|
|
void arg_dstr_cat(arg_dstr_t ds, char* str); |
|
|
ARG_EXTERN void arg_dstr_cat(arg_dstr_t ds, char* str); |
|
|
void arg_dstr_catf(arg_dstr_t ds, const char* fmt, ...); |
|
|
ARG_EXTERN void arg_dstr_catf(arg_dstr_t ds, const char* fmt, ...); |
|
|
char* arg_dstr_cstr(arg_dstr_t ds); |
|
|
ARG_EXTERN char* arg_dstr_cstr(arg_dstr_t ds); |
|
|
|
|
|
|
|
|
void arg_cmd_init(void); |
|
|
ARG_EXTERN void arg_cmd_init(void); |
|
|
void arg_cmd_uninit(void); |
|
|
ARG_EXTERN void arg_cmd_uninit(void); |
|
|
void arg_cmd_register(const char* name, arg_cmdfn* proc, const char* description); |
|
|
ARG_EXTERN void arg_cmd_register(const char* name, arg_cmdfn* proc, const char* description); |
|
|
void arg_cmd_unregister(const char* name); |
|
|
ARG_EXTERN void arg_cmd_unregister(const char* name); |
|
|
int arg_cmd_dispatch(const char* name, int argc, char* argv[], arg_dstr_t res); |
|
|
ARG_EXTERN int arg_cmd_dispatch(const char* name, int argc, char* argv[], arg_dstr_t res); |
|
|
unsigned int arg_cmd_count(void); |
|
|
ARG_EXTERN unsigned int arg_cmd_count(void); |
|
|
arg_cmd_info_t* arg_cmd_info(const char* name); |
|
|
ARG_EXTERN arg_cmd_info_t* arg_cmd_info(const char* name); |
|
|
arg_cmd_itr_t arg_cmd_itr_create(void); |
|
|
ARG_EXTERN arg_cmd_itr_t arg_cmd_itr_create(void); |
|
|
void arg_cmd_itr_destroy(arg_cmd_itr_t itr); |
|
|
ARG_EXTERN void arg_cmd_itr_destroy(arg_cmd_itr_t itr); |
|
|
int arg_cmd_itr_advance(arg_cmd_itr_t itr); |
|
|
ARG_EXTERN int arg_cmd_itr_advance(arg_cmd_itr_t itr); |
|
|
char* arg_cmd_itr_key(arg_cmd_itr_t itr); |
|
|
ARG_EXTERN char* arg_cmd_itr_key(arg_cmd_itr_t itr); |
|
|
arg_cmd_info_t* arg_cmd_itr_value(arg_cmd_itr_t itr); |
|
|
ARG_EXTERN arg_cmd_info_t* arg_cmd_itr_value(arg_cmd_itr_t itr); |
|
|
int arg_cmd_itr_search(arg_cmd_itr_t itr, void* k); |
|
|
ARG_EXTERN int arg_cmd_itr_search(arg_cmd_itr_t itr, void* k); |
|
|
void arg_mgsort(void* data, int size, int esize, int i, int k, arg_comparefn* comparefn); |
|
|
ARG_EXTERN void arg_mgsort(void* data, int size, int esize, int i, int k, arg_comparefn* comparefn); |
|
|
void arg_make_get_help_msg(arg_dstr_t res); |
|
|
ARG_EXTERN void arg_make_get_help_msg(arg_dstr_t res); |
|
|
void arg_make_help_msg(arg_dstr_t ds, char* cmd_name, void** argtable); |
|
|
ARG_EXTERN void arg_make_help_msg(arg_dstr_t ds, char* cmd_name, void** argtable); |
|
|
void arg_make_syntax_err_msg(arg_dstr_t ds, void** argtable, struct arg_end* end); |
|
|
ARG_EXTERN void arg_make_syntax_err_msg(arg_dstr_t ds, void** argtable, struct arg_end* end); |
|
|
int arg_make_syntax_err_help_msg(arg_dstr_t ds, char* name, int help, int nerrors, void** argtable, struct arg_end* end, int* exitcode); |
|
|
ARG_EXTERN int arg_make_syntax_err_help_msg(arg_dstr_t ds, char* name, int help, int nerrors, void** argtable, struct arg_end* end, int* exitcode); |
|
|
void arg_set_module_name(const char* name); |
|
|
ARG_EXTERN void arg_set_module_name(const char* name); |
|
|
void arg_set_module_version(int major, int minor, int patch, const char* tag); |
|
|
ARG_EXTERN void arg_set_module_version(int major, int minor, int patch, const char* tag); |
|
|
|
|
|
|
|
|
/**** deprecated functions, for back-compatibility only ********/ |
|
|
/**** deprecated functions, for back-compatibility only ********/ |
|
|
void arg_free(void** argtable); |
|
|
ARG_EXTERN void arg_free(void** argtable); |
|
|
|
|
|
|
|
|
#ifdef __cplusplus |
|
|
#ifdef __cplusplus |
|
|
} |
|
|
} |
|
|