/programs/develop/open watcom/trunk/clib/crt/8087cw.c |
---|
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: Default 80x87 control word. |
* |
****************************************************************************/ |
#include <float.h> |
/* This is the default value loaded into the 80x87 control word. |
If you want higher precision, then change PC_53 to PC_64. The |
reason we have the default set to PC_53 is generate reproducible |
floating-point results regardless of the level of optimization |
chosen for the compiler. |
This value is loaded when the 80x87 is initialized by the startup |
code, and also when _fpreset is called. |
*/ |
#pragma aux __8087cw "*"; |
/* 0x1000 | 0x0000 | 0x0200 | 0x007F */ |
unsigned short __8087cw = IC_AFFINE | RC_NEAR | PC_53 | 0x007F; |
/programs/develop/open watcom/trunk/clib/crt/87state.h |
---|
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 |
/programs/develop/open watcom/trunk/clib/crt/_8087386.asm |
---|
0,0 → 1,52 |
;***************************************************************************** |
;* |
;* 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 mdef.inc |
modstart _8087 |
xref "C",__chk8087 |
datasegment |
public __8087 |
public __real87 |
extrn __no87 :word |
__8087 db 0 ; 0 => no 8087 and no EMU, otherwise 8087 or EMU present |
__real87 db 0 ; 0 => no real 8087 is used, otherwise real 8087 is used |
enddata |
include xinit.inc |
xinit __chk8087,INIT_PRIORITY_FPU + 3 |
endmod |
end |
/programs/develop/open watcom/trunk/clib/crt/_8087osi.c |
---|
0,0 → 1,35 |
/**************************************************************************** |
* |
* 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: 80x87 related globals for OSI. |
* |
****************************************************************************/ |
#include "variety.h" |
unsigned char _8087; |
unsigned char _real87; |
/programs/develop/open watcom/trunk/clib/crt/___argc.c |
---|
0,0 → 1,37 |
/**************************************************************************** |
* |
* 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: Argument vector and count. |
* |
****************************************************************************/ |
#include "variety.h" |
#include "widechar.h" |
#include "initarg.h" |
_WCRTLINKD int __F_NAME(___Argc,___wArgc); /* argument count */ |
_WCRTLINKD CHAR_TYPE** __F_NAME(___Argv,___wArgv); /* argument vector */ |
/programs/develop/open watcom/trunk/clib/crt/_exit.c |
---|
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: Implementation _Exit(). |
* |
****************************************************************************/ |
#include <stdlib.h> |
/* POSIX says _exit() and _Exit() "shall be functionally equivalent" */ |
_WCRTLINK void _Exit( int status ) |
/********************************/ |
{ |
_exit( status ); |
} |
/programs/develop/open watcom/trunk/clib/crt/abort.c |
---|
0,0 → 1,54 |
/**************************************************************************** |
* |
* 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: Platform independent abort() implementation. |
* |
****************************************************************************/ |
#include "variety.h" |
#include <stdio.h> |
#include <stdlib.h> |
#include "rtdata.h" |
#include "exitwmsg.h" |
#include <signal.h> |
#include <unistd.h> |
void (*_RWD_abort)( void ) = __terminate; |
_WCRTLINK void abort( void ) |
{ |
if( _RWD_abort != __terminate ) { |
(*_RWD_abort)(); |
} |
__terminate(); /* 23-may-90 */ |
} |
void __terminate( void ) |
{ |
__fatal_runtime_error( "ABNORMAL TERMINATION\r\n", EXIT_FAILURE ); |
} |
/programs/develop/open watcom/trunk/clib/crt/argcv.c |
---|
0,0 → 1,49 |
/**************************************************************************** |
* |
* 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: Argument vector definition and startup. |
* |
****************************************************************************/ |
#include "variety.h" |
#include "rtinit.h" |
#include "widechar.h" |
#include <stdlib.h> |
#include "initarg.h" |
int __F_NAME(_argc,_wargc); |
CHAR_TYPE** __F_NAME(_argv,_wargv); |
int __F_NAME(__argc,__wargc); |
CHAR_TYPE** __F_NAME(__argv,__wargv); |
#if defined(__386__) || defined(__AXP__) || defined(__PPC__) |
AXI( __F_NAME(__Init_Argv,__wInit_Argv), INIT_PRIORITY_RUNTIME ) |
AYI( __F_NAME(__Fini_Argv,__wFini_Argv), INIT_PRIORITY_LIBRARY ) |
#else |
AXI( __F_NAME(__Init_Argv,__wInit_Argv), 1 ) |
AYI( __F_NAME(__Fini_Argv,__wFini_Argv), 1 ) |
#endif |
/programs/develop/open watcom/trunk/clib/crt/binmode.c |
---|
0,0 → 1,43 |
/**************************************************************************** |
* |
* 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: Special object file to force binary mode when linked in. |
* |
****************************************************************************/ |
#include "variety.h" |
#include <fcntl.h> |
#include <stdlib.h> |
#include "rtdata.h" |
#include "rtinit.h" |
static void do_it( void ) |
{ |
_RWD_fmode = O_BINARY; |
} |
AXI( do_it, INIT_PRIORITY_LIBRARY ) |
/programs/develop/open watcom/trunk/clib/crt/chk.asm |
---|
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: WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE |
;* DESCRIBE IT HERE! |
;* |
;***************************************************************************** |
include mdef.inc |
include struct.inc |
xref __STK |
modstart chk |
xdefp __CHK |
xdefp __GRO |
defp __CHK |
xchg eax,4[esp] |
call __STK |
mov eax,4[esp] |
ret 4 |
endproc __CHK |
defp __GRO |
ret 4 |
endproc __GRO |
endmod |
end |
/programs/develop/open watcom/trunk/clib/crt/chk8087.c |
---|
0,0 → 1,344 |
/**************************************************************************** |
* |
* 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: __chk8087 and other FPU related functions. |
* |
****************************************************************************/ |
#include "variety.h" |
#include <stdlib.h> |
#include <float.h> |
#if defined( __OS2__ ) |
#endif |
#if defined( __WINDOWS__ ) |
#include <i86.h> |
#endif |
#include "rtdata.h" |
#include "exitwmsg.h" |
#include "87state.h" |
extern void __GrabFP87( void ); |
extern unsigned short __8087cw; |
#pragma aux __8087cw "*"; |
#if defined( __DOS_086__ ) |
extern unsigned char __dos87real; |
#pragma aux __dos87real "*"; |
extern unsigned short __dos87emucall; |
#pragma aux __dos87emucall "*"; |
#endif |
extern void __init_80x87( void ); |
#if defined( __DOS_086__ ) |
#pragma aux __init_80x87 "*" = \ |
".8087" \ |
"cmp __dos87real,0" \ |
"jz l1" \ |
"finit" \ |
"fldcw __8087cw" \ |
"l1: cmp __dos87emucall,0" \ |
"jz l2" \ |
"mov ax,1" \ |
"call __dos87emucall" \ |
"l2:" ; |
#else |
#pragma aux __init_80x87 "*" = \ |
".8087" \ |
"finit" \ |
"fldcw __8087cw" ; |
#endif |
/* 0 => no 8087; 2 => 8087,287; 3=>387 */ |
extern unsigned char _WCI86NEAR __x87id( void ); |
#pragma aux __x87id "*"; |
#if !defined( __UNIX__ ) && !defined( __OS2_386__ ) |
extern void __fsave( _87state * ); |
extern void __frstor( _87state * ); |
#if defined( __386__ ) |
#pragma aux __fsave = \ |
0x9b 0xdd 0x30 /* fsave [eax] ; save the 8087 state */ \ |
0x9b /* wait */ \ |
parm routine [eax]; |
#pragma aux __frstor = \ |
0xdd 0x20 /* frstor [eax] ; restore the 8087 */ \ |
0x9b /* wait ; wait */ \ |
parm routine [eax]; |
#else /* __286__ */ |
#if defined( __BIG_DATA__ ) |
#pragma aux __fsave = \ |
0x53 /* push bx */ \ |
0x1e /* push ds */ \ |
0x8e 0xda /* mov ds,dx */ \ |
0x8b 0xd8 /* mov bx,ax */ \ |
0x9b 0xdd 0x37 /* fsave [bx] */ \ |
0x90 0x9b /* fwait */ \ |
0x1f /* pop ds */ \ |
0x5b /* pop bx */ \ |
parm routine [dx ax]; |
#else |
#pragma aux __fsave = \ |
0x53 /* push bx */ \ |
0x8b 0xd8 /* mov bx,ax */ \ |
0x9b 0xdd 0x37 /* fsave [bx] */ \ |
0x90 0x9b /* fwait */ \ |
0x5b /* pop bx */ \ |
parm routine [ax]; |
#endif |
#if defined( __BIG_DATA__ ) |
#pragma aux __frstor = \ |
0x53 /* push bx */ \ |
0x1e /* push ds */ \ |
0x8e 0xda /* mov ds,dx */ \ |
0x8b 0xd8 /* mov bx,ax */ \ |
0x9b 0xdd 0x27 /* frstor [bx] */ \ |
0x90 0x9b /* fwait */ \ |
0x1f /* pop ds */ \ |
0x5b /* pop bx */ \ |
parm routine [dx ax]; |
#else |
#pragma aux __frstor = \ |
0x53 /* push bx */ \ |
0x8b 0xd8 /* mov bx,ax */ \ |
0x9b 0xdd 0x27 /* frstor [bx] */ \ |
0x90 0x9b /* fwait */ \ |
0x5b /* pop bx */ \ |
parm routine [ax]; |
#endif |
#endif |
static void __save_8087( _87state * __fs ) |
{ |
__fsave( __fs ); |
} |
static void __rest_8087( _87state * __fs ) |
{ |
__frstor( __fs ); |
} |
#endif /* !__UNIX__ && && !__OS2__ */ |
_WCRTLINK void _fpreset( void ) |
{ |
if( _RWD_8087 != 0 ) { |
__init_80x87(); |
} |
} |
void __init_8087( void ) |
{ |
#if !defined( __UNIX__ ) && !defined( __OS2_386__ ) |
if( _RWD_real87 != 0 ) |
{ /* if our emulator, don't worry */ |
_RWD_Save8087 = __save_8087; /* point to real save 8087 routine */ |
_RWD_Rest8087 = __rest_8087; /* point to real restore 8087 routine */ |
} |
#endif |
_fpreset(); |
} |
#if defined( __DOS__ ) || defined( __OS2_286__ ) |
void _WCI86FAR __default_sigfpe_handler( int fpe_sig ) |
{ |
__fatal_runtime_error( "Floating point exception\r\n", EXIT_FAILURE ); |
} |
#endif |
#if defined( __OS2__ ) |
void __chk8087( void ) |
/********************/ |
{ |
char devinfo; |
#if defined( __386__ ) |
DosDevConfig( &devinfo, DEVINFO_COPROCESSOR ); |
if( devinfo == 0 ) { |
_RWD_real87 = 0; |
} else { |
_RWD_real87 = __x87id(); |
} |
_RWD_8087 = _RWD_real87; |
#else |
if( _RWD_8087 == 0 ) { |
DosDevConfig( &devinfo, 3, 0 ); |
if( devinfo == 0 ) { |
_RWD_real87 = 0; |
} else { |
_RWD_real87 = __x87id(); |
} |
_RWD_8087 = _RWD_real87; |
} |
if( _RWD_real87 ) { |
__GrabFP87(); |
} |
if( _RWD_8087 ) { |
_RWD_FPE_handler = __default_sigfpe_handler; |
} |
#endif |
_fpreset(); |
} |
#elif defined( __QNX__ ) |
void __chk8087( void ) |
/********************/ |
{ |
extern char __87; |
extern char __r87; |
_RWD_real87 = __r87; |
_RWD_8087 = __87; |
_fpreset(); |
} |
#elif defined( __LINUX__ ) |
void __chk8087( void ) |
/********************/ |
{ |
// TODO: We really need to call Linux and determine if the machine |
// has a real FPU or not, so we can properly work with an FPU |
// emulator. |
_RWD_real87 = __x87id(); |
_RWD_8087 = _RWD_real87; |
_fpreset(); |
} |
#elif defined( __NETWARE__ ) |
extern short __87present( void ); |
#pragma aux __87present = \ |
"smsw ax ", \ |
"test ax, 4 ", \ |
"jne no_emu ", \ |
"xor ax, ax ", \ |
"no_emu: ", \ |
"mov ax, 1 " \ |
value [ ax ]; |
extern void __chk8087( void ) |
/*****************************/ |
{ |
if( _RWD_8087 == 0 ) { |
if( __87present() ) { |
_RWD_8087 = 3; /* 387 */ |
_RWD_real87 = 3; |
} |
__init_80x87(); |
} |
} |
#elif defined( __NT__ ) |
void __chk8087( void ) |
/********************/ |
{ |
_RWD_real87 = 3; //387+ ; //__x87id(); |
_RWD_8087 = _RWD_real87; |
__init_8087(); |
} |
#elif defined( __DOS__ ) |
void __chk8087( void ) |
/********************/ |
{ |
if( _RWD_8087 != 0 ) { /* if we already know we have an 80x87 */ |
#if !defined( __386__ ) |
if( __dos87real ) |
__GrabFP87(); |
#endif |
_RWD_FPE_handler = __default_sigfpe_handler; |
return; /* this prevents real87 from being set */ |
} /* when we have an emulator */ |
_RWD_real87 = __x87id(); /* if a coprocessor is present then we */ |
_RWD_8087 = _RWD_real87; /* initialize even when NO87 is defined */ |
#if !defined( __386__ ) |
__dos87real = _RWD_real87; |
#endif |
__init_8087(); /* this handles the fpi87 and NO87 case */ |
if( _RWD_no87 != 0 ) { /* if NO87 environment var is defined */ |
_RWD_8087 = 0; /* then we want to pretend that the */ |
_RWD_real87 = 0; /* coprocessor doesn't exist */ |
} |
if( _RWD_real87 ) { |
__GrabFP87(); |
} |
if( _RWD_8087 ) { |
_RWD_FPE_handler = __default_sigfpe_handler; |
} |
} |
#elif defined( __WINDOWS__ ) |
void __chk8087( void ) |
/********************/ |
{ |
if( _RWD_8087 != 0 ) /* if we already know we have an 80x87 */ |
return; /* this prevents real87 from being set */ |
/* when we have an emulator */ |
if( GetWinFlags() & WF_80x87 ) { /* if a coprocessor is present then we */ |
#if defined( __386__ ) |
extern void pascal _FloatingPoint( void ); |
_FloatingPoint(); |
#endif |
_RWD_real87 = __x87id(); /* initialize even when NO87 is defined */ |
_RWD_8087 = _RWD_real87; /* this handles the fpi87 and NO87 case */ |
__init_8087(); |
} else { |
#if defined( __386__ ) |
// check to see if emulator is loaded |
union REGS regs; |
regs.w.ax = 0xfa00; |
int86( 0x2f, ®s, ®s ); |
if( regs.w.ax == 0x0666 ) { /* check for emulator present */ |
_RWD_real87 = __x87id(); /* initialize even when NO87 is defined */ |
_RWD_8087 = _RWD_real87; /* this handles the fpi87 and NO87 case */ |
__init_8087(); |
} |
#endif |
} |
if( _RWD_no87 != 0 ) { /* if NO87 environment var is defined */ |
_RWD_8087 = 0; /* then we want to pretend that the */ |
_RWD_real87 = 0; /* coprocessor doesn't exist */ |
} |
} |
#endif |
/programs/develop/open watcom/trunk/clib/crt/cinit.c |
---|
0,0 → 1,65 |
/**************************************************************************** |
* |
* 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: Common clib initialization code. |
* |
****************************************************************************/ |
#include "variety.h" |
#include <stdio.h> |
#include <stdlib.h> |
#include <io.h> |
#if defined(__DOS_386__) && !defined(__OSI__) |
#elif defined(__OS2__) |
#elif defined(__WINDOWS_386__) || defined(__NT__) |
#endif |
#if defined(__OS2__) |
#endif |
#if defined(__DOS_386__) && !defined(__OSI__) |
#endif |
void __CommonInit( void ) |
/**************************/ |
{ |
#if !defined(__NETWARE__) && !defined(__NT__) |
_amblksiz = 32 * 1024; /* set minimum memory block allocation */ |
#endif |
#if defined(__DOS_386__) && !defined(__OSI__) |
/* |
* If we are running under DOS/4G then we need to page lock interrupt |
* handlers (since we could be running under VMM). |
*/ |
if (!_IsPharLap() && (__DPMI_hosted() == 1)) |
{ |
DPMILockLinearRegion((long)&__GETDSStart_, |
((long)&__GETDSEnd_ - (long)&__GETDSStart_)); |
} |
#endif |
} |
/programs/develop/open watcom/trunk/clib/crt/commode.c |
---|
0,0 → 1,56 |
/**************************************************************************** |
* |
* 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: set commit mode initialization function |
* |
****************************************************************************/ |
#include "variety.h" |
#include "rtdata.h" |
#include "rtinit.h" |
#include "commode.h" |
/* |
* __set_commode function is actually a _WCRTLINK function. It's prototyped |
* incorrectly so that this module will work correctly with both dynamic |
* and static versions of the C library. |
* |
* The pragma is there so that this module will work with both stack and |
* register calling conventions, eliminating the need to have a separate |
* object file for each. |
* |
* Similarly, __set_commode is declared _WCI86FAR so that the same object |
* file will work in any 16-bit memory model. |
*/ |
static void do_it( void ) |
{ |
__set_commode(); |
} |
AXI( do_it, INIT_PRIORITY_LIBRARY ) |
/programs/develop/open watcom/trunk/clib/crt/commode.h |
---|
0,0 → 1,34 |
/**************************************************************************** |
* |
* 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: declaration for set commit mode function |
* |
****************************************************************************/ |
/* see note in commode.c */ |
_WCRTLINK extern void _WCI86FAR __set_commode( void ); |
#pragma aux __set_commode "*_"; |
/programs/develop/open watcom/trunk/clib/crt/crwd386.asm |
---|
0,0 → 1,179 |
;***************************************************************************** |
;* |
;* 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 runtime read/write data (386 version). |
;* |
;***************************************************************************** |
name crwdata |
.387 |
.386p |
assume nothing |
DGROUP group _DATA |
_TEXT segment byte public 'CODE' |
assume cs:_TEXT |
__null_FPE_rtn proc near |
ret |
__null_FPE_rtn endp |
_TEXT ends |
_DATA segment dword public 'DATA' |
assume DS:DGROUP |
ifndef __NETWARE__ |
_dynend dd 0 ; top of dynamic data area |
_curbrk dd 0 ; top of usable memory |
endif |
ifndef __QNX__ |
ifndef __LINUX__ |
ifndef _NETWARE_LIBC |
_LpCmdLine dd 0 ; pointer to raw command line |
_LpPgmName dd 0 ; pointer to program name (for argv[0]) |
endif |
ifdef __NT__ |
_LpDllName dd 0 ; pointer to dll name (for OS/2,WIN32) |
_LpwCmdLine dd 0 ; pointer to widechar raw command line |
_LpwPgmName dd 0 ; pointer to widechar program name (for argv[0]) |
_LpwDllName dd 0 ; pointer to widechar dll name (for OS/2,WIN32) |
endif |
ifdef __OS2__ |
_LpDllName dd 0 ; pointer to dll name (for OS/2,WIN32) |
_LpwCmdLine dd 0 ; pointer to widechar raw command line |
_LpwPgmName dd 0 ; pointer to widechar program name (for argv[0]) |
_LpwDllName dd 0 ; pointer to widechar dll name (for OS/2,WIN32) |
endif |
ifdef __DOS__ |
_psp dw 0,0 ; segment addr of program segment prefix |
__x386_stacklow label dword |
endif |
endif |
endif |
_STACKLOW dd 0 ; lowest address in stack |
_STACKTOP dd 0 ; highest address in stack |
__EFG_printf dd 0 |
__EFG_scanf dd 0 |
__ASTACKSIZ dd 0 ; alternate stack size |
__ASTACKPTR dd 0 ; alternate stack pointer |
ifndef __NETWARE__ |
_cbyte dd 0 ; used by getch, getche |
_cbyte2 dd 0 ; used by getch, getche |
_child dd 0 ; non-zero => a spawned process is running |
endif |
__no87 dw 0 ; non-zero => "NO87" environment var present |
ifndef __NETWARE__ |
ifdef __DOS__ |
_Extender db 0 ; see clib\h\extender.inc for values |
_ExtenderSubtype db 0 ; non-zero -> variant of extender |
__X32VM db 0 ; non-zero => X-32VM DOS Extender |
endif |
_Envptr dd 0 ; offset part of environment pointer |
_Envseg dw 0 ; segment containing environment strings |
ifndef __QNX__ |
ifndef __LINUX__ |
_osmajor db 0 ; major DOS version number |
_osminor db 0 ; minor DOS version number |
ifdef __NT__ |
_osbuild dw 0 ; operating system build number |
_osver dd 0 ; operating system build number |
_winmajor dd 0 ; operating system major version number |
_winminor dd 0 ; operating system minor version number |
_winver dd 0 ; operating system version number |
endif |
endif |
endif |
endif |
__FPE_handler dd __null_FPE_rtn ; FPE handler |
ifndef __QNX__ |
ifndef __LINUX__ |
ifndef __NETWARE__ |
public "C",_osmajor |
public "C",_osminor |
ifdef __NT__ |
public "C",_osbuild |
public "C",_osver |
public "C",_winmajor |
public "C",_winminor |
public "C",_winver |
public "C",__EFG_printf |
public "C",__EFG_scanf |
endif |
endif |
ifdef __DOS__ |
public "C",_psp |
public "C",_Extender |
public "C",_ExtenderSubtype |
public __X32VM |
public __x386_stacklow |
endif |
ifndef _NETWARE_LIBC |
public "C",_LpCmdLine |
public "C",_LpPgmName |
endif |
ifdef __NT__ |
public "C",_LpDllName |
public "C",_LpwCmdLine |
public "C",_LpwPgmName |
public "C",_LpwDllName |
public "C",_LpCmdLine |
public "C",_LpPgmName |
endif |
ifdef __OS2__ |
public "C",_LpDllName |
public "C",_LpwCmdLine |
public "C",_LpwPgmName |
public "C",_LpwDllName |
endif |
endif |
endif |
ifndef __NETWARE__ |
public "C",_dynend |
public "C",_curbrk |
endif |
public "C",_STACKLOW |
public "C",_STACKTOP |
public __ASTACKSIZ |
public __ASTACKPTR |
ifndef __NETWARE__ |
public "C",_cbyte |
public "C",_cbyte2 |
public "C",_child |
public "C",_Envptr |
public "C",_Envseg |
endif |
public __no87 |
public "C",__FPE_handler |
_DATA ends |
end |
/programs/develop/open watcom/trunk/clib/crt/cstrklbi.asm |
---|
0,0 → 1,70 |
name cstrklbri |
.386p |
assume nothing |
extrn __KolibriMain : near |
extrn ___begtext : near |
extrn __STACKTOP : near |
extrn __STACKLOW : near |
extrn __FiniRtns : near |
extrn _LpCmdLine : near |
extrn _LpPgmName : near |
_TEXT segment use32 dword public 'CODE' |
public _cstart_ |
public mainCRTStartup |
public __exit_ |
assume cs:_TEXT |
_cstart_ proc near |
mainCRTStartup: |
mov edx, 0x400 |
mov eax, 0xff |
out dx, al |
mov eax, esp |
sub eax, 8192 |
mov dword ptr [__STACKTOP],esp ; set stack top |
mov dword ptr [__STACKLOW],eax |
mov eax, dword ptr [ds:0x001c] |
mov ebx, dword ptr [ds:0x0020] |
mov dword ptr [_LpCmdLine], eax |
mov dword ptr [_LpPgmName], ebx |
jmp __KolibriMain |
dd ___begtext ; reference module with segment definitions |
; |
; copyright message |
; |
db "Open Watcom C/C++32 Run-Time system. " |
db "Portions Copyright (c) Sybase, Inc. 1988-2002." |
_cstart_ endp |
__exit_ proc near |
mov eax,00h ; run finalizers |
mov edx,0fh ; less than exit |
call __FiniRtns ; call finalizer routines |
mov eax, -1 |
int 0x40 |
ret |
__exit_ endp |
public _scalbn |
_scalbn proc |
fild dword ptr [esp+12] |
fld qword ptr [esp+4] |
fscale |
fstp st[1] |
ret |
_scalbn endp |
_TEXT ends |
end _cstart_ ;programm entry point |
/programs/develop/open watcom/trunk/clib/crt/cstrtwnt.asm |
---|
0,0 → 1,77 |
;***************************************************************************** |
;* |
;* 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++ Windows NT 32-bit console startup code. |
;* |
;***************************************************************************** |
; This must be assembled using one of the following commands: |
; wasm cstrtwnt -bt=NT -ms -3r |
; wasm cstrtwnt -bt=NT -ms -3s |
; |
name cstrtwnt |
.386p |
assume nothing |
extrn __NTMain : near |
extrn ___begtext : near |
extrn __LpCmdLine : near |
extrn __LpPgmName : near |
extrn __STACKLOW : near |
extrn __STACKTOP : near |
_TEXT segment use32 word public 'CODE' |
public _cstart_ |
public mainCRTStartup |
assume cs:_TEXT |
_cstart_ proc near |
mainCRTStartup: |
mov dword ptr [__STACKTOP], esp |
lea eax, [esp-40000h] |
mov dword ptr[__STACKLOW], eax |
mov eax, dword ptr [ds:0x1c] |
mov dword ptr [__LpCmdLine], eax |
mov eax, dword ptr [ds:0x20] |
mov dword ptr [__LpPgmName], eax |
jmp __NTMain |
dd ___begtext ; reference module with segment definitions |
; |
; copyright message |
; |
db "Open Watcom C/C++32 Run-Time system. " |
db "Portions Copyright (c) Sybase, Inc. 1988-2002." |
_cstart_ endp |
_TEXT ends |
end _cstart_ |
/programs/develop/open watcom/trunk/clib/crt/cvtbuf.c |
---|
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: __CVTBuffer() implementation. |
* |
****************************************************************************/ |
#include "variety.h" |
#include "widechar.h" |
#include <stdlib.h> |
//#include "liballoc.h" |
#include "rtdata.h" |
#include "exitwmsg.h" |
#include "xfloat.h" |
#if defined(__SW_BM) |
#include "thread.h" |
#endif |
#if !defined(__SW_BM) |
static MAX_CHAR_TYPE cvt_buffer[ __FPCVT_BUFFERLEN + 1 ]; |
#endif |
_WCRTLINK CHAR_TYPE *__CVTBuffer( void ) |
{ |
return( (CHAR_TYPE *)_RWD_cvtbuf ); |
} |
/programs/develop/open watcom/trunk/clib/crt/errno.c |
---|
0,0 → 1,84 |
/**************************************************************************** |
* |
* 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: errno related functions. |
* |
****************************************************************************/ |
#include "variety.h" |
#include "rtdata.h" |
#if defined(__QNX__) |
#include <sys/magic.h> |
#include <errno.h> |
_WCRTLINK int *__get_errno_ptr( void ) |
{ |
#if defined(__386__) |
void *err_ptr; |
__getmagicvar( &err_ptr, _m_errno_ptr ); |
return( err_ptr ); |
#else |
return( (int *)&__MAGIC.Errno ); |
#endif |
} |
#elif defined(__LINUX__) |
#include "errorno.h" |
#if !defined( __SW_BM ) |
_WCRTLINKD int errno; |
#endif |
_WCRTLINK int *__get_errno_ptr( void ) |
{ |
return( &_RWD_errno ); |
} |
#else |
#include "errorno.h" |
#if !defined( __SW_BM ) |
_WCRTLINKD int errno; |
_WCRTLINKD int _doserrno; |
#endif |
_WCRTLINK int *__get_errno_ptr( void ) |
{ |
return( &_RWD_errno ); |
} |
_WCRTLINK int *__get_doserrno_ptr( void ) |
{ |
return( &_RWD_doserrno ); |
} |
#endif |
/programs/develop/open watcom/trunk/clib/crt/errnovar.c |
---|
0,0 → 1,39 |
/**************************************************************************** |
* |
* 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: Module to initialize errno access. |
* |
****************************************************************************/ |
#include "variety.h" |
#include "rtinit.h" |
extern void __initerrno( void ); |
_WCRTLINKD unsigned errno; |
AXI( __initerrno, INIT_PRIORITY_LIBRARY ) |
/programs/develop/open watcom/trunk/clib/crt/errorno.h |
---|
0,0 → 1,60 |
/**************************************************************************** |
* |
* 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! |
* |
****************************************************************************/ |
#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 |
/programs/develop/open watcom/trunk/clib/crt/exit.c |
---|
0,0 → 1,84 |
/**************************************************************************** |
* |
* 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: Implementation of exit() and associated functions. |
* |
****************************************************************************/ |
#include "variety.h" |
#include "rtdata.h" |
#include "exitwmsg.h" |
#include "initfini.h" |
#include "rtinit.h" |
#include <stdio.h> |
#include <stdlib.h> |
//#include "defwin.h" |
#include "widechar.h" |
#include "initarg.h" |
/* |
__int23_exit is used by OS/2 as a general termination routine which unhooks |
exception handlers. A better name for this variable is __sig_exit. |
__sig_exit should be the system dependent signal termination routine and |
should replace the calls to __int23_exit and __FPE_handler_exit. |
Each OS should define its own __sig_exit and do the appropriate thing (for |
example, DOS version would call __int23_exit and __FPE_handler_exit) |
*/ |
#if defined(__NT__) || defined(__WARP__) |
_WCRTLINK extern void (*__process_fini)( unsigned, unsigned ); |
#endif |
#if !defined(__UNIX__) && !defined(__WINDOWS_386__) |
static void _null_exit_rtn() {} |
void (*__FPE_handler_exit)() = _null_exit_rtn; |
#endif |
_WCRTLINK void exit( int status ) |
{ |
#if defined(__UNIX__) |
#elif defined(__WINDOWS_386__) |
#elif defined(__NT__) || defined(__WARP__) |
__FiniRtns( FINI_PRIORITY_EXIT, 255 ); |
#else |
__FiniRtns( FINI_PRIORITY_EXIT, 255 ); |
#endif |
_exit( status ); |
} |
#ifndef __NETWARE__ |
_WCRTLINK void _exit( int status ) |
{ |
__exit( status ); |
} |
#endif |
/programs/develop/open watcom/trunk/clib/crt/exitwmsg.h |
---|
0,0 → 1,85 |
/**************************************************************************** |
* |
* 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: Fatal runtime error handlers. |
* |
****************************************************************************/ |
#ifndef _EXITWMSG_H_INCLUDED |
#define _EXITWMSG_H_INCLUDED |
#include "variety.h" |
#ifdef __cplusplus |
extern "C" { |
#endif |
#undef _EWM_PARM1 |
#undef _EWM_PARM2 |
#if defined(__386__) |
#define _EWM_PARM1 eax |
#define _EWM_PARM2 edx |
#elif defined(M_I86) |
#define _EWM_PARM1 ax dx |
#define _EWM_PARM2 bx |
#else |
#define _EWM_PARM1 |
#define _EWM_PARM2 |
#endif |
// C interface |
// - tracks normal calling convention |
// - this is the funtion that is called from ASM and from C, C++ |
// - note there is no #pragma aborts so that debugger can trace out |
_WCRTLINK extern void __exit_with_msg( char _WCI86FAR *, unsigned ); |
_WCRTLINK extern void __fatal_runtime_error( char _WCI86FAR *, unsigned ); |
// ASM interface |
// - always uses register calling convention |
// - this function is only called from the C implementation |
// of __exit_with_msg |
extern void __do_exit_with_msg( char _WCI86FAR *, unsigned ); |
#ifdef _M_IX86 |
#pragma aux __do_exit_with_msg "*__" \ |
parm caller [_EWM_PARM1] [_EWM_PARM2]; |
#endif |
#undef _EWM_PARM1 |
#undef _EWM_PARM2 |
_WCRTLINKD extern char volatile __WD_Present; |
// WVIDEO interface |
// this function should be called before __exit_with_msg() |
// to allow Watcom Debugger (nee WVIDEO) to trap runtime errors. |
// this really needs to be far!!! |
_WCRTLINK extern int __EnterWVIDEO( char _WCFAR *string ); |
#ifdef __cplusplus |
}; |
#endif |
#endif |
/programs/develop/open watcom/trunk/clib/crt/exitwmsg.inc |
---|
0,0 → 1,53 |
;***************************************************************************** |
;* |
;* 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! |
;* |
;***************************************************************************** |
ifdef __WASM__ |
ifdef __386__ |
extrn "C",__fatal_runtime_error : near |
else |
ifdef __SMALL__ |
extrn "C",__fatal_runtime_error : near |
endif |
ifdef __COMPACT__ |
extrn "C",__fatal_runtime_error : near |
endif |
ifdef __MEDIUM__ |
extrn "C",__fatal_runtime_error : far |
endif |
ifdef __LARGE__ |
extrn "C",__fatal_runtime_error : far |
endif |
ifdef __HUGE__ |
extrn "C",__fatal_runtime_error : far |
endif |
endif |
endif |
/programs/develop/open watcom/trunk/clib/crt/farsupp.h |
---|
0,0 → 1,74 |
/**************************************************************************** |
* |
* 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: Far pointer support typedefs. |
* |
****************************************************************************/ |
#ifndef _FARSUPP_H_INCLUDED |
#define _FARSUPP_H_INCLUDED |
#include "variety.h" |
#include "widechar.h" |
#ifdef __LONG_LONG_SUPPORT__ |
#include "clibi64.h" |
#endif |
/* Only support near/far pointers on 16-bit targets, extended DOS |
* and Win386. Ideally we might want to test for non-flat memory model. |
*/ |
#if defined( _M_I86 ) || defined( __DOS__ ) || defined( __WINDOWS__ ) |
#define __FAR_SUPPORT__ |
typedef CHAR_TYPE _WCFAR *FAR_STRING; |
typedef char _WCFAR *FAR_ASCII_STRING; |
typedef wchar_t _WCFAR *FAR_UNI_STRING; |
typedef int _WCFAR *FAR_INT; |
typedef signed char _WCFAR *FAR_CHAR; |
typedef short _WCFAR *FAR_SHORT; |
typedef long _WCFAR *FAR_LONG; |
typedef float _WCFAR *FAR_FLOAT; |
typedef double _WCFAR *FAR_DOUBLE; |
#ifdef __LONG_LONG_SUPPORT__ |
typedef UINT64_TYPE _WCFAR *FAR_INT64; |
#endif |
#else |
#undef __FAR_SUPPORT__ |
typedef CHAR_TYPE *FAR_STRING; |
typedef char *FAR_ASCII_STRING; |
typedef wchar_t *FAR_UNI_STRING; |
typedef int *FAR_INT; |
typedef signed char *FAR_CHAR; |
typedef short *FAR_SHORT; |
typedef long *FAR_LONG; |
typedef float *FAR_FLOAT; |
typedef double *FAR_DOUBLE; |
#ifdef __LONG_LONG_SUPPORT__ |
typedef UINT64_TYPE *FAR_INT64; |
#endif |
#endif |
#endif |
/programs/develop/open watcom/trunk/clib/crt/fltused.c |
---|
0,0 → 1,47 |
/**************************************************************************** |
* |
* 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: Module to invoke floating-point support initialiation. |
* |
****************************************************************************/ |
#include "variety.h" |
#include "rtinit.h" |
#if defined(__AXP__) || defined(__386__) || defined(__PPC__) |
unsigned _fltused_ = 0; |
#else |
unsigned _fltused_ = 1; |
#endif |
#if defined(_M_IX86) |
#pragma aux _fltused_ "*"; |
#endif |
extern void __setEFGfmt( void ); |
AXI( __setEFGfmt, INIT_PRIORITY_LIBRARY ) |
/programs/develop/open watcom/trunk/clib/crt/fpexcept.c |
---|
0,0 → 1,52 |
/**************************************************************************** |
* |
* 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: Floating-point exception handler wrapper. |
* |
****************************************************************************/ |
#include "variety.h" |
#include "rtdata.h" |
/* |
__FPE_exception is called from machine language with parm in EAX/AX |
(see "fstatus" module in CGSUPP) |
*/ |
#if defined(__386__) |
#define parmreg eax |
#else |
#define parmreg ax |
#endif |
void __FPE_exception( int fpe_type ); |
#pragma aux __FPE_exception "*_" parm caller [parmreg]; |
void __FPE_exception( int fpe_type ) |
{ |
_RWD_FPE_handler( fpe_type ); |
} |
/programs/develop/open watcom/trunk/clib/crt/ftos.h |
---|
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: Prototypes for floating-point formatting routines. |
* |
****************************************************************************/ |
#ifndef _FTOS_H_INCLUDED |
#define _FTOS_H_INCLUDED |
#include "variety.h" |
#include "farsupp.h" |
_WCRTLINK extern FAR_STRING (*__EFG_printf)(); |
_WCRTLINK extern void (*__EFG_scanf)(); |
extern FAR_STRING _EFG_Format(); |
extern void __cnvs2d(); |
_WMRTLINK extern FAR_STRING (*__get_EFG_Format())(); |
_WMRTLINK extern void (*__get__cnvs2d())(); |
#endif |
/programs/develop/open watcom/trunk/clib/crt/initarg.h |
---|
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 |
/programs/develop/open watcom/trunk/clib/crt/initargv.c |
---|
0,0 → 1,222 |
/**************************************************************************** |
* |
* 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: Functions to set up argc and argv parameters of main(), etc. |
* |
****************************************************************************/ |
#define __NETWARE__ |
#ifdef __NETWARE__ |
void __Init_Argv( void ) { } |
void __Fini_Argv( void ) { } |
#else |
//#include "dll.h" // needs to be first |
#include "variety.h" |
#include "widechar.h" |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
#include <io.h> |
//#include "liballoc.h" |
#include "initarg.h" |
extern int __historical_splitparms; |
extern void _Not_Enough_Memory( void ); /* 25-jul-89 */ |
static unsigned _SplitParms(int, CHAR_TYPE *, CHAR_TYPE **, CHAR_TYPE ** ); |
_WCRTLINKD static CHAR_TYPE *__F_NAME(__CmdLine,__wCmdLine); /* cmdline buffer */ |
_WCRTLINK void *__F_NAME( _getargv, _wgetargv )( |
int historical, CHAR_TYPE *exe, CHAR_TYPE *cmd, |
int *pargc, CHAR_TYPE ***pargv ); |
void __F_NAME(__Init_Argv,__wInit_Argv)( void ) |
{ |
__F_NAME( __CmdLine, __wCmdLine ) = __F_NAME( _getargv, _wgetargv )( |
__historical_splitparms, |
__F_NAME( _LpPgmName, _LpwPgmName ), __F_NAME( _LpCmdLine, _LpwCmdLine ), |
&__F_NAME( _argc, _wargc ), &__F_NAME( _argv, _wargv ) ); |
__F_NAME( __argc, __wargc ) = __F_NAME( _argc, _wargc ); |
__F_NAME( ___Argc, ___wArgc ) = __F_NAME( _argc, _wargc ); |
__F_NAME( __argv, __wargv ) = __F_NAME( _argv, _wargv ); |
__F_NAME( ___Argv, ___wArgv ) = __F_NAME( _argv, _wargv ); |
} |
_WCRTLINK void *__F_NAME( _getargv, _wgetargv )( |
int historical, CHAR_TYPE *exe, CHAR_TYPE *cmd, |
int *pargc, CHAR_TYPE ***pargv ) |
{ |
unsigned argc; /* argument count */ |
CHAR_TYPE **argv; /* Actual arguments */ |
CHAR_TYPE *endptr; /* ptr to end of command line */ |
unsigned len; /* length of command line */ |
CHAR_TYPE *cmdline; /* copy of command line */ |
unsigned size; /* amount to allocate */ |
unsigned argv_offset; /* offset of argv in storage */ |
argc = _SplitParms( historical, cmd, NULL, &endptr ) + 1; |
len = (unsigned) ( endptr - cmd ) + 1; |
argv_offset = __ALIGN_SIZE(len * sizeof(CHAR_TYPE)); |
size = argv_offset + (argc+1) * sizeof(CHAR_TYPE *); |
// round up size for alignment of argv pointer |
size = __ALIGN_SIZE( size ); |
#if defined(__REAL_MODE__) && defined(__BIG_DATA__) |
#if defined(__OS2_286__) |
if( _osmode == DOS_MODE ) { |
cmdline = lib_nmalloc( size ); |
if( (void _WCI86NEAR *) cmdline == NULL ) { |
cmdline = lib_malloc( size ); |
} |
} else { |
cmdline = lib_malloc( size ); |
} |
#else |
cmdline = lib_nmalloc( size ); |
if( (void _WCI86NEAR *) cmdline == NULL ) { |
cmdline = lib_malloc( size ); |
} |
#endif |
#else |
cmdline = lib_malloc( size ); |
#endif |
argv = NULL; |
argc = 0; |
if( cmdline ) { |
memcpy( cmdline, cmd, len * sizeof(CHAR_TYPE) ); |
argv = (void *) ( ( ( char*) cmdline ) + argv_offset ); |
argv[0] = exe; |
argc = _SplitParms( historical, cmdline, argv + 1, &endptr ) + 1; |
argv[argc] = NULL; |
} |
*pargc = argc; |
*pargv = argv; |
return( cmdline ); |
} |
static unsigned _SplitParms( int historical, CHAR_TYPE *p, CHAR_TYPE **argv, CHAR_TYPE **endptr ) |
{ |
register unsigned argc; |
register CHAR_TYPE *start; |
register CHAR_TYPE *new; |
enum QUOTE_STATE { |
QUOTE_NONE, /* no " active in current parm */ |
QUOTE_DELIMITER, /* " was first char and must be last */ |
QUOTE_STARTED /* " was seen, look for a match */ |
}; |
register enum QUOTE_STATE state; |
argc = 0; |
for(;;) { |
while( *p == ' ' || *p == '\t' ) { |
++p; /* skip over blanks or tabs */ |
} |
if( *p == '\0' ) break; |
/* we are at the start of a parm */ |
state = QUOTE_NONE; |
if( *p == '\"' ) { |
p++; |
state = QUOTE_DELIMITER; |
} |
new = start = p; |
for(;;) { |
if( *p == '\"' ) { |
if( !historical ) { |
p++; |
if( state == QUOTE_NONE ) { |
state = QUOTE_STARTED; |
} else { |
state = QUOTE_NONE; |
} |
continue; |
} else { |
if( state == QUOTE_DELIMITER ) { |
break; |
} |
} |
} |
if( *p == ' ' || *p == '\t' ) { |
if( state == QUOTE_NONE ) { |
break; |
} |
} |
if( *p == '\0' ) break; |
if( *p == '\\' ) { |
if( !historical ) { |
if( p[1] == '\"' ) { |
++p; |
if( p[-2] == '\\' ) { |
continue; |
} |
} |
} else { |
if( p[1] == '\"' || p[1] == '\\' && state == QUOTE_DELIMITER ) { |
++p; |
} |
} |
} |
if( argv ) { |
*(new++) = *p; |
} |
++p; |
} |
if( argv ) { |
argv[ argc ] = start; |
++argc; |
/* |
The *new = '\0' is req'd in case there was a \" to " |
translation. It must be after the *p check against |
'\0' because new and p could point to the same char |
in which case the scan would be terminated too soon. |
*/ |
if( *p == '\0' ) { |
*new = '\0'; |
break; |
} |
*new = '\0'; |
++p; |
} else { |
++argc; |
if( *p == '\0' ) { |
break; |
} |
++p; |
} |
} |
*endptr = p; |
return( argc ); |
} |
void __F_NAME(__Fini_Argv,__wFini_Argv)( void ) |
{ |
if( __F_NAME(__CmdLine,__wCmdLine) != NULL ) { |
lib_free( __F_NAME(__CmdLine,__wCmdLine) ); |
} |
} |
#endif |
/programs/develop/open watcom/trunk/clib/crt/initfini.h |
---|
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 |
/programs/develop/open watcom/trunk/clib/crt/initrtns.c |
---|
0,0 → 1,293 |
/**************************************************************************** |
* |
* 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: Initialization and termination of clib. |
* |
****************************************************************************/ |
#include "variety.h" |
#include "initfini.h" |
#include "rtinit.h" |
#define PNEAR ((__type_rtp)0) |
#define PFAR ((__type_rtp)1) |
#define PDONE ((__type_rtp)2) |
#if ( COMP_CFG_COFF == 1 ) || defined(__AXP__) || defined(__PPC__) || defined(__MIPS__) |
// following is an attempt to drop the need for an assembler |
// segment definitions file |
// unfortunately, the use of XIB,XIE,YIB,YIE doesn't get the |
// right sort of segments by default |
#pragma data_seg( ".rtl$xib", "DATA" ); |
YIXI( TS_SEG_XIB, _Start_XI, 0, 0 ) |
#pragma data_seg( ".rtl$xie", "DATA" ); |
YIXI( TS_SEG_XIE, _End_XI, 0, 0 ) |
#pragma data_seg( ".rtl$yib", "DATA" ); |
YIXI( TS_SEG_YIB, _Start_YI, 0, 0 ) |
#pragma data_seg( ".rtl$yie", "DATA" ); |
YIXI( TS_SEG_YIE, _End_YI, 0, 0 ) |
#pragma data_seg( ".data", "DATA" ); |
#elif defined(_M_IX86) |
extern struct rt_init _Start_XI; |
extern struct rt_init _End_XI; |
extern struct rt_init _Start_YI; |
extern struct rt_init _End_YI; |
#else |
#error unsupported platform |
#endif |
typedef void (*pfn)(void); |
typedef void (_WCI86FAR * _WCI86FAR fpfn)(void); |
typedef void (_WCI86NEAR * _WCI86NEAR npfn)(void); |
#if defined(__AXP__) || defined(__PPC__) || defined(__MIPS__) |
#define __GETDS() |
#define save_ds() |
#define restore_ds() |
#define save_es() |
#define restore_es() |
#define setup_es() |
#elif defined(__WINDOWS_386__) |
#define __GETDS() |
#define save_ds() |
#define restore_ds() |
#define save_es() |
#define restore_es() |
#define setup_es() |
#elif defined(__386__) |
#define __GETDS() |
#define save_ds() |
#define restore_ds() |
#if defined(__FLAT__) |
#define save_es() |
#define restore_es() |
#define setup_es() |
#else |
extern void save_es( void ); |
#pragma aux save_es = modify exact [es]; |
extern void restore_es( void ); |
#pragma aux restore_es = modify exact [es]; |
extern void setup_es( void ); |
#pragma aux setup_es = \ |
"push ds" \ |
"pop es" \ |
modify exact [es]; |
#endif |
#elif defined(M_I86) |
extern void save_dx( void ); |
#pragma aux save_dx = modify exact [dx]; |
extern void _WCI86NEAR __GETDS( void ); |
#pragma aux __GETDS "__GETDS"; |
extern void save_ds( void ); |
#pragma aux save_ds = "push ds" modify exact [sp]; |
extern void restore_ds( void ); |
#pragma aux restore_ds = "pop ds" modify exact [sp]; |
#define save_es() |
#define restore_es() |
#else |
#error unsupported platform |
#endif |
#if defined(M_I86) |
static void callit_near( npfn *f ) { |
// don't call a null pointer |
if( *f ) { |
save_dx(); |
save_ds(); |
// call function |
(void)(**f)(); |
restore_ds(); |
} |
} |
static void callit_far( fpfn _WCI86NEAR *f ) { |
// don't call a null pointer |
if( *f ) { |
save_ds(); |
// call function |
(void)(**f)(); |
restore_ds(); |
} |
} |
#else |
static void callit( pfn *f ) { |
// don't call a null pointer |
if( *f ) { |
// QNX needs es==ds |
setup_es(); |
// call function |
(void)(**f)(); |
} |
} |
#endif |
/* |
; - takes priority limit parm in eax, code will run init routines whose |
; priority is < eax (really al [0-255]) |
; eax==255 -> run all init routines |
; eax==15 -> run init routines whose priority is <= 15 |
; |
*/ |
void __InitRtns( unsigned limit ) { |
__type_rtp local_limit; |
struct rt_init _WCI86NEAR *pnext; |
save_ds(); |
save_es(); |
__GETDS(); |
local_limit = (__type_rtp)limit; |
for(;;) { |
{ |
__type_rtp working_limit; |
struct rt_init _WCI86NEAR *pcur; |
pcur = (struct rt_init _WCI86NEAR*)&_Start_XI; |
#if defined(COMP_CFG_COFF) |
pcur++; |
#endif |
pnext = (struct rt_init _WCI86NEAR*)&_End_XI; |
working_limit = local_limit; |
// walk list of routines |
while( pcur < (struct rt_init _WCI86NEAR*)&_End_XI ) |
{ |
// if this one hasn't been called |
if( pcur->rtn_type != PDONE ) { |
// if the priority is better than best so far |
if( pcur->priority <= working_limit ) |
{ |
// remember this one |
pnext = pcur; |
working_limit = pcur->priority; |
} |
} |
// advance to next entry |
pcur++; |
} |
// check to see if all done, if we didn't find any |
// candidates then we can return |
if( pnext == (struct rt_init _WCI86NEAR*)&_End_XI ) { |
break; |
} |
} |
#if defined(M_I86) |
if( pnext->rtn_type == PNEAR ) { |
callit_near( (npfn *)&pnext->rtn ); |
} else { |
callit_far( (fpfn _WCI86NEAR *)&pnext->rtn ); |
} |
#else |
callit( &pnext->rtn ); |
#endif |
// mark entry as invoked |
pnext->rtn_type = PDONE; |
} |
restore_es(); |
restore_ds(); |
} |
/* |
; - takes priority range parms in eax, edx, code will run fini routines whose |
; priority is >= eax (really al [0-255]) and <= edx (really dl [0-255]) |
; eax==0, edx=255 -> run all fini routines |
; eax==16, edx=255 -> run fini routines in range 16..255 |
; eax==16, edx=40 -> run fini routines in range 16..40 |
*/ |
#if defined(M_I86) |
void _WCI86FAR __FFiniRtns( unsigned min_limit, unsigned max_limit ) { |
__FiniRtns( min_limit, max_limit ); |
} |
#endif |
void __FiniRtns( unsigned min_limit, unsigned max_limit ) |
{ |
__type_rtp local_min_limit; |
__type_rtp local_max_limit; |
struct rt_init _WCI86NEAR *pnext; |
save_ds(); |
save_es(); |
__GETDS(); |
local_min_limit = (__type_rtp)min_limit; |
local_max_limit = (__type_rtp)max_limit; |
for(;;) { |
{ |
__type_rtp working_limit; |
struct rt_init _WCI86NEAR *pcur; |
pcur = (struct rt_init _WCI86NEAR*)&_Start_YI; |
#if defined(COMP_CFG_COFF) |
pcur++; |
#endif |
pnext = (struct rt_init _WCI86NEAR*)&_End_YI; |
working_limit = local_min_limit; |
// walk list of routines |
while( pcur < (struct rt_init _WCI86NEAR*)&_End_YI ) |
{ |
// if this one hasn't been called |
if( pcur->rtn_type != PDONE ) { |
// if the priority is better than best so far |
if( pcur->priority >= working_limit ) |
{ |
// remember this one |
pnext = pcur; |
working_limit = pcur->priority; |
} |
} |
// advance to next entry |
pcur++; |
} |
// check to see if all done, if we didn't find any |
// candidates then we can return |
if( pnext == (struct rt_init _WCI86NEAR*)&_End_YI ) { |
break; |
} |
} |
if( pnext->priority <= local_max_limit ) { |
#if defined(M_I86) |
if( pnext->rtn_type == PNEAR ) { |
callit_near( (npfn *)&pnext->rtn ); |
} else { |
callit_far( (fpfn _WCI86NEAR *)&pnext->rtn ); |
} |
#else |
callit( &pnext->rtn ); |
#endif |
} |
// mark entry as invoked even if we don't call it |
// if we didn't call it, it is because we don't want to |
// call finirtns with priority > max_limit, in that case |
// marking the function as called, won't hurt anything |
pnext->rtn_type = PDONE; |
} |
restore_es(); |
restore_ds(); |
} |
/programs/develop/open watcom/trunk/clib/crt/kmain.c |
---|
0,0 → 1,33 |
#include "variety.h" |
#include "initfini.h" |
_WCRTLINKD extern char *LpCmdLine; /* pointer to command line */ |
_WCRTLINKD extern char *LpPgmName; /* pointer to program name */ |
_WCRTLINKD int ___Argc; /* argument count */ |
_WCRTLINKD char * ___Argv[2]; /* argument vector */ |
_WCRTLINK void exit( int status ); |
_WCRTLINK extern void (*__process_fini)( unsigned, unsigned ); |
extern int main( int, char ** ); |
#pragma aux __KolibriMain "*"; |
void __KolibriMain(void ) |
/***************************************/ |
{ ___Argc = 2; |
___Argv[0] = LpPgmName; |
___Argv[1] = LpCmdLine; |
// __process_fini = &__FiniRtns; |
__InitRtns( 255 ); |
// __CommonInit(); |
exit( main( ___Argc, ___Argv ) ); |
} |
/programs/develop/open watcom/trunk/clib/crt/langenv.h |
---|
0,0 → 1,113 |
/**************************************************************************** |
* |
* 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: Establish common stuff for a target environment for |
* language-related processors. |
* |
****************************************************************************/ |
#ifndef __LANGENV_H__ |
#define __LANGENV_H__ |
// This file uses __TGT_SYS to figure out the required target. |
// |
// langenvd.h contains the possible values. |
// |
// __TGT_SYS_X86 is the default |
// |
#include "langenvd.h" |
#ifndef __TGT_SYS |
#define __TGT_SYS __TGT_SYS_X86 |
#endif |
#if __TGT_SYS == __TGT_SYS_X86 |
#define TS_SEG_CODE "_TEXT" |
#define TS_SEG_CONST "CONST" |
#define TS_SEG_CONST2 "CONST2" |
#define TS_SEG_DATA "_DATA" |
#define TS_SEG_TIB "TIB" |
#define TS_SEG_TI "TI" |
#define TS_SEG_TIE "TIE" |
#define TS_SEG_XIB "XIB" |
#define TS_SEG_XI "XI" |
#define TS_SEG_XIE "XIE" |
#define TS_SEG_YIB "YIB" |
#define TS_SEG_YI "YI" |
#define TS_SEG_YIE "YIE" |
#define TS_SEG_YC "YC" |
#define TS_SEG_BSS "_BSS" |
#define TS_SEG_STACK "STACK" |
#define TS_SEG_DEPENDS "not used" |
#define TS_SEG_TLSB ".tls" |
#define TS_SEG_TLS ".tls$" |
#define TS_SEG_TLSE ".tls$ZZZ" |
#define TS_SEG_TLS_CLASS "TLS" |
#define TS_MAX_OBJNAME 256 |
#define TS_DATA_MANGLE "_*" |
#define TS_CODE_MANGLE "*_" |
#elif __TGT_SYS == __TGT_SYS_AXP_NT || __TGT_SYS == __TGT_SYS_PPC_NT || __TGT_SYS == __TGT_SYS_MIPS |
#define TS_SEG_CODE ".text" |
#define TS_SEG_CONST ".const" |
#define TS_SEG_CONST2 ".const2" |
#define TS_SEG_DATA ".data" |
#define TS_SEG_TIB ".rtl$tib" |
#define TS_SEG_TI ".rtl$tid" |
#define TS_SEG_TIE ".rtl$tie" |
#define TS_SEG_XIB ".rtl$xib" |
#define TS_SEG_XI ".rtl$xid" |
#define TS_SEG_XIE ".rtl$xie" |
#define TS_SEG_YIB ".rtl$yib" |
#define TS_SEG_YI ".rtl$yid" |
#define TS_SEG_YIE ".rtl$yie" |
#define TS_SEG_YC ".rtl$yc" |
#define TS_SEG_BSS ".bss" |
#define TS_SEG_STACK ".stack" |
#define TS_SEG_DEPENDS ".depend" |
#define TS_SEG_TLSB ".tls" |
#define TS_SEG_TLS ".tls$" |
#define TS_SEG_TLSE ".tls$ZZZ" |
#define TS_SEG_TLS_CLASS NULL |
#define TS_MAX_OBJNAME 1024 |
#define TS_DATA_MANGLE "*" |
#define TS_CODE_MANGLE "*" |
#else |
#error Invalid target system |
#endif |
#undef __TGT_SYS |
#endif |
/programs/develop/open watcom/trunk/clib/crt/langenv.inc |
---|
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 |
/programs/develop/open watcom/trunk/clib/crt/langenvd.h |
---|
0,0 → 1,40 |
/**************************************************************************** |
* |
* 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: Define values for language targets. |
* |
****************************************************************************/ |
#ifndef __LANGENVD_H__ |
#define __LANGENVD_H__ |
#define __TGT_SYS_X86 0 // All x86 systems to date |
#define __TGT_SYS_AXP_NT 1 // Win32 on DEC Alpha AXP |
#define __TGT_SYS_PPC_NT 2 // Win32 on IBM/Motorola PowerPC |
#define __TGT_SYS_MIPS 3 // MIPS RISC Architecture |
#endif |
/programs/develop/open watcom/trunk/clib/crt/main2wnt.c |
---|
0,0 → 1,105 |
/**************************************************************************** |
* |
* 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: Implementation of __NTMain(). |
* |
****************************************************************************/ |
#include "variety.h" |
#include "widechar.h" |
#include <stdio.h> |
#include <stdlib.h> |
#include <string.h> |
#include <malloc.h> |
#include <windows.h> |
//#include "ntex.h" |
//#include "sigtab.h" |
#include "initfini.h" |
#include "initarg.h" |
void _cdecl mf_init(); |
void _stdcall InitHeap(int heap_size); |
int __appcwdlen; |
char* __appcwd; |
_WCRTLINK void (*__process_fini)(unsigned,unsigned) = 0; |
extern void __CommonInit( void ); |
extern int wmain( int, wchar_t ** ); |
extern int main( int, char ** ); |
extern char *LpCmdLine; |
extern char *LpPgmName; |
void __F_NAME(__NTMain,__wNTMain)( void ) |
/***************************************/ |
{ |
InitHeap(32*1024*1024); |
//mf_init(); |
__process_fini = &__FiniRtns; |
__InitRtns( 255 ); |
__CommonInit(); |
__appcwdlen = strrchr(_LpPgmName, '/') - _LpPgmName + 1; |
__appcwdlen = __appcwdlen > 512 ? 512 : __appcwdlen; |
__appcwd= (char*)malloc(__appcwdlen); |
strncpy(__appcwd, _LpPgmName, __appcwdlen); |
__appcwd[__appcwdlen] = 0; |
___Argc = 2; |
___Argv[0] = _LpPgmName; |
___Argv[1] = _LpCmdLine; |
#ifdef __WIDECHAR__ |
exit( wmain( ___wArgc, ___wArgv ) ); |
#else |
exit( main( ___Argc, ___Argv ) ); |
#endif |
} |
#ifdef __WIDECHAR__ |
#if defined(_M_IX86) |
#pragma aux __wNTMain "*" |
#endif |
#else |
#if defined(_M_IX86) |
#pragma aux __NTMain "*" |
#endif |
#endif |
_WCRTLINK void __exit( unsigned ret_code ) |
{ |
__FiniRtns( 0, FINI_PRIORITY_EXIT-1 ); |
_asm |
{ |
mov eax, -1 |
int 0x40 |
} |
} |
/programs/develop/open watcom/trunk/clib/crt/mdef.inc |
---|
0,0 → 1,358 |
;***************************************************************************** |
;* |
;* 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: Memory model setup for interfacing with C code. |
;* |
;***************************************************************************** |
_SMALL_CODE = 00h |
_BIG_CODE = 01h |
_SMALL_DATA = 00h |
_BIG_DATA = 02h |
_HUGE_DATA = 04h |
_LONG_INTS = 08h |
_USE_32_SEGS = 10h |
_386 = 10h ; from old clib |
_DS_PEGGED = 20h ; from old clib (used for Windows) |
_TINY = 40h ; from old clib (formerly 10h) |
_FLAT = ( _SMALL_CODE or _SMALL_DATA or _USE_32_SEGS ) |
_SMALL = ( _SMALL_CODE or _SMALL_DATA ) |
_COMPACT = ( _SMALL_CODE or _BIG_DATA ) |
_MEDIUM = ( _BIG_CODE or _SMALL_DATA ) |
_LARGE = ( _BIG_CODE or _BIG_DATA ) |
_HUGE = ( _BIG_CODE or _HUGE_DATA ) |
_EMULATION = 00h |
_8087 = 01h |
ifdef __WASM__ |
ifdef __FLAT__ |
_MODEL = _FLAT |
endif |
ifdef __SMALL__ |
_MODEL = _SMALL |
endif |
ifdef __COMPACT__ |
_MODEL = _COMPACT |
endif |
ifdef __MEDIUM__ |
_MODEL = _MEDIUM |
endif |
ifdef __LARGE__ |
_MODEL = _LARGE |
endif |
ifdef __HUGE__ |
_MODEL = _HUGE |
endif |
ifdef __386__ |
_MODEL = ( _MODEL or _USE_32_SEGS ) |
endif |
ifdef __WINDOWS__ |
if _MODEL and (_BIG_DATA or _HUGE_DATA) |
_MODEL = ( _MODEL or _DS_PEGGED ) |
endif |
endif |
ifdef __FPC__ |
_MATH = _EMULATION |
endif |
ifdef __FPI__ |
_MATH = _8087 |
endif |
ifdef __FPI87__ |
_MATH = _8087 |
endif |
else |
include .\model.inc ; defines _MODEL, _MATH symbols |
endif |
if _MODEL and _BIG_CODE |
modstart macro modname,alignment |
ifdef NDEBUG |
name modname |
endif |
ifb <alignment> |
_TEXT segment word public 'CODE' |
else |
_TEXT segment alignment public 'CODE' |
endif |
assume cs:_TEXT |
endm |
calli macro regname |
call dword ptr [regname] |
endm |
codeptr macro p1,p2 |
ifb <p2> |
extrn p1 : dword |
else |
extrn "&p1",p2 : dword |
endif |
endm |
docall macro dest |
call far ptr dest |
endm |
dojmp macro dest |
jmp far ptr dest |
endm |
defp macro dsym,exp |
dsym proc far exp |
endm |
defpe macro dsym |
ifdef _EXPORT |
dsym proc far export |
else |
dsym proc far |
endif |
endm |
defn macro dsym |
dsym proc near |
endm |
endproc macro dsym |
dsym endp |
endm |
epilog macro |
if _MODEL and _USE_32_SEGS |
pop EBP |
dec EBP |
mov ESP,EBP |
else |
pop BP |
dec BP |
endif |
endm |
prolog macro |
if _MODEL and _USE_32_SEGS |
inc EBP |
push EBP |
mov EBP,ESP |
else |
inc BP |
push BP |
mov BP,SP |
endif |
endm |
xdefp macro p1,p2 |
ifb <p2> |
public p1 |
else |
public "&p1",p2 |
endif |
endm |
xref macro p1,p2 |
ifb <p2> |
extrn `p1` : far |
else |
extrn "&p1",`p2` : far |
endif |
endm |
lcall macro dest |
push cs |
call near ptr dest |
endm |
else |
modstart macro modname,alignment |
ifdef NDEBUG |
name modname |
endif |
if _MODEL and _USE_32_SEGS |
_TEXT segment use32 alignment public 'CODE' |
else |
_TEXT segment alignment public 'CODE' |
endif |
assume cs:_TEXT |
endm |
calli macro regname |
call regname |
endm |
codeptr macro p1,p2 |
if _MODEL and _USE_32_SEGS |
ifb <p2> |
extrn p1 : dword |
else |
extrn "&p1",p2 : dword |
endif |
else |
ifb <p2> |
extrn p1 : word |
else |
extrn "&p1",p2 : word |
endif |
endif |
endm |
defn macro dsym |
dsym proc near |
endm |
defp macro dsym,exp |
dsym proc near exp |
endm |
defpe macro dsym |
ifdef _EXPORT |
dsym proc near export |
else |
dsym proc near |
endif |
endm |
docall macro dest |
call dest |
endm |
dojmp macro dest |
jmp dest |
endm |
endproc macro dsym |
dsym endp |
endm |
epilog macro |
if _MODEL and _USE_32_SEGS |
pop EBP |
else |
pop BP |
endif |
endm |
prolog macro |
if _MODEL and _USE_32_SEGS |
push EBP |
mov EBP,ESP |
else |
push BP |
mov BP,SP |
endif |
endm |
xdefp macro p1,p2 |
ifb <p2> |
public p1 |
else |
public "&p1",p2 |
endif |
endm |
xref macro p1,p2 |
ifb <p2> |
extrn `p1` : near |
else |
extrn "&p1",`p2` : near |
endif |
endm |
lcall macro dest |
call dest |
endm |
endif |
endmod macro |
_TEXT ends |
endm |
dataseg macro |
DGROUP group _DATA |
assume ds:DGROUP,ss:DGROUP |
if _MODEL and _USE_32_SEGS |
_DATA segment use32 dword public 'DATA' |
else |
_DATA segment word public 'DATA' |
endif |
endm |
datasegment macro |
dataseg ; should be phased out |
endm |
enddata macro |
_DATA ends |
endm |
bss_segment macro |
if _MODEL and _USE_32_SEGS |
_BSS segment use32 dword public 'BSS' |
else |
_BSS segment word public 'BSS' |
endif |
DGROUP group _BSS |
assume ds:DGROUP |
endm |
endbss macro |
_BSS ends |
endm |
alias_function macro alias, function |
ifb <function> |
xref "C",_&alias |
else |
xref "C",function |
endif |
.code |
public "C",`alias` |
ifdef _EXPORT |
`alias` proc export |
else |
`alias` proc |
endif |
ifb <function> |
jmp _&alias |
else |
jmp `function` |
endif |
`alias` endp |
endm |
xred macro p1,p2,p3 |
ifb <p3> |
extrn p1 : p2 |
else |
extrn "&p1",p2 : p3 |
endif |
endm |
/programs/develop/open watcom/trunk/clib/crt/rtdata.h |
---|
0,0 → 1,211 |
/**************************************************************************** |
* |
* 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 CLIB structures and variables. |
* |
****************************************************************************/ |
#ifndef _RTDATA_H_INCLUDED |
#define _RTDATA_H_INCLUDED |
#include "variety.h" |
#include <stdio.h> |
#include "errorno.h" |
/* DOS based platforms have stdaux/stdprn in addition to stdin/out/err */ |
#if defined(__DOS__) || defined(__WINDOWS__) || defined(__OSI__) |
#define NUM_STD_STREAMS 5 |
#else |
#define NUM_STD_STREAMS 3 |
#endif |
#if defined(__NT__) || defined(__OS2__) |
struct __pipe_info { |
int isPipe; /* non-zero if it's a pipe */ |
int pid; /* PID of spawned process */ |
}; |
#endif |
typedef struct __stream_link { |
struct __stream_link * next; |
struct __iobuf * stream; |
unsigned char * _base; /* location of buffer */ |
int _orientation; /* wide/byte/not oriented */ |
int _extflags; /* extended flags */ |
unsigned char _tmpfchar; /* tmpfile number */ |
unsigned char _filler[sizeof(int)-1];/* explicit padding */ |
#if defined(__NT__) || defined(__OS2__) |
struct __pipe_info pipeInfo; /* pipe-related fields */ |
#endif |
} __stream_link; |
typedef void _WCI86FAR FPEhandler( int ); |
#define _FP_BASE(__fp) ((__fp)->_link->_base) |
#ifndef __NETWARE__ |
#define _FP_ORIENTATION(__fp) ((__fp)->_link->_orientation) |
#define _FP_EXTFLAGS(__fp) ((__fp)->_link->_extflags) |
#endif |
#define _FP_TMPFCHAR(__fp) ((__fp)->_link->_tmpfchar) |
#ifndef __NETWARE__ |
#define _FP_PIPEDATA(__fp) ((__fp)->_link->pipeInfo) |
#endif |
extern __stream_link *__OpenStreams; |
extern __stream_link *__ClosedStreams; |
extern char * _WCNEAR __env_mask; /* ptr to char array of flags */ |
extern FPEhandler *__FPE_handler; |
extern void (*__FPE_handler_exit)( void ); |
#if !defined(__NETWARE__) |
extern int _cbyte; |
extern int _cbyte2; |
extern int _child; |
extern int __umaskval; |
extern unsigned _curbrk; |
extern int _commode; |
#endif |
#if !defined (_NETWARE_LIBC) |
extern unsigned _STACKTOP; |
#endif |
#if !defined(__QNX__) && !defined(__LINUX__) |
extern void (*__Save8087)();/* Ptr to FP state save rtn (spawn) */ |
extern void (*__Rest8087)();/* Ptr to FP state restore rtn (spawn) */ |
#endif |
extern unsigned short _8087cw; /* control word initializer */ |
extern unsigned char _no87; /* NO87 environment var defined */ |
extern unsigned char _8087; /* type of 8087/emulator present */ |
extern unsigned char _real87; /* 8087 coprocessor hardware present */ |
#if defined(_M_IX86) |
#pragma aux _8087cw "_*"; |
#pragma aux _no87 "_*"; |
#pragma aux _8087 "_*"; |
#pragma aux _real87 "_*"; |
#endif |
#if !defined(__SW_BM) |
extern unsigned _STACKLOW; |
#endif |
#define _RWD_ostream __OpenStreams |
#define _RWD_cstream __ClosedStreams |
#define _RWD_iob __iob |
#if !defined(__NETWARE__) |
#define _RWD_threadid _threadid |
#endif |
#define _RWD_environ environ |
#define _RWD_wenviron _wenviron |
#define _RWD_env_mask __env_mask |
#define _RWD_abort __abort |
#define _RWD_sigtab __SIGNALTABLE |
#define _RWD_FPE_handler_exit __FPE_handler_exit |
#define _RWD_FPE_handler __FPE_handler |
#define _RWD_fmode _fmode |
#if !defined(__NETWARE__) |
#define _RWD_umaskval __umaskval |
#define _RWD_cbyte _cbyte |
#define _RWD_cbyte2 _cbyte2 |
#define _RWD_child _child |
#define _RWD_amblksiz _amblksiz |
#define _RWD_curbrk _curbrk |
#define _RWD_dynend _dynend |
#define _RWD_psp _psp |
#endif |
#if !defined (_NETWARE_LIBC) |
#define _RWD_stacktop _STACKTOP |
#endif |
#if !defined(__QNX__) && !defined(__LINUX__) |
#define _RWD_Save8087 __Save8087 |
#define _RWD_Rest8087 __Rest8087 |
#endif |
#define _RWD_8087cw _8087cw |
#define _RWD_no87 _no87 |
#define _RWD_8087 _8087 |
#define _RWD_real87 _real87 |
#if !defined(__NETWARE__) |
#define _RWD_HShift _HShift |
#define _RWD_osmajor _osmajor |
#define _RWD_osminor _osminor |
#define _RWD_osmode _osmode |
#if defined(__NT__) |
#define _RWD_osbuild _osbuild |
#define _RWD_osver _osver |
#define _RWD_winmajor _winmajor |
#define _RWD_winminor _winminor |
#define _RWD_winver _winver |
#endif |
#define _RWD_doserrno _DOSERRNO |
#endif |
#define _RWD_tmpfnext __tmpfnext |
#if !defined(_RWD_errno) |
#define _RWD_errno _ERRNO |
#endif |
#define _RWD_nexttok _NEXTTOK |
#define _RWD_nextftok _NEXTFTOK |
#define _RWD_nextmbtok _NEXTMBTOK |
#define _RWD_nextmbftok _NEXTMBFTOK |
#define _RWD_nextwtok _NEXTWTOK |
#define _RWD_tzname tzname |
#define _RWD_timezone timezone |
#define _RWD_daylight daylight |
#define _RWD_dst_adjust __dst_adjust |
#define _RWD_start_dst __start_dst |
#define _RWD_end_dst __end_dst |
#define _RWD_asctime _RESULT |
#ifdef __SW_BM |
#define _RWD_cvtbuf __THREADDATAPTR->__cvt_buffer |
#else |
#define _RWD_cvtbuf cvt_buffer |
#endif |
#if defined(__NETWARE__) |
#define _RWD_ioexit __ioexit |
#define _RWD_tmpnambuf (__THREADDATAPTR->__tmpnambuf) |
#define _RWD_randnextinit (__THREADDATAPTR->__randnextinit) |
#else |
#define _RWD_tmpnambuf _tmpname |
#define _RWD_randnextinit THREAD_PTR.__randnextinit |
#endif |
#define _RWD_stacklow _STACKLOW |
#define _RWD_randnext _RANDNEXT |
#define _RWD_ThreadData _ThreadData |
#define _RWD_StaticInitSema _StaticInitSema |
#define _RWD_PureErrorFlag _PureErrorFlag |
#define _RWD_UndefVfunFlag _UndefVfunFlag |
#define _RWD_ModuleInit _ModuleInit |
/* |
For the sake of efficiency, tell the compiler |
that the __exit... routines never return. |
*/ |
_WCRTLINK extern void __exit( unsigned ); |
#if defined(_M_IX86) |
#pragma aux __exit aborts; |
#endif |
extern void (*__abort)( void ); // Defined in abort.c |
extern void __terminate( void ); // Defined in abort.c |
#endif // _RTDATA_H_INCLUDED |
/programs/develop/open watcom/trunk/clib/crt/rtinit.h |
---|
0,0 → 1,131 |
/**************************************************************************** |
* |
* 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: Structures for run-time initialization/finalization. |
* |
****************************************************************************/ |
#ifndef __RTINIT_H__ |
#define __RTINIT_H__ |
#include "langenvd.h" |
#if defined( __PPC__ ) |
#define __TGT_SYS __TGT_SYS_AXP_PPC |
typedef unsigned __type_rtp; |
typedef unsigned __type_pad; |
typedef void( *__type_rtn ) ( void ); |
#elif defined( __AXP__ ) |
#define __TGT_SYS __TGT_SYS_AXP_NT |
typedef unsigned __type_rtp; |
typedef unsigned __type_pad; |
typedef void( *__type_rtn ) ( void ); |
#elif defined( __MIPS__ ) |
#define __TGT_SYS __TGT_SYS_MIPS |
typedef unsigned __type_rtp; |
typedef unsigned __type_pad; |
typedef void( *__type_rtn ) ( void ); |
#else |
#define __TGT_SYS __TGT_SYS_X86 |
typedef unsigned char __type_rtp; |
typedef unsigned short __type_pad; |
#if defined( __386__ ) |
typedef void __near( *__type_rtn ) ( void ); |
#else |
typedef void( *__type_rtn ) ( void ); |
#endif |
#endif |
#include "langenv.h" |
#if defined( __MEDIUM__ ) || defined( __LARGE__ ) || defined( __HUGE__ ) |
#define __LARGE_CODE__ |
#endif |
// initialization progresses from highest priority to lowest |
// finalization progresses from lowest to highest |
#pragma pack( 1 ) |
struct rt_init // structure placed in XI/YI segment |
{ |
__type_rtp rtn_type; // - near=0/far=1 routine indication |
// also used when walking table to flag |
// completed entries |
__type_rtp priority; // - priority (0-highest 255-lowest) |
__type_rtn rtn; // - routine |
#if !( defined( __LARGE_CODE__ ) || defined( __386__ ) ) || defined( COMP_CFG_COFF ) |
__type_pad padding; // - padding, when small code ptr |
// or when risc cpu |
#endif |
}; |
#pragma pack() |
#if defined( M_I86 ) |
#if defined( __LARGE_CODE__ ) /* segmented large code models */ |
#define YIXI( seg, label, routine, priority ) \ |
struct rt_init __based( __segname( seg ) ) label = \ |
{ 1, priority, routine }; |
#else /* other segmented models */ |
#define YIXI( seg, label, routine, priority ) \ |
struct rt_init __based( __segname( seg ) ) label = \ |
{ 0, priority, routine, 0 }; |
#endif |
#else /* non-segmented architectures */ |
#define YIXI( seg, label, routine, priority ) \ |
struct rt_init __based( __segname( seg ) ) label = \ |
{ 0, priority, routine }; |
#endif |
/* |
Use these when you want a global label for the XI/YI structure |
*/ |
#define XI( label, routine, priority ) YIXI( TS_SEG_XI, label, routine, priority ) |
#define YI( label, routine, priority ) YIXI( TS_SEG_YI, label, routine, priority ) |
/* |
Use these when you don't care about the label on the XI/YI structure |
*/ |
#define __ANON( x ) __anon ## x |
#define ANON( x ) __ANON( x ) |
#define AXI( routine, priority ) static XI( ANON( __LINE__ ), routine, priority ) |
#define AYI( routine, priority ) static YI( ANON( __LINE__ ), routine, priority ) |
enum { |
INIT_PRIORITY_THREAD = 1, // priority for thread data init |
INIT_PRIORITY_FPU = 2, // priority for FPU/EMU init |
INIT_PRIORITY_RUNTIME = 10, // priority for run/time initialization |
INIT_PRIORITY_IOSTREAM = 20, // priority for IOSTREAM |
INIT_PRIORITY_LIBRARY = 32, // default library-initialization priority |
INIT_PRIORITY_PROGRAM = 64, // default program-initialization priority |
FINI_PRIORITY_DTOR = 40, // priority for module DTOR |
DTOR_PRIORITY = 40, // priority for module DTOR |
FINI_PRIORITY_EXIT = 16 // when exit() is called, functions between |
// 255 and this are called, the rest of the |
// fini routines are called from __exit(). |
}; |
/* have to turn off, or we get unref'd warnings for AXI & AYI stuff */ |
#pragma off( unreferenced ) |
#endif |
/programs/develop/open watcom/trunk/clib/crt/save8087.c |
---|
0,0 → 1,40 |
/**************************************************************************** |
* |
* 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 "variety.h" |
#include "87state.h" |
#include "rtdata.h" |
static void _do_nothing( _87state *st ) {} |
void (*_RWD_Save8087)(_87state *) = _do_nothing; |
void (*_RWD_Rest8087)(_87state *) = _do_nothing; |
/programs/develop/open watcom/trunk/clib/crt/segdefns.asm |
---|
0,0 → 1,140 |
;***************************************************************************** |
;* |
;* 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! |
;* |
;***************************************************************************** |
; |
; segment definitions for WATCOM C/C++32 |
; |
include langenv.inc |
name segdefns |
.386p |
assume nothing |
if COMP_CFG_COFF |
DGROUP group _NULL,_AFTERNULL,CONST,_DATA,DATA,_BSS,STACK |
else |
ifdef __LINUX__ |
DGROUP group _NULL,_AFTERNULL,CONST,_DATA,DATA,TIB,TI,TIE,XIB,XI,XIE,YIB,YI,YIE,_BSS |
else |
DGROUP group _NULL,_AFTERNULL,CONST,_DATA,DATA,_BSS,STACK,TIB,TI,TIE,XIB,XI,XIE,YIB,YI,YIE |
endif |
endif |
; this guarantees that no function pointer will equal NULL |
; (WLINK will keep segment 'BEGTEXT' in front) |
; This segment must be at least 4 bytes in size to avoid confusing the |
; signal function. |
BEGTEXT segment use32 word public 'CODE' |
assume cs:BEGTEXT |
forever label near |
int 3h |
jmp short forever |
; NOTE that __begtext needs to be at offset 3 |
; don't move it. i.e. don't change any code before here. |
___begtext label byte |
nop |
nop |
nop |
nop |
public ___begtext |
assume cs:nothing |
BEGTEXT ends |
assume ds:DGROUP |
_NULL segment para public 'BEGDATA' |
__nullarea label word |
db 01h,01h,01h,00h |
public __nullarea |
_NULL ends |
_AFTERNULL segment word public 'BEGDATA' |
_AFTERNULL ends |
CONST segment word public 'DATA' |
CONST ends |
if COMP_CFG_COFF eq 0 |
TIB segment byte public 'DATA' |
TIB ends |
TI segment byte public 'DATA' |
TI ends |
TIE segment byte public 'DATA' |
TIE ends |
XIB segment word public 'DATA' |
_Start_XI label byte |
public "C",_Start_XI |
XIB ends |
XI segment word public 'DATA' |
XI ends |
XIE segment word public 'DATA' |
_End_XI label byte |
public "C",_End_XI |
XIE ends |
YIB segment word public 'DATA' |
_Start_YI label byte |
public "C",_Start_YI |
YIB ends |
YI segment word public 'DATA' |
YI ends |
YIE segment word public 'DATA' |
_End_YI label byte |
public "C",_End_YI |
YIE ends |
endif |
_DATA segment word public 'DATA' |
_DATA ends |
DATA segment word public 'DATA' |
DATA ends |
_BSS segment word public 'BSS' |
_BSS ends |
ifndef __LINUX__ |
STACK_SIZE equ 4096h |
STACK segment para stack 'STACK' |
db (STACK_SIZE) dup(?) |
STACK ends |
endif |
_TEXT segment use32 word public 'CODE' |
_TEXT ends |
end |
/programs/develop/open watcom/trunk/clib/crt/setefg.c |
---|
0,0 → 1,48 |
/**************************************************************************** |
* |
* 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: Routine to bring in real floating-point formatting code. |
* |
****************************************************************************/ |
#include "variety.h" |
#include <stdio.h> |
#include "ftos.h" |
#include "farsupp.h" |
/* This routine will be called by cstart if "_fltused" is referenced. */ |
void __setEFGfmt( void ) |
{ |
#ifdef __SW_BR |
__EFG_printf = __get_EFG_Format(); |
__EFG_scanf = __get__cnvs2d(); /* 27-mar-90 */ |
#else |
__EFG_printf = _EFG_Format; |
__EFG_scanf = __cnvs2d; /* 27-mar-90 */ |
#endif |
} |
/programs/develop/open watcom/trunk/clib/crt/stacklow.h |
---|
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 |
/programs/develop/open watcom/trunk/clib/crt/stackwnt.c |
---|
0,0 → 1,68 |
/**************************************************************************** |
* |
* 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: Dummy stack check routines for non-x86 Win32 platforms. |
* |
****************************************************************************/ |
#include "variety.h" |
#include "rtdata.h" |
#include "stacklow.h" |
#include "exitwmsg.h" |
#if defined(__AXP__) || defined(__PPC__) |
void _init_stk( void ) |
{ |
} |
_WCRTLINK unsigned __CHK( unsigned i ) |
{ |
return( i ); |
} |
_WCRTLINK void __GRO( unsigned i ) |
{ |
i = i; |
} |
_WCRTLINK void __STKOVERFLOW( void ) |
{ |
__fatal_runtime_error( "stack overflow", -1 ); |
} |
#endif |
_WCRTLINK unsigned stackavail() |
{ |
#if defined(__AXP__) || defined(__PPC__) |
unsigned _SP; |
_SP = (unsigned)&_SP; |
return( _SP - _RWD_stacklow ); |
#else |
return( _SP() - _RWD_stacklow ); |
#endif |
} |
/programs/develop/open watcom/trunk/clib/crt/stkwnt.asm |
---|
0,0 → 1,120 |
;***************************************************************************** |
;* |
;* 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 mdef.inc |
include struct.inc |
include xinit.inc |
include exitwmsg.inc |
modstart stk |
datasegment |
extrn "C",_STACKLOW : dword |
msg db "Stack Overflow!", 0dh, 0ah, 0 |
enddata |
xinit _init_stk,DEF_PRIORITY |
assume ds:DGROUP |
defp _init_stk |
ret ; return |
endproc _init_stk |
xdefp __CHK |
defpe __CHK ; new style stack check |
xchg eax,4[esp] ; get parm in eax |
call __STK ; call stack checker |
mov eax,4[esp] ; restore eax |
ret 4 |
endproc __CHK |
xdefp __STK |
defpe __STK |
push eax ; save parm for __GRO routine |
_guess ; guess: no overflow |
cmp eax,esp ; - quit if user asking for too much |
_quif ae ; - ... |
sub eax,esp ; - calculate new low point |
neg eax ; - calc what new SP would be |
cmp eax,_STACKLOW ; - quit if too much |
_quif be ; - ... |
call __GRO ; - return |
ret |
_endguess ; endguess |
__STKOVERFLOW: |
xdefp "C",__STKOVERFLOW |
pop eax ; pop the stack |
ifdef __STACK__ |
push 1 ; ... |
push offset msg ; print the error message |
else |
mov eax,offset msg ; print the error message |
mov edx,1 ; ... |
endif |
call __fatal_runtime_error ; ... |
endproc __STK |
xdefp __GRO |
defpe __GRO ; dummy function to resolve symbol |
push eax ; save regs |
push ebx ; ... |
mov eax,12[esp] ; get size to grow by |
mov ebx,-4 ; initialiaze index |
lup: ; do { |
mov [esp+ebx],ebx ; - touch that stack page |
sub ebx,1000H ; - decrement by 4k |
sub eax,1000H ; - decrement by 4k |
jg lup ; } while stack left to go |
pop ebx ; restore regs |
pop eax ; ... |
ret 4 ; return to caller |
endproc __GRO |
xdefp __alloca_probe |
; on entry eax is size of stack to grow |
; on exit esp has been advanced to new size |
defpe __alloca_probe ; ms compatible function |
push eax ; size parm to __GRO |
call __GRO |
push eax ; save size |
lea eax,8[esp] ; get esp value to adjust |
sub eax,[esp] ; carve off piece of stack |
xchg eax,esp ; set new esp |
mov eax,4[eax] ; snag return address |
jmp eax ; return to caller |
endproc __alloca_probe |
endmod |
end |
/programs/develop/open watcom/trunk/clib/crt/struct.inc |
---|
0,0 → 1,220 |
;***************************************************************************** |
;* |
;* 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: Structured macros for MASM/WASM. |
;* |
;***************************************************************************** |
__label = 0 |
__depth = 0 |
__inner_loop = 0 |
_guess macro name |
__depth = __depth + 1 |
__label = __label + 1 |
_set __astk,%__depth,__label,<> |
__label = __label + 1 |
_set __estk,%__depth,__label,<> |
ifnb <name> |
name = __label |
endif |
endm |
_quif macro cc,name |
ifnb <name> |
_set __elbl,,name,<> |
_j cc,_l,%__elbl |
else |
_set __albl,,__astk,%__depth |
_j cc,_l,%__albl |
endif |
endm |
_quit macro name |
_quif ,name |
endm |
_admit macro |
_set __albl,,__astk,%__depth |
__label = __label + 1 |
_set __astk,%__depth,__label,<> |
_set __elbl,,__estk,%__depth |
_j ,_l,%__elbl |
_label _l,%__albl |
endm |
_endguess macro |
_set __albl,,__astk,%__depth |
_label _l,%__albl |
_set __elbl,,__estk,%__depth |
_label _l,%__elbl |
__depth = __depth - 1 |
endm |
_loop macro name |
_guess name |
_set __albl,,__astk,%__depth |
_label _m,%__albl |
_set __elbl,,__estk,%__depth |
_label _m,%__elbl |
_set __llbl,%__depth,%__inner_loop,<> |
_set __inner_loop,,%__depth,<> |
endm |
_loopif macro cc,name |
ifnb <name> |
_set __elbl,,name,<> |
_j cc,_m,%__elbl |
else |
_set __albl,,__astk,%__inner_loop |
_j cc,_m,%__albl |
endif |
endm |
_until macro cc |
_set __albl,,__astk,%__depth |
_jn cc,_m,%__albl |
_set __inner_loop,,__llbl,%__depth |
_endguess |
endm |
_endloop macro |
_set __albl,,__astk,%__depth |
_j ,_m,%__albl |
_set __inner_loop,,__llbl,%__depth |
_endguess |
endm |
_if macro cc |
_guess |
_set __albl,,__astk,%__depth |
_jn cc,_l,%__albl |
endm |
_else macro |
_admit |
endm |
_endif macro |
_endguess |
endm |
_set macro base1,ext1,base2,ext2 |
base1&ext1 = base2&ext2 |
endm |
_label macro base,ext |
base&ext: |
endm |
_j macro cc,base,ext |
j&cc base&ext |
endm |
_jn macro cc,base,ext |
jn&cc base&ext |
endm |
jnna macro label |
ja label |
endm |
jnnae macro label |
jae label |
endm |
jnnb macro label |
jb label |
endm |
jnnbe macro label |
jbe label |
endm |
jnnc macro label |
jc label |
endm |
jnne macro label |
je label |
endm |
jnng macro label |
jg label |
endm |
jnnge macro label |
jge label |
endm |
jnnl macro label |
jl label |
endm |
jnnle macro label |
jle label |
endm |
jnno macro label |
jo label |
endm |
jnnp macro label |
jp label |
endm |
jnns macro label |
js label |
endm |
jnnz macro label |
jz label |
endm |
jnpe macro label |
jpo label |
endm |
jnpo macro label |
jpe label |
endm |
j macro label |
jmp label |
endm |
jn macro label |
nop |
endm |
_shl macro reg,count |
add reg,reg |
endm |
_rcl macro reg,count |
adc reg,reg |
endm |
/programs/develop/open watcom/trunk/clib/crt/variety.h |
---|
0,0 → 1,293 |
/**************************************************************************** |
* |
* 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: Configuration for clib builds. |
* |
****************************************************************************/ |
#ifndef _VARIETY_H_INCLUDED |
#define _VARIETY_H_INCLUDED |
// |
// Note: for the DLL versions of the runtime libraries, this file must be |
// included before any of the runtime header files. |
// |
#ifndef _COMDEF_H_INCLUDED |
#include <_comdef.h> |
#endif |
// specialized data reference macro |
#define _HUGEDATA _WCDATA |
// memory model macros |
#if defined(__SMALL__) |
#define __SMALL_DATA__ |
#define __SMALL_CODE__ |
#elif defined(__FLAT__) |
#define __SMALL_DATA__ |
#define __SMALL_CODE__ |
#elif defined(__MEDIUM__) |
#define __SMALL_DATA__ |
#define __BIG_CODE__ |
#elif defined(__COMPACT__) |
#define __BIG_DATA__ |
#define __SMALL_CODE__ |
#elif defined(__LARGE__) |
#define __BIG_DATA__ |
#define __BIG_CODE__ |
#elif defined(__HUGE__) |
#define __BIG_DATA__ |
#define __BIG_CODE__ |
#elif defined(__AXP__) || defined(__PPC__) || defined(__MIPS__) |
// these effectively use near data references |
#define __SMALL_DATA__ |
#define __SMALL_CODE__ |
#else |
#error unable to configure memory model |
#endif |
// operating system and processor macros |
#if defined(__GENERIC__) |
#if defined(__386__) |
#define __PROTECT_MODE__ |
#define __GENERIC_386__ |
#elif defined(M_I86) |
#define __REAL_MODE__ |
#define __GENERIC_086__ |
#else |
#error unrecognized processor for GENERIC |
#endif |
#elif defined(__OS2__) |
#if defined(M_I86) |
#define __REAL_MODE__ |
#define __OS2_286__ |
#elif defined(__386__) |
#define __PROTECT_MODE__ |
#define __OS2_386__ |
#define __WARP__ |
#elif defined(__PPC__) |
#define __PROTECT_MODE__ |
#define __OS2_PPC__ |
#define __WARP__ |
#else |
#error unrecognized processor for OS2 |
#endif |
#elif defined(__NT__) |
#if !defined(WIN32_LEAN_AND_MEAN) && !defined(WIN32_NICE_AND_FAT) |
#define WIN32_LEAN_AND_MEAN |
#endif |
#define __PROTECT_MODE__ |
#if defined(__386__) |
#define __NT_386__ |
#elif defined(__AXP__) |
#define __NT_AXP__ |
#elif defined(__PPC__) |
#define __NT_PPC__ |
#else |
#error unrecognized processor for NT |
#endif |
#elif defined(__WINDOWS__) || defined(__WINDOWS_386__) |
#define __PROTECT_MODE__ |
#if defined(__386__) |
#define __WINDOWS__ |
#elif defined(M_I86) |
#define __WINDOWS_286__ |
#else |
#error unrecognized processor for WINDOWS |
#endif |
#elif defined(__DOS__) |
#if defined(__386__) |
#define __PROTECT_MODE__ |
#define __DOS_386__ |
#elif defined(M_I86) |
#define __REAL_MODE__ |
#define __DOS_086__ |
#else |
#error unrecognized processor for DOS |
#endif |
#elif defined(__OSI__) |
#if defined(__386__) |
#define __PROTECT_MODE__ |
#define __OSI_386__ |
#else |
#error unrecognized processor for OSI |
#endif |
#elif defined(__QNX__) |
#define __PROTECT_MODE__ |
#define __UNIX__ |
#if defined(__386__) |
#define __QNX_386__ |
#elif defined(M_I86) |
#define __QNX_286__ |
#else |
#error unrecognized processor for QNX |
#endif |
#elif defined(__LINUX__) |
#define __PROTECT_MODE__ |
#define __UNIX__ |
#if defined(__386__) |
#define __LINUX_386__ |
#elif defined(__PPC__) |
#define __LINUX_PPC__ |
#elif defined(__MIPS__) |
#define __LINUX_MIPS__ |
#else |
#error unrecognized processor for Linux |
#endif |
#elif defined(__NETWARE__) |
#define __PROTECT_MODE__ |
#if defined(__386__) |
#define __NETWARE_386__ |
#else |
#error unrecognized processor for NETWARE |
#endif |
#else |
#error unable to configure operating system and processor |
#endif |
// handle building dll's with appropriate linkage |
#if !defined(__SW_BR) && (defined(__WARP__) || defined(__NT__)) |
#if defined(__MAKE_DLL_CLIB) |
#undef _WCRTLINK |
#undef _WCIRTLINK |
#undef _WCRTLINKD |
#undef _WMRTLINK |
#undef _WMIRTLINK |
#undef _WMRTLINKD |
#undef _WPRTLINK |
#undef _WPIRTLINK |
#undef _WPRTLINKD |
#if defined(__NT__) |
#define _WCRTLINK __declspec(dllexport) _WRTLCALL |
#define _WCIRTLINK __declspec(dllexport) _WRTLCALL |
#define _WCRTLINKD __declspec(dllexport) |
#define _WMRTLINK __declspec(dllimport) _WRTLCALL |
#define _WMIRTLINK __declspec(dllimport) _WRTLCALL |
#define _WMRTLINKD __declspec(dllimport) |
#define _WPRTLINK __declspec(dllimport) _WRTLCALL |
#define _WPIRTLINK __declspec(dllimport) _WRTLCALL |
#define _WPRTLINKD __declspec(dllimport) |
#elif defined(__WARP__) |
#define _WCRTLINK __declspec(dllexport) _WRTLCALL |
#define _WCIRTLINK __declspec(dllexport) _WRTLCALL |
#define _WCRTLINKD __declspec(dllexport) |
#define _WMRTLINK _WRTLCALL |
#define _WMIRTLINK _WRTLCALL |
#define _WMRTLINKD |
#define _WPRTLINK _WRTLCALL |
#define _WPIRTLINK _WRTLCALL |
#define _WPRTLINKD |
#endif |
#elif defined(__MAKE_DLL_MATHLIB) |
#define _RTDLL |
#undef _WCRTLINK |
#undef _WCIRTLINK |
#undef _WCRTLINKD |
#undef _WMRTLINK |
#undef _WMIRTLINK |
#undef _WMRTLINKD |
#undef _WPRTLINK |
#undef _WPIRTLINK |
#undef _WPRTLINKD |
#if defined(__NT__) |
#define _WCRTLINK __declspec(dllimport) _WRTLCALL |
#define _WCIRTLINK __declspec(dllimport) _WRTLCALL |
#define _WCRTLINKD __declspec(dllimport) |
#define _WMRTLINK __declspec(dllexport) _WRTLCALL |
#define _WMIRTLINK __declspec(dllexport) _WRTLCALL |
#define _WMRTLINKD __declspec(dllexport) |
#define _WPRTLINK __declspec(dllimport) _WRTLCALL |
#define _WPIRTLINK __declspec(dllimport) _WRTLCALL |
#define _WPRTLINKD __declspec(dllimport) |
#elif defined(__WARP__) |
#define _WCRTLINK _WRTLCALL |
#define _WCIRTLINK _WRTLCALL |
#define _WCRTLINKD |
#define _WMRTLINK __declspec(dllexport) _WRTLCALL |
#define _WMIRTLINK __declspec(dllexport) _WRTLCALL |
#define _WMRTLINKD __declspec(dllexport) |
#define _WPRTLINK _WRTLCALL |
#define _WPIRTLINK _WRTLCALL |
#define _WPRTLINKD |
#endif |
#elif defined(__MAKE_DLL_CPPLIB) |
#define _RTDLL |
#undef _WCRTLINK |
#undef _WCIRTLINK |
#undef _WCRTLINKD |
#undef _WMRTLINK |
#undef _WMIRTLINK |
#undef _WMRTLINKD |
#undef _WPRTLINK |
#undef _WPIRTLINK |
#undef _WPRTLINKD |
#if defined(__NT__) |
#define _WCRTLINK __declspec(dllimport) _WRTLCALL |
#define _WCIRTLINK __declspec(dllimport) _WRTLCALL |
#define _WCRTLINKD __declspec(dllimport) |
#define _WMRTLINK __declspec(dllimport) _WRTLCALL |
#define _WMIRTLINK __declspec(dllimport) _WRTLCALL |
#define _WMRTLINKD __declspec(dllimport) |
#define _WPRTLINK __declspec(dllexport) _WRTLCALL |
#define _WPIRTLINK __declspec(dllexport) _WRTLCALL |
#define _WPRTLINKD __declspec(dllexport) |
#elif defined(__WARP__) |
#define _WCRTLINK _WRTLCALL |
#define _WCIRTLINK _WRTLCALL |
#define _WCRTLINKD |
#define _WMRTLINK _WRTLCALL |
#define _WMIRTLINK _WRTLCALL |
#define _WMRTLINKD |
#define _WPRTLINK __declspec(dllexport) _WRTLCALL |
#define _WPIRTLINK __declspec(dllexport) _WRTLCALL |
#define _WPRTLINKD __declspec(dllexport) |
#endif |
#endif |
#endif |
#define __ptr_check( p, a ) |
#define __null_check( p, a ) |
#define __stream_check( s, a ) |
#define __ROUND_UP_SIZE( __x, __amt ) (((__x)+((__amt)-1))&(~((__amt)-1))) |
/// |
/// This doesn't work for far pointer's |
/// |
///#define __ROUND_UP_PTR( __x, __amt ) ((void *)__ROUND_UP_SIZE((unsigned)(__x),__amt)) |
#if defined(M_I86) |
#define __ALIGN_SIZE( __x ) __ROUND_UP_SIZE( __x, 2 ) |
// #define __ALIGN_PTR( __x ) __ROUND_UP_PTR( __x, 2 ) |
#elif defined(__386__) |
#define __ALIGN_SIZE( __x ) __ROUND_UP_SIZE( __x, 4 ) |
/// #define __ALIGN_PTR( __x ) __ROUND_UP_PTR( __x, 4 ) |
#else |
#define __ALIGN_SIZE( __x ) __ROUND_UP_SIZE( __x, 8 ) |
// #define __ALIGN_PTR( __x ) __ROUND_UP_PTR( __x, 8 ) |
#endif |
#endif |
/programs/develop/open watcom/trunk/clib/crt/widechar.h |
---|
0,0 → 1,74 |
/**************************************************************************** |
* |
* 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: Macros for single source wide/narrow character code. |
* |
****************************************************************************/ |
#ifndef _WIDECHAR_H_INCLUDED |
#define _WIDECHAR_H_INCLUDED |
#include "variety.h" |
#include <stdlib.h> /* for wchar_t and _atouni */ |
/*** Define some handy macros ***/ |
#ifdef __WIDECHAR__ |
#define DIR_TYPE struct _wdirent |
#define CHAR_TYPE wchar_t |
#define UCHAR_TYPE wchar_t |
#define INTCHAR_TYPE wint_t |
#define INT_WC_TYPE wchar_t |
#define VOID_WC_TYPE wchar_t |
#define NULLCHAR 0 |
#define STRING(a) L##a |
#define _AToUni(p1,p2) _atouni(p1,p2) |
#define IS_ASCII(c) ( (c & 0xff00) == 0 ) |
#define TO_ASCII(c) ( c ) |
#define __F_NAME(n1,n2) n2 |
#define UNICODE |
#define _UNICODE |
#define __UNICODE__ |
#else |
#define DIR_TYPE struct dirent |
#define CHAR_TYPE char |
#define UCHAR_TYPE unsigned char |
#define INTCHAR_TYPE int |
#define INT_WC_TYPE int |
#define VOID_WC_TYPE void |
#define NULLCHAR '\0' |
#define STRING(a) a |
#define _AToUni(p1,p2) (p2) |
#define IS_ASCII(c) ( 1 ) |
#define TO_ASCII(c) ( (unsigned char)c ) |
#define __F_NAME(n1,n2) n1 |
#endif |
#define CHARSIZE (sizeof( CHAR_TYPE )) |
/* must be the larger of char and wchar_t */ |
#define MAX_CHAR_TYPE wchar_t |
#endif |
/programs/develop/open watcom/trunk/clib/crt/xfloat.h |
---|
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 |
/programs/develop/open watcom/trunk/clib/crt/xinit.inc |
---|
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 |
/programs/develop/open watcom/trunk/clib/crt/xmsgwnt.c |
---|
0,0 → 1,56 |
/**************************************************************************** |
* |
* 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: Fatal runtime error handler for Win32. |
* |
****************************************************************************/ |
#include "variety.h" |
#include "rtdata.h" |
#include "exitwmsg.h" |
void debug_out_str(const char* str); |
_WCRTLINK void __exit_with_msg( char *msg, unsigned retcode ) |
{ |
unsigned len; |
char *end; |
end = msg; |
for( len = 0; *end++ != '\0'; len++ ) |
; |
debug_out_str(msg); |
__exit( retcode ); |
} |
_WCRTLINK void __fatal_runtime_error( char *msg, unsigned retcode ) |
{ |
__exit_with_msg( msg, retcode ); |
} |
/programs/develop/open watcom/trunk/clib/crt/xstring.h |
---|
0,0 → 1,68 |
/**************************************************************************** |
* |
* 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 direct 'calls' to inline functions. |
* |
****************************************************************************/ |
#ifndef _XSTRING_H_INCLUDED |
#include "variety.h" |
#include <string.h> |
#ifdef __cplusplus |
extern "C" { |
#endif |
#ifdef __INLINE_FUNCTIONS__ |
void *_inline_memchr( const void *__s, int __c, size_t __n ); |
int _inline_memcmp( const void *__s1, const void *__s2, size_t __n ); |
void *_inline_memcpy( void *__s1, const void *__s2, size_t __n ); |
void *_inline_memmove( void *__s1, const void *__s2, size_t __n ); |
void *_inline_memset( void *__s, int __c, size_t __n ); |
char *_inline_strcat( char *__s1, const char *__s2 ); |
char *_inline_strchr( const char *__s, int __c ); |
int _inline_strcmp( const char *__s1, const char *__s2 ); |
char *_inline_strcpy( char *__s1, const char *__s2 ); |
size_t _inline_strlen( const char *__s ); |
void _WCFAR *_inline__fmemchr( const void _WCFAR *__s, int __c, size_t __n ); |
void _WCFAR *_inline__fmemcpy( void _WCFAR *__s1, const void _WCFAR *__s2, size_t __n ); |
void _WCFAR *_inline__fmemset( void _WCFAR *__s, int __c, size_t __n ); |
int _inline__fmemcmp( const void _WCFAR *__s1, const void _WCFAR *__s2, size_t __n ); |
char _WCFAR *_inline__fstrcat( char _WCFAR *__s1, const char _WCFAR *__s2 ); |
char _WCFAR *_inline__fstrchr( const char _WCFAR *__s, int __c ); |
int _inline__fstrcmp( const char _WCFAR *__s1, const char _WCFAR *__s2 ); |
char _WCFAR *_inline__fstrcpy( char _WCFAR *__s1, const char _WCFAR *__s2 ); |
size_t _inline__fstrlen( const char _WCFAR *__s ); |
void _inline_movedata( unsigned __srcseg, unsigned __srcoff, |
unsigned __tgtseg, unsigned __tgtoff, unsigned __len ); |
#endif /* __INLINE_FUNCTIONS__ */ |
#define _XSTRING_H_INCLUDED |
#ifdef __cplusplus |
}; |
#endif |
#endif |