Added __cplusplus macros for c++ compatibility

parent ca9526cb
libcleri (0.9.2)
* Added __cplusplus macros for c++ compatibility.
-- Jeroen van der Heijden <jeroen@transceptor.technology> 25 Aug 2017
libcleri (0.9.1)
* Rename object.h to cleri.h and the cleri_object_t to cleri_t.
......
......@@ -24,8 +24,16 @@ typedef struct cleri_olist_s cleri_olist_t;
typedef struct cleri_choice_s cleri_choice_t;
/* public functions */
#ifdef __cplusplus
extern "C" {
#endif
cleri_t * cleri_choice(uint32_t gid, int most_greedy, size_t len, ...);
#ifdef __cplusplus
}
#endif
/* structs */
struct cleri_choice_s
{
......
......@@ -52,7 +52,6 @@ typedef struct cleri_ref_s cleri_ref_t;
typedef struct cleri_s cleri_t;
typedef struct cleri_dup_s cleri_dup_t;
typedef enum cleri_e cleri_tp;
typedef union cleri_u cleri_via_t;
typedef void (*cleri_free_object_t)(cleri_t *);
......@@ -63,7 +62,7 @@ typedef cleri_node_t * (*cleri_parse_object_t)(
cleri_rule_store_t *);
/* enums */
enum cleri_e {
typedef enum cleri_e {
CLERI_TP_SEQUENCE,
CLERI_TP_OPTIONAL,
CLERI_TP_CHOICE,
......@@ -79,7 +78,7 @@ enum cleri_e {
CLERI_TP_REGEX,
CLERI_TP_REF,
CLERI_TP_END_OF_STATEMENT
};
} cleri_tp;
/* unions */
union cleri_u
......@@ -100,6 +99,10 @@ union cleri_u
};
/* public functions */
#ifdef __cplusplus
extern "C" {
#endif
cleri_t * cleri_new(
uint32_t gid,
cleri_tp tp,
......@@ -109,6 +112,10 @@ void cleri_incref(cleri_t * cl_object);
void cleri_decref(cleri_t * cl_object);
int cleri_free(cleri_t * cl_object);
#ifdef __cplusplus
}
#endif
/* fixed end of statement object */
extern cleri_t * CLERI_END_OF_STATEMENT;
......
......@@ -21,8 +21,16 @@ typedef struct cleri_s cleri_t;
typedef struct cleri_dup_s cleri_dup_t;
/* public functions */
#ifdef __cplusplus
extern "C" {
#endif
cleri_t * cleri_dup(uint32_t gid, cleri_t * cl_obj);
#ifdef __cplusplus
}
#endif
/* structs */
// cleri_dup_t is defined in cleri.h
......
......@@ -23,9 +23,17 @@ typedef struct cleri_s cleri_t;
typedef struct cleri_grammar_s cleri_grammar_t;
/* public functions */
#ifdef __cplusplus
extern "C" {
#endif
cleri_grammar_t * cleri_grammar(cleri_t * start, const char * re_keywords);
void cleri_grammar_free(cleri_grammar_t * grammar);
#ifdef __cplusplus
}
#endif
/* structs */
struct cleri_grammar_s
{
......
......@@ -21,8 +21,15 @@ typedef struct cleri_s cleri_t;
typedef struct cleri_keyword_s cleri_keyword_t;
/* public functions */
#ifdef __cplusplus
extern "C" {
#endif
cleri_t * cleri_keyword(uint32_t gid, const char * keyword, int ign_case);
#ifdef __cplusplus
}
#endif
/* structs */
struct cleri_keyword_s
{
......
......@@ -22,6 +22,10 @@ typedef struct cleri_s cleri_t;
typedef struct cleri_list_s cleri_list_t;
/* public functions */
#ifdef __cplusplus
extern "C" {
#endif
cleri_t * cleri_list(
uint32_t gid,
cleri_t * cl_obj,
......@@ -30,6 +34,10 @@ cleri_t * cleri_list(
size_t max,
int opt_closing);
#ifdef __cplusplus
}
#endif
/* structs */
struct cleri_list_s
{
......
......@@ -20,8 +20,16 @@ typedef struct cleri_s cleri_t;
typedef struct cleri_optional_s cleri_optional_t;
/* public functions */
#ifdef __cplusplus
extern "C" {
#endif
cleri_t * cleri_optional(uint32_t gid, cleri_t * cl_obj);
#ifdef __cplusplus
}
#endif
/* structs */
struct cleri_optional_s
{
......
......@@ -31,10 +31,18 @@ typedef struct cleri_rule_store_s cleri_rule_store_t;
typedef struct cleri_parse_s cleri_parse_t;
/* public functions */
#ifdef __cplusplus
extern "C" {
#endif
cleri_parse_t * cleri_parse(cleri_grammar_t * grammar, const char * str);
void cleri_parse_free(cleri_parse_t * pr);
void cleri_parse_expect_start(cleri_parse_t * pr);
#ifdef __cplusplus
}
#endif
/* private functions */
cleri_node_t * cleri__parse_walk(
cleri_parse_t * pr,
......
......@@ -25,8 +25,16 @@ typedef struct cleri_olist_s cleri_olist_t;
typedef struct cleri_prio_s cleri_prio_t;
/* public functions */
#ifdef __cplusplus
extern "C" {
#endif
cleri_t * cleri_prio(uint32_t gid, size_t len, ...);
#ifdef __cplusplus
}
#endif
/* structs */
struct cleri_prio_s
{
......
......@@ -20,7 +20,15 @@
typedef struct cleri_s cleri_t;
/* public functions */
#ifdef __cplusplus
extern "C" {
#endif
cleri_t * cleri_ref(void);
void cleri_ref_set(cleri_t * ref, cleri_t * cl_obj);
#ifdef __cplusplus
}
#endif
#endif /* CLERI_REF_H_ */
\ No newline at end of file
......@@ -22,8 +22,16 @@ typedef struct cleri_s cleri_t;
typedef struct cleri_regex_s cleri_regex_t;
/* public functions */
#ifdef __cplusplus
extern "C" {
#endif
cleri_t * cleri_regex(uint32_t gid, const char * pattern);
#ifdef __cplusplus
}
#endif
/* structs */
struct cleri_regex_s
{
......
......@@ -22,8 +22,16 @@ typedef struct cleri_s cleri_t;
typedef struct cleri_repeat_s cleri_repeat_t;
/* public functions */
#ifdef __cplusplus
extern "C" {
#endif
cleri_t * cleri_repeat(uint32_t gid, cleri_t * cl_obj, size_t min, size_t max);
#ifdef __cplusplus
}
#endif
/* structs */
struct cleri_repeat_s
{
......
......@@ -25,15 +25,14 @@ typedef struct cleri_node_s cleri_node_t;
typedef struct cleri_rule_tested_s cleri_rule_tested_t;
typedef struct cleri_rule_store_s cleri_rule_store_t;
typedef struct cleri_rule_s cleri_rule_t;
typedef enum cleri_rule_test_e cleri_rule_test_t;
/* enums */
enum cleri_rule_test_e
typedef enum cleri_rule_test_e
{
CLERI_RULE_ERROR=-1,
CLERI_RULE_FALSE,
CLERI_RULE_TRUE
};
} cleri_rule_test_t;
/* private functions */
cleri_t * cleri__rule(uint32_t gid, cleri_t * cl_obj);
......
......@@ -23,8 +23,16 @@ typedef struct cleri_olist_s cleri_olist_t;
typedef struct cleri_sequence_s cleri_sequence_t;
/* public functions */
#ifdef __cplusplus
extern "C" {
#endif
cleri_t * cleri_sequence(uint32_t gid, size_t len, ...);
#ifdef __cplusplus
}
#endif
/* structs */
struct cleri_sequence_s
{
......
......@@ -24,8 +24,16 @@ typedef struct cleri_s cleri_t;
typedef struct cleri_token_s cleri_token_t;
/* public functions */
#ifdef __cplusplus
extern "C" {
#endif
cleri_t * cleri_token(uint32_t gid, const char * token);
#ifdef __cplusplus
}
#endif
/* structs */
struct cleri_token_s
{
......
......@@ -23,8 +23,16 @@ typedef struct cleri_tlist_s cleri_tlist_t;
typedef struct cleri_tokens_s cleri_tokens_t;
/* public functions */
#ifdef __cplusplus
extern "C" {
#endif
cleri_t * cleri_tokens(uint32_t gid, const char * tokens);
#ifdef __cplusplus
}
#endif
/* structs */
struct cleri_tlist_s
{
......
......@@ -9,7 +9,7 @@
#define LIBCLERI_VERSION_MAJOR 0
#define LIBCLERI_VERSION_MINOR 9
#define LIBCLERI_VERSION_PATCH 1
#define LIBCLERI_VERSION_PATCH 2
#define LIBCLERI_STRINGIFY(num) #num
#define LIBCLERI_VERSION_STR(major,minor,patch) \
......@@ -22,6 +22,15 @@
LIBCLERI_VERSION_MINOR, \
LIBCLERI_VERSION_PATCH)
/* public funtion */
#ifdef __cplusplus
extern "C" {
#endif
const char * cleri_version(void);
#ifdef __cplusplus
}
#endif
#endif /* CLERI_VERSION_H_ */
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment