diff --git a/src/libraries/libc/arch/amd64/errno.cpp b/src/libraries/libc/arch/amd64/errno.cpp new file mode 100644 index 0000000..8afd4f6 --- /dev/null +++ b/src/libraries/libc/arch/amd64/errno.cpp @@ -0,0 +1,10 @@ +#include + +static int errno_value = 0; + +int * +__errno_location() +{ + // TODO: thread-local errno + return &errno_value; +} diff --git a/src/libraries/libc/include/arch/amd64/errno.h b/src/libraries/libc/include/arch/amd64/errno.h index a4c7eb6..10e8d66 100644 --- a/src/libraries/libc/include/arch/amd64/errno.h +++ b/src/libraries/libc/include/arch/amd64/errno.h @@ -2,4 +2,13 @@ /// \file arch/amd64/errno.h /// errno implementation for amd64 -extern int errno; +#ifdef __cplusplus +extern "C" { +#endif + +int * __errno_location(); +#define errno (*__errno_location()) + +#ifdef __cplusplus +} // extern C +#endif diff --git a/src/libraries/libc/stdlib/strtod.cpp b/src/libraries/libc/stdlib/strtod.cpp new file mode 100644 index 0000000..916a37f --- /dev/null +++ b/src/libraries/libc/stdlib/strtod.cpp @@ -0,0 +1,18 @@ +/** \file strtod.cpp + * + * This file is part of the C standard library for the jsix operating + * system. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#include +#include + +double strtod( const char * restrict nptr, char ** restrict endptr ) +{ + assert(!"strtod() NYI"); + return 0; +} diff --git a/src/libraries/libc/stdlib/strtof.cpp b/src/libraries/libc/stdlib/strtof.cpp new file mode 100644 index 0000000..913b365 --- /dev/null +++ b/src/libraries/libc/stdlib/strtof.cpp @@ -0,0 +1,18 @@ +/** \file strtof.cpp + * + * This file is part of the C standard library for the jsix operating + * system. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#include +#include + +float strtof( const char * restrict nptr, char ** restrict endptr ) +{ + assert(!"strtof() NYI"); + return 0; +} diff --git a/src/libraries/libc/stdlib/strtol.cpp b/src/libraries/libc/stdlib/strtol.cpp new file mode 100644 index 0000000..b30c8c7 --- /dev/null +++ b/src/libraries/libc/stdlib/strtol.cpp @@ -0,0 +1,18 @@ +/** \file strtol.cpp + * + * This file is part of the C standard library for the jsix operating + * system. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#include +#include + +long strtol( const char * restrict nptr, char ** restrict endptr, int base ) +{ + assert(!"strtol() NYI"); + return 0; +} diff --git a/src/libraries/libc/stdlib/strtold.cpp b/src/libraries/libc/stdlib/strtold.cpp new file mode 100644 index 0000000..1d9aff1 --- /dev/null +++ b/src/libraries/libc/stdlib/strtold.cpp @@ -0,0 +1,18 @@ +/** \file strtold.cpp + * + * This file is part of the C standard library for the jsix operating + * system. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#include +#include + +long double strtold( const char * restrict nptr, char ** restrict endptr ) +{ + assert(!"strtold() NYI"); + return 0; +} diff --git a/src/libraries/libc/stdlib/strtoll.cpp b/src/libraries/libc/stdlib/strtoll.cpp new file mode 100644 index 0000000..50dfc94 --- /dev/null +++ b/src/libraries/libc/stdlib/strtoll.cpp @@ -0,0 +1,18 @@ +/** \file strtoll.cpp + * + * This file is part of the C standard library for the jsix operating + * system. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#include +#include + +long long strtoll( const char * restrict nptr, char ** restrict endptr, int base ) +{ + assert(!"strtoll() NYI"); + return 0; +} diff --git a/src/libraries/libc/stdlib/strtoul.cpp b/src/libraries/libc/stdlib/strtoul.cpp new file mode 100644 index 0000000..2846ed1 --- /dev/null +++ b/src/libraries/libc/stdlib/strtoul.cpp @@ -0,0 +1,18 @@ +/** \file strtoul.cpp + * + * This file is part of the C standard library for the jsix operating + * system. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#include +#include + +unsigned long strtoul( const char * restrict nptr, char ** restrict endptr, int base ) +{ + assert(!"strtoul() NYI"); + return 0; +} diff --git a/src/libraries/libc/stdlib/strtoull.cpp b/src/libraries/libc/stdlib/strtoull.cpp new file mode 100644 index 0000000..6eeff9c --- /dev/null +++ b/src/libraries/libc/stdlib/strtoull.cpp @@ -0,0 +1,18 @@ +/** \file strtoull.cpp + * + * This file is part of the C standard library for the jsix operating + * system. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#include +#include + +unsigned long long strtoull( const char * restrict nptr, char ** restrict endptr, int base ) +{ + assert(!"strtoull() NYI"); + return 0; +} diff --git a/src/libraries/libc/string/memcmp.cpp b/src/libraries/libc/string/memcmp.cpp index 5aa7f47..f7d0984 100644 --- a/src/libraries/libc/string/memcmp.cpp +++ b/src/libraries/libc/string/memcmp.cpp @@ -23,3 +23,5 @@ int memcmp(const void *s1, const void *s2, size_t n) { return -1; } +extern "C" int bcmp(const void *s1, const void *s2, size_t n) + __attribute__ ((weak, alias ("memcmp"))); diff --git a/src/libraries/libc/wchar/swprintf.cpp b/src/libraries/libc/wchar/swprintf.cpp new file mode 100644 index 0000000..6c89cbc --- /dev/null +++ b/src/libraries/libc/wchar/swprintf.cpp @@ -0,0 +1,18 @@ +/** \file swprintf.cpp + * + * This file is part of the C standard library for the jsix operating + * system. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#include +#include + +int swprintf(wchar_t * restrict s, size_t n, const wchar_t * restrict format, ...) +{ + assert(!"swprintf() NYI"); + return 0; +} diff --git a/src/libraries/libc/wchar/wcslen.cpp b/src/libraries/libc/wchar/wcslen.cpp new file mode 100644 index 0000000..57e2c62 --- /dev/null +++ b/src/libraries/libc/wchar/wcslen.cpp @@ -0,0 +1,18 @@ +/** \file wcslen.cpp + * + * This file is part of the C standard library for the jsix operating + * system. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#include +#include + +size_t wcslen(const wchar_t * s) +{ + assert(!"wcslen() NYI"); + return 0; +} diff --git a/src/libraries/libc/wchar/wcstod.cpp b/src/libraries/libc/wchar/wcstod.cpp new file mode 100644 index 0000000..f21ef5a --- /dev/null +++ b/src/libraries/libc/wchar/wcstod.cpp @@ -0,0 +1,18 @@ +/** \file wcstod.cpp + * + * This file is part of the C standard library for the jsix operating + * system. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#include +#include + +double wcstod(const wchar_t * restrict nptr, wchar_t ** restrict endptr) +{ + assert(!"wcstod() NYI"); + return 0; +} diff --git a/src/libraries/libc/wchar/wcstof.cpp b/src/libraries/libc/wchar/wcstof.cpp new file mode 100644 index 0000000..fc3fda4 --- /dev/null +++ b/src/libraries/libc/wchar/wcstof.cpp @@ -0,0 +1,18 @@ +/** \file wcstof.cpp + * + * This file is part of the C standard library for the jsix operating + * system. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#include +#include + +float wcstof(const wchar_t * restrict nptr, wchar_t ** restrict endptr) +{ + assert(!"wcstof() NYI"); + return 0; +} diff --git a/src/libraries/libc/wchar/wcstol.cpp b/src/libraries/libc/wchar/wcstol.cpp new file mode 100644 index 0000000..9aace21 --- /dev/null +++ b/src/libraries/libc/wchar/wcstol.cpp @@ -0,0 +1,18 @@ +/** \file wcstol.cpp + * + * This file is part of the C standard library for the jsix operating + * system. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#include +#include + +long wcstol(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base) +{ + assert(!"wcstol() NYI"); + return 0; +} diff --git a/src/libraries/libc/wchar/wcstold.cpp b/src/libraries/libc/wchar/wcstold.cpp new file mode 100644 index 0000000..787e24f --- /dev/null +++ b/src/libraries/libc/wchar/wcstold.cpp @@ -0,0 +1,18 @@ +/** \file wcstold.cpp + * + * This file is part of the C standard library for the jsix operating + * system. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#include +#include + +long double wcstold(const wchar_t * restrict nptr, wchar_t ** restrict endptr) +{ + assert(!"wcstold() NYI"); + return 0; +} diff --git a/src/libraries/libc/wchar/wcstoll.cpp b/src/libraries/libc/wchar/wcstoll.cpp new file mode 100644 index 0000000..18167cc --- /dev/null +++ b/src/libraries/libc/wchar/wcstoll.cpp @@ -0,0 +1,18 @@ +/** \file wcstoll.cpp + * + * This file is part of the C standard library for the jsix operating + * system. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#include +#include + +long long wcstoll(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base) +{ + assert(!"wcstoll() NYI"); + return 0; +} diff --git a/src/libraries/libc/wchar/wcstoul.cpp b/src/libraries/libc/wchar/wcstoul.cpp new file mode 100644 index 0000000..93b5d88 --- /dev/null +++ b/src/libraries/libc/wchar/wcstoul.cpp @@ -0,0 +1,18 @@ +/** \file wcstoul.cpp + * + * This file is part of the C standard library for the jsix operating + * system. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#include +#include + +unsigned long wcstoul(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base) +{ + assert(!"wcstoul() NYI"); + return 0; +} diff --git a/src/libraries/libc/wchar/wcstoull.cpp b/src/libraries/libc/wchar/wcstoull.cpp new file mode 100644 index 0000000..a1c2b1d --- /dev/null +++ b/src/libraries/libc/wchar/wcstoull.cpp @@ -0,0 +1,18 @@ +/** \file wcstoull.cpp + * + * This file is part of the C standard library for the jsix operating + * system. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#include +#include + +unsigned long long wcstoull(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base) +{ + assert(!"wcstoull() NYI"); + return 0; +} diff --git a/src/libraries/libc/wchar/wmemchr.cpp b/src/libraries/libc/wchar/wmemchr.cpp new file mode 100644 index 0000000..f96f1d7 --- /dev/null +++ b/src/libraries/libc/wchar/wmemchr.cpp @@ -0,0 +1,18 @@ +/** \file wmemchr.cpp + * + * This file is part of the C standard library for the jsix operating + * system. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#include +#include + +wchar_t * wmemchr(const wchar_t * s, wchar_t c, size_t n) +{ + assert(!"wmemchr() NYI"); + return 0; +} diff --git a/src/libraries/libc/wchar/wmememp.cpp b/src/libraries/libc/wchar/wmememp.cpp new file mode 100644 index 0000000..0a3e706 --- /dev/null +++ b/src/libraries/libc/wchar/wmememp.cpp @@ -0,0 +1,18 @@ +/** \file wmemcmp.cpp + * + * This file is part of the C standard library for the jsix operating + * system. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#include +#include + +int wmemcmp(const wchar_t * s1, const wchar_t * s2, size_t n) +{ + assert(!"wmemcmp() NYI"); + return 0; +}