int cust_cmp_fnc(cust_key_t *a, cust_key_t *b) */
/* Declaration of new custom tree with internal node */
-#define GAVL_CUST_NODE_INT_DEC(cust_prefix, cust_root_t, cust_item_t, cust_key_t,\
+#define GAVL_CUST_NODE_INT_DEC_SCOPE(cust_scope, cust_prefix, cust_root_t, cust_item_t, cust_key_t,\
cust_root_node, cust_item_node, cust_item_key, cust_cmp_fnc) \
\
static inline cust_item_t * \
cust_prefix##_node2key(const cust_root_t *root, gavl_node_t *node)\
{ return &(cust_prefix##_node2item(root, node)->cust_item_key);}\
\
-void cust_prefix##_init_root_field(cust_root_t *root);\
-int cust_prefix##_search_node(const cust_root_t *root, cust_key_t const *key, gavl_node_t **nodep);\
-cust_item_t *cust_prefix##_find(const cust_root_t *root, cust_key_t const *key);\
-cust_item_t *cust_prefix##_find_first(const cust_root_t *root, cust_key_t const *key);\
-cust_item_t *cust_prefix##_find_after(const cust_root_t *root, cust_key_t const *key);\
-int cust_prefix##_insert(cust_root_t *root, cust_item_t *item);\
-int cust_prefix##_delete_node(cust_root_t *root, gavl_node_t *node);\
-int cust_prefix##_delete(cust_root_t *root, cust_item_t *item);\
-gavl_node_t *cust_prefix##_first_node(const cust_root_t *root);\
-gavl_node_t *cust_prefix##_last_node(const cust_root_t *root);\
+cust_scope void cust_prefix##_init_root_field(cust_root_t *root);\
+cust_scope int cust_prefix##_search_node(const cust_root_t *root, cust_key_t const *key, gavl_node_t **nodep);\
+cust_scope cust_item_t *cust_prefix##_find(const cust_root_t *root, cust_key_t const *key);\
+cust_scope cust_item_t *cust_prefix##_find_first(const cust_root_t *root, cust_key_t const *key);\
+cust_scope cust_item_t *cust_prefix##_find_after(const cust_root_t *root, cust_key_t const *key);\
+cust_scope int cust_prefix##_insert(cust_root_t *root, cust_item_t *item);\
+cust_scope int cust_prefix##_delete_node(cust_root_t *root, gavl_node_t *node);\
+cust_scope int cust_prefix##_delete(cust_root_t *root, cust_item_t *item);\
+cust_scope gavl_node_t *cust_prefix##_first_node(const cust_root_t *root);\
+cust_scope gavl_node_t *cust_prefix##_last_node(const cust_root_t *root);\
\
static inline void \
cust_prefix##_init_detached(cust_item_t *item){\
/*** Iterators ***/\
UL_ITBASE_SORT_DEC(cust_prefix, cust_root_t, cust_item_t, cust_key_t)
+#define GAVL_CUST_NODE_INT_DEC(cust_prefix, cust_root_t, cust_item_t, cust_key_t,\
+ cust_root_node, cust_item_node, cust_item_key, cust_cmp_fnc) \
+ GAVL_CUST_NODE_INT_DEC_SCOPE(extern, cust_prefix, cust_root_t, cust_item_t, cust_key_t,\
+ cust_root_node, cust_item_node, cust_item_key, cust_cmp_fnc)
+
#define gavl_cust_for_each(cust_prefix, root, ptr) \
for(ptr=cust_prefix##_first(root);ptr;ptr=cust_prefix##_next((root),ptr))
#endif
/* Declaration of tree with first/last enhanced speed functions with internal node */
-#define GAVL_FLES_INT_DEC(cust_prefix, cust_root_t, cust_item_t, cust_key_t,\
+#define GAVL_FLES_INT_DEC_SCOPE(cust_scope, cust_prefix, cust_root_t, cust_item_t, cust_key_t,\
cust_root_field, cust_item_node, cust_item_key, cust_cmp_fnc) \
\
static inline cust_item_t * \
cust_prefix##_node2key(const cust_root_t *root, gavl_node_t *node)\
{ return &(cust_prefix##_node2item(root, node)->cust_item_key);}\
\
-void cust_prefix##_init_root_field(cust_root_t *root);\
-int cust_prefix##_search_node(const cust_root_t *root, cust_key_t const *key, gavl_node_t **nodep);\
-cust_item_t *cust_prefix##_find(const cust_root_t *root, cust_key_t const *key);\
-cust_item_t *cust_prefix##_find_first(const cust_root_t *root, cust_key_t const *key);\
-cust_item_t *cust_prefix##_find_after(const cust_root_t *root, cust_key_t const *key);\
-int cust_prefix##_insert(cust_root_t *root, cust_item_t *item);\
-cust_item_t *cust_prefix##_cut_first(cust_root_t *root);\
-int cust_prefix##_delete_node(cust_root_t *root, gavl_node_t *node);\
-int cust_prefix##_delete(cust_root_t *root, cust_item_t *item);\
+cust_scope void cust_prefix##_init_root_field(cust_root_t *root);\
+cust_scope int cust_prefix##_search_node(const cust_root_t *root, cust_key_t const *key, gavl_node_t **nodep);\
+cust_scope cust_item_t *cust_prefix##_find(const cust_root_t *root, cust_key_t const *key);\
+cust_scope cust_item_t *cust_prefix##_find_first(const cust_root_t *root, cust_key_t const *key);\
+cust_scope cust_item_t *cust_prefix##_find_after(const cust_root_t *root, cust_key_t const *key);\
+cust_scope int cust_prefix##_insert(cust_root_t *root, cust_item_t *item);\
+cust_scope cust_item_t *cust_prefix##_cut_first(cust_root_t *root);\
+cust_scope int cust_prefix##_delete_node(cust_root_t *root, gavl_node_t *node);\
+cust_scope int cust_prefix##_delete(cust_root_t *root, cust_item_t *item);\
\
static inline void \
cust_prefix##_init_detached(cust_item_t *item){\
/*** Iterators ***/\
UL_ITBASE_SORT_DEC(cust_prefix, cust_root_t, cust_item_t, cust_key_t)
+#define GAVL_FLES_INT_DEC(cust_prefix, cust_root_t, cust_item_t, cust_key_t,\
+ cust_root_field, cust_item_node, cust_item_key, cust_cmp_fnc) \
+ GAVL_FLES_INT_DEC_SCOPE(extern, cust_prefix, cust_root_t, cust_item_t, cust_key_t,\
+ cust_root_field, cust_item_node, cust_item_key, cust_cmp_fnc)
/**
* GAVL_FLES_INT_IMP - Implementation of new custom tree with fast first/last functions
int cust_cmp_fnc(cust_key_t *a, cust_key_t *b) */
/*** Base declaration of custom GSA array ***/
-#define GSA_BASE_CUST_DEC(cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
+#define GSA_BASE_CUST_DEC_SCOPE(cust_scope, cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
cust_array_field, cust_item_key, cust_cmp_fnc) \
\
static inline cust_item_t * \
cust_prefix##_indx2key(const cust_array_t *array, unsigned indx)\
{ return &(cust_prefix##_indx2item(array, indx)->cust_item_key);}\
\
-int cust_prefix##_bsearch_indx(const cust_array_t *array, cust_key_t const *key, int mode, unsigned *indxp);\
+cust_scope int cust_prefix##_bsearch_indx(const cust_array_t *array, cust_key_t const *key, int mode, unsigned *indxp);\
\
static inline cust_item_t *\
cust_prefix##_at(const cust_array_t *array, unsigned indx)\
}
/* Declaration of new const custom array without support of runtime modifications */
-#define GSA_CONST_CUST_DEC(cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
+#define GSA_CONST_CUST_DEC_SCOPE(cust_scope, cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
cust_array_field, cust_item_key, cust_cmp_fnc) \
\
-GSA_BASE_CUST_DEC(cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
+GSA_BASE_CUST_DEC_SCOPE(cust_scope, cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
cust_array_field, cust_item_key, cust_cmp_fnc) \
\
GSA_IT_CUST_DEC(cust_prefix, const cust_array_t, cust_item_t, cust_key_t)
+#define GSA_CONST_CUST_DEC(cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
+ cust_array_field, cust_item_key, cust_cmp_fnc) \
+ GSA_CONST_CUST_DEC_SCOPE(extern, cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
+ cust_array_field, cust_item_key, cust_cmp_fnc)
+
/*** Declaration of dynamic custom array with full functions ***/
-#define GSA_CUST_DEC(cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
+#define GSA_CUST_DEC_SCOPE(cust_scope, cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
cust_array_field, cust_item_key, cust_cmp_fnc) \
\
-GSA_BASE_CUST_DEC(cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
+GSA_BASE_CUST_DEC_SCOPE(cust_scope, cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
cust_array_field, cust_item_key, cust_cmp_fnc) \
\
-int cust_prefix##_insert(cust_array_t *array, cust_item_t *item);\
-int cust_prefix##_delete(cust_array_t *array, const cust_item_t *item);\
+cust_scope int cust_prefix##_insert(cust_array_t *array, cust_item_t *item);\
+cust_scope int cust_prefix##_delete(cust_array_t *array, const cust_item_t *item);\
\
static inline void \
cust_prefix##_init_array_field(cust_array_t *array)\
cust_prefix##_delete_it(cust_prefix##_it_t *it)\
{\
cust_prefix##_delete_at(it->container,it->indx);\
-}\
+}
+
+#define GSA_CUST_DEC(cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
+ cust_array_field, cust_item_key, cust_cmp_fnc) \
+ GSA_CUST_DEC_SCOPE(extern, cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
+ cust_array_field, cust_item_key, cust_cmp_fnc) \
/*** Declaration of static custom array with limited functions ***/
-#define GSA_STATIC_CUST_DEC(cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
+#define GSA_STATIC_CUST_DEC_SCOPE(cust_scope, cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
cust_array_field, cust_item_key, cust_cmp_fnc) \
\
-GSA_BASE_CUST_DEC(cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
+GSA_BASE_CUST_DEC_SCOPE(cust_scope, cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
cust_array_field, cust_item_key, cust_cmp_fnc) \
\
-int cust_prefix##_insert(cust_array_t *array, cust_item_t *item);\
-int cust_prefix##_delete(cust_array_t *array, const cust_item_t *item);\
-void cust_prefix##_init_array_field(cust_array_t *array);\
-int cust_prefix##_insert_at(cust_array_t *array, cust_item_t *item, unsigned indx);\
-int cust_prefix##_delete_at(cust_array_t *array, unsigned indx); \
+cust_scope int cust_prefix##_insert(cust_array_t *array, cust_item_t *item);\
+cust_scope int cust_prefix##_delete(cust_array_t *array, const cust_item_t *item);\
+cust_scope void cust_prefix##_init_array_field(cust_array_t *array);\
+cust_scope int cust_prefix##_insert_at(cust_array_t *array, cust_item_t *item, unsigned indx);\
+cust_scope int cust_prefix##_delete_at(cust_array_t *array, unsigned indx); \
\
static inline void \
cust_prefix##_delete_all(cust_array_t *array)\
cust_prefix##_delete_it(cust_prefix##_it_t *it)\
{\
cust_prefix##_delete_at(it->container,it->indx);\
-}\
+}
+#define GSA_STATIC_CUST_DEC(cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
+ cust_array_field, cust_item_key, cust_cmp_fnc) \
+ GSA_STATIC_CUST_DEC_SCOPE(extern, cust_prefix, cust_array_t, cust_item_t, cust_key_t,\
+ cust_array_field, cust_item_key, cust_cmp_fnc)
/* The next implementation of foreaach is elegant, but can not
be used in C99 non-conformant C compiler */
}
#endif /*UL_HTIMER_WITH_HPTREE*/
-#define UL_HTIMER_DEC(cust_prefix, cust_queue_t, cust_timer_t, \
+#define UL_HTIMER_DEC_SCOPE(cust_scope, cust_prefix, cust_queue_t, cust_timer_t, \
cust_queue_field, cust_timer_field) \
\
-void cust_prefix##_init_queue(cust_queue_t *queue);\
-cust_timer_t *cust_prefix##_cut_expired(cust_queue_t *queue, ul_htim_time_t *act_time);\
-int cust_prefix##_next_expire(cust_queue_t *queue, ul_htim_time_t *act_time);\
+cust_scope void cust_prefix##_init_queue(cust_queue_t *queue);\
+cust_scope cust_timer_t *cust_prefix##_cut_expired(cust_queue_t *queue, ul_htim_time_t *act_time);\
+cust_scope int cust_prefix##_next_expire(cust_queue_t *queue, ul_htim_time_t *act_time);\
static inline int \
cust_prefix##_add(cust_queue_t *queue, cust_timer_t *timer){ \
return ul_htim_queue_insert(&queue->cust_queue_field, &timer->cust_timer_field); \
return timer->cust_timer_field.expires;\
}
+#define UL_HTIMER_DEC(cust_prefix, cust_queue_t, cust_timer_t, \
+ cust_queue_field, cust_timer_field) \
+ UL_HTIMER_DEC_SCOPE(extern, cust_prefix, cust_queue_t, cust_timer_t, \
+ cust_queue_field, cust_timer_field)
+
#define UL_HTIMER_IMP(cust_prefix, cust_queue_t, cust_timer_t, \
cust_queue_field, cust_timer_field) \
\