/Pristine-Pro/POCO/POEKIT/INC/COMPILER.H

http://github.com/AnimatorPro/Animator-Pro · C Header · 138 lines · 28 code · 30 blank · 80 comment · 1 complexity · e4fe1e7504cd6338b11228fc0671c92b MD5 · raw file

  1. /*****************************************************************************
  2. * COMPILER.H - Fine tune options and standardize macros between compilers.
  3. *
  4. * This is a good place to put #pragma statements and other information
  5. * specific to a given compiler. Every module in PJ and all its subsystems
  6. * and libraries will include this header file.
  7. *
  8. * In addition to options, performance tuning statements, and so on, this
  9. * header defines several macros which standardize operations between
  10. * different compilers. (IE, quirk-fixes.) For example, a va_list type
  11. * is an array-of-one under Watcom, but a scalar item under High C. When
  12. * you add a new compiler type, each of these macros must be defined as
  13. * appropriate to your compiler. Currently, these macros are:
  14. *
  15. * NOFUNC - A NULL pointer that works for function pointers.
  16. * copy_va_list - Copy a value from one va_list variable to another.
  17. *
  18. * To add a new compiler, just clone one of the existing sections, change
  19. * the compiler ID in the #if defined() statement, and add your options and
  20. * quirk-fix macros.
  21. ****************************************************************************/
  22. #ifndef COMPILER_H
  23. /*****************************************************************************
  24. * Items specific to 386/protected mode, but not any given compiler...
  25. *
  26. * norm_pointer is a function for the 86/286, but in protected mode with
  27. * a flat address space it's unnecessary.
  28. ****************************************************************************/
  29. #define norm_pointer(c) ((void *)(c))
  30. /*****************************************************************************
  31. * Watcom C/386 v8.0
  32. ****************************************************************************/
  33. #if defined(__WATCOMC__)
  34. /*----------------------------------------------------------------------------
  35. * compiler directives...
  36. * put pragmas for options and performance tuning, etc, here.
  37. *--------------------------------------------------------------------------*/
  38. #pragma off(unreferenced); /* don't whine about unused */
  39. /* function parameters. */
  40. #define PROTECTED /* not sure what this is for. */
  41. #ifndef _toupper
  42. #define _toupper(c) ((c) + 'A' - 'a') /* these are missing from */
  43. #define _tolower(c) ((c) + 'a' - 'A') /* Watcom's current ctype.h */
  44. #endif
  45. extern char *_STACKTOP; /* Watcom stack goodies... */
  46. extern char *_STACKLOW; /* not sure what these are for, */
  47. #define __STACK_R32__ /* suspect only for PJ internals*/
  48. /*----------------------------------------------------------------------------
  49. * PJ-specific items...
  50. * this section must appear for each compiler. the macro definitions
  51. * should be modified as needed for your compiler.
  52. *
  53. * in Watcom, a function pointer can be the normal ((void*)0).
  54. * macro to copy a va_list value assumes that va list is a char *va_list[1].
  55. *--------------------------------------------------------------------------*/
  56. #define NOFUNC ((void*)0)
  57. #define copy_va_list(src,dest) {dest[0]=src[0];}
  58. #include "pjinline.h" /* we can write better inlines than Watcom, include them */
  59. /*****************************************************************************
  60. * Metaware High C v1.6
  61. ****************************************************************************/
  62. #elif defined(__HIGHC__)
  63. /*----------------------------------------------------------------------------
  64. * compiler directives...
  65. * put pragmas for options and performance tuning, etc, here.
  66. *--------------------------------------------------------------------------*/
  67. #pragma on(387); /* ok to generate 80387 instructions */
  68. #pragma on(floating_point); /* BUT, do not use non emulated 80387 */
  69. /* instructions. If you KNOW this code will */
  70. /* ONLY be used with an 80387 loaded machine */
  71. /* change this to 'on'. */
  72. /*----------------------------------------------------------------------------
  73. * PJ-specific items...
  74. * this section must appear for each compiler. the macro definitions
  75. * should be modified as needed for your compiler.
  76. *
  77. * in High C, a function pointer can be 0, but not ((void*)0)
  78. * macro to copy a va_list value assumes that va list is a char *va_list.
  79. *--------------------------------------------------------------------------*/
  80. #define NOFUNC 0L
  81. #define copy_va_list(src,dest) {dest=src}
  82. /*****************************************************************************
  83. * Borland/Turbo C (for poco development work only)
  84. ****************************************************************************/
  85. #elif defined(__BORLANDC__) || defined(__TURBOC__)
  86. /*----------------------------------------------------------------------------
  87. * compiler directives...
  88. * put pragmas for options and performance tuning, etc, here.
  89. *--------------------------------------------------------------------------*/
  90. /* nothing borland-specific needed right now */
  91. /*----------------------------------------------------------------------------
  92. * PJ-specific items...
  93. * this section must appear for each compiler. the macro definitions
  94. * should be modified as needed for your compiler.
  95. *
  96. * in Watcom, a function pointer can be the normal ((void*)0).
  97. * macro to copy a va_list value assumes that va list is a char *va_list[1].
  98. *--------------------------------------------------------------------------*/
  99. #define NOFUNC ((void*)0)
  100. #define copy_va_list(src,dest) {dest=src;}
  101. /*****************************************************************************
  102. * Unknown compiler, whine and die.
  103. ****************************************************************************/
  104. #else
  105. #error Unknown compiler type in COMPILER.H!!!
  106. #endif
  107. #endif /* COMPILER_H */
  108.