mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 21:35: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
|
|
@ -38,11 +38,12 @@ Main(void)
|
|||
Cron *cron = NULL;
|
||||
|
||||
start = UtilTsMillis();
|
||||
/* TODO: Read args(config file, HTTP/XMPP threads, ...) */
|
||||
|
||||
memset(&conf, 0, sizeof(conf));
|
||||
Log(LOG_INFO,
|
||||
"%s - v%s (Cytoplasm %s)",
|
||||
NAME, VERSION, CytoplasmGetVersionStr()
|
||||
"%s - v%s[%s] (Cytoplasm %s)",
|
||||
NAME, VERSION, CODE, CytoplasmGetVersionStr()
|
||||
);
|
||||
Log(LOG_INFO, "=======================");
|
||||
LogConfigIndent(LogConfigGlobal());
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ DecodeQuote(StringRect rect, size_t *skip)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static StringRect
|
||||
DecodeSpan(StringRect rect, char del, size_t *skip)
|
||||
{
|
||||
|
|
@ -300,6 +301,18 @@ ShoveXML(XEP393Element *element, XMLElement *xmlparent)
|
|||
return;
|
||||
}
|
||||
|
||||
if (element->type == XEP393_CODE)
|
||||
{
|
||||
XMLElement *pre, *code, *text;
|
||||
pre = XMLCreateTag("pre");
|
||||
code = XMLCreateTag("code");
|
||||
text = XMLCreateText(element->text_data);
|
||||
XMLAddChild(code, text);
|
||||
XMLAddChild(pre, code);
|
||||
XMLAddChild(xmlparent, pre);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (element->type)
|
||||
{
|
||||
case XEP393_ITALIC:
|
||||
|
|
|
|||
|
|
@ -57,5 +57,5 @@ extern StringRect StrShift(StringRect rect, int n);
|
|||
extern size_t StrViewLines(StringRect);
|
||||
extern size_t StrViewChars(StringRect, int line);
|
||||
|
||||
extern void PrintRect(StringRect rect);
|
||||
extern char * StrViewToStr(StringRect rect);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ typedef enum XEP393Type {
|
|||
XEP393_EMPH,
|
||||
XEP393_SRKE,
|
||||
XEP393_MONO,
|
||||
XEP393_CODE,
|
||||
XEP393_TEXT,
|
||||
XEP393_QUOT,
|
||||
XEP393_LINE,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
#ifndef PARSEE_FORM_H
|
||||
#define PARSEE_FORM_H
|
||||
|
||||
/*-*
|
||||
* This is a szt of macros to handle XML forms. Aya does not yet support
|
||||
* macros. TODO!
|
||||
* --------
|
||||
* Written-By: LDA */
|
||||
|
||||
#define Report(id, label) do \
|
||||
{ \
|
||||
field = XMLCreateTag("field"); \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue