build msvcrt and crtdll from same source via lib\crt

fix problem with scanf/printf reading/printing doubles

svn path=/trunk/; revision=13343
This commit is contained in:
Gunnar Dalsnes 2005-01-27 21:23:43 +00:00
parent b6a8b98ef0
commit 4b5d785258
5 changed files with 308 additions and 1 deletions

View file

@ -42,7 +42,7 @@ BUS = acpi isapnp pci
LIB_FSLIB = vfatlib
# Static libraries
LIB_STATIC = string rosrtl epsapi uuid libwine zlib rtl tgetopt pseh adns dxguid strmiids
LIB_STATIC = string rosrtl epsapi uuid libwine zlib rtl tgetopt pseh adns dxguid strmiids crt
# Keyboard layout libraries
DLLS_KBD = kbdda kbddv kbdes kbdfr kbdgr kbdse kbduk kbdus

View file

@ -70,6 +70,8 @@ extern __file_rec* __file_rec_list;
void _dosmaperr(unsigned long oserrcode);
extern int __fmode;
#ifdef __cplusplus
}
#endif

View file

@ -0,0 +1,124 @@
/*
* msvcrt C++ exception handling
*
* Copyright 2002 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __MSVCRT_CPPEXCEPT_H
#define __MSVCRT_CPPEXCEPT_H
#define CXX_FRAME_MAGIC 0x19930520
#define CXX_EXCEPTION 0xe06d7363
typedef void (*vtable_ptr)();
/* type_info object, see cpp.c for inplementation */
typedef struct __type_info
{
vtable_ptr *vtable;
char *name; /* Unmangled name, allocated lazily */
char mangled[32]; /* Variable length, but we declare it large enough for static RTTI */
} type_info;
/* the exception frame used by CxxFrameHandler */
typedef struct __cxx_exception_frame
{
EXCEPTION_REGISTRATION_RECORD frame; /* the standard exception frame */
int trylevel;
DWORD ebp;
} cxx_exception_frame;
/* info about a single catch {} block */
typedef struct __catchblock_info
{
UINT flags; /* flags (see below) */
type_info *type_info; /* C++ type caught by this block */
int offset; /* stack offset to copy exception object to */
void (*handler)(); /* catch block handler code */
} catchblock_info;
#define TYPE_FLAG_CONST 1
#define TYPE_FLAG_VOLATILE 2
#define TYPE_FLAG_REFERENCE 8
/* info about a single try {} block */
typedef struct __tryblock_info
{
int start_level; /* start trylevel of that block */
int end_level; /* end trylevel of that block */
int catch_level; /* initial trylevel of the catch block */
int catchblock_count; /* count of catch blocks in array */
catchblock_info *catchblock; /* array of catch blocks */
} tryblock_info;
/* info about the unwind handler for a given trylevel */
typedef struct __unwind_info
{
int prev; /* prev trylevel unwind handler, to run after this one */
void (*handler)(); /* unwind handler */
} unwind_info;
/* descriptor of all try blocks of a given function */
typedef struct __cxx_function_descr
{
UINT magic; /* must be CXX_FRAME_MAGIC */
UINT unwind_count; /* number of unwind handlers */
unwind_info *unwind_table; /* array of unwind handlers */
UINT tryblock_count; /* number of try blocks */
tryblock_info *tryblock; /* array of try blocks */
UINT unknown[3];
} cxx_function_descr;
typedef void (*cxx_copy_ctor)(void);
/* complete information about a C++ type */
typedef struct __cxx_type_info
{
UINT flags; /* flags (see CLASS_* flags below) */
type_info *type_info; /* C++ type info */
int this_offset; /* offset of base class this pointer from start of object */
int vbase_descr; /* offset of virtual base class descriptor */
int vbase_offset; /* offset of this pointer offset in virtual base class descriptor */
size_t size; /* object size */
cxx_copy_ctor copy_ctor; /* copy constructor */
} cxx_type_info;
#define CLASS_IS_SIMPLE_TYPE 1
#define CLASS_HAS_VIRTUAL_BASE_CLASS 4
/* table of C++ types that apply for a given object */
typedef struct __cxx_type_info_table
{
UINT count; /* number of types */
const cxx_type_info *info[3]; /* variable length, we declare it large enough for static RTTI */
} cxx_type_info_table;
typedef DWORD (*cxx_exc_custom_handler)( PEXCEPTION_RECORD, cxx_exception_frame*,
PCONTEXT, EXCEPTION_REGISTRATION_RECORD**,
cxx_function_descr*, int nested_trylevel,
EXCEPTION_REGISTRATION_RECORD *nested_frame, DWORD unknown3 );
/* type information for an exception object */
typedef struct __cxx_exception_type
{
UINT flags; /* TYPE_FLAG flags */
void (*destructor)(); /* exception object destructor */
cxx_exc_custom_handler custom_handler; /* custom handler for this exception */
const cxx_type_info_table *type_info_table; /* list of types for this exception object */
} cxx_exception_type;
void _CxxThrowException(void*,const cxx_exception_type*);
#endif /* __MSVCRT_CPPEXCEPT_H */

