Documentation formatting.
This commit is contained in:
parent
5ff6aa8a8b
commit
8d7e5f7f5a
22
src/config.c
22
src/config.c
|
@ -15,19 +15,17 @@
|
||||||
#include "tags.h"
|
#include "tags.h"
|
||||||
|
|
||||||
#ifdef WINDOWS_OS
|
#ifdef WINDOWS_OS
|
||||||
#include <io.h>
|
# include <io.h>
|
||||||
#else
|
#else
|
||||||
#ifdef DMALLOC
|
# ifdef DMALLOC
|
||||||
/*
|
/* macro for valloc() in dmalloc.h may conflict with declaration for valloc()
|
||||||
macro for valloc() in dmalloc.h may conflict with declaration for valloc()
|
in unistd.h - we don't need (debugging for) valloc() here. dmalloc.h should
|
||||||
in unistd.h - we don't need (debugging for) valloc() here. dmalloc.h should
|
come last but it doesn't.*/
|
||||||
come last but it doesn't.
|
# ifdef valloc
|
||||||
*/
|
# undef valloc
|
||||||
#ifdef valloc
|
# endif
|
||||||
#undef valloc
|
# endif
|
||||||
#endif
|
# include <unistd.h>
|
||||||
#endif
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include "fileio.h"
|
#include "fileio.h"
|
||||||
#include "tidy.h"
|
#include "tidy.h"
|
||||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||||
#include "sprtf.h"
|
# include "sprtf.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct _fp_input_source
|
typedef struct _fp_input_source
|
||||||
|
@ -50,8 +50,8 @@ static void TIDY_CALL filesrc_ungetByte( void* sourceData, byte bv )
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SUPPORT_POSIX_MAPPED_FILES
|
#if SUPPORT_POSIX_MAPPED_FILES
|
||||||
#define initFileSource initStdIOFileSource
|
# define initFileSource initStdIOFileSource
|
||||||
#define freeFileSource freeStdIOFileSource
|
# define freeFileSource freeStdIOFileSource
|
||||||
#endif
|
#endif
|
||||||
int TY_(initFileSource)( TidyAllocator *allocator, TidyInputSource* inp, FILE* fp )
|
int TY_(initFileSource)( TidyAllocator *allocator, TidyInputSource* inp, FILE* fp )
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "streamio.h"
|
#include "streamio.h"
|
||||||
#include "tmbstr.h"
|
#include "tmbstr.h"
|
||||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||||
#include "sprtf.h"
|
# include "sprtf.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* duplicate attributes */
|
/* duplicate attributes */
|
||||||
|
|
|
@ -40,11 +40,11 @@
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
#include "streamio.h"
|
#include "streamio.h"
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#include "sprtf.h"
|
# include "sprtf.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SPRTF
|
#ifndef SPRTF
|
||||||
#define SPRTF printf
|
# define SPRTF printf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||||
|
|
|
@ -93,19 +93,18 @@ void TY_(freeFileSource)( TidyInputSource* inp, Bool closeIt )
|
||||||
TY_(freeStdIOFileSource)( inp, closeIt );
|
TY_(freeStdIOFileSource)( inp, closeIt );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* SUPPORT_POSIX_MAPPED_FILES */
|
||||||
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1300) /* less than msvc++ 7.0 */
|
# if defined(_MSC_VER) && (_MSC_VER < 1300) /* less than msvc++ 7.0 */
|
||||||
#pragma warning(disable:4115) /* named type definition in parentheses in windows headers */
|
# pragma warning(disable:4115) /* named type definition in parentheses in windows headers */
|
||||||
#endif
|
# endif
|
||||||
#include <windows.h>
|
# include <windows.h>
|
||||||
#include <errno.h>
|
# include <errno.h>
|
||||||
|
# include "streamio.h"
|
||||||
#include "streamio.h"
|
# include "tidy-int.h"
|
||||||
#include "tidy-int.h"
|
# include "message.h"
|
||||||
#include "message.h"
|
|
||||||
|
|
||||||
typedef struct _fp_input_mapped_source
|
typedef struct _fp_input_mapped_source
|
||||||
{
|
{
|
||||||
|
@ -192,7 +191,7 @@ static int initMappedFileSource( TidyAllocator *allocator, TidyInputSource* inp,
|
||||||
if ( !fin )
|
if ( !fin )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
#if defined(__MINGW32__)
|
# if defined(__MINGW32__)
|
||||||
{
|
{
|
||||||
DWORD lowVal, highVal;
|
DWORD lowVal, highVal;
|
||||||
lowVal = GetFileSize(fp, &highVal);
|
lowVal = GetFileSize(fp, &highVal);
|
||||||
|
@ -205,8 +204,8 @@ static int initMappedFileSource( TidyAllocator *allocator, TidyInputSource* inp,
|
||||||
fin->size = (fin->size << 32);
|
fin->size = (fin->size << 32);
|
||||||
fin->size += lowVal;
|
fin->size += lowVal;
|
||||||
}
|
}
|
||||||
#else /* NOT a MinGW build */
|
# else /* NOT a MinGW build */
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1300) /* less than msvc++ 7.0 */
|
# if defined(_MSC_VER) && (_MSC_VER < 1300) /* less than msvc++ 7.0 */
|
||||||
{
|
{
|
||||||
LARGE_INTEGER* pli = (LARGE_INTEGER *)&fin->size;
|
LARGE_INTEGER* pli = (LARGE_INTEGER *)&fin->size;
|
||||||
(DWORD)pli->LowPart = GetFileSize( fp, (DWORD *)&pli->HighPart );
|
(DWORD)pli->LowPart = GetFileSize( fp, (DWORD *)&pli->HighPart );
|
||||||
|
@ -216,15 +215,15 @@ static int initMappedFileSource( TidyAllocator *allocator, TidyInputSource* inp,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
# else
|
||||||
if ( !GetFileSizeEx( fp, (LARGE_INTEGER*)&fin->size )
|
if ( !GetFileSizeEx( fp, (LARGE_INTEGER*)&fin->size )
|
||||||
|| fin->size <= 0 )
|
|| fin->size <= 0 )
|
||||||
{
|
{
|
||||||
TidyFree(allocator, fin);
|
TidyFree(allocator, fin);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
#endif /* MinGW y/n */
|
# endif /* MinGW y/n */
|
||||||
|
|
||||||
fin->map = CreateFileMapping( fp, NULL, PAGE_READONLY, 0, 0, NULL );
|
fin->map = CreateFileMapping( fp, NULL, PAGE_READONLY, 0, 0, NULL );
|
||||||
|
|
||||||
|
@ -291,25 +290,25 @@ int TY_(DocParseFileWithMappedFile)( TidyDocImpl* doc, ctmbstr filnam ) {
|
||||||
HANDLE fin = CreateFileA( filnam, GENERIC_READ, FILE_SHARE_READ, NULL,
|
HANDLE fin = CreateFileA( filnam, GENERIC_READ, FILE_SHARE_READ, NULL,
|
||||||
OPEN_EXISTING, 0, NULL );
|
OPEN_EXISTING, 0, NULL );
|
||||||
|
|
||||||
#if PRESERVE_FILE_TIMES
|
# if PRESERVE_FILE_TIMES
|
||||||
LONGLONG actime, modtime;
|
LONGLONG actime, modtime;
|
||||||
TidyClearMemory( &doc->filetimes, sizeof(doc->filetimes) );
|
TidyClearMemory( &doc->filetimes, sizeof(doc->filetimes) );
|
||||||
|
|
||||||
if ( fin != INVALID_HANDLE_VALUE && cfgBool(doc,TidyKeepFileTimes) &&
|
if ( fin != INVALID_HANDLE_VALUE && cfgBool(doc,TidyKeepFileTimes) &&
|
||||||
GetFileTime(fin, NULL, (FILETIME*)&actime, (FILETIME*)&modtime) )
|
GetFileTime(fin, NULL, (FILETIME*)&actime, (FILETIME*)&modtime) )
|
||||||
{
|
{
|
||||||
#define TY_I64(str) TYDYAPPEND(str,LL)
|
# define TY_I64(str) TYDYAPPEND(str,LL)
|
||||||
#if _MSC_VER < 1300 && !defined(__GNUC__) /* less than msvc++ 7.0 */
|
# if _MSC_VER < 1300 && !defined(__GNUC__) /* less than msvc++ 7.0 */
|
||||||
# undef TY_I64
|
# undef TY_I64
|
||||||
# define TY_I64(str) TYDYAPPEND(str,i64)
|
# define TY_I64(str) TYDYAPPEND(str,i64)
|
||||||
#endif
|
# endif
|
||||||
doc->filetimes.actime =
|
doc->filetimes.actime =
|
||||||
(time_t)( ( actime - TY_I64(116444736000000000)) / 10000000 );
|
(time_t)( ( actime - TY_I64(116444736000000000)) / 10000000 );
|
||||||
|
|
||||||
doc->filetimes.modtime =
|
doc->filetimes.modtime =
|
||||||
(time_t)( ( modtime - TY_I64(116444736000000000)) / 10000000 );
|
(time_t)( ( modtime - TY_I64(116444736000000000)) / 10000000 );
|
||||||
}
|
}
|
||||||
#endif
|
# endif /* PRESERVE_FILE_TIMES */
|
||||||
|
|
||||||
if ( fin != INVALID_HANDLE_VALUE )
|
if ( fin != INVALID_HANDLE_VALUE )
|
||||||
{
|
{
|
||||||
|
@ -330,14 +329,5 @@ int TY_(DocParseFileWithMappedFile)( TidyDocImpl* doc, ctmbstr filnam ) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* defined(_WIN32) */
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* local variables:
|
|
||||||
* mode: c
|
|
||||||
* indent-tabs-mode: nil
|
|
||||||
* c-basic-offset: 4
|
|
||||||
* eval: (c-set-offset 'substatement-open 0)
|
|
||||||
* end:
|
|
||||||
*/
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include "tmbstr.h"
|
#include "tmbstr.h"
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||||
#include "sprtf.h"
|
# include "sprtf.h"
|
||||||
#endif
|
#endif
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "limits.h"
|
#include "limits.h"
|
||||||
#include "tmbstr.h"
|
#include "tmbstr.h"
|
||||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||||
#include "sprtf.h"
|
# include "sprtf.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
32
src/parser.c
32
src/parser.c
|
@ -13,11 +13,11 @@
|
||||||
#include "tags.h"
|
#include "tags.h"
|
||||||
#include "tmbstr.h"
|
#include "tmbstr.h"
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#include "sprtf.h"
|
# include "sprtf.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SPRTF
|
#ifndef SPRTF
|
||||||
#define SPRTF printf
|
# define SPRTF printf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -401,30 +401,12 @@ static void TrimTrailingSpace( TidyDocImpl* doc, Node *element, Node *last )
|
||||||
{
|
{
|
||||||
c = (byte) lexer->lexbuf[ last->end - 1 ];
|
c = (byte) lexer->lexbuf[ last->end - 1 ];
|
||||||
|
|
||||||
if ( c == ' '
|
if ( c == ' ' )
|
||||||
#ifdef COMMENT_NBSP_FIX
|
|
||||||
|| c == 160
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
#ifdef COMMENT_NBSP_FIX
|
last->end -= 1;
|
||||||
/* take care with <td> </td> */
|
if ( (element->tag->model & CM_INLINE) &&
|
||||||
if ( c == 160 &&
|
!(element->tag->model & CM_FIELD) )
|
||||||
( element->tag == doc->tags.tag_td ||
|
lexer->insertspace = yes;
|
||||||
element->tag == doc->tags.tag_th )
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (last->end > last->start + 1)
|
|
||||||
last->end -= 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
last->end -= 1;
|
|
||||||
if ( (element->tag->model & CM_INLINE) &&
|
|
||||||
!(element->tag->model & CM_FIELD) )
|
|
||||||
lexer->insertspace = yes;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
10
src/pprint.c
10
src/pprint.c
|
@ -21,12 +21,12 @@
|
||||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||||
/* #define DEBUG_PPRINT */
|
/* #define DEBUG_PPRINT */
|
||||||
/* #define DEBUG_INDENT */
|
/* #define DEBUG_INDENT */
|
||||||
#ifdef DEBUG_PPRINT
|
# ifdef DEBUG_PPRINT
|
||||||
extern void dbg_show_node( TidyDocImpl* doc, Node *node, int caller, int indent );
|
extern void dbg_show_node( TidyDocImpl* doc, Node *node, int caller, int indent );
|
||||||
#endif
|
# endif
|
||||||
#ifdef DEBUG_INDENT
|
# ifdef DEBUG_INDENT
|
||||||
#include "sprtf.h"
|
# include "sprtf.h"
|
||||||
#endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
32
src/sprtf.c
32
src/sprtf.c
|
@ -11,40 +11,42 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning( disable : 4995 )
|
# pragma warning( disable : 4995 )
|
||||||
#endif
|
#endif
|
||||||
/* Module: sprtf.c */
|
/* Module: sprtf.c */
|
||||||
/* Debug log file output */
|
/* 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, ... */
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#include <WinSock2.h>
|
# include <WinSock2.h>
|
||||||
#include <sys/timeb.h>
|
# include <sys/timeb.h>
|
||||||
#if (defined(UNICODE) || defined(_UNICODE))
|
# if (defined(UNICODE) || defined(_UNICODE))
|
||||||
#include <Strsafe.h>
|
# include <Strsafe.h>
|
||||||
#endif
|
# endif
|
||||||
#else /* !_MSC_VER */
|
#else /* !_MSC_VER */
|
||||||
#include <sys/time.h> /* gettimeoday(), struct timeval,... */
|
# include <sys/time.h> /* gettimeoday(), struct timeval,... */
|
||||||
#endif /* _MSC_VER y/n */
|
#endif /* _MSC_VER y/n */
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdlib.h> /* for exit() in unix */
|
#include <stdlib.h> /* for exit() in unix */
|
||||||
#include "sprtf.h"
|
#include "sprtf.h"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#ifndef _CRT_SECURE_NO_DEPRECATE
|
# ifndef _CRT_SECURE_NO_DEPRECATE
|
||||||
#define _CRT_SECURE_NO_DEPRECATE
|
# define _CRT_SECURE_NO_DEPRECATE
|
||||||
#endif /* #ifndef _CRT_SECURE_NO_DEPRECATE */
|
# endif /* #ifndef _CRT_SECURE_NO_DEPRECATE */
|
||||||
#pragma warning( disable:4996 )
|
# pragma warning( disable:4996 )
|
||||||
#else
|
#else
|
||||||
#define strcmpi strcasecmp
|
# define strcmpi strcasecmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MX_ONE_BUF
|
#ifndef MX_ONE_BUF
|
||||||
#define MX_ONE_BUF 1024
|
# define MX_ONE_BUF 1024
|
||||||
#endif
|
#endif
|
||||||
#ifndef MX_BUFFERS
|
#ifndef MX_BUFFERS
|
||||||
#define MX_BUFFERS 1024
|
# define MX_BUFFERS 1024
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char _s_strbufs[MX_ONE_BUF * MX_BUFFERS];
|
static char _s_strbufs[MX_ONE_BUF * MX_BUFFERS];
|
||||||
|
@ -75,7 +77,7 @@ static int add2listview = 0;
|
||||||
static int append_to_log = 0;
|
static int append_to_log = 0;
|
||||||
|
|
||||||
#ifndef VFP
|
#ifndef VFP
|
||||||
#define VFP(a) ( a && ( a != (FILE *)-1 ) )
|
# define VFP(a) ( a && ( a != (FILE *)-1 ) )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int add_list_out( int val )
|
int add_list_out( int val )
|
||||||
|
|
|
@ -13,16 +13,16 @@
|
||||||
/* Module: sprtf.h */
|
/* Module: sprtf.h */
|
||||||
/* Debug log file output */
|
/* Debug log file output */
|
||||||
#ifndef _SPRTF_HXX_
|
#ifndef _SPRTF_HXX_
|
||||||
#define _SPRTF_HXX_
|
# define _SPRTF_HXX_
|
||||||
#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
|
||||||
#define MCDECL
|
# define MCDECL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TIDY_EXPORT int add_std_out( int val );
|
TIDY_EXPORT int add_std_out( int val );
|
||||||
|
@ -54,7 +54,7 @@ TIDY_EXPORT int gettimeofday(struct timeval *tp, void *tzp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SPRTF
|
#ifndef SPRTF
|
||||||
#define SPRTF sprtf
|
# define SPRTF sprtf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -162,12 +162,12 @@ uint TY_(DecodeMacRoman)(uint c);
|
||||||
#define CR 0xD
|
#define CR 0xD
|
||||||
#define LF 0xA
|
#define LF 0xA
|
||||||
|
|
||||||
#if defined(MAC_OS_CLASSIC)
|
#if defined(MAC_OS_CLASSIC)
|
||||||
#define DEFAULT_NL_CONFIG TidyCR
|
# define DEFAULT_NL_CONFIG TidyCR
|
||||||
#elif defined(_WIN32) || defined(OS2_OS)
|
#elif defined(_WIN32) || defined(OS2_OS)
|
||||||
#define DEFAULT_NL_CONFIG TidyCRLF
|
# define DEFAULT_NL_CONFIG TidyCRLF
|
||||||
#else
|
#else
|
||||||
#define DEFAULT_NL_CONFIG TidyLF
|
# define DEFAULT_NL_CONFIG TidyLF
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "message.h"
|
#include "message.h"
|
||||||
#include "tmbstr.h"
|
#include "tmbstr.h"
|
||||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||||
#include "sprtf.h"
|
# include "sprtf.h"
|
||||||
#endif
|
#endif
|
||||||
/* Attribute checking methods */
|
/* Attribute checking methods */
|
||||||
static CheckAttribs CheckIMG;
|
static CheckAttribs CheckIMG;
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
|
|
||||||
#if !defined(NDEBUG) && defined(_MSC_VER)
|
#if !defined(NDEBUG) && defined(_MSC_VER)
|
||||||
#include "sprtf.h"
|
# include "sprtf.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Create/Destroy a Tidy "document" object */
|
/* Create/Destroy a Tidy "document" object */
|
||||||
|
|
Loading…
Reference in a new issue