1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include "Vector.h"
#include "String.h"
#include "BumpAlloc.h"
#include <stdio.h>
int
main() {
MemoryManager g = M_bump(KiB(2)),
t = M_bump(KiB(3));
String *hexes = V_new(&g, sizeof(String), 8);
Result status = R_Ok;
for (usize i = 7; i <= 4830; i += 69) {
PRINT_NOTOK(V_pushp((Vector**)&hexes, S_printf(&t, "%x", i)));
}
String all = S_printf(&g, "Total: %ld\n", V_count(hexes));
for (usize i = 0; i + 4 < V_count(hexes); i += 4) {
PRINT_NOTOK(
S_append(&all,
S_concat(&t,
hexes[0+i], " ", hexes[1+i], " ", hexes[2+i], " ", hexes[3+i], "\n",
NULL)));
}
printf("%s", all);
PRINT_NOTOK(g.destroy(&g));
PRINT_NOTOK(t.destroy(&t));
return 0;
}
|