#include
#include /* for longjmp on error exit */
#include
#include /* may need for Unix V */
#include
#include
#ifdef NEEDS_MALLOC_H
#include
#endif
#ifdef SUPPORT_GETPWNAM
#include
#endif
#ifdef NEEDS_UNISTD_H
#include /* needed for unlink on some Unix systems */
#endif
/* By default, use case-sensitive filename comparison.
*/
#ifndef FILENAMES_CASE_SENSITIVE
#define FILENAMES_CASE_SENSITIVE 1
#endif
/*
Tidy preserves the last modified time for the files it
cleans up.
*/
/*
If your platform doesn't support and the
utime() function, or and the futime()
function then set PRESERVE_FILE_TIMES to 0.
If your platform doesn't support and the
futime() function, then set HAS_FUTIME to 0.
If your platform supports and the
utime() function requires the file to be
closed first, then set UTIME_NEEDS_CLOSED_FILE to 1.
*/
/* Keep old PRESERVEFILETIMES define for compatibility */
#ifdef PRESERVEFILETIMES
#undef PRESERVE_FILE_TIMES
#define PRESERVE_FILE_TIMES PRESERVEFILETIMES
#endif
#ifndef PRESERVE_FILE_TIMES
#if defined(RISC_OS) || defined(OPENVMS_OS) || defined(OSF_OS)
#define PRESERVE_FILE_TIMES 0
#else
#define PRESERVE_FILE_TIMES 1
#endif
#endif
#if PRESERVE_FILE_TIMES
#ifndef HAS_FUTIME
#if defined(CYGWIN_OS) || defined(BE_OS) || defined(OS2_OS) || defined(HPUX_OS) || defined(SOLARIS_OS) || defined(LINUX_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(IRIX_OS) || defined(AIX_OS) || defined(__BORLANDC__) || defined(__GLIBC__)
#define HAS_FUTIME 0
#else
#define HAS_FUTIME 1
#endif
#endif
#ifndef UTIME_NEEDS_CLOSED_FILE
#if defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(LINUX_OS)
#define UTIME_NEEDS_CLOSED_FILE 1
#else
#define UTIME_NEEDS_CLOSED_FILE 0
#endif
#endif
#if defined(MAC_OS_X) || (!defined(MAC_OS_CLASSIC) && !defined(__MSL__))
#include
#include
#else
#include
#endif
#if HAS_FUTIME
#include
#else
#include
#endif /* HASFUTIME */
/*
MS Windows needs _ prefix for Unix file functions.
Not required by Metrowerks Standard Library (MSL).
Tidy uses following for preserving the last modified time.
WINDOWS automatically set by Win16 compilers.
_WIN32 automatically set by Win32 compilers.
*/
#if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__)
#define futime _futime
#define fstat _fstat
#define utimbuf _utimbuf /* Windows seems to want utimbuf */
#define stat _stat
#define utime _utime
#define vsnprintf _vsnprintf
#endif /* _WIN32 */
#endif /* PRESERVE_FILE_TIMES */
/*
MS Windows needs _ prefix for Unix file functions.
Not required by Metrowerks Standard Library (MSL).
WINDOWS automatically set by Win16 compilers.
_WIN32 automatically set by Win32 compilers.
*/
#if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__)
#if !(defined(__WATCOMC__) || defined(__MINGW32__))
#define fileno _fileno
#define setmode _setmode
#endif
#define access _access
#define strcasecmp _stricmp
#ifndef va_copy
#define va_copy(dest, src) (dest = src)
#endif
#if _MSC_VER > 1000
#pragma warning( disable : 4189 ) /* local variable is initialized but not referenced */
#pragma warning( disable : 4100 ) /* unreferenced formal parameter */
#pragma warning( disable : 4706 ) /* assignment within conditional expression */
#endif
#if _MSC_VER > 1300
#pragma warning( disable : 4996 ) /* disable depreciation warning */
#endif
#endif /* _WIN32 */
#if defined(_WIN32)
#if (defined(_USRDLL) || defined(_WINDLL) || defined(BUILD_SHARED_LIB)) && !defined(TIDY_EXPORT) && !defined(TIDY_STATIC)
#ifdef BUILDING_SHARED_LIB
#define TIDY_EXPORT __declspec( dllexport )
#else
#define TIDY_EXPORT __declspec( dllimport )
#endif
#else
#define TIDY_EXPORT extern
#endif
#ifndef TIDY_CALL
#ifdef _WIN64
# define TIDY_CALL __fastcall
#else
# define TIDY_CALL __stdcall
#endif
#endif
#endif /* _WIN32 */
/* hack for gnu sys/types.h file which defines uint and ulong */
#if defined(BE_OS) || defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(OSF_OS) || defined(IRIX_OS) || defined(AIX_OS)
#include
#endif
#if !defined(HPUX_OS) && !defined(CYGWIN_OS) && !defined(MAC_OS_X) && !defined(BE_OS) && !defined(SOLARIS_OS) && !defined(BSD_BASED_OS) && !defined(OSF_OS) && !defined(IRIX_OS) && !defined(AIX_OS) && !defined(LINUX_OS)
# undef uint
typedef unsigned int uint;
#endif
#if defined(HPUX_OS) || defined(CYGWIN_OS) || defined(MAC_OS) || defined(BSD_BASED_OS) || defined(_WIN32)
# undef ulong
typedef unsigned long ulong;
#endif
/*
With GCC 4, __attribute__ ((visibility("default"))) can be used along compiling with tidylib
with "-fvisibility=hidden". See http://gcc.gnu.org/wiki/Visibility and build/gmake/Makefile.
*/
/*
#if defined(__GNUC__) && __GNUC__ >= 4
#define TIDY_EXPORT __attribute__ ((visibility("default")))
#endif
*/
#ifndef TIDY_EXPORT /* Define it away for most builds */
#define TIDY_EXPORT
#endif
#ifndef TIDY_STRUCT
#define TIDY_STRUCT
#endif
typedef unsigned char byte;
typedef uint tchar; /* single, full character */
typedef char tmbchar; /* single, possibly partial character */
#ifndef TMBSTR_DEFINED
typedef tmbchar* tmbstr; /* pointer to buffer of possibly partial chars */
typedef const tmbchar* ctmbstr; /* Ditto, but const */
#define NULLSTR (tmbstr)""
#define TMBSTR_DEFINED
#endif
#ifndef TIDY_CALL
#define TIDY_CALL
#endif
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
# define ARG_UNUSED(x) x __attribute__((unused))
#else
# define ARG_UNUSED(x) x
#endif
/* HAS_VSNPRINTF triggers the use of "vsnprintf", which is safe related to
buffer overflow. Therefore, we make it the default unless HAS_VSNPRINTF
has been defined. */
#ifndef HAS_VSNPRINTF
# define HAS_VSNPRINTF 1
#endif
#ifndef SUPPORT_POSIX_MAPPED_FILES
# define SUPPORT_POSIX_MAPPED_FILES 1
#endif
/*
bool is a reserved word in some but
not all C++ compilers depending on age
work around is to avoid bool altogether
by introducing a new enum called Bool
*/
/* We could use the C99 definition where supported
typedef _Bool Bool;
#define no (_Bool)0
#define yes (_Bool)1
*/
typedef enum
{
no,
yes
} Bool;
/* for NULL pointers
#define null ((const void*)0)
extern void* null;
*/
#if defined(DMALLOC)
#include "dmalloc.h"
#endif
/* Opaque data structure.
* Cast to implementation type struct within lib.
* This will reduce inter-dependencies/conflicts w/ application code.
*/
#if 1
#define opaque_type( typenam )\
struct _##typenam { int _opaque; };\
typedef struct _##typenam const * typenam
#else
#define opaque_type(typenam) typedef const void* typenam
#endif
/* Opaque data structure used to pass back
** and forth to keep current position in a
** list or other collection.
*/
opaque_type( TidyIterator );
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __TIDY_PLATFORM_H__ */
/*
* local variables:
* mode: c
* indent-tabs-mode: nil
* c-basic-offset: 4
* eval: (c-set-offset 'substatement-open 0)
* end:
*/