summaryrefslogtreecommitdiff
path: root/zap/source
diff options
context:
space:
mode:
Diffstat (limited to 'zap/source')
-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
27 files changed, 0 insertions, 864 deletions
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