summaryrefslogtreecommitdiffhomepage
path: root/examples/complex.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-07-22 13:01:47 +0200
committerTyge Løvset <[email protected]>2020-07-22 13:01:47 +0200
commitc47f6949cbd6d851eddb83cc1b9aa4e2cf3dbe61 (patch)
treeb9738ca838fb0ad40bda6a117263f3e78fd024fc /examples/complex.c
parente0ebdfb05aa543eac980920949bc993e1bec931b (diff)
downloadSTC-modified-c47f6949cbd6d851eddb83cc1b9aa4e2cf3dbe61.tar.gz
STC-modified-c47f6949cbd6d851eddb83cc1b9aa4e2cf3dbe61.zip
Renamed CArray to CArr. Renamed cmap_xx_get() to cmap_xx_find(). Changed _front() and _back() signatures.
Diffstat (limited to 'examples/complex.c')
-rw-r--r--examples/complex.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/examples/complex.c b/examples/complex.c
index 6cfed90c..d4800260 100644
--- a/examples/complex.c
+++ b/examples/complex.c
@@ -1,12 +1,12 @@
#include <stc/cstr.h>
#include <stc/cmap.h>
#include <stc/clist.h>
-#include <stc/carray.h>
+#include <stc/carr.h>
void check_destroy(float* v) {printf("destroy %g\n", *v);}
-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_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_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.
- CArray2_f table = carray2_f_make(ydim, xdim, 0.f);
- printf("table: (%zu, %zu)\n", carray2_ydim(table), carray2_xdim(table));
+ CArr2_f table = carr2_f_make(ydim, xdim, 0.f);
+ printf("table: (%zu, %zu)\n", carr2_ydim(table), carr2_xdim(table));
CList_t2 tableList = clist_init;
CMap_il listMap = cmap_init;
// Put in some data.
- carray2_f_data(table, y)[x] = 3.1415927; // table[y][x]
+ carr2_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
- CArray2_f table = clist_back(cmap_il_get(&cmap_sm_get(&theMap, strKey)->value, tableKey)->value);
- printf("value (%d, %d) is: %f\n", y, x, carray2_f_value(table, y, x));
+ 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));
}
cmap_sm_destroy(&theMap); // free up the whole shebang!