home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / msgapi38.zip / INCLUDE / COMPILER.H < prev    next >
C/C++ Source or Header  |  1995-05-07  |  9KB  |  320 lines

  1. /***************************************************************************
  2.  *                                                                         *
  3.  *  MSGAPI Source Code, Version 2.00                                       *
  4.  *  Copyright 1989-1991 by Scott J. Dudley.  All rights reserved.          *
  5.  *                                                                         *
  6.  *  Compiler-determination and memory-model-determination routines         *
  7.  *                                                                         *
  8.  *  For complete details of the licensing restrictions, please refer to    *
  9.  *  the licence agreement, which is published in its entirety in           *
  10.  *  README.1ST.                                                            *
  11.  *                                                                         *
  12.  *  USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE       *
  13.  *  MSGAPI LICENSING AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF THIS       *
  14.  *  AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO NOT HAVE    *
  15.  *  THESE FILES, YOU SHOULD IMMEDIATELY CONTACT THE AUTHOR AT ONE OF THE   *
  16.  *  ADDRESSES LISTED BELOW.  IN NO EVENT SHOULD YOU PROCEED TO USE THIS    *
  17.  *  FILE WITHOUT HAVING ACCEPTED THE TERMS OF THE MSGAPI LICENSING         *
  18.  *  AGREEMENT, OR SUCH OTHER AGREEMENT AS YOU ARE ABLE TO REACH WITH THE   *
  19.  *  AUTHOR.                                                                *
  20.  *                                                                         *
  21.  *  You can contact the author at one of the address listed below:         *
  22.  *                                                                         *
  23.  *  Scott Dudley           FidoNet  1:249/106                              *
  24.  *  777 Downing St.        Internet f106.n249.z1.fidonet.org               *
  25.  *  Kingston, Ont.         BBS      (613) 389-8315   HST/14.4k, 24hrs      *
  26.  *  Canada - K7M 5N3                                                       *
  27.  *                                                                         *
  28.  ***************************************************************************/
  29.  
  30. /* $Id: compiler.h_v 1.0 1991/11/16 16:16:51 sjd Rel sjd $ */
  31.  
  32. /* Non-DOS systems...  Just do a "#define __FARCODE__",                     *
  33.  * "#define __FARDATA__" and "#define __LARGE__" in place of this file.     */
  34.  
  35. #ifndef __COMPILER_H_DEFINED
  36. #define __COMPILER_H_DEFINED
  37.  
  38. #if (!defined(OS_2) && !defined(MSDOS))
  39.   #define OS_2
  40. #endif
  41.  
  42. #if !defined(OS_2) && !defined(__MSDOS__)
  43.   #define __MSDOS__
  44. #endif
  45.  
  46. #ifdef OS_2
  47. #ifndef __386__
  48.   #define __386__
  49. #endif
  50.  
  51. #ifndef __FLAT__
  52.   #define __FLAT__
  53. #endif
  54. #endif
  55.  
  56.  /* WATCOM has both M_I86xxx and __modeltype__ macros */
  57. #if !(defined(__WATCOMC__) && defined(__MSDOS__))
  58.  
  59.   #if (defined(M_I86SM) || defined(M_I86MM)) || (defined(M_I86CM) || defined(M_I86LM) || defined(M_I86HM))
  60.     #define __MSC__
  61.   #endif
  62.  
  63.   #ifdef M_I86SM
  64.     #define __SMALL__
  65.   #endif
  66.  
  67.   #ifdef M_I86MM
  68.     #define __MEDIUM__
  69.   #endif
  70.  
  71.   #ifdef M_I86CM
  72.     #define __COMPACT__
  73.   #endif
  74.  
  75.   #ifdef M_I86LM
  76.     #define __LARGE__
  77.   #endif
  78.  
  79.   #ifdef M_I86HM
  80.     #define __HUGE__
  81.   #endif
  82.  
  83. #endif /* ! __WATCOMD__ */
  84.  
  85.  
  86. /* Handle 386 "flat" memory model */
  87.  
  88. #ifdef __FLAT__
  89.  
  90.   /* Other macros may get defined by braindead compilers */
  91.  
  92.   #ifdef __SMALL__
  93.     #undef __SMALL_
  94.   #endif
  95.  
  96.   #ifdef __TINY__
  97.     #undef __TINY__
  98.   #endif
  99.  
  100.   #ifdef __MEDIUM__
  101.     #undef __MEDIUM__
  102.   #endif
  103.  
  104.   #ifdef __COMPACT__
  105.     #undef __COMPACT__
  106.   #endif
  107.  
  108.   #ifdef __LARGE__
  109.     #undef __LARGE__
  110.   #endif
  111.  
  112.   #ifdef __HUGE__
  113.     #undef __HUGE__
  114.   #endif
  115.  
  116.   /* Code is really "near", but "far" in this context means that we want    *
  117.    * a 32 bit ptr (vice 16 bit).                                            */
  118.  
  119.   #define __FARCODE__
  120.   #define __FARDATA__
  121.  
  122.   /* Everything should be "near" in the flat model */
  123.  
  124.   #ifdef far
  125.     #undef far
  126.   #endif
  127.  
  128.   #ifdef near
  129.     #undef near
  130.   #endif
  131.  
  132.   #ifdef huge
  133.     #undef huge
  134.   #endif
  135.  
  136.   #define far
  137.   #define near
  138.   #define huge
  139. #endif
  140.  
  141.  
  142. #if defined(__SMALL__) || defined(__TINY__)
  143.   #define __NEARCODE__
  144.   #define __NEARDATA__
  145. #endif
  146.  
  147. #ifdef __MEDIUM__
  148.   #define __FARCODE__
  149.   #define __NEARDATA__
  150. #endif
  151.  
  152. #ifdef __COMPACT__
  153.   #define __NEARCODE__
  154.   #define __FARDATA__
  155. #endif
  156.  
  157. #if defined(__LARGE__) || defined(__HUGE__)
  158.   #define __FARCODE__
  159.   #define __FARDATA__
  160. #endif
  161.  
  162.  
  163.  
  164. /* Compiler-specific stuff:                                                 *
  165.  *                                                                          *
  166.  *  _stdc - Standard calling sequence.  This should be the type of          *
  167.  *          function required for function ptrs for qsort() et al.          *
  168.  *  _fast - Fastest calling sequence supported.  If the default             *
  169.  *          calling sequence is the fastest, or if your compiler            *
  170.  *          only has one, define this to nothing.                           *
  171.  *  _intr - For defining interrupt functions.  For some idiotic             *
  172.  *          reason, MSC requires that interrupts be declared                *
  173.  *          as "cdecl interrupt", instead of just "interrupt".              */
  174.  
  175. #if defined(__BORLANDC__) && defined(__OS2__)
  176.   #undef  __TURBOC__
  177.   #define __BCOS2__
  178. #endif
  179.  
  180. #if defined(__TURBOC__)
  181.  
  182.   #define _stdc     cdecl
  183.   #define _intr     interrupt far
  184.   #define _intcast  void (_intr *)()
  185.   #define _veccast  _intcast
  186.   #define _fast     pascal
  187.   #define _loadds
  188.  
  189.   #define NW(var) (void)var
  190.   /* structs are packed in TC by default, accd to TURBOC.CFG */
  191.   /* bad assumption!  should explicitly specify packing - djnb */
  192.  
  193. #elif defined(__WATCOMC__) && defined(__MSDOS__)
  194.     #define _stdc cdecl
  195.     #define _intr interrupt far
  196.     #define _intcast void (_intr *)()
  197.     #define _veccase _intcast
  198.     #define _fast pascal
  199.     #define NW(var) (void)var
  200. /*    #define farread        read
  201.     #define farwrite       write */
  202.  
  203. #elif defined(__MSC__)
  204.  
  205.   #define _stdc     cdecl
  206.   #define _intr     cdecl interrupt far
  207.   #define _intcast  void (_intr *)()
  208.   #define _veccast  _intcast
  209.  
  210.   #if _MSC_VER >= 600
  211.     #define _fast _fastcall
  212.   #else
  213.     #define _fast pascal
  214.   #endif
  215.  
  216.   #pragma pack(1)                 /* Structures should NOT be padded */
  217.   #define NW(var)  var = var      /* NW == No Warning */
  218.  
  219. #elif defined(__WATCOMC__)
  220.  
  221.   #define _stdc
  222.   #define _intr
  223.   #define _intcast
  224.   #define _veccast
  225.   #define _fast
  226.   #define far
  227.   #define farread        read
  228.   #define farwrite       write
  229.  
  230.   #pragma pack(1)                 /* Structures should NOT be padded */
  231.   #define NW(var)   (void)var
  232.  
  233. #elif defined(__EMX__)
  234.  
  235.   #define _stdc
  236.   #define _intr
  237.   #define _intcast
  238.   #define _veccast
  239.   #define _fast
  240.   #define _loadds
  241.  
  242.   #define cdecl
  243.   #define pascal
  244.   #define far
  245.  
  246.   #pragma pack(1)                 /* Structures should NOT be padded */
  247.   #define NW(var)   (void)var
  248.  
  249.   /* Hacks for replacement functions */
  250.   #define farread        read
  251.   #define farwrite       write
  252.   #define mymkdir        __mkdir
  253.   #define unlock(a,b,c)  NW(a)
  254.   #define lock(a,b,c)    0
  255.  
  256.   /* sys/emx.h */
  257.   int __mkdir (__const__ char *);
  258.  
  259. #elif defined(__BCOS2__)
  260.  
  261.   #define _stdc     cdecl
  262.   #define _intr
  263.   #define _intcast
  264.   #define _veccast
  265.   #define _fast     pascal
  266.   #define _loadds
  267.  
  268.   #define far
  269.  
  270.   #pragma option -a1              /* Structures should NOT be padded */
  271.   #define NW(var)   (void)var
  272.  
  273.   /* Hacks for replacement functions */
  274.   #define farread        read
  275.   #define farwrite       write
  276.  
  277. #elif defined(__IBMC__)
  278.  
  279.   #define _stdc
  280.   #define _intr
  281.   #define _intcast
  282.   #define _veccast
  283.   #define _fast
  284.   #define _loadds
  285.  
  286.   #define cdecl
  287.   #define pascal
  288.   #define far
  289.  
  290.   #pragma pack(1)                 /* Structures should NOT be padded */
  291.   #define NW(var)   (void)var
  292.  
  293.   /* Hacks for replacement functions */
  294.   #define farread        read
  295.   #define farwrite       write
  296.   #define unlock(a,b,c)  NW(a)
  297.   #define lock(a,b,c)    0
  298.  
  299. #else
  300.   #error Unknown compiler!
  301.  
  302.   #define _stdc
  303.   #define _intr     interrupt
  304.   #define _intcast  void (_intr *)()
  305.   #define _veccast  _intr
  306.   #define _fast
  307.   #define NW(var)   (void)var
  308.   #define __MSDOS__
  309. #endif
  310.  
  311. #ifndef mymkdir
  312. #define mymkdir mkdir
  313. #endif
  314.  
  315. #define NO_MKTIME
  316. #define NO_STRFTIME
  317.  
  318. #endif /* ! __COMPILER_H_DEFINED */
  319.  
  320.