summaryrefslogtreecommitdiff
path: root/zap
diff options
context:
space:
mode:
Diffstat (limited to 'zap')
-rw-r--r--zap/GNUmakefile132
-rw-r--r--zap/include/zap/bs.d/flt.h20
-rw-r--r--zap/include/zap/bs.d/int.h173
-rw-r--r--zap/include/zap/bs.h50
-rw-r--r--zap/include/zap/bs.hh201
-rw-r--r--zap/include/zap/math.h76
-rw-r--r--zap/include/zap/math.hh91
-rw-r--r--zap/include/zap/mem.h26
-rw-r--r--zap/include/zap/mem.hh76
-rw-r--r--zap/include/zap/str.h49
-rw-r--r--zap/include/zap/str.hh33
-rw-r--r--zap/include/zap/sys.d/arch.h68
-rw-r--r--zap/include/zap/sys.d/attr.h35
-rw-r--r--zap/include/zap/sys.d/cmp.h66
-rw-r--r--zap/include/zap/sys.d/lang.h60
-rw-r--r--zap/include/zap/sys.d/os.h160
-rw-r--r--zap/include/zap/sys.h108
-rw-r--r--zap/include/zap/sys.hh18
-rw-r--r--zap/source/amd64/bs/trap.s10
-rw-r--r--zap/source/amd64/math/abs.s34
-rw-r--r--zap/source/amd64/mem/cp.s66
-rw-r--r--zap/source/amd64/mem/fill.s35
-rw-r--r--zap/source/amd64/sys/syscall.s27
-rw-r--r--zap/source/any/bs/trap.c14
-rw-r--r--zap/source/any/math/abs.cc13
-rw-r--r--zap/source/any/math/divmod.cc15
-rw-r--r--zap/source/any/mem/cp.c15
-rw-r--r--zap/source/any/mem/eq.c15
-rw-r--r--zap/source/any/mem/fill.c13
-rw-r--r--zap/source/any/mem/srch.c17
-rw-r--r--zap/source/any/str/fmt.cc43
-rw-r--r--zap/source/any/str/fmtlen.cc37
-rw-r--r--zap/source/any/str/numdig.hh12
-rw-r--r--zap/source/any/str/streq.c17
-rw-r--r--zap/source/any/str/strlen.c13
-rw-r--r--zap/source/any/str/utf8dec.c47
-rw-r--r--zap/source/any/str/utf8declen.c29
-rw-r--r--zap/source/any/str/utf8enc.c44
-rw-r--r--zap/source/any/str/utf8enclen.c29
-rw-r--r--zap/source/any/str/win1252dec.c107
-rw-r--r--zap/source/any/str/win1252enc.c109
-rw-r--r--zap/source/any/sys/syscall.c11
-rw-r--r--zap/source/arm/sys/syscall.s32
-rw-r--r--zap/source/arm64/sys/syscall.s26
-rw-r--r--zap/source/ia32/sys/syscall.s34
45 files changed, 0 insertions, 2306 deletions
diff --git a/zap/GNUmakefile b/zap/GNUmakefile
deleted file mode 100644
index 025f156..0000000
--- a/zap/GNUmakefile
+++ /dev/null
@@ -1,132 +0,0 @@
-# Copyright 2022-2023 Gabriel Jensen.
-# 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>.
-
-ifeq "$(arch)" ""
-arch := $(shell ../getarch.sh)
-ifeq "$(arch)" "unknown"
-$(error Unable to detect architecture!)
-endif
-$(info Detected architecture $(arch) !)
-endif
-
-ifeq "$(stdc)" ""
-stdc := c99
-endif
-
-ifeq "$(stdcxx)" ""
-stdcxx := c++14
-endif
-
-OBJ_BS_TRAP := source/any/bs/trap.o
-OBJ_MATH_ABS := source/any/math/abs.o
-OBJ_MATH_DIVMOD := source/any/math/divmod.o
-OBJ_MEM_CP := source/any/mem/cp.o
-OBJ_MEM_EQ := source/any/mem/eq.o
-OBJ_MEM_FILL := source/any/mem/fill.o
-OBJ_MEM_SRCH := source/any/mem/srch.o
-OBJ_STR_FMT := source/any/str/fmt.o
-OBJ_STR_FMTLEN := source/any/str/fmtlen.o
-OBJ_STR_STREQ := source/any/str/streq.o
-OBJ_STR_STRLEN := source/any/str/strlen.o
-OBJ_STR_UTF8DEC := source/any/str/utf8dec.o
-OBJ_STR_UTF8DECLEN := source/any/str/utf8declen.o
-OBJ_STR_UTF8ENC := source/any/str/utf8enc.o
-OBJ_STR_UTF8ENCLEN := source/any/str/utf8enclen.o
-OBJ_STR_WIN1252DEC := source/any/str/win1252dec.o
-OBJ_STR_WIN1252ENC := source/any/str/win1252enc.o
-OBJ_SYS_SYSCALL := source/any/sys/syscall.o
-
-ifeq "$(arch)" "amd64"
-OBJ_BS_TRAP := source/$(arch)/bs/trap.o
-OBJ_MEM_CP := source/$(arch)/mem/cp.o
-OBJ_MEM_FILL := source/$(arch)/mem/fill.o
-OBJ_SYS_SYSCALL := source/$(arch)/sys/syscall.o
-else ifeq "$(arch)" "arm"
-OBJ_SYS_SYSCALL := source/$(arch)/sys/syscall.o
-else ifeq "$(arch)" "arm64"
-OBJ_MEM_CP := source/$(arch)/mem/cp.o
-OBJ_SYS_SYSCALL := source/$(arch)/sys/syscall.o
-else ifeq "$(arch)" "ia32"
-OBJ_SYS_SYSCALL := source/$(arch)/sys/syscall.o
-endif
-
-OBJS := \
- $(OBJ_BS_TRAP) \
- $(OBJ_MATH_ABS) \
- $(OBJ_MATH_DIVMOD) \
- $(OBJ_MEM_CP) \
- $(OBJ_MEM_EQ) \
- $(OBJ_MEM_FILL) \
- $(OBJ_MEM_SRCH) \
- $(OBJ_STR_FMT) \
- $(OBJ_STR_FMTLEN) \
- $(OBJ_STR_STREQ) \
- $(OBJ_STR_STRLEN) \
- $(OBJ_STR_UTF8DEC) \
- $(OBJ_STR_UTF8DECLEN) \
- $(OBJ_STR_UTF8ENC) \
- $(OBJ_STR_UTF8ENCLEN) \
- $(OBJ_STR_WIN1252DEC) \
- $(OBJ_STR_WIN1252ENC)
-
-ifneq "$(nosyscall)" "true"
-OBJS := \
- $(OBJS) \
- $(OBJ_SYS_SYSCALL)
-endif
-
-LIB := libzap.a
-
-HDRS := \
- include/zap/bs.h \
- include/zap/math.h \
- include/zap/mem.h
-
-CFLAGS := \
- -Iinclude \
- -Oz \
- -Wall \
- -Wextra \
- -Wpedantic \
- -ffreestanding \
- -fshort-enums \
- -g \
- -nostdlib \
- -pipe \
- -std=$(stdc)
-
-CXXFLAGS := \
- -Iinclude \
- -Oz \
- -Wall \
- -Wextra \
- -Wpedantic \
- -ffreestanding \
- -fno-exceptions \
- -fshort-enums \
- -g \
- -nostdlib \
- -pipe \
- -std=$(stdcxx)
-
-.PHONY: clean install purge
-
-$(LIB): $(OBJS)
- $(AR) r $(@) $(^)
-
-install: $(LIB)
- mkdir -pm755 "$(HDRDIR)/zap/bs.d"
- mkdir -pm755 "$(HDRDIR)/zap/sys.d"
- mkdir -pm755 "$(LIBDIR)"
- install -m644 "include/zap/"*".h" "$(HDRDIR)/zap"
- install -m644 "include/zap/"*".hh" "$(HDRDIR)/zap"
- install -m644 "include/zap/bs.d/"*".h" "$(HDRDIR)/zap/bs.d"
- install -m644 "include/zap/sys.d/"*".h" "$(HDRDIR)/zap/sys.d"
- install -m755 "$(LIB)" "$(LIBDIR)"
-
-clean:
- $(RM) $(OBJS)
-
-purge: clean
- $(RM) $(LIB)
diff --git a/zap/include/zap/bs.d/flt.h b/zap/include/zap/bs.d/flt.h
deleted file mode 100644
index 4d65236..0000000
--- a/zap/include/zap/bs.d/flt.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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>.
-*/
-
-#if \
- zap_arch_amd64 \
-|| zap_arch_arm \
-|| zap_arch_arm64 \
-|| zap_arch_ia32
-#define zap_fixfltf02 (0x1)
-#define zap_fixfltf04 (0x1)
-
-typedef float zap_f02;
-typedef double zap_f04;
-#else
-#define zap_fixflt02 (0x0)
-#define zap_fixflt04 (0x0)
-#endif
diff --git a/zap/include/zap/bs.d/int.h b/zap/include/zap/bs.d/int.h
deleted file mode 100644
index 864a761..0000000
--- a/zap/include/zap/bs.d/int.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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>.
-*/
-
-#define zap_minvaluc ((unsigned char) +0x0u)
-#define zap_minvalus ((unsigned short) +0x0u)
-#define zap_minvalui ((unsigned int) +0x0u)
-#define zap_minvalul ((unsigned long) +0x0u)
-#define zap_minvalull ((unsigned long long)+0x0)
-#define zap_minvalsc ((signed char) -0x80)
-#define zap_minvals ((short) -0x8000)
-#define zap_minvali ((int) -0x80000000)
-#define zap_minvalll ((long long) -0x8000000000000000)
-
-#define zap_maxvaluc ((unsigned char) +0xFFu)
-#define zap_maxvalus ((unsigned short) +0xFFFFu)
-#define zap_maxvalui ((unsigned int) +0xFFFFFFFFu)
-#define zap_maxvalull ((unsigned long long)+0xFFFFFFFFFFFFFFFFu)
-#define zap_maxvalsc ((signed char) +0x7F)
-#define zap_maxvals ((short) +0x7FFF)
-#define zap_maxvali ((int) +0x7FFFFFFF)
-#define zap_maxvalll ((long long) +0x7FFFFFFFFFFFFFFF)
-
-#define zap_typid8 zap_typidc
-#define zap_minval8 zap_minvaluc
-#define zap_minval8s zap_minvalsc
-#define zap_maxval8 zap_maxvaluc
-#define zap_maxval8s zap_maxvalsc
-typedef unsigned char zap_i8;
-typedef signed char zap_i8s;
-
-#define zap_typid01 zap_typids
-#define zap_minval01 zap_minvalus
-#define zap_minval01s zap_minvals
-#define zap_maxval01 zap_maxvalus
-#define zap_maxval01s zap_maxvals
-typedef unsigned short zap_i01;
-typedef short zap_i01s;
-
-#define zap_typid02 zap_typid
-#define zap_minval02 zap_minvalui
-#define zap_minval02s zap_minvali
-#define zap_maxval02 zap_maxvalui
-#define zap_maxval02s zap_maxvali
-typedef unsigned int zap_i02;
-typedef int zap_i02s;
-
-#if \
- zap_os_dos \
-|| zap_os_os2 \
-|| zap_os_win
-
-#define zap_minvall ((long long) -0x80000000)
-#define zap_maxvalul ((unsigned long long)+0xFFFFFFFFu)
-#define zap_maxvall ((long long) +0x7FFFFFFF)
-
-#define zap_typid04 zap_typidll
-#define zap_minval04 zap_minvalull
-#define zap_minval04s zap_minvalll
-#define zap_maxval04 zap_maxvalull
-#define zap_maxval04s zap_maxvalll
-typedef unsigned long long zap_i04;
-typedef long long zap_i04s;
-
-#else
-#if \
- zap_arch_amd64 \
-|| zap_arch_arm64
-#define zap_minvall ((long long) -0x8000000000000000)
-#define zap_maxvalul ((unsigned long long)+0xFFFFFFFFFFFFFFFFu)
-#define zap_maxvall ((long long) +0x7FFFFFFFFFFFFFFF)
-
-#define zap_typid04 zap_typidl
-#define zap_minval04 zap_minvalul
-#define zap_minval04s zap_minvall
-#define zap_maxval04 zap_maxvalul
-#define zap_maxval04s zap_maxvall
-typedef unsigned long zap_i04;
-typedef long zap_i04s;
-
-#elif \
- zap_arch_arm \
-|| zap_arch_ia32
-#define zap_minvall ((long long) -0x80000000)
-#define zap_maxvalul ((unsigned long long)+0xFFFFFFFFu)
-#define zap_maxvall ((long long) +0x7FFFFFFF)
-
-#define zap_typid04 zap_typidl
-#define zap_minval04 zap_minvalul
-#define zap_minval04s zap_minvall
-#define zap_maxval04 zap_maxvalul
-#define zap_maxval04s zap_maxvall
-typedef unsigned long zap_i04;
-typedef long zap_i04s;
-
-#endif
-#endif
-
-#if \
- zap_arch_arm \
-|| zap_arch_arm64
-#define zap_uchr (0x1)
-#else
-#define zap_uchr (0x0)
-#endif
-
-#if zap_uchr
-#define zap_minvalc zap_minvaluc
-#define zap_maxvalc zap_maxvaluc
-#else
-#define zap_minvalc zap_minvalsc
-#define zap_maxvalc zap_maxvalsc
-#endif
-
-#if \
- zap_arch_amd64 \
-|| zap_arch_arm64
-
-#define zap_typidp zap_typid04
-#define zap_minvalp zap_minval04
-#define zap_maxvalp zap_maxval04
-typedef zap_i04 zap_ptr;
-
-#define zap_typidsz zap_typid04
-#define zap_minvalsz zap_minval04
-#define zap_maxvalsz zap_maxval04
-typedef zap_i04 zap_sz;
-
-#elif \
- zap_arch_arm
-|| zap_arch_ia32
-
-#define zap_typidp zap_typid02
-#define zap_minvalp zap_minval02
-#define zap_maxvalp zap_maxval02
-typedef zap_i02 zap_ptr;
-
-#define zap_typidsz zap_typid02
-#define zap_minvalsz zap_minval02
-#define zap_maxvalsz zap_maxval02
-typedef zap_i02 zap_sz;
-
-#endif
-
-#if \
- zap_os_dos \
-|| zap_os_os2 \
-|| zap_os_win
-
-#define zap_typidwc zap_typid01
-#define zap_minvalwc zap_minval01
-#define zap_maxvalwc zap_maxval01
-typedef zap_i01 zap_wchr;
-
-#else
-#if zap_uchr
-
-#define zap_typidwc zap_typid02
-#define zap_minvalwc zap_minval02
-#define zap_maxvalwc zap_maxval02
-typedef zap_i02 zap_wchr;
-
-#else
-
-#define zap_typidwc zap_typid02
-#define zap_minvalwc zap_minval02s
-#define zap_maxvalwc zap_maxval02s
-typedef zap_i02s zap_wchr;
-
-#endif
-#endif
diff --git a/zap/include/zap/bs.h b/zap/include/zap/bs.h
deleted file mode 100644
index 482f20d..0000000
--- a/zap/include/zap/bs.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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>.
-*/
-
-#ifndef zap_priv_hdr_bs
-#define zap_priv_hdr_bs
-
-// C99: long long
-
-#include <zap/sys.h>
-
-zap_priv_cdecl
-
-#define zap_ver ((unsigned long)+0x1Bu) // Programs expecting this version will still compile with the current extension version.
-#define zap_extver ((unsigned long)+0x0u) // The extension versions adds functionality without breaking the existing ones.
- // The patch version is not public as it only changes implementation details.
-
-#define zap_typid_c ((unsigned char)+0x0u)
-#define zap_typid_s ((unsigned char)+0x1u)
-#define zap_typid_i ((unsigned char)+0x2u)
-#define zap_typid_l ((unsigned char)+0x3u)
-#define zap_typid_ll ((unsigned char)+0x4u)
-#define zap_typid_f ((unsigned char)+0x5u)
-#define zap_typid_d ((unsigned char)+0x6u)
-#define zap_typid_ld ((unsigned char)+0x7u)
-
-#include <zap/bs.d/int.h>
-#include <zap/bs.d/flt.h>
-
-#define zap_nopos zap_maxvalsz
-
-#define zap_nullptr ((void *)0x0)
-
-#define zap_bytelen ((zap_sz)+0x8u)
-
-zap_noret void zap_trap(void);
-
-#if zap_cmp_gcc
-#define zap_unreach() ((void)__builtin_unreachable())
-#elif zap_cmp_msvc
-#define zap_unreach() ((void)__assume(0x0))
-#else
-#define zap_unreach() (zap_trap())
-#endif
-
-zap_priv_cdeclend
-
-#endif
diff --git a/zap/include/zap/bs.hh b/zap/include/zap/bs.hh
deleted file mode 100644
index 00f66b1..0000000
--- a/zap/include/zap/bs.hh
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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>.
-*/
-
-#ifndef zap_priv_cxxhdr_bs
-#define zap_priv_cxxhdr_bs
-
-// C++11: constexpr
-// C++14: template variables
-
-#ifndef __cplusplus
-#error C++ header included from C!
-#endif
-
-#include <zap/sys.hh>
-#include <zap/bs.h>
-
-namespace zap {
- namespace impl {
- template<typename typ> struct minval {constexpr static typ val = {};};
-
- template<> struct minval<bool> {constexpr static auto val = false;};
- template<> struct minval<signed char> {constexpr static auto val = zap_minvalsc;};
- template<> struct minval<short> {constexpr static auto val = zap_minvals;};
- template<> struct minval<int> {constexpr static auto val = zap_minvali;};
- template<> struct minval<long> {constexpr static auto val = zap_minvall;};
- template<> struct minval<long long> {constexpr static auto val = zap_minvalll;};
- template<> struct minval<unsigned char> {constexpr static auto val = zap_minvaluc;};
- template<> struct minval<unsigned short> {constexpr static auto val = zap_minvalus;};
- template<> struct minval<unsigned int> {constexpr static auto val = zap_minvalui;};
- template<> struct minval<unsigned long> {constexpr static auto val = zap_minvalul;};
- template<> struct minval<unsigned long long> {constexpr static auto val = zap_minvalull;};
- template<> struct minval<char> {constexpr static auto val = zap_minvalc;};
- template<> struct minval<wchar_t> {constexpr static auto val = zap_minvalwc;};
-#if __cpp_char8_t >= 201811
- template<> struct minval<char8_t> {constexpr static auto val = zap_minvaluc;};
-#endif
- template<> struct minval<char16_t> {constexpr static auto val = zap_minval01;};
- template<> struct minval<char32_t> {constexpr static auto val = zap_minval02;};
-
- template<typename typ> struct maxval {constexpr static typ val = {};};
-
- template<> struct maxval<bool> {constexpr static auto val = true;};
- template<> struct maxval<signed char> {constexpr static auto val = zap_maxvalsc;};
- template<> struct maxval<int> {constexpr static auto val = zap_maxvali;};
- template<> struct maxval<short> {constexpr static auto val = zap_maxvals;};
- template<> struct maxval<long> {constexpr static auto val = zap_maxvall;};
- template<> struct maxval<long long> {constexpr static auto val = zap_maxvalll;};
- template<> struct maxval<unsigned char> {constexpr static auto val = zap_maxvaluc;};
- template<> struct maxval<unsigned short> {constexpr static auto val = zap_maxvalus;};
- template<> struct maxval<unsigned int> {constexpr static auto val = zap_maxvalui;};
- template<> struct maxval<unsigned long> {constexpr static auto val = zap_maxvalul;};
- template<> struct maxval<unsigned long long> {constexpr static auto val = zap_maxvalull;};
- template<> struct maxval<char> {constexpr static auto val = zap_maxvalc;};
- template<> struct maxval<wchar_t> {constexpr static auto val = zap_maxvalwc;};
-#if __cpp_char8_t >= 201811
- template<> struct maxval<char8_t> {constexpr static auto val = zap_maxvaluc;};
-#endif
- template<> struct maxval<char16_t> {constexpr static auto val = zap_maxval01;};
- template<> struct maxval<char32_t> {constexpr static auto val = zap_maxval02;};
- }
-
- template<typename typ> constexpr auto minval = ::zap::impl::minval<typ>::val;
-
- template<typename typ> constexpr auto maxval = ::zap::impl::maxval<typ>::val;
-}
-
-namespace zap {
- namespace impl {
- template<typename ityp> struct sign {using typ = ityp;};
-
- template<> struct sign<unsigned char> {using typ = signed char;};
- template<> struct sign<unsigned int> {using typ = int;};
- template<> struct sign<unsigned long> {using typ = long;};
- template<> struct sign<unsigned long long> {using typ = long long;};
- template<> struct sign<unsigned short> {using typ = short;};
-
- template<typename ityp> struct usign {using typ = ityp;};
-
- template<> struct usign<signed char> {using typ = unsigned char;};
- template<> struct usign<int> {using typ = unsigned int;};
- template<> struct usign<long> {using typ = unsigned long;};
- template<> struct usign<long long> {using typ = unsigned long long;};
- template<> struct usign<short> {using typ = unsigned short;};
- }
-
- template<typename typ> using sign = typename ::zap::impl::sign<typ>::typ;
-
- template<typename typ> using usign = typename ::zap::impl::usign<typ>::typ;
-}
-
-namespace zap {
- namespace impl {
- template<typename ityp> struct remqual {using typ = ityp;};
-
- template<typename ityp> struct remqual<ityp const> {using typ = ityp;};
- template<typename ityp> struct remqual<ityp volatile> {using typ = ityp;};
- template<typename ityp> struct remqual<ityp const volatile> {using typ = ityp;};
- }
-
- template<typename typ> using remqual = typename ::zap::impl::remqual<typ>::typ;
-}
-
-namespace zap {
- namespace impl {
- template<typename ltyp,typename rtyp> struct typeq {constexpr static bool eq = false;};
-
- template<typename typ> struct typeq<typ,typ> {constexpr static auto eq = true;};
- }
-
- template<typename ltyp,typename rtyp> constexpr auto typeq = ::zap::impl::typeq<ltyp,rtyp>::eq;
-}
-
-namespace zap {
- template<typename typ> constexpr auto ischrtyp =
- ::zap::typeq<typ,char>
- || ::zap::typeq<typ,char16_t>
- || ::zap::typeq<typ,char32_t>
-#if __cpp_char8_t
- || ::zap::typeq<typ,char8_t>
-#endif
- || ::zap::typeq<typ,unsigned char>
- || ::zap::typeq<typ,wchar_t>;
-
- template<typename typ> constexpr auto isflttyp =
- ::zap::typeq<typ,double>
- || ::zap::typeq<typ,float>
- || ::zap::typeq<typ,long double>
-#if __STDCPP_BFLOAT16_T__
- || ::zap::typeq<typ,decltype (0x0.0p0bf16)>
-#endif
-#if __STDCPP_FLOAT128_T__
- || ::zap::typeq<typ,decltype (0x0.0p0f16)>
-#endif
-#if __STDCPP_FLOAT16_T__
- || ::zap::typeq<typ,decltype (0x0.0p0f32)>
-#endif
-#if __STDCPP_FLOAT32_T__
- || ::zap::typeq<typ,decltype (0x0.0p0f64)>
-#endif
-#if __STDCPP_FLOAT64_T__
- || ::zap::typeq<typ,decltype (0x0.0p0f128)>
-#endif
- ;
-
- template<typename typ> constexpr auto isinttyp =
- ::zap::typeq<typ,int>
- || ::zap::typeq<typ,long>
- || ::zap::typeq<typ,long long>
- || ::zap::typeq<typ,short>
- || ::zap::typeq<typ,signed char>
- || ::zap::typeq<typ,unsigned char>
- || ::zap::typeq<typ,unsigned int>
- || ::zap::typeq<typ,unsigned long>
- || ::zap::typeq<typ,unsigned long long>
- || ::zap::typeq<typ,unsigned short>;
-
- template<typename typ> constexpr auto isarithtyp =
- ::zap::isflttyp<typ>
- || ::zap::isinttyp<typ>;
-}
-
-namespace zap {
- using i8 = ::zap_i8;
- using i8s = ::zap_i8s;
-
- using i01 = ::zap_i01;
- using i01s = ::zap_i01s;
-
- using i02 = ::zap_i02;
- using i02s = ::zap_i02s;
-
- using i04 = ::zap_i04;
- using i04s = ::zap_i04s;
-
- using ptr = ::zap_ptr;
- using sz = ::zap_sz;
-
-#if zap_fixflt02
- using f02 = ::zap_f02;
-#endif
-#if zap_fixflt04
- using f04 = ::zap_f04;
-#endif
-}
-
-namespace zap {
- constexpr auto ver = zap_ver;
- constexpr auto bytelen = zap_bytelen;
- constexpr auto nopos = zap_nopos;
-}
-
-namespace zap {
- [[noreturn]] zap_attr_iln inline void trap() noexcept {::zap_trap();}
-
- [[noreturn]] zap_attr_iln inline void unreach() noexcept {zap_unreach();}
-}
-
-#endif
diff --git a/zap/include/zap/math.h b/zap/include/zap/math.h
deleted file mode 100644
index f90116c..0000000
--- a/zap/include/zap/math.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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>.
-*/
-
-#ifndef zap_priv_hdr_math
-#define zap_priv_hdr_math
-
-#include <zap/bs.h>
-
-zap_priv_cdecl
-
-typedef struct {
- signed char lval;
- signed char rval;
-} zap_pairsc;
-
-typedef struct {
- short lval;
- short rval;
-} zap_pairs;
-
-typedef struct {
- int lval;
- int rval;
-} zap_pairi;
-
-typedef struct {
- long lval;
- long rval;
-} zap_pairl;
-
-typedef struct {
- long long lval;
- long long rval;
-} zap_pairll;
-
-zap_attr_nthrw zap_attr_unseq zap_pairsc zap_divmodsc(signed char num,signed char den);
-zap_attr_nthrw zap_attr_unseq zap_pairs zap_divmods( short num,short den);
-zap_attr_nthrw zap_attr_unseq zap_pairi zap_divmodi( int num,int den);
-zap_attr_nthrw zap_attr_unseq zap_pairl zap_divmodl( long num,long den);
-zap_attr_nthrw zap_attr_unseq zap_pairll zap_divmodll(long long num,long long den);
-zap_attr_nthrw zap_attr_unseq zap_pairsc zap_divmodsc(signed char num,signed char den);
-zap_attr_nthrw zap_attr_unseq zap_pairs zap_divmods( short num,short den);
-zap_attr_nthrw zap_attr_unseq zap_pairi zap_divmodi( int num,int den);
-zap_attr_nthrw zap_attr_unseq zap_pairl zap_divmodl( long num,long den);
-zap_attr_nthrw zap_attr_unseq zap_pairll zap_divmodll(long long num,long long den);
-
-zap_attr_nthrw zap_attr_unseq float zap_absf( float val);
-zap_attr_nthrw zap_attr_unseq double zap_absd( double val);
-zap_attr_nthrw zap_attr_unseq long double zap_absld(long double val);
-
-zap_attr_nthrw zap_attr_unseq float zap_cosf( float ang);
-zap_attr_nthrw zap_attr_unseq double zap_cosd( double ang);
-zap_attr_nthrw zap_attr_unseq long double zap_cosld(long double ang);
-
-zap_attr_nthrw zap_attr_unseq float zap_sinf( float ang);
-zap_attr_nthrw zap_attr_unseq double zap_sind( double ang);
-zap_attr_nthrw zap_attr_unseq long double zap_sinld(long double ang);
-
-zap_attr_nthrw zap_attr_unseq float zap_sqrtf( float val);
-zap_attr_nthrw zap_attr_unseq double zap_sqrtd( double val);
-zap_attr_nthrw zap_attr_unseq long double zap_sqrtld(long double val);
-
-zap_attr_nthrw zap_attr_unseq float zap_rootf( float val,float n);
-zap_attr_nthrw zap_attr_unseq double zap_rootd( double val,double n);
-zap_attr_nthrw zap_attr_unseq long double zap_rootld(long double val,long double n);
-
-zap_attr_nthrw zap_attr_unseq float zap_tanf( float ang);
-zap_attr_nthrw zap_attr_unseq double zap_tand( double ang);
-zap_attr_nthrw zap_attr_unseq long double zap_tanld(long double ang);
-
-zap_priv_cdeclend
-
-#endif
diff --git a/zap/include/zap/math.hh b/zap/include/zap/math.hh
deleted file mode 100644
index ae159c8..0000000
--- a/zap/include/zap/math.hh
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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>.
-*/
-
-#ifndef zap_priv_cxxhdr_math
-#define zap_priv_cxxhdr_math
-
-#include <zap/bs.hh>
-#include <zap/math.h>
-
-namespace zap {
- namespace impl {
- template<typename typ> struct inf {constexpr static auto val = ::zap::maxval<typ>;};
-
-#if zap_priv_hasbuiltin(__builtin_huge_valf)
- template<> struct inf<float> {constexpr static auto val = __builtin_huge_valf();};
-#endif
-
-#if zap_priv_hasbuiltin(__builtin_huge_val)
- template<> struct inf<double> {constexpr static auto val = __builtin_huge_val();};
-#endif
-
-#if zap_priv_hasbuiltin(__builtin_huge_vall)
- template<> struct inf<long double> {constexpr static auto val = __builtin_huge_vall();};
-#endif
- }
-
- template<typename typ> constexpr auto inf = ::zap::impl::inf<typ>::val;
-}
-
-namespace zap {
- namespace impl {
- template<typename ityp> struct cpairtyp {using typ = ityp;};
-
- template<> struct cpairtyp<signed char> {using typ = ::zap_pairsc;};
- template<> struct cpairtyp<short> {using typ = ::zap_pairs;};
- template<> struct cpairtyp<int> {using typ = ::zap_pairi;};
- template<> struct cpairtyp<long> {using typ = ::zap_pairl;};
- template<> struct cpairtyp<long long> {using typ = ::zap_pairll;};
- }
-
- template<typename typ> class pair {
- public:
- using cpairtyp = typename ::zap::impl::cpairtyp<typ>::typ;
-
- typ lval;
- typ rval;
-
- constexpr auto cpair() noexcept -> cpairtyp {
- cpairtyp pair;
- pair.lval = this->lval;
- pair.rval = this->rval;
- return pair;
- }
- };
-}
-
-namespace zap {
- template<typename typ> constexpr auto abs(typ const val) noexcept -> ::zap::usign<typ> {
- using newtyp = ::zap::usign<typ>; // If a floating-point type was used, the new type would be identical.
- if (val > typ {0x0}) return static_cast<newtyp>(val);
- return typ {0x0} - static_cast<newtyp>(val);
- }
-
- template<typename typ> constexpr auto divmod(typ const num,typ const den) noexcept -> ::zap::pair<typ> {
- ::zap::pair<typ> pair;
- zap_priv_ulikly (den == 0x0) {
- pair.lval = ::zap::inf<typ>;
- pair.rval = pair.lval;
- return pair;
- }
- for (pair = ::zap::pair<typ> {typ {0x0},num};pair.rval >= den;++pair.lval,pair.rval -= den);
- return pair;
- }
-
- template<typename typ> constexpr auto exp(typ const val,typ const n) noexcept -> typ {
- zap_priv_ulikly (n == typ {0x0}) {
- return typ {0x1};
- }
- zap_priv_ulikly (val == typ {0x0}) {
- return typ {0x0};
- }
- typ exp = val;
- for (typ i = typ {0x1};i < n;++i) exp *= val;
- return exp;
- }
-}
-
-#endif
diff --git a/zap/include/zap/mem.h b/zap/include/zap/mem.h
deleted file mode 100644
index 0364b9d..0000000
--- a/zap/include/zap/mem.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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>.
-*/
-
-#ifndef zap_priv_hdr_mem
-#define zap_priv_hdr_mem
-
-#include <zap/bs.h>
-
-zap_priv_cdecl
-
-typedef struct {
- void * dest;
- void * src;
-} zap_cpret;
-
-zap_attr_nthrw zap_cpret zap_cp( void * zap_restr dest,void const * zap_restr src, zap_sz num);
-zap_attr_nthrw zap_i8 zap_eq( void const * lbuf,void const * rbuf,zap_sz num);
-zap_attr_nthrw void zap_fill(void * dest,unsigned char val, zap_sz num);
-zap_attr_nthrw void * zap_srch(void const * buf, unsigned char val, zap_sz num);
-
-zap_priv_cdeclend
-
-#endif
diff --git a/zap/include/zap/mem.hh b/zap/include/zap/mem.hh
deleted file mode 100644
index b237cbc..0000000
--- a/zap/include/zap/mem.hh
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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>.
-*/
-
-#ifndef zap_priv_cxxhdr_mem
-#define zap_priv_cxxhdr_mem
-
-#include <zap/bs.hh>
-#include <zap/mem.h>
-
-namespace zap {
- template<typename desttyp,typename srctyp> struct cpret {
- desttyp * dest;
- srctyp * src;
- };
-}
-
-namespace zap {
- template<typename desttyp,typename srctyp> zap_attr_iln inline ::zap::cpret<desttyp,srctyp> bytecp(desttyp * zap_restr dest,srctyp const * zap_restr src,::zap::sz const num) noexcept {
- ::zap_cpret const cpret = ::zap_cp(dest,src,num);
-
- return ::zap::cpret<desttyp,srctyp> {.dest = static_cast<desttyp *>(cpret.dest),.src = static_cast<srctyp *>(cpret.src),};
- }
-
- template<typename ltyp,typename rtyp> zap_attr_iln inline bool byteeq(ltyp const * lbuf,rtyp const * rbuf,::zap::sz const num) noexcept {
- return ::zap_eq(lbuf,rbuf,num);
- }
-
- template<typename typ> zap_attr_iln inline void bytefill(typ * dest,unsigned char const val,::zap::sz const num) noexcept {
- ::zap_fill(dest,val,num);
- }
-
- template<typename typ> zap_attr_iln inline typ * bytesrch(typ * buf,unsigned char const val,::zap::sz const num) noexcept {
- return const_cast<typ *>(static_cast<::zap::remqual<typ> *>(::zap_srch(buf,val,num)));
- }
-}
-
-namespace zap {
- template<typename typ> constexpr ::zap::cpret<typ,typ> cp(typ * zap_restr dest,typ const * zap_restr src,::zap::sz const num) noexcept {
- zap_priv_ifnconsteval {return ::zap::bytecp(dest,src,num);}
-
- typ * const zap_restr stop = dest + num;
- while (dest != stop) *dest++ = *src++;
-
- return ::zap::cpret<typ,typ> {.dest = dest,.src = const_cast<typ *>(src),};
- }
-
- template<typename typ> constexpr bool eq(typ const * lbuf,typ const * rbuf,::zap::sz const num) noexcept {
- typ const * const stop = lbuf + num;
-
- while (lbuf != stop) if (*lbuf++ != *rbuf++) return false;
-
- return true;
- }
-
- template<typename typ> constexpr void fill(typ * dest,typ const val,::zap::sz const num) noexcept {
- typ * const stop = dest + num;
-
- while (dest != stop) *dest++ = val;
- }
-
- template<typename typ> constexpr typ * srch(typ * buf,unsigned char const val,::zap::sz const num) noexcept {
- typ const * const stop = buf + num;
-
- while (buf != stop) {
- typ const * addr = buf++;
- if (*addr == val) return addr;
- }
-
- return nullptr;
- }
-}
-
-#endif
diff --git a/zap/include/zap/str.h b/zap/include/zap/str.h
deleted file mode 100644
index a4c75fb..0000000
--- a/zap/include/zap/str.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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>.
-*/
-
-#ifndef zap_priv_hdr_str
-#define zap_priv_hdr_str
-
-#include <zap/bs.h>
-
-zap_priv_cdecl
-
-zap_i8 zap_streq( char const * lstr,char const * rstr);
-zap_sz zap_strlen(char const * str);
-
-zap_sz zap_utf8declen(zap_i8 const * buf);
-zap_sz zap_utf8enclen(zap_i02 const * buf);
-
-void zap_utf8dec( zap_i02 * zap_restr dest,zap_i8 const * zap_restr src);
-void zap_utf8enc( zap_i8 * zap_restr dest,zap_i02 const * zap_restr src);
-void zap_win1252dec(zap_i02 * zap_restr dest,zap_i8 const * zap_restr src);
-void zap_win1252enc(zap_i8 * zap_restr dest,zap_i02 const * zap_restr src);
-
-void zap_fmti( zap_i02 * buf,int val,zap_i8 bs,zap_i8 rtl);
-void zap_fmtl( zap_i02 * buf,long val,zap_i8 bs,zap_i8 rtl);
-void zap_fmtll( zap_i02 * buf,long long val,zap_i8 bs,zap_i8 rtl);
-void zap_fmts( zap_i02 * buf,short val,zap_i8 bs,zap_i8 rtl);
-void zap_fmtsc( zap_i02 * buf,signed char val,zap_i8 bs,zap_i8 rtl);
-void zap_fmtuc( zap_i02 * buf,unsigned char val,zap_i8 bs,zap_i8 rtl);
-void zap_fmtui( zap_i02 * buf,unsigned int val,zap_i8 bs,zap_i8 rtl);
-void zap_fmtul( zap_i02 * buf,unsigned long val,zap_i8 bs,zap_i8 rtl);
-void zap_fmtull(zap_i02 * buf,unsigned long long val,zap_i8 bs,zap_i8 rtl);
-void zap_fmtus( zap_i02 * buf,unsigned short val,zap_i8 bs,zap_i8 rtl);
-
-zap_i8 zap_fmtleni( int val,zap_i8 bs);
-zap_i8 zap_fmtlenl( long val,zap_i8 bs);
-zap_i8 zap_fmtlenll( long long val,zap_i8 bs);
-zap_i8 zap_fmtlens( short val,zap_i8 bs);
-zap_i8 zap_fmtlensc( signed char val,zap_i8 bs);
-zap_i8 zap_fmtlenuc( unsigned char val,zap_i8 bs);
-zap_i8 zap_fmtlenui( unsigned int val,zap_i8 bs);
-zap_i8 zap_fmtlenul( unsigned long val,zap_i8 bs);
-zap_i8 zap_fmtlenull(unsigned long long val,zap_i8 bs);
-zap_i8 zap_fmtlenus( unsigned short val,zap_i8 bs);
-
-zap_priv_cdeclend
-
-#endif
diff --git a/zap/include/zap/str.hh b/zap/include/zap/str.hh
deleted file mode 100644
index 288ca07..0000000
--- a/zap/include/zap/str.hh
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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>.
-*/
-
-#ifndef zap_priv_cxxhdr_str
-#define zap_priv_cxxhdr_str
-
-#include <zap/bs.hh>
-#include <zap/str.h>
-
-namespace zap {
- template<typename typ> constexpr auto streq(typ const * lstr,typ const * rstr) noexcept -> bool {
- static_assert(::zap::ischrtyp<typ>,"Input type must be a character type.");
- for (;;++lstr,++rstr) {
- typ const lchr = *lstr;
- typ const rchr = *rstr;
- if (lchr != rchr) return false;
- if (lchr == typ {0x0}) break;
- }
- return true;
- }
-
- template<typename typ> constexpr auto strlen(typ const * str) noexcept -> ::zap::sz {
- static_assert(::zap::ischrtyp<typ>,"Input type must be a character type.");
- typ const * const start = str;
- while (*str++ != typ {0x0});
- return static_cast<::zap::sz>(str - start) - 0x1u;
- }
-}
-
-#endif
diff --git a/zap/include/zap/sys.d/arch.h b/zap/include/zap/sys.d/arch.h
deleted file mode 100644
index 2abd2b2..0000000
--- a/zap/include/zap/sys.d/arch.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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>.
-*/
-
-/*
- arch- macro-------- vendors-----------------------------------
- clang cray gcc icc icx msvc pcc tiny watcom xlc
-
- amd64 __amd64 clang gcc pcc
- amd64 __amd64__ clang gcc pcc
- amd64 __x86_64 clang gcc icc icx pcc
- amd64 __x86_64__ clang gcc icc icx pcc tiny
- amd64 _M_AMD64 icc msvc
- amd64 _M_X64 icc icx msvc
-
- arm __arm clang
- arm __arm__ clang gcc
- arm _M_ARM msvc
-
- arm64 __aarch64__ clang gcc
- arm64 _M_ARM64 msvc
-
- ia32 __386__ watcom
- ia32 __I86__ watcom
- ia32 __X86__ watcom
- ia32 __i386 clang gcc icc icx
- ia32 __i386__ clang gcc icc icx
- ia32 _M_I386 watcom
- ia32 _M_I86 watcom
- ia32 _M_IX86 icc icx msvc watcom
-*/
-
-#if \
- defined(__amd64) \
-|| defined(__amd64__) \
-|| defined(__x86_64) \
-|| defined(__x86_64__) \
-|| defined(_M_AMD64) \
-|| defined(_M_X64)
-#define zap_arch_amd64 (0x1)
-#endif
-
-#if \
- defined(__arm) \
-|| defined(__arm__) \
-|| defined(_M_ARM)
-#define zap_arch_arm (0x1)
-#endif
-
-#if \
- defined(__aarch64__) \
-|| defined(_M_ARM64)
-#define zap_arch_arm64
-#endif
-
-#if \
- defined(__386__) \
-|| defined(__I86__) \
-|| defined(__X86__) \
-|| defined(__i386) \
-|| defined(__i386__) \
-|| defined(_M_I386) \
-|| defined(_M_I86) \
-|| defined(_M_IX86)
-#define zap_arch_ia32
-#endif
diff --git a/zap/include/zap/sys.d/attr.h b/zap/include/zap/sys.d/attr.h
deleted file mode 100644
index 4c4a268..0000000
--- a/zap/include/zap/sys.d/attr.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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>.
-*/
-
-#if zap_priv_hasattr(__always_inline__)
-#define zap_attr_iln __attribute__ ((__always_inline__))
-#else
-#define zap_attr_iln
-#endif
-
-#if zap_priv_hasattr(__nothrow__)
-#define zap_attr_nthrw __attribute__ ((__nothrow__))
-#elif zap_cmp_msvc
-#define zap_attr_nthrw __declspec (nothrow)
-#else
-#define zap_attr_nthrw
-#endif
-
-#if zap_priv_hasattr(__const__)
-#define zap_attr_unseq __attribute__ ((__const__))
-#elif zap_lang_c23
-#define zap_attr_unseq [[unsequenced]]
-#else
-#define zap_attr_unseq
-#endif
-
-#if zap_priv_hasattr(__unused__)
-#define zap_attr_unuse __attribute__ ((__unused__))
-#elif zap_lang_c23 || zap_lang_cxx11
-#define zap_attr_unuse [[maybe_unused]]
-#else
-#define zap_attr_unuse
-#endif
diff --git a/zap/include/zap/sys.d/cmp.h b/zap/include/zap/sys.d/cmp.h
deleted file mode 100644
index efc6126..0000000
--- a/zap/include/zap/sys.d/cmp.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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>.
-*/
-
-#if \
- defined(__clang__) \
-|| defined(__llvm__)
-#define zap_cmp_clang (0x1)
-#endif
-
-#if \
- defined(_CRAYC)
-#define zap_cmp_cray (0x1)
-#endif
-
-#if \
- defined(__GNUC__)
-#define zap_cmp_gcc (0x1)
-#endif
-
-#if \
- defined(__EDG__)
-#define zap_cmp_edg (0x1)
-#endif
-
-#if \
- defined(__ICC) \
-|| defined(__ICL) \
-|| defined(__INTEL_COMPILER)
-#define zap_cmp_icc (0x1)
-#endif
-
-#if \
- defined(__INTEL_LLVM_COMPILER)
-#define zap_icx (0x1)
-#endif
-
-#if \
- defined(_MSC_VER)
-#define zap_cmp_msvc (0x1)
-#endif
-
-#if \
- defined(__open_xl__)
-#define zap_cmp_xlc (0x1)
-#endif
-
-#if \
- defined(__VAX11C) \
-|| defined(__VAXC) \
-|| defined(__vax11c) \
-|| defined(__vaxc)
-#define zap_cmp_vsi (0x1)
-#endif
-
-#if \
- defined(__WATCOMC__)
-#define zap_cmp_watcom (0x1)
-#endif
-
-#if \
- defined(__TINYC__)
-#define zap_cmp_tiny (0x1)
-#endif
diff --git a/zap/include/zap/sys.d/lang.h b/zap/include/zap/sys.d/lang.h
deleted file mode 100644
index c7157e5..0000000
--- a/zap/include/zap/sys.d/lang.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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>.
-*/
-
-#ifdef __cplusplus
-
-#define zap_lang_cxx89 (0x1)
-
-#if __cplusplus >= 199711
-#define zap_lang_cxx99 (0x1)
-
-#if __cplusplus >= 201103
-#define zap_lang_cxx11 (0x1)
-
-#if __cplusplus >= 201402
-#define zap_lang_cxx14 (0x1)
-
-#if __cplusplus >= 201703
-#define zap_lang_cxx17 (0x1)
-
-#if __cplusplus >= 202002
-#define zap_lang_cxx20 (0x1)
-
-#if __cplusplus > 202002
-#define zap_lang_cxx23 (0x1)
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-
-#else
-
-#define zap_lang_c90 (0x1)
-
-#if __STDC_VERSION__ >= 199409
-#define zap_lang_c95 (0x1)
-
-#if zap_lang_c99
-#define zap_lang_c99 (0x1)
-
-#if __STDC_VERSION__ >= 201112
-#define zap_lang_c11 (0x1)
-
-#if __STDC_VERSION__ >= 201710
-#define zap_lang_c17 (0x1)
-
-#if zap_lang_c23
-#define zap_lang_c23 (0x1)
-
-#endif
-#endif
-#endif
-#endif
-#endif
-
-#endif
diff --git a/zap/include/zap/sys.d/os.h b/zap/include/zap/sys.d/os.h
deleted file mode 100644
index 0a8e85c..0000000
--- a/zap/include/zap/sys.d/os.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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>.
-*/
-
-/*
- os------- macro---------- vendors-----------------------------------
- clang cray edg gcc icc icx msvc pcc tiny vsi watcom xlc
-
- aix __HOS_AIX__ clang
- aix __TOS_AIX__ clang
- aix _AIX clang
-
- dos __DOS__ watcom
- dos _DOS watcom
-
- drgnfly __DragonFly__ clang
-
- freebsd __FreeBSD__ clang gcc
-
- hurd __GNU__ clang
- hurd __gnu_hurd__ clang
-
- linux __LINUX__ watcom
- linux __gnu_linux__ clang cray gcc icc icx
- linux __linux clang cray gcc icc icx tiny
- linux __linux__ clang cray gcc icc icx pcc tiny
-
- mac __APPLE__ clang icc
- mac __MACH__ clang icc
-
- minix __minix clang
-
- netbsd __NetBSD__ clang
-
- openbsd __OpenBSD__ clang
-
- os2 __OS2__ watcom
-
- sol __sun clang
- sol __sun__ clang
-
- vms __VMS vsi
- vms __vms vsi
-
- win __WINDOWS__ watcom
- win __WINDOWS_386__ watcom
- win __w64 icc
- win _WIN32 clang edg icc icx msvc
- win _WIN64 clang edg icc icx msvc
- win _WINDOWS watcom
-
-
- unix __UNIX__ watcom
- unix __unix clang gcc icc icx tiny xlc
- unix __unix__ clang gcc icc icx tiny xlc
-*/
-
-#if \
- defined(__HOS_AIX__) \
-|| defined(__TOS_AIX__) \
-|| defined(_AIX)
-#define zap_os_aix (0x1)
-#endif
-
-#if \
- defined(__DragonFly__)
-#define zap_os_drgnfly (0x1)
-#endif
-
-#if \
- defined(__DOS__) \
-|| defined(_DOS)
-#define zap_os_dos (0x1)
-#endif
-
-#if \
- defined(__FreeBSD__)
-#define zap_os_freebsd (0x1)
-#endif
-
-#if \
- defined(__GNU__) \
-|| defined(__gnu_hurd__)
-#define zap_os_hurd (0x1)
-#endif
-
-#if \
- defined(__LINUX__) \
-|| defined(__gnu_linux__) \
-|| defined(__linux) \
-|| defined(__linux__)
-#define zap_os_linux (0x1)
-#endif
-
-#if \
- defined(__APPLE__) \
-|| defined(__MACH__)
-#define zap_os_mac (0x1)
-#endif
-
-#if \
- defined(__minix)
-#define zap_os_minix (0x1)
-#endif
-
-#if \
- defined(__NetBSD__)
-#define zap_os_netbsd (0x1)
-#endif
-
-#if \
- defined(__OpenBSD__)
-#define zap_os_openbsd (0x1)
-#endif
-
-#if \
- defined(__OS2__)
-#define zap_os_os2 (0x1)
-#endif
-
-#if \
- defined(__sun) \
-|| defined(__sun__)
-#define zap_os_sol (0x1)
-#endif
-
-#if \
- defined(__VMS)
-|| defined(__vms)
-#define zap_os_vms (0x1)
-#endif
-
-#if \
- defined(__WINDOWS__) \
-|| defined(__WINDOWS_386__) \
-|| defined(__w64) \
-|| defined(_WIN32) \
-|| defined(_WIN64) \
-|| defined(_WINDOWS)
-#define zap_os_win (0x1)
-#endif
-
-#if \
- zap_os_aix \
-|| zap_os_drgnfly \
-|| zap_os_freebsd \
-|| zap_os_hurd \
-|| zap_os_linux \
-|| zap_os_mac \
-|| zap_os_minix \
-|| zap_os_netbsd \
-|| zap_os_openbsd \
-|| zap_os_sol \
-|| defined(__UNIX__) \
-|| defined(__unix) \
-|| defined(__unix__)
-#define zap_os_unix (0x1)
-#endif
diff --git a/zap/include/zap/sys.h b/zap/include/zap/sys.h
deleted file mode 100644
index 96cfb42..0000000
--- a/zap/include/zap/sys.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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>.
-*/
-
-#ifndef zap_priv_hdr_sys
-#define zap_priv_hdr_sys
-
-/*
- Sources for pre-defined macros:
-
- clang: <https://clang.llvm.org/docs/LanguageExtensions.html#builtin-macros>
- cray: <https://www.serc.iisc.ac.in/serc_web/wp-content/uploads/2019/05/Cray_C_and_C-_Reference_Manual.pdf>
- gcc: <https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html>
- icc: <https://www.intel.com/content/www/us/en/docs/cpp-compiler/developer-guide-reference/2021-8/additional-predefined-macros.html>
- icx: <https://www.intel.com/content/www/us/en/docs/dpcpp-cpp-compiler/developer-guide-reference/2023-0/additional-predefined-macros.html>
- xlc: <https://www.ibm.com/docs/en/SSRZSMX_17.1.0/pdf/user.pdf>
- msvc: <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros>
- vsi: <https://vmssoftware.com/docs/VSI_C_USER.pdf>
-
- ... as well as my own tests.
-
- We define all of the platform detection macros to the value (1) of the type int.
-*/
-
-#include <zap/sys.d/cmp.h>
-
-#include <zap/sys.d/arch.h>
-#include <zap/sys.d/os.h>
-
-#include <zap/sys.d/lang.h>
-
-#ifdef __cplusplus
-#define zap_priv_cdecl extern "C" {
-#define zap_priv_cdeclend }
-#else
-#define zap_priv_cdecl
-#define zap_priv_cdeclend
-#endif
-
-#ifdef __has_builtin
-#define zap_priv_hasbuiltin(builtin) __has_builtin(builtin)
-#else
-#define zap_priv_hasbuiltin(builtin) (0x0)
-#endif
-
-#ifdef __has_attribute
-#define zap_priv_hasattr(attr) __has_attribute(attr)
-#else
-#define zap_priv_hasattr(attr) (0x0)
-#endif
-
-#if zap_cmp_gcc
-#define zap_restr __restrict__
-#elif zap_cmp_msvc
-#define zap_restr __restrict
-#elif zap_lang_c99
-#define zap_restr restrict
-#else
-#define zap_restr
-#endif
-
-#if zap_priv_hasbuiltin(__builtin_expect)
-#define zap_priv_likly(expr) if (__builtin_expect((expr),0x1))
-#define zap_priv_ulikly(expr) if (__builtin_expect((expr),0x0))
-#elif __cplusplus > 202002
-#define zap_priv_likly(expr) if ((expr)) [[likely]]
-#define zap_priv_ulikly(expr) if ((expr)) [[unlikely]]
-#else
-#define zap_priv_likly(expr) if ((expr))
-#define zap_priv_ulikly(expr) if ((expr))
-#endif
-
-#if zap_lang_cxx89
-#if zap_priv_hasbuiltin(__builtin_is_constant_evaluated)
-#define zap_priv_ifconsteval if (__builtin_is_constant_evaluated())
-#define zap_priv_ifnconsteval if (!__builtin_is_constant_evaluated())
-#elif zap_lang_cxx23
-#define zap_priv_ifconsteval if consteval
-#define zap_priv_ifnconsteval if !consteval
-#else
-#define zap_priv_ifconsteval if (false)
-#define zap_priv_ifnconsteval if (true)
-#endif
-#endif
-
-#if zap_priv_hasattr(__noreturn__)
-#define zap_noret __attribute__ ((__noreturn__))
-#elif zap_cmp_msvc
-#define zap_noret __declspec (noreturn)
-#elif zap_lang_c23 || __cplusplus >= 201103
-#define zap_noret [[noreturn]]
-#elif zap_lang_c99
-#define zap_noret _Noreturn
-#else
-#define zap_noret
-#endif
-
-#include <zap/sys.d/attr.h>
-
-zap_priv_cdecl
-
-unsigned long zap_syscall(unsigned long id,...);
-
-zap_priv_cdeclend
-
-#endif
diff --git a/zap/include/zap/sys.hh b/zap/include/zap/sys.hh
deleted file mode 100644
index 9b210e6..0000000
--- a/zap/include/zap/sys.hh
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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>.
-*/
-
-#ifndef zap_priv_cxxhdr_sys
-#define zap_priv_cxxhdr_sys
-
-// C++11: parameter pack
-
-#include <zap/sys.h>
-
-namespace zap {
- template<typename... typs> zap_attr_iln inline unsigned long syscall(unsigned long const id,typs... args) noexcept {return ::zap_syscall(id,args...);}
-}
-
-#endif
diff --git a/zap/source/amd64/bs/trap.s b/zap/source/amd64/bs/trap.s
deleted file mode 100644
index 19c52a8..0000000
--- a/zap/source/amd64/bs/trap.s
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright 2022-2023 Gabriel Jensen.
-# 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>.
-
-.intel_syntax noprefix
-
-.globl zap_trap
-
-zap_trap:
- ud2
diff --git a/zap/source/amd64/math/abs.s b/zap/source/amd64/math/abs.s
deleted file mode 100644
index 178b5a7..0000000
--- a/zap/source/amd64/math/abs.s
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright 2022-2023 Gabriel Jensen.
-# 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>.
-
-.intel_syntax noprefix
-
-.globl zap_abs8
-.globl zap_abs01
-.globl zap_abs02
-.globl zap_abs04
-
-zap_abs8:
- mov al,dil
- neg al # zap_i8 ret = -inv; // Invert the copy of the input value. This also tests the sign of the value.
- cmovs ax,di # if (val < 0x0) ret = val; // If it was positive, just return the unmodified input.
- ret # return ret;
-
-zap_abs01:
- mov ax,di
- neg ax
- cmovs ax,di
- ret
-
-zap_abs02:
- mov eax,edi
- neg eax
- cmovs eax,edi
- ret
-
-zap_abs04:
- mov rax,rdi
- neg rax
- cmovs rax,rdi
- ret
diff --git a/zap/source/amd64/mem/cp.s b/zap/source/amd64/mem/cp.s
deleted file mode 100644
index b0b91e5..0000000
--- a/zap/source/amd64/mem/cp.s
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright 2022-2023 Gabriel Jensen.
-# 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>.
-
-.intel_syntax noprefix
-
-.globl zap_cp
-
-zap_cp:
- # zap_i8 val1;
- # zap_i04 val8;
- # unsigned int128_t val01;
- # unsigned int256_t val02;
-
-.big02cp: # big02cp:; // We assume AVX.
- cmp rdx,0x20
- jl short .big01cp # if (rem < 0x20u) goto big01cp;
-
- vmovdqu ymm0,[rsi] # val02 = *(unsigned int256_t *)src;
- vmovdqu [rdi],ymm0 # *(unsigned int256_t *)dest = val02;
-
- add rdi,0x20 # dest += 0x20u;
- add rsi,0x20 # src += 0x20u;
- sub rdx,0x20 # rem -= 0x20u;
- jmp short .big02cp # goto big02cp;
-
-.big01cp: # big01cp:;
- cmp rdx,0x10
- jl short .wrdcp # if (rem < 0x10u) goto wrdcp;
-
- movdqu xmm0,[rsi] # val01 = *(unsigned int128_t *)src;
- movdqu [rdi],xmm0 # *(unsigned int128_t *)dest = val01;
-
- add rdi,0x10 # dest += 0x10u;
- add rsi,0x10 # src += 0x10u;
- sub rdx,0x10 # rem -= 0x10u;
- jmp short .big01cp # goto big01cp;
-
-.wrdcp: # wrdcp:;
- cmp rdx,0x8
- jl short .bytecp # if (rem < 0x8u) goto bytecp;
-
- mov rcx,[rsi] # val8 = *(zap_i04 *)src;
- mov [rdi],rcx # *(zap_i04 *)dest = val8;
-
- add rsi,0x8 # dest += 0x8u;
- add rdi,0x8 # src += 0x8u;
- sub rdx,0x8 # rem -= 0x8u;
- jmp short .wrdcp # goto wrdcp
-
-.bytecp: # bytecp:;
- test rdx,rdx # if (rem == 0x0)
- jz short .done # goto done
-
- mov cl,[rsi] # val1 = *(zap_i8 *)src;
- mov [rdi],cl # *(zap_i8 *)dest = val1;
-
- inc rdi # ++dest;
- inc rsi # ++src;
- dec rdx # --rem;
- jmp short .bytecp # goto bytecp;
-
-.done:
- mov rax,rdi
- mov rdx,rsi
- ret # return (zap_cpret) {.dest = dest,.src = src};
diff --git a/zap/source/amd64/mem/fill.s b/zap/source/amd64/mem/fill.s
deleted file mode 100644
index 8e3f5fd..0000000
--- a/zap/source/amd64/mem/fill.s
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright 2022-2023 Gabriel Jensen.
-# 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>.
-
-.intel_syntax noprefix
-
-.globl zap_fill
-
-zap_fill:
- movzx rsi,sil # zap_i04 extval = val;
- mov rax,0x0101010101010101 # zap_i04 val = 0x0101010101010101u;
- imul rax,rsi # val *= extval;
-
-.wrdfill: # wrdfill:;
- cmp rdx,0x8
- jl short .bytefill # if (num < 0x8u) goto bytefill;
-
- mov [rdi],rax # *(zap_i04 *)dest = val8;
-
- add rdi,0x8 # dest += 0x8u;
- sub rdx,0x8 # num -= 0x8u;
- jmp short .wrdfill # goto wrdfill
-
-.bytefill: # bytefill:;
- test rdx,rdx # if (rem == 0x0)
- jz short .done # goto done
-
- mov [rdi],al # *(zap_i8 *)dest = val1;
-
- inc rdi # ++dest;
- dec rdx # --rem;
- jmp short .bytefill # goto bytefill;
-
-.done:
- ret # return
diff --git a/zap/source/amd64/sys/syscall.s b/zap/source/amd64/sys/syscall.s
deleted file mode 100644
index f6a615a..0000000
--- a/zap/source/amd64/sys/syscall.s
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 2022-2023 Gabriel Jensen.
-# 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>.
-
-.globl zap_syscall
-
-zap_syscall:
- # System calls on AMD64 use the following registers:
- # rax : System call identifier
- # rdi : First parameter
- # rsi : Second parameter
- # rdx : Third parameter
- # r10 : Fourth parameter
- # r8 : Fifth parameter
- # r9 : Sixth parameter
- # eax : Return value
- # No registers to save.
- movq %rdi,%rax # Move the first parameter (the identifier) to rax.
- movq %rsi,%rdi # Move parameters into their designated registers.
- movq %rdx,%rsi
- movq %rcx,%rdx
- movq %r8,%r10 # System calls use r10 instead of rcx.
- movq %r9,%r8
- movq 0x8(%rsp),%r9 # Extract the sixth argument from the stack.
- syscall # Slime incident
- # No need to move the return value.
- ret
diff --git a/zap/source/any/bs/trap.c b/zap/source/any/bs/trap.c
deleted file mode 100644
index 307a7f0..0000000
--- a/zap/source/any/bs/trap.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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 <zap/bs.h>
-
-void zap_trap(void) {
-#if zap_priv_hasbuiltin(__builtin_trap)
- __builtin_trap();
-#endif
- for (;;) {}
-}
diff --git a/zap/source/any/math/abs.cc b/zap/source/any/math/abs.cc
deleted file mode 100644
index 65e5a22..0000000
--- a/zap/source/any/math/abs.cc
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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 <zap/math.hh>
-
-extern "C" {
- zap_attr_nthrw float zap_absf( float const val) {return ::zap::abs(val);}
- zap_attr_nthrw double zap_absd( double const val) {return ::zap::abs(val);}
- zap_attr_nthrw long double zap_absld(long double const val) {return ::zap::abs(val);}
-}
diff --git a/zap/source/any/math/divmod.cc b/zap/source/any/math/divmod.cc
deleted file mode 100644
index f117013..0000000
--- a/zap/source/any/math/divmod.cc
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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 <zap/math.hh>
-
-extern "C" {
- zap_attr_nthrw auto zap_divmodsc(signed char const num,signed char const den) -> ::zap_pairsc {return ::zap::divmod(num,den).cpair();}
- zap_attr_nthrw auto zap_divmods( short const num,short const den) -> ::zap_pairs {return ::zap::divmod(num,den).cpair();}
- zap_attr_nthrw auto zap_divmodi( int const num,int const den) -> ::zap_pairi {return ::zap::divmod(num,den).cpair();}
- zap_attr_nthrw auto zap_divmodl( long const num,long const den) -> ::zap_pairl {return ::zap::divmod(num,den).cpair();}
- zap_attr_nthrw auto zap_divmodll(long long const num,long long const den) -> ::zap_pairll {return ::zap::divmod(num,den).cpair();}
-}
diff --git a/zap/source/any/mem/cp.c b/zap/source/any/mem/cp.c
deleted file mode 100644
index f0de644..0000000
--- a/zap/source/any/mem/cp.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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 <zap/mem.h>
-
-void * zap_cp(void * const zap_restr voiddest,void const * const zap_restr voidsrc,zap_sz const num) {
- unsigned char * dest = voiddest;
- unsigned char const * src = voidsrc;
- unsigned char * const stop = dest + num;
- while (dest != stop) *dest++ = *src++;
- return dest;
-}
diff --git a/zap/source/any/mem/eq.c b/zap/source/any/mem/eq.c
deleted file mode 100644
index 5ff5c4f..0000000
--- a/zap/source/any/mem/eq.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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 <zap/mem.h>
-
-zap_i8 zap_eq(void const * const voidlbuf,void const * const voidrbuf,zap_sz const num) {
- unsigned char const * lbuf = voidlbuf;
- unsigned char const * rbuf = voidrbuf;
- unsigned char const * const stop = lbuf + num;
- while (lbuf != stop) if (*lbuf++ != *rbuf++) return 0x0u;
- return 0x1u;
-}
diff --git a/zap/source/any/mem/fill.c b/zap/source/any/mem/fill.c
deleted file mode 100644
index 548dfeb..0000000
--- a/zap/source/any/mem/fill.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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 <zap/mem.h>
-
-void zap_fill(void * const voiddest,unsigned char const val,zap_sz const num) {
- unsigned char * dest = voiddest;
- unsigned char * const stop = dest + num;
- while (dest != stop) *dest++ = val;
-}
diff --git a/zap/source/any/mem/srch.c b/zap/source/any/mem/srch.c
deleted file mode 100644
index 46c8ec8..0000000
--- a/zap/source/any/mem/srch.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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 <zap/mem.h>
-
-void * zap_srch(void const * const voidbuf,zap_i8 const val,zap_sz const num) {
- unsigned char const * buf = voidbuf;
- unsigned char const * const stop = buf + num;
- while (buf != stop) {
- unsigned char const * addr = buf++;
- if (*addr == val) return (void *)addr;
- }
- return zap_nullptr;
-}
diff --git a/zap/source/any/str/fmt.cc b/zap/source/any/str/fmt.cc
deleted file mode 100644
index ff6edb1..0000000
--- a/zap/source/any/str/fmt.cc
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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 <zap/str.hh>
-
-#include "numdig.hh"
-
-namespace zap {
- namespace impl {
- template<typename signtyp> zap_attr_iln inline static auto fmt(::zap::i02 * buf,signtyp signval,::zap::i8 const bs,::zap::i8 const rtl) noexcept -> void {
- using typ = typename ::zap::usign<signtyp>;
- char32_t const * digs = U"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- if (bs == 0xCu) digs = U"0123456789\u218A\u218B";
- if (signval < 0x0) {
- signval = -signval;
- *buf++ = 0x2212u;
- }
- typ val = static_cast<typ>(signval);
- if (rtl) {
- buf += ::zap::impl::numdig(val,bs) - 0x1u;
- for (;val > 0x0u;val /= bs) *buf-- = static_cast<::zap::i02>(digs[static_cast<::zap::sz>(val % static_cast<typ>(bs))]);
- return;
- }
- for (;val > 0x0u;val /= bs) *buf++ = static_cast<::zap::i02>(digs[static_cast<::zap::sz>(val % static_cast<typ>(bs))]);
- }
- }
-}
-
-extern "C" {
- auto zap_fmti( ::zap::i02 * const buf,int const val,::zap::i8 const bs,::zap::i8 const rtl) -> void {return ::zap::impl::fmt(buf,val,bs,rtl);}
- auto zap_fmtl( ::zap::i02 * const buf,long const val,::zap::i8 const bs,::zap::i8 const rtl) -> void {return ::zap::impl::fmt(buf,val,bs,rtl);}
- auto zap_fmtll( ::zap::i02 * const buf,long long const val,::zap::i8 const bs,::zap::i8 const rtl) -> void {return ::zap::impl::fmt(buf,val,bs,rtl);}
- auto zap_fmts( ::zap::i02 * const buf,short const val,::zap::i8 const bs,::zap::i8 const rtl) -> void {return ::zap::impl::fmt(buf,val,bs,rtl);}
- auto zap_fmtsc( ::zap::i02 * const buf,signed char const val,::zap::i8 const bs,::zap::i8 const rtl) -> void {return ::zap::impl::fmt(buf,val,bs,rtl);}
- auto zap_fmtuc( ::zap::i02 * const buf,unsigned char const val,::zap::i8 const bs,::zap::i8 const rtl) -> void {return ::zap::impl::fmt(buf,val,bs,rtl);}
- auto zap_fmtui( ::zap::i02 * const buf,unsigned int const val,::zap::i8 const bs,::zap::i8 const rtl) -> void {return ::zap::impl::fmt(buf,val,bs,rtl);}
- auto zap_fmtul( ::zap::i02 * const buf,unsigned long const val,::zap::i8 const bs,::zap::i8 const rtl) -> void {return ::zap::impl::fmt(buf,val,bs,rtl);}
- auto zap_fmtull(::zap::i02 * const buf,unsigned long long const val,::zap::i8 const bs,::zap::i8 const rtl) -> void {return ::zap::impl::fmt(buf,val,bs,rtl);}
- auto zap_fmtus( ::zap::i02 * const buf,unsigned short const val,::zap::i8 const bs,::zap::i8 const rtl) -> void {return ::zap::impl::fmt(buf,val,bs,rtl);}
-}
diff --git a/zap/source/any/str/fmtlen.cc b/zap/source/any/str/fmtlen.cc
deleted file mode 100644
index b5e508c..0000000
--- a/zap/source/any/str/fmtlen.cc
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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 <zap/math.hh>
-#include <zap/str.hh>
-
-#include "numdig.hh"
-
-namespace zap {
- namespace impl {
- template<typename typ> zap_attr_iln inline static auto fmtlen(typ val,::zap::i8 const bs) noexcept -> ::zap::i8 {
- ::zap::i8 len = 0x0u;
- if (val < 0x0) {
- val = static_cast<typ>(::zap::abs(val));
- len = 0x1u;
- }
- len += ::zap::impl::numdig(val,bs);
- return len;
- }
- }
-}
-
-extern "C" {
- auto zap_fmtleni( int const val,::zap::i8 const bs) -> ::zap::i8 {return ::zap::impl::fmtlen(val,bs);}
- auto zap_fmtlenl( long const val,::zap::i8 const bs) -> ::zap::i8 {return ::zap::impl::fmtlen(val,bs);}
- auto zap_fmtlenll( long long const val,::zap::i8 const bs) -> ::zap::i8 {return ::zap::impl::fmtlen(val,bs);}
- auto zap_fmtlens( short const val,::zap::i8 const bs) -> ::zap::i8 {return ::zap::impl::fmtlen(val,bs);}
- auto zap_fmtlensc( signed char const val,::zap::i8 const bs) -> ::zap::i8 {return ::zap::impl::fmtlen(val,bs);}
- auto zap_fmtlenuc( unsigned char const val,::zap::i8 const bs) -> ::zap::i8 {return ::zap::impl::fmtlen(val,bs);}
- auto zap_fmtlenui( unsigned int const val,::zap::i8 const bs) -> ::zap::i8 {return ::zap::impl::fmtlen(val,bs);}
- auto zap_fmtlenul( unsigned long const val,::zap::i8 const bs) -> ::zap::i8 {return ::zap::impl::fmtlen(val,bs);}
- auto zap_fmtlenull(unsigned long long const val,::zap::i8 const bs) -> ::zap::i8 {return ::zap::impl::fmtlen(val,bs);}
- auto zap_fmtlenus( unsigned short const val,::zap::i8 const bs) -> ::zap::i8 {return ::zap::impl::fmtlen(val,bs);}
-}
diff --git a/zap/source/any/str/numdig.hh b/zap/source/any/str/numdig.hh
deleted file mode 100644
index ea36f0b..0000000
--- a/zap/source/any/str/numdig.hh
+++ /dev/null
@@ -1,12 +0,0 @@
-#pragma once
-
-namespace zap {
- namespace impl {
- template<typename typ> zap_attr_iln inline static auto numdig(typ fmtval,::zap::i8 const bs) noexcept -> ::zap::i8 {
- ::zap::i8 len = 0x0u;
- if (fmtval == typ {0x0}) return 0x1u;
- for (typ val = fmtval;val > 0x0;val /= static_cast<typ>(bs)) ++len;
- return len;
- }
- }
-}
diff --git a/zap/source/any/str/streq.c b/zap/source/any/str/streq.c
deleted file mode 100644
index 6b1002d..0000000
--- a/zap/source/any/str/streq.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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 <zap/str.h>
-
-zap_i8 zap_streq(char const * lstr,char const * rstr) {
- for (;;++lstr,++rstr) {
- char const lchr = *lstr;
- char const rchr = *rstr;
- if (lchr != rchr) return 0x0u;
- if (lchr == '\x0') break;
- }
- return zap_maxval8;
-}
diff --git a/zap/source/any/str/strlen.c b/zap/source/any/str/strlen.c
deleted file mode 100644
index e763701..0000000
--- a/zap/source/any/str/strlen.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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 <zap/str.h>
-
-zap_sz zap_strlen(char const * str) {
- char const * const start = str;
- while (*str++ != '\x0');
- return (zap_sz)(str - start) - 0x1u;
-}
diff --git a/zap/source/any/str/utf8dec.c b/zap/source/any/str/utf8dec.c
deleted file mode 100644
index add8697..0000000
--- a/zap/source/any/str/utf8dec.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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 <zap/str.h>
-
-void zap_utf8dec(zap_i02 * dest,zap_i8 const * src) {
- for (;;++dest) {
- zap_i8 const oct = *src;
- if (oct == 0x0u) break;
- if (oct >= 0xF0u) { /* Four octets. */
- zap_i02 chr = ((zap_i02)oct ^ 0xF0u) << 0x12u;
- ++src;
- chr += ((zap_i02)*src ^ 0x80u) << 0xCu;
- ++src;
- chr += ((zap_i02)*src ^ 0x80u) << 0x6u;
- ++src;
- chr += (zap_i02)*src ^ 0x80u;
- ++src;
- *dest = chr;
- continue;
- }
- if (oct >= 0xE0u) { /* Three octets. */
- zap_i02 chr = ((zap_i02)oct ^ 0xE0u) << 0xCu;
- ++src;
- chr += ((zap_i02)*src ^ 0x80u) << 0x6u;
- ++src;
- chr += (zap_i02)*src ^ 0x80u;
- ++src;
- *dest = chr;
- continue;
- }
- if (oct >= 0xC0u) { /* Two octets. */
- zap_i02 chr = ((zap_i02)oct ^ 0xC0u) << 0x6u;
- ++src;
- chr += (zap_i02)*src ^ 0x80u;
- ++src;
- *dest = chr;
- continue;
- }
- /* One octet. */
- *dest = oct;
- ++src;
- }
-}
diff --git a/zap/source/any/str/utf8declen.c b/zap/source/any/str/utf8declen.c
deleted file mode 100644
index f8b7ae8..0000000
--- a/zap/source/any/str/utf8declen.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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 <zap/str.h>
-
-zap_sz zap_utf8declen(zap_i8 const * buf) {
- zap_sz len = 0x0u;
- for (;;++len) {
- zap_i8 const oct = *buf;
- if (oct == 0x0u) break;
- if (oct >= 0xF0u) {
- buf += 0x4u;
- continue;
- }
- if (oct >= 0xE0u) {
- buf += 0x3u;
- continue;
- }
- if (oct >= 0xC0u) {
- buf += 0x2u;
- continue;
- }
- ++buf;
- }
- return len;
-}
diff --git a/zap/source/any/str/utf8enc.c b/zap/source/any/str/utf8enc.c
deleted file mode 100644
index a6b31c6..0000000
--- a/zap/source/any/str/utf8enc.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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 <zap/str.h>
-
-void zap_utf8enc(zap_i8 * dest,zap_i02 const * src) {
- for (;;++src) {
- zap_i02 const chr = *src;
- if (chr > 0xFFFFu) { /* Four octets. */
- *dest = 0xF0u + (chr >> 0x12u);
- ++dest;
- *dest = 0x80u + (chr >> 0xCu & 0x3Fu);
- ++dest;
- *dest = 0x80u + (chr >> 0x6u & 0x3Fu);
- ++dest;
- *dest = 0x80u + (chr & 0x3Fu);
- ++dest;
- continue;
- }
- if (chr >= 0x7FFu) { /* Three octets. */
- *dest = 0xE0u + (zap_i8)(chr >> 0xCu);
- ++dest;
- *dest = 0x80u + (zap_i8)(chr >> 0x6u & 0x3Fu);
- ++dest;
- *dest = 0x80u + (zap_i8)(chr & 0x3Fu);
- ++dest;
- continue;
- }
- if (chr >= 0x7Fu) { /* Two octets. */
- *dest = 0xC0u + (zap_i8)(chr >> 0x6u);
- ++dest;
- *dest = 0x80u + (zap_i8)(chr & 0x3Fu);
- ++dest;
- continue;
- }
- /* One octet. */
- *dest = chr;
- ++dest;
- if (chr == 0x0u) break;
- }
-}
diff --git a/zap/source/any/str/utf8enclen.c b/zap/source/any/str/utf8enclen.c
deleted file mode 100644
index f49031e..0000000
--- a/zap/source/any/str/utf8enclen.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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 <zap/str.h>
-
-zap_sz zap_utf8enclen(zap_i02 const * buf) {
- zap_sz len = 0x0u;
- for (;;++buf) {
- zap_i02 const chr = *buf;
- if (chr == 0x0u) break;
- if (chr >= 0x10000u) {
- len += 0x4u;
- continue;
- }
- if (chr >= 0x800u) {
- len += 0x3u;
- continue;
- }
- if (chr >= 0x80u) {
- len += 0x2u;
- continue;
- }
- ++len;
- }
- return len;
-}
diff --git a/zap/source/any/str/win1252dec.c b/zap/source/any/str/win1252dec.c
deleted file mode 100644
index 0e29a5a..0000000
--- a/zap/source/any/str/win1252dec.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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 <zap/str.h>
-
-void zap_win1252dec(zap_i02 * dest,zap_i8 const * src) {
- for (;;++src,++dest) {
- zap_i8 const chr = *src;
- if (chr == 0x0u) break;
- switch (chr) {
- default:
- *dest = *src;
- break;
- case 0x81: /* Bad characters. */
- case 0x8D:
- case 0x8F:
- case 0x90:
- case 0x9D:
- *dest = 0xFFFDu; /* REPLACEMENT CHARACTER */
- break;
- case 0x80:
- *dest = 0x20ACu;
- break;
- case 0x82:
- *dest = 0x201Au;
- break;
- case 0x83:
- *dest = 0x192u;
- break;
- case 0x84:
- *dest = 0x201Eu;
- break;
- case 0x85:
- *dest = 0x2026u;
- break;
- case 0x86:
- *dest = 0x2020u;
- break;
- case 0x87:
- *dest = 0x2021u;
- break;
- case 0x88:
- *dest = 0x2C6u;
- break;
- case 0x89:
- *dest = 0x2030u;
- break;
- case 0x8A:
- *dest = 0x160u;
- break;
- case 0x8B:
- *dest = 0x2039u;
- break;
- case 0x8C:
- *dest = 0x152u;
- break;
- case 0x8E:
- *dest = 0x17Du;
- break;
- case 0x91:
- *dest = 0x2018u;
- break;
- case 0x92:
- *dest = 0x2019u;
- break;
- case 0x93:
- *dest = 0x201Cu;
- break;
- case 0x94:
- *dest = 0x201Du;
- break;
- case 0x95:
- *dest = 0x2022u;
- break;
- case 0x96:
- *dest = 0x2013u;
- break;
- case 0x97:
- *dest = 0x2014u;
- break;
- case 0x98:
- *dest = 0x2DCu;
- break;
- case 0x99:
- *dest = 0x2122u;
- break;
- case 0x9A:
- *dest = 0x161u;
- break;
- case 0x9B:
- *dest = 0x203Au;
- break;
- case 0x9C:
- *dest = 0x153u;
- break;
- case 0x9E:
- *dest = 0x17Eu;
- break;
- case 0x9F:
- *dest = 0x178u;
- break;
- }
- }
-}
diff --git a/zap/source/any/str/win1252enc.c b/zap/source/any/str/win1252enc.c
deleted file mode 100644
index d7ae548..0000000
--- a/zap/source/any/str/win1252enc.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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 <zap/str.h>
-
-void zap_win1252enc(zap_i8 * dest,zap_i02 const * src) {
- for (;;++src,++dest) {
- zap_i02 const chr = *src;
- if (chr == 0x0u) break;
- zap_i8 const bad = 0x3Fu;
- switch (chr) {
- default:
- if (chr > 0xFFu) {
- *dest = bad;
- break;
- }
- if (chr >= 0x80u && chr <= 0x9Fu) {
- *dest = bad;
- break;
- }
- *dest = *src;
- break;
- case 0x20ACu:
- *dest = 0x80u;
- break;
- case 0x201Au:
- *dest = 0x82u;
- break;
- case 0x192u:
- *dest = 0x83u;
- break;
- case 0x201Eu:
- *dest = 0x84u;
- break;
- case 0x2026u:
- *dest = 0x85u;
- break;
- case 0x2020u:
- *dest = 0x86u;
- break;
- case 0x2021u:
- *dest = 0x87u;
- break;
- case 0x2C6u:
- *dest = 0x88u;
- break;
- case 0x2030u:
- *dest = 0x89u;
- break;
- case 0x160u:
- *dest = 0x8Au;
- break;
- case 0x2039u:
- *dest = 0x8Bu;
- break;
- case 0x152u:
- *dest = 0x8Cu;
- break;
- case 0x17Du:
- *dest = 0x8Eu;
- break;
- case 0x2018u:
- *dest = 0x91u;
- break;
- case 0x2019u:
- *dest = 0x92u;
- break;
- case 0x201Cu:
- *dest = 0x93u;
- break;
- case 0x201Du:
- *dest = 0x94u;
- break;
- case 0x2022u:
- *dest = 0x95u;
- break;
- case 0x2013u:
- *dest = 0x96u;
- break;
- case 0x2014u:
- *dest = 0x97u;
- break;
- case 0x2DCu:
- *dest = 0x98u;
- break;
- case 0x2122u:
- *dest = 0x99u;
- break;
- case 0x161u:
- *dest = 0x9Au;
- break;
- case 0x203Au:
- *dest = 0x9Bu;
- break;
- case 0x153u:
- *dest = 0x9Cu;
- break;
- case 0x17Eu:
- *dest = 0x9Eu;
- break;
- case 0x178u:
- *dest = 0x9Fu;
- break;
- }
- }
-}
diff --git a/zap/source/any/sys/syscall.c b/zap/source/any/sys/syscall.c
deleted file mode 100644
index 46d1074..0000000
--- a/zap/source/any/sys/syscall.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- Copyright 2022-2023 Gabriel Jensen.
- 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 <zap/str.h>
-
-void zap_syscall(unsigned long,...) {
- zap_trap(); // Unsupported.
-}
diff --git a/zap/source/arm/sys/syscall.s b/zap/source/arm/sys/syscall.s
deleted file mode 100644
index c4f8d40..0000000
--- a/zap/source/arm/sys/syscall.s
+++ /dev/null
@@ -1,32 +0,0 @@
-@ Copyright 2022-2023 Gabriel Jensen.
-@ 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>.
-
-.syntax unified
-
-.arm
-
-.globl zap_syscall
-
-zap_syscall:
- @ System calls on ARM EABI use the following registers:
- @ r0 : System call identifier
- @ r1 : First parameter
- @ r2 : Second parameter
- @ r3 : Third parameter
- @ r4 : Fourth parameter
- @ r5 : Fifth parameter
- @ r6 : Sixth parameter
- @ r0 : Return value
- push {r4-r5,r7,lr} @ Remember that the parameters are now further up the stack.
- mov r7,r0 @ Move the identifier.
- mov r0,r1 @ Place parameters.
- mov r1,r2
- mov r2,r3
- ldr r3,[sp,0x10] @ Get the remaining parameters from the stack.
- ldr r4,[sp,0x14]
- ldr r5,[sp,0x18]
- svc 0x0 @ Divinity
- pop {r4-r5,r7} @ Restore the registers.
- pop {r0}
- bx r0
diff --git a/zap/source/arm64/sys/syscall.s b/zap/source/arm64/sys/syscall.s
deleted file mode 100644
index df4817d..0000000
--- a/zap/source/arm64/sys/syscall.s
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2022-2023 Gabriel Jensen.
-// 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>.
-
-.globl zap_syscall
-
-zap_syscall:
- // System calls on ARM64 use the following registers:
- // x0 : System call identifier
- // x1 : First parameter
- // x2 : Second parameter
- // x3 : Third parameter
- // x4 : Fourth parameter
- // x5 : Fifth parameter
- // x6 : Sixth parameter
- // x0 : Return value
- mov x8,x0 // Move the first parameter (the identifier) to x8.
- mov x0,x1 // Shift all of the other parameters to the left.
- mov x1,x2
- mov x2,x3
- mov x3,x4
- mov x4,x5
- mov x5,x6
- svc 0x0 // Zephyr
- // No need to move the return value (already in x0).
- ret
diff --git a/zap/source/ia32/sys/syscall.s b/zap/source/ia32/sys/syscall.s
deleted file mode 100644
index c99cd2b..0000000
--- a/zap/source/ia32/sys/syscall.s
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright 2022-2023 Gabriel Jensen.
-# 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>.
-
-.globl zap_syscall
-
-zap_syscall:
- # System calls on IA-32 use the following registers:
- # eax : System call identifier
- # ebx : First parameter
- # ecx : Second parameter
- # edx : Third parameter
- # esi : Fourth parameter
- # edi : Fifth parameter
- # ebp : Sixth parameter
- # eax : Return value
- pushl %ebx # Remember to save the registers.
- pushl %esi
- pushl %edi
- pushl %ebp # Remember that the provided paramters are now further up the stack.
- movl 0x14(%esp),%eax # Move the first parameter (the identifier) to eax.
- movl 0x18(%esp),%ebx # Move the remaining parameters into their designated registers. This will read "out of bounds" memory if the number of passed parameters is less than six, but this shouldn't matter as long as the data isn't being used, which it won't be as long as the expected ammount of parameters have been passed.
- movl 0x1C(%esp),%ecx
- movl 0x20(%esp),%edx
- movl 0x24(%esp),%esi
- movl 0x28(%esp),%edi
- movl 0x2C(%esp),%ebp
- int $0x80 # Flying city
- popl %ebp # Restore the registers.
- popl %edi
- popl %esi
- popl %ebx
- # No need to move the return value.
- ret