ODGen.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. /* OpenDoors Online Software Programming Toolkit
  2. * (C) Copyright 1991 - 1999 by Brian Pirie.
  3. *
  4. * Oct-2001 door32.sys/socket modifications by Rob Swindell (www.synchro.net)
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. *
  20. *
  21. * File: ODGen.h
  22. *
  23. * Description: Contains general definitions used throughout OpenDoors,
  24. * including: - version information manifest constants
  25. * - debugging macros
  26. * - compiler-dependent definitions
  27. * - internally used macros
  28. *
  29. * Revisions: Date Ver Who Change
  30. * ---------------------------------------------------------------
  31. * Oct 13, 1994 6.00 BP Created.
  32. * Oct 20, 1994 6.00 BP Added DIM macro.
  33. * Dec 31, 1994 6.00 BP Remove USEINLINE option.
  34. * Dec 12, 1995 6.00 BP Moved ODPLAT_??? to OpenDoor.h.
  35. * Dec 19, 1995 6.00 BP Implement ASSERT() for Win32.
  36. * Jan 23, 1996 6.00 BP Added OD_TEXTMODE.
  37. * Feb 19, 1996 6.00 BP Changed version number to 6.00.
  38. * Feb 24, 1996 6.00 BP Turn off OD_DIAGNOSTICS.
  39. * Mar 03, 1996 6.10 BP Begin version 6.10.
  40. * Mar 03, 1996 6.10 BP Moved ODFAR to OpenDoor.h.
  41. * Oct 19, 2001 6.20 RS Incremented version for socket support.
  42. */
  43. #ifndef _INC_ODGEN
  44. #define _INC_ODGEN
  45. /* PLATFORM-SPECIFIC DEFINITIONS. */
  46. /* DLL specific defintions. */
  47. #ifdef OD_DLL
  48. #ifdef ODPLAT_WIN32
  49. #define OD_DLL_NAME "ODOORS62"
  50. #endif /* ODPLAT_WIN32 */
  51. #endif /* OD_DLL */
  52. /* Mutlithreading specific definitions. */
  53. #ifdef ODPLAT_WIN32
  54. #define OD_MULTITHREADED
  55. #endif /* ODPLAT_WIN32 */
  56. /* Text mode specific definitions. */
  57. #if defined(ODPLAT_DOS) || defined(ODPLAT_NIX)
  58. #define OD_TEXTMODE
  59. #endif /* ODPLAT_DOS */
  60. /* DOS specific definitions. */
  61. #ifdef ODPLAT_DOS
  62. /* Keyword to flag ISR functions. */
  63. #define INTERRUPT interrupt
  64. /* Inline assembly keyword varies from compiler to compiler. */
  65. #ifdef _MSC_VER
  66. #define ASM __asm
  67. #else
  68. #define ASM asm
  69. #endif
  70. /* Memory model information. */
  71. #ifdef __TINY__
  72. #define SMALLDATA
  73. #define SMALLCODE
  74. #endif
  75. #ifdef __SMALL__
  76. #define SMALLDATA
  77. #define SMALLCODE
  78. #endif
  79. #ifdef __COMPACT__
  80. #define LARGEDATA
  81. #define SMALLCODE
  82. #endif
  83. #ifdef __MEDIUM__
  84. #define SMALLDATA
  85. #define LARGECODE
  86. #endif
  87. #ifdef __LARGE__
  88. #define LARGEDATA
  89. #define LARGECODE
  90. #endif
  91. #ifdef __HUGE__
  92. #define LARGEDATA
  93. #define LARGECODE
  94. #endif
  95. #endif /* ODPLAT_DOS */
  96. /* VERSION INFORMATION CONSTANTS. */
  97. #define OD_VER_SHORTNAME "OpenDoors"
  98. #define OD_VER_STATUSLINE " OpenDoors 6.24 - (C) Copyright 1991-2001" \
  99. " by Brian Pirie "
  100. #define OD_VER_UNREG_STAT " OpenDoors 6.24 *WARNING* Unregistered Version" \
  101. " - Limit 1 month trial period! "
  102. #ifdef ODPLAT_DOS
  103. #define OD_VER_SIGNON "[OpenDoors 6.24/DOS - " \
  104. "(C) Copyright 1991-2001 by Brian Pirie]\n\r"
  105. #define OD_VER_FULLNAME "OpenDoors 6.24/DOS"
  106. #endif /* ODPLAT_DOS */
  107. #ifdef ODPLAT_WIN32
  108. #define OD_VER_SIGNON "[OpenDoors 6.24/Win32 - " \
  109. "(C) Copyright 1991-2001 by Brian Pirie]\n\r"
  110. #define OD_VER_FULLNAME "OpenDoors 6.24/Win32"
  111. #endif /* ODPLAT_WIN32 */
  112. #ifdef ODPLAT_NIX
  113. #define OD_VER_SIGNON "[OpenDoors 6.24/*nix - " \
  114. "(C) Copyright 1991-2001 by Brian Pirie]\n\r"
  115. #define OD_VER_FULLNAME "OpenDoors 6.24/*nix"
  116. #endif /* ODPLAT_NIX */
  117. /* COMPILER DEPENDENT DEFINITIONS. */
  118. /* Some compilers don't like const keyword on parameters. */
  119. #define CONST const
  120. /* DEBUG MACROS. */
  121. /* OD_DEBUG is defined for debug version of the library. */
  122. /* #define OD_DEBUG */
  123. /* OD_DIAGNOSTICS is defined to enable od_internal_debug. */
  124. /* #define OD_DIAGNOSTICS */
  125. /* ASSERTion macro - terminates if test condition fails. */
  126. #ifdef OD_DEBUG
  127. #define __STR(x) __VAL(x)
  128. #define __VAL(x) #x
  129. #ifdef ODPLAT_WIN32
  130. #define ASSERT(x) if(!(x)) { MessageBox(NULL, __FILE__ ":" \
  131. __STR(__LINE__) "\n" #x, OD_VER_FULLNAME " - Test condition failed", \
  132. MB_ICONSTOP | MB_OK); exit(1); }
  133. #else /* !ODPLAT_WIN32 */
  134. #define ASSERT(x) if(!(x)) { puts(OD_VER_FULLNAME \
  135. " - Test condition failed:\n" __FILE__ ":" __STR(__LINE__) "\n" #x); \
  136. exit(1); }
  137. #endif /* !ODPLAT_WIN32 */
  138. #else /* !OD_DEBUG */
  139. #define ASSERT(x)
  140. #endif /* !OD_DEBUG */
  141. /* TRACE() macro - used to generate debug output. */
  142. #ifdef OD_TRACE
  143. #include <stdio.h>
  144. #define TRACE_API 1
  145. #define TRACE(x, y) printf("[%s]", y);
  146. #else
  147. #define TRACE(x, y)
  148. #endif
  149. /* SCREEN SIZE. */
  150. #define OD_SCREEN_WIDTH 80
  151. #define OD_SCREEN_HEIGHT 25
  152. /* INTERNALLY USED MACROS. */
  153. /* MIN() and MAX() macros. Note that expressions passed to macros may be */
  154. /* evaluated more than once. For this reason, it is best to only pass */
  155. /* constants or variables to these macros. */
  156. #ifndef MIN
  157. #define MIN(x, y) ((x) > (y)) ? (y) : (x)
  158. #endif /* !MIN */
  159. #ifndef MAX
  160. #define MAX(x, y) ((x) > (y)) ? (x) : (y)
  161. #endif /* !MAX */
  162. /* DIM() macro. Returns the number of elements in an array. */
  163. #ifndef DIM
  164. #define DIM(x) (sizeof(x) / sizeof(*x))
  165. #endif /* !DIM */
  166. /* UNUSED() macro. Used to flag that a function parameter is intentionally */
  167. /* not used, thus preventing a compile-time warning. */
  168. #define UNUSED(x) ((void)(x))
  169. #endif /* !_INC_ODGEN */