Initial C++ runtime work. Much more to do.

This commit is contained in:
2015-05-02 23:32:01 -04:00
parent 772476ea85
commit db2bda84c8
35 changed files with 7920 additions and 0 deletions

4
include/assert.h Normal file
View File

@ -0,0 +1,4 @@
#include <sys/param.h>
#include <sys/systm.h>
#define assert( e ) KASSERT( (e), "Assertion failure" )

1
include/ctype.h Normal file
View File

@ -0,0 +1 @@
#include <sys/ctype.h>

1
include/errno.h Normal file
View File

@ -0,0 +1 @@
#include <sys/errno.h>

0
include/limits.h Normal file
View File

0
include/stdbool.h Normal file
View File

23
include/stddef.h Normal file
View File

@ -0,0 +1,23 @@
#ifdef __cplusplus
extern "C"
{
#endif
#include <sys/types.h>
#include <sys/stddef.h>
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
#undef NULL
#define NULL (nullptr)
#else
#endif
#ifdef __cplusplus
namespace std
{
using size_t= ::size_t;
using ptrdiff_t= ::ptrdiff_t;
}
#endif

1
include/stdint.h Normal file
View File

@ -0,0 +1 @@
#include <sys/stdint.h>

0
include/stdio.h Normal file
View File

33
include/stdlib.h Normal file
View File

@ -0,0 +1,33 @@
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/libkern.h>
#include <sys/malloc.h>
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
namespace cxxruntime
{
extern void *malloc( std::size_t );
extern void *realloc(void *, std::size_t);
extern void free(void *);
}
#define __extern_c extern "C"
#else
#define __extern_c extern
#endif
__extern_c void *cxxruntime_malloc(size_t);
__extern_c void *cxxruntime_realloc(void *, size_t);
__extern_c void cxxruntime_free(void *);
__extern_c char *cxxruntime_strdup(const char *);
__extern_c void abort() __attribute__(( __noreturn__ ));

0
include/string.h Normal file
View File