Added debug to several files. WIP

This commit is contained in:
Jim Derry 2017-10-03 20:56:50 -04:00
parent 4e3c1a1562
commit a137c068e5
5 changed files with 19 additions and 15 deletions

View file

@ -2426,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) )
@ -2458,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

@ -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

View file

@ -82,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

@ -269,7 +269,7 @@ Node *TY_(InsertedToken)( TidyDocImpl* doc )
istack = lexer->insert; istack = lexer->insert;
/* #if 0 && defined(_DEBUG) */ /* #if 0 && defined(_DEBUG) */
#if !defined(NDEBUG) && 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

@ -40,7 +40,7 @@
#include "utf8.h" #include "utf8.h"
#include "streamio.h" #include "streamio.h"
#if !defined(NDEBUG) && defined(_MSC_VER) #if !defined(NDEBUG)
/* #define DEBUG_ALLOCATION special EXTRA allocation debug information - VERY NOISY */ /* #define DEBUG_ALLOCATION special EXTRA allocation debug information - VERY NOISY */
static void check_me(char *name); static void check_me(char *name);
static Bool show_attrs = yes; static Bool show_attrs = yes;
@ -173,9 +173,9 @@ static void Show_Node( TidyDocImpl* doc, const char *msg, Node *node )
} }
} }
#define GTDBG(a,b,c) Show_Node(a,b,c) #define GTDBG(a,b,c) Show_Node(a,b,c)
#else #else /* NDEBUG is define */
#define GTDBG(a,b,c) #define GTDBG(a,b,c)
#endif #endif /* !defined(NDEBUG) */
/* Forward references /* Forward references
*/ */
@ -322,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;
@ -413,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)
{ {
@ -1413,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;
@ -1507,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) {
@ -2484,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);
@ -3418,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;