Added some more stdlib.
This commit is contained in:
27
include/assert.h
Normal file
27
include/assert.h
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(BAD_APPLE_OS_ASSERT_H_INCLUDED)
|
||||
#define BAD_APPLE_OS_ASSERT_H_INCLUDED
|
||||
|
||||
#include "./detail/common.h"
|
||||
|
||||
BA_EXTERN_C_BEGIN
|
||||
|
||||
#if defined(NDEBUG)
|
||||
#define assert(condition) ((void) 0)
|
||||
#else
|
||||
#define assert(condition) \
|
||||
if (!(condition)) \
|
||||
{ \
|
||||
__ba__assert_fail(__FILE__, __LINE__, #condition); \
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
BA_CXX_NORETURN void __ba__assert_fail(const char* filename, int line, const char* condition) BA_CXX_NOEXCEPT;
|
||||
#endif
|
||||
|
||||
BA_EXTERN_C_END
|
||||
|
||||
#endif // !defined(BAD_APPLE_OS_ASSERT_H_INCLUDED)
|
||||
9
include/cassert
Normal file
9
include/cassert
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
#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)
|
||||
16
include/cstdio
Normal file
16
include/cstdio
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
#endif // !defined(BAD_APPLE_OS_CSTDIO_INCLUDED)
|
||||
14
include/cstdlib
Normal file
14
include/cstdlib
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(BAD_APPLE_OS_CSTDLIB_INCLUDED)
|
||||
#define BAD_APPLE_OS_CSTDLIB_INCLUDED
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace std
|
||||
{
|
||||
using ::abort;
|
||||
}
|
||||
|
||||
#endif // !defined(BAD_APPLE_OS_CSTDLIB_INCLUDED)
|
||||
@@ -1,14 +1,19 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(BAD_APPLE_OS_CSTRING_HPP_INCLUDED)
|
||||
#define BAD_APPLE_OS_CSTRING_HPP_INCLUDED
|
||||
#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_HPP_INCLUDED)
|
||||
#endif // !defined(BAD_APPLE_OS_CSTRING_INCLUDED)
|
||||
|
||||
@@ -6,10 +6,16 @@
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#define BA_CXX_NODISCARD [[nodiscard]]
|
||||
#define BA_CXX_NORETURN [[noreturn]]
|
||||
#define BA_CXX_NOEXCEPT noexcept
|
||||
#define BA_EXTERN_C_BEGIN extern "C" {
|
||||
#define BA_EXTERN_C_END }
|
||||
#else
|
||||
#define BA_CXX_NODISCARD
|
||||
#define BA_CXX_NORETURN
|
||||
#define BA_CXX_NOEXCEPT
|
||||
#define BA_EXTERN_C_BEGIN
|
||||
#define BA_EXTERN_C_END
|
||||
#endif
|
||||
|
||||
#endif // !defined(BAD_APPLE_OS_DETAIL_ATTRIBUTES_H_INCLUDED)
|
||||
17
include/stdio.h
Normal file
17
include/stdio.h
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(BAD_APPLE_OS_STDIO_H_INCLUDED)
|
||||
#define BAD_APPLE_OS_STDIO_H_INCLUDED
|
||||
|
||||
#include "./detail/common.h"
|
||||
|
||||
BA_EXTERN_C_BEGIN
|
||||
|
||||
int putchar(int chr) BA_CXX_NOEXCEPT;
|
||||
int puts(const char* str) BA_CXX_NOEXCEPT;
|
||||
int printf(const char* format, ...) BA_CXX_NOEXCEPT;
|
||||
|
||||
BA_EXTERN_C_END
|
||||
|
||||
#endif // !defined(BAD_APPLE_OS_STDIO_H_INCLUDED)
|
||||
15
include/stdlib.h
Normal file
15
include/stdlib.h
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(BAD_APPLE_OS_STDLIB_H_INCLUDED)
|
||||
#define BAD_APPLE_OS_STDLIB_H_INCLUDED
|
||||
|
||||
#include "./detail/common.h"
|
||||
|
||||
BA_EXTERN_C_BEGIN
|
||||
|
||||
BA_CXX_NORETURN void abort();
|
||||
|
||||
BA_EXTERN_C_END
|
||||
|
||||
#endif // !defined(BAD_APPLE_OS_STDLIB_H_INCLUDED)
|
||||
@@ -6,14 +6,16 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "./detail/attributes.h"
|
||||
#include "./detail/common.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
BA_EXTERN_C_BEGIN
|
||||
|
||||
BA_CXX_NODISCARD int memcmp(const void* lhs, const void* rhs, size_t count) BA_CXX_NOEXCEPT;
|
||||
void memcpy(void* dest, const void* src, size_t count) BA_CXX_NOEXCEPT;
|
||||
void memmove(void* dest, const void* src, size_t count) BA_CXX_NOEXCEPT;
|
||||
void* memset(void* dest, int value, size_t count) BA_CXX_NOEXCEPT;
|
||||
BA_CXX_NODISCARD size_t strlen(const char* str) BA_CXX_NOEXCEPT;
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
BA_EXTERN_C_END
|
||||
|
||||
#endif // !defined(BAD_APPLE_OS_STRING_H_INCLUDED)
|
||||
|
||||
Reference in New Issue
Block a user