[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

@ -5,8 +5,12 @@
# =========================== Parsee Flags ============================= # =========================== Parsee Flags =============================
# phantasmagoria - test runs without an actual code
CODE=phantasmagoria
NAME=Parsee NAME=Parsee
VERSION=0.0.0 VERSION=0.0.0
REPOSITORY=$(shell git remote get-url origin) REPOSITORY=$(shell git remote get-url origin)
# =========================== Compilation Flags ============================ # =========================== Compilation Flags ============================
@ -22,7 +26,7 @@ AYAS=ayaya
ETC=etc ETC=etc
INCLUDES=src/include INCLUDES=src/include
CC=cc CC=cc
CFLAGS=-I$(SOURCE) -I$(INCLUDES) -I$(CYTO_INC) -DNAME="\"$(NAME)\"" -DVERSION="\"$(VERSION)\"" -DREPOSITORY=\"$(REPOSITORY)\" -g -ggdb -Wall -Werror CFLAGS=-I$(SOURCE) -I$(INCLUDES) -I$(CYTO_INC) -DNAME="\"$(NAME)\"" -DVERSION="\"$(VERSION)\"" -DREPOSITORY=\"$(REPOSITORY)\" -DCODE=\"$(CODE)\" -g -ggdb -Wall -Werror
LDFLAGS=-L $(CYTO_LIB) -lCytoplasm -g -ggdb LDFLAGS=-L $(CYTO_LIB) -lCytoplasm -g -ggdb
AFLAGS=-C "$(ETC)/ayadoc/style.css" -p "$(NAME)" AFLAGS=-C "$(ETC)/ayadoc/style.css" -p "$(NAME)"
BINARY=parsee BINARY=parsee

View file

@ -38,11 +38,12 @@ Main(void)
Cron *cron = NULL; Cron *cron = NULL;
start = UtilTsMillis(); start = UtilTsMillis();
/* TODO: Read args(config file, HTTP/XMPP threads, ...) */
memset(&conf, 0, sizeof(conf)); memset(&conf, 0, sizeof(conf));
Log(LOG_INFO, Log(LOG_INFO,
"%s - v%s (Cytoplasm %s)", "%s - v%s[%s] (Cytoplasm %s)",
NAME, VERSION, CytoplasmGetVersionStr() NAME, VERSION, CODE, CytoplasmGetVersionStr()
); );
Log(LOG_INFO, "======================="); Log(LOG_INFO, "=======================");
LogConfigIndent(LogConfigGlobal()); LogConfigIndent(LogConfigGlobal());

View file

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

View file

@ -103,6 +103,7 @@ DecodeQuote(StringRect rect, size_t *skip)
return ret; return ret;
} }
static StringRect static StringRect
DecodeSpan(StringRect rect, char del, size_t *skip) DecodeSpan(StringRect rect, char del, size_t *skip)
{ {
@ -300,6 +301,18 @@ ShoveXML(XEP393Element *element, XMLElement *xmlparent)
return; 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) switch (element->type)
{ {
case XEP393_ITALIC: case XEP393_ITALIC:

View file

@ -57,5 +57,5 @@ extern StringRect StrShift(StringRect rect, int n);
extern size_t StrViewLines(StringRect); extern size_t StrViewLines(StringRect);
extern size_t StrViewChars(StringRect, int line); extern size_t StrViewChars(StringRect, int line);
extern void PrintRect(StringRect rect); extern char * StrViewToStr(StringRect rect);
#endif #endif

View file

@ -14,6 +14,7 @@ typedef enum XEP393Type {
XEP393_EMPH, XEP393_EMPH,
XEP393_SRKE, XEP393_SRKE,
XEP393_MONO, XEP393_MONO,
XEP393_CODE,
XEP393_TEXT, XEP393_TEXT,
XEP393_QUOT, XEP393_QUOT,
XEP393_LINE, XEP393_LINE,

View file

@ -1,6 +1,12 @@
#ifndef PARSEE_FORM_H #ifndef PARSEE_FORM_H
#define 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 \ #define Report(id, label) do \
{ \ { \
field = XMLCreateTag("field"); \ field = XMLCreateTag("field"); \