Merge branch 'sprtf' into next

This commit is contained in:
Jim Derry 2017-10-04 11:11:39 -04:00
commit 430fc6118d
18 changed files with 185 additions and 215 deletions

View file

@ -142,20 +142,21 @@ endif ()
# NOTE: Currently only available in the Debug configuration build in # NOTE: Currently only available in the Debug configuration build in
# Windows, but could be maybe extended to Unix, others... # Windows, but could be maybe extended to Unix, others...
#------------------------------------------------------------------------ #------------------------------------------------------------------------
if (WIN32) 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 )
option( ENABLE_ALLOC_DEBUG "Set ON to output node allocation diagnostics." OFF )
option( ENABLE_CRTDBG_MEMORY "Set ON to enable the Windows CRT debug library." OFF ) if (ENABLE_ALLOC_DEBUG)
add_definitions ( -DDEBUG_ALLOCATION ) # see lexer.c for details
message(STATUS "*** Note, lexer.c node allocation diagnostics are ON")
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 (ENABLE_ALLOC_DEBUG) if (WIN32)
add_definitions ( -DDEBUG_ALLOCATION ) # see lexer.c for details option( ENABLE_CRTDBG_MEMORY "Set ON to enable the Windows CRT debug library." OFF )
message(STATUS "*** Note, lexer.c node allocation diagnostics are ON")
endif ()
if (ENABLE_CRTDBG_MEMORY) if (ENABLE_CRTDBG_MEMORY)
add_definitions ( -D_CRTDBG_MAP_ALLOC ) # see tidy.c for details add_definitions ( -D_CRTDBG_MAP_ALLOC ) # see tidy.c for details
@ -334,7 +335,7 @@ set ( CFILES
${SRCDIR}/buffio.c ${SRCDIR}/fileio.c ${SRCDIR}/streamio.c ${SRCDIR}/buffio.c ${SRCDIR}/fileio.c ${SRCDIR}/streamio.c
${SRCDIR}/tagask.c ${SRCDIR}/tmbstr.c ${SRCDIR}/utf8.c ${SRCDIR}/tagask.c ${SRCDIR}/tmbstr.c ${SRCDIR}/utf8.c
${SRCDIR}/tidylib.c ${SRCDIR}/mappedio.c ${SRCDIR}/gdoc.c ${SRCDIR}/tidylib.c ${SRCDIR}/mappedio.c ${SRCDIR}/gdoc.c
${SRCDIR}/language.c ${SRCDIR}/messageobj.c ) ${SRCDIR}/language.c ${SRCDIR}/messageobj.c ${SRCDIR}/sprtf.c )
set ( HFILES set ( HFILES
${INCDIR}/tidyplatform.h ${INCDIR}/tidy.h ${INCDIR}/tidyenum.h ${INCDIR}/tidyplatform.h ${INCDIR}/tidy.h ${INCDIR}/tidyenum.h
@ -352,12 +353,7 @@ set ( LIBHFILES
${SRCDIR}/pprint.h ${SRCDIR}/streamio.h ${SRCDIR}/tags.h ${SRCDIR}/pprint.h ${SRCDIR}/streamio.h ${SRCDIR}/tags.h
${SRCDIR}/tmbstr.h ${SRCDIR}/utf8.h ${SRCDIR}/tidy-int.h ${SRCDIR}/tmbstr.h ${SRCDIR}/utf8.h ${SRCDIR}/tidy-int.h
${SRCDIR}/version.h ${SRCDIR}/gdoc.h ${SRCDIR}/language.h ${SRCDIR}/version.h ${SRCDIR}/gdoc.h ${SRCDIR}/language.h
${SRCDIR}/language_en.h ) ${SRCDIR}/language_en.h ${SRCDIR}/sprtf.h )
if (MSVC)
list(APPEND CFILES ${SRCDIR}/sprtf.c)
list(APPEND LIBHFILES ${SRCDIR}/sprtf.h)
endif ()
#------------------------------------------------------------------------ #------------------------------------------------------------------------

View file

@ -25,17 +25,12 @@
#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) #if !defined(NDEBUG) && defined(_MSC_VER) && defined(_CRTDBG_MAP_ALLOC)
# include "sprtf.h"
# ifdef _CRTDBG_MAP_ALLOC
# include <stdlib.h> # include <stdlib.h>
# include <crtdbg.h> # include <crtdbg.h>
# endif
#endif #endif
#ifndef SPRTF #include "sprtf.h"
# define SPRTF printf
#endif
/** 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;
@ -2017,7 +2012,7 @@ int main( int argc, char** argv )
# 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
set_log_file((char *)"temptidy.txt", 0); /* add_append_log(1); */ set_log_file((char *)"temptidy.txt", 0);
#endif #endif
tdoc = tidyCreate(); tdoc = tidyCreate();
@ -2431,7 +2426,7 @@ int main( int argc, char** argv )
if ( argc > 1 ) if ( argc > 1 )
{ {
htmlfil = argv[1]; htmlfil = argv[1];
#if (!defined(NDEBUG) && defined(_MSC_VER)) #if (!defined(NDEBUG))
SPRTF("Tidying '%s'\n", htmlfil); SPRTF("Tidying '%s'\n", htmlfil);
#endif /* DEBUG outout */ #endif /* DEBUG outout */
if ( tidyOptGetBool(tdoc, TidyEmacs) ) if ( tidyOptGetBool(tdoc, TidyEmacs) )
@ -2463,7 +2458,7 @@ int main( int argc, char** argv )
if ( outfil ) { if ( outfil ) {
status = tidySaveFile( tdoc, outfil ); status = tidySaveFile( tdoc, outfil );
} else { } else {
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG)
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

@ -1418,10 +1418,8 @@ TIDY_EXPORT double TIDY_CALL tidyGetArgValueDouble(TidyMessage tmessage, /**<
** Your callback function will be provided with the following parameters. ** Your callback function will be provided with the following parameters.
** @param tdoc Indicates the source tidy document. ** @param tdoc Indicates the source tidy document.
** @param line Indicates the line in the source document at this point in the process. ** @param line Indicates the line in the source document at this point in the process.
** @param column Indicates the column in the source document at this point in the process. ** @param col Indicates the column in the source document at this point in the process.
** @param destLine Indicates the line number in the output document at this point in the process. ** @param destLine Indicates the line number in the output document at this point in the process.
** @return Your callback function will return `yes` if Tidy should include the
** report in its own output sink, or `no` if Tidy should suppress it.
*/ */
typedef void (TIDY_CALL *TidyPPProgress)( TidyDoc tdoc, uint line, uint col, uint destLine ); typedef void (TIDY_CALL *TidyPPProgress)( TidyDoc tdoc, uint line, uint col, uint destLine );
@ -1898,7 +1896,7 @@ TIDY_EXPORT uint TIDY_CALL tidyErrorCodeFromKey(ctmbstr code);
** @result Returns a TidyIterator, which is a token used to represent the ** @result Returns a TidyIterator, which is a token used to represent the
** current position in a list within LibTidy. ** current position in a list within LibTidy.
*/ */
TIDY_EXPORT TidyIterator TIDY_CALL getErrorCodeList(); TIDY_EXPORT TidyIterator TIDY_CALL getErrorCodeList(void);
/** Given a valid TidyIterator initiated with getErrorCodeList(), returns /** Given a valid TidyIterator initiated with getErrorCodeList(), returns
** an instance of the opaque type TidyMessageArgument, which serves as a token ** an instance of the opaque type TidyMessageArgument, which serves as a token
@ -1946,7 +1944,7 @@ TIDY_EXPORT Bool TIDY_CALL tidySetLanguage( ctmbstr languageCode );
/** Gets the current language used by Tidy. /** Gets the current language used by Tidy.
** @result Returns a string indicating the currently set language. ** @result Returns a string indicating the currently set language.
*/ */
TIDY_EXPORT ctmbstr TIDY_CALL tidyGetLanguage(); TIDY_EXPORT ctmbstr TIDY_CALL tidyGetLanguage(void);
/** @} /** @}
** @name Locale Mappings ** @name Locale Mappings
@ -1978,7 +1976,7 @@ opaque_type(tidyLocaleMapItem);
** @result Returns a TidyIterator, which is a token used to represent the ** @result Returns a TidyIterator, which is a token used to represent the
** current position in a list within LibTidy. ** current position in a list within LibTidy.
*/ */
TIDY_EXPORT TidyIterator TIDY_CALL getWindowsLanguageList(); TIDY_EXPORT TidyIterator TIDY_CALL getWindowsLanguageList(void);
/** Given a valid TidyIterator initiated with getWindowsLanguageList(), returns /** Given a valid TidyIterator initiated with getWindowsLanguageList(), returns
** a pointer to a tidyLocaleMapItem, which can be further interrogated with ** a pointer to a tidyLocaleMapItem, which can be further interrogated with
@ -2046,7 +2044,7 @@ TIDY_EXPORT ctmbstr TIDY_CALL tidyDefaultString( uint messageType );
** @result Returns a TidyIterator, which is a token used to represent the ** @result Returns a TidyIterator, which is a token used to represent the
** current position in a list within LibTidy. ** current position in a list within LibTidy.
*/ */
TIDY_EXPORT TidyIterator TIDY_CALL getStringKeyList(); TIDY_EXPORT TidyIterator TIDY_CALL getStringKeyList(void);
/** Given a valid TidyIterator initiated with getStringKeyList(), returns /** Given a valid TidyIterator initiated with getStringKeyList(), returns
** an unsigned integer representing the next key value. ** an unsigned integer representing the next key value.
@ -2076,7 +2074,7 @@ TIDY_EXPORT uint TIDY_CALL getNextStringKey( TidyIterator* iter );
** @result Returns a TidyIterator, which is a token used to represent the ** @result Returns a TidyIterator, which is a token used to represent the
** current position in a list within LibTidy. ** current position in a list within LibTidy.
*/ */
TIDY_EXPORT TidyIterator TIDY_CALL getInstalledLanguageList(); TIDY_EXPORT TidyIterator TIDY_CALL getInstalledLanguageList(void);
/** Given a valid TidyIterator initiated with getInstalledLanguageList(), /** Given a valid TidyIterator initiated with getInstalledLanguageList(),
** returns a string representing a language name that is installed in Tidy. ** returns a string representing a language name that is installed in Tidy.

View file

@ -481,6 +481,10 @@ extern "C" {
# define setmode _setmode # define setmode _setmode
# endif # endif
# if defined(_MSC_VER)
# define fileno _fileno
#endif
# define access _access # define access _access
# define strcasecmp _stricmp # define strcasecmp _stricmp
@ -647,6 +651,27 @@ opaque_type( TidyIterator );
} /* extern "C" */ } /* extern "C" */
#endif #endif
/*=============================================================================
* Debugging
* When building and not defining the NDEBUG macro, Tidy will output
* extensive debug information. In addition to this macro, you can supply
* build flags for additional diagnostic information:
* - _CRTDBG_MAP_ALLOC (_MSC_VER only)
* - DEBUG_ALLOCATION
* - DEBUG_MEMORY
*===========================================================================*/
#if !defined(NDEBUG)
# include "sprtf.h"
#endif
#ifndef SPRTF
# define SPRTF printf
#endif
#endif /* __TIDY_PLATFORM_H__ */ #endif /* __TIDY_PLATFORM_H__ */

View file

@ -9,16 +9,13 @@
#include "tidy.h" #include "tidy.h"
#include "forward.h" #include "forward.h"
#ifdef DEBUG_MEMORY
# include "sprtf.h"
#endif
static TidyMalloc g_malloc = NULL; static TidyMalloc g_malloc = NULL;
static TidyRealloc g_realloc = NULL; 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(_MSC_VER) && defined(DEBUG_MEMORY) #if !defined(NDEBUG) && 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;
@ -66,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(_MSC_VER) && defined(DEBUG_MEMORY) #if !defined(NDEBUG) && 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) {
@ -85,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(_MSC_VER) && defined(DEBUG_MEMORY) #if !defined(NDEBUG) && 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
@ -96,7 +93,7 @@ static void TIDY_CALL defaultFree( TidyAllocator* ARG_UNUSED(allocator), void* m
{ {
if ( mem ) if ( mem )
{ {
#if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_MEMORY) #if !defined(NDEBUG) && 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

@ -13,9 +13,6 @@
#include "forward.h" #include "forward.h"
#include "fileio.h" #include "fileio.h"
#include "tidy.h" #include "tidy.h"
#if !defined(NDEBUG) && defined(_MSC_VER)
# include "sprtf.h"
#endif
typedef struct _fp_input_source typedef struct _fp_input_source
{ {
@ -85,8 +82,8 @@ 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) && defined(_MSC_VER) #if !defined(NDEBUG)
if (_fileno(fout) != 2) if (fileno(fout) != 2)
{ {
if (bv != 0x0d) if (bv != 0x0d)
{ {

View file

@ -10,9 +10,6 @@
#include "attrs.h" #include "attrs.h"
#include "streamio.h" #include "streamio.h"
#include "tmbstr.h" #include "tmbstr.h"
#if !defined(NDEBUG) && defined(_MSC_VER)
# include "sprtf.h"
#endif
/* duplicate attributes */ /* duplicate attributes */
AttVal *TY_(DupAttrs)( TidyDocImpl* doc, AttVal *attrs) AttVal *TY_(DupAttrs)( TidyDocImpl* doc, AttVal *attrs)
@ -272,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) && defined(_MSC_VER) #if !defined(NDEBUG)
if ( lexer->istacksize == 0 ) if ( lexer->istacksize == 0 )
{ {
SPRTF( "WARNING: ZERO sized istack!\n" ); SPRTF( "WARNING: ZERO sized istack!\n" );

View file

@ -113,7 +113,7 @@ Bool TY_(tidySetLanguage)( ctmbstr languageCode );
/** /**
* Gets the current language used by Tidy. * Gets the current language used by Tidy.
*/ */
ctmbstr TY_(tidyGetLanguage)(); ctmbstr TY_(tidyGetLanguage)(void);
/** /**
* Provides a string given `messageType` in the current * Provides a string given `messageType` in the current
@ -145,7 +145,7 @@ ctmbstr TY_(tidyDefaultString)( uint messageType );
* these are provided for documentation generation purposes * these are provided for documentation generation purposes
* and probably aren't useful for LibTidy implementors. * and probably aren't useful for LibTidy implementors.
*/ */
TidyIterator TY_(getStringKeyList)(); TidyIterator TY_(getStringKeyList)(void);
/* /*
* Provides the next key value in Tidy's list of localized * Provides the next key value in Tidy's list of localized
@ -160,7 +160,7 @@ uint TY_(getNextStringKey)( TidyIterator* iter );
* in Tidy's structure of Windows<->POSIX local mapping. * in Tidy's structure of Windows<->POSIX local mapping.
* Items can be retrieved with getNextWindowsLanguage(); * Items can be retrieved with getNextWindowsLanguage();
*/ */
TidyIterator TY_(getWindowsLanguageList)(); TidyIterator TY_(getWindowsLanguageList)(void);
/** /**
* Returns the next record of type `localeMapItem` in * Returns the next record of type `localeMapItem` in
@ -183,7 +183,7 @@ const ctmbstr TY_(TidyLangPosixName)( const tidyLocaleMapItemImpl *item );
* in Tidy's list of installed language codes. * in Tidy's list of installed language codes.
* Items can be retrieved with getNextInstalledLanguage(); * Items can be retrieved with getNextInstalledLanguage();
*/ */
TidyIterator TY_(getInstalledLanguageList)(); TidyIterator TY_(getInstalledLanguageList)(void);
/** /**
* Returns the next installed language. * Returns the next installed language.

View file

@ -39,15 +39,8 @@
#include "clean.h" #include "clean.h"
#include "utf8.h" #include "utf8.h"
#include "streamio.h" #include "streamio.h"
#ifdef _MSC_VER
# include "sprtf.h"
#endif
#ifndef SPRTF #if !defined(NDEBUG)
# define SPRTF printf
#endif
#if !defined(NDEBUG) && defined(_MSC_VER)
/* #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;
@ -180,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 #else /* NDEBUG is define */
#define GTDBG(a,b,c) #define GTDBG(a,b,c)
#endif #endif /* !defined(NDEBUG) */
/* Forward references /* Forward references
*/ */
@ -329,7 +322,7 @@ static uint GetVersFromFPI(ctmbstr fpi)
return 0; return 0;
} }
#if (defined(_MSC_VER) && !defined(NDEBUG)) #if defined(_MSC_VER)
/* Issue #377 - Output diminishing version bits */ /* Issue #377 - Output diminishing version bits */
typedef struct tagV2S { typedef struct tagV2S {
uint bit; uint bit;
@ -420,14 +413,14 @@ void TY_(ConstrainVersion)(TidyDocImpl* doc, uint vers)
SPRTF("After : %s\n", vcur); SPRTF("After : %s\n", vcur);
} }
} }
#else /* !#if (defined(_MSC_VER) && !defined(NDEBUG)) */ #else /* !#if defined(_MSC_VER) */
/* 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) && !defined(NDEBUG)) y/n */ #endif /* #if defined(_MSC_VER) y/n */
Bool TY_(IsWhite)(uint c) Bool TY_(IsWhite)(uint c)
{ {
@ -1420,7 +1413,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(_MSC_VER) && defined(DEBUG_ALLOCATION) #if !defined(NDEBUG) && defined(DEBUG_ALLOCATION)
SPRTF("Allocated node %p\n", node ); SPRTF("Allocated node %p\n", node );
#endif #endif
return node; return node;
@ -1514,7 +1507,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(_MSC_VER) && defined(DEBUG_ALLOCATION) #if !defined(NDEBUG) && 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) {
@ -2491,7 +2484,7 @@ Node* TY_(GetToken)( TidyDocImpl* doc, GetTokenMode mode )
return GetTokenFromStream( doc, mode ); return GetTokenFromStream( doc, mode );
} }
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG)
static void check_me(char *name) static void check_me(char *name)
{ {
SPRTF("Have node %s\n", name); SPRTF("Have node %s\n", name);
@ -3425,7 +3418,7 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
return node; /* the COMMENT token */ return node; /* the COMMENT token */
} }
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG)
SPRTF("Returning NULL...\n"); SPRTF("Returning NULL...\n");
#endif #endif
return NULL; return NULL;

View file

@ -14,9 +14,6 @@
#include "streamio.h" #include "streamio.h"
#include "tmbstr.h" #include "tmbstr.h"
#include "utf8.h" #include "utf8.h"
#if !defined(NDEBUG) && defined(_MSC_VER)
# include "sprtf.h"
#endif
#include "version.h" #include "version.h"

View file

@ -213,7 +213,7 @@ uint TY_(tidyErrorCodeFromKey)(ctmbstr code);
* `TidyReportFilter3`. * `TidyReportFilter3`.
* Items can be retrieved with getNextErrorCode(); * Items can be retrieved with getNextErrorCode();
*/ */
TidyIterator TY_(getErrorCodeList)(); TidyIterator TY_(getErrorCodeList)(void);
/** /**
* Returns the next error code having initialized the iterator * Returns the next error code having initialized the iterator

View file

@ -10,9 +10,6 @@
#include "tidy-int.h" #include "tidy-int.h"
#include "limits.h" #include "limits.h"
#include "tmbstr.h" #include "tmbstr.h"
#if !defined(NDEBUG) && defined(_MSC_VER)
# include "sprtf.h"
#endif
/********************************************************************* /*********************************************************************

View file

@ -12,13 +12,6 @@
#include "clean.h" #include "clean.h"
#include "tags.h" #include "tags.h"
#include "tmbstr.h" #include "tmbstr.h"
#ifdef _MSC_VER
# include "sprtf.h"
#endif
#ifndef SPRTF
# define SPRTF printf
#endif
/* /*
Issue #72 - Need to know to avoid error-reporting - no warning only if --show-body-only yes Issue #72 - Need to know to avoid error-reporting - no warning only if --show-body-only yes
@ -461,7 +454,7 @@ 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) && defined(_MSC_VER) #if !defined(NDEBUG)
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 #endif
@ -801,7 +794,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -809,7 +802,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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,
@ -817,7 +810,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -882,7 +875,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -936,7 +929,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -1100,7 +1093,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -1120,7 +1113,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -1179,7 +1172,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -1194,7 +1187,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -1209,7 +1202,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -1224,7 +1217,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -1234,7 +1227,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
else else
{ {
TrimSpaces( doc, element ); TrimSpaces( doc, element );
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -1278,7 +1271,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -1346,7 +1339,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
} }
TrimSpaces( doc, element ); TrimSpaces( doc, element );
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -1546,18 +1539,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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) && defined(_MSC_VER) #if !defined(NDEBUG)
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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -1639,7 +1632,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -1730,7 +1723,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -1820,7 +1813,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -1844,7 +1837,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -1861,7 +1854,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -1887,7 +1880,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -1924,7 +1917,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -2050,7 +2043,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -2102,7 +2095,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -2115,7 +2108,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -2146,7 +2139,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -2334,7 +2327,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) && defined(_MSC_VER) #if !defined(NDEBUG)
static int in_parse_list = 0; static int in_parse_list = 0;
#endif #endif
Lexer* lexer = doc->lexer; Lexer* lexer = doc->lexer;
@ -2342,13 +2335,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -2363,7 +2356,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -2430,7 +2423,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -2463,7 +2456,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -2475,7 +2468,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -2514,7 +2507,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -2938,7 +2931,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) && defined(_MSC_VER) #if !defined(NDEBUG)
static int in_parse_table = 0; static int in_parse_table = 0;
#endif #endif
Lexer* lexer = doc->lexer; Lexer* lexer = doc->lexer;
@ -2948,7 +2941,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) && defined(_MSC_VER) #if !defined(NDEBUG)
in_parse_table++; in_parse_table++;
SPRTF("Entering ParseTableTag %d...\n",in_parse_table); SPRTF("Entering ParseTableTag %d...\n",in_parse_table);
#endif #endif
@ -2973,7 +2966,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -3053,7 +3046,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -3067,7 +3060,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -3088,7 +3081,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -3324,14 +3317,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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) && defined(_MSC_VER) #if !defined(NDEBUG)
in_parse_select++; in_parse_select++;
SPRTF("Entering ParseSelect %d...\n",in_parse_select); SPRTF("Entering ParseSelect %d...\n",in_parse_select);
#endif #endif
@ -3343,7 +3336,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -3372,7 +3365,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -3381,14 +3374,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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) && defined(_MSC_VER) #if !defined(NDEBUG)
in_parse_datalist++; in_parse_datalist++;
SPRTF("Entering ParseDatalist %d...\n",in_parse_datalist); SPRTF("Entering ParseDatalist %d...\n",in_parse_datalist);
#endif #endif
@ -3400,7 +3393,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -3429,7 +3422,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) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -3635,7 +3628,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) && defined(_MSC_VER) #if !defined(NDEBUG)
SPRTF("Enter ParseHead...\n"); SPRTF("Enter ParseHead...\n");
#endif #endif
while ((node = TY_(GetToken)(doc, IgnoreWhitespace)) != NULL) while ((node = TY_(GetToken)(doc, IgnoreWhitespace)) != NULL)
@ -3741,7 +3734,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) && defined(_MSC_VER) #if !defined(NDEBUG)
SPRTF("Exit ParseHead 1...\n"); SPRTF("Exit ParseHead 1...\n");
#endif #endif
} }
@ -3797,7 +3790,7 @@ 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) && defined(_MSC_VER) #if !defined(NDEBUG)
SPRTF("Enter ParseBody...\n"); SPRTF("Enter ParseBody...\n");
#endif #endif
@ -4064,7 +4057,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) && defined(_MSC_VER) #if !defined(NDEBUG)
SPRTF("Exit ParseBody 1...\n"); SPRTF("Exit ParseBody 1...\n");
#endif #endif
} }
@ -4253,7 +4246,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) && defined(_MSC_VER) #if !defined(NDEBUG)
SPRTF("Entering ParseHTML...\n"); SPRTF("Entering ParseHTML...\n");
#endif #endif
TY_(SetOptionBool)( doc, TidyXmlTags, no ); TY_(SetOptionBool)( doc, TidyXmlTags, no );
@ -4311,7 +4304,7 @@ 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) && defined(_MSC_VER) #if !defined(NDEBUG)
SPRTF("Exit ParseHTML 1...\n"); SPRTF("Exit ParseHTML 1...\n");
#endif #endif
return; return;
@ -4482,7 +4475,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) && defined(_MSC_VER) #if !defined(NDEBUG)
SPRTF("Exit ParseHTML 2...\n"); SPRTF("Exit ParseHTML 2...\n");
#endif #endif
} }

View file

@ -18,15 +18,10 @@
#include "utf8.h" #include "utf8.h"
/* *** FOR DEBUG ONLY *** */ /* *** FOR DEBUG ONLY *** */
#if !defined(NDEBUG) && defined(_MSC_VER)
/* #define DEBUG_PPRINT */ /* #define DEBUG_PPRINT */
/* #define DEBUG_INDENT */ /* #define DEBUG_INDENT */
# ifdef DEBUG_PPRINT #if !defined(NDEBUG) && 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
# ifdef DEBUG_INDENT
# include "sprtf.h"
# endif
#endif #endif
/* /*
@ -619,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(_MSC_VER) && defined(DEBUG_INDENT) #if !defined(NDEBUG) && 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;
@ -683,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(_MSC_VER) && defined(DEBUG_INDENT) #if !defined(NDEBUG) && 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;
@ -705,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(_MSC_VER) && defined(DEBUG_INDENT) #if !defined(NDEBUG) && 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;
@ -733,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(_MSC_VER) && defined(DEBUG_INDENT) #if !defined(NDEBUG) && 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;
@ -762,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(_MSC_VER) && defined(DEBUG_INDENT) #if !defined(NDEBUG) && 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;
@ -1950,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(_MSC_VER) && defined(DEBUG_INDENT) #if !defined(NDEBUG) && 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;
@ -2058,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(_MSC_VER) && defined(DEBUG_PPRINT) #if !defined(NDEBUG) && defined(DEBUG_PPRINT)
dbg_show_node( doc, node, 4, GetSpaces( &doc->pprint ) ); dbg_show_node( doc, node, 4, GetSpaces( &doc->pprint ) );
#endif #endif
@ -2318,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(_MSC_VER) && defined(DEBUG_INDENT) #if !defined(NDEBUG) && 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

@ -1,20 +1,15 @@
/* /* sprtf.c
* SPRTF - Log output utility - part of the HTML Tidy project * SPRTF - Log output utility - part of the HTML Tidy project
* *
* Author: Geoff R. McLane <reports _at_ geoffair _dot_ info> * Copyright (c) 1998-2017 Geoff R. McLane and HTACG
* License: MIT (see tidy.h for the copyright notice)
*
* Revision 1.0.2 2017/02/12 17:06:02 geoff - correct license and coding style
* Revision 1.0.1 2012/11/06 13:01:25 geoff
* Revision 1.0.0 2012/10/17 00:00:00 geoff
* *
* See tidy.h for the copyright notice.
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning( disable : 4995 ) # pragma warning( disable : 4995 )
#endif #endif
/* Module: sprtf.c */
/* Debug log file output */
#include <stdio.h> /* fopen()... */ #include <stdio.h> /* fopen()... */
#include <string.h> /* strcpy */ #include <string.h> /* strcpy */
#include <stdarg.h> /* va_start, va_end, ... */ #include <stdarg.h> /* va_start, va_end, ... */

View file

@ -1,24 +1,32 @@
/*
* SPRTF - Log output utility - part of the HTML Tidy project
*
* Author: Geoff R. McLane <reports _at_ geoffair _dot_ info>
* License: MIT (see tidy.h for the copyright notice)
*
* Revision 1.0.2 2017/02/12 17:06:02 geoff - correct license and coding style
* Revision 1.0.1 2012/11/06 13:01:25 geoff
* Revision 1.0.0 2012/10/17 00:00:00 geoff
*
*/
/* Module: sprtf.h */
/* Debug log file output */
#ifndef _SPRTF_HXX_ #ifndef _SPRTF_HXX_
# define _SPRTF_HXX_ #define _SPRTF_HXX_
/**************************************************************************//**
* @file
* Log output utility - part of the HTML Tidy project
*
* @author Geoff R. McLane [reports _at_ geoffair _dot_ info]
*
* @copyright
* Copyright (c) 1998-2017 Geoff R. McLane and HTACG.
* @par
* All Rights Reserved.
* @par
* See `tidy.h` for the complete license.
*
* @date 2017/02/12 17:06:02 Revision 1.0.2 geoff - correct license and coding style
* @date 2012/11/06 13:01:25 Revision 1.0.1 geoff
* @date 2012/10/17 00:00:00 Revision 1.0.0 geoff
* @date Additional updates: consult git log
*
******************************************************************************/
#include "tidyplatform.h" #include "tidyplatform.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#ifdef _MSC_VER #ifdef _MSC_VER
# define MCDECL _cdecl # define MCDECL _cdecl
#else #else
@ -42,23 +50,21 @@ TIDY_EXPORT int MCDECL sprtf( const char *pf, ... );
#define M_MAX_SPRTF 2048 #define M_MAX_SPRTF 2048
TIDY_EXPORT int direct_out_it( char *cp ); TIDY_EXPORT int direct_out_it( char *cp );
TIDY_EXPORT char *GetNxtBuf(); TIDY_EXPORT char *GetNxtBuf(void);
#define EndBuf(a) ( a + strlen(a) ) #define EndBuf(a) ( a + strlen(a) )
TIDY_EXPORT char *get_date_stg(); TIDY_EXPORT char *get_date_stg(void);
TIDY_EXPORT char *get_time_stg(); TIDY_EXPORT char *get_time_stg(void);
TIDY_EXPORT char *get_date_time_stg(); TIDY_EXPORT char *get_date_time_stg(void);
#ifdef _MSC_VER #ifdef _MSC_VER
TIDY_EXPORT int gettimeofday(struct timeval *tp, void *tzp); TIDY_EXPORT int gettimeofday(struct timeval *tp, void *tzp);
#endif #endif
#ifndef SPRTF
# define SPRTF sprtf
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* #ifndef _SPRTF_HXX_*/ #endif /* #ifndef _SPRTF_HXX_*/
/* eof - sprtf.h */ /* eof - sprtf.h */

View file

@ -10,9 +10,6 @@
#include "tidy-int.h" #include "tidy-int.h"
#include "message.h" #include "message.h"
#include "tmbstr.h" #include "tmbstr.h"
#if !defined(NDEBUG) && defined(_MSC_VER)
# include "sprtf.h"
#endif
/* Attribute checking methods */ /* Attribute checking methods */
static CheckAttribs CheckIMG; static CheckAttribs CheckIMG;
static CheckAttribs CheckLINK; static CheckAttribs CheckLINK;
@ -476,10 +473,7 @@ static void declare( TidyDocImpl* doc, TidyTagImpl* tags,
} }
} }
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG)
/* ====================================================================
MSVC DEBUG ONLY
*/
void ListElementsPerVersion( uint vers, Bool has ) void ListElementsPerVersion( uint vers, Bool has )
{ {
uint val, cnt, total, wrap = 10; uint val, cnt, total, wrap = 10;
@ -525,7 +519,7 @@ void show_have_html5(void)
ListElementsPerVersion( VERS_HTML5, yes ); ListElementsPerVersion( VERS_HTML5, yes );
} }
#endif #endif /* !defined(NDEBUG) */
/* 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

@ -34,9 +34,6 @@
#include "mappedio.h" #include "mappedio.h"
#include "language.h" #include "language.h"
#if !defined(NDEBUG) && defined(_MSC_VER)
# include "sprtf.h"
#endif
/* Create/Destroy a Tidy "document" object */ /* Create/Destroy a Tidy "document" object */
static TidyDocImpl* tidyDocCreate( TidyAllocator *allocator ); static TidyDocImpl* tidyDocCreate( TidyAllocator *allocator );
@ -1408,7 +1405,7 @@ void tidyDocReportDoctype( TidyDocImpl* doc )
/***************************************************************************** /*****************************************************************************
* HTML5 STUFF * HTML5 STUFF
*****************************************************************************/ *****************************************************************************/
#if !defined(NDEBUG) && defined(_MSC_VER) #if 0 && !defined(NDEBUG)
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)
@ -1507,9 +1504,7 @@ void TY_(CheckHTML5)( TidyDocImpl* doc, Node* node )
Bool warn = yes; /* should this be a warning, error, or report??? */ Bool warn = yes; /* should this be a warning, error, or report??? */
AttVal* attr = NULL; AttVal* attr = NULL;
int i = 0; int i = 0;
#if !defined(NDEBUG) && defined(_MSC_VER)
// list_not_html5();
#endif
while (node) while (node)
{ {
if ( nodeHasAlignAttr( node ) ) { if ( nodeHasAlignAttr( node ) ) {
@ -1785,7 +1780,7 @@ void TY_(CheckHTMLTagsAttribsVersions)( TidyDocImpl* doc, Node* node )
} }
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG)
/* *** FOR DEBUG ONLY *** */ /* *** FOR DEBUG ONLY *** */
const char *dbg_get_lexer_type( void *vp ) const char *dbg_get_lexer_type( void *vp )
{ {
@ -1922,7 +1917,7 @@ int tidyDocCleanAndRepair( TidyDocImpl* doc )
Bool mergeEmphasis = cfgBool( doc, TidyMergeEmphasis ); Bool mergeEmphasis = cfgBool( doc, TidyMergeEmphasis );
Node* node; Node* node;
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG)
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
@ -2040,7 +2035,7 @@ int tidyDocCleanAndRepair( TidyDocImpl* doc )
} }
} }
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG)
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