home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / c / CLib37x.lha / c_lib / source / lib_source / compiler.h next >
Encoding:
C/C++ Source or Header  |  1997-01-25  |  2.8 KB  |  96 lines

  1. /*
  2. **      $VER: compiler.h 37.5 (24.1.97)
  3. **
  4. **      Compiler independent register and SAS/C extensions handling
  5. **
  6. **      (C) Copyright 1997 Andreas R. Kleinert
  7. **      All Rights Reserved.
  8. */
  9.  
  10. /* Basically, Amiga C compilers must reach the goal to be
  11.    as SAS/C compatible as possible. But on the other hand,
  12.    when porting AmigaOS to other platforms, one perhaps
  13.    can't expect GCC becoming SAS/C compatible.
  14.  
  15.    There are two ways to make your sources portable:
  16.  
  17.     - using non ANSI SAS/C statements and making these
  18.       "available" to the other compilers (re- or undefining)
  19.     - using replacements for SAS/C statements and smartly
  20.       redefining these for any compiler
  21.  
  22.    The last mentioned is the most elegant, but may require to
  23.    rewrite your source codes, so this compiler include file
  24.    basically does offer both.
  25.  
  26.    For some compilers, this may have been done fromout project or
  27.    makefiles for the first method (e.g. StormC) to ensure compileablity.
  28.  
  29.    Basically, you should include this header file BEFORE any other stuff.
  30. */
  31.  
  32. /* ********************************************************************* */
  33. /* Method 1: redefining SAS/C keywords                                   */
  34. /*                                                                       */
  35. #ifdef __MAXON__  // ignore this switches of SAS/Storm
  36. #define __aligned
  37. #define __asm
  38. #define __regargs
  39. #define __saveds
  40. #define __stdargs
  41. #endif
  42.  
  43.  /* for SAS/C we don't need this, for StormC this is done in the
  44.     makefile or projectfile */
  45.  
  46. /*                                                                       */
  47. /* ********************************************************************* */
  48.  
  49.  
  50. /* ********************************************************************* */
  51. /* Method 2: defining our own keywords                                   */
  52. /*                                                                       */
  53. #ifdef __SASC
  54.  
  55. #  define REG(r)     register __ ## r
  56. #  define SAVEDS     __saveds
  57. #  define ASM        __asm
  58. #  define REGARGS    __regargs
  59. #  define STDARGS    __stdargs
  60. #  define ALIGNED    __aligned
  61.  
  62. #else
  63. # ifdef __MAXON__
  64.  
  65. #   define REG(r)    register __ ## r
  66. #   define SAVEDS
  67. #   define ASM
  68. #   define REGARGS
  69. #   define STDARGS
  70. #   define ALIGNED
  71.  
  72. # else
  73. #   ifdef __STORM__
  74.  
  75. #     define REG(r)  register __ ## r
  76. #     define SAVEDS  __saveds
  77. #     define ASM
  78. #     define REGARGS
  79. #     define STDARGS
  80. #     define ALIGNED
  81.  
  82. #   else /* any other compiler, to be added here */
  83.  
  84. #     define REG(r)
  85. #     define SAVEDS
  86. #     define ASM
  87. #     define REGARGS
  88. #     define STDARGS
  89. #     define ALIGNED
  90.  
  91. #   endif /* __STORM__ */
  92. # endif /* __MAXON__ */
  93. #endif /* __SASC */
  94. /*                                                                       */
  95. /* ********************************************************************* */
  96.