View file

@ -0,0 +1,53 @@
/*
* C++ exception handling facility
*
* Copyright 2000 Francois Gouget.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WINE_EH_H
#define __WINE_EH_H
#ifndef __WINE_USE_MSVCRT
#define __WINE_USE_MSVCRT
#endif
#if !defined(__cplusplus) && !defined(USE_MSVCRT_PREFIX)
#error "eh.h is meant only for C++ applications"
#endif
#ifndef MSVCRT
# ifdef USE_MSVCRT_PREFIX
# define MSVCRT(x) MSVCRT_##x
# else
# define MSVCRT(x) x
# endif
#endif
struct _EXCEPTION_POINTERS;
typedef void (*terminate_handler)();
typedef void (*terminate_function)();
typedef void (*unexpected_handler)();
typedef void (*unexpected_function)();
typedef void (*_se_translator_function)(unsigned int code, struct _EXCEPTION_POINTERS *info);
terminate_function MSVCRT(set_terminate)(terminate_function func);
unexpected_function MSVCRT(set_unexpected)(unexpected_function func);
_se_translator_function MSVCRT(_set_se_translator)(_se_translator_function func);
void MSVCRT(terminate)();
void MSVCRT(unexpected)();
#endif /* __WINE_EH_H */

View file

@ -0,0 +1,128 @@
/*
* Copyright 2001 Jon Griffiths
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WINE_MSVCRT_H
#define __WINE_MSVCRT_H
#include <stdarg.h>
#include <ctype.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "winnls.h"
#include "msvcrt/string.h"
#include "eh.h"
/* TLS data */
extern DWORD MSVCRT_tls_index;
typedef struct __MSVCRT_thread_data
{
int _errno; // ros
unsigned long doserrno;
char *mbstok_next; /* next ptr for mbstok() */
char *efcvt_buffer; /* buffer for ecvt/fcvt */
terminate_function terminate_handler;
unexpected_function unexpected_handler;
_se_translator_function se_translator;
EXCEPTION_RECORD *exc_record;
} MSVCRT_thread_data;
extern MSVCRT_thread_data *msvcrt_get_thread_data(void);
extern int MSVCRT_current_lc_all_cp;
void _purecall(void);
void MSVCRT__set_errno(int);
char* msvcrt_strndup(const char*,unsigned int);
#ifndef __REACTOS__
MSVCRT_wchar_t *msvcrt_wstrndup(const MSVCRT_wchar_t*, unsigned int);
#endif
void MSVCRT__amsg_exit(int errnum);
extern char **MSVCRT__environ;
#ifndef __REACTOS__
extern MSVCRT_wchar_t **MSVCRT__wenviron;
extern char ** msvcrt_SnapshotOfEnvironmentA(char **);
extern MSVCRT_wchar_t ** msvcrt_SnapshotOfEnvironmentW(MSVCRT_wchar_t **);
#endif
/* FIXME: This should be declared in new.h but it's not an extern "C" so
* it would not be much use anyway. Even for Winelib applications.
*/
int MSVCRT__set_new_mode(int mode);
void* MSVCRT_operator_new(unsigned long size);
void MSVCRT_operator_delete(void*);
#ifndef __REACTOS__
typedef void* (*MSVCRT_malloc_func)(MSVCRT_size_t);
#endif
typedef void (*MSVCRT_free_func)(void*);
#ifndef __REACTOS__
extern char* MSVCRT___unDName(int,const char*,int,MSVCRT_malloc_func,MSVCRT_free_func,unsigned int);
#endif
/* Setup and teardown multi threaded locks */
extern void msvcrt_init_mt_locks(void);
extern void msvcrt_free_mt_locks(void);
extern void msvcrt_init_io(void);
extern void msvcrt_free_io(void);
extern void msvcrt_init_console(void);
extern void msvcrt_free_console(void);
extern void msvcrt_init_args(void);
extern void msvcrt_free_args(void);
/* run-time error codes */
#define _RT_STACK 0
#define _RT_NULLPTR 1
#define _RT_FLOAT 2
#define _RT_INTDIV 3
#define _RT_EXECMEM 5
#define _RT_EXECFORM 6
#define _RT_EXECENV 7
#define _RT_SPACEARG 8
#define _RT_SPACEENV 9
#define _RT_ABORT 10
#define _RT_NPTR 12
#define _RT_FPTR 13
#define _RT_BREAK 14
#define _RT_INT 15
#define _RT_THREAD 16
#define _RT_LOCK 17
#define _RT_HEAP 18
#define _RT_OPENCON 19
#define _RT_QWIN 20
#define _RT_NOMAIN 21
#define _RT_NONCONT 22
#define _RT_INVALDISP 23
#define _RT_ONEXIT 24
#define _RT_PUREVIRT 25
#define _RT_STDIOINIT 26
#define _RT_LOWIOINIT 27
#define _RT_HEAPINIT 28
#define _RT_DOMAIN 120
#define _RT_SING 121
#define _RT_TLOSS 122
#define _RT_CRNL 252
#define _RT_BANNER 255
#endif /* __WINE_MSVCRT_H */