Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /****************************************************************************
  2. *
  3. *                            Open Watcom Project
  4. *
  5. *    Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
  6. *
  7. *  ========================================================================
  8. *
  9. *    This file contains Original Code and/or Modifications of Original
  10. *    Code as defined in and that are subject to the Sybase Open Watcom
  11. *    Public License version 1.0 (the 'License'). You may not use this file
  12. *    except in compliance with the License. BY USING THIS FILE YOU AGREE TO
  13. *    ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
  14. *    provided with the Original Code and Modifications, and is also
  15. *    available at www.sybase.com/developer/opensource.
  16. *
  17. *    The Original Code and all software distributed under the License are
  18. *    distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  19. *    EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
  20. *    ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
  21. *    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
  22. *    NON-INFRINGEMENT. Please see the License for the specific language
  23. *    governing rights and limitations under the License.
  24. *
  25. *  ========================================================================
  26. *
  27. * Description:  Internal CLIB structures and variables.
  28. *
  29. ****************************************************************************/
  30.  
  31.  
  32. #ifndef _RTDATA_H_INCLUDED
  33. #define _RTDATA_H_INCLUDED
  34.  
  35. #include "variety.h"
  36.  
  37. #include <stdio.h>
  38. #include "errorno.h"
  39.  
  40. /* DOS based platforms have stdaux/stdprn in addition to stdin/out/err */
  41. #if defined(__DOS__) || defined(__WINDOWS__) || defined(__OSI__)
  42.     #define NUM_STD_STREAMS 5
  43. #else
  44.     #define NUM_STD_STREAMS 3
  45. #endif
  46.  
  47. #if defined(__NT__) || defined(__OS2__)
  48.     struct __pipe_info {
  49.         int                 isPipe;     /* non-zero if it's a pipe */
  50.         int                 pid;        /* PID of spawned process */
  51.     };
  52. #endif
  53.  
  54. typedef struct __stream_link {
  55.     struct __stream_link *  next;
  56.     struct __iobuf *        stream;
  57.     unsigned char *         _base;          /* location of buffer */
  58.     int                     _orientation;   /* wide/byte/not oriented */
  59.     int                     _extflags;      /* extended flags */
  60.     unsigned char           _tmpfchar;      /* tmpfile number */
  61.     unsigned char           _filler[sizeof(int)-1];/* explicit padding */
  62. #if defined(__NT__) || defined(__OS2__)
  63.     struct __pipe_info      pipeInfo;       /* pipe-related fields */
  64. #endif
  65. } __stream_link;
  66.  
  67. typedef void _WCI86FAR      FPEhandler( int );
  68.  
  69. #define _FP_BASE(__fp)          ((__fp)->_link->_base)
  70. #ifndef __NETWARE__
  71.     #define _FP_ORIENTATION(__fp)   ((__fp)->_link->_orientation)
  72.     #define _FP_EXTFLAGS(__fp)      ((__fp)->_link->_extflags)
  73. #endif
  74.     #define _FP_TMPFCHAR(__fp)      ((__fp)->_link->_tmpfchar)
  75. #ifndef __NETWARE__
  76.     #define _FP_PIPEDATA(__fp)      ((__fp)->_link->pipeInfo)
  77. #endif
  78.  
  79. extern __stream_link        *__OpenStreams;
  80. extern __stream_link        *__ClosedStreams;
  81. extern      char            * _WCNEAR __env_mask;  /* ptr to char array of flags */
  82. extern      FPEhandler      *__FPE_handler;
  83. extern      void            (*__FPE_handler_exit)( void );
  84. #if !defined(__NETWARE__)
  85.     extern  int             _cbyte;
  86.     extern  int             _cbyte2;
  87.     extern  int             _child;
  88.     extern  int             __umaskval;
  89.     extern  unsigned        _curbrk;
  90.     extern  int             _commode;
  91. #endif
  92. #if !defined (_NETWARE_LIBC)
  93. extern      unsigned        _STACKTOP;
  94. #endif
  95. #if !defined(__QNX__) && !defined(__LINUX__)
  96.     extern void         (*__Save8087)();/* Ptr to FP state save rtn (spawn) */
  97.     extern void         (*__Rest8087)();/* Ptr to FP state restore rtn (spawn) */
  98. #endif
  99. extern unsigned short       _8087cw;    /* control word initializer */
  100. extern unsigned char        _no87;      /* NO87 environment var defined */
  101. extern unsigned char        _8087;      /* type of 8087/emulator present */
  102. extern unsigned char        _real87;    /* 8087 coprocessor hardware present */
  103. #if defined(_M_IX86)
  104.     #pragma aux             _8087cw "_*";
  105.     #pragma aux             _no87 "_*";
  106.     #pragma aux             _8087 "_*";
  107.     #pragma aux             _real87 "_*";
  108. #endif
  109. #if !defined(__SW_BM)
  110.     extern  unsigned        _STACKLOW;
  111. #endif
  112.  
  113. #define _RWD_ostream            __OpenStreams
  114. #define _RWD_cstream            __ClosedStreams
  115. #define _RWD_iob                __iob
  116. #if !defined(__NETWARE__)
  117.     #define _RWD_threadid       _threadid
  118. #endif
  119. #define _RWD_environ            environ
  120. #define _RWD_wenviron           _wenviron
  121. #define _RWD_env_mask           __env_mask
  122. #define _RWD_abort              __abort
  123. #define _RWD_sigtab             __SIGNALTABLE
  124. #define _RWD_FPE_handler_exit   __FPE_handler_exit
  125. #define _RWD_FPE_handler        __FPE_handler
  126. #define _RWD_fmode              _fmode
  127. #if !defined(__NETWARE__)
  128.     #define _RWD_umaskval       __umaskval
  129.     #define _RWD_cbyte          _cbyte
  130.     #define _RWD_cbyte2         _cbyte2
  131.     #define _RWD_child          _child
  132.     #define _RWD_amblksiz       _amblksiz
  133.     #define _RWD_curbrk         _curbrk
  134.     #define _RWD_dynend         _dynend
  135.     #define _RWD_psp            _psp
  136. #endif
  137. #if !defined (_NETWARE_LIBC)
  138. #define _RWD_stacktop           _STACKTOP
  139. #endif
  140. #if !defined(__QNX__) && !defined(__LINUX__)
  141.     #define _RWD_Save8087       __Save8087
  142.     #define _RWD_Rest8087       __Rest8087
  143. #endif
  144. #define _RWD_8087cw             _8087cw
  145. #define _RWD_no87               _no87
  146. #define _RWD_8087               _8087
  147. #define _RWD_real87             _real87
  148. #if !defined(__NETWARE__)
  149.     #define _RWD_HShift         _HShift
  150.     #define _RWD_osmajor        _osmajor
  151.     #define _RWD_osminor        _osminor
  152.     #define _RWD_osmode         _osmode
  153.     #if defined(__NT__)
  154.         #define _RWD_osbuild    _osbuild
  155.         #define _RWD_osver      _osver
  156.         #define _RWD_winmajor   _winmajor
  157.         #define _RWD_winminor   _winminor
  158.         #define _RWD_winver     _winver
  159.     #endif
  160.     #define _RWD_doserrno       _DOSERRNO
  161. #endif
  162. #define _RWD_tmpfnext           __tmpfnext
  163. #if !defined(_RWD_errno)
  164.     #define _RWD_errno              _ERRNO
  165. #endif
  166. #define _RWD_nexttok            _NEXTTOK
  167. #define _RWD_nextftok           _NEXTFTOK
  168. #define _RWD_nextmbtok          _NEXTMBTOK
  169. #define _RWD_nextmbftok         _NEXTMBFTOK
  170. #define _RWD_nextwtok           _NEXTWTOK
  171. #define _RWD_tzname             tzname
  172. #define _RWD_timezone           timezone
  173. #define _RWD_daylight           daylight
  174. #define _RWD_dst_adjust         __dst_adjust
  175. #define _RWD_start_dst          __start_dst
  176. #define _RWD_end_dst            __end_dst
  177. #define _RWD_asctime            _RESULT
  178. #ifdef __SW_BM
  179.     #define _RWD_cvtbuf         __THREADDATAPTR->__cvt_buffer
  180. #else
  181.     #define _RWD_cvtbuf         cvt_buffer
  182. #endif
  183. #if defined(__NETWARE__)
  184.     #define _RWD_ioexit         __ioexit
  185.     #define _RWD_tmpnambuf      (__THREADDATAPTR->__tmpnambuf)
  186.     #define _RWD_randnextinit   (__THREADDATAPTR->__randnextinit)
  187. #else
  188.     #define _RWD_tmpnambuf      _tmpname
  189.     #define _RWD_randnextinit   THREAD_PTR.__randnextinit
  190. #endif
  191. #define _RWD_stacklow           _STACKLOW
  192. #define _RWD_randnext           _RANDNEXT
  193. #define _RWD_ThreadData         _ThreadData
  194. #define _RWD_StaticInitSema     _StaticInitSema
  195. #define _RWD_PureErrorFlag      _PureErrorFlag
  196. #define _RWD_UndefVfunFlag      _UndefVfunFlag
  197. #define _RWD_ModuleInit         _ModuleInit
  198.  
  199. /*
  200.     For the sake of efficiency, tell the compiler
  201.     that the __exit... routines never return.
  202. */
  203. _WCRTLINK   extern  void    __exit( unsigned );
  204. #if defined(_M_IX86)
  205.     #pragma aux     __exit aborts;
  206. #endif
  207.  
  208. extern      void    (*__abort)( void );     // Defined in abort.c
  209. extern      void    __terminate( void );    // Defined in abort.c
  210.  
  211. #endif // _RTDATA_H_INCLUDED
  212.