home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / yacl-012.zip / base / defs.h < prev    next >
C/C++ Source or Header  |  1995-04-09  |  3KB  |  135 lines

  1.  
  2.  
  3. #ifndef _defs_h_
  4. #define _defs_h_
  5.  
  6.  
  7.  
  8.  
  9.  
  10. /*
  11.  *
  12.  *          Copyright (C) 1994, M. A. Sridhar
  13.  *  
  14.  *
  15.  *     This software is Copyright M. A. Sridhar, 1994. You are free
  16.  *     to copy, modify or distribute this software  as you see fit,
  17.  *     and to use  it  for  any  purpose, provided   this copyright
  18.  *     notice and the following   disclaimer are included  with all
  19.  *     copies.
  20.  *
  21.  *                        DISCLAIMER
  22.  *
  23.  *     The author makes no warranties, either expressed or implied,
  24.  *     with respect  to  this  software, its  quality, performance,
  25.  *     merchantability, or fitness for any particular purpose. This
  26.  *     software is distributed  AS IS.  The  user of this  software
  27.  *     assumes all risks  as to its quality  and performance. In no
  28.  *     event shall the author be liable for any direct, indirect or
  29.  *     consequential damages, even if the  author has been  advised
  30.  *     as to the possibility of such damages.
  31.  *
  32.  */
  33.  
  34.  
  35.  
  36. // Check that a platform is defined:
  37. #if !defined(__UNIX__) && !defined(WINDOWS) && !defined(__MS_WINDOWS__)
  38. #if !defined(MSDOS) && !defined(__DOS__) && !defined(__WINDOWS__)
  39. #if !defined(__OS2__)
  40. #error (defs.h) Unsupported platform
  41. #error define __UNIX__, WINDOWS, __MS_WINDOWS__, MSDOS or __OS2__
  42. #endif
  43. #endif
  44. #endif
  45.  
  46. #ifdef __GNUC__
  47. #pragma interface
  48. #endif
  49.  
  50. #ifdef __BORLANDC__
  51. #pragma warn -inl // No warnings about inline functions
  52. #endif
  53.  
  54.  
  55. // -------------------- Essential typedefs -----------------------
  56.  
  57. typedef unsigned short ushort;
  58. typedef unsigned long  ulong;
  59. typedef unsigned char  uchar;
  60. typedef void*          CL_VoidPtr;
  61. #if !defined(__GNUC__) || (__GNUC_MINOR__ <= 5)
  62. typedef uchar          bool;
  63. #endif
  64.  
  65.  
  66.  
  67. // ---------------------- #define'd symbols -----------------------
  68.  
  69.  
  70. #ifndef TRUE
  71. #define TRUE 1
  72. #define FALSE 0
  73. #endif
  74.  
  75. #if defined(__MS_WINDOWS__) && defined(BUILD_DLL)
  76. #define CL_EXPORT _export
  77. #endif
  78.  
  79. #if defined(__OS2__) && defined(BUILD_DLL)
  80. #define CL_EXPORT _export
  81. #endif
  82.  
  83. #ifndef CL_EXPORT
  84. #define CL_EXPORT
  85. #endif
  86.  
  87.  
  88.  
  89. #if (defined (__MSDOS__) || defined (__MS_WINDOWS__)) && defined(__BORLANDC__)
  90. #define __FAR __far
  91. #define __HUGE huge
  92. #else
  93. #define __FAR
  94. #define __HUGE
  95. #endif
  96.  
  97. #ifndef NO_DEBUG
  98. #include "base/error.h"
  99. #define assert(cond,params) if (!(cond)) CL_Error::Fatal params
  100. #else
  101. #define assert(cond, params)
  102. #endif
  103.  
  104.  
  105. #ifndef NULL
  106. #define NULL  0L
  107. #endif
  108.  
  109.  
  110.  
  111.  
  112.  
  113. // ------------------------- Inline functions -------------------------
  114.  
  115. #ifdef __GNUC__
  116. #pragma implementation // Force code generation for minl and maxl
  117. #endif
  118.  
  119. inline long minl (long x, long y)
  120. {
  121.     return (x < y) ? x : y;
  122. }
  123.  
  124.  
  125. inline long maxl (long x, long y)
  126. {
  127.     return (x > y) ? x : y;
  128. }
  129.  
  130.  
  131.  
  132. #endif
  133.  
  134.  
  135.