[HEADERS]

- start using our own c++ headers and forward stlport ones to them in msvc build.
 - fix fpecode declaration for MSVC.
[CMAKE]
 - cardlib is a cpp library.
Now stlport compiles with msvc.

svn path=/branches/cmake-bringup/; revision=49552
This commit is contained in:
Jérôme Gardou 2010-11-10 22:20:05 +00:00
parent 3742d626dc
commit 8c6671477e
18 changed files with 942 additions and 5 deletions

View file

@ -123,6 +123,13 @@ ENDMACRO(add_minicd)
macro(set_cpp)
include_directories(BEFORE ${REACTOS_SOURCE_DIR}/include/stlport)
set(IS_CPP 1)
add_definitions(
-D_STLP_NATIVE_CPP_C_INCLUDE_PATH=../c++
-D_STLP_NATIVE_C_INCLUDE_PATH=../crt
-D_STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH=../c++
-D_STLP_USE_NEW_C_HEADERS
-D_STLP_NO_TYPEINFO
)
endmacro()
MACRO(add_livecd_target _targetname _dir )# optional parameter : _nameoncd

9
include/c++/cfloat Normal file
View file

@ -0,0 +1,9 @@
// C++ forwarding C float header.
//
// ISO C++ 14882: 18.2.2 Implementation properties: C library
//
#pragma once
#include <float.h>

17
include/c++/climits Normal file
View file

@ -0,0 +1,17 @@
// C limitations
#pragma once
#include <limits.h>
#ifndef LLONG_MIN
#define LLONG_MIN (-__LONG_LONG_MAX__ - 1)
#endif
#ifndef LLONG_MAX
#define LLONG_MAX __LONG_LONG_MAX__
#endif
#ifndef ULLONG_MAX
#define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1)
#endif

16
include/c++/clocale Normal file
View file

@ -0,0 +1,16 @@
// C++ forwarding C locale header.
#pragma once
#include <locale.h>
// Get rid of those macros defined in <locale.h> in lieu of real functions.
#undef setlocale
#undef localeconv
namespace std
{
using ::lconv;
using ::setlocale;
using ::localeconv;
}

292
include/c++/cmath Normal file
View file

