home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / c / ios_src / portab.h < prev    next >
C/C++ Source or Header  |  1993-01-31  |  11KB  |  255 lines

  1. /*****************************************************************************/
  2. /*                                                                           */
  3. /* PORTAB.H                                                                  */
  4. /*                                                                           */
  5. /* Use of this file may make your code compatible with all C compilers       */
  6. /* listed.                                                                   */
  7. /*                                                                           */
  8. /*****************************************************************************/
  9.  
  10. /*****************************************************************************/
  11. /* ENVIRONMENT                                                               */
  12. /*****************************************************************************/
  13.  
  14. #ifndef __PORTAB__
  15. #define __PORTAB__
  16.  
  17. #define GEMDOS     1                          /* Digital Research GEMDOS     */
  18. #define MSDOS      0                          /* Microsoft MSDOS             */
  19. #define OS2        0                          /* Microsoft OS/2              */
  20. #define FLEXOS     0                          /* Digital Research FlexOS     */
  21. #define UNIX       0                          /* Unix Operating System       */
  22.  
  23. #define M68000     1                          /* Motorola Processing Unit    */
  24. #define I8086      0                          /* Intel Processing Unit       */
  25.  
  26. #define DR_C       0                          /* Digital Research C Compiler */
  27. #define LASER_C    0                          /* Laser C Compiler            */
  28. #define LATTICE_C  0                          /* Lattice C Compiler          */
  29. #define MW_C       0                          /* Mark Williams C Compiler    */
  30. #define TURBO_C    1                          /* Turbo C Compiler            */
  31. #define MS_C       0                          /* Microsoft C Compiler        */
  32. #define HIGH_C     0                          /* Metaware High C Compiler    */
  33. #define PCC        0                          /* Portable C-Compiler         */
  34.  
  35. #define GEM1       0x0001                     /* ATARI GEM version           */
  36. #define GEM2       0x0002                     /* MSDOS GEM 2.x versions      */
  37. #define GEM3       0x0004                     /* MSDOS GEM/3 version         */
  38. #define XGEM       0x0100                     /* OS/2,FlexOS X/GEM version   */
  39.  
  40. #ifndef GEM
  41. #if GEMDOS
  42. #define GEM        GEM1                       /* GEMDOS default is GEM1      */
  43. #endif /* GEMDOS */
  44.  
  45. #if MSDOS
  46. #define GEM        GEM3                       /* MSDOS default is GEM3       */
  47. #endif /* MSDOS */
  48.  
  49. #if OS2
  50. #define GEM        XGEM                       /* OS/2 default is X/GEM       */
  51. #endif /* MSDOS */
  52.  
  53. #if FLEXOS | UNIX
  54. #define GEM        XGEM                       /* FlexOS default is X/GEM     */
  55. #endif /* FLEXOS */
  56. #endif /* GEM */
  57.  
  58. /*****************************************************************************/
  59. /* STANDARD TYPE DEFINITIONS                                                 */
  60. /*****************************************************************************/
  61.  
  62. #define BYTE    signed char                   /* Signed byte                 */
  63. #define UBYTE   unsigned char                 /* Unsigned byte               */
  64.  
  65. #if LATTICE_C | PCC
  66. #define WORD    short                         /* Signed word (16 bits)       */
  67. #if GEMDOS
  68.     #define UWORD    unsigned int              /* Lattice on ST require int    */
  69. #else
  70.     #define UWORD   unsigned short            /* Unsigned word               */
  71. #endif
  72. #else
  73. #define WORD    int                           /* Signed word (16 bits)       */
  74. #define UWORD   unsigned int                  /* Unsigned word               */
  75. #endif
  76.  
  77. #define LONG    long                          /* Signed long (32 bits)       */
  78. #define ULONG   unsigned long                 /* Unsigned long               */
  79.  
  80. #define BOOLEAN WORD                          /* 2 valued (true/false)       */
  81.  
  82. #define FLOAT   float                         /* Single precision float      */
  83. #define DOUBLE  double                        /* Double precision float      */
  84.  
  85. #define INT     int                           /* A machine dependent int     */
  86. #define UINT    unsigned int                  /* A machine dependent uint    */
  87.  
  88. #define REG     register                      /* Register variable           */
  89. #define AUTO    auto                          /* Local to function           */
  90. #define EXTERN  extern                        /* External variable           */
  91. #define LOCAL   static                        /* Local to module             */
  92. #define MLOCAL  LOCAL                         /* Local to module             */
  93. #define GLOBAL                                /* Global variable             */
  94.  
  95. /*****************************************************************************/
  96. /* COMPILER DEPENDENT DEFINITIONS                                            */
  97. /*****************************************************************************/
  98.  
  99. #if GEMDOS                                    /* GEMDOS compilers            */
  100. #if DR_C
  101. #define void WORD                             /* DR_C doesn't know void      */
  102. #endif /* DR_C */
  103.  
  104. #if LASER_C
  105. #define vqt_font_info vqt_fontinfo            /* Wrong GEM binding           */
  106. #define graf_mbox graf_movebox                /* Wrong GEM binding           */
  107. #define graf_rubbox graf_rubberbox            /* Wrong GEM binding           */
  108. #endif /* LASER_C */
  109.  
  110. #if LATTICE_C
  111. #define vqt_font_info vqt_fontinfo            /* Wrong GEM binding           */
  112. #define graf_mbox graf_movebox                /* Wrong GEM binding           */
  113. #define graf_rubbox graf_rubberbox            /* Wrong GEM binding           */
  114. #endif /* LATTICE_C */
  115.  
  116. #if TURBO_C
  117. #define graf_mbox graf_movebox                /* Wrong GEM binding           */
  118. #define graf_rubbox graf_rubberbox            /* Wrong GEM binding           */
  119. #endif /* TURBO_C */
  120.  
  121. #if MW_C
  122. #define VOID WORD                             /* MW_C doesn't know (void *)  */
  123. #endif /* MW_C */
  124.  
  125. #if LATTICE_C
  126. #define ADR(A) (LONG)A >> 16, (LONG)A & 0xFFFF
  127. #else
  128. #define ADR(A) (WORD)((LONG)A >> 16), (WORD)((LONG)A & 0xFFFF)
  129. #endif /* LATTICE_C */
  130. #endif /* GEMDOS */
  131.  
  132. #if MSDOS | OS2                               /* MSDOS or OS2 compilers      */
  133. #define ADR(A) (WORD)((LONG)A & 0xFFFF), (WORD)((LONG)A >> 16)
  134. #endif /* MSDOS */
  135.  
  136. #if FLEXOS                                    /* FlexOS compilers            */
  137. #define ADR(A) (WORD)((LONG)A & 0xFFFF), (WORD)((LONG)A >> 16)
  138. #endif /* FLEXOS */
  139.  
  140. #if MS_C | TURBO_C | HIGH_C                   /* ANSI compilers              */
  141. #define ANSI 1
  142. #define _(params) params                      /* Parameter checking          */
  143. #else
  144. #define ANSI 0
  145. #define _(params) ()                          /* No parameter checking       */
  146. #define const
  147. #define volatile
  148. #if DR_C | LASER_C | LATTICE_C | MW_C
  149. #define size_t UINT
  150. #endif
  151. #endif
  152.  
  153. #if DR_C | LASER_C | LATTICE_C | MW_C | HIGH_C | PCC
  154. #define cdecl
  155. #define pascal
  156. #endif
  157.  
  158. #define CONST    const
  159. #define VOLATILE volatile
  160. #define CDECL    cdecl
  161. #define PASCAL   pascal
  162.  
  163. #define SIZE_T   size_t
  164.  
  165. #ifndef VOID
  166. #define VOID     void
  167. #endif
  168.  
  169. /*****************************************************************************/
  170. /* OPERATING SYSTEM DEPENDENT DEFINITIONS                                    */
  171. /*****************************************************************************/
  172.  
  173. #if GEMDOS | UNIX
  174. #define NEAR                                  /* Near pointer                */
  175. #define FAR                                   /* Far pointer                 */
  176. #define HUGE                                  /* Huge pointer                */
  177. #else
  178. #if HIGH_C
  179. #define NEAR   _near                          /* Near pointer                */
  180. #define FAR    _far                           /* Far pointer                 */
  181. #define HUGE   _huge                          /* Huge pointer                */
  182. #else
  183. #define NEAR    near                          /* Near pointer                */
  184. #define FAR     far                           /* Far pointer                 */
  185. #define HUGE    huge                          /* Huge pointer                */
  186. #endif /* HIGH_C */
  187. #endif /* GEMDOS */
  188.  
  189. #if MSDOS | OS2 | FLEXOS                      /* MSDOS or OS2 compilers      */
  190. #define FPOFF(a)  (UWORD)(a)
  191. #define FPSEG(a)  ((UWORD)((ULONG)(a) >> 16))
  192. #define MKFP(a,b) ((VOID FAR *)(((ULONG)(a) << 16) | (UWORD)(b)))
  193. #endif /* MSDOS | OS2 | FLEXOS */
  194.  
  195. #if FLEXOS                                    /* FlexOS compilers            */
  196. #define main GEMAIN                           /* Because of X/GEM SRTL       */
  197. #endif /* FLEXOS */
  198.  
  199. #if GEM & GEM1
  200. #define appl_bvset(bvdisk, bvhard)
  201. #define appl_yield() evnt_timer (0, 0)
  202. #define menu_unregister(mid)
  203. #define scrp_clear()
  204. #define xgrf_stepcalc(orgw, orgh, xc, yc, w, h, pcx, pcy, pcnt, pxstep, pystep)
  205. #define xgrf_2box(xc, yc, w, h, corners, cnt, xstep, ystep, doubled)
  206. #endif /* GEM1 */
  207.  
  208. #if GEM & (GEM1 | XGEM)
  209. #define shel_rdef(lpcmd, lpdir)
  210. #define shel_wdef(lpcmd, lpdir)
  211. #endif /* GEM1 | XGEM */
  212.  
  213. #if GEM & (GEM1 | GEM2)
  214. #define menu_click(click, setit)
  215. #define v_copies(handle, count)
  216. #define v_etext(handle, x, y, string, offsets)
  217. #define v_orient(handle, orientation)
  218. #define v_tray(handle, tray)
  219. #define v_xbit_image(handle, filename, aspect, x_scale, y_scale, h_align, v_align, rotate, background, foreground, xy)\
  220.         v_bit_image (handle, filename, aspect, x_scale, y_scale, h_align, v_align, xy)
  221. #define vst_ex_load_fonts(handle, select, font_max, font_free)\
  222.         vst_load_fonts   (handle, select)
  223. #endif /* GEM1 | GEM2 */
  224.  
  225. #if GEM & (GEM2 | GEM3 | XGEM)
  226. #define fsel_exinput(pipath, pisel, pbutton, plabel)\
  227.         fsel_input  (pipath, pisel, pbutton)
  228. #define wind_new()
  229. #endif /* GEM2 | GEM3 | XGEM */
  230.  
  231. /*****************************************************************************/
  232. /* MISCELLANEOUS DEFINITIONS                                                 */
  233. /*****************************************************************************/
  234.  
  235. #ifndef FALSE
  236. #define FALSE   (BOOLEAN)0                    /* Function FALSE value        */
  237. #define TRUE    (BOOLEAN)1                    /* Function TRUE  value        */
  238. #endif
  239.  
  240. #define FAILURE (-1)                          /* Function failure return val */
  241. #define SUCCESS 0                             /* Function success return val */
  242. #define FOREVER for (;;)                      /* Infinite loop declaration   */
  243. #define EOS     '\0'                          /* End of string value         */
  244.  
  245. #ifndef NULL
  246. #define NULL    0L                            /* Null long value             */
  247. #endif
  248.  
  249. #ifndef EOF
  250. #define EOF     (-1)                          /* EOF value                   */
  251. #endif
  252.  
  253. #endif /* __PORTAB__ */
  254.  
  255.