From cf3150a461e1d7ea09cb43388b8a49a9706ce153 Mon Sep 17 00:00:00 2001 From: "tg(x)" <*@tg-x.net> Date: Sun, 1 May 2011 00:30:25 +0200 Subject: [PATCH] render: removed old code --- include/psyc/render.h | 42 ------------------------ src/render.c | 74 ------------------------------------------- 2 files changed, 116 deletions(-) diff --git a/include/psyc/render.h b/include/psyc/render.h index c54a2b8..c880125 100644 --- a/include/psyc/render.h +++ b/include/psyc/render.h @@ -36,48 +36,6 @@ psycRenderRC psyc_render(psycPacket *packet, char *buffer, size_t buflen); */ inline psycRenderRC psyc_renderList(psycList *list, char *buffer, size_t buflen); -/* -typedef enum -{ - PSYC_RENDER_CHECK_LENGTH = 0, - PSYC_RENDER_NEED_LENGTH = 1, - PSYC_RENDER_NO_LENGTH = 2, - PSYC_RENDER_ROUTING = 3, -} psycRenderFlag; -*/ - -/** - * Struct for keeping render state. - */ -/* -typedef struct -{ - psycRenderFlag flag; ///< flags for the renderer - psycPart part; ///< part of the packet being rendered - size_t cursor; ///< current position in buffer - size_t spot; ///< space for rendered length between the headers - size_t contentLength; ///< length of the content part - size_t length; ///< how big is the buffer we allocated - char buffer[]; ///< OMG a C99 feature! variable size buffer! -} psycRenderState; -*/ -/** - * Initiates the state struct. - * - * @param state Pointer to the state struct that should be initiated. - */ -/* -inline void psyc_initRenderState (psycRenderState* state); - -int psyc_renderModifier(psycRenderState* render, - const char* name, size_t nlength, - const char* value, size_t vlength, - psycRenderFlag flags, char oper); - -int psyc_renderBody(psycRenderState* render, - const char* method, size_t mlength, - const char* data, size_t dlength); -*/ #endif // PSYC_RENDER_H /** @} */ // end of rendering group diff --git a/src/render.c b/src/render.c index b7a6773..c12c06b 100644 --- a/src/render.c +++ b/src/render.c @@ -102,77 +102,3 @@ psycRenderRC psyc_render(psycPacket *packet, char *buffer, size_t buflen) assert(cur == packet->length); return PSYC_RENDER_SUCCESS; } - -/* -inline void psyc_initRenderState (psycRenderState *state) -{ - memset(state, 0, sizeof(psycRenderState)); -} - -psycRenderRC psyc_renderModifier(psycRenderState *state, - const char *name, size_t nlength, - const char *value, size_t vlength, - const psycRenderFlag flags, char oper) -{ - size_t startc = state->cursor; - - unless (nlength) nlength = strlen(name); - // vlength 0 means an empty variable.. no cheating there - unless (oper) oper = C_GLYPH_OPERATOR_SET; - - state->buffer[state->cursor++] = oper; - strncpy(&state->buffer[state->cursor], name, nlength); - state->cursor += nlength; - - if (vlength) - { - state->buffer[state->cursor++] = '\t'; - strncpy(&state->buffer[state->cursor], value, vlength); - state->cursor += vlength; - } - - //if (flags == PSYC_RENDER_ROUTING) - if (psyc_isRoutingVar(name, nlength)) - { // no more routing headers allowed after content started - if (state->part != PSYC_PART_ROUTING) - { - P1(("Too late to add a routing variable!\n")); - return PSYC_RENDER_ERROR_ROUTING; - } - } - else if (state->part == PSYC_PART_ROUTING) - { // first entity header, set part to content - state->part = PSYC_PART_CONTENT; - // add "\n000000000" to buffer - // and make spot point to the first 0 - } - - // update content length if we're in the content part - if (state->part == PSYC_PART_CONTENT) - state->contentLength += state->cursor - startc; - - return PSYC_RENDER_SUCCESS; -} - -psycRenderRC psyc_renderBody(psycRenderState *state, - const char *method, size_t mlength, - const char *data, size_t dlength) -{ - if (state->flag == PSYC_RENDER_CHECK_LENGTH) - { - // find out if this packet needs a prepended length - if (dlength == 1 && data[0] == C_GLYPH_PACKET_DELIMITER) - state->flag = PSYC_RENDER_NEED_LENGTH; - else if (dlength > 404) - state->flag = PSYC_RENDER_NEED_LENGTH; - else if (memmem(data, dlength, PSYC_C2ARG(PSYC_PACKET_DELIMITER))) - state->flag = PSYC_RENDER_NEED_LENGTH; - else - state->flag = PSYC_RENDER_NO_LENGTH; - } - - // TBD - - return PSYC_RENDER_SUCCESS; -} -*/