[ADD/WIP] Codenames, try to get codeblocks basics

Mostly focused on the LMDB support right now, sorry!
This commit is contained in:
LDA 2024-08-10 09:52:11 +02:00
commit 61b248363d
7 changed files with 42 additions and 10 deletions

View file

@ -225,13 +225,14 @@ StrViewLines(StringRect view)
return view.end_line - view.start_line + 1;
}
void
PrintRect(StringRect rect)
char *
StrViewToStr(StringRect rect)
{
size_t i;
char *ret = NULL, *rtmp;
if (!rect.source_lines)
{
return;
return NULL;
}
for (i = 0; i < StrViewLines(rect); i++)
@ -239,16 +240,22 @@ PrintRect(StringRect rect)
char *line = NULL, *tmp;
char cbuf[2] = { 0, '\0' };
size_t chi = 0;
bool last = i == StrViewLines(rect) - 1;
while ((*cbuf = StrGet(&rect, i, chi)) != '\0' &&
chi++ <= StrViewChars(rect, i))
{
tmp = line;
rtmp = line;
line = StrConcat(2, line, cbuf);
Free(tmp);
Free(rtmp);
}
Log(LOG_INFO, line);
tmp = ret;
ret = StrConcat(3, ret, line, last ? "\n" : "\n");
Free(tmp);
Free(line);
}
return ret;
}