@ -0,0 +1,292 @@
//Standard C++ math declarations
#pragma once
#include <math.h>
// Get rid of those macros defined in <math.h> in lieu of real functions.
#undef abs
#undef div
#undef acos
#undef asin
#undef atan
#undef atan2
#undef ceil
#undef cos
#undef cosh
#undef exp
#undef fabs
#undef floor
#undef fmod
#undef frexp
#undef ldexp
#undef log
#undef log10
#undef modf
#undef pow
#undef sin
#undef sinh
#undef sqrt
#undef tan
#undef tanh
namespace std
{
// Forward declaration of a helper function. This really should be
// an `exported' forward declaration.
template<typename _Tp>
_Tp __cmath_power(_Tp, unsigned int);
template<typename _Tp>
inline _Tp
__pow_helper(_Tp __x, int __n)
{
return __n < 0
? _Tp(1)/__cmath_power(__x, -__n)
: __cmath_power(__x, __n);
}
inline double
abs(double __x)
{ return fabs(__x); }
inline float
abs(float __x)
{ return fabsf(__x); }
inline long double
abs(long double __x)
{ return fabsl(__x); }
using ::acos;
inline float
acos(float __x)
{ return acosf(__x); }
inline long double
acos(long double __x)
{ return acosl(__x); }
using ::asin;
inline float
asin(float __x)
{ return asinf(__x); }
inline long double
asin(long double __x)
{ return asinl(__x); }
using ::atan;
inline float
atan(float __x)
{ return atanf(__x); }
inline long double
atan(long double __x)
{ return atanl(__x); }
using ::atan2;
inline float
atan2(float __y, float __x)
{ return atan2f(__y, __x); }
inline long double
atan2(long double __y, long double __x)
{ return atan2l(__y, __x); }
using ::ceil;
inline float
ceil(float __x)
{ return ceilf(__x); }
inline long double
ceil(long double __x)
{ return ceill(__x); }
using ::cos;
inline float
cos(float __x)
{ return cosf(__x); }
inline long double
cos(long double __x)
{ return cosl(__x); }
using ::cosh;
inline float
cosh(float __x)
{ return coshf(__x); }
inline long double
cosh(long double __x)
{ return coshl(__x); }
using ::exp;
inline float
exp(float __x)
{ return expf(__x); }
inline long double
exp(long double __x)
{ return expl(__x); }
using ::fabs;
inline float
fabs(float __x)
{ return fabsf(__x); }
inline long double
fabs(long double __x)
{ return fabsl(__x); }
using ::floor;
inline float
floor(float __x)
{ return floorf(__x); }
inline long double
floor(long double __x)
{ return floorl(__x); }
using ::fmod;
inline float
fmod(float __x, float __y)
{ return fmodf(__x, __y); }
inline long double
fmod(long double __x, long double __y)
{ return fmodl(__x, __y); }
using ::frexp;
inline float
frexp(float __x, int* __exp)
{ return frexpf(__x, __exp); }
inline long double
frexp(long double __x, int* __exp)
{ return frexpl(__x, __exp); }
using ::ldexp;
inline float
ldexp(float __x, int __exp)
{ return ldexpf(__x, __exp); }
inline long double
ldexp(long double __x, int __exp)
{ return ldexpl(__x, __exp); }
using ::log;
inline float
log(float __x)
{ return logf(__x); }
inline long double
log(long double __x)
{ return logl(__x); }
using ::log10;
inline float
log10(float __x)
{ return log10f(__x); }
inline long double
log10(long double __x)
{ return log10l(__x); }
using ::modf;
inline float
modf(float __x, float* __iptr)
{ return modff(__x, __iptr); }
inline long double
modf(long double __x, long double* __iptr)
{ return modfl(__x, __iptr); }
using ::pow;
inline float
pow(float __x, float __y)
{ return powf(__x, __y); }
inline long double
pow(long double __x, long double __y)
{ return powl(__x, __y); }
inline double
pow(double __x, int __i)
{ return pow(__x, static_cast<double>(__i)); }
inline float
pow(float __x, int __n)
{ return powf(__x, static_cast<float>(__n)); }
inline long double
pow(long double __x, int __n)
{ return powl(__x, static_cast<long double>(__n)); }
using ::sin;
inline float
sin(float __x)
{ return sinf(__x); }
inline long double
sin(long double __x)
{ return sinl(__x); }
using ::sinh;
inline float
sinh(float __x)
{ return sinhf(__x); }
inline long double
sinh(long double __x)
{ return sinhl(__x); }
using ::sqrt;
inline float
sqrt(float __x)
{ return sqrtf(__x); }
inline long double
sqrt(long double __x)
{ return sqrtl(__x); }
using ::tan;
inline float
tan(float __x)
{ return tanf(__x); }
inline long double
tan(long double __x)
{ return tanl(__x); }
using ::tanh;
inline float
tanh(float __x)
{ return tanhf(__x); }
inline long double
tanh(long double __x)
{ return tanhl(__x); }
}

11
include/c++/cstddef Normal file
View file

@ -0,0 +1,11 @@
// ISO C++ standards definitions
#include <stddef.h>
#pragma once
namespace std
{
using ::ptrdiff_t;
using ::size_t;
}

97
include/c++/cstdio Normal file
View file

@ -0,0 +1,97 @@
// C++ forwarding C stdio header.
#pragma once
#include <cstddef>
#include <stdio.h>
// Get rid of those macros defined in <stdio.h> in lieu of real functions.
#undef clearerr
#undef fclose
#undef feof
#undef ferror
#undef fflush
#undef fgetc
#undef fgetpos
#undef fgets
#undef fopen
#undef fprintf
#undef fputc
#undef fputs
#undef fread
#undef freopen
#undef fscanf
#undef fseek
#undef fsetpos
#undef ftell
#undef fwrite
#undef getc
#undef getchar
#undef gets
#undef perror
#undef printf
#undef putc
#undef putchar
#undef puts
#undef remove
#undef rename
#undef rewind
#undef scanf
#undef setbuf
#undef setvbuf
#undef sprintf
#undef sscanf
#undef tmpfile
#undef tmpnam
#undef ungetc
#undef vfprintf
#undef vprintf
#undef vsprintf
namespace std
{
using ::FILE;
using ::fpos_t;
using ::clearerr;
using ::fclose;
using ::feof;
using ::ferror;
using ::fflush;
using ::fgetc;
using ::fgetpos;
using ::fgets;
using ::fopen;
using ::fprintf;
using ::fputc;
using ::fputs;
using ::fread;
using ::freopen;
using ::fscanf;
using ::fseek;
using ::fsetpos;
using ::ftell;
using ::fwrite;
using ::getc;
using ::getchar;
using ::gets;
using ::perror;
using ::printf;
using ::putc;
using ::putchar;
using ::puts;
using ::remove;
using ::rename;
using ::rewind;
using ::scanf;
using ::setbuf;
using ::setvbuf;
using ::sprintf;
using ::sscanf;
using ::tmpfile;
using ::tmpnam;
using ::ungetc;
using ::vfprintf;
using ::vprintf;
using ::vsprintf;
}

77
include/c++/cstdlib Normal file
View file

@ -0,0 +1,77 @@
// Standard C library declarations
#pragma once
#include <cstddef>
#include <stdlib.h>
// Get rid of those macros defined in <stdlib.h> in lieu of real functions.
#undef abort
#undef abs
#undef atexit
#undef atof
#undef atoi
#undef atol
#undef bsearch
#undef calloc
#undef div
#undef exit
#undef free
#undef getenv
#undef labs
#undef ldiv
#undef malloc
#undef mblen
#undef mbstowcs
#undef mbtowc
#undef qsort
#undef rand
#undef realloc
#undef srand
#undef strtod
#undef strtol
#undef strtoul
#undef system
#undef wcstombs
#undef wctomb
namespace std
{
using ::div_t;
using ::ldiv_t;
using ::abort;
using ::abs;
using ::atexit;
using ::atof;
using ::atoi;
using ::atol;
using ::bsearch;
using ::calloc;
using ::div;
using ::exit;
using ::free;
using ::getenv;
using ::labs;
using ::ldiv;
using ::malloc;
using ::mblen;
using ::mbstowcs;
using ::mbtowc;
using ::qsort;
using ::rand;
using ::realloc;
using ::srand;
using ::strtod;
using ::strtol;
using ::strtoul;
using ::system;
using ::wcstombs;
using ::wctomb;
inline long
abs(long __i) { return labs(__i); }
inline ldiv_t
div(long __i, long __j) { return ldiv(__i, __j); }
}

60
include/c++/cstring Normal file
View file

@ -0,0 +1,60 @@
// Standard C string declarations for C++
//
// ISO C++ 14882: 20.4.6 C library
//
#pragma once
#include <cstddef>
#include <string.h>
// Get rid of those macros defined in <string.h> in lieu of real functions.
#undef memchr
#undef memcmp
#undef memcpy
#undef memmove
#undef memset
#undef strcat
#undef strchr
#undef strcmp
#undef strcoll
#undef strcpy
#undef strcspn
#undef strerror
#undef strlen
#undef strncat
#undef strncmp
#undef strncpy
#undef strpbrk
#undef strrchr
#undef strspn
#undef strstr
#undef strtok
#undef strxfrm
namespace std
{
using ::memchr;
using ::memcmp;
using ::memcpy;
using ::memmove;
using ::memset;
using ::strcat;
using ::strcmp;
using ::strcoll;
using ::strcpy;
using ::strcspn;
using ::strerror;
using ::strlen;
using ::strncat;
using ::strncmp;
using ::strncpy;
using ::strspn;
using ::strtok;
using ::strxfrm;
using ::strchr;
using ::strpbrk;
using ::strrchr;
using ::strstr;
}

34
include/c++/ctime Normal file
View file

@ -0,0 +1,34 @@
// ISO C++ date and time declarations
#include <cstddef>
#include <time.h>
#pragma once
// Get rid of those macros defined in <time.h> in lieu of real functions.
#undef clock
#undef difftime
#undef mktime
#undef time
#undef asctime
#undef ctime
#undef gmtime
#undef localtime
#undef strftime
namespace std
{
using ::clock_t;
using ::time_t;
using ::tm;
using ::clock;
using ::difftime;
using ::mktime;
using ::time;
using ::asctime;
using ::ctime;
using ::gmtime;
using ::localtime;
using ::strftime;
}

152
include/c++/cwchar Normal file
View file

