Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add export "C" for all header files #740

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions include/zenoh-pico/collections/arc_slice.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
#include "slice.h"
#include "zenoh-pico/system/platform_common.h"

#ifdef __cplusplus
extern "C" {
#endif

_Z_REFCOUNT_DEFINE(_z_slice, _z_slice)

/*-------- ArcSlice --------*/
Expand Down Expand Up @@ -52,4 +56,8 @@ z_result_t _z_arc_slice_copy(_z_arc_slice_t* dst, const _z_arc_slice_t* src);
z_result_t _z_arc_slice_move(_z_arc_slice_t* dst, _z_arc_slice_t* src);
z_result_t _z_arc_slice_drop(_z_arc_slice_t* s);

#ifdef __cplusplus
}
#endif

#endif /* ZENOH_PICO_COLLECTIONS_ARC_SLICE_H */
8 changes: 8 additions & 0 deletions include/zenoh-pico/collections/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#include <stdint.h>
#include <string.h>

#ifdef __cplusplus
extern "C" {
#endif

/*------------------ Internal Array Macros ------------------*/
#define _Z_ARRAY_DEFINE(name, type) \
typedef struct { \
Expand Down Expand Up @@ -71,4 +75,8 @@
} \
}

#ifdef __cplusplus
}
#endif

#endif /* ZENOH_PICO_COLLECTIONS_ARRAY_H */
8 changes: 8 additions & 0 deletions include/zenoh-pico/collections/bytes.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
#include "vec.h"
#include "zenoh-pico/protocol/iobuf.h"

