From: ppisa Date: Tue, 20 Oct 2009 09:55:29 +0000 (+0000) Subject: Add possibility to specify GAVL, GSA and HTIMER generated symbols scope. X-Git-Tag: ul_drv-0.8.0-release~9 X-Git-Url: https://rtime.felk.cvut.cz/gitweb/ulut.git/commitdiff_plain/ff879fd5a3259f7887952690af661e43b56affc3 Add possibility to specify GAVL, GSA and HTIMER generated symbols scope. This allows to GSA_CUST_DEC_SCOPE declaration macro variant where the first argument can select static scope or explicit functions visibility UL_ATTR_UNUSED static UL_EXPORT UL_DLLLOCAL UL_DLLPUBLIC The DLL symbol visibility macros are defined in ul_udexport.h header file. Same GAVL, GSA and HTIMER implementation macro is used as for case of declaration with default functions scope. --- diff --git a/ulut/ul_gavl.h b/ulut/ul_gavl.h index 5ce7f53..926c69f 100644 --- a/ulut/ul_gavl.h +++ b/ulut/ul_gavl.h @@ -412,7 +412,7 @@ typedef struct{ 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 * \ @@ -423,16 +423,16 @@ static inline cust_key_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){\ @@ -476,6 +476,11 @@ cust_prefix##_cut_first(cust_root_t *root)\ /*** 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)) diff --git a/ulut/ul_gavlflesint.h b/ulut/ul_gavlflesint.h index 83a9403..7eef3b4 100644 --- a/ulut/ul_gavlflesint.h +++ b/ulut/ul_gavlflesint.h @@ -32,7 +32,7 @@ extern "C" { #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 * \ @@ -43,15 +43,15 @@ static inline cust_key_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){\ @@ -99,6 +99,10 @@ cust_prefix##_is_empty(const cust_root_t *root)\ /*** 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 diff --git a/ulut/ul_gsa.h b/ulut/ul_gsa.h index 64f0309..cc8a069 100644 --- a/ulut/ul_gsa.h +++ b/ulut/ul_gsa.h @@ -153,7 +153,7 @@ void gsa_cust_delete_all(gsa_array_field_t *array); 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 * \ @@ -167,7 +167,7 @@ static inline cust_key_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)\ @@ -316,23 +316,28 @@ cust_prefix##_find_after_it(cust_array_t *container, cust_key_t const *key, cust } /* 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)\ @@ -372,20 +377,25 @@ static inline void \ 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)\ @@ -407,8 +417,12 @@ static inline void \ 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 */ diff --git a/ulut/ul_htimer.h b/ulut/ul_htimer.h index 394f7e5..df46814 100644 --- a/ulut/ul_htimer.h +++ b/ulut/ul_htimer.h @@ -115,12 +115,12 @@ ul_htim_queue_inline_first(ul_htim_queue_t *queue, ul_htim_node_t **phtim) } #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); \ @@ -148,6 +148,11 @@ cust_prefix##_get_expire(cust_timer_t *timer){\ 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) \ \