From 613cd9c306b200aaca7403c4c7c678634c409758 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Sat, 25 Jul 2020 23:00:09 +0200 Subject: Reverted CArr to CArray again. --- examples/complex.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'examples/complex.c') diff --git a/examples/complex.c b/examples/complex.c index d4800260..a52bd175 100644 --- a/examples/complex.c +++ b/examples/complex.c @@ -1,12 +1,12 @@ #include #include #include -#include +#include void check_destroy(float* v) {printf("destroy %g\n", *v);} -declare_CArr(f, float, check_destroy); // normally omit the last argument - float type need no destroy. -declare_CList(t2, CArr2_f, carr2_f_destroy, c_noCompare); +declare_CArray(f, float, check_destroy); // normally omit the last argument - float type need no destroy. +declare_CList(t2, CArray2_f, carray2_f_destroy, c_noCompare); declare_CMap(il, int, CList_t2, clist_t2_destroy); declare_CMap_str(sm, CMap_il, cmap_il_destroy); @@ -17,20 +17,20 @@ int main() { CMap_sm theMap = cmap_init; { // Construct. - CArr2_f table = carr2_f_make(ydim, xdim, 0.f); - printf("table: (%zu, %zu)\n", carr2_ydim(table), carr2_xdim(table)); + CArray2_f table = carray2_f_make(ydim, xdim, 0.f); + printf("table: (%zu, %zu)\n", carray2_ydim(table), carray2_xdim(table)); CList_t2 tableList = clist_init; CMap_il listMap = cmap_init; // Put in some data. - carr2_f_data(table, y)[x] = 3.1415927; // table[y][x] + carray2_f_data(table, y)[x] = 3.1415927; // table[y][x] clist_t2_pushBack(&tableList, table); cmap_il_put(&listMap, tableKey, tableList); cmap_sm_put(&theMap, strKey, listMap); } { // Access the data entry - CArr2_f table = clist_back(cmap_il_find(&cmap_sm_find(&theMap, strKey)->value, tableKey)->value); - printf("value (%d, %d) is: %f\n", y, x, carr2_f_value(table, y, x)); + CArray2_f table = clist_back(cmap_il_find(&cmap_sm_find(&theMap, strKey)->value, tableKey)->value); + printf("value (%d, %d) is: %f\n", y, x, carray2_f_value(table, y, x)); } cmap_sm_destroy(&theMap); // free up the whole shebang! -- cgit v1.2.3