| T X T _ S K I P C C ( )
| | | | | SOURCE: qdev_autodocs.txt 1.163 (12/09/2014) English
INDEP - TXT_#?
----------------------------------------------------------------------------
NAME
txt_skipcc() - Skips C-style comments in NULL term.
strings in a special manner.
SYNOPSIS
output = txt_skipcc(string, sf);
UBYTE *txt_skipcc(UBYTE *, struct txt_scc_form *);
FUNCTION
This function allows to skip C-style comments in the
strings or even in whole data streams as delivered in
line or block chunks.
INPUTS
string - NULL terminated string to be parsed.
sf - Feed form structure that is described in
the header file.
RETURNS
Returns pointer to a string that is free of comments
nearby. It should never return NULL under normal
circumstances.
BASES
None.
NOTES
This function allows to process comments that are
within comments.
This function needs special preparation before it can
be used, so it is advised to use macros.
This function does not modify input data in any way,
but data termination is a must which can be done on
the outside.
Imbalance in closing comments may cause whole parsing
not to return any data beyond the point when it had
its start! You have to start and end any comment with
just a bit of care(standard)! You can always look in
'sf_comm' to see if comments are messed up.
Beware! When working on streams and/or data blocks
make sure that the buffer is '/*' and '*/' synced at
all times! Buffer must not end with just '/' or '*',
cus another fill may kill the comment marker!
SEE ALSO
EXAMPLE
...
UBYTE *data = "This text/*string!*/ contains"
"/*/*/*/*/*/*weird*/*/*/*/*/*/"
" comments at the source level"
" /*yes, sir!*/that should be"
" invisible after the execution"
"/*exactly!*/!\n";
QDEV_TXT_SKIPCCTYPE(sf);
QDEV_TXT_SKIPCCINIT(sf);
QDEV_TXT_SKIPCCITER(data, sf)
{
/*
* This destroys the data, but hopefully can be very
* easily reversed!
*/
if (sf.sf_start)
{
*sf.sf_start = '\0';
}
/*
* This sort of check is essential, always do it this
* way!
*/
if (*sf.sf_ptr)
{
printf("%s", sf.sf_ptr);
}
}
BUGS
None known.
----------------------------------------------------------------------------
| |
| |