add win32 (msvc) support

This commit is contained in:
2024-11-14 16:56:12 +00:00
parent c14c2e5500
commit d614e110df
35 changed files with 454 additions and 280 deletions

View File

@@ -100,42 +100,42 @@ struct b_arglist {
struct b_btree list_options;
};
extern struct b_command *b_command_get_subcommand_with_name(
BLUE_API struct b_command *b_command_get_subcommand_with_name(
struct b_command *cmd, const char *name);
extern struct b_command *b_command_get_subcommand_with_long_name(
BLUE_API struct b_command *b_command_get_subcommand_with_long_name(
struct b_command *cmd, const char *long_name);
extern struct b_command *b_command_get_subcommand_with_short_name(
BLUE_API struct b_command *b_command_get_subcommand_with_short_name(
struct b_command *cmd, char short_name);
extern struct b_command_option *b_command_get_option_with_long_name(
BLUE_API struct b_command_option *b_command_get_option_with_long_name(
struct b_command *cmd, const char *long_name);
extern struct b_command_option *b_command_get_option_with_short_name(
BLUE_API struct b_command_option *b_command_get_option_with_short_name(
struct b_command *cmd, char short_name);
extern struct b_command_option *b_command_option_create(void);
extern void b_command_option_destroy(struct b_command_option *opt);
BLUE_API struct b_command_option *b_command_option_create(void);
BLUE_API void b_command_option_destroy(struct b_command_option *opt);
extern struct b_command_arg *b_command_arg_create(void);
extern void b_command_arg_destroy(struct b_command_arg *arg);
BLUE_API struct b_command_arg *b_command_arg_create(void);
BLUE_API void b_command_arg_destroy(struct b_command_arg *arg);
extern struct b_arglist *b_arglist_create(void);
extern b_status b_arglist_parse(
BLUE_API struct b_arglist *b_arglist_create(void);
BLUE_API b_status b_arglist_parse(
struct b_arglist *args, struct b_command **cmd, int argc,
const char **argv);
extern void b_arglist_destroy(struct b_arglist *args);
BLUE_API void b_arglist_destroy(struct b_arglist *args);
extern struct b_string *z__b_command_default_usage_string(
BLUE_API struct b_string *z__b_command_default_usage_string(
struct b_command *cmd, struct b_command_option *with_opt);
extern void z__b_get_arg_usage_string(
BLUE_API void z__b_get_arg_usage_string(
struct b_command_arg *arg, bool colour, struct b_string *out);
extern void z__b_get_arg_description(
BLUE_API void z__b_get_arg_description(
struct b_command_arg *arg, struct b_string *out);
extern void z__b_get_option_usage_string(
BLUE_API void z__b_get_option_usage_string(
struct b_command_option *opt, enum cmd_string_flags flags,
struct b_string *out);
extern void z__b_get_option_description(
BLUE_API void z__b_get_option_description(
struct b_command_option *opt, struct b_string *out);
#endif

View File

@@ -172,59 +172,59 @@ typedef struct b_arglist b_arglist;
typedef int (*b_command_callback)(
const b_command *, const b_arglist *, const b_array *);
extern b_command *b_command_create(unsigned int id);
extern void b_command_destroy(b_command *cmd);
extern b_status b_command_register(b_command *cmd);
extern int b_command_dispatch(unsigned int cmd_id, int argc, const char **argv);
BLUE_API b_command *b_command_create(unsigned int id);
BLUE_API void b_command_destroy(b_command *cmd);
BLUE_API b_status b_command_register(b_command *cmd);
BLUE_API int b_command_dispatch(unsigned int cmd_id, int argc, const char **argv);
extern b_status b_command_set_name(b_command *cmd, const char *name);
extern b_status b_command_set_long_name(b_command *cmd, const char *name);
extern b_status b_command_set_short_name(b_command *cmd, char name);
extern b_status b_command_set_flags(b_command *cmd, b_command_flags flags);
extern b_status b_command_set_description(b_command *cmd, const char *description);
extern b_status b_command_set_callback(b_command *cmd, b_command_callback callback);
extern b_status b_command_set_parent(b_command *cmd, unsigned int parent_id);
extern b_command_option *b_command_add_option(b_command *cmd, int id);
extern b_command_arg *b_command_add_arg(b_command *cmd, int id);
extern b_command_usage *b_command_add_usage(b_command *cmd);
BLUE_API b_status b_command_set_name(b_command *cmd, const char *name);
BLUE_API b_status b_command_set_long_name(b_command *cmd, const char *name);
BLUE_API b_status b_command_set_short_name(b_command *cmd, char name);
BLUE_API b_status b_command_set_flags(b_command *cmd, b_command_flags flags);
BLUE_API b_status b_command_set_description(b_command *cmd, const char *description);
BLUE_API b_status b_command_set_callback(b_command *cmd, b_command_callback callback);
BLUE_API b_status b_command_set_parent(b_command *cmd, unsigned int parent_id);
BLUE_API b_command_option *b_command_add_option(b_command *cmd, int id);
BLUE_API b_command_arg *b_command_add_arg(b_command *cmd, int id);
BLUE_API b_command_usage *b_command_add_usage(b_command *cmd);
extern b_status b_command_option_set_long_name(
BLUE_API b_status b_command_option_set_long_name(
b_command_option *opt, const char *name);
extern b_status b_command_option_set_short_name(b_command_option *opt, char name);
extern b_status b_command_option_set_description(
BLUE_API b_status b_command_option_set_short_name(b_command_option *opt, char name);
BLUE_API b_status b_command_option_set_description(
b_command_option *opt, const char *description);
extern b_command_arg *b_command_option_add_arg(b_command_option *opt, int id);
BLUE_API b_command_arg *b_command_option_add_arg(b_command_option *opt, int id);
extern b_status b_command_arg_set_name(b_command_arg *arg, const char *name);
extern b_status b_command_arg_set_description(
BLUE_API b_status b_command_arg_set_name(b_command_arg *arg, const char *name);
BLUE_API b_status b_command_arg_set_description(
b_command_arg *arg, const char *description);
extern b_status b_command_arg_set_nr_values(
BLUE_API b_status b_command_arg_set_nr_values(
b_command_arg *arg, b_command_arg_value_count nr_values);
extern b_status b_command_arg_set_allowed_values(
BLUE_API b_status b_command_arg_set_allowed_values(
b_command_arg *arg, const char **allowed_values);
extern b_status b_command_usage_add_option(
BLUE_API b_status b_command_usage_add_option(
b_command_usage *usage, b_command_option *opt);
extern b_status b_command_usage_add_arg(b_command_usage *usage, b_command_arg *opt);
extern b_status b_command_usage_add_command(
BLUE_API b_status b_command_usage_add_arg(b_command_usage *usage, b_command_arg *opt);
BLUE_API b_status b_command_usage_add_command(
b_command_usage *usage, unsigned int cmd_id);
extern b_status b_arglist_get_string(
BLUE_API b_status b_arglist_get_string(
const b_arglist *args, unsigned int opt_id, unsigned int arg_id,
unsigned int index, const char **out);
extern b_status b_arglist_get_int(
BLUE_API b_status b_arglist_get_int(
const b_arglist *args, unsigned int opt_id, unsigned int arg_id,
unsigned int index, long long *out);
extern b_status b_arglist_get_uint(
BLUE_API b_status b_arglist_get_uint(
const b_arglist *args, unsigned int opt_id, unsigned int arg_id,
unsigned int index, unsigned long long *out);
extern size_t b_arglist_get_count(
BLUE_API size_t b_arglist_get_count(
const b_arglist *args, unsigned int opt_id, unsigned int arg_id);
extern int b_arglist_iterator_begin(
BLUE_API int b_arglist_iterator_begin(
const b_arglist *args, unsigned int opt_filter, unsigned int arg_filter,
b_arglist_iterator *it);
extern bool b_arglist_iterator_next(b_arglist_iterator *it);
extern bool b_arglist_iterator_is_valid(const b_arglist_iterator *it);
BLUE_API bool b_arglist_iterator_next(b_arglist_iterator *it);
BLUE_API bool b_arglist_iterator_is_valid(const b_arglist_iterator *it);
#endif