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 )
{
htmlfil = argv[1];
#if (!defined(NDEBUG) && defined(_MSC_VER))
#if (!defined(NDEBUG))
SPRTF("Tidying '%s'\n", htmlfil);
#endif /* DEBUG outout */
if ( tidyOptGetBool(tdoc, TidyEmacs) )
@ -2458,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 );

View file

@ -481,6 +481,10 @@ extern "C" {
# define setmode _setmode
# endif
# if defined(_MSC_VER)
# define fileno _fileno
#endif
# define access _access
# define strcasecmp _stricmp

View file

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

View file

@ -269,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" );

View file

@ -40,7 +40,7 @@
#include "utf8.h"
#include "streamio.h"
#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;
@ -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)
#else
#else /* NDEBUG is define */
#define GTDBG(a,b,c)
#endif
#endif /* !defined(NDEBUG) */
/* Forward references
*/
@ -322,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;
@ -413,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)
{
@ -1413,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;
@ -1507,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) {
@ -2484,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);
@ -3418,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;