update clib

git-svn-id: svn://kolibrios.org@701 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge)
2008-01-23 19:23:33 +00:00
parent 7941c117bc
commit 275695e8c3
41 changed files with 4614 additions and 3937 deletions

View File

@@ -0,0 +1,45 @@
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: prototype for 8087 save/restore state functions and data
*
****************************************************************************/
#if defined(_M_IX86)
typedef struct _87state { /* 80x87 save area */
#if defined( __386__ )
char data[108]; /* 32-bit save area size */
#else
char data[94]; /* 16-bit save area size */
#endif
} _87state;
extern void (*__Save8087)(_87state *);
extern void (*__Rest8087)(_87state *);
#endif

View File

@@ -30,6 +30,31 @@
****************************************************************************/
#define _ERRNO errno
#if defined(__OS2__) || defined(__NT__)
#if defined(__SW_BM)
#include "thread.h"
#define _ERRNO (__THREADDATAPTR->__errnoP)
#define _DOSERRNO (__THREADDATAPTR->__doserrnoP)
#else
#define _ERRNO errno
#define _DOSERRNO _doserrno
#endif
#else
// QNX errno is magically multithread aware
// What does NETWARE do?
#if !defined (_NETWARE_LIBC)
#define _ERRNO errno
#else
extern int * ___errno(void);
#define _ERRNO *___errno() /* get LibC errno */
#endif
#ifndef __NETWARE__
#define _DOSERRNO _doserrno
#endif
#endif

View File

@@ -0,0 +1,58 @@
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: prototypes for arguments processing variables
*
****************************************************************************/
#ifndef _INITARG_H_INCLUDED
#define _INITARG_H_INCLUDED
extern int __F_NAME(_argc,_wargc); /* argument count */
extern CHAR_TYPE **__F_NAME(_argv,_wargv); /* argument vector */
extern void __F_NAME(__Init_Argv,__wInit_Argv)( void );
extern void __F_NAME(__Fini_Argv,__wFini_Argv)( void );
_WCRTLINKD extern int __F_NAME(___Argc,___wArgc); /* argument count */
_WCRTLINKD extern CHAR_TYPE**__F_NAME(___Argv,___wArgv); /* argument vector */
_WCRTLINKD extern char *_LpCmdLine; /* pointer to command line */
_WCRTLINKD extern char *_LpPgmName; /* pointer to program name */
extern char *_LpDllName; /* pointer to dll name */
_WCRTLINKD extern wchar_t *_LpwCmdLine; /* pointer to wide command line */
_WCRTLINKD extern wchar_t *_LpwPgmName; /* pointer to wide program name */
extern wchar_t *_LpwDllName; /* pointer to wide dll name */
#if defined(__WINDOWS_386__)
extern char __Is_DLL;
#else
extern int __Is_DLL;
#endif
#endif

View File

@@ -0,0 +1,86 @@
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: Init/Fini routines delcarations.
*
****************************************************************************/
#ifndef _INITFINI_H_INCLUDED
#define _INITFINI_H_INCLUDED
#include "variety.h"
#include "rtinit.h"
#if defined(__386__)
#define __PARMREG1 eax
#define __PARMREG2 edx
#elif defined(M_I86)
#define __PARMREG1 ax
#define __PARMREG2 dx
#else
#define __PARMREG1
#define __PARMREG2
#endif
extern void __InitRtns( unsigned );
// - takes priority limit parm in __PARMREG1
// code will run init routines whose
// priority is <= __PARMREG1 (really [0-255])
// __PARMREG1==255 -> run all init routines
// __PARMREG1==15 -> run init routines whose priority is <= 15
#if defined(_M_IX86)
#pragma aux __InitRtns "*" parm [__PARMREG1]
#if !defined(__386__)
extern void _WCI86FAR __FInitRtns(unsigned);
#pragma aux __FInitRtns "*" parm [__PARMREG1]
#endif
#endif
extern void __FiniRtns(unsigned,unsigned);
// - takes priority limit range in __PARMREG1, __PARMREG2
// code will run fini routines whose
// priority is >= __PARMREG1 (really [0-255]) and
// <= __PARMREG2 (really [0-255])
// __PARMREG1==0 ,__PARMREG2==255 -> run all fini routines
// __PARMREG1==16,__PARMREG2==255 -> run fini routines in range 16...255
// __PARMREG1==16,__PARMREG2==40 -> run fini routines in range 16...40
#if defined(_M_IX86)
#pragma aux __FiniRtns "*" parm [__PARMREG1] [__PARMREG2]
#if !defined(__386__)
extern void _WCI86FAR __FFiniRtns( unsigned, unsigned );
#pragma aux __FFiniRtns "*" parm [__PARMREG1] [__PARMREG2]
#endif
#endif
#if defined(__OS2__) && defined(__386__)
#define EXIT_PRIORITY_CLIB 0x00009F00
#endif
#undef __PARMREG1
#undef __PARMREG2
#endif

