diff options
| author | Tyge Løvset <[email protected]> | 2021-01-30 23:05:36 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-01-30 23:05:36 +0100 |
| commit | b3d9e68fa2c2ec9ebe7e3f08045d01db5b720eea (patch) | |
| tree | 100c3d8b5a2df433efd9cf148d3c66506f1d288b /examples | |
| parent | 5c196be3cfa172ca521ced0cf5d9b7d0acec5b83 (diff) | |
| download | STC-modified-b3d9e68fa2c2ec9ebe7e3f08045d01db5b720eea.tar.gz STC-modified-b3d9e68fa2c2ec9ebe7e3f08045d01db5b720eea.zip | |
Internal changes: removed use of cmap_inits and set_inits. Use cmap_x_init() and cset_X_init(). Minor changes in cvec, csmap, cstr, crandom.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/complex.c | 4 | ||||
| -rw-r--r-- | examples/convert.c | 2 | ||||
| -rw-r--r-- | examples/demos.c | 8 | ||||
| -rw-r--r-- | examples/inits.c | 4 | ||||
| -rw-r--r-- | examples/mapmap.c | 4 | ||||
| -rw-r--r-- | examples/phonebook.c | 3 | ||||
| -rw-r--r-- | examples/words.c | 2 |
7 files changed, 13 insertions, 14 deletions
diff --git a/examples/complex.c b/examples/complex.c index 67397669..cbf07af2 100644 --- a/examples/complex.c +++ b/examples/complex.c @@ -14,9 +14,9 @@ int main() { int xdim = 4, ydim = 6;
int x = 1, y = 5, tableKey = 42;
const char* strKey = "first";
- cmap_l listMap = cmap_inits;
+ cmap_l listMap = cmap_l_init();
- cmap_s myMap = cmap_inits;
+ cmap_s myMap = cmap_s_init();
// Construct.
carray2f arr_a = carray2f_init(ydim, xdim, 0.f);
diff --git a/examples/convert.c b/examples/convert.c index f5dd5af6..25ae9dcd 100644 --- a/examples/convert.c +++ b/examples/convert.c @@ -12,7 +12,7 @@ using_clist_str(); int main()
{
- cmap_str map = cmap_inits;
+ cmap_str map = cmap_str_init();
cmap_str_emplace(&map, "green", "#00ff00");
cmap_str_emplace(&map, "blue", "#0000ff");
cmap_str_emplace(&map, "yellow", "#ffff00");
diff --git a/examples/demos.c b/examples/demos.c index 2ee267e6..aa1fa28b 100644 --- a/examples/demos.c +++ b/examples/demos.c @@ -108,7 +108,7 @@ using_cset(i, int); void setdemo1()
{
printf("\nSETDEMO1\n");
- cset_i nums = cset_inits;
+ cset_i nums = cset_i_init();
cset_i_insert(&nums, 8);
cset_i_insert(&nums, 11);
@@ -123,7 +123,7 @@ using_cmap(ii, int, int); void mapdemo1()
{
printf("\nMAPDEMO1\n");
- cmap_ii nums = cmap_inits;
+ cmap_ii nums = cmap_ii_init();
cmap_ii_put(&nums, 8, 64);
cmap_ii_put(&nums, 11, 121);
printf("val 8: %d\n", *cmap_ii_at(&nums, 8));
@@ -136,7 +136,7 @@ using_cmap_strkey(si, int); // Shorthand macro for the general using_cmap expans void mapdemo2()
{
printf("\nMAPDEMO2\n");
- cmap_si nums = cmap_inits;
+ cmap_si nums = cmap_si_init();
cmap_si_put(&nums, "Hello", 64);
cmap_si_put(&nums, "Groovy", 121);
cmap_si_put(&nums, "Groovy", 200); // overwrite previous
@@ -158,7 +158,7 @@ using_cmap_str(); void mapdemo3()
{
printf("\nMAPDEMO3\n");
- cmap_str table = cmap_inits;
+ cmap_str table = cmap_str_init();
cmap_str_put(&table, "Map", "test");
cmap_str_put(&table, "Make", "my");
cmap_str_put(&table, "Sunny", "day");
diff --git a/examples/inits.c b/examples/inits.c index 759fc7a7..2c138a43 100644 --- a/examples/inits.c +++ b/examples/inits.c @@ -45,7 +45,7 @@ int main(void) // CMAP ID
int year = 2020;
- cmap_id idnames = cmap_inits;
+ cmap_id idnames = cmap_id_init();
c_push_items(&idnames, cmap_id, {
{100, cstr_from("Hello")},
{110, cstr_from("World")},
@@ -59,7 +59,7 @@ int main(void) // CMAP CNT
- cmap_cnt countries = cmap_inits;
+ cmap_cnt countries = cmap_cnt_init();
c_push_items(&countries, cmap_cnt, {
{"Norway", 100},
{"Denmark", 50},
diff --git a/examples/mapmap.c b/examples/mapmap.c index a56a30db..7782f5bf 100644 --- a/examples/mapmap.c +++ b/examples/mapmap.c @@ -7,8 +7,8 @@ using_cmap_str(); using_cmap_strkey(cfg, cmap_str, cmap_str_del, cmap_str_clone);
int main(void) {
- cmap_cfg config = cmap_inits;
- cmap_str init = cmap_inits;
+ cmap_cfg config = cmap_cfg_init();
+ cmap_str init = cmap_str_init();
cmap_str_put(&cmap_cfg_emplace(&config, "user", init).first->second, "name", "Joe");
cmap_str_put(&cmap_cfg_emplace(&config, "user", init).first->second, "groups", "proj1,proj3");
cmap_str_put(&cmap_cfg_emplace(&config, "group", init).first->second, "proj1", "Energy");
diff --git a/examples/phonebook.c b/examples/phonebook.c index 91d01072..1bedcce9 100644 --- a/examples/phonebook.c +++ b/examples/phonebook.c @@ -36,8 +36,7 @@ void print_phone_book(cmap_str phone_book) int main(int argc, char **argv)
{
bool erased;
- cmap_str phone_book = cmap_inits;
- c_push_items(&phone_book, cmap_str, {
+ c_init (cmap_str, phone_book, {
{"Lilia Friedman", "(892) 670-4739"},
{"Tariq Beltran", "(489) 600-7575"},
{"Laiba Juarez", "(303) 885-5692"},
diff --git a/examples/words.c b/examples/words.c index 693e302e..08563cfc 100644 --- a/examples/words.c +++ b/examples/words.c @@ -26,7 +26,7 @@ int main1() "this", "sentence", "is", "a", "hoax" }); - cmap_si word_map = cmap_inits; + cmap_si word_map = cmap_si_init(); c_foreach (w, cvec_str, words) cmap_si_emplace(&word_map, w.ref->str, 0).first->second += 1; |
