Tidying progress callback implemented.
This commit is contained in:
parent
34d456aa80
commit
dcd8f16f73
|
@ -631,6 +631,9 @@ TIDY_EXPORT Bool TIDY_CALL tidyInitSink( TidyOutputSink* sink,
|
|||
TIDY_EXPORT void TIDY_CALL tidyPutByte( TidyOutputSink* sink, uint byteValue );
|
||||
|
||||
|
||||
/****************
|
||||
Errors
|
||||
****************/
|
||||
/** Callback to filter messages by diagnostic level:
|
||||
** info, warning, etc. Just set diagnostic output
|
||||
** handler to redirect all diagnostics output. Return true
|
||||
|
@ -656,6 +659,18 @@ TIDY_EXPORT int TIDY_CALL tidySetErrorBuffer( TidyDoc tdoc, TidyBuffer* errb
|
|||
/** Set error sink to given generic sink */
|
||||
TIDY_EXPORT int TIDY_CALL tidySetErrorSink( TidyDoc tdoc, TidyOutputSink* sink );
|
||||
|
||||
|
||||
/****************
|
||||
Printing
|
||||
****************/
|
||||
/** Callback to track the progress of the pretting printing process.
|
||||
**
|
||||
*/
|
||||
typedef Bool (TIDY_CALL *TidyPPProgress)( TidyDoc tdoc, uint line, uint col, uint destLine );
|
||||
|
||||
TIDY_EXPORT Bool TIDY_CALL tidySetPrettyPrinterCallback( TidyDoc tdoc,
|
||||
TidyPPProgress callback );
|
||||
|
||||
/** @} end IO group */
|
||||
|
||||
/* TODO: Catalog all messages for easy translation
|
||||
|
|
|
@ -2118,10 +2118,17 @@ void TY_(PPrintTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node )
|
|||
Node *content, *last;
|
||||
uint spaces = cfg( doc, TidyIndentSpaces );
|
||||
Bool xhtml = cfgBool( doc, TidyXhtmlOut );
|
||||
uint lastline = 0;
|
||||
|
||||
if ( node == NULL )
|
||||
return;
|
||||
|
||||
if (doc->progressCallback)
|
||||
{
|
||||
if (doc->pprint.line > lastline)
|
||||
doc->progressCallback( tidyImplToDoc(doc), node->line, node->column, doc->pprint.line );
|
||||
}
|
||||
|
||||
if (node->type == TextNode)
|
||||
{
|
||||
PPrintText( doc, mode, indent, node );
|
||||
|
|
|
@ -59,6 +59,7 @@ struct _TidyDocImpl
|
|||
TidyReportFilter mssgFilt;
|
||||
TidyReportFilter2 mssgFilt2;
|
||||
TidyOptCallback pOptCallback;
|
||||
TidyPPProgress progressCallback;
|
||||
|
||||
/* Parse + Repair Results */
|
||||
uint optionErrors;
|
||||
|
|
|
@ -752,6 +752,19 @@ int TIDY_CALL tidySetErrorSink( TidyDoc tdoc, TidyOutputSink* sink )
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Use TidyPPProgress to monitor the progress of the pretty printer.
|
||||
*/
|
||||
Bool TIDY_CALL tidySetPrettyPrinterCallback(TidyDoc tdoc, TidyPPProgress callback)
|
||||
{
|
||||
TidyDocImpl* impl = tidyDocToImpl( tdoc );
|
||||
if ( impl )
|
||||
{
|
||||
impl->progressCallback = callback;
|
||||
return yes;
|
||||
}
|
||||
return no;
|
||||
}
|
||||
|
||||
|
||||
/* Document info */
|
||||
int TIDY_CALL tidyStatus( TidyDoc tdoc )
|
||||
|
|
Loading…
Reference in a new issue