#ifdef __cplusplus
extern "C" {
#endif

inline size_t _z_arc_slice_size(const _z_arc_slice_t *s) {
(void)s;
return sizeof(_z_arc_slice_t);
Expand Down Expand Up @@ -94,4 +98,8 @@ void _z_bytes_writer_clear(_z_bytes_writer_t *writer);
void _z_bytes_writer_move(_z_bytes_writer_t *dst, _z_bytes_writer_t *src);
size_t _z_bytes_reader_remaining(const _z_bytes_reader_t *reader);

#ifdef __cplusplus
}
#endif

#endif /* ZENOH_PICO_COLLECTIONS_BYTES_H */
8 changes: 8 additions & 0 deletions include/zenoh-pico/collections/element.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#include "zenoh-pico/system/platform.h"
#include "zenoh-pico/utils/result.h"

#ifdef __cplusplus
extern "C" {
#endif

/*-------- element functions --------*/
typedef size_t (*z_element_size_f)(void *e);
typedef void (*z_element_clear_f)(void *e);
Expand Down Expand Up @@ -74,4 +78,8 @@ static inline void _z_noop_move(void *dst, void *src) {

_Z_ELEM_DEFINE(_z_noop, _z_noop_t, _z_noop_size, _z_noop_clear, _z_noop_copy)

#ifdef __cplusplus
}
#endif

#endif /* ZENOH_PICO_COLLECTIONS_ELEMENT_H */
8 changes: 8 additions & 0 deletions include/zenoh-pico/collections/fifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#include "zenoh-pico/collections/element.h"
#include "zenoh-pico/collections/ring.h"

#ifdef __cplusplus
extern "C" {
#endif

/*-------- Fifo Buffer --------*/
typedef struct {
_z_ring_t _ring;
Expand Down Expand Up @@ -60,4 +64,8 @@ void _z_fifo_free(_z_fifo_t **xs, z_element_free_f f_f);
static inline void name##_fifo_clear(name##_fifo_t *r) { _z_fifo_clear(r, name##_elem_free); } \
static inline void name##_fifo_free(name##_fifo_t **r) { _z_fifo_free(r, name##_elem_free); }

#ifdef __cplusplus
}
#endif

#endif /* ZENOH_PICO_COLLECTIONS_FIFO_H */
8 changes: 8 additions & 0 deletions include/zenoh-pico/collections/intmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#include "zenoh-pico/collections/list.h"
#include "zenoh-pico/utils/result.h"

#ifdef __cplusplus
extern "C" {
#endif

/*-------- int-void map --------*/
#define _Z_DEFAULT_INT_MAP_CAPACITY 16

Expand Down Expand Up @@ -113,4 +117,8 @@ void _z_int_void_map_free(_z_int_void_map_t **map, z_element_free_f f);
_z_int_void_map_free(m, name##_intmap_entry_elem_free); \
}

#ifdef __cplusplus
}
#endif

#endif /* ZENOH_PICO_COLLECTIONS_INTMAP_H */
8 changes: 8 additions & 0 deletions include/zenoh-pico/collections/lifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

#include "zenoh-pico/collections/element.h"

#ifdef __cplusplus
extern "C" {
#endif

/*-------- Ring Buffer --------*/
typedef struct {
void **_val;
Expand Down Expand Up @@ -61,4 +65,8 @@ void _z_lifo_free(_z_lifo_t **xs, z_element_free_f f_f);
static inline void name##_lifo_clear(name##_lifo_t *r) { _z_lifo_clear(r, name##_elem_free); } \
static inline void name##_lifo_free(name##_lifo_t **r) { _z_lifo_free(r, name##_elem_free); }

#ifdef __cplusplus
}
#endif

#endif /* ZENOH_PICO_COLLECTIONS_LIFO_H */
8 changes: 8 additions & 0 deletions include/zenoh-pico/collections/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

#include "zenoh-pico/collections/element.h"

#ifdef __cplusplus
extern "C" {
#endif

/*-------- Single-linked List --------*/
/**
* A single-linked list.
Expand Down Expand Up @@ -72,4 +76,8 @@ void _z_list_free(_z_list_t **xs, z_element_free_f f_f);
static inline name##_list_t *name##_list_clone(name##_list_t *l) { return _z_list_clone(l, name##_elem_clone); } \
static inline void name##_list_free(name##_list_t **l) { _z_list_free(l, name##_elem_free); }

#ifdef __cplusplus
}
#endif

#endif /* ZENOH_PICO_COLLECTIONS_LIST_H */
8 changes: 8 additions & 0 deletions include/zenoh-pico/collections/ring.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

#include "zenoh-pico/collections/element.h"

#ifdef __cplusplus
extern "C" {
#endif

/*-------- Ring Buffer --------*/
typedef struct {
void **_val;
Expand Down Expand Up @@ -65,4 +69,8 @@ void _z_ring_free(_z_ring_t **xs, z_element_free_f f_f);
static inline void name##_ring_clear(name##_ring_t *r) { _z_ring_clear(r, name##_elem_free); } \
static inline void name##_ring_free(name##_ring_t **r) { _z_ring_free(r, name##_elem_free); }

#ifdef __cplusplus
}
#endif

#endif /* ZENOH_PICO_COLLECTIONS_RING_H */
8 changes: 8 additions & 0 deletions include/zenoh-pico/collections/slice.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

#include "zenoh-pico/utils/result.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
void (*deleter)(void *data, void *context);
void *context;
Expand Down Expand Up @@ -67,4 +71,8 @@ void _z_slice_clear(_z_slice_t *bs);
void _z_slice_free(_z_slice_t **bs);
bool _z_slice_is_alloced(const _z_slice_t *s);

#ifdef __cplusplus
}
#endif

#endif /* ZENOH_PICO_COLLECTIONS_SLICE_H */
8 changes: 8 additions & 0 deletions include/zenoh-pico/collections/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#include "zenoh-pico/collections/slice.h"
#include "zenoh-pico/collections/vec.h"

#ifdef __cplusplus
extern "C" {
#endif

/*-------- str --------*/
typedef char *_z_str_t;

Expand Down Expand Up @@ -100,4 +104,8 @@ _Z_SVEC_DEFINE(_z_string, _z_string_t)
_Z_LIST_DEFINE(_z_string, _z_string_t)
_Z_INT_MAP_DEFINE(_z_string, _z_string_t)

#ifdef __cplusplus
}
#endif

#endif /* ZENOH_PICO_COLLECTIONS_STRING_H */
8 changes: 8 additions & 0 deletions include/zenoh-pico/collections/vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

#include "zenoh-pico/collections/element.h"

#ifdef __cplusplus
extern "C" {
#endif

/*-------- Dynamically allocated vector --------*/
/**
* A dynamically allocated vector. Elements are stored as pointers.
Expand Down Expand Up @@ -114,4 +118,8 @@ void _z_svec_release(_z_svec_t *v);
static inline void name##_svec_clear(name##_svec_t *v) { _z_svec_clear(v, name##_elem_clear, sizeof(type)); } \
static inline void name##_svec_free(name##_svec_t **v) { _z_svec_free(v, name##_elem_clear, sizeof(type)); }

#ifdef __cplusplus
}
#endif

#endif /* ZENOH_PICO_COLLECTIONS_VECTOR_H */
8 changes: 8 additions & 0 deletions include/zenoh-pico/link/config/bt.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#include "zenoh-pico/config.h"
#include "zenoh-pico/system/platform.h"

#ifdef __cplusplus
extern "C" {
#endif

#if Z_FEATURE_LINK_BLUETOOTH == 1

#define BT_CONFIG_ARGC 3
Expand Down Expand Up @@ -50,4 +54,8 @@ z_result_t _z_bt_config_from_str(_z_str_intmap_t *strint, const char *s);
z_result_t _z_bt_config_from_strn(_z_str_intmap_t *strint, const char *s, size_t n);
#endif

#ifdef __cplusplus
}
#endif

#endif /* ZENOH_PICO_LINK_CONFIG_BT_H */
8 changes: 8 additions & 0 deletions include/zenoh-pico/link/config/raweth.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#include "zenoh-pico/config.h"
#include "zenoh-pico/link/link.h"

#ifdef __cplusplus
extern "C" {
#endif

#define RAWETH_SCHEMA "reth"

z_result_t _z_endpoint_raweth_valid(_z_endpoint_t *endpoint);
Expand All @@ -29,4 +33,8 @@ char *_z_raweth_config_to_str(const _z_str_intmap_t *s);
z_result_t _z_raweth_config_from_strn(_z_str_intmap_t *strint, const char *s, size_t n);
z_result_t _z_raweth_config_from_str(_z_str_intmap_t *strint, const char *s);

#ifdef __cplusplus
}
#endif

#endif /* ZENOH_PICO_LINK_CONFIG_RAWETH_H */
8 changes: 8 additions & 0 deletions include/zenoh-pico/link/config/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#include "zenoh-pico/config.h"
#include "zenoh-pico/system/platform.h"

#ifdef __cplusplus
extern "C" {
#endif

#if Z_FEATURE_LINK_SERIAL == 1

#define SERIAL_CONFIG_ARGC 1
Expand Down Expand Up @@ -66,4 +70,8 @@ z_result_t _z_serial_config_from_str(_z_str_intmap_t *strint, const char *s);
z_result_t _z_serial_config_from_strn(_z_str_intmap_t *strint, const char *s, size_t n);
#endif

#ifdef __cplusplus
}
#endif

#endif /* ZENOH_PICO_LINK_CONFIG_SERIAL_H */
8 changes: 8 additions & 0 deletions include/zenoh-pico/link/config/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#include "zenoh-pico/collections/string.h"
#include "zenoh-pico/config.h"

#ifdef __cplusplus
extern "C" {
#endif

#if Z_FEATURE_LINK_TCP == 1

#define TCP_CONFIG_ARGC 1
Expand All @@ -40,4 +44,8 @@ z_result_t _z_tcp_config_from_str(_z_str_intmap_t *strint, const char *s);
z_result_t _z_tcp_config_from_strn(_z_str_intmap_t *strint, const char *s, size_t n);
#endif

#ifdef __cplusplus
}
#endif

#endif /* ZENOH_PICO_LINK_CONFIG_TCP_H */
8 changes: 8 additions & 0 deletions include/zenoh-pico/link/config/udp.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
#include "zenoh-pico/collections/intmap.h"
#include "zenoh-pico/collections/string.h"

#ifdef __cplusplus
extern "C" {
#endif

#define UDP_CONFIG_ARGC 3

#define UDP_CONFIG_IFACE_KEY 0x01
Expand Down Expand Up @@ -48,4 +52,8 @@ z_result_t _z_udp_config_from_str(_z_str_intmap_t *strint, const char *s);
z_result_t _z_udp_config_from_strn(_z_str_intmap_t *strint, const char *s, size_t n);
#endif

#ifdef __cplusplus
}
#endif

#endif /* ZENOH_PICO_LINK_CONFIG_UDP_H */
8 changes: 8 additions & 0 deletions include/zenoh-pico/link/config/ws.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#include "zenoh-pico/collections/string.h"
#include "zenoh-pico/config.h"

#ifdef __cplusplus
extern "C" {
#endif

#if Z_FEATURE_LINK_WS == 1

#define WS_CONFIG_TOUT_KEY 0x01
Expand All @@ -39,4 +43,8 @@ z_result_t _z_ws_config_from_str(_z_str_intmap_t *strint, const char *s);
z_result_t _z_ws_config_from_strn(_z_str_intmap_t *strint, const char *s, size_t n);
#endif

#ifdef __cplusplus
}
#endif

#endif /* ZENOH_PICO_LINK_CONFIG_WS_H */
8 changes: 8 additions & 0 deletions include/zenoh-pico/link/endpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#include "zenoh-pico/collections/string.h"
#include "zenoh-pico/utils/result.h"

#ifdef __cplusplus
extern "C" {
#endif

/*------------------ Locator ------------------*/
#if Z_FEATURE_LINK_TCP == 1
#define TCP_SCHEMA "tcp"
Expand Down Expand Up @@ -72,4 +76,8 @@ z_result_t _z_endpoint_from_string(_z_endpoint_t *ep, _z_string_t *s);
void _z_endpoint_clear(_z_endpoint_t *ep);
void _z_endpoint_free(_z_endpoint_t **ep);

#ifdef __cplusplus
}
#endif

#endif /* ZENOH_PICO_LINK_ENDPOINT_H */
8 changes: 8 additions & 0 deletions include/zenoh-pico/link/link.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@

#include "zenoh-pico/utils/result.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* Link transport capability enum.
*
Expand Down Expand Up @@ -144,4 +148,8 @@ z_result_t _z_link_send_wbuf(const _z_link_t *zl, const _z_wbuf_t *wbf);
size_t _z_link_recv_zbuf(const _z_link_t *zl, _z_zbuf_t *zbf, _z_slice_t *addr);
size_t _z_link_recv_exact_zbuf(const _z_link_t *zl, _z_zbuf_t *zbf, size_t len, _z_slice_t *addr);

#ifdef __cplusplus
}
#endif

#endif /* ZENOH_PICO_LINK_H */
Loading
Loading