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

table rendering

This commit is contained in:
tg(x) 2011-11-26 15:03:10 +01:00
parent 2e242d4f47
commit d0b3b85924
9 changed files with 90 additions and 48 deletions

View file

@ -89,6 +89,12 @@ typedef struct {
PsycListFlag flag;
} PsycList;
typedef struct {
PsycList *list;
size_t width;
size_t length;
} PsycTable;
/** Intermediate struct for a PSYC packet */
typedef struct {
PsycHeader routing; ///< Routing header.
@ -177,12 +183,16 @@ psyc_packet_length_check (PsycPacket *p);
size_t
psyc_packet_length_set (PsycPacket *p);
/** Initialize list. */
/** Initialize a list. */
void
psyc_list_init (PsycList *list, PsycString *elems, size_t num_elems,
PsycListFlag flag);
/** Initialize packet. */
/** Initialize a table. */
void
psyc_table_init (PsycTable *table, size_t width, PsycList *list);
/** Initialize a packet. */
void
psyc_packet_init (PsycPacket *packet,
PsycModifier *routing, size_t routinglen,

View file

@ -31,16 +31,6 @@ typedef enum {
PSYC_RENDER_SUCCESS = 0,
} PsycRenderRC;
/**
* Return codes for psyc_render_list.
*/
typedef enum {
/// Error, buffer is too small to render the list.
PSYC_RENDER_LIST_ERROR = -1,
/// List is rendered successfully in the buffer.
PSYC_RENDER_LIST_SUCCESS = 0,
} PsycRenderListRC;
/**
* Render a PSYC packet into a buffer.
*
@ -67,9 +57,12 @@ psyc_render (PsycPacket *packet, char *buffer, size_t buflen);
#ifdef __INLINE_PSYC_RENDER
static inline
#endif
PsycRenderListRC
PsycRenderRC
psyc_render_list (PsycList *list, char *buffer, size_t buflen);
PsycRenderRC
psyc_render_table (PsycTable *table, char *buffer, size_t buflen);
/** @} */ // end of render group
#endif