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