1 #ifndef __TIDY_PLATFORM_H__
2 #define __TIDY_PLATFORM_H__
46 #if defined(TIDY_ENABLE_CONFIG_FILES)
47 # if !defined(TIDY_CONFIG_FILE)
48 # define TIDY_CONFIG_FILE "/etc/tidy.conf"
50 # if !defined(TIDY_USER_CONFIG_FILE)
51 # define TIDY_USER_CONFIG_FILE "~/.tidyrc"
54 # if defined(TIDY_CONFIG_FILE)
55 # undef TIDY_CONFIG_FILE
57 # if defined(TIDY_USER_CONFIG_FILE)
58 # undef TIDY_USER_CONFIG_FILE
81 #ifndef SUPPORT_LOCALIZATIONS
82 # define SUPPORT_LOCALIZATIONS 1
86 #ifndef SUPPORT_CONSOLE_APP
87 # define SUPPORT_CONSOLE_APP 1
97 #if defined(macintosh)
99 # define MAC_OS_CLASSIC
100 # ifndef PLATFORM_NAME
101 # define PLATFORM_NAME "Mac OS"
105 # if !defined(_POSIX) && !defined(NO_ACCESS_SUPPORT)
106 # define NO_ACCESS_SUPPORT
109 # ifdef SUPPORT_GETPWNAM
110 # undef SUPPORT_GETPWNAM
113 #elif defined(__APPLE__) && defined(__MACH__)
116 # ifndef PLATFORM_NAME
117 # include "TargetConditionals.h"
119 # define PLATFORM_NAME "Apple iOS"
121 # define PLATFORM_NAME "Apple macOS"
123 # define PLATFORM_NAME "Apple tvOS"
124 # elif TARGET_OS_WATCH
125 # define PLATFORM_NAME "Apple watchOS"
127 # define PLATFORM_NAME "Apple Unknown OS"
132 #if defined(MAC_OS_CLASSIC) || defined(MAC_OS_X)
135 # define FILENAMES_CASE_SENSITIVE 0
136 # define strcasecmp strcmp
141 #if defined(__FreeBSD__)
142 # define BSD_BASED_OS
143 # ifndef PLATFORM_NAME
144 # define PLATFORM_NAME "FreeBSD"
147 #elif defined(__NetBSD__)
148 # define BSD_BASED_OS
149 # ifndef PLATFORM_NAME
150 # define PLATFORM_NAME "NetBSD"
153 #elif defined(__OpenBSD__)
154 # define BSD_BASED_OS
155 # ifndef PLATFORM_NAME
156 # define PLATFORM_NAME "OpenBSD"
159 #elif defined(__DragonFly__)
160 # define BSD_BASED_OS
161 # ifndef PLATFORM_NAME
162 # define PLATFORM_NAME "DragonFly"
165 #elif defined(__MINT__)
166 # define BSD_BASED_OS
167 # ifndef PLATFORM_NAME
168 # define PLATFORM_NAME "FreeMiNT"
171 #elif defined(__bsdi__)
172 # define BSD_BASED_OS
173 # ifndef PLATFORM_NAME
174 # define PLATFORM_NAME "BSD/OS"
180 #if defined(WINDOWS) || defined(_WIN32)
183 # ifndef PLATFORM_NAME
184 # define PLATFORM_NAME "Windows"
187 # if defined(__MWERKS__) || defined(__MSL__)
189 # ifdef SUPPORT_GETPWNAM
190 # undef SUPPORT_GETPWNAM
193 # if !defined(NO_SETMODE_SUPPORT)
194 # define NO_SETMODE_SUPPORT
196 # define strcasecmp _stricmp
199 # if defined(__BORLANDC__)
200 # define strcasecmp stricmp
203 # define FILENAMES_CASE_SENSITIVE 0
204 # define SUPPORT_POSIX_MAPPED_FILES 0
210 #if defined(linux) && defined(__alpha__)
213 # ifndef PLATFORM_NAME
214 # define PLATFORM_NAME "Linux/Alpha"
217 #elif defined(linux) && defined(__sparc__)
220 # ifndef PLATFORM_NAME
221 # define PLATFORM_NAME "Linux/Sparc"
224 #elif defined(linux) && (defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__))
227 # ifndef PLATFORM_NAME
228 # define PLATFORM_NAME "Linux/x86"
231 #elif defined(linux) && defined(__powerpc__)
234 # if defined(__linux__) && defined(__powerpc__)
235 # ifndef PLATFORM_NAME
237 # define PLATFORM_NAME "MkLinux"
240 # ifndef PLATFORM_NAME
241 # define PLATFORM_NAME "Linux/PPC"
245 #elif defined(linux) || defined(__linux__)
248 # ifndef PLATFORM_NAME
249 # define PLATFORM_NAME "Linux"
257 # ifndef PLATFORM_NAME
258 # define PLATFORM_NAME "Solaris"
266 # ifndef PLATFORM_NAME
267 # define PLATFORM_NAME "HPUX"
273 #if defined(__riscos__)
275 # ifndef PLATFORM_NAME
276 # define PLATFORM_NAME "RISC OS"
282 #if defined(__OS2__) || defined(__EMX__)
284 # ifndef PLATFORM_NAME
285 # define PLATFORM_NAME "OS/2"
287 # define FILENAMES_CASE_SENSITIVE 0
288 # define strcasecmp stricmp
295 # ifndef PLATFORM_NAME
296 # define PLATFORM_NAME "SGI IRIX"
304 # ifndef PLATFORM_NAME
305 # define PLATFORM_NAME "IBM AIX"
311 #if defined(__BEOS__)
313 # ifndef PLATFORM_NAME
314 # define PLATFORM_NAME "BeOS"
320 #if defined(__CYGWIN__)
322 # ifndef PLATFORM_NAME
323 # define PLATFORM_NAME "Cygwin"
325 # define FILENAMES_CASE_SENSITIVE 0
332 # ifndef PLATFORM_NAME
333 # define PLATFORM_NAME "OpenVMS"
335 # define FILENAMES_CASE_SENSITIVE 0
342 # ifndef PLATFORM_NAME
343 # define PLATFORM_NAME "DEC Alpha OSF"
351 # if defined(forARM) && defined(__NEWTON_H)
354 # ifndef PLATFORM_NAME
355 # define PLATFORM_NAME "Newton"
358 # ifndef PLATFORM_NAME
359 # define PLATFORM_NAME "ARM"
377 #ifdef NEEDS_MALLOC_H
381 #ifdef SUPPORT_GETPWNAM
385 #ifdef NEEDS_UNISTD_H
395 #ifndef FILENAMES_CASE_SENSITIVE
396 # define FILENAMES_CASE_SENSITIVE 1
415 #ifdef PRESERVEFILETIMES
416 # undef PRESERVE_FILE_TIMES
417 # define PRESERVE_FILE_TIMES PRESERVEFILETIMES
420 #ifndef PRESERVE_FILE_TIMES
421 # if defined(RISC_OS) || defined(OPENVMS_OS) || defined(OSF_OS)
422 # define PRESERVE_FILE_TIMES 0
424 # define PRESERVE_FILE_TIMES 1
428 #if PRESERVE_FILE_TIMES
431 # 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__)
432 # define HAS_FUTIME 0
434 # define HAS_FUTIME 1
438 # ifndef UTIME_NEEDS_CLOSED_FILE
439 # if defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(LINUX_OS)
440 # define UTIME_NEEDS_CLOSED_FILE 1
442 # define UTIME_NEEDS_CLOSED_FILE 0
446 # if defined(MAC_OS_X) || (!defined(MAC_OS_CLASSIC) && !defined(__MSL__))
447 # include <sys/types.h>
448 # include <sys/stat.h>
454 # include <sys/utime.h>
467 # if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__)
468 # define futime _futime
469 # define fstat _fstat
470 # define utimbuf _utimbuf
472 # define utime _utime
473 # define vsnprintf _vsnprintf
488 #if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__)
490 # if !(defined(__WATCOMC__) || defined(__MINGW32__))
491 # define fileno _fileno
492 # define setmode _setmode
495 # if defined(_MSC_VER)
496 # define fileno _fileno
497 #if !defined(NDEBUG) && !defined(ENABLE_DEBUG_LOG) && !defined(DISABLE_DEBUG_LOG)
498 #define ENABLE_DEBUG_LOG
502 # define access _access
503 # define strcasecmp _stricmp
506 # define va_copy(dest, src) (dest = src)
510 # pragma warning( disable : 4189 )
511 # pragma warning( disable : 4100 )
512 # pragma warning( disable : 4706 )
516 # pragma warning( disable : 4996 )
523 # if (defined(_USRDLL) || defined(_WINDLL) || defined(BUILD_SHARED_LIB)) && !defined(TIDY_EXPORT) && !defined(TIDY_STATIC)
524 # ifdef BUILDING_SHARED_LIB
525 # define TIDY_EXPORT __declspec( dllexport )
527 # define TIDY_EXPORT __declspec( dllimport )
530 # define TIDY_EXPORT extern
535 # define TIDY_CALL __fastcall
537 # define TIDY_CALL __stdcall
548 #if defined(BE_OS) || defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(OSF_OS) || defined(IRIX_OS) || defined(AIX_OS)
549 # include <sys/types.h>
552 #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)
557 #if defined(HPUX_OS) || defined(CYGWIN_OS) || defined(MAC_OS) || defined(BSD_BASED_OS) || defined(_WIN32)
559 typedef unsigned long ulong;
592 #ifndef TMBSTR_DEFINED
595 # define NULLSTR (tmbstr)""
596 # define TMBSTR_DEFINED
603 #if defined(__GNUC__) || defined(__INTEL_COMPILER)
604 # define ARG_UNUSED(x) x __attribute__((unused))
605 # define FUNC_UNUSED __attribute__((unused))
607 # define ARG_UNUSED(x) x
614 #ifndef HAS_VSNPRINTF
615 # define HAS_VSNPRINTF 1
618 #ifndef SUPPORT_POSIX_MAPPED_FILES
619 # define SUPPORT_POSIX_MAPPED_FILES 1
643 # include "dmalloc.h"
651 #define opaque_type( typenam )\
652 struct _##typenam { int _opaque; };\
653 typedef struct _##typenam const * typenam
655 #define opaque_type(typenam) typedef const void* typenam