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

added function setParseFlags

This commit is contained in:
Marenz 2011-05-15 20:36:16 +02:00
parent ec23faa4ae
commit 51b3dc3a66
2 changed files with 38 additions and 2 deletions

View file

@ -133,17 +133,34 @@ struct ParseState
* Params: * Params:
* flags = Flags to be set for the parser, see ParseFlag. * flags = Flags to be set for the parser, see ParseFlag.
*/ */
static ParseState opCall ( ubyte flags ) static ParseState opCall ( ParseFlag flags )
{ {
ParseState inst; ParseState inst;
inst.flags = flags; inst.flags = flags;
if (flags & ParseFlag.ROUTING_ONLY) if (flags & ParseFlag.START_AT_CONTENT)
inst.part = Part.CONTENT; inst.part = Part.CONTENT;
return inst; return inst;
} }
/**
* Change parse flags in state
*
* Params:
* state = Pointer to the state struct that should be initialized.
* flags = Flags to be set for the parser, see psycParseFlag.
*
* See_Also: psyc_initParseState psycParseFlag
*/
void setParseFlags (ParseFlag flags)
{
this.flags = flags;
if (flags & ParseFlag.START_AT_CONTENT)
this.part = Part.CONTENT;
}
/** /**
* Sets a new buffer in the parser state struct with data to be parsed. * Sets a new buffer in the parser state struct with data to be parsed.
* *

View file

@ -268,6 +268,25 @@ void psyc_initParseState2 (psycParseState *state, uint8_t flags)
state->part = PSYC_PART_CONTENT; state->part = PSYC_PART_CONTENT;
} }
/**
* Change parse flags in state
*
* @param state Pointer to the state struct that should be initialized.
* @param flags Flags to be set for the parser, see psycParseFlag.
* @see psyc_initParseState
* @see psycParseFlag
*/
static inline
void psyc_setParseFlags (psycParseState *state, uint8_t flags)
{
state->flags = flags;
if (flags & PSYC_PARSE_START_AT_CONTENT)
state->part = PSYC_PART_CONTENT;
}
/** /**
* Sets a new buffer in the parser state struct with data to be parsed. * Sets a new buffer in the parser state struct with data to be parsed.
* *