1
0
Fork 0
mirror of git://git.psyc.eu/libpsyc synced 2024-08-15 03:19:02 +00:00

death the parser

This commit is contained in:
psyc://psyced.org/~lynX 2011-05-09 09:02:15 +02:00
parent 26539cdd14
commit 36491b4886
12 changed files with 41 additions and 25 deletions

19
README
View file

@ -19,11 +19,12 @@ The "plain C API" is a very low-level API intended to be used for bindings.
To access a certain module of the library, just include the according header To access a certain module of the library, just include the according header
file from the psyc directory: file from the psyc directory:
parser.h -- parse psyc packets psyc.h -- basic things for well-being
render.h -- render psyc packets psyc/parse.h -- parse psyc packets
text.h -- text template functions psyc/render.h -- render psyc packets
packet.h -- structures for render.h and functions to initialize them psyc/text.h -- text template functions
syntax.h -- definitions and constants related to parsing and rendering psyc/packet.h -- structures for render.h and functions to initialize them
psyc/syntax.h -- definitions and constants related to parsing and rendering
== Directory Overview == == Directory Overview ==
@ -70,3 +71,11 @@ developement room at
== Licence == == Licence ==
-- To be discussed -- -- To be discussed --
== Style Wars ==
This source code should follow the http://about.psyc.eu/Indent conventions.
(if you have good reasons to use another style, discuss it on the
wiki page so that it becomes the general style convention for all
of us, not just for you).

View file

@ -17,7 +17,6 @@
*/ */
#ifndef PSYC_H #ifndef PSYC_H
# define PSYC_H
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
@ -148,4 +147,5 @@ int psyc_inherits(char *sho, size_t slen,
int psyc_matches(char *sho, size_t slen, int psyc_matches(char *sho, size_t slen,
char *lon, size_t llen); char *lon, size_t llen);
#endif // PSYC_H #define PSYC_H
#endif

View file

@ -1,8 +1,10 @@
# Why do we have a Makefile in the include directory?
prefix = /usr prefix = /usr
includedir = ${prefix}/include includedir = ${prefix}/include
INSTALL = install INSTALL = install
HEADERS = packet.h parser.h render.h syntax.h text.h HEADERS = packet.h parse.h render.h syntax.h text.h
install: ${HEADERS} install: ${HEADERS}

View file

@ -1,5 +1,4 @@
#ifndef PSYC_PACKET_H #ifndef PSYC_PACKET_H
# define PSYC_PACKET_H
#include <psyc.h> #include <psyc.h>
#include <psyc/syntax.h> #include <psyc/syntax.h>
@ -143,4 +142,5 @@ psycPacket psyc_newRawPacket2 (psycModifier *routing, size_t routinglen,
const char *content, size_t contentlen, const char *content, size_t contentlen,
psycPacketFlag flag); psycPacketFlag flag);
#endif // PSYC_PACKET_H #define PSYC_PACKET_H
#endif

View file

@ -1,5 +1,7 @@
#ifndef PSYC_PARSE_H
/** /**
* @file psyc/parser.h * @file psyc/parse.h
* @brief Interface for various PSYC parser functions. * @brief Interface for various PSYC parser functions.
* *
* All parsing functions and the definitions they use are * All parsing functions and the definitions they use are
@ -108,9 +110,6 @@
/** @{ */ // begin of parser group /** @{ */ // begin of parser group
#ifndef PSYC_PARSER_H
# define PSYC_PARSER_H
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <psyc.h> #include <psyc.h>
@ -411,6 +410,7 @@ psycParseRC psyc_parse (psycParseState *state, char *oper,
psycParseListRC psyc_parseList (psycParseListState *state, psycString *name, psycParseListRC psyc_parseList (psycParseListState *state, psycString *name,
psycString *value, psycString *elem); psycString *value, psycString *elem);
#endif // PSYC_PARSER_H
/** @} */ // end of parser group /** @} */ // end of parser group
#define PSYC_PARSE_H
#endif

View file

@ -1,5 +1,4 @@
#ifndef PSYC_RENDER_H #ifndef PSYC_RENDER_H
# define PSYC_RENDER_H
#include <psyc/packet.h> #include <psyc/packet.h>
@ -39,6 +38,7 @@ psycRenderRC psyc_render (psycPacket *packet, char *buffer, size_t buflen);
*/ */
psycRenderRC psyc_renderList (psycList *list, char *buffer, size_t buflen); psycRenderRC psyc_renderList (psycList *list, char *buffer, size_t buflen);
#endif // PSYC_RENDER_H
/** @} */ // end of render group /** @} */ // end of render group
#define PSYC_RENDER_H
#endif

View file

@ -1,5 +1,4 @@
#ifndef PSYC_SYNTAX_H #ifndef PSYC_SYNTAX_H
#define PSYC_SYNTAX_H
#ifndef PSYC_LIST_SIZE_LIMIT #ifndef PSYC_LIST_SIZE_LIMIT
# define PSYC_LIST_SIZE_LIMIT 404 # define PSYC_LIST_SIZE_LIMIT 404
@ -42,4 +41,5 @@
#define PSYC_ROUTING_MERGE 2 #define PSYC_ROUTING_MERGE 2
#define PSYC_ROUTING_RENDER 4 #define PSYC_ROUTING_RENDER 4
#endif /* PSYC_SYNTAX_H */ #define PSYC_SYNTAX_H
#endif

View file

@ -1,3 +1,5 @@
#ifndef PSYC_TEXT_H
/** /**
* @file psyc/text.h * @file psyc/text.h
* @brief Interface for text template rendering. * @brief Interface for text template rendering.
@ -157,3 +159,6 @@ size_t psyc_getTextBytesWritten (psycTextState *state)
psycTextRC psyc_text (psycTextState *state, psycTextCB getValue); psycTextRC psyc_text (psycTextState *state, psycTextCB getValue);
/** @} */ // end of text group /** @} */ // end of text group
#define PSYC_TEXT_H
#endif

View file

@ -4,8 +4,8 @@
# define PSYC_LIB_H # define PSYC_LIB_H
#include <psyc.h> #include <psyc.h>
#include "./debug.h"
#include <assert.h> #include <assert.h>
#include "debug.h"
/* perlisms for readability */ /* perlisms for readability */
#define unless(COND) if (!(COND)) #define unless(COND) if (!(COND))

View file

@ -6,7 +6,7 @@
#endif #endif
#include "lib.h" #include "lib.h"
#include <psyc/parser.h> #include <psyc/parse.h>
#define ADVANCE_CURSOR_OR_RETURN(ret) \ #define ADVANCE_CURSOR_OR_RETURN(ret) \
if (++(state->cursor) >= state->buffer.length) \ if (++(state->cursor) >= state->buffer.length) \

View file

@ -3,7 +3,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <psyc.h> #include <psyc.h>
#include <psyc/parser.h> #include <psyc/parse.h>
int main (int argc, char **argv) int main (int argc, char **argv)
{ {

View file

@ -21,7 +21,7 @@
#include <assert.h> #include <assert.h>
#include <psyc.h> #include <psyc.h>
#include <psyc/parser.h> #include <psyc/parse.h>
#include <psyc/render.h> #include <psyc/render.h>
#include <psyc/syntax.h> #include <psyc/syntax.h>