summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-05-20 00:40:54 +0200
committerTyge Løvset <[email protected]>2023-05-20 00:40:54 +0200
commitbb59d9c87f8d99f50c439351480c0ec8d6eea38e (patch)
treec8e273e7a63332ca37a5a15e9c81e534b8af7e44
parent26513bb1352ab4e4ffe931aabd80868216afc551 (diff)
downloadSTC-modified-bb59d9c87f8d99f50c439351480c0ec8d6eea38e.tar.gz
STC-modified-bb59d9c87f8d99f50c439351480c0ec8d6eea38e.zip
Rename c_make() macro to c_init(). c_make still available, but deprecated.
-rw-r--r--README.md4
-rw-r--r--docs/cbox_api.md2
-rw-r--r--docs/ccommon_api.md10
-rw-r--r--docs/clist_api.md8
-rw-r--r--docs/cmap_api.md2
-rw-r--r--docs/cset_api.md2
-rw-r--r--docs/csmap_api.md4
-rw-r--r--docs/cspan_api.md4
-rw-r--r--docs/csset_api.md2
-rw-r--r--include/stc/algo/filter.h2
-rw-r--r--include/stc/ccommon.h5
-rw-r--r--include/stc/cspan.h2
-rw-r--r--include/stc/cstack.h6
-rw-r--r--misc/examples/arcvec_erase.c2
-rw-r--r--misc/examples/cointerleave.c4
-rw-r--r--misc/examples/convert.c2
-rw-r--r--misc/examples/csmap_erase.c2
-rw-r--r--misc/examples/csmap_find.c2
-rw-r--r--misc/examples/csmap_insert.c2
-rw-r--r--misc/examples/csset_erase.c2
-rw-r--r--misc/examples/forfilter.c2
-rw-r--r--misc/examples/forloops.c4
-rw-r--r--misc/examples/inits.c6
-rw-r--r--misc/examples/list.c2
-rw-r--r--misc/examples/list_erase.c2
-rw-r--r--misc/examples/list_splice.c4
-rw-r--r--misc/examples/lower_bound.c4
-rw-r--r--misc/examples/multidim.c2
-rw-r--r--misc/examples/music_arc.c2
-rw-r--r--misc/examples/new_list.c4
-rw-r--r--misc/examples/new_map.c6
-rw-r--r--misc/examples/new_pque.c2
-rw-r--r--misc/examples/new_smap.c4
-rw-r--r--misc/examples/phonebook.c2
-rw-r--r--misc/examples/printspan.c8
-rw-r--r--misc/examples/scheduler.c2
36 files changed, 63 insertions, 62 deletions
diff --git a/README.md b/README.md
index 2ef371b5..d699e1d1 100644
--- a/README.md
+++ b/README.md
@@ -35,7 +35,7 @@ Algorithms
----------
- [***Ranged for-loops*** - c_foreach, c_forpair, c_forlist](docs/ccommon_api.md#ranged-for-loops)
- [***Range algorithms*** - c_forrange, crange, c_forfilter](docs/ccommon_api.md#range-algorithms)
-- [***Generic algorithms*** - c_make, c_find_if, c_erase_if, csort, etc.](docs/ccommon_api.md#generic-algorithms)
+- [***Generic algorithms*** - c_init, c_find_if, c_erase_if, csort, etc.](docs/ccommon_api.md#generic-algorithms)
- [***Coroutines*** - Simon Tatham's coroutines done right.](docs/ccommon_api.md#coroutines)
- [***Regular expressions*** - Rob Pike's Plan 9 regexp modernized!](docs/cregex_api.md)
- [***Random numbers*** - a very fast *PRNG* based on *SFC64*](docs/crandom_api.md)
@@ -117,7 +117,7 @@ Benchmark notes:
## Naming conventions
- Container names are prefixed by `c`, e.g. `cvec`, `cstr`.
-- Public STC macros are prefixed by `c_`, e.g. `c_foreach`, `c_make`.
+- Public STC macros are prefixed by `c_`, e.g. `c_foreach`, `c_init`.
- Template parameter macros are prefixed by `i_`, e.g. `i_val`, `i_type`.
- All containers can be initialized with `{0}`, i.e. no heap allocation used by default init.
- Common types for a container type Con:
diff --git a/docs/cbox_api.md b/docs/cbox_api.md
index ca4d90da..5914a5ad 100644
--- a/docs/cbox_api.md
+++ b/docs/cbox_api.md
@@ -92,7 +92,7 @@ void int_drop(int* x) {
int main()
{
- IVec vec = c_make(Vec, {2021, 2012, 2022, 2015});
+ IVec vec = c_init(Vec, {2021, 2012, 2022, 2015});
ISet set = {0};
c_defer(
IVec_drop(&vec),
diff --git a/docs/ccommon_api.md b/docs/ccommon_api.md
index eaf01996..56424989 100644
--- a/docs/ccommon_api.md
+++ b/docs/ccommon_api.md
@@ -18,7 +18,7 @@
#define i_tag ii
#include <stc/csmap.h>
...
-csmap_ii map = c_make(csmap_ii, { {23,1}, {3,2}, {7,3}, {5,4}, {12,5} });
+csmap_ii map = c_init(csmap_ii, { {23,1}, {3,2}, {7,3}, {5,4}, {12,5} });
c_foreach (i, csmap_ii, map)
printf(" %d", i.ref->first);
@@ -158,7 +158,7 @@ Note that `c_flt_take()` and `c_flt_takewhile()` breaks the loop on false.
---
## Generic algorithms
-### c_make, c_drop
+### c_init, c_drop
Make any container from an initializer list:
```c
@@ -170,11 +170,11 @@ Make any container from an initializer list:
#include <stc/cmap.h>
...
// Initializes with const char*, internally converted to cstr!
-cset_str myset = c_make(cset_str, {"This", "is", "the", "story"});
+cset_str myset = c_init(cset_str, {"This", "is", "the", "story"});
cset_str myset2 = c_clone(myset);
int x = 7, y = 8;
-cmap_int mymap = c_make(cmap_int, { {1, 2}, {3, 4}, {5, 6}, {x, y} });
+cmap_int mymap = c_init(cmap_int, { {1, 2}, {3, 4}, {5, 6}, {x, y} });
```
Drop multiple containers of the same type:
```c
@@ -232,7 +232,7 @@ possible and very fast. Note that `i_more` must be defined to pick up template p
#include <stdio.h>
int main() {
- MyDeq deq = c_make(MyDeq, {5, 3, 5, 9, 7, 4, 7, 2, 4, 9, 3, 1, 2, 6, 4});
+ MyDeq deq = c_init(MyDeq, {5, 3, 5, 9, 7, 4, 7, 2, 4, 9, 3, 1, 2, 6, 4});
MyDeq_sort_n(&deq, MyDeq_size(&deq));
c_foreach (i, MyDeq, deq) printf(" %d", *i.ref);
MyDeq_drop(&deq);
diff --git a/docs/clist_api.md b/docs/clist_api.md
index eb84fbd4..36935c88 100644
--- a/docs/clist_api.md
+++ b/docs/clist_api.md
@@ -124,7 +124,7 @@ Interleave *push_front()* / *push_back()* then *sort()*:
#include <stdio.h>
int main() {
- DList list = c_make(DList, {10., 20., 30., 40., 50., 60., 70., 80., 90.});
+ DList list = c_init(DList, {10., 20., 30., 40., 50., 60., 70., 80., 90.});
c_forrange (i, 1, 10) {
if (i & 1) DList_push_front(&list, (double) i);
@@ -162,7 +162,7 @@ Use of *erase_at()* and *erase_range()*:
int main ()
{
- clist_i L = c_make(clist_i, {10, 20, 30, 40, 50});
+ clist_i L = c_init(clist_i, {10, 20, 30, 40, 50});
// 10 20 30 40 50
clist_i_iter it = clist_i_begin(&L); // ^
clist_i_next(&it);
@@ -196,8 +196,8 @@ Splice `[30, 40]` from *L2* into *L1* before `3`:
#include <stdio.h>
int main() {
- clist_i L1 = c_make(clist_i, {1, 2, 3, 4, 5});
- clist_i L2 = c_make(clist_i, {10, 20, 30, 40, 50});
+ clist_i L1 = c_init(clist_i, {1, 2, 3, 4, 5});
+ clist_i L2 = c_init(clist_i, {10, 20, 30, 40, 50});
clist_i_iter i = clist_i_advance(clist_i_begin(&L1), 2);
clist_i_iter j1 = clist_i_advance(clist_i_begin(&L2), 2), j2 = clist_i_advance(j1, 2);
diff --git a/docs/cmap_api.md b/docs/cmap_api.md
index cdb57534..2c9ac8ed 100644
--- a/docs/cmap_api.md
+++ b/docs/cmap_api.md
@@ -123,7 +123,7 @@ bool c_memcmp_eq(const i_keyraw* a, const i_keyraw* b); // !
int main()
{
// Create an unordered_map of three strings (that map to strings)
- cmap_str umap = c_make(cmap_str, {
+ cmap_str umap = c_init(cmap_str, {
{"RED", "#FF0000"},
{"GREEN", "#00FF00"},
{"BLUE", "#0000FF"}
diff --git a/docs/cset_api.md b/docs/cset_api.md
index b9e8ae99..7243beb3 100644
--- a/docs/cset_api.md
+++ b/docs/cset_api.md
@@ -86,7 +86,7 @@ int main ()
{
Strset first, second={0}, third={0}, fourth={0}, fifth;
- first = c_make(Strset, {"red", "green", "blue"});
+ first = c_init(Strset, {"red", "green", "blue"});
fifth = Strset_clone(second);
c_forlist (i, const char*, {"orange", "pink", "yellow"})
diff --git a/docs/csmap_api.md b/docs/csmap_api.md
index 8c2048c0..b1bb07c6 100644
--- a/docs/csmap_api.md
+++ b/docs/csmap_api.md
@@ -111,7 +111,7 @@ void csmap_X_value_drop(csmap_X_value* pval);
int main()
{
// Create a sorted map of three strings (maps to string)
- csmap_str colors = c_make(csmap_str, {
+ csmap_str colors = c_init(csmap_str, {
{"RED", "#FF0000"},
{"GREEN", "#00FF00"},
{"BLUE", "#0000FF"}
@@ -192,7 +192,7 @@ This example uses a csmap with cstr as mapped value.
int main()
{
uint32_t col = 0xcc7744ff;
- IDSMap idnames = c_make(IDSMap, { {100, "Red"}, {110, "Blue"} });
+ IDSMap idnames = c_init(IDSMap, { {100, "Red"}, {110, "Blue"} });
// Assign/overwrite an existing mapped value with a const char*
IDSMap_emplace_or_assign(&idnames, 110, "White");
diff --git a/docs/cspan_api.md b/docs/cspan_api.md
index 10565b0f..ec203460 100644
--- a/docs/cspan_api.md
+++ b/docs/cspan_api.md
@@ -143,8 +143,8 @@ using_cspan3(Span, int); // Shorthand to define Span, Span2, and Span3
int main()
{
- // c_make() can create any STC container/span from an initializer list:
- Span span = c_make(Span, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ // c_init() can create any STC container/span from an initializer list:
+ Span span = c_init(Span, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24});
// create a 3d cspan:
Span3 span3 = cspan_md(span.data, 2, 4, 3);
diff --git a/docs/csset_api.md b/docs/csset_api.md
index d095696c..dafe6670 100644
--- a/docs/csset_api.md
+++ b/docs/csset_api.md
@@ -86,7 +86,7 @@ int main ()
{
SSet second={0}, third={0}, fourth={0}, fifth={0};
- second = c_make(SSet, {"red", "green", "blue"});
+ second = c_init(SSet, {"red", "green", "blue"});
c_forlist (i, const char*, {"orange", "pink", "yellow"})
SSet_emplace(&third, *i.ref);
diff --git a/include/stc/algo/filter.h b/include/stc/algo/filter.h
index fe733c64..8dc1ad74 100644
--- a/include/stc/algo/filter.h
+++ b/include/stc/algo/filter.h
@@ -28,7 +28,7 @@
int main()
{
- cstack_int stk = c_make(cstack_int, {1, 2, 3, 4, 5, 6, 7, 8, 9});
+ cstack_int stk = c_init(cstack_int, {1, 2, 3, 4, 5, 6, 7, 8, 9});
c_foreach (i, cstack_int, stk)
printf(" %d", *i.ref);
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h
index 07c72e2f..e9d97d4b 100644
--- a/include/stc/ccommon.h
+++ b/include/stc/ccommon.h
@@ -117,8 +117,9 @@
/* Function macros and others */
-#define c_make(C, ...) \
- C##_from_n((C##_raw[])__VA_ARGS__, c_sizeof((C##_raw[])__VA_ARGS__)/c_sizeof(C##_raw))
+#define c_init(C, ...) \
+ C##_from_n((C##_raw[])__VA_ARGS__, c_sizeof((C##_raw[])__VA_ARGS__)/c_sizeof(C##_raw))
+#define c_make(C, ...) c_init(C, __VA_ARGS__) // [deprecated]
#define c_litstrlen(literal) (c_sizeof("" literal) - 1)
#define c_arraylen(a) (intptr_t)(sizeof(a)/sizeof 0[a])
diff --git a/include/stc/cspan.h b/include/stc/cspan.h
index ac3e9206..b07e75a8 100644
--- a/include/stc/cspan.h
+++ b/include/stc/cspan.h
@@ -115,7 +115,7 @@ typedef struct { int32_t d[6]; } cspan_idx6;
#define cspan_md(array, ...) \
{.data=array, .shape={__VA_ARGS__}, .stride={.d={__VA_ARGS__}}}
-/* For static initialization, use cspan_make(). c_make() for non-static only. */
+/* For static initialization, use cspan_make(). c_init() for non-static only. */
#define cspan_make(SpanType, ...) \
{.data=(SpanType##_value[])__VA_ARGS__, .shape={sizeof((SpanType##_value[])__VA_ARGS__)/sizeof(SpanType##_value)}}
diff --git a/include/stc/cstack.h b/include/stc/cstack.h
index bee7d17b..eb6ccb58 100644
--- a/include/stc/cstack.h
+++ b/include/stc/cstack.h
@@ -175,12 +175,12 @@ STC_INLINE i_keyraw _cx_memb(_value_toraw)(const _cx_value* val)
#endif // !i_no_clone
STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self) {
- return c_LITERAL(_cx_iter){self->_len ? (_cx_value*)self->data : NULL,
- (_cx_value*)self->data + self->_len};
+ return c_LITERAL(_cx_iter){self->_len ? self->data : NULL,
+ self->data + self->_len};
}
STC_INLINE _cx_iter _cx_memb(_end)(const _cx_self* self)
- { return c_LITERAL(_cx_iter){NULL, (_cx_value*)self->data + self->_len}; }
+ { return c_LITERAL(_cx_iter){NULL, self->data + self->_len}; }
STC_INLINE void _cx_memb(_next)(_cx_iter* it)
{ if (++it->ref == it->end) it->ref = NULL; }
diff --git a/misc/examples/arcvec_erase.c b/misc/examples/arcvec_erase.c
index 3bf41559..28160c1c 100644
--- a/misc/examples/arcvec_erase.c
+++ b/misc/examples/arcvec_erase.c
@@ -15,7 +15,7 @@ void show_drop(int* x) { printf("drop: %d\n", *x); }
int main()
{
- Vec vec = c_make(Vec, {2012, 1990, 2012, 2019, 2015});
+ Vec vec = c_init(Vec, {2012, 1990, 2012, 2019, 2015});
// clone the second 2012 and push it back.
// note: cloning make sure that vec.data[2] has ref count 2.
diff --git a/misc/examples/cointerleave.c b/misc/examples/cointerleave.c
index aa57808e..e11b2bf3 100644
--- a/misc/examples/cointerleave.c
+++ b/misc/examples/cointerleave.c
@@ -38,8 +38,8 @@ void interleaved(struct Generator* g)
void Use(void)
{
- IVec a = c_make(IVec, {2, 4, 6, 8, 10, 11});
- IVec b = c_make(IVec, {3, 5, 7, 9});
+ IVec a = c_init(IVec, {2, 4, 6, 8, 10, 11});
+ IVec b = c_init(IVec, {3, 5, 7, 9});
struct Generator g = {{&a}, {&b}};
diff --git a/misc/examples/convert.c b/misc/examples/convert.c
index 138035e9..c5649c55 100644
--- a/misc/examples/convert.c
+++ b/misc/examples/convert.c
@@ -25,7 +25,7 @@ int main()
cvec_str_drop(&values),
clist_str_drop(&list)
){
- map = c_make(cmap_str, {
+ map = c_init(cmap_str, {
{"green", "#00ff00"},
{"blue", "#0000ff"},
{"yellow", "#ffff00"},
diff --git a/misc/examples/csmap_erase.c b/misc/examples/csmap_erase.c
index 697e6c09..568dae29 100644
--- a/misc/examples/csmap_erase.c
+++ b/misc/examples/csmap_erase.c
@@ -34,7 +34,7 @@ int main()
printmap(m1);
// Fill in some data to test with
- mymap m2 = c_make(mymap, {
+ mymap m2 = c_init(mymap, {
{10, "Bob"},
{11, "Rob"},
{12, "Robert"},
diff --git a/misc/examples/csmap_find.c b/misc/examples/csmap_find.c
index c417567a..92dd0031 100644
--- a/misc/examples/csmap_find.c
+++ b/misc/examples/csmap_find.c
@@ -42,7 +42,7 @@ void findit(csmap_istr c, csmap_istr_key val)
int main()
{
- csmap_istr m1 = c_make(csmap_istr, {{40, "Zr"}, {45, "Rh"}});
+ csmap_istr m1 = c_init(csmap_istr, {{40, "Zr"}, {45, "Rh"}});
cvec_istr v = {0};
puts("The starting map m1 is (key, value):");
diff --git a/misc/examples/csmap_insert.c b/misc/examples/csmap_insert.c
index 3da245c7..7708fdc9 100644
--- a/misc/examples/csmap_insert.c
+++ b/misc/examples/csmap_insert.c
@@ -96,7 +96,7 @@ int main()
csmap_ii m4 = {0};
// Insert the elements from an initializer_list
- m4 = c_make(csmap_ii, {{4, 44}, {2, 22}, {3, 33}, {1, 11}, {5, 55}});
+ m4 = c_init(csmap_ii, {{4, 44}, {2, 22}, {3, 33}, {1, 11}, {5, 55}});
puts("After initializer_list insertion, m4 contains:");
print_ii(m4);
puts("");
diff --git a/misc/examples/csset_erase.c b/misc/examples/csset_erase.c
index 9fa40682..5fe3fcba 100644
--- a/misc/examples/csset_erase.c
+++ b/misc/examples/csset_erase.c
@@ -5,7 +5,7 @@
int main()
{
- csset_int set = c_make(csset_int, {30, 20, 80, 40, 60, 90, 10, 70, 50});
+ csset_int set = c_init(csset_int, {30, 20, 80, 40, 60, 90, 10, 70, 50});
c_foreach (k, csset_int, set)
printf(" %d", *k.ref);
diff --git a/misc/examples/forfilter.c b/misc/examples/forfilter.c
index fbb7280f..8ea3e6a1 100644
--- a/misc/examples/forfilter.c
+++ b/misc/examples/forfilter.c
@@ -17,7 +17,7 @@
void demo1(void)
{
- IVec vec = c_make(IVec, {0, 1, 2, 3, 4, 5, 80, 6, 7, 80, 8, 9, 80,
+ IVec vec = c_init(IVec, {0, 1, 2, 3, 4, 5, 80, 6, 7, 80, 8, 9, 80,
10, 11, 12, 13, 14, 15, 80, 16, 17});
c_forfilter (i, IVec, vec, flt_skipValue(i, 80))
diff --git a/misc/examples/forloops.c b/misc/examples/forloops.c
index 1fc00614..337cfaa1 100644
--- a/misc/examples/forloops.c
+++ b/misc/examples/forloops.c
@@ -34,8 +34,8 @@ int main()
printf(" %s", *i.ref);
puts("");
- IVec vec = c_make(IVec, {12, 23, 453, 65, 113, 215, 676, 34, 67, 20, 27, 66, 189, 45, 280, 199});
- IMap map = c_make(IMap, {{12, 23}, {453, 65}, {676, 123}, {34, 67}});
+ IVec vec = c_init(IVec, {12, 23, 453, 65, 113, 215, 676, 34, 67, 20, 27, 66, 189, 45, 280, 199});
+ IMap map = c_init(IMap, {{12, 23}, {453, 65}, {676, 123}, {34, 67}});
puts("\n\nc_foreach:");
c_foreach (i, IVec, vec)
diff --git a/misc/examples/inits.c b/misc/examples/inits.c
index e098422e..1f01f88a 100644
--- a/misc/examples/inits.c
+++ b/misc/examples/inits.c
@@ -66,7 +66,7 @@ int main(void)
// CMAP CNT
- cmap_cnt countries = c_make(cmap_cnt, {
+ cmap_cnt countries = c_init(cmap_cnt, {
{"Norway", 100},
{"Denmark", 50},
{"Iceland", 10},
@@ -88,7 +88,7 @@ int main(void)
// CVEC PAIR
- cvec_ip pairs1 = c_make(cvec_ip, {{5, 6}, {3, 4}, {1, 2}, {7, 8}});
+ cvec_ip pairs1 = c_init(cvec_ip, {{5, 6}, {3, 4}, {1, 2}, {7, 8}});
cvec_ip_sort(&pairs1);
c_foreach (i, cvec_ip, pairs1)
@@ -98,7 +98,7 @@ int main(void)
// CLIST PAIR
- clist_ip pairs2 = c_make(clist_ip, {{5, 6}, {3, 4}, {1, 2}, {7, 8}});
+ clist_ip pairs2 = c_init(clist_ip, {{5, 6}, {3, 4}, {1, 2}, {7, 8}});
clist_ip_sort(&pairs2);
c_foreach (i, clist_ip, pairs2)
diff --git a/misc/examples/list.c b/misc/examples/list.c
index 363d7fec..ed27aa50 100644
--- a/misc/examples/list.c
+++ b/misc/examples/list.c
@@ -34,7 +34,7 @@ int main() {
puts("");
DList_drop(&list);
- list = c_make(DList, {10, 20, 30, 40, 30, 50});
+ list = c_init(DList, {10, 20, 30, 40, 30, 50});
const double* v = DList_get(&list, 30);
printf("found: %f\n", *v);
diff --git a/misc/examples/list_erase.c b/misc/examples/list_erase.c
index 0201c2d9..17adf11f 100644
--- a/misc/examples/list_erase.c
+++ b/misc/examples/list_erase.c
@@ -7,7 +7,7 @@
int main ()
{
- IList L = c_make(IList, {10, 20, 30, 40, 50});
+ IList L = c_init(IList, {10, 20, 30, 40, 50});
c_foreach (x, IList, L)
printf("%d ", *x.ref);
diff --git a/misc/examples/list_splice.c b/misc/examples/list_splice.c
index baebca29..73015454 100644
--- a/misc/examples/list_splice.c
+++ b/misc/examples/list_splice.c
@@ -16,8 +16,8 @@ void print_ilist(const char* s, clist_i list)
int main ()
{
- clist_i list1 = c_make(clist_i, {1, 2, 3, 4, 5});
- clist_i list2 = c_make(clist_i, {10, 20, 30, 40, 50});
+ clist_i list1 = c_init(clist_i, {1, 2, 3, 4, 5});
+ clist_i list2 = c_init(clist_i, {10, 20, 30, 40, 50});
print_ilist("list1:", list1);
print_ilist("list2:", list2);
diff --git a/misc/examples/lower_bound.c b/misc/examples/lower_bound.c
index 6ec7544c..d146c4d9 100644
--- a/misc/examples/lower_bound.c
+++ b/misc/examples/lower_bound.c
@@ -11,7 +11,7 @@ int main()
// TEST SORTED VECTOR
{
int key, *res;
- cvec_int vec = c_make(cvec_int, {40, 600, 1, 7000, 2, 500, 30});
+ cvec_int vec = c_init(cvec_int, {40, 600, 1, 7000, 2, 500, 30});
cvec_int_sort(&vec);
@@ -40,7 +40,7 @@ int main()
// TEST SORTED SET
{
int key, *res;
- csset_int set = c_make(csset_int, {40, 600, 1, 7000, 2, 500, 30});
+ csset_int set = c_init(csset_int, {40, 600, 1, 7000, 2, 500, 30});
key = 100;
res = csset_int_lower_bound(&set, key).ref;
diff --git a/misc/examples/multidim.c b/misc/examples/multidim.c
index 3980e6d8..2f3ad907 100644
--- a/misc/examples/multidim.c
+++ b/misc/examples/multidim.c
@@ -8,7 +8,7 @@ using_cspan3(ispan, int);
int main()
{
- cstack_int v = c_make(cstack_int, {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24});
+ cstack_int v = c_init(cstack_int, {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24});
// View data as contiguous memory representing 24 ints
ispan ms1 = cspan_from(&v);
diff --git a/misc/examples/music_arc.c b/misc/examples/music_arc.c
index 3714e1d5..87a57783 100644
--- a/misc/examples/music_arc.c
+++ b/misc/examples/music_arc.c
@@ -32,7 +32,7 @@ void Song_drop(Song* s) {
void example3()
{
- SongVec vec1 = c_make(SongVec, {
+ SongVec vec1 = c_init(SongVec, {
Song_make("Bob Dylan", "The Times They Are A Changing"),
Song_make("Aretha Franklin", "Bridge Over Troubled Water"),
Song_make("Thalia", "Entre El Mar y Una Estrella")
diff --git a/misc/examples/new_list.c b/misc/examples/new_list.c
index 14fabb4a..993f1aac 100644
--- a/misc/examples/new_list.c
+++ b/misc/examples/new_list.c
@@ -48,7 +48,7 @@ int main()
clist_pnt_push_back(&my.pntlst, (Point){123, 456});
MyStruct_drop(&my);
- clist_pnt plst = c_make(clist_pnt, {{42, 14}, {32, 94}, {62, 81}});
+ clist_pnt plst = c_init(clist_pnt, {{42, 14}, {32, 94}, {62, 81}});
clist_pnt_sort(&plst);
c_foreach (i, clist_pnt, plst)
@@ -57,7 +57,7 @@ int main()
clist_pnt_drop(&plst);
- clist_float flst = c_make(clist_float, {123.3f, 321.2f, -32.2f, 78.2f});
+ clist_float flst = c_init(clist_float, {123.3f, 321.2f, -32.2f, 78.2f});
clist_float_sort(&flst);
c_foreach (i, clist_float, flst)
diff --git a/misc/examples/new_map.c b/misc/examples/new_map.c
index f01db64f..1f50db83 100644
--- a/misc/examples/new_map.c
+++ b/misc/examples/new_map.c
@@ -42,18 +42,18 @@ int point_cmp(const Point* a, const Point* b) {
int main()
{
- cmap_pnt pmap = c_make(cmap_pnt, {{{42, 14}, 1}, {{32, 94}, 2}, {{62, 81}, 3}});
+ cmap_pnt pmap = c_init(cmap_pnt, {{{42, 14}, 1}, {{32, 94}, 2}, {{62, 81}, 3}});
c_foreach (i, cmap_pnt, pmap)
printf(" (%d, %d: %d)", i.ref->first.x, i.ref->first.y, i.ref->second);
puts("");
- cmap_str smap = c_make(cmap_str, {
+ cmap_str smap = c_init(cmap_str, {
{"Hello, friend", "long time no see"},
{"So long", "see you around"},
});
- cset_str sset = c_make(cset_str, {
+ cset_str sset = c_init(cset_str, {
"Hello, friend",
"Nice to see you again",
"So long",
diff --git a/misc/examples/new_pque.c b/misc/examples/new_pque.c
index 5b26b3de..dc2ecf12 100644
--- a/misc/examples/new_pque.c
+++ b/misc/examples/new_pque.c
@@ -10,7 +10,7 @@ typedef struct Point { int x, y; } Point;
int main()
{
- PointQ pque = c_make(PointQ, {{23, 80}, {12, 32}, {54, 74}, {12, 62}});
+ PointQ pque = c_init(PointQ, {{23, 80}, {12, 32}, {54, 74}, {12, 62}});
// print
for (; !PointQ_empty(&pque); PointQ_pop(&pque))
{
diff --git a/misc/examples/new_smap.c b/misc/examples/new_smap.c
index f930eba2..2eaae836 100644
--- a/misc/examples/new_smap.c
+++ b/misc/examples/new_smap.c
@@ -37,12 +37,12 @@ int point_cmp(const Point* a, const Point* b) {
int main()
{
- PMap pmap = c_make(PMap, {
+ PMap pmap = c_init(PMap, {
{{42, 14}, 1},
{{32, 94}, 2},
{{62, 81}, 3},
});
- SMap smap = c_make(SMap, {
+ SMap smap = c_init(SMap, {
{"Hello, friend", "this is the mapped value"},
{"The brown fox", "jumped"},
{"This is the time", "for all good things"},
diff --git a/misc/examples/phonebook.c b/misc/examples/phonebook.c
index c0007cb7..38a71089 100644
--- a/misc/examples/phonebook.c
+++ b/misc/examples/phonebook.c
@@ -38,7 +38,7 @@ void print_phone_book(cmap_str phone_book)
int main(int argc, char **argv)
{
- cmap_str phone_book = c_make(cmap_str, {
+ cmap_str phone_book = c_init(cmap_str, {
{"Lilia Friedman", "(892) 670-4739"},
{"Tariq Beltran", "(489) 600-7575"},
{"Laiba Juarez", "(303) 885-5692"},
diff --git a/misc/examples/printspan.c b/misc/examples/printspan.c
index 60a2d934..b9ec2476 100644
--- a/misc/examples/printspan.c
+++ b/misc/examples/printspan.c
@@ -24,21 +24,21 @@ int main()
intspan sp1 = cspan_make(intspan, {1, 2});
printMe( sp1 );
- printMe( c_make(intspan, {1, 2, 3}) );
+ printMe( c_init(intspan, {1, 2, 3}) );
int arr[] = {1, 2, 3, 4, 5, 6};
intspan sp2 = cspan_from_array(arr);
printMe( (intspan)cspan_subspan(&sp2, 1, 4) );
- cvec_int vec = c_make(cvec_int, {1, 2, 3, 4, 5});
+ cvec_int vec = c_init(cvec_int, {1, 2, 3, 4, 5});
printMe( (intspan)cspan_from(&vec) );
printMe( sp2 );
- cstack_int stk = c_make(cstack_int, {1, 2, 3, 4, 5, 6, 7});
+ cstack_int stk = c_init(cstack_int, {1, 2, 3, 4, 5, 6, 7});
printMe( (intspan)cspan_from(&stk) );
- csset_str set = c_make(csset_str, {"5", "7", "4", "3", "8", "2", "1", "9", "6"});
+ csset_str set = c_init(csset_str, {"5", "7", "4", "3", "8", "2", "1", "9", "6"});
printf("%d:", (int)csset_str_size(&set));
c_foreach (e, csset_str, set)
printf(" %s", cstr_str(e.ref));
diff --git a/misc/examples/scheduler.c b/misc/examples/scheduler.c
index bad5201b..14c85f56 100644
--- a/misc/examples/scheduler.c
+++ b/misc/examples/scheduler.c
@@ -58,7 +58,7 @@ static bool taskB(struct Task* task)
void Use(void)
{
- Scheduler scheduler = c_make(Scheduler, {
+ Scheduler scheduler = c_init(Scheduler, {
{taskA, &scheduler},
{taskB, &scheduler},
});