Merge branch 'sprtf' into next
This commit is contained in:
commit
430fc6118d
|
@ -142,20 +142,21 @@ endif ()
|
|||
# NOTE: Currently only available in the Debug configuration build in
|
||||
# Windows, but could be maybe extended to Unix, others...
|
||||
#------------------------------------------------------------------------
|
||||
if (WIN32)
|
||||
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 )
|
||||
option( ENABLE_MEMORY_DEBUG "Set ON to output some memory diagnostics." 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)
|
||||
add_definitions ( -DDEBUG_MEMORY ) # see alloc.c for details
|
||||
message(STATUS "*** Note, alloc.c memory diagnostics are ON")
|
||||
endif ()
|
||||
|
||||
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 (WIN32)
|
||||
option( ENABLE_CRTDBG_MEMORY "Set ON to enable the Windows CRT debug library." OFF )
|
||||
|
||||
if (ENABLE_CRTDBG_MEMORY)
|
||||
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}/tagask.c ${SRCDIR}/tmbstr.c ${SRCDIR}/utf8.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
|
||||
${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}/tmbstr.h ${SRCDIR}/utf8.h ${SRCDIR}/tidy-int.h
|
||||
${SRCDIR}/version.h ${SRCDIR}/gdoc.h ${SRCDIR}/language.h
|
||||
${SRCDIR}/language_en.h )
|
||||
|
||||
if (MSVC)
|
||||
list(APPEND CFILES ${SRCDIR}/sprtf.c)
|
||||
list(APPEND LIBHFILES ${SRCDIR}/sprtf.h)
|
||||
endif ()
|
||||
${SRCDIR}/language_en.h ${SRCDIR}/sprtf.h )
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
|
|
@ -25,17 +25,12 @@
|
|||
#if defined(_WIN32)
|
||||
# include <windows.h> /* Force console to UTF8. */
|
||||
#endif
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
# include "sprtf.h"
|
||||
# ifdef _CRTDBG_MAP_ALLOC
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER) && defined(_CRTDBG_MAP_ALLOC)
|
||||
# include <stdlib.h>
|
||||
# include <crtdbg.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SPRTF
|
||||
# define SPRTF printf
|
||||
#endif
|
||||
#include "sprtf.h"
|
||||
|
||||
/** Tidy will send errors to this file, which will be stderr later. */
|
||||
static FILE* errout = NULL;
|
||||
|
@ -2017,7 +2012,7 @@ int main( int argc, char** argv )
|
|||
# if defined(_CRTDBG_MAP_ALLOC)
|
||||
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
|
||||
# endif
|
||||
set_log_file((char *)"temptidy.txt", 0); /* add_append_log(1); */
|
||||
set_log_file((char *)"temptidy.txt", 0);
|
||||
#endif
|
||||
|
||||
tdoc = tidyCreate();
|
||||
|
@ -2431,7 +2426,7 @@ int main( int argc, char** argv )
|
|||
if ( argc > 1 )
|
||||
{
|
||||
htmlfil = argv[1];
|
||||
#if (!defined(NDEBUG) && defined(_MSC_VER))
|
||||
#if (!defined(NDEBUG))
|
||||
SPRTF("Tidying '%s'\n", htmlfil);
|
||||
#endif /* DEBUG outout */
|
||||
if ( tidyOptGetBool(tdoc, TidyEmacs) )
|
||||
|
@ -2463,7 +2458,7 @@ int main( int argc, char** argv )
|
|||
if ( outfil ) {
|
||||
status = tidySaveFile( tdoc, outfil );
|
||||
} else {
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
static char tmp_buf[264];
|
||||
sprintf(tmp_buf,"%s.html",get_log_file());
|
||||
status = tidySaveFile( tdoc, tmp_buf );
|
||||
|
|
|
@ -1418,10 +1418,8 @@ TIDY_EXPORT double TIDY_CALL tidyGetArgValueDouble(TidyMessage tmessage, /**<
|
|||
** Your callback function will be provided with the following parameters.
|
||||
** @param tdoc Indicates the source tidy document.
|
||||
** @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.
|
||||
** @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 );
|
||||
|
||||
|
@ -1898,7 +1896,7 @@ TIDY_EXPORT uint TIDY_CALL tidyErrorCodeFromKey(ctmbstr code);
|
|||
** @result Returns a TidyIterator, which is a token used to represent the
|
||||
** 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
|
||||
** 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.
|
||||
** @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
|
||||
|
@ -1978,7 +1976,7 @@ opaque_type(tidyLocaleMapItem);
|
|||
** @result Returns a TidyIterator, which is a token used to represent the
|
||||
** 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
|
||||
** 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
|
||||
** 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
|
||||
** 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
|
||||
** 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(),
|
||||
** returns a string representing a language name that is installed in Tidy.
|
||||
|
|
|
@ -481,6 +481,10 @@ extern "C" {
|
|||
# define setmode _setmode
|
||||
# endif
|
||||
|
||||
# if defined(_MSC_VER)
|
||||
# define fileno _fileno
|
||||
#endif
|
||||
|
||||
# define access _access
|
||||
# define strcasecmp _stricmp
|
||||
|
||||
|
@ -647,6 +651,27 @@ opaque_type( TidyIterator );
|
|||
} /* extern "C" */
|
||||
#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__ */
|
||||
|
||||
|
||||
|
|
11
src/alloc.c
11
src/alloc.c
|
@ -9,16 +9,13 @@
|
|||
|
||||
#include "tidy.h"
|
||||
#include "forward.h"
|
||||
#ifdef DEBUG_MEMORY
|
||||
# include "sprtf.h"
|
||||
#endif
|
||||
|
||||
static TidyMalloc g_malloc = NULL;
|
||||
static TidyRealloc g_realloc = NULL;
|
||||
static TidyFree g_free = 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 realloccnt = 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) );
|
||||
if ( !p )
|
||||
defaultPanic( allocator,"Out of memory!");
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_MEMORY)
|
||||
#if !defined(NDEBUG) && defined(DEBUG_MEMORY)
|
||||
alloccnt++;
|
||||
SPRTF("%d: alloc MEM %p, size %d\n", alloccnt, p, (int)size );
|
||||
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) );
|
||||
if (!p)
|
||||
defaultPanic( allocator, "Out of memory!");
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_MEMORY)
|
||||
#if !defined(NDEBUG) && defined(DEBUG_MEMORY)
|
||||
realloccnt++;
|
||||
SPRTF("%d: realloc MEM %p, size %d\n", realloccnt, p, (int)newsize );
|
||||
#endif
|
||||
|
@ -96,7 +93,7 @@ static void TIDY_CALL defaultFree( TidyAllocator* ARG_UNUSED(allocator), void* m
|
|||
{
|
||||
if ( mem )
|
||||
{
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_MEMORY)
|
||||
#if !defined(NDEBUG) && defined(DEBUG_MEMORY)
|
||||
freecnt++;
|
||||
SPRTF("%d: free MEM %p\n", freecnt, mem );
|
||||
#endif
|
||||
|
|
|
@ -13,9 +13,6 @@
|
|||
#include "forward.h"
|
||||
#include "fileio.h"
|
||||
#include "tidy.h"
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
# include "sprtf.h"
|
||||
#endif
|
||||
|
||||
typedef struct _fp_input_source
|
||||
{
|
||||
|
@ -85,8 +82,8 @@ void TIDY_CALL TY_(filesink_putByte)( void* sinkData, byte bv )
|
|||
{
|
||||
FILE* fout = (FILE*) sinkData;
|
||||
fputc( bv, fout );
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
if (_fileno(fout) != 2)
|
||||
#if !defined(NDEBUG)
|
||||
if (fileno(fout) != 2)
|
||||
{
|
||||
if (bv != 0x0d)
|
||||
{
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
#include "attrs.h"
|
||||
#include "streamio.h"
|
||||
#include "tmbstr.h"
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
# include "sprtf.h"
|
||||
#endif
|
||||
|
||||
/* duplicate attributes */
|
||||
AttVal *TY_(DupAttrs)( TidyDocImpl* doc, AttVal *attrs)
|
||||
|
@ -272,7 +269,7 @@ Node *TY_(InsertedToken)( TidyDocImpl* doc )
|
|||
istack = lexer->insert;
|
||||
|
||||
/* #if 0 && defined(_DEBUG) */
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
if ( lexer->istacksize == 0 )
|
||||
{
|
||||
SPRTF( "WARNING: ZERO sized istack!\n" );
|
||||
|
|
|
@ -113,7 +113,7 @@ Bool TY_(tidySetLanguage)( ctmbstr languageCode );
|
|||
/**
|
||||
* Gets the current language used by Tidy.
|
||||
*/
|
||||
ctmbstr TY_(tidyGetLanguage)();
|
||||
ctmbstr TY_(tidyGetLanguage)(void);
|
||||
|
||||
/**
|
||||
* Provides a string given `messageType` in the current
|
||||
|
@ -145,7 +145,7 @@ ctmbstr TY_(tidyDefaultString)( uint messageType );
|
|||
* these are provided for documentation generation purposes
|
||||
* 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
|
||||
|
@ -160,7 +160,7 @@ uint TY_(getNextStringKey)( TidyIterator* iter );
|
|||
* in Tidy's structure of Windows<->POSIX local mapping.
|
||||
* Items can be retrieved with getNextWindowsLanguage();
|
||||
*/
|
||||
TidyIterator TY_(getWindowsLanguageList)();
|
||||
TidyIterator TY_(getWindowsLanguageList)(void);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Items can be retrieved with getNextInstalledLanguage();
|
||||
*/
|
||||
TidyIterator TY_(getInstalledLanguageList)();
|
||||
TidyIterator TY_(getInstalledLanguageList)(void);
|
||||
|
||||
/**
|
||||
* Returns the next installed language.
|
||||
|
|
27
src/lexer.c
27
src/lexer.c
|
@ -39,15 +39,8 @@
|
|||
#include "clean.h"
|
||||
#include "utf8.h"
|
||||
#include "streamio.h"
|
||||
#ifdef _MSC_VER
|
||||
# include "sprtf.h"
|
||||
#endif
|
||||
|
||||
#ifndef SPRTF
|
||||
# define SPRTF printf
|
||||
#endif
|
||||
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
/* #define DEBUG_ALLOCATION special EXTRA allocation debug information - VERY NOISY */
|
||||
static void check_me(char *name);
|
||||
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)
|
||||
#else
|
||||
#else /* NDEBUG is define */
|
||||
#define GTDBG(a,b,c)
|
||||
#endif
|
||||
#endif /* !defined(NDEBUG) */
|
||||
|
||||
/* Forward references
|
||||
*/
|
||||
|
@ -329,7 +322,7 @@ static uint GetVersFromFPI(ctmbstr fpi)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if (defined(_MSC_VER) && !defined(NDEBUG))
|
||||
#if defined(_MSC_VER)
|
||||
/* Issue #377 - Output diminishing version bits */
|
||||
typedef struct tagV2S {
|
||||
uint bit;
|
||||
|
@ -420,14 +413,14 @@ void TY_(ConstrainVersion)(TidyDocImpl* doc, uint vers)
|
|||
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 */
|
||||
/* this is handled here rather than in the tag/attr dicts */
|
||||
void TY_(ConstrainVersion)(TidyDocImpl* doc, uint vers)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
@ -1420,7 +1413,7 @@ Node *TY_(NewNode)(TidyAllocator* allocator, Lexer *lexer)
|
|||
node->column = lexer->columns;
|
||||
}
|
||||
node->type = TextNode;
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_ALLOCATION)
|
||||
#if !defined(NDEBUG) && defined(DEBUG_ALLOCATION)
|
||||
SPRTF("Allocated node %p\n", node );
|
||||
#endif
|
||||
return node;
|
||||
|
@ -1514,7 +1507,7 @@ void TY_(RemoveAttribute)( TidyDocImpl* doc, Node *node, AttVal *attr )
|
|||
*/
|
||||
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! */
|
||||
if (node) {
|
||||
if (RootNode != node->type) {
|
||||
|
@ -2491,7 +2484,7 @@ Node* TY_(GetToken)( TidyDocImpl* doc, GetTokenMode mode )
|
|||
return GetTokenFromStream( doc, mode );
|
||||
}
|
||||
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
static void check_me(char *name)
|
||||
{
|
||||
SPRTF("Have node %s\n", name);
|
||||
|
@ -3425,7 +3418,7 @@ static Node* GetTokenFromStream( TidyDocImpl* doc, GetTokenMode mode )
|
|||
return node; /* the COMMENT token */
|
||||
}
|
||||
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
SPRTF("Returning NULL...\n");
|
||||
#endif
|
||||
return NULL;
|
||||
|
|
|
@ -14,9 +14,6 @@
|
|||
#include "streamio.h"
|
||||
#include "tmbstr.h"
|
||||
#include "utf8.h"
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
# include "sprtf.h"
|
||||
#endif
|
||||
#include "version.h"
|
||||
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ uint TY_(tidyErrorCodeFromKey)(ctmbstr code);
|
|||
* `TidyReportFilter3`.
|
||||
* Items can be retrieved with getNextErrorCode();
|
||||
*/
|
||||
TidyIterator TY_(getErrorCodeList)();
|
||||
TidyIterator TY_(getErrorCodeList)(void);
|
||||
|
||||
/**
|
||||
* Returns the next error code having initialized the iterator
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
#include "tidy-int.h"
|
||||
#include "limits.h"
|
||||
#include "tmbstr.h"
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
# include "sprtf.h"
|
||||
#endif
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
|
|
123
src/parser.c
123
src/parser.c
|
@ -12,13 +12,6 @@
|
|||
#include "clean.h"
|
||||
#include "tags.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
|
||||
|
@ -461,7 +454,7 @@ static void TrimInitialSpace( TidyDocImpl* doc, Node *element, Node *text )
|
|||
node->end = element->start;
|
||||
lexer->lexbuf[node->start] = ' ';
|
||||
TY_(InsertNodeBeforeElement)(element ,node);
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
SPRTF("TrimInitialSpace: Created text node, inserted before <%s>\n",
|
||||
(element->element ? element->element : "unknown"));
|
||||
#endif
|
||||
|
@ -801,7 +794,7 @@ static void AddClassNoIndent( TidyDocImpl* doc, Node *node )
|
|||
*/
|
||||
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 parse_block_cnt = 0;
|
||||
#endif
|
||||
|
@ -809,7 +802,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
|
|||
Node *node;
|
||||
Bool checkstack = yes;
|
||||
uint istackbase = 0;
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
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
|
||||
|
||||
if ( element->tag->model & CM_EMPTY ) {
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_block--;
|
||||
SPRTF("Exit ParseBlockL 1 %d...\n",in_parse_block);
|
||||
#endif
|
||||
|
@ -882,7 +875,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
|
|||
|
||||
element->closed = yes;
|
||||
TrimSpaces( doc, element );
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_block--;
|
||||
SPRTF("Exit ParseBlock 2 %d...\n",in_parse_block);
|
||||
#endif
|
||||
|
@ -936,7 +929,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
|
|||
{
|
||||
TY_(UngetToken)( doc );
|
||||
TrimSpaces( doc, element );
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_block--;
|
||||
SPRTF("Exit ParseBlock 2 %d...\n",in_parse_block);
|
||||
#endif
|
||||
|
@ -1100,7 +1093,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
|
|||
{
|
||||
TY_(UngetToken)( doc );
|
||||
TrimSpaces( doc, element );
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_block--;
|
||||
SPRTF("Exit ParseBlock 3 %d...\n",in_parse_block);
|
||||
#endif
|
||||
|
@ -1120,7 +1113,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
|
|||
lexer->istackbase = istackbase;
|
||||
|
||||
TrimSpaces( doc, element );
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_block--;
|
||||
SPRTF("Exit ParseBlock 4 %d...\n",in_parse_block);
|
||||
#endif
|
||||
|
@ -1179,7 +1172,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
|
|||
element->parent->tag->parser == TY_(ParseList) )
|
||||
{
|
||||
TrimSpaces( doc, element );
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_block--;
|
||||
SPRTF("Exit ParseBlock 5 %d...\n",in_parse_block);
|
||||
#endif
|
||||
|
@ -1194,7 +1187,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
|
|||
if ( nodeIsDL(element->parent) )
|
||||
{
|
||||
TrimSpaces( doc, element );
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_block--;
|
||||
SPRTF("Exit ParseBlock 6 %d...\n",in_parse_block);
|
||||
#endif
|
||||
|
@ -1209,7 +1202,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
|
|||
/* In exiled mode, return so table processing can
|
||||
continue. */
|
||||
if (lexer->exiled) {
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_block--;
|
||||
SPRTF("Exit ParseBlock 7 %d...\n",in_parse_block);
|
||||
#endif
|
||||
|
@ -1224,7 +1217,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
|
|||
TY_(PopInline)( doc, NULL );
|
||||
lexer->istackbase = istackbase;
|
||||
TrimSpaces( doc, element );
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_block--;
|
||||
SPRTF("Exit ParseBlock 8 %d...\n",in_parse_block);
|
||||
#endif
|
||||
|
@ -1234,7 +1227,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
|
|||
else
|
||||
{
|
||||
TrimSpaces( doc, element );
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_block--;
|
||||
SPRTF("Exit ParseBlock 9 %d...\n",in_parse_block);
|
||||
#endif
|
||||
|
@ -1278,7 +1271,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
|
|||
if (!(mode & Preformatted))
|
||||
TrimSpaces(doc, element);
|
||||
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_block--;
|
||||
SPRTF("Exit ParseBlock 9b %d...\n",in_parse_block);
|
||||
#endif
|
||||
|
@ -1346,7 +1339,7 @@ void TY_(ParseBlock)( TidyDocImpl* doc, Node *element, GetTokenMode mode)
|
|||
}
|
||||
|
||||
TrimSpaces( doc, element );
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_block--;
|
||||
SPRTF("Exit ParseBlock 10 %d...\n",in_parse_block);
|
||||
#endif
|
||||
|
@ -1546,18 +1539,18 @@ void TY_(ParseNamespace)(TidyDocImpl* doc, Node *basenode, 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;
|
||||
#endif
|
||||
Lexer* lexer = doc->lexer;
|
||||
Node *node, *parent;
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_inline++;
|
||||
SPRTF("Entering ParseInline %d...\n",in_parse_inline);
|
||||
#endif
|
||||
|
||||
if (element->tag->model & CM_EMPTY) {
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_inline--;
|
||||
SPRTF("Exit ParseInline 1 %d...\n",in_parse_inline);
|
||||
#endif
|
||||
|
@ -1639,7 +1632,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
|
|||
|
||||
element->closed = yes;
|
||||
TrimSpaces( doc, element );
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_inline--;
|
||||
SPRTF("Exit ParseInline 2 %d...\n",in_parse_inline);
|
||||
#endif
|
||||
|
@ -1730,7 +1723,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
|
|||
|
||||
if (!(mode & Preformatted))
|
||||
TrimSpaces(doc, element);
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_inline--;
|
||||
SPRTF("Exit ParseInline 3 %d...\n",in_parse_inline);
|
||||
#endif
|
||||
|
@ -1820,7 +1813,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
|
|||
TY_(InlineDup1)( doc, NULL, element ); /* dupe the <i>, after </b> */
|
||||
if (!(mode & Preformatted))
|
||||
TrimSpaces( doc, element );
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_inline--;
|
||||
SPRTF("Exit ParseInline 4 %d...\n",in_parse_inline);
|
||||
#endif
|
||||
|
@ -1844,7 +1837,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
|
|||
|
||||
if (!(mode & Preformatted))
|
||||
TrimSpaces(doc, element);
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_inline--;
|
||||
SPRTF("Exit ParseInline 5 %d...\n",in_parse_inline);
|
||||
#endif
|
||||
|
@ -1861,7 +1854,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
|
|||
{
|
||||
TY_(UngetToken)( doc );
|
||||
TrimSpaces(doc, element);
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_inline--;
|
||||
SPRTF("Exit ParseInline 6 %d...\n",in_parse_inline);
|
||||
#endif
|
||||
|
@ -1887,7 +1880,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
|
|||
if (!(mode & Preformatted))
|
||||
TrimSpaces(doc, element);
|
||||
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_inline--;
|
||||
SPRTF("Exit ParseInline 7 %d...\n",in_parse_inline);
|
||||
#endif
|
||||
|
@ -1924,7 +1917,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
|
|||
if (!(mode & Preformatted))
|
||||
TrimSpaces(doc, element);
|
||||
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_inline--;
|
||||
SPRTF("Exit ParseInline 8 %d...\n",in_parse_inline);
|
||||
#endif
|
||||
|
@ -2050,7 +2043,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
|
|||
if (!(mode & Preformatted))
|
||||
TrimSpaces(doc, element);
|
||||
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_inline--;
|
||||
SPRTF("Exit ParseInline 9 %d...\n",in_parse_inline);
|
||||
#endif
|
||||
|
@ -2102,7 +2095,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
|
|||
{
|
||||
TY_(DiscardElement)( doc, element );
|
||||
TY_(UngetToken)( doc );
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_inline--;
|
||||
SPRTF("Exit ParseInline 10 %d...\n",in_parse_inline);
|
||||
#endif
|
||||
|
@ -2115,7 +2108,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
|
|||
if (!(mode & Preformatted))
|
||||
TrimSpaces(doc, element);
|
||||
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_inline--;
|
||||
SPRTF("Exit ParseInline 11 %d...\n",in_parse_inline);
|
||||
#endif
|
||||
|
@ -2146,7 +2139,7 @@ void TY_(ParseInline)( TidyDocImpl* doc, Node *element, GetTokenMode mode )
|
|||
if (!(element->tag->model & CM_OPT))
|
||||
TY_(Report)(doc, element, node, MISSING_ENDTAG_FOR);
|
||||
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_inline--;
|
||||
SPRTF("Exit ParseInline 12 %d...\n",in_parse_inline);
|
||||
#endif
|
||||
|
@ -2334,7 +2327,7 @@ static Bool FindLastLI( Node *list, Node **lastli )
|
|||
|
||||
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;
|
||||
#endif
|
||||
Lexer* lexer = doc->lexer;
|
||||
|
@ -2342,13 +2335,13 @@ void TY_(ParseList)(TidyDocImpl* doc, Node *list, GetTokenMode ARG_UNUSED(mode))
|
|||
Bool wasblock;
|
||||
Bool nodeisOL = nodeIsOL(list);
|
||||
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_list++;
|
||||
SPRTF("Entering ParseList %d...\n",in_parse_list);
|
||||
#endif
|
||||
if (list->tag->model & CM_EMPTY)
|
||||
{
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_list--;
|
||||
SPRTF("Exit ParseList 1 %d... CM_EMPTY\n",in_parse_list);
|
||||
#endif
|
||||
|
@ -2363,7 +2356,7 @@ void TY_(ParseList)(TidyDocImpl* doc, Node *list, GetTokenMode ARG_UNUSED(mode))
|
|||
{
|
||||
TY_(FreeNode)( doc, node);
|
||||
list->closed = yes;
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_list--;
|
||||
SPRTF("Exit ParseList 2 %d... Endtag\n",in_parse_list);
|
||||
#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_(UngetToken)( doc );
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_list--;
|
||||
SPRTF("Exit ParseList 3 %d... No End Tag\n",in_parse_list);
|
||||
#endif
|
||||
|
@ -2463,7 +2456,7 @@ void TY_(ParseList)(TidyDocImpl* doc, Node *list, GetTokenMode ARG_UNUSED(mode))
|
|||
if (TY_(nodeHasCM)(node,CM_BLOCK) && lexer->excludeBlocks)
|
||||
{
|
||||
TY_(Report)(doc, list, node, MISSING_ENDTAG_BEFORE);
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_list--;
|
||||
SPRTF("Exit ParseList 4 %d... No End Tag\n",in_parse_list);
|
||||
#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)
|
||||
|| nodeIsTABLE(node)) )
|
||||
{
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_list--;
|
||||
SPRTF("Exit ParseList 5 %d... exiled\n",in_parse_list);
|
||||
#endif
|
||||
|
@ -2514,7 +2507,7 @@ void TY_(ParseList)(TidyDocImpl* doc, Node *list, GetTokenMode ARG_UNUSED(mode))
|
|||
}
|
||||
|
||||
TY_(Report)(doc, list, node, MISSING_ENDTAG_FOR);
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_list--;
|
||||
SPRTF("Exit ParseList 6 %d... missing end tag\n",in_parse_list);
|
||||
#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))
|
||||
{
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
static int in_parse_table = 0;
|
||||
#endif
|
||||
Lexer* lexer = doc->lexer;
|
||||
|
@ -2948,7 +2941,7 @@ void TY_(ParseTableTag)(TidyDocImpl* doc, Node *table, GetTokenMode ARG_UNUSED(m
|
|||
TY_(DeferDup)( doc );
|
||||
istackbase = lexer->istackbase;
|
||||
lexer->istackbase = lexer->istacksize;
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_table++;
|
||||
SPRTF("Entering ParseTableTag %d...\n",in_parse_table);
|
||||
#endif
|
||||
|
@ -2973,7 +2966,7 @@ void TY_(ParseTableTag)(TidyDocImpl* doc, Node *table, GetTokenMode ARG_UNUSED(m
|
|||
}
|
||||
lexer->istackbase = istackbase;
|
||||
table->closed = yes;
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_table--;
|
||||
SPRTF("Exit ParseTableTag 1 %d... EndTag\n",in_parse_table);
|
||||
#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_(UngetToken)( doc );
|
||||
lexer->istackbase = istackbase;
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_table--;
|
||||
SPRTF("Exit ParseTableTag 2 %d... missing EndTag\n",in_parse_table);
|
||||
#endif
|
||||
|
@ -3067,7 +3060,7 @@ void TY_(ParseTableTag)(TidyDocImpl* doc, Node *table, GetTokenMode ARG_UNUSED(m
|
|||
TY_(UngetToken)( doc );
|
||||
TY_(Report)(doc, table, node, TAG_NOT_ALLOWED_IN);
|
||||
lexer->istackbase = istackbase;
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_table--;
|
||||
SPRTF("Exit ParseTableTag 3 %d... CM_TABLE\n",in_parse_table);
|
||||
#endif
|
||||
|
@ -3088,7 +3081,7 @@ void TY_(ParseTableTag)(TidyDocImpl* doc, Node *table, GetTokenMode ARG_UNUSED(m
|
|||
|
||||
TY_(Report)(doc, table, node, MISSING_ENDTAG_FOR);
|
||||
lexer->istackbase = istackbase;
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_table--;
|
||||
SPRTF("Exit ParseTableTag 4 %d... missing end\n",in_parse_table);
|
||||
#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))
|
||||
{
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
static int in_parse_select = 0;
|
||||
#endif
|
||||
Lexer* lexer = doc->lexer;
|
||||
Node *node;
|
||||
|
||||
lexer->insert = NULL; /* defer implicit inline start tags */
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_select++;
|
||||
SPRTF("Entering ParseSelect %d...\n",in_parse_select);
|
||||
#endif
|
||||
|
@ -3343,7 +3336,7 @@ void TY_(ParseSelect)(TidyDocImpl* doc, Node *field, GetTokenMode ARG_UNUSED(mod
|
|||
TY_(FreeNode)( doc, node);
|
||||
field->closed = yes;
|
||||
TrimSpaces(doc, field);
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_select--;
|
||||
SPRTF("Exit ParseSelect 1 %d...\n",in_parse_select);
|
||||
#endif
|
||||
|
@ -3372,7 +3365,7 @@ void TY_(ParseSelect)(TidyDocImpl* doc, Node *field, GetTokenMode ARG_UNUSED(mod
|
|||
}
|
||||
|
||||
TY_(Report)(doc, field, node, MISSING_ENDTAG_FOR);
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_select--;
|
||||
SPRTF("Exit ParseSelect 2 %d...\n",in_parse_select);
|
||||
#endif
|
||||
|
@ -3381,14 +3374,14 @@ void TY_(ParseSelect)(TidyDocImpl* doc, Node *field, GetTokenMode ARG_UNUSED(mod
|
|||
/* HTML5 */
|
||||
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;
|
||||
#endif
|
||||
Lexer* lexer = doc->lexer;
|
||||
Node *node;
|
||||
|
||||
lexer->insert = NULL; /* defer implicit inline start tags */
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_datalist++;
|
||||
SPRTF("Entering ParseDatalist %d...\n",in_parse_datalist);
|
||||
#endif
|
||||
|
@ -3400,7 +3393,7 @@ void TY_(ParseDatalist)(TidyDocImpl* doc, Node *field, GetTokenMode ARG_UNUSED(m
|
|||
TY_(FreeNode)( doc, node);
|
||||
field->closed = yes;
|
||||
TrimSpaces(doc, field);
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_datalist--;
|
||||
SPRTF("Exit ParseDatalist 1 %d...\n",in_parse_datalist);
|
||||
#endif
|
||||
|
@ -3429,7 +3422,7 @@ void TY_(ParseDatalist)(TidyDocImpl* doc, Node *field, GetTokenMode ARG_UNUSED(m
|
|||
}
|
||||
|
||||
TY_(Report)(doc, field, node, MISSING_ENDTAG_FOR);
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
in_parse_datalist--;
|
||||
SPRTF("Exit ParseDatalist 2 %d...\n",in_parse_datalist);
|
||||
#endif
|
||||
|
@ -3635,7 +3628,7 @@ void TY_(ParseHead)(TidyDocImpl* doc, Node *head, GetTokenMode ARG_UNUSED(mode))
|
|||
int HasTitle = 0;
|
||||
int HasBase = 0;
|
||||
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
SPRTF("Enter ParseHead...\n");
|
||||
#endif
|
||||
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_(FreeNode)( doc, node);
|
||||
}
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
SPRTF("Exit ParseHead 1...\n");
|
||||
#endif
|
||||
}
|
||||
|
@ -3797,7 +3790,7 @@ void TY_(ParseBody)(TidyDocImpl* doc, Node *body, GetTokenMode mode)
|
|||
checkstack = yes;
|
||||
|
||||
TY_(BumpObject)( doc, body->parent );
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
SPRTF("Enter ParseBody...\n");
|
||||
#endif
|
||||
|
||||
|
@ -4064,7 +4057,7 @@ void TY_(ParseBody)(TidyDocImpl* doc, Node *body, GetTokenMode mode)
|
|||
TY_(Report)(doc, body, node, DISCARDING_UNEXPECTED);
|
||||
TY_(FreeNode)( doc, node);
|
||||
}
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
SPRTF("Exit ParseBody 1...\n");
|
||||
#endif
|
||||
}
|
||||
|
@ -4253,7 +4246,7 @@ void TY_(ParseHTML)(TidyDocImpl* doc, Node *html, GetTokenMode mode)
|
|||
Node *frameset = NULL;
|
||||
Node *noframes = NULL;
|
||||
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
SPRTF("Entering ParseHTML...\n");
|
||||
#endif
|
||||
TY_(SetOptionBool)( doc, TidyXmlTags, no );
|
||||
|
@ -4311,7 +4304,7 @@ void TY_(ParseHTML)(TidyDocImpl* doc, Node *html, GetTokenMode mode)
|
|||
TY_(InsertNodeAtEnd)(html, node);
|
||||
TY_(ParseBody)(doc, node, mode);
|
||||
}
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
SPRTF("Exit ParseHTML 1...\n");
|
||||
#endif
|
||||
return;
|
||||
|
@ -4482,7 +4475,7 @@ void TY_(ParseHTML)(TidyDocImpl* doc, Node *html, GetTokenMode mode)
|
|||
|
||||
TY_(InsertNodeAtEnd)(html, node);
|
||||
ParseTag(doc, node, mode);
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
SPRTF("Exit ParseHTML 2...\n");
|
||||
#endif
|
||||
}
|
||||
|
|
23
src/pprint.c
23
src/pprint.c
|
@ -18,16 +18,11 @@
|
|||
#include "utf8.h"
|
||||
|
||||
/* *** FOR DEBUG ONLY *** */
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
/* #define DEBUG_PPRINT */
|
||||
/* #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 );
|
||||
#endif
|
||||
# ifdef DEBUG_INDENT
|
||||
# include "sprtf.h"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
Block-level and unknown elements are printed on
|
||||
|
@ -619,7 +614,7 @@ static Bool CheckWrapIndent( TidyDocImpl* doc, uint indent )
|
|||
WrapLine( doc );
|
||||
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 );
|
||||
#endif
|
||||
pprint->indent[ 0 ].spaces = indent;
|
||||
|
@ -683,7 +678,7 @@ void TY_(PFlushLine)( TidyDocImpl* doc, uint 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 );
|
||||
#endif
|
||||
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 */
|
||||
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 );
|
||||
#endif
|
||||
pprint->indent[ 0 ].spaces = indent;
|
||||
|
@ -733,7 +728,7 @@ void TY_(PFlushLineSmart)( TidyDocImpl* doc, uint 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 );
|
||||
#endif
|
||||
pprint->indent[ 0 ].spaces = indent;
|
||||
|
@ -762,7 +757,7 @@ static void PCondFlushLineSmart( TidyDocImpl* doc, uint 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 );
|
||||
#endif
|
||||
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 !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 );
|
||||
#endif
|
||||
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 );
|
||||
}
|
||||
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER) && defined(DEBUG_PPRINT)
|
||||
#if !defined(NDEBUG) && defined(DEBUG_PPRINT)
|
||||
dbg_show_node( doc, node, 4, GetSpaces( &doc->pprint ) );
|
||||
#endif
|
||||
|
||||
|
@ -2318,7 +2313,7 @@ void TY_(PPrintTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node )
|
|||
TidyPrintImpl* pprint = &doc->pprint;
|
||||
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 );
|
||||
#endif
|
||||
pprint->indent[ 0 ].spaces = indent;
|
||||
|
|
13
src/sprtf.c
13
src/sprtf.c
|
@ -1,20 +1,15 @@
|
|||
/*
|
||||
/* sprtf.c
|
||||
* 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
|
||||
* Copyright (c) 1998-2017 Geoff R. McLane and HTACG
|
||||
*
|
||||
* See tidy.h for the copyright notice.
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning( disable : 4995 )
|
||||
#endif
|
||||
/* Module: sprtf.c */
|
||||
/* Debug log file output */
|
||||
|
||||
#include <stdio.h> /* fopen()... */
|
||||
#include <string.h> /* strcpy */
|
||||
#include <stdarg.h> /* va_start, va_end, ... */
|
||||
|
|
50
src/sprtf.h
50
src/sprtf.h
|
@ -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_
|
||||
#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"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define MCDECL _cdecl
|
||||
#else
|
||||
|
@ -42,23 +50,21 @@ TIDY_EXPORT int MCDECL sprtf( const char *pf, ... );
|
|||
#define M_MAX_SPRTF 2048
|
||||
TIDY_EXPORT int direct_out_it( char *cp );
|
||||
|
||||
TIDY_EXPORT char *GetNxtBuf();
|
||||
TIDY_EXPORT char *GetNxtBuf(void);
|
||||
|
||||
#define EndBuf(a) ( a + strlen(a) )
|
||||
|
||||
TIDY_EXPORT char *get_date_stg();
|
||||
TIDY_EXPORT char *get_time_stg();
|
||||
TIDY_EXPORT char *get_date_time_stg();
|
||||
TIDY_EXPORT char *get_date_stg(void);
|
||||
TIDY_EXPORT char *get_time_stg(void);
|
||||
TIDY_EXPORT char *get_date_time_stg(void);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
TIDY_EXPORT int gettimeofday(struct timeval *tp, void *tzp);
|
||||
#endif
|
||||
|
||||
#ifndef SPRTF
|
||||
# define SPRTF sprtf
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* #ifndef _SPRTF_HXX_*/
|
||||
/* eof - sprtf.h */
|
||||
|
|
10
src/tags.c
10
src/tags.c
|
@ -10,9 +10,6 @@
|
|||
#include "tidy-int.h"
|
||||
#include "message.h"
|
||||
#include "tmbstr.h"
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
# include "sprtf.h"
|
||||
#endif
|
||||
/* Attribute checking methods */
|
||||
static CheckAttribs CheckIMG;
|
||||
static CheckAttribs CheckLINK;
|
||||
|
@ -476,10 +473,7 @@ static void declare( TidyDocImpl* doc, TidyTagImpl* tags,
|
|||
}
|
||||
}
|
||||
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
/* ====================================================================
|
||||
MSVC DEBUG ONLY
|
||||
*/
|
||||
#if !defined(NDEBUG)
|
||||
void ListElementsPerVersion( uint vers, Bool has )
|
||||
{
|
||||
uint val, cnt, total, wrap = 10;
|
||||
|
@ -525,7 +519,7 @@ void show_have_html5(void)
|
|||
ListElementsPerVersion( VERS_HTML5, yes );
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* !defined(NDEBUG) */
|
||||
|
||||
/* public interface for finding tag by name */
|
||||
Bool TY_(FindTag)( TidyDocImpl* doc, Node *node )
|
||||
|
|
|
@ -34,9 +34,6 @@
|
|||
#include "mappedio.h"
|
||||
#include "language.h"
|
||||
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
# include "sprtf.h"
|
||||
#endif
|
||||
|
||||
/* Create/Destroy a Tidy "document" object */
|
||||
static TidyDocImpl* tidyDocCreate( TidyAllocator *allocator );
|
||||
|
@ -1408,7 +1405,7 @@ void tidyDocReportDoctype( TidyDocImpl* doc )
|
|||
/*****************************************************************************
|
||||
* HTML5 STUFF
|
||||
*****************************************************************************/
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if 0 && !defined(NDEBUG)
|
||||
extern void show_not_html5(void);
|
||||
/* -----------------------------
|
||||
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??? */
|
||||
AttVal* attr = NULL;
|
||||
int i = 0;
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
// list_not_html5();
|
||||
#endif
|
||||
|
||||
while (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 *** */
|
||||
const char *dbg_get_lexer_type( void *vp )
|
||||
{
|
||||
|
@ -1922,7 +1917,7 @@ int tidyDocCleanAndRepair( TidyDocImpl* doc )
|
|||
Bool mergeEmphasis = cfgBool( doc, TidyMergeEmphasis );
|
||||
Node* node;
|
||||
|
||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||
#if !defined(NDEBUG)
|
||||
SPRTF("All nodes BEFORE clean and repair\n");
|
||||
dbg_show_all_nodes( doc, &doc->root, 0 );
|
||||
#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");
|
||||
dbg_show_all_nodes( doc, &doc->root, 0 );
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue