home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / nsprpub / pr / include / md / _scoos.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.6 KB  |  145 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /*
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  * 
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  * 
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #ifndef nspr_scoos5_defs_h___
  20. #define nspr_scoos5_defs_h___
  21.  
  22. /*
  23.  * Internal configuration macros
  24.  */
  25.  
  26. #define PR_LINKER_ARCH    "scoos5"
  27. #define PR_DLL_SUFFIX        ".so"
  28.  
  29. #define _PR_SI_SYSNAME      "SCO"
  30. #define _PR_SI_ARCHITECTURE "x86"
  31. #define _PR_STACK_VMBASE    0x50000000
  32.  
  33. #define _MD_DEFAULT_STACK_SIZE    65536L
  34. #define _MD_MMAP_FLAGS          MAP_PRIVATE
  35.  
  36. #undef  HAVE_STACK_GROWING_UP
  37. #define    HAVE_DLL
  38. #define    USE_DLFCN
  39.  
  40. #if !defined (HAVE_STRERROR)
  41. #define HAVE_STRERROR
  42. #endif
  43.  
  44. #ifndef    HAVE_WEAK_IO_SYMBOLS
  45. #define    HAVE_WEAK_IO_SYMBOLS
  46. #endif
  47.  
  48. #define NEED_STRFTIME_LOCK
  49. #define NEED_TIME_R
  50. #define _PR_RECV_BROKEN /* recv doesn't work on Unix Domain Sockets */
  51.  
  52. #define USE_SETJMP
  53.  
  54. #ifdef _PR_LOCAL_THREADS_ONLY
  55. #include <setjmp.h>
  56.  
  57. #define _MD_GET_SP(_t)  (_t)->md.jb[4]
  58. #define PR_NUM_GCREGS    _SIGJBLEN
  59. #define PR_CONTEXT_TYPE    sigjmp_buf
  60.  
  61. #define CONTEXT(_th) ((_th)->md.jb)
  62.  
  63. #define _MD_INIT_CONTEXT(_thread, _sp, _main, status)                \
  64. {                                                                      \
  65.     *status = PR_TRUE;                                                \
  66.     if (sigsetjmp(CONTEXT(_thread),1)) {                              \
  67.         (*_main)();                                                 \
  68.     }                                                                  \
  69.     _MD_GET_SP(_thread) = (int) ((_sp) - 64);    \
  70. }
  71.  
  72. #define _MD_SWITCH_CONTEXT(_thread)                                  \
  73.     if (!sigsetjmp(CONTEXT(_thread), 1)) {                             \
  74.         (_thread)->md.errcode = errno;                              \
  75.         _PR_Schedule();                                                 \
  76.     }
  77.  
  78. /*
  79. ** Restore a thread context, saved by _MD_SWITCH_CONTEXT
  80. */
  81. #define _MD_RESTORE_CONTEXT(_thread)                                \
  82. {                                                                     \
  83.     errno = (_thread)->osErrorCode;                                     \
  84.     _MD_SET_CURRENT_THREAD(_thread);                                \
  85.     siglongjmp(CONTEXT(_thread), 1);                                \
  86. }
  87.  
  88. #endif /* _PR_LOCAL_THREADS_ONLY */
  89.  
  90. struct _MDThread {
  91.     jmp_buf jb;
  92.     int id;
  93.     int errcode;
  94. };
  95.  
  96. struct _MDThreadStack {
  97.     PRInt8 notused;
  98. };
  99.  
  100. struct _MDLock {
  101.     PRInt8 notused;
  102. };
  103.  
  104. struct _MDSemaphore {
  105.     PRInt8 notused;
  106. };
  107.  
  108. struct _MDCVar {
  109.     PRInt8 notused;
  110. };
  111.  
  112. struct _MDSegment {
  113.     PRInt8 notused;
  114. };
  115.  
  116. struct _MDCPU {
  117.     struct _MDCPU_Unix md_unix;
  118. };
  119.  
  120. #define _MD_INIT_LOCKS()
  121. #define _MD_NEW_LOCK(lock) PR_SUCCESS
  122. #define _MD_FREE_LOCK(lock)
  123. #define _MD_LOCK(lock)
  124. #define _MD_UNLOCK(lock)
  125. #define _MD_INIT_IO()
  126. #define _MD_IOQ_LOCK()
  127. #define _MD_IOQ_UNLOCK()
  128.  
  129. #define _MD_EARLY_INIT              _MD_EarlyInit
  130. #define _MD_FINAL_INIT                _PR_UnixInit
  131. #define _MD_INIT_RUNNING_CPU(cpu)     _MD_unix_init_running_cpu(cpu)
  132. #define _MD_INIT_THREAD             _MD_InitializeThread
  133. #define _MD_EXIT_THREAD(thread)
  134. #define    _MD_SUSPEND_THREAD(thread)
  135. #define    _MD_RESUME_THREAD(thread)
  136. #define _MD_CLEAN_THREAD(_thread)
  137.  
  138. #define _MD_GET_INTERVAL                  _PR_UNIX_GetInterval
  139. #define _MD_INTERVAL_PER_SEC              _PR_UNIX_TicksPerSecond
  140.  
  141. #define _MD_SELECT        _select
  142. #define _MD_POLL        _poll
  143.  
  144. #endif /* nspr_scoos5_defs_h___ */
  145.