Merge branch 'next' into deprecation_mechanism

This commit is contained in:
Jim Derry 2017-10-07 14:59:35 -04:00
commit 217d05fe49
12 changed files with 137 additions and 134 deletions

View file

@ -136,12 +136,22 @@ endif ()
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# Memory Diagnostics # Diagnostics
# Enable building with some memory diagnostics. # Enable building with logs, some memory diagnostics.
#
# NOTE: Currently only available in the Debug configuration build in
# Windows, but could be maybe extended to Unix, others...
#------------------------------------------------------------------------ #------------------------------------------------------------------------
if (MSVC AND NOT CMAKE_BUILD_TYPE MATCHES Release)
option( ENABLE_DEBUG_LOG "Set ON to output debugging messages." ON )
else ()
option( ENABLE_DEBUG_LOG "Set ON to output debugging messages." OFF )
endif ()
if ( ENABLE_DEBUG_LOG )
add_definitions( -DENABLE_DEBUG_LOG )
message(STATUS "*** Debug Logging is enabled.")
else ()
message(STATUS "*** Debug Logging is NOT enabled.")
endif ()
option( ENABLE_ALLOC_DEBUG "Set ON to output node allocation diagnostics." OFF ) option( ENABLE_ALLOC_DEBUG "Set ON to output node allocation diagnostics." OFF )
option( ENABLE_MEMORY_DEBUG "Set ON to output some memory diagnostics." OFF ) option( ENABLE_MEMORY_DEBUG "Set ON to output some memory diagnostics." OFF )
@ -150,10 +160,10 @@ if (ENABLE_ALLOC_DEBUG)
message(STATUS "*** Note, lexer.c node allocation diagnostics are ON") message(STATUS "*** Note, lexer.c node allocation diagnostics are ON")
endif () endif ()
if (ENABLE_MEMORY_DEBUG) if (ENABLE_MEMORY_DEBUG)
add_definitions ( -DDEBUG_MEMORY ) # see alloc.c for details add_definitions ( -DDEBUG_MEMORY ) # see alloc.c for details
message(STATUS "*** Note, alloc.c memory diagnostics are ON") message(STATUS "*** Note, alloc.c memory diagnostics are ON")
endif () endif ()
if (WIN32) if (WIN32)
option( ENABLE_CRTDBG_MEMORY "Set ON to enable the Windows CRT debug library." OFF ) option( ENABLE_CRTDBG_MEMORY "Set ON to enable the Windows CRT debug library." OFF )

View file

