mirror of
git://git.psyc.eu/libpsyc
synced 2024-08-15 03:19:02 +00:00
text: moved inline functions to .h, fixed warnings
This commit is contained in:
parent
51c95d0858
commit
c92bfd3a91
3 changed files with 44 additions and 50 deletions
|
@ -38,21 +38,46 @@ typedef struct
|
|||
* number of bytes written. 0 is a legal return value. Should the
|
||||
* callback return -1, psyc_text leaves the original template text as is.
|
||||
*/
|
||||
typedef psycTextValueRC (*psycTextCB)(char *name, size_t len, psycString *value);
|
||||
typedef psycTextValueRC (*psycTextCB)(const char *name, size_t len, psycString *value);
|
||||
|
||||
inline void psyc_initTextState (psycTextState *state,
|
||||
char *template, size_t tlen,
|
||||
char *buffer, size_t blen);
|
||||
static inline
|
||||
void psyc_initTextState (psycTextState *state,
|
||||
char *template, size_t tlen,
|
||||
char *buffer, size_t blen)
|
||||
{
|
||||
state->cursor = state->written = 0;
|
||||
state->template = psyc_newString(template, tlen);
|
||||
state->buffer = psyc_newString(buffer, blen);
|
||||
state->open = psyc_newString("[", 1);
|
||||
state->close = psyc_newString("]", 1);
|
||||
}
|
||||
|
||||
inline void psyc_initTextState2 (psycTextState* state,
|
||||
char *template, size_t tlen,
|
||||
char *buffer, size_t blen,
|
||||
char *open, size_t openlen,
|
||||
char *close, size_t closelen);
|
||||
static inline
|
||||
void psyc_initTextState2 (psycTextState* state,
|
||||
char *template, size_t tlen,
|
||||
char *buffer, size_t blen,
|
||||
char *open, size_t openlen,
|
||||
char *close, size_t closelen)
|
||||
{
|
||||
state->template = psyc_newString(template, tlen);
|
||||
state->buffer = psyc_newString(buffer, blen);
|
||||
state->open = psyc_newString(open, openlen);
|
||||
state->close = psyc_newString(close, closelen);
|
||||
}
|
||||
|
||||
inline void psyc_setTextBuffer (psycTextState *state, psycString buffer);
|
||||
static inline
|
||||
void psyc_setTextBuffer (psycTextState* state, psycString buffer)
|
||||
{
|
||||
state->buffer = buffer;
|
||||
state->written = 0;
|
||||
}
|
||||
|
||||
inline void psyc_setTextBuffer2 (psycTextState *state, char *buffer, size_t length);
|
||||
static inline
|
||||
void psyc_setTextBuffer2 (psycTextState* state,
|
||||
char *buffer, size_t length)
|
||||
{
|
||||
psyc_setTextBuffer(state, psyc_newString(buffer, length));
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills out text templates by asking a callback for content.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue