00001 #ifndef __PLATFORM_H__
00002 #define __PLATFORM_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 #ifndef SUPPORT_ASIAN_ENCODINGS
00056 #define SUPPORT_ASIAN_ENCODINGS 1
00057 #endif
00058
00059
00060 #ifndef SUPPORT_UTF16_ENCODINGS
00061 #define SUPPORT_UTF16_ENCODINGS 1
00062 #endif
00063
00064
00065 #ifndef SUPPORT_ACCESSIBILITY_CHECKS
00066 #define SUPPORT_ACCESSIBILITY_CHECKS 1
00067 #endif
00068
00069
00070
00071
00072 #if defined(macintosh)
00073
00074 #define MAC_OS_CLASSIC
00075 #ifndef PLATFORM_NAME
00076 #define PLATFORM_NAME "Mac OS"
00077 #endif
00078
00079
00080 #if !defined(_POSIX) && !defined(NO_ACCESS_SUPPORT)
00081 #define NO_ACCESS_SUPPORT
00082 #endif
00083
00084 #ifdef SUPPORT_GETPWNAM
00085 #undef SUPPORT_GETPWNAM
00086 #endif
00087
00088 #elif defined(__APPLE__) && defined(__MACH__)
00089
00090 #define MAC_OS_X
00091 #ifndef PLATFORM_NAME
00092 #define PLATFORM_NAME "Mac OS X"
00093 #endif
00094 #endif
00095
00096 #if defined(MAC_OS_CLASSIC) || defined(MAC_OS_X)
00097
00098 #define MAC_OS
00099 #define FILENAMES_CASE_SENSITIVE 0
00100 #define strcasecmp strcmp
00101 #ifndef DFLT_REPL_CHARENC
00102 #define DFLT_REPL_CHARENC MACROMAN
00103 #endif
00104 #endif
00105
00106
00107
00108 #if defined(__FreeBSD__)
00109 #define BSD_BASED_OS
00110 #ifndef PLATFORM_NAME
00111 #define PLATFORM_NAME "FreeBSD"
00112 #endif
00113
00114 #elif defined(__NetBSD__)
00115 #define BSD_BASED_OS
00116 #ifndef PLATFORM_NAME
00117 #define PLATFORM_NAME "NetBSD"
00118 #endif
00119
00120 #elif defined(__OpenBSD__)
00121 #define BSD_BASED_OS
00122 #ifndef PLATFORM_NAME
00123 #define PLATFORM_NAME "OpenBSD"
00124 #endif
00125
00126 #elif defined(__MINT__)
00127 #define BSD_BASED_OS
00128 #ifndef PLATFORM_NAME
00129 #define PLATFORM_NAME "FreeMiNT"
00130 #endif
00131
00132 #elif defined(__bsdi__)
00133 #define BSD_BASED_OS
00134 #ifndef PLATFORM_NAME
00135 #define PLATFORM_NAME "BSD/OS"
00136 #endif
00137
00138 #endif
00139
00140
00141
00142 #if defined(WINDOWS) || defined(_WIN32)
00143
00144 #define WINDOWS_OS
00145 #ifndef PLATFORM_NAME
00146 #define PLATFORM_NAME "Windows"
00147 #endif
00148
00149 #if defined(__MWERKS__) || defined(__MSL__)
00150
00151
00152 #ifdef SUPPORT_GETPWNAM
00153 #undef SUPPORT_GETPWNAM
00154 #endif
00155
00156
00157 #if !defined(NO_SETMODE_SUPPORT)
00158 #define NO_SETMODE_SUPPORT
00159 #endif
00160
00161 #define strcasecmp _stricmp
00162
00163 #endif
00164
00165 #define FILENAMES_CASE_SENSITIVE 0
00166
00167 #endif
00168
00169
00170
00171 #if defined(linux) && defined(__alpha__)
00172
00173 #define LINUX_OS
00174 #ifndef PLATFORM_NAME
00175 #define PLATFORM_NAME "Linux/Alpha"
00176 #endif
00177
00178 #elif defined(linux) && defined(__sparc__)
00179
00180 #define LINUX_OS
00181 #ifndef PLATFORM_NAME
00182 #define PLATFORM_NAME "Linux/Sparc"
00183 #endif
00184
00185 #elif defined(linux) && (defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__))
00186
00187 #define LINUX_OS
00188 #ifndef PLATFORM_NAME
00189 #define PLATFORM_NAME "Linux/x86"
00190 #endif
00191
00192 #elif defined(linux) && defined(__powerpc__)
00193
00194 #define LINUX_OS
00195
00196 #if defined(__linux__) && defined(__powerpc__)
00197
00198
00199
00200
00201 #ifndef PLATFORM_NAME
00202 #define PLATFORM_NAME "MkLinux"
00203 #endif
00204
00205 #else
00206
00207 #ifndef PLATFORM_NAME
00208 #define PLATFORM_NAME "Linux/PPC"
00209 #endif
00210
00211 #endif
00212
00213 #elif defined(linux) || defined(__linux__)
00214
00215 #define LINUX_OS
00216 #ifndef PLATFORM_NAME
00217 #define PLATFORM_NAME "Linux"
00218 #endif
00219
00220 #endif
00221
00222
00223
00224 #if defined(sun)
00225 #define SOLARIS_OS
00226 #ifndef PLATFORM_NAME
00227 #define PLATFORM_NAME "Solaris"
00228 #endif
00229 #endif
00230
00231
00232
00233 #if defined(__hpux)
00234 #define HPUX_OS
00235 #ifndef PLATFORM_NAME
00236 #define PLATFORM_NAME "HPUX"
00237 #endif
00238 #endif
00239
00240
00241
00242 #if defined(__riscos__)
00243 #define RISC_OS
00244 #ifndef PLATFORM_NAME
00245 #define PLATFORM_NAME "RISC OS"
00246 #endif
00247 #endif
00248
00249
00250
00251 #if defined(__OS2__) || defined(__EMX__)
00252 #define OS2_OS
00253 #ifndef PLATFORM_NAME
00254 #define PLATFORM_NAME "OS/2"
00255 #endif
00256 #define FILENAMES_CASE_SENSITIVE 0
00257 #define strcasecmp stricmp
00258 #endif
00259
00260
00261
00262 #if defined(__sgi)
00263 #define IRIX_OS
00264 #ifndef PLATFORM_NAME
00265 #define PLATFORM_NAME "SGI IRIX"
00266 #endif
00267 #endif
00268
00269
00270
00271 #if defined(_AIX)
00272 #define AIX_OS
00273 #ifndef PLATFORM_NAME
00274 #define PLATFORM_NAME "IBM AIX"
00275 #endif
00276 #endif
00277
00278
00279
00280
00281 #if defined(__BEOS__)
00282 #define BE_OS
00283 #ifndef PLATFORM_NAME
00284 #define PLATFORM_NAME "BeOS"
00285 #endif
00286 #endif
00287
00288
00289
00290 #if defined(__CYGWIN__)
00291 #define CYGWIN_OS
00292 #ifndef PLATFORM_NAME
00293 #define PLATFORM_NAME "Cygwin"
00294 #endif
00295 #define FILENAMES_CASE_SENSITIVE 0
00296 #endif
00297
00298
00299
00300 #if defined(__VMS)
00301 #define OPENVMS_OS
00302 #ifndef PLATFORM_NAME
00303 #define PLATFORM_NAME "OpenVMS"
00304 #endif
00305 #define FILENAMES_CASE_SENSITIVE 0
00306 #endif
00307
00308
00309
00310 #if defined(__osf__)
00311 #define OSF_OS
00312 #ifndef PLATFORM_NAME
00313 #define PLATFORM_NAME "DEC Alpha OSF"
00314 #endif
00315 #endif
00316
00317
00318
00319 #if defined(__arm)
00320 #define ARM_OS
00321
00322 #if defined(forARM) && defined(__NEWTON_H)
00323
00324
00325 #define NEWTON_OS
00326 #ifndef PLATFORM_NAME
00327 #define PLATFORM_NAME "Newton"
00328 #endif
00329
00330 #else
00331
00332 #ifndef PLATFORM_NAME
00333 #define PLATFORM_NAME "ARM"
00334 #endif
00335
00336 #endif
00337
00338 #endif
00339
00340 #include <ctype.h>
00341 #include <stdio.h>
00342 #include <setjmp.h>
00343 #include <stdlib.h>
00344 #include <stdarg.h>
00345 #include <string.h>
00346 #include <assert.h>
00347
00348 #ifdef NEEDS_MALLOC_H
00349 #include <malloc.h>
00350 #endif
00351
00352 #ifdef SUPPORT_GETPWNAM
00353 #include <pwd.h>
00354 #endif
00355
00356 #ifdef NEEDS_UNISTD_H
00357 #include <unistd.h>
00358 #endif
00359
00360
00361
00362
00363 #ifndef DFLT_REPL_CHARENC
00364 #define DFLT_REPL_CHARENC WIN1252
00365 #endif
00366
00367
00368
00369 #ifndef FILENAMES_CASE_SENSITIVE
00370 #define FILENAMES_CASE_SENSITIVE 1
00371 #endif
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393 #ifdef PRESERVEFILETIMES
00394 #undef PRESERVE_FILE_TIMES
00395 #define PRESERVE_FILE_TIMES PRESERVEFILETIMES
00396 #endif
00397
00398 #ifndef PRESERVE_FILE_TIMES
00399 #if defined(RISC_OS) || defined(OPENVMS_OS) || defined(OSF_OS)
00400 #define PRESERVE_FILE_TIMES 0
00401 #else
00402 #define PRESERVE_FILE_TIMES 1
00403 #endif
00404 #endif
00405
00406 #if PRESERVE_FILE_TIMES
00407
00408 #ifndef HAS_FUTIME
00409 #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__)
00410 #define HAS_FUTIME 0
00411 #else
00412 #define HAS_FUTIME 1
00413 #endif
00414 #endif
00415
00416 #ifndef UTIME_NEEDS_CLOSED_FILE
00417 #if defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(MAC_OS) || defined(__MSL__) || defined(LINUX_OS)
00418 #define UTIME_NEEDS_CLOSED_FILE 1
00419 #else
00420 #define UTIME_NEEDS_CLOSED_FILE 0
00421 #endif
00422 #endif
00423
00424 #if defined(MAC_OS_X) || (!defined(MAC_OS_CLASSIC) && !defined(__MSL__))
00425 #include <sys/types.h>
00426 #include <sys/stat.h>
00427 #else
00428 #include <stat.h>
00429 #endif
00430
00431 #if HAS_FUTIME
00432 #include <sys/utime.h>
00433 #else
00434 #include <utime.h>
00435 #endif
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446 #if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__)
00447
00448 #define futime _futime
00449 #define fstat _fstat
00450 #define utimbuf _utimbuf
00451 #define stat _stat
00452 #define utime _utime
00453 #define vsnprintf _vsnprintf
00454 #endif
00455
00456 #endif
00457
00458
00459
00460
00461
00462
00463
00464
00465 #if defined(_WIN32) && !defined(__MSL__) && !defined(__BORLANDC__)
00466
00467 #ifndef __WATCOMC__
00468 #define fileno _fileno
00469 #define setmode _setmode
00470 #endif
00471
00472 #define access _access
00473 #define strcasecmp _stricmp
00474
00475 #if _MSC_VER > 1000
00476 #pragma warning( disable : 4189 )
00477 #pragma warning( disable : 4100 )
00478 #pragma warning( disable : 4706 )
00479 #pragma warning( disable : 4068 )
00480 #endif
00481
00482 #endif
00483
00484 #if defined(_WIN32)
00485
00486 #if (defined(_USRDLL) || defined(_WINDLL)) && !defined(TIDY_EXPORT)
00487 #define TIDY_EXPORT __declspec( dllexport )
00488 #endif
00489
00490 #endif
00491
00492
00493
00494 #if defined(BE_OS) || defined(SOLARIS_OS) || defined(BSD_BASED_OS) || defined(OSF_OS) || defined(IRIX_OS) || defined(AIX_OS)
00495 #include <sys/types.h>
00496 #endif
00497 #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)
00498 typedef unsigned int uint;
00499 #endif
00500 #if defined(HPUX_OS) || defined(CYGWIN_OS) || defined(MAC_OS) || defined(BSD_BASED_OS) || defined(_WIN32)
00501 typedef unsigned long ulong;
00502 #endif
00503
00504 #ifndef TIDY_EXPORT
00505 #define TIDY_EXPORT
00506 #endif
00507
00508 #ifndef TIDY_STRUCT
00509 #define TIDY_STRUCT
00510 #endif
00511
00512 typedef unsigned char byte;
00513
00514 typedef uint tchar;
00515 typedef char tmbchar;
00516 #ifndef TMBSTR_DEFINED
00517 typedef tmbchar* tmbstr;
00518 typedef const tmbchar* ctmbstr;
00519 #define NULLSTR (tmbstr)""
00520 #define TMBSTR_DEFINED
00521 #endif
00522
00523
00524
00525
00526
00527
00528
00529
00530 typedef enum
00531 {
00532 no,
00533 yes
00534 } Bool;
00535
00536
00537
00538
00539
00540
00541 #if defined(DMALLOC)
00542 #include "dmalloc.h"
00543 #endif
00544
00545 void *MemAlloc(size_t size);
00546 void *MemRealloc(void *mem, size_t newsize);
00547 void MemFree(void *mem);
00548 void ClearMemory(void *, size_t size);
00549 void FatalError( ctmbstr msg );
00550
00551
00552
00553
00554
00555 #if 1
00556
00557
00558
00559 #define opaque_type( typenam )\
00560 struct _##typenam { int _opaque; };\
00561 typedef struct _##typenam* typenam
00562 #else
00563 #define opaque_type(typenam) typedef void* typenam
00564 #endif
00565
00566
00567
00568
00569
00570 opaque_type( TidyIterator );
00571
00572 #ifdef __cplusplus
00573 }
00574 #endif
00575
00576 #endif