mirror of
git://git.psyc.eu/libpsyc
synced 2024-08-15 03:19:02 +00:00
functions for creating packet & modifier structs, rendering
This commit is contained in:
parent
e047884a0d
commit
3afb723bf8
13 changed files with 267 additions and 99 deletions
|
@ -1,6 +1,6 @@
|
|||
CFLAGS=-I../include -DDEBUG -g -O0 -Wall
|
||||
LDFLAGS=-L../src
|
||||
LOADLIBES=-lpsyc
|
||||
LOADLIBES=-lpsyc -lm
|
||||
TARGETS=testParser testMatch testRender isRoutingVar
|
||||
|
||||
all: $(TARGETS)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
char* vars[] =
|
||||
const char* vars[] =
|
||||
{
|
||||
"_source",
|
||||
"_source_relay",
|
||||
|
@ -19,6 +19,7 @@ int main(int argc, char** argv)
|
|||
int i;
|
||||
for (i = 0; i < sizeof(vars) / sizeof(*vars); i++)
|
||||
{
|
||||
printf(">> %s: %ld %ld\n", vars[i], sizeof(vars[i]), sizeof(*vars[i]));
|
||||
printf("%s: %d\n", vars[i], PSYC_isRoutingVar(vars[i], strlen(vars[i])));
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ int main(int argc, char** argv)
|
|||
{
|
||||
int index, ret;
|
||||
char buffer[2048], oper;
|
||||
PSYC_Array name, value, elem;
|
||||
PSYC_String name, value, elem;
|
||||
PSYC_ParseState state;
|
||||
PSYC_ParseListState listState;
|
||||
|
||||
|
@ -22,7 +22,7 @@ int main(int argc, char** argv)
|
|||
write(1, ">> PARSE\n", 9);
|
||||
|
||||
PSYC_initParseState(&state);
|
||||
PSYC_nextParseBuffer(&state, PSYC_createArray(buffer, index));
|
||||
PSYC_nextParseBuffer(&state, PSYC_newString(buffer, index));
|
||||
|
||||
// try parsing that now
|
||||
while ((ret = PSYC_parse(&state, &oper, &name, &value)))
|
||||
|
|
|
@ -19,13 +19,13 @@ int writePresence(const char *avail, int availlen, const char *desc, int desclen
|
|||
}
|
||||
// if (PSYC_initBuffer(pb, WHATEVER)) die("PSYC_initBuffer hates me");
|
||||
|
||||
(void) PSYC_renderVar(pb, "_context", 0,
|
||||
(void) PSYC_renderModifier(pb, "_context", 0,
|
||||
myUNI, sizeof(myUNI), PSYC_RENDER_ROUTING, 0);
|
||||
|
||||
// the first call to PSYC_renderHeader() without PSYC_RENDER_ROUTING adds the
|
||||
// extra newline to the buffer. later vars with PSYC_RENDER_ROUTING cause an error.
|
||||
(void) PSYC_renderVar(pb, "_degree_availability", 0, avail, availlen, 0, C_GLYPH_OPERATOR_ASSIGN);
|
||||
(void) PSYC_renderVar(pb, "_description_presence", 0, desc, desclen, 0, C_GLYPH_OPERATOR_ASSIGN);
|
||||
(void) PSYC_renderModifier(pb, "_degree_availability", 0, avail, availlen, 0, C_GLYPH_OPERATOR_ASSIGN);
|
||||
(void) PSYC_renderModifier(pb, "_description_presence", 0, desc, desclen, 0, C_GLYPH_OPERATOR_ASSIGN);
|
||||
// presence is to be assigned permanently in distributed state
|
||||
|
||||
(void) PSYC_renderBody(pb, "_notice_presence", 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue