diff options
| author | Tyge Løvset <[email protected]> | 2021-09-12 23:04:33 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-09-12 23:04:33 +0200 |
| commit | fa2871406affad4d96a54554f80c7418a716b98c (patch) | |
| tree | 8062af12ca689538ee8d6882c6f06bdb05e29a1f /include | |
| parent | 1a9020f895754f564e480ba9ed564c637f26060e (diff) | |
| download | STC-modified-fa2871406affad4d96a54554f80c7418a716b98c.tar.gz STC-modified-fa2871406affad4d96a54554f80c7418a716b98c.zip | |
Renamed input macro i_module to i_prefix. Replaced astar.c example.
Now supports that user defines i_prefix.
Diffstat (limited to 'include')
| -rw-r--r-- | include/stc/cdeq.h | 4 | ||||
| -rw-r--r-- | include/stc/clist.h | 4 | ||||
| -rw-r--r-- | include/stc/cmap.h | 4 | ||||
| -rw-r--r-- | include/stc/cpque.h | 7 | ||||
| -rw-r--r-- | include/stc/cqueue.h | 4 | ||||
| -rw-r--r-- | include/stc/cset.h | 4 | ||||
| -rw-r--r-- | include/stc/csmap.h | 4 | ||||
| -rw-r--r-- | include/stc/csset.h | 4 | ||||
| -rw-r--r-- | include/stc/cstack.h | 6 | ||||
| -rw-r--r-- | include/stc/cvec.h | 4 | ||||
| -rw-r--r-- | include/stc/template.h | 4 |
11 files changed, 32 insertions, 17 deletions
diff --git a/include/stc/cdeq.h b/include/stc/cdeq.h index c6993427..21a6ece8 100644 --- a/include/stc/cdeq.h +++ b/include/stc/cdeq.h @@ -31,8 +31,8 @@ struct cdeq_rep { size_t size, cap; void* base[]; }; #define cdeq_rep_(self) c_container_of((self)->_base, struct cdeq_rep, base)
#endif // CDEQ_H_INCLUDED
-#ifndef i_module
-#define i_module cdeq
+#ifndef i_prefix
+#define i_prefix cdeq_
#endif
#include "template.h"
diff --git a/include/stc/clist.h b/include/stc/clist.h index 685601c4..bf96076c 100644 --- a/include/stc/clist.h +++ b/include/stc/clist.h @@ -81,7 +81,9 @@ _c_clist_complete_types(clist_VOID, dummy); #endif // CLIST_H_INCLUDED
-#define i_module clist
+#ifndef i_prefix
+#define i_prefix clist_
+#endif
#include "template.h"
#if !defined i_fwd
diff --git a/include/stc/cmap.h b/include/stc/cmap.h index a03d5c83..36417bc9 100644 --- a/include/stc/cmap.h +++ b/include/stc/cmap.h @@ -59,8 +59,8 @@ int main(void) { typedef struct { size_t idx; uint_fast8_t hx; } chash_bucket_t;
#endif // CMAP_H_INCLUDED
-#ifndef i_module
-#define i_module cmap
+#ifndef i_prefix
+#define i_prefix cmap_
#define cx_MAP_ONLY c_true
#define cx_SET_ONLY c_false
#define cx_keyref(vp) (&(vp)->first)
diff --git a/include/stc/cpque.h b/include/stc/cpque.h index 4f7e0003..e8f9c471 100644 --- a/include/stc/cpque.h +++ b/include/stc/cpque.h @@ -28,7 +28,10 @@ #include "forward.h"
#endif
-#define i_module cpque
+#ifndef i_prefix
+#define i_prefix cpque_
+#endif
+
#include "template.h"
#if !defined i_fwd
@@ -43,7 +46,7 @@ STC_API void cx_memb(_emplace_items)(Self *self, const cx_rawvalue_t arr[], size STC_API Self cx_memb(_clone)(Self q);
STC_INLINE Self cx_memb(_init)(void)
- { return (Self){0, 0, 0}; }
+ { return c_make(Self){0, 0, 0}; }
STC_INLINE Self cx_memb(_with_capacity)(size_t cap) {
Self out = {(cx_value_t *) c_malloc(cap*sizeof(cx_value_t)), 0, cap};
diff --git a/include/stc/cqueue.h b/include/stc/cqueue.h index 454913c1..f1d173e2 100644 --- a/include/stc/cqueue.h +++ b/include/stc/cqueue.h @@ -53,7 +53,9 @@ int main() { }
*/
-#define i_module cqueue
+#ifndef i_prefix
+#define i_prefix cqueue_
+#endif
#define i_queue
#define _push_back _push
#define _pop_front _pop
diff --git a/include/stc/cset.h b/include/stc/cset.h index ffdbca0d..2861ce89 100644 --- a/include/stc/cset.h +++ b/include/stc/cset.h @@ -39,7 +39,9 @@ int main(void) { }
*/
-#define i_module cset
+#ifndef i_prefix
+#define i_prefix cset_
+#endif
#define cx_MAP_ONLY c_false
#define cx_SET_ONLY c_true
#define cx_keyref(vp) (vp)
diff --git a/include/stc/csmap.h b/include/stc/csmap.h index 46408399..bae2ea96 100644 --- a/include/stc/csmap.h +++ b/include/stc/csmap.h @@ -59,8 +59,8 @@ struct csmap_rep { size_t root, disp, head, size, cap; void* nodes[]; }; #define _csmap_rep(self) c_container_of((self)->nodes, struct csmap_rep, nodes)
#endif // CSMAP_H_INCLUDED
-#ifndef i_module
-#define i_module csmap
+#ifndef i_prefix
+#define i_prefix csmap_
#define cx_MAP_ONLY c_true
#define cx_SET_ONLY c_false
#define cx_keyref(vp) (&(vp)->first)
diff --git a/include/stc/csset.h b/include/stc/csset.h index 44fbfa54..19cf147c 100644 --- a/include/stc/csset.h +++ b/include/stc/csset.h @@ -42,7 +42,9 @@ int main(void) { }
*/
-#define i_module csset
+#ifndef i_prefix
+#define i_prefix csset_
+#endif
#define cx_MAP_ONLY c_false
#define cx_SET_ONLY c_true
#define cx_keyref(vp) (vp)
diff --git a/include/stc/cstack.h b/include/stc/cstack.h index c0d89c78..043fbdc6 100644 --- a/include/stc/cstack.h +++ b/include/stc/cstack.h @@ -28,7 +28,9 @@ #include "forward.h"
#endif
-#define i_module cstack
+#ifndef i_prefix
+#define i_prefix cstack_
+#endif
#include "template.h"
#if !defined i_fwd
@@ -37,7 +39,7 @@ cx_deftypes(_c_cstack_types, Self, i_val); typedef i_valraw cx_rawvalue_t;
STC_INLINE Self cx_memb(_init)(void)
- { return (Self){0, 0, 0}; }
+ { return c_make(Self){0, 0, 0}; }
STC_INLINE Self cx_memb(_with_capacity)(size_t cap) {
Self out = {(cx_value_t *) c_malloc(cap*sizeof(cx_value_t)), 0, cap};
diff --git a/include/stc/cvec.h b/include/stc/cvec.h index f9f62439..8d379b6e 100644 --- a/include/stc/cvec.h +++ b/include/stc/cvec.h @@ -67,7 +67,9 @@ struct cvec_rep { size_t size, cap; void* data[]; }; #define cvec_rep_(self) c_container_of((self)->data, struct cvec_rep, data)
#endif // CVEC_H_INCLUDED
-#define i_module cvec
+#ifndef i_prefix
+#define i_prefix cvec_
+#endif
#include "template.h"
#if !defined i_fwd
diff --git a/include/stc/template.h b/include/stc/template.h index 9e183858..062f6939 100644 --- a/include/stc/template.h +++ b/include/stc/template.h @@ -26,7 +26,7 @@ #ifndef STC_TEMPLATE_H_INCLUDED
#define STC_TEMPLATE_H_INCLUDED
#define cx_memb(name) c_PASTE(Self, name)
- #define Self c_PASTE3(i_module, _, i_tag)
+ #define Self c_PASTE(i_prefix, i_tag)
// typedef container types defined in forward.h. VC requires c_EXPAND.
#define cx_deftypes(macro, SELF, ...) c_EXPAND(macro(SELF, __VA_ARGS__))
@@ -128,7 +128,7 @@ #else // -------------------------------------------------------
-#undef i_module
+#undef i_prefix
#undef i_tag
#undef f_tag
#undef i_imp
|
