summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/bits.c12
-rw-r--r--examples/bits2.c4
-rw-r--r--examples/books.c2
-rw-r--r--examples/box2.c12
-rw-r--r--examples/complex.c2
-rw-r--r--examples/csmap_erase.c4
-rw-r--r--examples/csmap_find.c2
-rw-r--r--examples/cstr_match.c4
-rw-r--r--examples/demos.c8
-rw-r--r--examples/new_queue.c4
-rw-r--r--examples/prime.c4
-rw-r--r--examples/priority.c2
-rw-r--r--examples/queue.c2
-rw-r--r--examples/random.c6
-rw-r--r--examples/sso_map.c2
15 files changed, 35 insertions, 35 deletions
diff --git a/examples/bits.c b/examples/bits.c
index 48c77ed0..ca4de6af 100644
--- a/examples/bits.c
+++ b/examples/bits.c
@@ -4,11 +4,11 @@
int main()
{
c_with (cbits set = cbits_with_size(23, true), cbits_drop(&set)) {
- printf("count %" c_zu ", %" c_zu "\n", cbits_count(&set), cbits_size(&set));
+ printf("count %" c_ZU ", %" c_ZU "\n", cbits_count(&set), cbits_size(&set));
cbits s1 = cbits_from("1110100110111");
char buf[256];
cbits_to_str(&s1, buf, 0, -1);
- printf("buf: %s: %" c_zu "\n", buf, cbits_count(&s1));
+ printf("buf: %s: %" c_ZU "\n", buf, cbits_count(&s1));
cbits_drop(&s1);
cbits_reset(&set, 9);
@@ -16,7 +16,7 @@ int main()
c_autobuf (str, char, cbits_size(&set) + 1)
printf(" str: %s\n", cbits_to_str(&set, str, 0, -1));
- printf("%4" c_zu ": ", cbits_size(&set));
+ printf("%4" c_ZU ": ", cbits_size(&set));
c_forrange (i, cbits_size(&set))
printf("%d", cbits_test(&set, i));
puts("");
@@ -26,12 +26,12 @@ int main()
cbits_resize(&set, 93, false);
cbits_resize(&set, 102, true);
cbits_set_value(&set, 99, false);
- printf("%4" c_zu ": ", cbits_size(&set));
+ printf("%4" c_ZU ": ", cbits_size(&set));
c_forrange (i, cbits_size(&set))
printf("%d", cbits_test(&set, i));
puts("\nIterate:");
- printf("%4" c_zu ": ", cbits_size(&set));
+ printf("%4" c_ZU ": ", cbits_size(&set));
c_forrange (i, cbits_size(&set))
printf("%d", cbits_test(&set, i));
puts("");
@@ -53,7 +53,7 @@ int main()
puts("");
cbits_set_all(&set, false);
- printf("%4" c_zu ": ", cbits_size(&set));
+ printf("%4" c_ZU ": ", cbits_size(&set));
c_forrange (i, cbits_size(&set))
printf("%d", cbits_test(&set, i));
puts("");
diff --git a/examples/bits2.c b/examples/bits2.c
index e42ca4e5..95eb8b83 100644
--- a/examples/bits2.c
+++ b/examples/bits2.c
@@ -9,10 +9,10 @@ int main()
{
Bits s1 = Bits_from("1110100110111");
- printf("size %" c_zu "\n", Bits_size(&s1));
+ printf("size %" c_ZU "\n", Bits_size(&s1));
char buf[256];
Bits_to_str(&s1, buf, 0, -1);
- printf("buf: %s: count=%" c_zu "\n", buf, Bits_count(&s1));
+ printf("buf: %s: count=%" c_ZU "\n", buf, Bits_count(&s1));
Bits_reset(&s1, 8);
c_autobuf (str, char, Bits_size(&s1) + 1)
diff --git a/examples/books.c b/examples/books.c
index bdcc5889..bfced28f 100644
--- a/examples/books.c
+++ b/examples/books.c
@@ -32,7 +32,7 @@ int main()
// When collections store owned values (String), they can still be
// queried using references (&str).
if (cmap_str_contains(&book_reviews, "Les Misérables")) {
- printf("We've got %" c_zu " reviews, but Les Misérables ain't one.",
+ printf("We've got %" c_ZU " reviews, but Les Misérables ain't one.",
cmap_str_size(&book_reviews));
}
diff --git a/examples/box2.c b/examples/box2.c
index 13dc8c26..2413e3fe 100644
--- a/examples/box2.c
+++ b/examples/box2.c
@@ -64,22 +64,22 @@ int main(void) {
// Double indirection
box_in_a_box = cbox_BoxPoint_from(boxed_origin());
- printf("Point occupies %" c_zu " bytes on the stack\n",
+ printf("Point occupies %" c_ZU " bytes on the stack\n",
sizeof(point));
- printf("Rectangle occupies %" c_zu " bytes on the stack\n",
+ printf("Rectangle occupies %" c_ZU " bytes on the stack\n",
sizeof(rectangle));
// box size == pointer size
- printf("Boxed point occupies %" c_zu " bytes on the stack\n",
+ printf("Boxed point occupies %" c_ZU " bytes on the stack\n",
sizeof(boxed_point));
- printf("Boxed rectangle occupies %" c_zu " bytes on the stack\n",
+ printf("Boxed rectangle occupies %" c_ZU " bytes on the stack\n",
sizeof(boxed_rectangle));
- printf("Boxed box occupies %" c_zu " bytes on the stack\n",
+ printf("Boxed box occupies %" c_ZU " bytes on the stack\n",
sizeof(box_in_a_box));
// Copy the data contained in `boxed_point` into `unboxed_point`
Point unboxed_point = *boxed_point.get;
- printf("Unboxed point occupies %" c_zu " bytes on the stack\n",
+ printf("Unboxed point occupies %" c_ZU " bytes on the stack\n",
sizeof(unboxed_point));
}
}
diff --git a/examples/complex.c b/examples/complex.c
index 71ee6b0b..c91f95d5 100644
--- a/examples/complex.c
+++ b/examples/complex.c
@@ -37,7 +37,7 @@ int main()
// Put in some data in the structures
stack.data[3] = 3.1415927f;
- printf("stack size: %" c_zu "\n", FloatStack_size(&stack));
+ printf("stack size: %" c_ZU "\n", FloatStack_size(&stack));
StackList list = StackList_init();
StackList_push_back(&list, stack);
diff --git a/examples/csmap_erase.c b/examples/csmap_erase.c
index d05c32fe..97f45779 100644
--- a/examples/csmap_erase.c
+++ b/examples/csmap_erase.c
@@ -12,7 +12,7 @@ void printmap(mymap m)
{
c_foreach (elem, mymap, m)
printf(" [%d, %s]", elem.ref->first, cstr_str(&elem.ref->second));
- printf("\nsize() == %" c_zu "\n\n", mymap_size(&m));
+ printf("\nsize() == %" c_ZU "\n\n", mymap_size(&m));
}
int main()
@@ -77,7 +77,7 @@ int main()
// The 3rd member function removes elements with a given Key
size_t count = mymap_erase(&m3, 2);
// The 3rd member function also returns the number of elements removed
- printf("The number of elements removed from m3 is: %" c_zu "\n", count);
+ printf("The number of elements removed from m3 is: %" c_ZU "\n", count);
puts("After the element with a key of 2 is deleted, the map m3 is:");
printmap(m3);
}
diff --git a/examples/csmap_find.c b/examples/csmap_find.c
index 98da589e..3c507476 100644
--- a/examples/csmap_find.c
+++ b/examples/csmap_find.c
@@ -18,7 +18,7 @@ void print_elem(csmap_istr_raw p) {
#define using_print_collection(CX) \
void print_collection_##CX(const CX* t) { \
- printf("%" c_zu " elements: ", CX##_size(t)); \
+ printf("%" c_ZU " elements: ", CX##_size(t)); \
\
c_foreach (p, CX, *t) { \
print_elem(CX##_value_toraw(p.ref)); \
diff --git a/examples/cstr_match.c b/examples/cstr_match.c
index a991278c..9324ce41 100644
--- a/examples/cstr_match.c
+++ b/examples/cstr_match.c
@@ -6,7 +6,7 @@ int main()
{
c_with (cstr ss = cstr_new("The quick brown fox jumps over the lazy dog.JPG"), cstr_drop(&ss)) {
size_t pos = cstr_find_at(&ss, 0, "brown");
- printf("%" c_zu " [%s]\n", pos, pos == cstr_npos ? "<NULL>" : cstr_str(&ss) + pos);
+ printf("%" c_ZU " [%s]\n", pos, pos == cstr_npos ? "<NULL>" : cstr_str(&ss) + pos);
printf("equals: %d\n", cstr_equals(&ss, "The quick brown fox jumps over the lazy dog.JPG"));
printf("contains: %d\n", cstr_contains(&ss, "umps ove"));
printf("starts_with: %d\n", cstr_starts_with(&ss, "The quick brown"));
@@ -16,7 +16,7 @@ int main()
cstr s1 = cstr_new("hell😀 w😀rl🐨");
csview ch1 = cstr_u8_chr(&s1, 7);
csview ch2 = cstr_u8_chr(&s1, 10);
- printf("%s\nsize: %" c_zu ", %" c_zu "\n", cstr_str(&s1), cstr_u8_size(&s1), cstr_size(&s1));
+ printf("%s\nsize: %" c_ZU ", %" c_ZU "\n", cstr_str(&s1), cstr_u8_size(&s1), cstr_size(&s1));
printf("ch1: %.*s\n", c_ARGsv(ch1));
printf("ch2: %.*s\n", c_ARGsv(ch2));
}
diff --git a/examples/demos.c b/examples/demos.c
index 457e5f4d..2795b478 100644
--- a/examples/demos.c
+++ b/examples/demos.c
@@ -48,7 +48,7 @@ void vectordemo1()
cvec_ix_erase_n(&bignums, 0, 1); // erase the first
for (size_t i = 0; i < cvec_ix_size(&bignums); ++i) {
- printf("%" c_zu ": %" PRIu64 "\n", i, bignums.data[i]);
+ printf("%" c_ZU ": %" PRIu64 "\n", i, bignums.data[i]);
}
}
}
@@ -175,11 +175,11 @@ void mapdemo3()
cmap_str_iter it = cmap_str_find(&table, "Make");
c_foreach (i, cmap_str, table)
printf("entry: %s: %s\n", cstr_str(&i.ref->first), cstr_str(&i.ref->second));
- printf("size %" c_zu ": remove: Make: %s\n", cmap_str_size(&table), cstr_str(&it.ref->second));
+ printf("size %" c_ZU ": remove: Make: %s\n", cmap_str_size(&table), cstr_str(&it.ref->second));
//cmap_str_erase(&table, "Make");
cmap_str_erase_at(&table, it);
- printf("size %" c_zu "\n", cmap_str_size(&table));
+ printf("size %" c_ZU "\n", cmap_str_size(&table));
c_foreach (i, cmap_str, table)
printf("entry: %s: %s\n", cstr_str(&i.ref->first), cstr_str(&i.ref->second));
cmap_str_drop(&table); // frees key and value cstrs, and hash table.
@@ -199,7 +199,7 @@ void arraydemo1()
float **arr2 = arr3.data[5];
float *arr1 = arr3.data[5][4];
- printf("arr3: %" c_zu ": (%" c_zu ", %" c_zu ", %" c_zu ") = %" c_zu "\n", sizeof(arr3),
+ printf("arr3: %" c_ZU ": (%" c_ZU ", %" c_ZU ", %" c_ZU ") = %" c_ZU "\n", sizeof(arr3),
arr3.xdim, arr3.ydim, arr3.zdim, carr3_f_size(&arr3));
printf("%g\n", arr1[3]); // = 10.2
diff --git a/examples/new_queue.c b/examples/new_queue.c
index c1e4e7b0..46ae836e 100644
--- a/examples/new_queue.c
+++ b/examples/new_queue.c
@@ -32,7 +32,7 @@ int main() {
IQ_push(&Q, stc64_uniform(&rng, &dist));
// Push or pop on the queue 50 million times
- printf("befor: size %" c_zu ", capacity %" c_zu "\n", IQ_size(&Q), IQ_capacity(&Q));
+ printf("befor: size %" c_ZU ", capacity %" c_ZU "\n", IQ_size(&Q), IQ_capacity(&Q));
c_forrange (n) {
int r = stc64_uniform(&rng, &dist);
if (r & 3)
@@ -40,6 +40,6 @@ int main() {
else
IQ_pop(&Q);
}
- printf("after: size %" c_zu ", capacity %" c_zu "\n", IQ_size(&Q), IQ_capacity(&Q));
+ printf("after: size %" c_ZU ", capacity %" c_ZU "\n", IQ_size(&Q), IQ_capacity(&Q));
}
}
diff --git a/examples/prime.c b/examples/prime.c
index 01528d80..8f883f14 100644
--- a/examples/prime.c
+++ b/examples/prime.c
@@ -25,7 +25,7 @@ cbits sieveOfEratosthenes(size_t n)
int main(void)
{
size_t n = 1000000000;
- printf("computing prime numbers up to %" c_zu "\n", n);
+ printf("computing prime numbers up to %" c_ZU "\n", n);
clock_t t1 = clock();
c_with (cbits primes = sieveOfEratosthenes(n + 1), cbits_drop(&primes)) {
@@ -33,7 +33,7 @@ int main(void)
size_t np = cbits_count(&primes);
clock_t t2 = clock();
- printf("number of primes: %" c_zu ", time: %f\n", np, (t2 - t1) / (float)CLOCKS_PER_SEC);
+ printf("number of primes: %" c_ZU ", time: %f\n", np, (t2 - t1) / (float)CLOCKS_PER_SEC);
puts("Show all the primes in the range [2, 1000):");
printf("2");
c_forrange (i, 3, 1000, 2)
diff --git a/examples/priority.c b/examples/priority.c
index 82f95d09..6af297ac 100644
--- a/examples/priority.c
+++ b/examples/priority.c
@@ -15,7 +15,7 @@ int main() {
c_auto (cpque_i, heap)
{
// Push ten million random numbers to priority queue
- printf("Push %" c_zu " numbers\n", N);
+ printf("Push %" c_ZU " numbers\n", N);
c_forrange (N)
cpque_i_push(&heap, stc64_uniform(&rng, &dist));
diff --git a/examples/queue.c b/examples/queue.c
index cdf4cdb3..f39c4b8b 100644
--- a/examples/queue.c
+++ b/examples/queue.c
@@ -26,6 +26,6 @@ int main() {
else
--n, cqueue_i_pop(&queue);
}
- printf("%d, %" c_zu "\n", n, cqueue_i_size(&queue));
+ printf("%d, %" c_ZU "\n", n, cqueue_i_size(&queue));
}
}
diff --git a/examples/random.c b/examples/random.c
index 6ebda57e..fe64290d 100644
--- a/examples/random.c
+++ b/examples/random.c
@@ -18,7 +18,7 @@ int main()
sum += (uint32_t)stc64_rand(&rng);
}
diff = clock() - before;
- printf("full range\t\t: %f secs, %" c_zu ", avg: %f\n",
+ printf("full range\t\t: %f secs, %" c_ZU ", avg: %f\n",
(float)diff / CLOCKS_PER_SEC, N, (double)sum / N);
stc64_uniform_t dist1 = stc64_uniform_new(0, range);
@@ -29,7 +29,7 @@ int main()
sum += stc64_uniform(&rng, &dist1); // unbiased
}
diff = clock() - before;
- printf("unbiased 0-%" PRIu64 "\t: %f secs, %" c_zu ", avg: %f\n",
+ printf("unbiased 0-%" PRIu64 "\t: %f secs, %" c_ZU ", avg: %f\n",
range, (float)diff/CLOCKS_PER_SEC, N, (double)sum / N);
sum = 0;
@@ -39,7 +39,7 @@ int main()
sum += stc64_rand(&rng) % (range + 1); // biased
}
diff = clock() - before;
- printf("biased 0-%" PRIu64 " \t: %f secs, %" c_zu ", avg: %f\n",
+ printf("biased 0-%" PRIu64 " \t: %f secs, %" c_ZU ", avg: %f\n",
range, (float)diff / CLOCKS_PER_SEC, N, (double)sum / N);
}
diff --git a/examples/sso_map.c b/examples/sso_map.c
index a7ee5bb5..cc5e16a1 100644
--- a/examples/sso_map.c
+++ b/examples/sso_map.c
@@ -10,7 +10,7 @@ int main()
cmap_str_emplace(&m, "Test long ", "This is a longer string.");
c_forpair (k, v, cmap_str, m)
- printf("%s: '%s' Len=%" c_zu ", Is long: %s\n",
+ printf("%s: '%s' Len=%" c_ZU ", Is long: %s\n",
cstr_str(_.k), cstr_str(_.v), cstr_size(_.v),
cstr_is_long(_.v)?"true":"false");
}