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 );
|
TIDY_EXPORT void TIDY_CALL tidyPutByte( TidyOutputSink* sink, uint byteValue );
|
||||||
|
|
||||||
|
|
||||||
|
/****************
|
||||||
|
Errors
|
||||||
|
****************/
|
||||||
/** Callback to filter messages by diagnostic level:
|
/** Callback to filter messages by diagnostic level:
|
||||||
** info, warning, etc. Just set diagnostic output
|
** info, warning, etc. Just set diagnostic output
|
||||||
** handler to redirect all diagnostics output. Return true
|
** 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 */
|
/** Set error sink to given generic sink */
|
||||||
TIDY_EXPORT int TIDY_CALL tidySetErrorSink( TidyDoc tdoc, TidyOutputSink* 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 */
|
/** @} end IO group */
|
||||||
|
|
||||||
/* TODO: Catalog all messages for easy translation
|
/* 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;
|
Node *content, *last;
|
||||||
uint spaces = cfg( doc, TidyIndentSpaces );
|
uint spaces = cfg( doc, TidyIndentSpaces );
|
||||||
Bool xhtml = cfgBool( doc, TidyXhtmlOut );
|
Bool xhtml = cfgBool( doc, TidyXhtmlOut );
|
||||||
|
uint lastline = 0;
|
||||||
|
|
||||||
if ( node == NULL )
|
if ( node == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (doc->progressCallback)
|
||||||
|
{
|
||||||
|
if (doc->pprint.line > lastline)
|
||||||
|
doc->progressCallback( tidyImplToDoc(doc), node->line, node->column, doc->pprint.line );
|
||||||
|
}
|
||||||
|
|
||||||
if (node->type == TextNode)
|
if (node->type == TextNode)
|
||||||
{
|
{
|
||||||
PPrintText( doc, mode, indent, node );
|
PPrintText( doc, mode, indent, node );
|
||||||
|
|
|
@ -59,6 +59,7 @@ struct _TidyDocImpl
|
||||||
TidyReportFilter mssgFilt;
|
TidyReportFilter mssgFilt;
|
||||||
TidyReportFilter2 mssgFilt2;
|
TidyReportFilter2 mssgFilt2;
|
||||||
TidyOptCallback pOptCallback;
|
TidyOptCallback pOptCallback;
|
||||||
|
TidyPPProgress progressCallback;
|
||||||
|
|
||||||
/* Parse + Repair Results */
|
/* Parse + Repair Results */
|
||||||
uint optionErrors;
|
uint optionErrors;
|
||||||
|
|
|
@ -752,6 +752,19 @@ int TIDY_CALL tidySetErrorSink( TidyDoc tdoc, TidyOutputSink* sink )
|
||||||
return -EINVAL;
|
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 */
|
/* Document info */
|
||||||
int TIDY_CALL tidyStatus( TidyDoc tdoc )
|
int TIDY_CALL tidyStatus( TidyDoc tdoc )
|
||||||
|
|
Loading…
Reference in a new issue