ODKrnl.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* OpenDoors Online Software Programming Toolkit
  2. * (C) Copyright 1991 - 1999 by Brian Pirie.
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. *
  18. *
  19. * File: ODKrnl.h
  20. *
  21. * Description: Contains the public definitions related to odkrnl.c
  22. *
  23. * Revisions: Date Ver Who Change
  24. * ---------------------------------------------------------------
  25. * Jan 01, 1995 6.00 BP Split off from odcore.c and oddoor.h
  26. * Dec 12, 1995 6.00 BP Added entry, exit and kernel macros.
  27. * Jan 12, 1996 6.00 BP Added bOnlyShiftArrow.
  28. * Feb 19, 1996 6.00 BP Changed version number to 6.00.
  29. * Mar 03, 1996 6.10 BP Begin version 6.10.
  30. * Mar 13, 1996 6.10 BP bOnlyShiftArrow -> nArrowUseCount.
  31. */
  32. #ifndef _INC_ODKRNL
  33. #define _INC_ODKRNL
  34. #include "ODPlat.h"
  35. /* Global kernel-related variables. */
  36. extern tODTimer RunKernelTimer;
  37. extern time_t nNextTimeDeductTime;
  38. extern char chLastControlKey;
  39. extern INT nArrowUseCount;
  40. extern BOOL bForceStatusUpdate;
  41. extern BOOL bSysopColor;
  42. #ifdef OD_MULTITHREADED
  43. extern tODSemaphoreHandle hODActiveSemaphore;
  44. #endif /* OD_MULTITHREADED */
  45. /* Chat mode global variables. */
  46. extern BOOL bIsShell;
  47. extern BOOL bChatted;
  48. /* Kernel function prototypes. */
  49. tODResult ODKrnlInitialize(void);
  50. void ODKrnlShutdown(void);
  51. void ODKrnlHandleLocalKey(WORD wKeyCode);
  52. void ODKrnlEndChatMode(void);
  53. void ODKrnlForceOpenDoorsShutdown(BYTE btReasonForShutdown);
  54. #ifdef OD_MULTITHREADED
  55. tODResult ODKrnlStartChatThread(BOOL bTriggeredInternally);
  56. #endif /* OD_MULTITHREADED */
  57. /* Macro used to generate the appropriate code (if any) to call */
  58. /* the OpenDoors kernel from within OpenDoors code. */
  59. #ifdef OD_MULTITHREADED
  60. #define CALL_KERNEL_IF_NEEDED()
  61. #else /* !OD_MULTITHREADED */
  62. #ifdef ODPLAT_NIX
  63. #ifdef USE_KERNEL_SIGNAL
  64. #define CALL_KERNEL_IF_NEEDED()
  65. #else
  66. #define CALL_KERNEL_IF_NEEDED() od_kernel()
  67. #endif
  68. #else
  69. #define CALL_KERNEL_IF_NEEDED() od_kernel()
  70. #endif /* !ODPLAT_NIX */
  71. #endif /* !OD_MULTITHREADED */
  72. /* Macro used to increment or decrement OpenDoors active semaphore. */
  73. #ifdef OD_MULTITHREADED
  74. #define OD_API_ENTRY() ODSemaphoreUp(hODActiveSemaphore, 1);
  75. #define OD_API_EXIT() ODSemaphoreDown(hODActiveSemaphore, 1);
  76. #else /* !OD_MULTITHREADED */
  77. #define OD_API_ENTRY()
  78. #define OD_API_EXIT()
  79. #endif /* !OD_MULTITHREADED */
  80. #endif /* _INC_ODKRNL */