1 #ifndef __TIDY_PLATFORM_H__
2 #define __TIDY_PLATFORM_H__
54 #ifndef SUPPORT_ASIAN_ENCODINGS
55 #define SUPPORT_ASIAN_ENCODINGS 1
59 #ifndef SUPPORT_UTF16_ENCODINGS
60 #define SUPPORT_UTF16_ENCODINGS 1
64 #ifndef SUPPORT_ACCESSIBILITY_CHECKS
65 #define SUPPORT_ACCESSIBILITY_CHECKS 1
69 #ifndef SUPPORT_LOCALIZATIONS
70 #define SUPPORT_LOCALIZATIONS 1
76 #if defined(macintosh)
78 #define MAC_OS_CLASSIC
80 #define PLATFORM_NAME "Mac OS"
84 #if !defined(_POSIX) && !defined(NO_ACCESS_SUPPORT)
85 #define NO_ACCESS_SUPPORT
88 #ifdef SUPPORT_GETPWNAM
89 #undef SUPPORT_GETPWNAM
92 #elif defined(__APPLE__) && defined(__MACH__)
96 #define PLATFORM_NAME "Mac OS X"
100 #if defined(MAC_OS_CLASSIC) || defined(MAC_OS_X)
103 #define FILENAMES_CASE_SENSITIVE 0
104 #define strcasecmp strcmp
109 #if defined(__FreeBSD__)
111 #ifndef PLATFORM_NAME
112 #define PLATFORM_NAME "FreeBSD"
115 #elif defined(__NetBSD__)
117 #ifndef PLATFORM_NAME
118 #define PLATFORM_NAME "NetBSD"
121 #elif defined(__OpenBSD__)
123 #ifndef PLATFORM_NAME
124 #define PLATFORM_NAME "OpenBSD"
127 #elif defined(__DragonFly__)
129 #ifndef PLATFORM_NAME
130 #define PLATFORM_NAME "DragonFly"
133 #elif defined(__MINT__)
135 #ifndef PLATFORM_NAME
136 #define PLATFORM_NAME "FreeMiNT"
139 #elif defined(__bsdi__)
141 #ifndef PLATFORM_NAME
142 #define PLATFORM_NAME "BSD/OS"
149 #if defined(WINDOWS) || defined(_WIN32)
152 #ifndef PLATFORM_NAME
153 #define PLATFORM_NAME "Windows"
156 #if defined(__MWERKS__) || defined(__MSL__)
159 #ifdef SUPPORT_GETPWNAM
160 #undef SUPPORT_GETPWNAM
164 #if !defined(NO_SETMODE_SUPPORT)
165 #define NO_SETMODE_SUPPORT
168 #define strcasecmp _stricmp
172 #if defined(__BORLANDC__)
173 #define strcasecmp stricmp
176 #define FILENAMES_CASE_SENSITIVE 0
177 #define SUPPORT_POSIX_MAPPED_FILES 0
183 #if defined(linux) && defined(__alpha__)
186 #ifndef PLATFORM_NAME
187 #define PLATFORM_NAME "Linux/Alpha"
190 #elif defined(linux) && defined(__sparc__)
193 #ifndef PLATFORM_NAME
194 #define PLATFORM_NAME "Linux/Sparc"
197 #elif defined(linux) && (defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__))
200 #ifndef PLATFORM_NAME
201 #define PLATFORM_NAME "Linux/x86"
204 #elif defined(linux) && defined(__powerpc__)
208 #if defined(__linux__) && defined(__powerpc__)
213 #ifndef PLATFORM_NAME
214 #define PLATFORM_NAME "MkLinux"
219 #ifndef PLATFORM_NAME
220 #define PLATFORM_NAME "Linux/PPC"
225 #elif defined(linux) || defined(__linux__)
228 #ifndef PLATFORM_NAME
229 #define PLATFORM_NAME "Linux"
238 #ifndef PLATFORM_NAME
239 #define PLATFORM_NAME "Solaris"
247 #ifndef PLATFORM_NAME
248 #define PLATFORM_NAME "HPUX"
254 #if defined(__riscos__)
256 #ifndef PLATFORM_NAME
257 #define PLATFORM_NAME "RISC OS"
263 #if defined(__OS2__) || defined(__EMX__)
265 #ifndef PLATFORM_NAME
266 #define PLATFORM_NAME "OS/2"
268 #define FILENAMES_CASE_SENSITIVE 0
269 #define strcasecmp stricmp
276 #ifndef PLATFORM_NAME
277 #define PLATFORM_NAME "SGI IRIX"
285 #ifndef PLATFORM_NAME
286 #define PLATFORM_NAME "IBM AIX"
293 #if defined(__BEOS__)
295 #ifndef PLATFORM_NAME
296 #define PLATFORM_NAME "BeOS"
302 #if defined(__CYGWIN__)
304 #ifndef PLATFORM_NAME
305 #define PLATFORM_NAME "Cygwin"
307 #define FILENAMES_CASE_SENSITIVE 0
314 #ifndef PLATFORM_NAME
315 #define PLATFORM_NAME "OpenVMS"
317 #define FILENAMES_CASE_SENSITIVE 0
324 #ifndef PLATFORM_NAME
325 #define PLATFORM_NAME "DEC Alpha OSF"
334 #if defined(forARM) && defined(__NEWTON_H)
338 #ifndef PLATFORM_NAME
339 #define PLATFORM_NAME "Newton"
344 #ifndef PLATFORM_NAME
345 #define PLATFORM_NAME "ARM"
360 #ifdef NEEDS_MALLOC_H
364 #ifdef SUPPORT_GETPWNAM
368 #ifdef NEEDS_UNISTD_H
374 #ifndef FILENAMES_CASE_SENSITIVE
375 #define FILENAMES_CASE_SENSITIVE 1
398 #ifdef PRESERVEFILETIMES
399 #undef PRESERVE_FILE_TIMES
400 #define PRESERVE_FILE_TIMES PRESERVEFILETIMES
403 #ifndef PRESERVE_FILE_TIMES
404 #if defined(RISC_OS) || defined(OPENVMS_OS) || defined(OSF_OS)
405 #define PRESERVE_FILE_TIMES 0
407 #define PRESERVE_FILE_TIMES 1
411 #if PRESERVE_FILE_TIMES
414 #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__)
421 #ifndef UTIME_NEEDS_CLOSED_FILE
422 #if defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(LINUX_OS)
423 #define UTIME_NEEDS_CLOSED_FILE 1
425 #define UTIME_NEEDS_CLOSED_FILE 0
429 #if defined(MAC_OS_X) || (!defined(MAC_OS_CLASSIC) && !defined(__MSL__))
430 #include <sys/types.h>
431 #include <sys/stat.h>
437 #include <sys/utime.h>
451 #if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__)
453 #define futime _futime
455 #define utimbuf _utimbuf
458 #define vsnprintf _vsnprintf
470 #if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__)
472 #if !(defined(__WATCOMC__) || defined(__MINGW32__))
473 #define fileno _fileno
474 #define setmode _setmode
477 #define access _access
478 #define strcasecmp _stricmp
481 #define va_copy(dest, src) (dest = src)
485 #pragma warning( disable : 4189 )
486 #pragma warning( disable : 4100 )
487 #pragma warning( disable : 4706 )
491 #pragma warning( disable : 4996 )
498 #if (defined(_USRDLL) || defined(_WINDLL) || defined(BUILD_SHARED_LIB)) && !defined(TIDY_EXPORT) && !defined(TIDY_STATIC)
499 #ifdef BUILDING_SHARED_LIB
500 #define TIDY_EXPORT __declspec( dllexport )
502 #define TIDY_EXPORT __declspec( dllimport )
505 #define TIDY_EXPORT extern
510 # define TIDY_CALL __fastcall
512 # define TIDY_CALL __stdcall
520 #if defined(BE_OS) || defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(OSF_OS) || defined(IRIX_OS) || defined(AIX_OS)
521 #include <sys/types.h>
523 #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)
527 #if defined(HPUX_OS) || defined(CYGWIN_OS) || defined(MAC_OS) || defined(BSD_BASED_OS) || defined(_WIN32)
529 typedef unsigned long ulong;
554 #ifndef TMBSTR_DEFINED
557 #define NULLSTR (tmbstr)""
558 #define TMBSTR_DEFINED
565 #if defined(__GNUC__) || defined(__INTEL_COMPILER)
566 # define ARG_UNUSED(x) x __attribute__((unused))
568 # define ARG_UNUSED(x) x
574 #ifndef HAS_VSNPRINTF
575 # define HAS_VSNPRINTF 1
578 #ifndef SUPPORT_POSIX_MAPPED_FILES
579 # define SUPPORT_POSIX_MAPPED_FILES 1
613 #define opaque_type( typenam )\
614 struct _##typenam { int _opaque; };\
615 typedef struct _##typenam const * typenam
617 #define opaque_type(typenam) typedef const void* typenam