View File

@@ -0,0 +1,33 @@
;*****************************************************************************
;*
;* Open Watcom Project
;*
;* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
;*
;* ========================================================================
;*
;* This file contains Original Code and/or Modifications of Original
;* Code as defined in and that are subject to the Sybase Open Watcom
;* Public License version 1.0 (the 'License'). You may not use this file
;* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
;* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
;* provided with the Original Code and Modifications, and is also
;* available at www.sybase.com/developer/opensource.
;*
;* The Original Code and all software distributed under the License are
;* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
;* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
;* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
;* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
;* NON-INFRINGEMENT. Please see the License for the specific language
;* governing rights and limitations under the License.
;*
;* ========================================================================
;*
;* Description: WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
;* DESCRIBE IT HERE!
;*
;*****************************************************************************
COMP_CFG_COFF equ 0

View File

@@ -0,0 +1,50 @@
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
* DESCRIBE IT HERE!
*
****************************************************************************/
#ifndef _LJMPHDL_H_INCLUDED
#define _LJMPHDL_H_INCLUDED
#include "variety.h"
typedef void (*pfun)( void _WCFAR * );
#if defined(__386__)
#pragma aux __arg_convention parm caller [eax dx];
#pragma aux (__arg_convention) pfun;
#elif defined(M_I86)
#pragma aux __arg_convention parm caller [ax dx];
#pragma aux (__arg_convention) pfun;
#endif
_WCRTLINKD extern pfun __longjmp_handler;
#endif

View File

