summaryrefslogtreecommitdiffhomepage
path: root/docs/cmap_api.md
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-01-12 11:14:17 +0100
committerGitHub <[email protected]>2021-01-12 11:14:17 +0100
commit5f2935c6a9a57e6c7fedf4d6e2509282df5871a8 (patch)
tree074a36866f6a6fac4c6f71fcaf91ec767cccf8dc /docs/cmap_api.md
parent066e809aa3ccd3f8e68dee3c04d6728a61128630 (diff)
downloadSTC-modified-5f2935c6a9a57e6c7fedf4d6e2509282df5871a8.tar.gz
STC-modified-5f2935c6a9a57e6c7fedf4d6e2509282df5871a8.zip
Update cmap_api.md
Diffstat (limited to 'docs/cmap_api.md')
-rw-r--r--docs/cmap_api.md12
1 files 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<int, Vec3i>:
#include <stdio.h>
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);