commit 981fee6457fd20e5a19e46f7f57af92f993fafc5
parent ce32beb839c8a3fa55f84fd3d37a1be6d2458432
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date: Wed, 12 Jun 2024 20:15:28 +0200
Fix a few inconsistencies
Diffstat:
4 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt
@@ -1,5 +1,6 @@
add_executable(demo main.cpp)
target_link_libraries(demo PRIVATE args)
+target_include_directories(demo PRIVATE ../include)
set_target_properties(demo PROPERTIES LANGUAGE CXX)
set_target_properties(demo PROPERTIES
VERSION ${PROJECT_VERSION}
@@ -8,6 +9,7 @@ set_target_properties(demo PROPERTIES
add_executable(cdemo main.c)
target_link_libraries(cdemo PRIVATE args)
+target_include_directories(cdemo PRIVATE ../include)
set_target_properties(cdemo PROPERTIES LANGUAGE C)
set_target_properties(cdemo PROPERTIES
VERSION ${PROJECT_VERSION}
diff --git a/demo/main.c b/demo/main.c
@@ -13,7 +13,7 @@ typedef struct {
int relocatable;
} arguments_t;
-int parse_opt(int key, const char *arg, args_parser *parser) {
+int parse_opt(int key, const char *arg, args_parser_t *parser) {
arguments_t *arguments = (arguments_t *)args_parser_input(parser);
switch (key) {
diff --git a/include/args.h b/include/args.h
@@ -15,7 +15,7 @@ extern "C" {
namespace args {
struct Parser;
-typedef Parser args_parser;
+typedef Parser args_parser_t;
#else
@@ -28,7 +28,7 @@ typedef Parser args_parser;
#define ENUM_PARSE args_parse_e
struct __Parser;
-typedef struct __Parser args_parser;
+typedef struct __Parser args_parser_t;
#endif
@@ -41,7 +41,7 @@ typedef struct {
int group;
} args_option_t;
-typedef int (*args_parse_f)(int key, const char *arg, args_parser *parser);
+typedef int (*args_parse_f)(int key, const char *arg, args_parser_t *parser);
typedef struct {
args_option_t const *options;
@@ -96,16 +96,16 @@ enum ENUM_PARSE {
#if !defined __cplusplus || defined WITH_C_BINDINGS
-void *args_parser_input(args_parser *parser);
+void *args_parser_input(args_parser_t *parser);
-void args_usage(args_parser *parser);
+void args_usage(args_parser_t *parser);
-void argp_help(const args_parser *state, FILE *stream, unsigned flags);
+void args_help(const args_parser_t *state, FILE *stream, unsigned flags);
int args_parse(const args_argp_t *argp, int argc, char *argv[], unsigned flags,
void *input);
-void argp_failure(const args_parser *parser, int status, int errnum,
+void args_failure(const args_parser_t *parser, int status, int errnum,
const char *fmt, ...);
#endif
diff --git a/src/c_bindings.cpp b/src/c_bindings.cpp
@@ -10,15 +10,15 @@ int args_parse(const args_argp_t *argp, int argc, char *argv[], unsigned flags,
return parse(argp, argc, argv, flags, input);
}
-void *args_parser_input(args_parser *parser) { return parser->input(); }
+void *args_parser_input(args_parser_t *parser) { return parser->input(); }
-void args_usage(args_parser *parser) { return usage(parser); }
+void args_usage(args_parser_t *parser) { return usage(parser); }
-void argp_help(const args_parser *parser, FILE *stream, unsigned flags) {
+void args_help(const args_parser_t *parser, FILE *stream, unsigned flags) {
help(parser, stream, flags);
}
-void argp_failure(const args_parser *parser, int status, int errnum,
+void args_failure(const args_parser_t *parser, int status, int errnum,
const char *fmt, ...) {
std::va_list args;
va_start(args, fmt);