mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 19:55:10 +00:00
[ADD/WIP] Codenames, try to get codeblocks basics
Mostly focused on the LMDB support right now, sorry!
This commit is contained in:
parent
93d7b0f8e0
commit
61b248363d
7 changed files with 42 additions and 10 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue