Some more stdlib (array and vector, untested so far).
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(BAD_APPLE_OS_CASSERT_INCLUDED)
|
||||
#define BAD_APPLE_OS_CASSERT_INCLUDED
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#endif // !defined(BAD_APPLE_OS_CASSERT_INCLUDED)
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
|
||||
#if !defined(BAD_APPLE_OS_CSTDARG_INCLUDED)
|
||||
#define BAD_APPLE_OS_CSTDARG_INCLUDED
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
namespace std
|
||||
{
|
||||
using ::va_list;
|
||||
}
|
||||
|
||||
#endif // !defined(BAD_APPLE_OS_CSTDARG_INCLUDED)
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(BAD_APPLE_OS_CSTDIO_INCLUDED)
|
||||
#define BAD_APPLE_OS_CSTDIO_INCLUDED
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace std
|
||||
{
|
||||
using ::putchar;
|
||||
using ::puts;
|
||||
using ::printf;
|
||||
using ::vprintf;
|
||||
}
|
||||
|
||||
#endif // !defined(BAD_APPLE_OS_CSTDIO_INCLUDED)
|
||||
@@ -1,18 +0,0 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(BAD_APPLE_OS_CSTDLIB_INCLUDED)
|
||||
#define BAD_APPLE_OS_CSTDLIB_INCLUDED
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace std
|
||||
{
|
||||
using ::abort;
|
||||
using ::malloc;
|
||||
using ::free;
|
||||
}
|
||||
|
||||
void __ba_registerAllocatableMemory(void* memory, size_t size) noexcept;
|
||||
|
||||
#endif // !defined(BAD_APPLE_OS_CSTDLIB_INCLUDED)
|
||||
@@ -1,19 +0,0 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(BAD_APPLE_OS_CSTRING_INCLUDED)
|
||||
#define BAD_APPLE_OS_CSTRING_INCLUDED
|
||||
|
||||
#include <string.h>
|
||||
|
||||
namespace std
|
||||
{
|
||||
using ::strlen;
|
||||
|
||||
using ::memcmp;
|
||||
using ::memcpy;
|
||||
using ::memmove;
|
||||
using ::memset;
|
||||
}
|
||||
|
||||
#endif // !defined(BAD_APPLE_OS_CSTRING_INCLUDED)
|
||||
@@ -1,50 +0,0 @@
|
||||
|
||||
#if !defined(BAD_APPLE_OS_EXCEPTION_INCLUDED)
|
||||
#define BAD_APPLE_OS_EXCEPTION_INCLUDED
|
||||
|
||||
#include <cstdlib>
|
||||
#include "os/panic.hpp"
|
||||
|
||||
#if defined(__cpp_exceptions)
|
||||
#define __ba_throw throw
|
||||
#else
|
||||
#define __ba_throw ba::impl::gAbortHelper(__FILE__, __LINE__) =
|
||||
#endif
|
||||
|
||||
namespace std
|
||||
{
|
||||
class exception
|
||||
{
|
||||
public:
|
||||
virtual ~exception() noexcept = default;
|
||||
virtual const char* what() const noexcept;
|
||||
};
|
||||
}
|
||||
|
||||
#if !defined(__cpp_exceptions)
|
||||
namespace ba::impl
|
||||
{
|
||||
struct ExceptionAbortHelper
|
||||
{
|
||||
private:
|
||||
const char* mFile = "<unknown>";
|
||||
int mLine = -1;
|
||||
public:
|
||||
[[noreturn]] ExceptionAbortHelper& operator=(const std::exception& ex) noexcept
|
||||
{
|
||||
panicf("Uncaught exception with message \"%s\" at %s:%d.", ex.what(), mFile, mLine);
|
||||
}
|
||||
|
||||
ExceptionAbortHelper& operator()(const char* file, int line) noexcept
|
||||
{
|
||||
mFile = file;
|
||||
mLine = line;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
extern ExceptionAbortHelper gAbortHelper;
|
||||
}
|
||||
#endif // !defined(__cpp_exceptions)
|
||||
|
||||
#endif // !defined(BAD_APPLE_OS_EXCEPTION_INCLUDED)
|
||||
19
include/new
19
include/new
@@ -1,19 +0,0 @@
|
||||
|
||||
#if !defined(BAD_APPLE_OS_NEW_INCLUDED)
|
||||
#define BAD_APPLE_OS_NEW_INCLUDED
|
||||
|
||||
#include <exception>
|
||||
|
||||
namespace std
|
||||
{
|
||||
class bad_alloc : public std::exception
|
||||
{
|
||||
public:
|
||||
bad_alloc() noexcept = default;
|
||||
bad_alloc(const bad_alloc&) noexcept = default;
|
||||
|
||||
const char * what() const noexcept override;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // !defined(BAD_APPLE_OS_NEW_INCLUDED)
|
||||
@@ -4,7 +4,7 @@
|
||||
#if !defined(BAD_APPLE_OS_STDIO_H_INCLUDED)
|
||||
#define BAD_APPLE_OS_STDIO_H_INCLUDED
|
||||
|
||||
#include <cstdarg>
|
||||
#include "../stdlib/include/cstdarg"
|
||||
#include "./detail/common.h"
|
||||
|
||||
BA_EXTERN_C_BEGIN
|
||||
|
||||
Reference in New Issue
Block a user