kludge.h
上传用户:zbbssh
上传日期:2007-01-08
资源大小:196k
文件大小:2k
源码类别:

CA认证

开发平台:

C/C++

  1. #ifndef KLUDGE_H
  2. #define KLUDGE_H
  3. /*
  4.  * Kludges for not-quite-ANSI systems.
  5.  * This should always be the last file included, because it may
  6.  * mess up some system header files.
  7.  */
  8. /* SunOS 4.1.x <assert.h> needs "stderr" defined, and "exit" declared... */
  9. #ifdef assert
  10. #if ASSERT_NEEDS_STDIO
  11. #include <stdio.h>
  12. #endif
  13. #if ASSERT_NEEDS_STDLIB
  14. #if !NO_STDLIB_H
  15. #include <stdlib.h>
  16. #endif
  17. #endif
  18. #endif
  19. #if NO_MEMMOVE /* memove() not in libraries */
  20. #define memmove(dest,src,len) bcopy(src,dest,len)
  21. #endif
  22. #if NO_MEMCPY /* memcpy() not in libraries */
  23. #define memcpy(dest,src,len) bcopy(src,dest,len)
  24. #endif
  25. #if MEM_PROTOS_BROKEN
  26. #define memcpy(d,s,l) memcpy((void *)(d), (void const *)(s), l)
  27. #define memmove(d,s,l) memmove((void *)(d), (void const *)(s), l)
  28. #define memcmp(d,s,l) memcmp((void const *)(d), (void const *)(s), l)
  29. #define memset(d,v,l) memset((void *)(d), v, l)
  30. #endif
  31. /*
  32.  * If there are no prototypes for the stdio functions, use these to
  33.  * reduce compiler warnings.  Uses EOF as a giveaway to indicate
  34.  * that <stdio.h> was #included.
  35.  */
  36. #if NO_STDIO_PROTOS /* Missing prototypes for "simple" functions */
  37. #if defined(EOF)
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. int (puts)(char const *);
  42. int (fputs)(char const *, FILE *);
  43. void (rewind)(FILE *);
  44. int (fflush)(FILE *);
  45. int (fclose)(FILE *);
  46. int (printf)(char const *, ...);
  47. int (fprintf)(FILE *, char const *, ...);
  48. int (fseek)(FILE *, long, int);
  49. int (remove)(char const *);
  50. int (rename)(char const *, char const *);
  51. void (perror)(char const *);
  52. int (pclose)(FILE *);
  53. /* If we have a sufficiently old-fashioned stdio, it probably uses these... */
  54. int (_flsbuf)(int, FILE *);
  55. int (_filbuf)(FILE *);
  56. int (ungetc)(int, FILE *);
  57. size_t (fread)(char *, size_t, size_t, FILE *);
  58. size_t (fwrite)(char const *, size_t, size_t, FILE *);
  59. #if defined(va_start) || defined(va_arg) || defined(va_end)
  60. int (vfprintf)(FILE *, char const *, ...);
  61. #endif
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #endif /* EOF */
  66. #endif /* NO_STDIO_PROTOS */
  67. /*
  68.  * Borland C seems to think that it's a bad idea to decleare a
  69.  * structure tag and not declare the contents.  I happen to think
  70.  * it's a *good* idea to use such "opaque" structures wherever
  71.  * possible.  So shut up.
  72.  */
  73. #ifdef __BORLANDC__
  74. #pragma warn -stu
  75. #ifndef MSDOS
  76. #define MSDOS 1
  77. #endif
  78. #endif
  79. /* Cope with people forgetting to define the OS, if possible... */
  80. #ifndef MSDOS
  81. #ifdef __MSDOS
  82. #define MSDOS 1
  83. #endif
  84. #endif
  85. #endif /* KLUDGE_H */