This commit is contained in:
Daniel Ledda
2025-01-02 18:20:56 +01:00
parent 39ff16b6a6
commit 49e379dd54
9 changed files with 80 additions and 44 deletions

22
app.cpp
View File

@@ -1,5 +1,6 @@
#include <stdio.h>
#include "core.cpp"
#include "core.h"
int main(int argc, char **argv) {
int statusCode = 0;
@@ -7,14 +8,23 @@ int main(int argc, char **argv) {
Arena *arena = arenaAlloc(Megabytes(64));
list<string> args = getArgs(arena, argc, argv);
log(strSplit(arena, strlit("-"), strlit("hallo-world")));
log(strSplit(arena, "-"_s, "hallo-world"_s));
while (true) {
size_t arenaPos = arena->head;
string line = PushString(arena, 128);
fgets(line.str, (int)line.length, stdin);
log(strSplit(arena, strlit("-"), line));
arenaFreeFrom(arena, arenaPos);
string line;
list<string> split;
WithScratch(temp) {
line = PushString(temp.arena, 128);
fgets(line.str, (int)line.length, stdin);
split = strSplit(temp.arena, "-"_s, line);
}
if (line.str[0] == '\n' && line.str[1] == '\0') {
break;
} else {
log(split);
}
}
return statusCode;