home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 13 / MA_Cover_13.bin / source / c / tidy26jul99 / platform.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-12-08  |  1.9 KB  |  97 lines

  1. /* platform.h
  2.  
  3.   (c) 1998 (W3C) MIT, INRIA, Keio University
  4.   See tidy.c for the copyright notice.
  5. */
  6.  
  7. #include <ctype.h>
  8. #include <stdio.h>
  9. #include <setjmp.h>  /* for longjmp on error exit */
  10. #include <stdlib.h>
  11. #include <stdarg.h>  /* may need <varargs.h> for Unix V */
  12. #include <string.h>
  13. #include <malloc.h>
  14. #include <assert.h>
  15.  
  16. #define ACCESS_URL  "http://www.w3.org/WAI/GL"
  17.  
  18. /*
  19.   uncomment and edit this #define if you want
  20.   to specify the config file at compile-time
  21.  
  22. #define CONFIG_FILE "/etc/tidy_config.txt"
  23. */
  24.  
  25. #ifdef NEEDS_UNISTD_H
  26. #include <unistd.h>  /* needed for unlink on some Unix systems */
  27. #endif
  28.  
  29.  
  30. /* hack for gnu sys/types.h file  which defines uint and ulong */
  31. /* you may need to delete the #ifndef and #endif on your system */
  32. #ifndef __USE_MISC
  33. typedef unsigned int uint;
  34. typedef unsigned long ulong;
  35. #endif
  36.  
  37. typedef unsigned char byte;
  38.  
  39. typedef char *UTF8;
  40.  
  41. /*
  42.   bool is a reserved word in some but
  43.   not all C++ compilers depending on age
  44.   work around is to avoid bool altogether
  45.   by introducing a new enum called Bool
  46. */
  47. typedef enum
  48. {
  49.    no,
  50.    yes
  51. } Bool;
  52.  
  53. /* for null pointers */
  54. #define null 0
  55.  
  56. /*
  57.   portability hack for deleting files - this is used
  58.   in pprint.c for deleting superfluous slides.
  59.  
  60.   Win32 defines _unlink as per Unix unlink function.
  61. */
  62.  
  63. #ifdef WINDOWS
  64. #define unlink _unlink
  65. #endif
  66.  
  67. typedef struct
  68. {
  69.     int encoding;
  70.     int state;     /* for ISO 2022 */
  71.     FILE *fp;
  72. } Out;
  73.  
  74. void outc(uint c, Out *out);
  75.  
  76. void *MemAlloc(uint size);
  77. void *MemRealloc(void *mem, uint newsize);
  78. void MemFree(void *mem);
  79.  
  80. /* string functions */
  81. uint ToLower(uint c);
  82. uint ToUpper(uint c);
  83. char *wstrdup(char *str);
  84. char *wstrndup(char *str, int len);
  85. void wstrncpy(char *s1, char *s2, int size);
  86. void wstrcpy(char *s1, char *s2);
  87. int wstrcmp(char *s1, char *s2);
  88. int wstrcasecmp(char *s1, char *s2);
  89. int wstrncmp(char *s1, char *s2, int n);
  90. int wstrlen(char *str);
  91. void ClearMemory(void *, uint size);
  92.  
  93. void tidy_out(FILE *fp, const char* msg, ...);
  94.  
  95.  
  96.  
  97.