@ -0,0 +1,152 @@
// C++ wchar forwarding header
#pragma once
#include <cstddef>
#include <wchar.h>
namespace std
{
using ::mbstate_t;
}
// Get rid of those macros defined in <wchar.h> in lieu of real functions.
#undef btowc
#undef fgetwc
#undef fgetws
#undef fputwc
#undef fputws
#undef fwide
#undef fwprintf
#undef fwscanf
#undef getwc
#undef getwchar
#undef mbrlen
#undef mbrtowc
#undef mbsinit
#undef mbsrtowcs
#undef putwc
#undef putwchar
#undef swprintf
#undef swscanf
#undef ungetwc
#undef vfwprintf
#undef vfwscanf
#undef vswprintf
#undef vswscanf
#undef vwprintf
#undef vwscanf
#undef wcrtomb
#undef wcscat
#undef wcschr
#undef wcscmp
#undef wcscoll
#undef wcscpy
#undef wcscspn
#undef wcsftime
#undef wcslen
#undef wcsncat
#undef wcsncmp
#undef wcsncpy
#undef wcspbrk
#undef wcsrchr
#undef wcsrtombs
#undef wcsspn
#undef wcsstr
#undef wcstod
#undef wcstof
#undef wcstok
#undef wcstol
#undef wcstoul
#undef wcsxfrm
#undef wctob
#undef wmemchr
#undef wmemcmp
#undef wmemcpy
#undef wmemmove
#undef wmemset
#undef wprintf
#undef wscanf
namespace std
{
using ::wint_t;
using ::btowc;
using ::fgetwc;
using ::fgetws;
using ::fputwc;
using ::fputws;
using ::fwide;
using ::fwprintf;
using ::fwscanf;
using ::getwc;
using ::getwchar;
using ::mbrlen;
using ::mbrtowc;
using ::mbsinit;
using ::mbsrtowcs;
using ::putwc;
using ::putwchar;
using ::swprintf;
using ::swscanf;
using ::ungetwc;
using ::vfwprintf;
using ::vfwscanf;
using ::vswprintf;
using ::vswscanf;
using ::vwprintf;
using ::vwscanf;
using ::wcrtomb;
using ::wcscat;
using ::wcscmp;
using ::wcscoll;
using ::wcscpy;
using ::wcscspn;
using ::wcsftime;
using ::wcslen;
using ::wcsncat;
using ::wcsncmp;
using ::wcsncpy;
using ::wcsrtombs;
using ::wcsspn;
using ::wcstod;
using ::wcstof;
using ::wcstok;
using ::wcstol;
using ::wcstoul;
using ::wcsxfrm;
using ::wctob;
using ::wmemcmp;
using ::wmemcpy;
using ::wmemmove;
using ::wmemset;
using ::wprintf;
using ::wscanf;
using ::wcschr;
using ::wcspbrk;
using ::wcsrchr;
using ::wcsstr;
using ::wmemchr;
inline wchar_t*
wcschr(wchar_t* __p, wchar_t __c)
{ return wcschr(const_cast<const wchar_t*>(__p), __c); }
inline wchar_t*
wcspbrk(wchar_t* __s1, const wchar_t* __s2)
{ return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }
inline wchar_t*
wcsrchr(wchar_t* __p, wchar_t __c)
{ return wcsrchr(const_cast<const wchar_t*>(__p), __c); }
inline wchar_t*
wcsstr(wchar_t* __s1, const wchar_t* __s2)
{ return wcsstr(const_cast<const wchar_t*>(__s1), __s2); }
inline wchar_t*
wmemchr(wchar_t* __p, wchar_t __c, size_t __n)
{ return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); }
}

66
include/c++/exception Normal file
View file

@ -0,0 +1,66 @@
// Exception Handling support header for -*- C++ -*-
#ifndef __EXCEPTION__
#define __EXCEPTION__
extern "C++" {
namespace std
{
/**
* @defgroup exceptions Exceptions
* @ingroup diagnostics
*
* Classes and functions for reporting errors via exception classes.
* @{
*/
/**
* @brief Base class for all library exceptions.
*
* This is the base class for all exceptions thrown by the standard
* library, and by certain language expressions. You are free to derive
* your own %exception classes, or use a different hierarchy, or to
* throw non-class data (e.g., fundamental types).
*/
class exception
{
public:
exception() throw() { }
virtual ~exception() throw();
/** Returns a C-style character string describing the general cause
* of the current error. */
virtual const char* what() const throw();
};
/** If an %exception is thrown which is not listed in a function's
* %exception specification, one of these may be thrown. */
class bad_exception : public exception
{
public:
bad_exception() throw() { }
virtual ~bad_exception() throw();
virtual const char* what() const throw();
};
typedef void (*unexpected_handler) ();
unexpected_handler set_unexpected(unexpected_handler) throw();
DECLSPEC_NORETURN void unexpected();
bool uncaught_exception() throw();
// @} group exceptions
} // namespace std
typedef void (*terminate_handler) ();
terminate_handler set_terminate(terminate_handler) throw();
DECLSPEC_NORETURN void terminate() throw();
} // extern "C++"
#endif