@@ -0,0 +1,103 @@
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: Internal data and routines for "Safer C", or bounds-checking
* library extension.
*
****************************************************************************/
#ifndef _SAFERLIB_H_INCLUDED
#define _SAFERLIB_H_INCLUDED
#define __STDC_WANT_LIB_EXT1__ 1
#include <stdlib.h>
#include <stdint.h>
// Maximum length of runtime-constraint error message
#define RTCT_MSG_MAX 128
#define _RWD_rtcthandler __runtime_constraint_handler
extern constraint_handler_t __runtime_constraint_handler;
extern void __rtct_fail( const char *fn, const char *reason, void *reserved );
// Runtime-constraint validation macros. Call the handler and return zero if check
// failed, return non-zero value if check succeeded.
#define __check_constraint_nullptr( arg ) \
((arg == NULL) ? __rtct_fail( __func__, #arg " == NULL", NULL ), 0 : 1)
#define __check_constraint_maxsize( arg ) \
((arg > RSIZE_MAX) ? __rtct_fail( __func__, #arg " > RSIZE_MAX", NULL ), 0 : 1)
#define __check_constraint_zero( arg ) \
((arg == 0) ? __rtct_fail( __func__, #arg " == 0", NULL ), 0 : 1)
#define __check_constraint_toosmall( name, left ) \
((left == 0) ? __rtct_fail( __func__, #name " is too small to hold data", NULL ), 0 : 1)
// Runtime-constraint validation macros. Construct the message and return
// zero if check failed, return non-zero value if check succeeded.
// __rtct_fail has to be explicitly called later.
#define __check_constraint_nullptr_msg( msg, arg ) \
((arg == NULL) ? ( msg = #arg " == NULL" ), 0 : 1)
#define __check_constraint_maxsize_msg( msg, arg ) \
((arg > RSIZE_MAX) ? ( msg = #arg " > RSIZE_MAX" ), 0 : 1)
#define __check_constraint_zero_msg( msg, arg ) \
((arg == 0) ? ( msg = #arg " == 0" ), 0 : 1)
#define __check_constraint_toosmall_msg( msg, name, left ) \
((left == 0) ? ( msg = #name " is too small to hold data" ), 0 : 1)
#define __check_constraint_a_gt_b_msg( msg, a, b ) \
((a > b) ? ( msg = #a " > " #b ), 0 : 1)
#define __check_constraint_overlap_msg( msg, p1, len1, p2, len2 ) \
(((p1 == p2) || ( (p1 > p2) && ( p1 < (CHAR_TYPE *)p2 + len2 * sizeof( CHAR_TYPE ))) \
|| ( (p2 > p1) && ( p2 < (CHAR_TYPE *)p1 + len1 * sizeof( CHAR_TYPE )))) \
? ( msg = #p1 " overlap " #p2 ), 0 : 1)
// For 16-bit targets, the RSIZE_MAX check is effectively no-op. Object sizes
// up to SIZE_MAX are legal and not uncommon.
#if RSIZE_MAX == SIZE_MAX
#undef __check_constraint_maxsize
#define __check_constraint_maxsize( arg ) 1
#undef __check_constraint_maxsize_msg
#define __check_constraint_maxsize_msg( msg, arg ) 1
#define __lte_rsizmax( arg ) 1
#else
#define __lte_rsizmax( arg ) (arg <= RSIZE_MAX)
#endif
#endif // _SAFERLIB_H_INCLUDED

View File

@@ -0,0 +1,59 @@
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
* DESCRIBE IT HERE!
*
****************************************************************************/
#ifndef _STACKLOW_H_INCLUDED
#define _STACKLOW_H_INCLUDED
#define __Align4K( x ) (((x)+0xfffL) & ~0xfffL )
#if defined(_M_IX86)
extern unsigned _SP();
#if defined(__386__)
#pragma aux _SP = "mov eax,esp" value [eax];
#else
#pragma aux _SP = "mov ax,sp" value [ax];
#endif
#endif
#if defined(__NT__)
void __init_stack_limits( unsigned *stacklow, unsigned *stacktop );
#endif
#if defined(__SW_BM)
#include "thread.h"
#define _STACKLOW (__THREADDATAPTR->__stklowP)
#else
extern unsigned _STACKLOW;
#endif
#endif

View File

@@ -0,0 +1,41 @@
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
* DESCRIBE IT HERE!
*
****************************************************************************/
#ifndef __STRDUP_H_INCLUDED
#define __STRDUP_H_INCLUDED
#include "variety.h"
#include "widechar.h"
_WCRTLINK extern char *__clib_strdup( const char *str );
_WCRTLINK extern wchar_t *__clib_wcsdup( const wchar_t *str );
#endif

View File

@@ -0,0 +1,479 @@
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: C/C++ run-time library floating-point definitions.
*
****************************************************************************/
#ifndef _XFLOAT_H_INCLUDED
#define _XFLOAT_H_INCLUDED
#include <stddef.h> // for wchar_t
#include <float.h> // for LDBL_DIG
#ifdef __cplusplus
extern "C" {
#endif
#if (defined(__386__) || defined(M_I86)) && defined(__WATCOMC__)
#define _LONG_DOUBLE_
#endif
typedef struct { // This layout matches Intel 8087
#ifdef _LONG_DOUBLE_
unsigned long low_word; // - low word of fraction
unsigned long high_word; // - high word of fraction
unsigned short exponent; // - exponent and sign
#else // use this for all other 32-bit RISC
union {
double value; // - double value
unsigned long word[2];// - so we can access bits
};
#endif
} long_double;
typedef struct { // Layout of IEEE 754 double (FD)
union {
double value; // - double value
unsigned long word[2];// - so we can access bits
};
} float_double;
typedef struct { // Layout of IEEE 754 single (FS)
union {
float value; // - double value
unsigned long word; // - so we can access bits
};
} float_single;
/* NB: The following values *must* match FP_ macros in math.h! */
enum ld_classification {
__ZERO = 0,
__DENORMAL = 1,
__NONZERO = 2,
__NAN = 3,
__INFINITY = 4
};
enum ldcvt_flags {
E_FMT = 0x0001, // 'E' format
F_FMT = 0x0002, // 'F' format
G_FMT = 0x0004, // 'G' format
F_CVT = 0x0008, // __cvt routine format rules
F_DOT = 0x0010, // always put '.' in result
LONG_DOUBLE = 0x0020, // number is true long double
NO_TRUNC = 0x0040, // always provide ndigits in buffer
IN_CAPS = 0x0080, // 'inf'/'nan' is uppercased
};
typedef struct cvt_info {
int ndigits; // INPUT: number of digits
int scale; // INPUT: FORTRAN scale factor
int flags; // INPUT: flags (see ldcvt_flags)
int expchar; // INPUT: exponent character to use
int expwidth; // INPUT/OUTPUT: number of exponent digits
int sign; // OUTPUT: 0 => +ve; otherwise -ve
int decimal_place; // OUTPUT: position of '.'
int n1; // OUTPUT: number of leading characters
int nz1; // OUTPUT: followed by this many '0's
int n2; // OUTPUT: followed by these characters
int nz2; // OUTPUT: followed by this many '0's
} CVT_INFO;
_WMRTLINK extern void __LDcvt(
long_double *pld, // pointer to long_double
CVT_INFO *cvt, // conversion info
char *buf ); // buffer
#if defined( __WATCOMC__ )
_WMRTLINK extern int __Strtold(
const char *bufptr,
long_double *pld,
char **endptr );
#endif
extern int __LDClass( long_double * );
extern void __ZBuf2LD(char _WCNEAR *, long_double _WCNEAR *);
extern void _LDScale10x(long_double _WCNEAR *,int);
_WMRTLINK extern void __cnvd2ld( double _WCNEAR *src, long_double _WCNEAR *dst );
_WMRTLINK extern void __cnvs2d( char *buf, double *value );
_WMRTLINK extern int __cnvd2f( double *src, float *tgt );
#ifdef _LONG_DOUBLE_
extern void __iLDFD(long_double _WCNEAR *, double _WCNEAR *);
extern void __iLDFS(long_double _WCNEAR *, float _WCNEAR *);
extern void __iFDLD(double _WCNEAR *,long_double _WCNEAR *);
extern void __iFSLD(float _WCNEAR *,long_double _WCNEAR *);
extern long __LDI4(long_double _WCNEAR *);
extern void __I4LD(long,long_double _WCNEAR *);
extern void __U4LD(unsigned long,long_double _WCNEAR *);
extern void __FLDA(long_double _WCNEAR *,long_double _WCNEAR *,long_double _WCNEAR *);
extern void __FLDS(long_double _WCNEAR *,long_double _WCNEAR *,long_double _WCNEAR *);
extern void __FLDM(long_double _WCNEAR *,long_double _WCNEAR *,long_double _WCNEAR *);
extern void __FLDD(long_double _WCNEAR *,long_double _WCNEAR *,long_double _WCNEAR *);
extern int __FLDC(long_double _WCNEAR *,long_double _WCNEAR *);
#endif
#ifdef __WATCOMC__
#if defined(__386__)
#pragma aux __ZBuf2LD "*" parm caller [eax] [edx];
#if defined(__FPI__)
extern unsigned __Get87CW(void);
extern void __Set87CW(unsigned short);
#pragma aux __Get87CW = \
"push 0"\
float "fstcw [esp]"\
float "fwait"\
"pop eax"\
value [eax];
#pragma aux __Set87CW = \
"push eax"\
float "fldcw [esp]"\
"pop eax"\
parm caller [eax];
#pragma aux __FLDA = \
float "fld tbyte ptr [eax]"\
float "fld tbyte ptr [edx]"\
float "fadd"\
float "fstp tbyte ptr [ebx]"\
parm caller [eax] [edx] [ebx];
#pragma aux __FLDS = \
float "fld tbyte ptr [eax]"\
float "fld tbyte ptr [edx]"\
float "fsub"\
float "fstp tbyte ptr [ebx]"\
parm caller [eax] [edx] [ebx];
#pragma aux __FLDM = \
float "fld tbyte ptr [eax]"\
float "fld tbyte ptr [edx]"\
float "fmul"\
float "fstp tbyte ptr [ebx]"\
parm caller [eax] [edx] [ebx];
#pragma aux __FLDD = \
float "fld tbyte ptr [eax]"\
float "fld tbyte ptr [edx]"\
float "fdiv"\
float "fstp tbyte ptr [ebx]"\
parm caller [eax] [edx] [ebx];
#pragma aux __FLDC = \
/* ST(1) */\
float "fld tbyte ptr [edx]"\
/* ST(0) */\
float "fld tbyte ptr [eax]"\
/* compare ST(0) with ST(1) */\
float "fcompp"\
float "fstsw ax"\
"sahf"\
"sbb edx,edx"\
"shl edx,1"\
"shl ah,2"\
"cmc"\
"adc edx,0"\
/* edx will be -1,0,+1 if [eax] <, ==, > [edx] */\
parm caller [eax] [edx] value [edx];
#pragma aux __LDI4 = \
float "fld tbyte ptr [eax]"\
"push eax"\
"push eax"\
float "fstcw [esp]"\
float "fwait"\
"pop eax"\
"push eax"\
"or ah,0x0c"\
"push eax"\
float "fldcw [esp]"\
"pop eax"\
float "fistp dword ptr 4[esp]"\
float "fldcw [esp]"\
"pop eax"\
"pop eax"\
parm caller [eax] value [eax];
#pragma aux __I4LD = \
"push eax"\
float "fild dword ptr [esp]"\
"pop eax"\
float "fstp tbyte ptr [edx]"\
parm caller [eax] [edx];
#pragma aux __U4LD = \
"push 0"\
"push eax"\
float "fild qword ptr [esp]"\
"pop eax"\
"pop eax"\
float "fstp tbyte ptr [edx]"\
parm caller [eax] [edx];
#pragma aux __iFDLD = \
float "fld qword ptr [eax]"\
float "fstp tbyte ptr [edx]"\
parm caller [eax] [edx];
#pragma aux __iFSLD = \
float "fld dword ptr [eax]"\
float "fstp tbyte ptr [edx]"\
parm caller [eax] [edx];
#pragma aux __iLDFD = \
float "fld tbyte ptr [eax]"\
float "fstp qword ptr [edx]"\
parm caller [eax] [edx];
#pragma aux __iLDFS = \
float "fld tbyte ptr [eax]"\
float "fstp dword ptr [edx]"\
parm caller [eax] [edx];
#else // floating-point calls
#pragma aux __FLDA "*" parm caller [eax] [edx] [ebx];
#pragma aux __FLDS "*" parm caller [eax] [edx] [ebx];
#pragma aux __FLDM "*" parm caller [eax] [edx] [ebx];
#pragma aux __FLDD "*" parm caller [eax] [edx] [ebx];
#pragma aux __LDI4 "*" parm caller [eax] value [eax];
#pragma aux __I4LD "*" parm caller [eax] [edx];
#pragma aux __U4LD "*" parm caller [eax] [edx];
#pragma aux __iFDLD "*" parm caller [eax] [edx];
#pragma aux __iFSLD "*" parm caller [eax] [edx];
#pragma aux __iLDFD "*" parm caller [eax] [edx];
#pragma aux __iLDFS "*" parm caller [eax] [edx];
#pragma aux __FLDC "*" parm caller [eax] [edx] value [eax];
#endif
#elif defined(M_I86) // 16-bit pragmas
#pragma aux __ZBuf2LD "*" parm caller [ax] [dx];
#if defined(__FPI__)
extern unsigned __Get87CW(void);
extern void __Set87CW(unsigned short);
#pragma aux __Get87CW = \
"push ax"\
"push bp"\
"mov bp,sp"\
float "fstcw 2[bp]"\
float "fwait"\
"pop bp"\
"pop ax"\
value [ax];
#pragma aux __Set87CW = \
"push ax"\
"push bp"\
"mov bp,sp"\
float "fldcw 2[bp]"\
"pop bp"\
"pop ax"\
parm caller [ax];
#pragma aux __FLDA = \
"push bp"\
"mov bp,ax"\
float "fld tbyte ptr [bp]"\
"mov bp,dx"\
float "fld tbyte ptr [bp]"\
float "fadd"\
"mov bp,bx"\
float "fstp tbyte ptr [bp]"\
"pop bp"\
parm caller [ax] [dx] [bx];
#pragma aux __FLDS = \
"push bp"\
"mov bp,ax"\
float "fld tbyte ptr [bp]"\
"mov bp,dx"\
float "fld tbyte ptr [bp]"\
float "fsub"\
"mov bp,bx"\
float "fstp tbyte ptr [bp]"\
"pop bp"\
parm caller [ax] [dx] [bx];
#pragma aux __FLDM = \
"push bp"\
"mov bp,ax"\
float "fld tbyte ptr [bp]"\
"mov bp,dx"\
float "fld tbyte ptr [bp]"\
float "fmul"\
"mov bp,bx"\
float "fstp tbyte ptr [bp]"\
"pop bp"\
parm caller [ax] [dx] [bx];
#pragma aux __FLDD = \
"push bp"\
"mov bp,ax"\
float "fld tbyte ptr [bp]"\
"mov bp,dx"\
float "fld tbyte ptr [bp]"\
float "fdiv"\
"mov bp,bx"\
float "fstp tbyte ptr [bp]"\
"pop bp"\
parm caller [ax] [dx] [bx];
#pragma aux __FLDC = \
"push bp"\
"mov bp,dx"\
/* ST(1) */\
float "fld tbyte ptr [bp]"\
"mov bp,ax"\
/* ST(0) */\
float "fld tbyte ptr [bp]"\
/* compare ST(0) with ST(1) */\
float "fcompp"\
"push ax"\
"mov bp,sp"\
float "fstsw 0[bp]"\
float "fwait"\
"pop ax"\
"sahf"\
"sbb dx,dx"\
"shl dx,1"\
"shl ah,1"\
"shl ah,1"\
"cmc"\
"adc dx,0"\
"pop bp"\
parm caller [ax] [dx] value [dx];
#pragma aux __LDI4 = \
"push bp"\
"mov bp,ax"\
float "fld tbyte ptr [bp]"\
"push dx"\
"push ax"\
"push ax"\
"mov bp,sp"\
float "fstcw [bp]"\
float "fwait"\
"pop ax"\
"push ax"\
"or ah,0x0c"\
"mov 2[bp],ax"\
float "fldcw 2[bp]"\
float "fistp dword ptr 2[bp]"\
float "fldcw [bp]"\
"pop ax"\
"pop ax"\
"pop dx"\
"pop bp"\
parm caller [ax] value [dx ax];
#pragma aux __I4LD = \
"push bp"\
"push dx"\
"push ax"\
"mov bp,sp"\
float "fild dword ptr [bp]"\
"pop ax"\
"pop dx"\
"mov bp,bx"\
float "fstp tbyte ptr [bp]"\
"pop bp"\
parm caller [dx ax] [bx];
#pragma aux __U4LD = \
"push bp"\
"push ax"\
"push ax"\
"push dx"\
"push ax"\
"mov bp,sp"\
"sub ax,ax"\
"mov 4[bp],ax"\
"mov 6[bp],ax"\
float "fild qword ptr 2[bp]"\
"pop ax"\
"pop dx"\
"pop ax"\
"pop ax"\
"mov bp,bx"\
float "fstp tbyte ptr [bp]"\
"pop bp"\
parm caller [dx ax] [bx];
#pragma aux __iFDLD = \
"push bp"\
"mov bp,ax"\
float "fld qword ptr [bp]"\
"mov bp,dx"\
float "fstp tbyte ptr [bp]"\
"pop bp"\
parm caller [ax] [dx];
#pragma aux __iFSLD = \
"push bp"\
"mov bp,ax"\
float "fld dword ptr [bp]"\
"mov bp,dx"\
float "fstp tbyte ptr [bp]"\
"pop bp"\
parm caller [ax] [dx];
#pragma aux __iLDFD = \
"push bp"\
"mov bp,ax"\
float "fld tbyte ptr [bp]"\
"mov bp,dx"\
float "fstp qword ptr [bp]"\
"pop bp"\
parm caller [ax] [dx];
#pragma aux __iLDFS = \
"push bp"\
"mov bp,ax"\
float "fld tbyte ptr [bp]"\
"mov bp,dx"\
float "fstp dword ptr [bp]"\
"pop bp"\
parm caller [ax] [dx];
#else // floating-point calls
#pragma aux __FLDA "*" parm caller [ax] [dx] [bx];
#pragma aux __FLDS "*" parm caller [ax] [dx] [bx];
#pragma aux __FLDM "*" parm caller [ax] [dx] [bx];
#pragma aux __FLDD "*" parm caller [ax] [dx] [bx];
#pragma aux __LDI4 "*" parm caller [ax] value [dx ax];
#pragma aux __I4LD "*" parm caller [dx ax] [bx];
#pragma aux __U4LD "*" parm caller [dx ax] [bx];
#pragma aux __iFDLD "*" parm caller [ax] [dx];
#pragma aux __iFSLD "*" parm caller [ax] [dx];
#pragma aux __iLDFD "*" parm caller [ax] [dx];
#pragma aux __iLDFS "*" parm caller [ax] [dx];
#pragma aux __FLDC "*" parm caller [ax] [dx] value [ax];
#endif
#endif
#endif
#ifdef _LONG_DOUBLE_
// macros to allow old source code names to still work
#define __FDLD __iFDLD
#define __FSLD __iFSLD
#define __LDFD __iLDFD
#define __LDFS __iLDFS
#endif
// define number of significant digits for long double numbers (80-bit)
// it will be defined in float.h as soon as OW support long double
// used in mathlib/c/ldcvt.c
#ifdef _LONG_DOUBLE_
#if LDBL_DIG == 15
#undef LDBL_DIG
#define LDBL_DIG 19
#else
#error LDBL_DIG has changed from 15
#endif
#endif
// floating point conversion buffer length definition
// used by various floating point conversion routines
// used in clib/startup/c/cvtbuf.c and lib_misc/h/thread.h
// it must be equal maximum FP precision ( LDBL_DIG )
#define __FPCVT_BUFFERLEN 19
#ifdef __cplusplus
};
#endif
#endif

View File

@@ -0,0 +1,109 @@
;*****************************************************************************
;*
;* Open Watcom Project
;*
;* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
;*
;* ========================================================================
;*
;* This file contains Original Code and/or Modifications of Original
;* Code as defined in and that are subject to the Sybase Open Watcom
;* Public License version 1.0 (the 'License'). You may not use this file
;* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
;* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
;* provided with the Original Code and Modifications, and is also
;* available at www.sybase.com/developer/opensource.
;*
;* The Original Code and all software distributed under the License are
;* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
;* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
;* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
;* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
;* NON-INFRINGEMENT. Please see the License for the specific language
;* governing rights and limitations under the License.
;*
;* ========================================================================
;*
;* Description: WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
;* DESCRIBE IT HERE!
;*
;*****************************************************************************
include langenv.inc
PNEAR equ 0
PFAR equ 1
xinit macro rtn,priority
XI segment word public 'DATA'
if _MODEL and _BIG_CODE
db PFAR
db priority
dd rtn
else
if _MODEL and _USE_32_SEGS
db PNEAR
db priority
dd rtn
if COMP_CFG_COFF EQ 1
dw 0
endif
else
db PNEAR
db priority
dw rtn
dw 0
endif
endif
XI ends
endm
xfini macro rtn,priority
YI segment word public 'DATA'
if _MODEL and _BIG_CODE
db PFAR
db priority
dd rtn
else
if _MODEL and _USE_32_SEGS
db PNEAR
db priority
dd rtn
if COMP_CFG_COFF EQ 1
dw 0
endif
else
db PNEAR
db priority
dw rtn
dw 0
endif
endif
YI ends
endm
INIT_PRIORITY_THREAD equ 1 ; priority for thread data init
INIT_PRIORITY_FPU equ 2 ; priority for FPU/EMU init
INIT_PRIORITY_RUNTIME equ 10 ; priority for run-time initialization
INIT_PRIORITY_IOSTREAM equ 20 ; priority for IOSTREAM
INIT_PRIORITY_LIBRARY equ 32 ; default library-initialization priority
DEF_PRIORITY equ 32 ; ...
INIT_PRIORITY_PROGRAM equ 64 ; default program-initialization priority
DTOR_PRIORITY equ 40 ; priority for module DTOR
DGROUP group XIB,XI,XIE,YIB,YI,YIE
XIB segment word public 'DATA'
XIB ends
XI segment word public 'DATA'
XI ends
XIE segment word public 'DATA'
XIE ends
YIB segment word public 'DATA'
YIB ends
YI segment word public 'DATA'
YI ends
YIE segment word public 'DATA'
YIE ends