aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--example.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/example.c b/example.c
index bddf398..00f79da 100644
--- a/example.c
+++ b/example.c
@@ -7,23 +7,32 @@
int
main() {
g_arena = B_create(KiB(4));
+ BumpArena t_arena = B_create(KiB(4));
- int *nums = AG_new(sizeof(int), 8);
- for (int i = 10; i < 20; ++i) {
- A_push(nums, &i);
+ String* hexes = AG_new(sizeof(String), 8);
+ Result status = R_Ok;
+
+ for (usize i = 7; i <= 4830; i += 69) {
+ status = A_ppush(hexes, S_printf(t_arena, "%x", i));
+
+ if (R_Ok != status) {
+ fprintf(stderr, "Error(%d): %lu %lu\n", status, i, A_count(hexes));
+ }
}
- printf("%lu/%lu |", A_count(nums), A_length(nums));
- for (int i = 0; i < A_count(nums); ++i)
- printf(" %d", nums[i]);
- printf("\n");
+ String all = SG_printf("Total: %ld\n", A_count(hexes));
+ for (usize i = 0; i + 4 < A_count(hexes); i += 4) {
+ Result status = S_append(all, S_concat(t_arena, hexes[0+i], " ", hexes[1+i], " ", hexes[2+i], " ", hexes[3+i], "\n", NULL));
+
+ if (R_Ok != status) {
+ fprintf(stderr, "Error(%d): %lu %lu\n", status, i, A_count(hexes));
+ }
+ }
- String s = SG_concat("Hello", " ", "World", "!", NULL);
- printf("%s\n", s);
+ printf("%s", all);
- String s1 = SG_printf("%s #%d\n", s, 5);
- printf("%s\n", s1);
B_destroy(g_arena);
+ B_destroy(t_arena);
return 0;
}