@ -21,17 +21,21 @@
#include "tidy.h" #include "tidy.h"
#include "tidybuffio.h" #include "tidybuffio.h"
#include "locale.h" /* for determing and setting locale */ #include "locale.h"
#if defined(_WIN32) #if defined(_WIN32)
# include <windows.h> /* Force console to UTF8. */ # include <windows.h> /* Force console to UTF8. */
#endif #endif
#if !defined(NDEBUG) && defined(_MSC_VER) && defined(_CRTDBG_MAP_ALLOC)
#ifdef ENABLE_DEBUG_LOG
# include "sprtf.h"
#endif
#if defined(ENABLE_DEBUG_LOG) && defined(_MSC_VER) && defined(_CRTDBG_MAP_ALLOC)
# include <stdlib.h> # include <stdlib.h>
# include <crtdbg.h> # include <crtdbg.h>
#endif #endif
#include "sprtf.h"
/** Tidy will send errors to this file, which will be stderr later. */ /** Tidy will send errors to this file, which will be stderr later. */
static FILE* errout = NULL; static FILE* errout = NULL;
@ -2008,7 +2012,7 @@ int main( int argc, char** argv )
uint contentWarnings = 0; uint contentWarnings = 0;
uint accessWarnings = 0; uint accessWarnings = 0;
#if !defined(NDEBUG) && defined(_MSC_VER) #if defined(ENABLE_DEBUG_LOG) && defined(_MSC_VER)
# if defined(_CRTDBG_MAP_ALLOC) # if defined(_CRTDBG_MAP_ALLOC)
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
# endif # endif
@ -2426,9 +2430,7 @@ int main( int argc, char** argv )
if ( argc > 1 ) if ( argc > 1 )
{ {
htmlfil = argv[1]; htmlfil = argv[1];
#if (!defined(NDEBUG)) DEBUG_LOG( SPRTF("Tidying '%s'\n", htmlfil) );
SPRTF("Tidying '%s'\n", htmlfil);
#endif /* DEBUG outout */
if ( tidyOptGetBool(tdoc, TidyEmacs) ) if ( tidyOptGetBool(tdoc, TidyEmacs) )
tidySetEmacsFile( tdoc, htmlfil ); tidySetEmacsFile( tdoc, htmlfil );
status = tidyParseFile( tdoc, htmlfil ); status = tidyParseFile( tdoc, htmlfil );
@ -2458,7 +2460,7 @@ int main( int argc, char** argv )
if ( outfil ) { if ( outfil ) {
status = tidySaveFile( tdoc, outfil ); status = tidySaveFile( tdoc, outfil );
} else { } else {
#if !defined(NDEBUG) #ifdef ENABLE_DEBUG_LOG
static char tmp_buf[264]; static char tmp_buf[264];
sprintf(tmp_buf,"%s.html",get_log_file()); sprintf(tmp_buf,"%s.html",get_log_file());
status = tidySaveFile( tdoc, tmp_buf ); status = tidySaveFile( tdoc, tmp_buf );

View file

@ -654,15 +654,18 @@ opaque_type( TidyIterator );
/*============================================================================= /*=============================================================================
* Debugging * Debugging
* When building and not defining the NDEBUG macro, Tidy will output * When building and defining the ENABLE_DEBUG_LOG macro, Tidy will output
* extensive debug information. In addition to this macro, you can supply * extensive debug information. In addition to this macro, you can supply
* build flags for additional diagnostic information: * build flags for additional diagnostic information:
* - _CRTDBG_MAP_ALLOC (_MSC_VER only) * - _CRTDBG_MAP_ALLOC (_MSC_VER only)
* - DEBUG_ALLOCATION * - DEBUG_ALLOCATION
* - DEBUG_MEMORY * - DEBUG_MEMORY
*
* You can use DEBUG_LOG( SPRTF() ) to avoid #ifdef ENABLE_DEBUG_LOG for
* one-liners.
*===========================================================================*/ *===========================================================================*/
#if !defined(NDEBUG) #ifdef ENABLE_DEBUG_LOG
# include "sprtf.h" # include "sprtf.h"
#endif #endif
@ -670,6 +673,11 @@ opaque_type( TidyIterator );
# define SPRTF printf # define SPRTF printf
#endif #endif
#ifdef ENABLE_DEBUG_LOG
# define DEBUG_LOG(ARG) do { ARG; } while(0)
#else
# define DEBUG_LOG(ARG)
#endif
#endif /* __TIDY_PLATFORM_H__ */ #endif /* __TIDY_PLATFORM_H__ */

View file

@ -15,7 +15,7 @@ static TidyRealloc g_realloc = NULL;
static TidyFree g_free = NULL; static TidyFree g_free = NULL;
static TidyPanic g_panic = NULL; static TidyPanic g_panic = NULL;
#if !defined(NDEBUG) && defined(DEBUG_MEMORY) #if defined(ENABLE_DEBUG_LOG) && defined(DEBUG_MEMORY)
static int alloccnt = 0; static int alloccnt = 0;
static int realloccnt = 0; static int realloccnt = 0;
static int freecnt = 0; static int freecnt = 0;
@ -63,7 +63,7 @@ static void* TIDY_CALL defaultAlloc( TidyAllocator* allocator, size_t size )
void *p = ( g_malloc ? g_malloc(size) : malloc(size) ); void *p = ( g_malloc ? g_malloc(size) : malloc(size) );
if ( !p ) if ( !p )
defaultPanic( allocator,"Out of memory!"); defaultPanic( allocator,"Out of memory!");
#if !defined(NDEBUG) && defined(DEBUG_MEMORY) #if defined(ENABLE_DEBUG_LOG) && defined(DEBUG_MEMORY)
alloccnt++; alloccnt++;
SPRTF("%d: alloc MEM %p, size %d\n", alloccnt, p, (int)size ); SPRTF("%d: alloc MEM %p, size %d\n", alloccnt, p, (int)size );
if (size == 0) { if (size == 0) {
@ -82,7 +82,7 @@ static void* TIDY_CALL defaultRealloc( TidyAllocator* allocator, void* mem, size
p = ( g_realloc ? g_realloc(mem, newsize) : realloc(mem, newsize) ); p = ( g_realloc ? g_realloc(mem, newsize) : realloc(mem, newsize) );
if (!p) if (!p)
defaultPanic( allocator, "Out of memory!"); defaultPanic( allocator, "Out of memory!");
#if !defined(NDEBUG) && defined(DEBUG_MEMORY) #if defined(ENABLE_DEBUG_LOG) && defined(DEBUG_MEMORY)
realloccnt++; realloccnt++;
SPRTF("%d: realloc MEM %p, size %d\n", realloccnt, p, (int)newsize ); SPRTF("%d: realloc MEM %p, size %d\n", realloccnt, p, (int)newsize );
#endif #endif
@ -93,7 +93,7 @@ static void TIDY_CALL defaultFree( TidyAllocator* ARG_UNUSED(allocator), void* m
{ {
if ( mem ) if ( mem )
{ {
#if !defined(NDEBUG) && defined(DEBUG_MEMORY) #if defined(ENABLE_DEBUG_LOG) && defined(DEBUG_MEMORY)
freecnt++; freecnt++;
SPRTF("%d: free MEM %p\n", freecnt, mem ); SPRTF("%d: free MEM %p\n", freecnt, mem );
#endif #endif

View file

@ -82,7 +82,7 @@ void TIDY_CALL TY_(filesink_putByte)( void* sinkData, byte bv )
{ {
FILE* fout = (FILE*) sinkData; FILE* fout = (FILE*) sinkData;
fputc( bv, fout ); fputc( bv, fout );
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
if (fileno(fout) != 2) if (fileno(fout) != 2)
{ {
if (bv != 0x0d) if (bv != 0x0d)

View file

@ -269,7 +269,7 @@ Node *TY_(InsertedToken)( TidyDocImpl* doc )
istack = lexer->insert; istack = lexer->insert;
/* #if 0 && defined(_DEBUG) */ /* #if 0 && defined(_DEBUG) */
#if !defined(NDEBUG) #if definedENABLE_DEBUG_LOG
if ( lexer->istacksize == 0 ) if ( lexer->istacksize == 0 )
{ {
SPRTF( "WARNING: ZERO sized istack!\n" ); SPRTF( "WARNING: ZERO sized istack!\n" );

View file

@ -40,7 +40,7 @@
#include "utf8.h" #include "utf8.h"
#include "streamio.h" #include "streamio.h"
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
/* #define DEBUG_ALLOCATION special EXTRA allocation debug information - VERY NOISY */ /* #define DEBUG_ALLOCATION special EXTRA allocation debug information - VERY NOISY */
static void check_me(char *name); static void check_me(char *name);
static Bool show_attrs = yes; static Bool show_attrs = yes;
@ -173,9 +173,9 @@ static void Show_Node( TidyDocImpl* doc, const char *msg, Node *node )
} }
} }
#define GTDBG(a,b,c) Show_Node(a,b,c) #define GTDBG(a,b,c) Show_Node(a,b,c)
#else /* NDEBUG is define */ #else /* ENABLE_DEBUG_LOG */
#define GTDBG(a,b,c) #define GTDBG(a,b,c)
#endif /* !defined(NDEBUG) */ #endif /* defined(ENABLE_DEBUG_LOG) */
/* Forward references /* Forward references
*/ */
@ -322,10 +322,10 @@ static uint GetVersFromFPI(ctmbstr fpi)
return 0; return 0;
} }
#if defined(_MSC_VER) #ifdef ENABLE_DEBUG_LOG
#ifndef EndBuf # ifndef EndBuf
# define EndBuf(a) ( a + strlen(a) ) # define EndBuf(a) ( a + strlen(a) )
#endif # endif
/* Issue #377 - Output diminishing version bits */ /* Issue #377 - Output diminishing version bits */
typedef struct tagV2S { typedef struct tagV2S {
@ -417,14 +417,14 @@ void TY_(ConstrainVersion)(TidyDocImpl* doc, uint vers)
SPRTF("After : %s\n", vcur); SPRTF("After : %s\n", vcur);
} }
} }
#else /* !#if defined(_MSC_VER) */ #else /* !#if defined(ENABLE_DEBUG_LOG) */
/* everything is allowed in proprietary version of HTML */ /* everything is allowed in proprietary version of HTML */
/* this is handled here rather than in the tag/attr dicts */ /* this is handled here rather than in the tag/attr dicts */
void TY_(ConstrainVersion)(TidyDocImpl* doc, uint vers) void TY_(ConstrainVersion)(TidyDocImpl* doc, uint vers)
{ {
doc->lexer->versions &= (vers | VERS_PROPRIETARY); doc->lexer->versions &= (vers | VERS_PROPRIETARY);
} }
#endif /* #if defined(_MSC_VER) y/n */ #endif /* #if defined(ENABLE_DEBUG_LOG) y/n */
Bool TY_(IsWhite)(uint c) Bool TY_(IsWhite)(uint c)
{ {
@ -1417,7 +1417,7 @@ Node *TY_(NewNode)(TidyAllocator* allocator, Lexer *lexer)
node->column = lexer->columns; node->column = lexer->columns;
} }
node->type = TextNode; node->type = TextNode;
#if !defined(NDEBUG) && defined(DEBUG_ALLOCATION) #if defined(ENABLE_DEBUG_LOG) && defined(DEBUG_ALLOCATION)
SPRTF("Allocated node %p\n", node ); SPRTF("Allocated node %p\n", node );
#endif #endif
return node; return node;
@ -1511,7 +1511,7 @@ void TY_(RemoveAttribute)( TidyDocImpl* doc, Node *node, AttVal *attr )
*/ */
void TY_(FreeNode)( TidyDocImpl* doc, Node *node ) void TY_(FreeNode)( TidyDocImpl* doc, Node *node )
{ {
#if !defined(NDEBUG) && defined(DEBUG_ALLOCATION) #if defined(ENABLE_DEBUG_LOG) && defined(DEBUG_ALLOCATION)
/* avoid showing free of root node! */ /* avoid showing free of root node! */
if (node) { if (node) {
if (RootNode != node->type) { if (RootNode != node->type) {
@ -2397,7 +2397,7 @@ void TY_(UngetToken)( TidyDocImpl* doc )
doc->lexer->pushed = yes; doc->lexer->pushed = yes;
} }
#if !defined(NDEBUG) && defined(_MSC_VER) #if defined(ENABLE_DEBUG_LOG)
# define CondReturnTextNode(doc, skip) \ # define CondReturnTextNode(doc, skip) \
if (lexer->txtend > lexer->txtstart) { \ if (lexer->txtend > lexer->txtstart) { \
Node *_node = TY_(TextToken)(lexer); \ Node *_node = TY_(TextToken)(lexer); \
@ -2488,7 +2488,7 @@ Node* TY_(GetToken)( TidyDocImpl* doc, GetTokenMode mode )
return GetTokenFromStream( doc, mode ); return GetTokenFromStream( doc, mode );
} }
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
static void check_me(char *name) static void check_me(char *name)
{ {
SPRTF("Have node %s\n", name); SPRTF("Have node %s\n", name);
@ -3422,9 +3422,7 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
return node; /* the COMMENT token */ return node; /* the COMMENT token */
} }
#if !defined(NDEBUG) DEBUG_LOG(SPRTF("Returning NULL...\n"));
SPRTF("Returning NULL...\n");
#endif
return NULL; return NULL;
} }

View file

@ -454,10 +454,8 @@ static void TrimInitialSpace( TidyDocImpl* doc, Node *element, Node *text )
node->end = element->start; node->end = element->start;
lexer->lexbuf[node->start] = ' '; lexer->lexbuf[node->start] = ' ';
TY_(InsertNodeBeforeElement)(element ,node); TY_(InsertNodeBeforeElement)(element ,node);
#if !defined(NDEBUG) DEBUG_LOG(SPRTF("TrimInitialSpace: Created text node, inserted before <%s>\n",
SPRTF("TrimInitialSpace: Created text node, inserted before <%s>\n", (element->element ? element->element : "unknown")));
(element->element ? element->element : "unknown"));
#endif
} }
} }
@ -794,7 +792,7 @@ static void AddClassNoIndent( TidyDocImpl* doc, Node *node )
*/ */
void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode) void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
{ {
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
static int in_parse_block = 0; static int in_parse_block = 0;
static int parse_block_cnt = 0; static int parse_block_cnt = 0;
#endif #endif
@ -802,7 +800,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
Node *node; Node *node;
Bool checkstack = yes; Bool checkstack = yes;
uint istackbase = 0; uint istackbase = 0;
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_block++; in_parse_block++;
parse_block_cnt++; parse_block_cnt++;
SPRTF("Entering ParseBlock %d... %d %s\n",in_parse_block,parse_block_cnt, SPRTF("Entering ParseBlock %d... %d %s\n",in_parse_block,parse_block_cnt,
@ -810,7 +808,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
#endif #endif
if ( element->tag->model & CM_EMPTY ) { if ( element->tag->model & CM_EMPTY ) {
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_block--; in_parse_block--;
SPRTF("Exit ParseBlockL 1 %d...\n",in_parse_block); SPRTF("Exit ParseBlockL 1 %d...\n",in_parse_block);
#endif #endif
@ -875,7 +873,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
element->closed = yes; element->closed = yes;
TrimSpaces( doc, element ); TrimSpaces( doc, element );
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_block--; in_parse_block--;
SPRTF("Exit ParseBlock 2 %d...\n",in_parse_block); SPRTF("Exit ParseBlock 2 %d...\n",in_parse_block);
#endif #endif
@ -929,7 +927,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
{ {
TY_(UngetToken)( doc ); TY_(UngetToken)( doc );
TrimSpaces( doc, element ); TrimSpaces( doc, element );
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_block--; in_parse_block--;
SPRTF("Exit ParseBlock 2 %d...\n",in_parse_block); SPRTF("Exit ParseBlock 2 %d...\n",in_parse_block);
#endif #endif
@ -1093,7 +1091,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
{ {
TY_(UngetToken)( doc ); TY_(UngetToken)( doc );
TrimSpaces( doc, element ); TrimSpaces( doc, element );
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_block--; in_parse_block--;
SPRTF("Exit ParseBlock 3 %d...\n",in_parse_block); SPRTF("Exit ParseBlock 3 %d...\n",in_parse_block);
#endif #endif
@ -1113,7 +1111,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
lexer->istackbase = istackbase; lexer->istackbase = istackbase;
TrimSpaces( doc, element ); TrimSpaces( doc, element );
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_block--; in_parse_block--;
SPRTF("Exit ParseBlock 4 %d...\n",in_parse_block); SPRTF("Exit ParseBlock 4 %d...\n",in_parse_block);
#endif #endif
@ -1172,7 +1170,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
element->parent->tag->parser == TY_(ParseList) ) element->parent->tag->parser == TY_(ParseList) )
{ {
TrimSpaces( doc, element ); TrimSpaces( doc, element );
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_block--; in_parse_block--;
SPRTF("Exit ParseBlock 5 %d...\n",in_parse_block); SPRTF("Exit ParseBlock 5 %d...\n",in_parse_block);
#endif #endif
@ -1187,7 +1185,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
if ( nodeIsDL(element->parent) ) if ( nodeIsDL(element->parent) )
{ {
TrimSpaces( doc, element ); TrimSpaces( doc, element );
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_block--; in_parse_block--;
SPRTF("Exit ParseBlock 6 %d...\n",in_parse_block); SPRTF("Exit ParseBlock 6 %d...\n",in_parse_block);
#endif #endif
@ -1202,7 +1200,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
/* In exiled mode, return so table processing can /* In exiled mode, return so table processing can
continue. */ continue. */
if (lexer->exiled) { if (lexer->exiled) {
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_block--; in_parse_block--;
SPRTF("Exit ParseBlock 7 %d...\n",in_parse_block); SPRTF("Exit ParseBlock 7 %d...\n",in_parse_block);
#endif #endif
@ -1217,7 +1215,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
TY_(PopInline)( doc, NULL ); TY_(PopInline)( doc, NULL );
lexer->istackbase = istackbase; lexer->istackbase = istackbase;
TrimSpaces( doc, element ); TrimSpaces( doc, element );
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_block--; in_parse_block--;
SPRTF("Exit ParseBlock 8 %d...\n",in_parse_block); SPRTF("Exit ParseBlock 8 %d...\n",in_parse_block);
#endif #endif
@ -1227,7 +1225,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
else else
{ {
TrimSpaces( doc, element ); TrimSpaces( doc, element );
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_block--; in_parse_block--;
SPRTF("Exit ParseBlock 9 %d...\n",in_parse_block); SPRTF("Exit ParseBlock 9 %d...\n",in_parse_block);
#endif #endif
@ -1271,7 +1269,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
if (!(mode & Preformatted)) if (!(mode & Preformatted))
TrimSpaces(doc, element); TrimSpaces(doc, element);
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_block--; in_parse_block--;
SPRTF("Exit ParseBlock 9b %d...\n",in_parse_block); SPRTF("Exit ParseBlock 9b %d...\n",in_parse_block);
#endif #endif
@ -1339,7 +1337,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
} }
TrimSpaces( doc, element ); TrimSpaces( doc, element );
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_block--; in_parse_block--;
SPRTF("Exit ParseBlock 10 %d...\n",in_parse_block); SPRTF("Exit ParseBlock 10 %d...\n",in_parse_block);
#endif #endif
@ -1539,18 +1537,18 @@ void TY_(ParseNamespace)(TidyDocImpl* doc, Node *basenode, GetTokenMode mode)
void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode ) void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
{ {
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
static int in_parse_inline = 0; static int in_parse_inline = 0;
#endif #endif
Lexer* lexer = doc->lexer; Lexer* lexer = doc->lexer;
Node *node, *parent; Node *node, *parent;
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_inline++; in_parse_inline++;
SPRTF("Entering ParseInline %d...\n",in_parse_inline); SPRTF("Entering ParseInline %d...\n",in_parse_inline);
#endif #endif
if (element->tag->model & CM_EMPTY) { if (element->tag->model & CM_EMPTY) {
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_inline--; in_parse_inline--;
SPRTF("Exit ParseInline 1 %d...\n",in_parse_inline); SPRTF("Exit ParseInline 1 %d...\n",in_parse_inline);
#endif #endif
@ -1632,7 +1630,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
element->closed = yes; element->closed = yes;
TrimSpaces( doc, element ); TrimSpaces( doc, element );
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_inline--; in_parse_inline--;
SPRTF("Exit ParseInline 2 %d...\n",in_parse_inline); SPRTF("Exit ParseInline 2 %d...\n",in_parse_inline);
#endif #endif
@ -1723,7 +1721,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
if (!(mode & Preformatted)) if (!(mode & Preformatted))
TrimSpaces(doc, element); TrimSpaces(doc, element);
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_inline--; in_parse_inline--;
SPRTF("Exit ParseInline 3 %d...\n",in_parse_inline); SPRTF("Exit ParseInline 3 %d...\n",in_parse_inline);
#endif #endif
@ -1813,7 +1811,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
TY_(InlineDup1)( doc, NULL, element ); /* dupe the <i>, after </b> */ TY_(InlineDup1)( doc, NULL, element ); /* dupe the <i>, after </b> */
if (!(mode & Preformatted)) if (!(mode & Preformatted))
TrimSpaces( doc, element ); TrimSpaces( doc, element );
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_inline--; in_parse_inline--;
SPRTF("Exit ParseInline 4 %d...\n",in_parse_inline); SPRTF("Exit ParseInline 4 %d...\n",in_parse_inline);
#endif #endif
@ -1837,7 +1835,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
if (!(mode & Preformatted)) if (!(mode & Preformatted))
TrimSpaces(doc, element); TrimSpaces(doc, element);
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_inline--; in_parse_inline--;
SPRTF("Exit ParseInline 5 %d...\n",in_parse_inline); SPRTF("Exit ParseInline 5 %d...\n",in_parse_inline);
#endif #endif
@ -1854,7 +1852,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
{ {
TY_(UngetToken)( doc ); TY_(UngetToken)( doc );
TrimSpaces(doc, element); TrimSpaces(doc, element);
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_inline--; in_parse_inline--;
SPRTF("Exit ParseInline 6 %d...\n",in_parse_inline); SPRTF("Exit ParseInline 6 %d...\n",in_parse_inline);
#endif #endif
@ -1880,7 +1878,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
if (!(mode & Preformatted)) if (!(mode & Preformatted))
TrimSpaces(doc, element); TrimSpaces(doc, element);
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_inline--; in_parse_inline--;
SPRTF("Exit ParseInline 7 %d...\n",in_parse_inline); SPRTF("Exit ParseInline 7 %d...\n",in_parse_inline);
#endif #endif
@ -1917,7 +1915,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
if (!(mode & Preformatted)) if (!(mode & Preformatted))
TrimSpaces(doc, element); TrimSpaces(doc, element);
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_inline--; in_parse_inline--;
SPRTF("Exit ParseInline 8 %d...\n",in_parse_inline); SPRTF("Exit ParseInline 8 %d...\n",in_parse_inline);
#endif #endif
@ -2043,7 +2041,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
if (!(mode & Preformatted)) if (!(mode & Preformatted))
TrimSpaces(doc, element); TrimSpaces(doc, element);
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_inline--; in_parse_inline--;
SPRTF("Exit ParseInline 9 %d...\n",in_parse_inline); SPRTF("Exit ParseInline 9 %d...\n",in_parse_inline);
#endif #endif
@ -2095,7 +2093,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
{ {
TY_(DiscardElement)( doc, element ); TY_(DiscardElement)( doc, element );
TY_(UngetToken)( doc ); TY_(UngetToken)( doc );
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_inline--; in_parse_inline--;
SPRTF("Exit ParseInline 10 %d...\n",in_parse_inline); SPRTF("Exit ParseInline 10 %d...\n",in_parse_inline);
#endif #endif
@ -2108,7 +2106,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
if (!(mode & Preformatted)) if (!(mode & Preformatted))
TrimSpaces(doc, element); TrimSpaces(doc, element);
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_inline--; in_parse_inline--;
SPRTF("Exit ParseInline 11 %d...\n",in_parse_inline); SPRTF("Exit ParseInline 11 %d...\n",in_parse_inline);
#endif #endif
@ -2139,7 +2137,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
if (!(element->tag->model & CM_OPT)) if (!(element->tag->model & CM_OPT))
TY_(Report)(doc, element, node, MISSING_ENDTAG_FOR); TY_(Report)(doc, element, node, MISSING_ENDTAG_FOR);
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_inline--; in_parse_inline--;
SPRTF("Exit ParseInline 12 %d...\n",in_parse_inline); SPRTF("Exit ParseInline 12 %d...\n",in_parse_inline);
#endif #endif
@ -2327,7 +2325,7 @@ static Bool FindLastLI( Node *list, Node **lastli )
void TY_(ParseList)(TidyDocImpl* doc, Node *list, GetTokenMode ARG_UNUSED(mode)) void TY_(ParseList)(TidyDocImpl* doc, Node *list, GetTokenMode ARG_UNUSED(mode))
{ {
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
static int in_parse_list = 0; static int in_parse_list = 0;
#endif #endif
Lexer* lexer = doc->lexer; Lexer* lexer = doc->lexer;
@ -2335,13 +2333,13 @@ void TY_(ParseList)(TidyDocImpl* doc, Node *list, GetTokenMode ARG_UNUSED(mode))
Bool wasblock; Bool wasblock;
Bool nodeisOL = nodeIsOL(list); Bool nodeisOL = nodeIsOL(list);
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_list++; in_parse_list++;
SPRTF("Entering ParseList %d...\n",in_parse_list); SPRTF("Entering ParseList %d...\n",in_parse_list);
#endif #endif
if (list->tag->model & CM_EMPTY) if (list->tag->model & CM_EMPTY)
{ {
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_list--; in_parse_list--;
SPRTF("Exit ParseList 1 %d... CM_EMPTY\n",in_parse_list); SPRTF("Exit ParseList 1 %d... CM_EMPTY\n",in_parse_list);
#endif #endif
@ -2356,7 +2354,7 @@ void TY_(ParseList)(TidyDocImpl* doc, Node *list, GetTokenMode ARG_UNUSED(mode))
{ {
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
list->closed = yes; list->closed = yes;
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_list--; in_parse_list--;
SPRTF("Exit ParseList 2 %d... Endtag\n",in_parse_list); SPRTF("Exit ParseList 2 %d... Endtag\n",in_parse_list);
#endif #endif
@ -2423,7 +2421,7 @@ void TY_(ParseList)(TidyDocImpl* doc, Node *list, GetTokenMode ARG_UNUSED(mode))
{ {
TY_(Report)(doc, list, node, MISSING_ENDTAG_BEFORE); TY_(Report)(doc, list, node, MISSING_ENDTAG_BEFORE);
TY_(UngetToken)( doc ); TY_(UngetToken)( doc );
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_list--; in_parse_list--;
SPRTF("Exit ParseList 3 %d... No End Tag\n",in_parse_list); SPRTF("Exit ParseList 3 %d... No End Tag\n",in_parse_list);
#endif #endif
@ -2456,7 +2454,7 @@ void TY_(ParseList)(TidyDocImpl* doc, Node *list, GetTokenMode ARG_UNUSED(mode))
if (TY_(nodeHasCM)(node,CM_BLOCK) && lexer->excludeBlocks) if (TY_(nodeHasCM)(node,CM_BLOCK) && lexer->excludeBlocks)
{ {
TY_(Report)(doc, list, node, MISSING_ENDTAG_BEFORE); TY_(Report)(doc, list, node, MISSING_ENDTAG_BEFORE);
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_list--; in_parse_list--;
SPRTF("Exit ParseList 4 %d... No End Tag\n",in_parse_list); SPRTF("Exit ParseList 4 %d... No End Tag\n",in_parse_list);
#endif #endif
@ -2468,7 +2466,7 @@ void TY_(ParseList)(TidyDocImpl* doc, Node *list, GetTokenMode ARG_UNUSED(mode))
&& (TY_(nodeHasCM)(node, CM_TABLE|CM_ROWGRP|CM_ROW) && (TY_(nodeHasCM)(node, CM_TABLE|CM_ROWGRP|CM_ROW)
|| nodeIsTABLE(node)) ) || nodeIsTABLE(node)) )
{ {
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_list--; in_parse_list--;
SPRTF("Exit ParseList 5 %d... exiled\n",in_parse_list); SPRTF("Exit ParseList 5 %d... exiled\n",in_parse_list);
#endif #endif
@ -2507,7 +2505,7 @@ void TY_(ParseList)(TidyDocImpl* doc, Node *list, GetTokenMode ARG_UNUSED(mode))
} }
TY_(Report)(doc, list, node, MISSING_ENDTAG_FOR); TY_(Report)(doc, list, node, MISSING_ENDTAG_FOR);
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_list--; in_parse_list--;
SPRTF("Exit ParseList 6 %d... missing end tag\n",in_parse_list); SPRTF("Exit ParseList 6 %d... missing end tag\n",in_parse_list);
#endif #endif
@ -2931,7 +2929,7 @@ void TY_(ParseColGroup)(TidyDocImpl* doc, Node *colgroup, GetTokenMode ARG_UNUSE
void TY_(ParseTableTag)(TidyDocImpl* doc, Node *table, GetTokenMode ARG_UNUSED(mode)) void TY_(ParseTableTag)(TidyDocImpl* doc, Node *table, GetTokenMode ARG_UNUSED(mode))
{ {
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
static int in_parse_table = 0; static int in_parse_table = 0;
#endif #endif
Lexer* lexer = doc->lexer; Lexer* lexer = doc->lexer;
@ -2941,7 +2939,7 @@ void TY_(ParseTableTag)(TidyDocImpl* doc, Node *table, GetTokenMode ARG_UNUSED(m
TY_(DeferDup)( doc ); TY_(DeferDup)( doc );
istackbase = lexer->istackbase; istackbase = lexer->istackbase;
lexer->istackbase = lexer->istacksize; lexer->istackbase = lexer->istacksize;
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_table++; in_parse_table++;
SPRTF("Entering ParseTableTag %d...\n",in_parse_table); SPRTF("Entering ParseTableTag %d...\n",in_parse_table);
#endif #endif
@ -2966,7 +2964,7 @@ void TY_(ParseTableTag)(TidyDocImpl* doc, Node *table, GetTokenMode ARG_UNUSED(m
} }
lexer->istackbase = istackbase; lexer->istackbase = istackbase;
table->closed = yes; table->closed = yes;
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_table--; in_parse_table--;
SPRTF("Exit ParseTableTag 1 %d... EndTag\n",in_parse_table); SPRTF("Exit ParseTableTag 1 %d... EndTag\n",in_parse_table);
#endif #endif
@ -3046,7 +3044,7 @@ void TY_(ParseTableTag)(TidyDocImpl* doc, Node *table, GetTokenMode ARG_UNUSED(m
TY_(Report)(doc, table, node, MISSING_ENDTAG_BEFORE ); TY_(Report)(doc, table, node, MISSING_ENDTAG_BEFORE );
TY_(UngetToken)( doc ); TY_(UngetToken)( doc );
lexer->istackbase = istackbase; lexer->istackbase = istackbase;
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_table--; in_parse_table--;
SPRTF("Exit ParseTableTag 2 %d... missing EndTag\n",in_parse_table); SPRTF("Exit ParseTableTag 2 %d... missing EndTag\n",in_parse_table);
#endif #endif
@ -3060,7 +3058,7 @@ void TY_(ParseTableTag)(TidyDocImpl* doc, Node *table, GetTokenMode ARG_UNUSED(m
TY_(UngetToken)( doc ); TY_(UngetToken)( doc );
TY_(Report)(doc, table, node, TAG_NOT_ALLOWED_IN); TY_(Report)(doc, table, node, TAG_NOT_ALLOWED_IN);
lexer->istackbase = istackbase; lexer->istackbase = istackbase;
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_table--; in_parse_table--;
SPRTF("Exit ParseTableTag 3 %d... CM_TABLE\n",in_parse_table); SPRTF("Exit ParseTableTag 3 %d... CM_TABLE\n",in_parse_table);
#endif #endif
@ -3081,7 +3079,7 @@ void TY_(ParseTableTag)(TidyDocImpl* doc, Node *table, GetTokenMode ARG_UNUSED(m
TY_(Report)(doc, table, node, MISSING_ENDTAG_FOR); TY_(Report)(doc, table, node, MISSING_ENDTAG_FOR);
lexer->istackbase = istackbase; lexer->istackbase = istackbase;
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_table--; in_parse_table--;
SPRTF("Exit ParseTableTag 4 %d... missing end\n",in_parse_table); SPRTF("Exit ParseTableTag 4 %d... missing end\n",in_parse_table);
#endif #endif
@ -3317,14 +3315,14 @@ void TY_(ParseOptGroup)(TidyDocImpl* doc, Node *field, GetTokenMode ARG_UNUSED(m
void TY_(ParseSelect)(TidyDocImpl* doc, Node *field, GetTokenMode ARG_UNUSED(mode)) void TY_(ParseSelect)(TidyDocImpl* doc, Node *field, GetTokenMode ARG_UNUSED(mode))
{ {
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
static int in_parse_select = 0; static int in_parse_select = 0;
#endif #endif
Lexer* lexer = doc->lexer; Lexer* lexer = doc->lexer;
Node *node; Node *node;
lexer->insert = NULL; /* defer implicit inline start tags */ lexer->insert = NULL; /* defer implicit inline start tags */
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_select++; in_parse_select++;
SPRTF("Entering ParseSelect %d...\n",in_parse_select); SPRTF("Entering ParseSelect %d...\n",in_parse_select);
#endif #endif
@ -3336,7 +3334,7 @@ void TY_(ParseSelect)(TidyDocImpl* doc, Node *field, GetTokenMode ARG_UNUSED(mod
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
field->closed = yes; field->closed = yes;
TrimSpaces(doc, field); TrimSpaces(doc, field);
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_select--; in_parse_select--;
SPRTF("Exit ParseSelect 1 %d...\n",in_parse_select); SPRTF("Exit ParseSelect 1 %d...\n",in_parse_select);
#endif #endif
@ -3365,7 +3363,7 @@ void TY_(ParseSelect)(TidyDocImpl* doc, Node *field, GetTokenMode ARG_UNUSED(mod
} }
TY_(Report)(doc, field, node, MISSING_ENDTAG_FOR); TY_(Report)(doc, field, node, MISSING_ENDTAG_FOR);
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_select--; in_parse_select--;
SPRTF("Exit ParseSelect 2 %d...\n",in_parse_select); SPRTF("Exit ParseSelect 2 %d...\n",in_parse_select);
#endif #endif
@ -3374,14 +3372,14 @@ void TY_(ParseSelect)(TidyDocImpl* doc, Node *field, GetTokenMode ARG_UNUSED(mod
/* HTML5 */ /* HTML5 */
void TY_(ParseDatalist)(TidyDocImpl* doc, Node *field, GetTokenMode ARG_UNUSED(mode)) void TY_(ParseDatalist)(TidyDocImpl* doc, Node *field, GetTokenMode ARG_UNUSED(mode))
{ {
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
static int in_parse_datalist = 0; static int in_parse_datalist = 0;
#endif #endif
Lexer* lexer = doc->lexer; Lexer* lexer = doc->lexer;
Node *node; Node *node;
lexer->insert = NULL; /* defer implicit inline start tags */ lexer->insert = NULL; /* defer implicit inline start tags */
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_datalist++; in_parse_datalist++;
SPRTF("Entering ParseDatalist %d...\n",in_parse_datalist); SPRTF("Entering ParseDatalist %d...\n",in_parse_datalist);
#endif #endif
@ -3393,7 +3391,7 @@ void TY_(ParseDatalist)(TidyDocImpl* doc, Node *field, GetTokenMode ARG_UNUSED(m
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
field->closed = yes; field->closed = yes;
TrimSpaces(doc, field); TrimSpaces(doc, field);
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_datalist--; in_parse_datalist--;
SPRTF("Exit ParseDatalist 1 %d...\n",in_parse_datalist); SPRTF("Exit ParseDatalist 1 %d...\n",in_parse_datalist);
#endif #endif
@ -3422,7 +3420,7 @@ void TY_(ParseDatalist)(TidyDocImpl* doc, Node *field, GetTokenMode ARG_UNUSED(m
} }
TY_(Report)(doc, field, node, MISSING_ENDTAG_FOR); TY_(Report)(doc, field, node, MISSING_ENDTAG_FOR);
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
in_parse_datalist--; in_parse_datalist--;
SPRTF("Exit ParseDatalist 2 %d...\n",in_parse_datalist); SPRTF("Exit ParseDatalist 2 %d...\n",in_parse_datalist);
#endif #endif
@ -3628,9 +3626,7 @@ void TY_(ParseHead)(TidyDocImpl* doc, Node *head, GetTokenMode ARG_UNUSED(mode))
int HasTitle = 0; int HasTitle = 0;
int HasBase = 0; int HasBase = 0;
#if !defined(NDEBUG) DEBUG_LOG(SPRTF("Enter ParseHead...\n"));
SPRTF("Enter ParseHead...\n");
#endif
while ((node = TY_(GetToken)(doc, IgnoreWhitespace)) != NULL) while ((node = TY_(GetToken)(doc, IgnoreWhitespace)) != NULL)
{ {
if (node->tag == head->tag && node->type == EndTag) if (node->tag == head->tag && node->type == EndTag)
@ -3734,9 +3730,7 @@ void TY_(ParseHead)(TidyDocImpl* doc, Node *head, GetTokenMode ARG_UNUSED(mode))
TY_(Report)(doc, head, node, DISCARDING_UNEXPECTED); TY_(Report)(doc, head, node, DISCARDING_UNEXPECTED);
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
} }
#if !defined(NDEBUG) DEBUG_LOG(SPRTF("Exit ParseHead 1...\n"));
SPRTF("Exit ParseHead 1...\n");
#endif
} }
/*\ /*\
@ -3790,10 +3784,8 @@ void TY_(ParseBody)(TidyDocImpl* doc, Node *body, GetTokenMode mode)
checkstack = yes; checkstack = yes;
TY_(BumpObject)( doc, body->parent ); TY_(BumpObject)( doc, body->parent );
#if !defined(NDEBUG)
SPRTF("Enter ParseBody...\n");
#endif
DEBUG_LOG(SPRTF("Enter ParseBody...\n"));
while ((node = TY_(GetToken)(doc, mode)) != NULL) while ((node = TY_(GetToken)(doc, mode)) != NULL)
{ {
/* find and discard multiple <body> elements */ /* find and discard multiple <body> elements */
@ -4057,9 +4049,7 @@ void TY_(ParseBody)(TidyDocImpl* doc, Node *body, GetTokenMode mode)
TY_(Report)(doc, body, node, DISCARDING_UNEXPECTED); TY_(Report)(doc, body, node, DISCARDING_UNEXPECTED);
TY_(FreeNode)( doc, node); TY_(FreeNode)( doc, node);
} }
#if !defined(NDEBUG) DEBUG_LOG(SPRTF("Exit ParseBody 1...\n"));
SPRTF("Exit ParseBody 1...\n");
#endif
} }
void TY_(ParseNoFrames)(TidyDocImpl* doc, Node *noframes, GetTokenMode mode) void TY_(ParseNoFrames)(TidyDocImpl* doc, Node *noframes, GetTokenMode mode)
@ -4246,9 +4236,7 @@ void TY_(ParseHTML)(TidyDocImpl* doc, Node *html, GetTokenMode mode)
Node *frameset = NULL; Node *frameset = NULL;
Node *noframes = NULL; Node *noframes = NULL;
#if !defined(NDEBUG) DEBUG_LOG(SPRTF("Entering ParseHTML...\n"));
SPRTF("Entering ParseHTML...\n");
#endif
TY_(SetOptionBool)( doc, TidyXmlTags, no ); TY_(SetOptionBool)( doc, TidyXmlTags, no );
for (;;) for (;;)
@ -4304,9 +4292,8 @@ void TY_(ParseHTML)(TidyDocImpl* doc, Node *html, GetTokenMode mode)
TY_(InsertNodeAtEnd)(html, node); TY_(InsertNodeAtEnd)(html, node);
TY_(ParseBody)(doc, node, mode); TY_(ParseBody)(doc, node, mode);
} }
#if !defined(NDEBUG)
SPRTF("Exit ParseHTML 1...\n"); DEBUG_LOG(SPRTF("Exit ParseHTML 1...\n"));
#endif
return; return;
} }
@ -4475,9 +4462,7 @@ void TY_(ParseHTML)(TidyDocImpl* doc, Node *html, GetTokenMode mode)
TY_(InsertNodeAtEnd)(html, node); TY_(InsertNodeAtEnd)(html, node);
ParseTag(doc, node, mode); ParseTag(doc, node, mode);
#if !defined(NDEBUG) DEBUG_LOG(SPRTF("Exit ParseHTML 2...\n"));
SPRTF("Exit ParseHTML 2...\n");
#endif
} }
static Bool nodeCMIsOnlyInline( Node* node ) static Bool nodeCMIsOnlyInline( Node* node )

View file

@ -20,7 +20,7 @@
/* *** FOR DEBUG ONLY *** */ /* *** FOR DEBUG ONLY *** */
/* #define DEBUG_PPRINT */ /* #define DEBUG_PPRINT */
/* #define DEBUG_INDENT */ /* #define DEBUG_INDENT */
#if !defined(NDEBUG) && defined(DEBUG_PPRINT) #if defined(ENABLE_DEBUG_LOG) && defined(DEBUG_PPRINT)
extern void dbg_show_node( TidyDocImpl* doc, Node *node, int caller, int indent ); extern void dbg_show_node( TidyDocImpl* doc, Node *node, int caller, int indent );
#endif #endif
@ -614,7 +614,7 @@ static Bool CheckWrapIndent( TidyDocImpl* doc, uint indent )
WrapLine( doc ); WrapLine( doc );
if ( pprint->indent[ 0 ].spaces < 0 ) if ( pprint->indent[ 0 ].spaces < 0 )
{ {
#if !defined(NDEBUG) && defined(DEBUG_INDENT) #if defined(ENABLE_DEBUG_LOG) && defined(DEBUG_INDENT)
SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent ); SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent );
#endif #endif
pprint->indent[ 0 ].spaces = indent; pprint->indent[ 0 ].spaces = indent;
@ -678,7 +678,7 @@ void TY_(PFlushLine)( TidyDocImpl* doc, uint indent )
if (pprint->indent[ 0 ].spaces != (int)indent ) if (pprint->indent[ 0 ].spaces != (int)indent )
{ {
#if !defined(NDEBUG) && defined(DEBUG_INDENT) #if defined(ENABLE_DEBUG_LOG) && defined(DEBUG_INDENT)
SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent ); SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent );
#endif #endif
pprint->indent[ 0 ].spaces = indent; pprint->indent[ 0 ].spaces = indent;
@ -700,7 +700,7 @@ static void PCondFlushLine( TidyDocImpl* doc, uint indent )
/* Issue #390 - Whether chars to flush or not, set new indent */ /* Issue #390 - Whether chars to flush or not, set new indent */
if ( pprint->indent[ 0 ].spaces != (int)indent ) if ( pprint->indent[ 0 ].spaces != (int)indent )
{ {
#if !defined(NDEBUG) && defined(DEBUG_INDENT) #if defined(ENABLE_DEBUG_LOG) && defined(DEBUG_INDENT)
SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent ); SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent );
#endif #endif
pprint->indent[ 0 ].spaces = indent; pprint->indent[ 0 ].spaces = indent;
@ -728,7 +728,7 @@ void TY_(PFlushLineSmart)( TidyDocImpl* doc, uint indent )
if ( pprint->indent[ 0 ].spaces != (int)indent ) if ( pprint->indent[ 0 ].spaces != (int)indent )
{ {
#if !defined(NDEBUG) && defined(DEBUG_INDENT) #if defined(ENABLE_DEBUG_LOG) && defined(DEBUG_INDENT)
SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent ); SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent );
#endif #endif
pprint->indent[ 0 ].spaces = indent; pprint->indent[ 0 ].spaces = indent;
@ -757,7 +757,7 @@ static void PCondFlushLineSmart( TidyDocImpl* doc, uint indent )
\*/ \*/
if (pprint->indent[ 0 ].spaces != (int)indent) if (pprint->indent[ 0 ].spaces != (int)indent)
{ {
#if !defined(NDEBUG) && defined(DEBUG_INDENT) #if defined(ENABLE_DEBUG_LOG) && defined(DEBUG_INDENT)
SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent ); SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent );
#endif #endif
pprint->indent[ 0 ].spaces = indent; pprint->indent[ 0 ].spaces = indent;
@ -1945,7 +1945,7 @@ void PPrintScriptStyle( TidyDocImpl* doc, uint mode, uint indent, Node *node )
if ( node->content && pprint->indent[ 0 ].spaces != (int)indent ) if ( node->content && pprint->indent[ 0 ].spaces != (int)indent )
{ {
#if !defined(NDEBUG) && defined(DEBUG_INDENT) #if defined(ENABLE_DEBUG_LOG) && defined(DEBUG_INDENT)
SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent ); SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent );
#endif #endif
pprint->indent[ 0 ].spaces = indent; pprint->indent[ 0 ].spaces = indent;
@ -2053,7 +2053,7 @@ void TY_(PPrintTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node )
doc->progressCallback( tidyImplToDoc(doc), node->line, node->column, doc->pprint.line + 1 ); doc->progressCallback( tidyImplToDoc(doc), node->line, node->column, doc->pprint.line + 1 );
} }
#if !defined(NDEBUG) && defined(DEBUG_PPRINT) #if defined(ENABLE_DEBUG_LOG) && defined(DEBUG_PPRINT)
dbg_show_node( doc, node, 4, GetSpaces( &doc->pprint ) ); dbg_show_node( doc, node, 4, GetSpaces( &doc->pprint ) );
#endif #endif
@ -2313,7 +2313,7 @@ void TY_(PPrintTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node )
TidyPrintImpl* pprint = &doc->pprint; TidyPrintImpl* pprint = &doc->pprint;
if (pprint->indent[ 0 ].spaces != (int)indent) if (pprint->indent[ 0 ].spaces != (int)indent)
{ {
#if !defined(NDEBUG) && defined(DEBUG_INDENT) #if defined(ENABLE_DEBUG_LOG) && defined(DEBUG_INDENT)
SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent ); SPRTF("%s Indent from %d to %d\n", __FUNCTION__, pprint->indent[ 0 ].spaces, indent );
#endif #endif
pprint->indent[ 0 ].spaces = indent; pprint->indent[ 0 ].spaces = indent;

View file

@ -473,7 +473,7 @@ static void declare( TidyDocImpl* doc, TidyTagImpl* tags,
} }
} }
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
void ListElementsPerVersion( uint vers, Bool has ) void ListElementsPerVersion( uint vers, Bool has )
{ {
uint val, cnt, total, wrap = 10; uint val, cnt, total, wrap = 10;
@ -519,7 +519,7 @@ void show_have_html5(void)
ListElementsPerVersion( VERS_HTML5, yes ); ListElementsPerVersion( VERS_HTML5, yes );
} }
#endif /* !defined(NDEBUG) */ #endif /* defined(ENABLE_DEBUG_LOG) */
/* public interface for finding tag by name */ /* public interface for finding tag by name */
Bool TY_(FindTag)( TidyDocImpl* doc, Node *node ) Bool TY_(FindTag)( TidyDocImpl* doc, Node *node )

View file

@ -1398,7 +1398,7 @@ void tidyDocReportDoctype( TidyDocImpl* doc )
/***************************************************************************** /*****************************************************************************
* HTML5 STUFF * HTML5 STUFF
*****************************************************************************/ *****************************************************************************/
#if 0 && !defined(NDEBUG) #if 0 && defined(ENABLE_DEBUG_LOG)
extern void show_not_html5(void); extern void show_not_html5(void);
/* ----------------------------- /* -----------------------------
List tags that do not have version HTML5 (HT50|XH50) List tags that do not have version HTML5 (HT50|XH50)
@ -1773,7 +1773,7 @@ void TY_(CheckHTMLTagsAttribsVersions)( TidyDocImpl* doc, Node* node )
} }
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
/* *** FOR DEBUG ONLY *** */ /* *** FOR DEBUG ONLY *** */
const char *dbg_get_lexer_type( void *vp ) const char *dbg_get_lexer_type( void *vp )
{ {
@ -1910,7 +1910,7 @@ int tidyDocCleanAndRepair( TidyDocImpl* doc )
Bool mergeEmphasis = cfgBool( doc, TidyMergeEmphasis ); Bool mergeEmphasis = cfgBool( doc, TidyMergeEmphasis );
Node* node; Node* node;
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
SPRTF("All nodes BEFORE clean and repair\n"); SPRTF("All nodes BEFORE clean and repair\n");
dbg_show_all_nodes( doc, &doc->root, 0 ); dbg_show_all_nodes( doc, &doc->root, 0 );
#endif #endif
@ -2028,7 +2028,7 @@ int tidyDocCleanAndRepair( TidyDocImpl* doc )
} }
} }
#if !defined(NDEBUG) #if defined(ENABLE_DEBUG_LOG)
SPRTF("All nodes AFTER clean and repair\n"); SPRTF("All nodes AFTER clean and repair\n");
dbg_show_all_nodes( doc, &doc->root, 0 ); dbg_show_all_nodes( doc, &doc->root, 0 );
#endif #endif

View file

@ -1,2 +1,2 @@
5.5.59 5.5.61
2017.10.06 2017.10.07