51
include/c++/new Normal file
View file

@ -0,0 +1,51 @@
// Standard C++ dynamic memory management header
#ifndef _NEW
#define _NEW
#include <cstddef>
#include <exception>
extern "C++" {
namespace std
{
class bad_alloc : public exception
{
public:
bad_alloc() throw() { }
// This declaration is not useless:
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
virtual ~bad_alloc() throw();
// See comment in eh_exception.cc.
virtual const char* what() const throw();
};
struct nothrow_t { };
extern const nothrow_t nothrow;
} // namespace std
typedef void (*new_handler)();
new_handler set_new_handler(new_handler) throw();
void* operator new (std::size_t size) throw (std::bad_alloc);
void* operator new (std::size_t size, const std::nothrow_t& nothrow_constant) throw();
void* operator new (std::size_t size, void* ptr) throw();
void* operator new[] (std::size_t size) throw (std::bad_alloc);
void* operator new[] (std::size_t size, const std::nothrow_t& nothrow_constant) throw();
void* operator new[] (std::size_t size, void* ptr) throw();
void operator delete (void* ptr) throw ();
void operator delete (void* ptr, const std::nothrow_t& nothrow_constant) throw();
void operator delete (void* ptr, void* voidptr2) throw();
void operator delete[] (void* ptr) throw ();
void operator delete[] (void* ptr, const std::nothrow_t& nothrow_constant) throw();
void operator delete[] (void* ptr, void* voidptr2) throw();
//@}
} // extern "C++"
#endif

48
include/c++/typeinfo Normal file
View file

@ -0,0 +1,48 @@
// RTTI support for C++
#ifndef _TYPEINFO
#define _TYPEINFO
#include <exception>
extern "C++" {
namespace std
{
class type_info {
public:
virtual ~type_info();
bool before (const type_info& rhs) const;
{ return __name < __arg.__name; }
bool operator==(const type_info& __arg) const
{ return __name == __arg.__name; }
bool operator!=(const type_info& __arg) const
{ return !operator==(__arg); }
const char* name() const;
protected:
const char* __name;
private:
type_info (const type_info& rhs);
type_info& operator= (const type_info& rhs);
};
class bad_cast : public exception
{
public:
bad_cast() throw() { }
virtual ~bad_cast() throw();
virtual const char* what() const throw();
};
class bad_typeid : public exception
{
public:
bad_typeid () throw() { }
virtual ~bad_typeid() throw();
virtual const char* what() const throw();
};
} // namespace std
} // extern "C++"
#endif

View file

@ -127,7 +127,7 @@ void __cdecl __MINGW_NOTHROW _fpreset (void);
void __cdecl __MINGW_NOTHROW fpreset (void);
/* Global 'variable' for the current floating point error code. */
_CRTIMP int * __cdecl __MINGW_NOTHROW __fpecode(void);
__MINGW_NOTHROW _CRTIMP int * __cdecl __fpecode(void);
#define _fpecode (*(__fpecode()))
/*

View file

@ -154,8 +154,8 @@ inline lldiv_t div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return _STLP_VEND
inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return ::llabs(__x); }
inline lldiv_t div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return ::lldiv(__x, __y); }
# endif
# else
inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return __x < 0 ? -__x : __x; }
/*# else
inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return __x < 0 ? -__x : __x; }*/
# endif
#endif

View file

@ -202,9 +202,7 @@
* a Microsoft Visual Studio release. This change native C/C++ library location
* and implementation, please define this to get correct STLport configuration.
*/
/*
#define _STLP_USING_PLATFORM_SDK_COMPILER 1
*/
/*
* Some compilers support the automatic linking feature.

View file

@ -1,4 +1,6 @@
set_cpp()
list(APPEND SOURCE
cardbitmaps.cpp
cardbutton.cpp