home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / nsprpub / pr / include / md / _ncr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  4.3 KB  |  172 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_unixware_defs_h___
  20. #define nspr_unixware_defs_h___
  21.  
  22. /*
  23.  * Internal configuration macros
  24.  */
  25.  
  26. #define PR_LINKER_ARCH    "ncr"
  27. #define _PR_SI_SYSNAME        "NCR"
  28. #define _PR_SI_ARCHITECTURE    "x86"
  29. #define PR_DLL_SUFFIX        ".so"
  30.  
  31. #define _PR_VMBASE         0x30000000
  32. #define _PR_STACK_VMBASE    0x50000000
  33. #define _MD_DEFAULT_STACK_SIZE    65536L
  34. #define _MD_MMAP_FLAGS          MAP_PRIVATE
  35.  
  36. #define    HAVE_DLL
  37. #define    USE_DLFCN
  38. #define _PR_RECV_BROKEN /* recv doesn't work on Unix Domain Sockets */
  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. #undef  HAVE_STACK_GROWING_UP
  49. #define HAVE_NETCONFIG
  50. #define NEED_STRFTIME_LOCK
  51. #define NEED_TIME_R
  52. #define NEED_LOCALTIME_R
  53. #define NEED_GMTIME_R  
  54. #define NEED_ASCTIME_R
  55. #define NEED_STRTOK_R
  56. #define NEED_CTIME_R
  57. #define _PR_NEED_STRCASECMP
  58.  
  59. #define USE_SETJMP
  60.  
  61. #include <setjmp.h>
  62.  
  63. #define _SETJMP setjmp
  64. #define _LONGJMP longjmp
  65. #define _PR_CONTEXT_TYPE         jmp_buf
  66. #define _MD_GET_SP(_t)           (_t)->md.context[4]
  67. #define _PR_NUM_GCREGS    _JBLEN
  68.  
  69. #define CONTEXT(_th) ((_th)->md.context)
  70.  
  71. /*
  72. ** Initialize the thread context preparing it to execute _main.
  73. */
  74. #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
  75. {                                  \
  76.     *status = PR_TRUE; \
  77.     if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
  78.     _MD_GET_SP(_thread) = (int) ((_sp) - 128); \
  79. }
  80.  
  81. #define _MD_SWITCH_CONTEXT(_thread)  \
  82.     if (!_SETJMP(CONTEXT(_thread))) { \
  83.     (_thread)->md.errcode = errno;  \
  84.     _PR_Schedule();             \
  85.     }
  86.  
  87. /*
  88. ** Restore a thread context, saved by _MD_SWITCH_CONTEXT
  89. */
  90. #define _MD_RESTORE_CONTEXT(_thread) \
  91. {                     \
  92.     errno = (_thread)->md.errcode;         \
  93.     _MD_SET_CURRENT_THREAD(_thread); \
  94.     _LONGJMP(CONTEXT(_thread), 1);    \
  95. }
  96.  
  97. /* Machine-dependent (MD) data structures.
  98.  * Don't use SVR4 native threads (yet). 
  99.  */
  100.  
  101. struct _MDThread {
  102.     _PR_CONTEXT_TYPE context;
  103.     int id;
  104.     int errcode;
  105. };
  106.  
  107. struct _MDThreadStack {
  108.     PRInt8 notused;
  109. };
  110.  
  111. struct _MDLock {
  112.     PRInt8 notused;
  113. };
  114.  
  115. struct _MDSemaphore {
  116.     PRInt8 notused;
  117. };
  118.  
  119. struct _MDCVar {
  120.     PRInt8 notused;
  121. };
  122.  
  123. struct _MDSegment {
  124.     PRInt8 notused;
  125. };
  126.  
  127. struct _MDCPU {
  128.     struct _MDCPU_Unix md_unix;
  129. };
  130.  
  131. #define _MD_INIT_LOCKS()
  132. #define _MD_NEW_LOCK(lock) PR_SUCCESS
  133. #define _MD_FREE_LOCK(lock)
  134. #define _MD_LOCK(lock)
  135. #define _MD_UNLOCK(lock)
  136. #define _MD_INIT_IO()
  137. #define _MD_IOQ_LOCK()
  138. #define _MD_IOQ_UNLOCK()
  139.  
  140. /*
  141.  * The following are copied from _sunos.h, _aix.h.  This means
  142.  * some of them should probably be moved into _unixos.h.  But
  143.  * _irix.h seems to be quite different in regard to these macros.
  144.  */
  145. #define _MD_GET_INTERVAL                  _PR_UNIX_GetInterval
  146. #define _MD_INTERVAL_PER_SEC              _PR_UNIX_TicksPerSecond
  147.  
  148. #define _MD_EARLY_INIT        _MD_EarlyInit
  149. #define _MD_FINAL_INIT        _PR_UnixInit
  150. #define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
  151. #define _MD_INIT_THREAD         _MD_InitializeThread
  152. #define _MD_EXIT_THREAD(thread)
  153. #define    _MD_SUSPEND_THREAD(thread)
  154. #define    _MD_RESUME_THREAD(thread)
  155. #define _MD_CLEAN_THREAD(_thread)
  156.  
  157. /*
  158.  * We wrapped the select() call.  _MD_SELECT refers to the built-in,
  159.  * unwrapped version.
  160.  */
  161. #include <sys/time.h>
  162. #include <sys/types.h>
  163. #include <sys/select.h>
  164. extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
  165.     fd_set *execptfds, struct timeval *timeout);
  166. #define _MD_SELECT _select
  167.  
  168. #define _MD_POLL _poll
  169. extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
  170.  
  171. #endif /* nspr_ncr_defs_h */
  172.