summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/new_smap.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-12-23 23:55:10 +0100
committerTyge Løvset <[email protected]>2022-12-23 23:55:10 +0100
commitd623c6c85071b9af5d607bb5d9aceceaea05220a (patch)
treef20fc3714f86e1553d1103bed6dc8efefcbd9d6b /misc/examples/new_smap.c
parent5f57d597cd27aef55adbcb3b452973b0c6e33667 (diff)
downloadSTC-modified-d623c6c85071b9af5d607bb5d9aceceaea05220a.tar.gz
STC-modified-d623c6c85071b9af5d607bb5d9aceceaea05220a.zip
Experimental uppercase macros.
Diffstat (limited to 'misc/examples/new_smap.c')
-rw-r--r--misc/examples/new_smap.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/misc/examples/new_smap.c b/misc/examples/new_smap.c
index c77aa185..8b1df828 100644
--- a/misc/examples/new_smap.c
+++ b/misc/examples/new_smap.c
@@ -42,34 +42,34 @@ int point_cmp(const Point* a, const Point* b) {
int main()
{
- c_auto (csmap_int, imap) {
+ c_AUTO (csmap_int, imap) {
csmap_int_insert(&imap, 123, 321);
}
- c_auto (PMap, pmap) {
- c_forlist (i, PMap_value, {
+ c_AUTO (PMap, pmap) {
+ c_FORLIST (i, PMap_value, {
{{42, 14}, 1},
{{32, 94}, 2},
{{62, 81}, 3},
}) PMap_insert(&pmap, c_PAIR(i.ref));
- c_forpair (p, i, PMap, pmap)
+ c_FORPAIR (p, i, PMap, pmap)
printf(" (%d,%d: %d)", _.p->x, _.p->y, *_.i);
puts("");
}
- c_auto (SMap, smap) {
- c_forlist (i, SMap_raw, {
+ c_AUTO (SMap, smap) {
+ c_FORLIST (i, SMap_raw, {
{"Hello, friend", "this is the mapped value"},
{"The brown fox", "jumped"},
{"This is the time", "for all good things"},
}) SMap_emplace(&smap, c_PAIR(i.ref));
- c_forpair (i, j, SMap, smap)
+ c_FORPAIR (i, j, SMap, smap)
printf(" (%s: %s)\n", cstr_str(_.i), cstr_str(_.j));
}
- c_auto (SSet, sset) {
+ c_AUTO (SSet, sset) {
SSet_emplace(&sset, "Hello, friend");
SSet_emplace(&sset, "Goodbye, foe");
printf("Found? %s\n", SSet_contains(&sset, "Hello, friend") ? "true" : "false");