diff options
| author | Tyge Løvset <[email protected]> | 2020-07-27 17:59:41 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2020-07-27 17:59:41 +0200 |
| commit | 31b2b9877c950b2606b8cff4eab398dd44321937 (patch) | |
| tree | c31b095ade62a2fa92e9dd8cb01bcf717f7d35b9 /examples/complex.c | |
| parent | bdd322f4c7d30a3cba1aa0c6ff3106b2045fb879 (diff) | |
| download | STC-modified-31b2b9877c950b2606b8cff4eab398dd44321937.tar.gz STC-modified-31b2b9877c950b2606b8cff4eab398dd44321937.zip | |
API CHANGES: Made types all lower case. E.g.: CMap_<tag> => cmap_<tag>, CList_<tag> => clist_<tag>. Note: CStr => cstr_t, CBitset => cbitset_t
Diffstat (limited to 'examples/complex.c')
| -rw-r--r-- | examples/complex.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/examples/complex.c b/examples/complex.c index 40dc9722..87caaa4e 100644 --- a/examples/complex.c +++ b/examples/complex.c @@ -5,22 +5,22 @@ 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, CArray2f, carray2f_destroy, c_noCompare);
-declare_CMap(il, int, CList_t2, clist_t2_destroy);
-declare_CMap_str(sm, CMap_il, cmap_il_destroy);
+declare_carray(f, float, check_destroy); // normally omit the last argument - float type need no destroy.
+declare_clist(t2, carray2f, carray2f_destroy, c_noCompare);
+declare_cmap(il, int, clist_t2, clist_t2_destroy);
+declare_cmap_str(sm, cmap_il, cmap_il_destroy);
int main() {
int xdim = 4, ydim = 6;
int x = 1, y = 5, tableKey = 42;
const char* strKey = "first";
- CMap_sm theMap = cmap_init;
+ cmap_sm theMap = cmap_init;
{ // Construct.
- CArray2f table = carray2f_make(ydim, xdim, 0.f);
+ carray2f table = carray2f_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;
+ clist_t2 tableList = clist_init;
+ cmap_il listMap = cmap_init;
// Put in some data.
carray2f_data(table, y)[x] = 3.1415927; // table[y][x]
@@ -29,7 +29,7 @@ int main() { cmap_sm_put(&theMap, strKey, listMap);
}
{ // Access the data entry
- CArray2f table = clist_back(cmap_il_find(&cmap_sm_find(&theMap, strKey)->value, tableKey)->value);
+ carray2f table = clist_back(cmap_il_find(&cmap_sm_find(&theMap, strKey)->value, tableKey)->value);
printf("value (%d, %d) is: %f\n", y, x, carray2f_value(table, y, x));
}
|
