From 5f2935c6a9a57e6c7fedf4d6e2509282df5871a8 Mon Sep 17 00:00:00 2001 From: Tyge Løvset <60263450+tylov@users.noreply.github.com> Date: Tue, 12 Jan 2021 11:14:17 +0100 Subject: Update cmap_api.md --- docs/cmap_api.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/cmap_api.md b/docs/cmap_api.md index b1631443..67feafdb 100644 --- a/docs/cmap_api.md +++ b/docs/cmap_api.md @@ -178,8 +178,7 @@ using_cmap_strval(id, int); int main() { uint32_t col = 0xcc7744ff; - cmap_id idnames = cmap_inits; - c_push_items(&idnames, cmap_id, { + c_init (cmap_id, idnames, { {100, "Red"}, {110, "Blue"}, }); @@ -246,13 +245,11 @@ Inverse: demonstrate cmap with mapped POD type Vec3i: cmap: #include typedef struct { int x, y, z; } Vec3i; - using_cmap(iv, int, Vec3i); int main() { cmap_iv vecs = cmap_iv_init(); - cmap_iv_put(&vecs, 1, (Vec3i){100, 0, 0}); cmap_iv_put(&vecs, 2, (Vec3i){ 0, 100, 0}); cmap_iv_put(&vecs, 3, (Vec3i){ 0, 0, 100}); @@ -289,7 +286,6 @@ void viking_del(Viking* vk) { cstr_del(&vk->country); } - // Define Viking raw struct with hash, equals, and convertion functions between Viking and VikingRaw structs: typedef struct VikingRaw { @@ -322,9 +318,9 @@ using_cmap(vk, Viking, int, c_default_del, c_default_clone, int main() { c_init (cmap_vk vikings { - {\{"Einar", "Norway"}, 20}, - {\{"Olaf", "Denmark"}, 24}, - {\{"Harald", "Iceland"}, 12}, + { {"Einar", "Norway"}, 20 }, + { {"Olaf", "Denmark"}, 24 }, + { {"Harald", "Iceland"}, 12 }, }); cmap_vk_put(&vikings, (VikingRaw){"Bjorn", "Sweden"}, 10); -- cgit v1.2.3