summaryrefslogtreecommitdiff
path: root/zap/include/zap/bs.h
diff options
context:
space:
mode:
Diffstat (limited to 'zap/include/zap/bs.h')
-rw-r--r--zap/include/zap/bs.h101
1 files changed, 83 insertions, 18 deletions
diff --git a/zap/include/zap/bs.h b/zap/include/zap/bs.h
index 5da18d8..678b892 100644
--- a/zap/include/zap/bs.h
+++ b/zap/include/zap/bs.h
@@ -1,39 +1,104 @@
/*
- Copyright 2022 Gabriel Jensen.
+ 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 a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
*/
#if !defined(zap_priv_hdr_bs)
#define zap_priv_hdr_bs
+#include <csys.h>
+
#if defined(__cplusplus)
-extern "C" {
+#define zap_priv_cdecl extern "C" {
+#define zap_priv_cdeclend }
+#else
+#define zap_priv_cdecl
+#define zap_priv_cdeclend
+#endif
+
+#if defined(__GNUC__)
+#define zap_priv_noret __attribute__ ((noreturn))
+#elif __STDC_VERSION__ == 202311 || __cplusplus == 201103
+#define zap_priv_noret [[noreturn]]
+#elif __STDC_VERSION__ == 199901
+#define zap_priv_noret _Noreturn
+#else
+#define zap_priv_noret
+#endif
+
+#if defined(__GNUC__)
+#define zap_priv_nothrw __attribute__ ((nothrow))
+#else
+#define zap_priv_nothrw
+#endif
+
+#if defined(__GNUC__)
+#define zap_priv_restr __restrict
+#elif __STDC_VERSION__ == 199901
+#define zap_priv_restr restrict
+#else
+#define zap_priv_restr
+#endif
+
+#if defined(__GNUC__)
+#define zap_priv_unseq __attribute__ ((const))
+#elif __STDC_VERSION__ == 202311
+#define zap_priv_unseq [[unsequenced]]
+#else
+#define zap_priv_unseq
#endif
-typedef unsigned char zap_bool;
+zap_priv_cdecl
+
+#define zap_ver ((unsigned long)+0x16u)
+
+#define zap_bytesz ((zap_sz)+0x8u)
+
#define zap_false ((zap_bool)+0x0u)
-#define zap_true ((zap_bool)+0xFFu)
+#define zap_true ((zap_bool)-0x1)
-typedef unsigned short zap_chr10;
-typedef unsigned int zap_chr20;
-typedef unsigned char zap_chr8;
+#define zap_nopos ((zap_sz)-0x1)
-typedef signed char zap_cmp;
-#define zap_eq ((zap_cmp)+0x0)
-#define zap_gt ((zap_cmp)+0x7F)
-#define zap_lt ((zap_cmp)-0x80)
+#define zap_nullptr ((void *)0x0u)
-#define zap_nopos ((zap_sz)+0xFFFFFFFFFFFFFFFFu)
+typedef unsigned char zap_i8;
+typedef unsigned short zap_i01;
+typedef unsigned int zap_i02;
+#if \
+ csys_arch_arm \
+ || csys_arch_ia32 \
+ || (csys_os_cur == csys_os_win && csys_arch_amd64)
+typedef unsigned long long zap_i04;
+#else
+typedef unsigned long zap_i04;
+#endif
-#define zap_nullptr (0x0u)
+typedef signed char zap_i8s;
+typedef short zap_i01s;
+typedef int zap_i02s;
+typedef long zap_i04s;
-typedef unsigned long zap_sz;
+typedef zap_i8 zap_chr8;
+typedef zap_i01 zap_chr01;
+typedef zap_i02 zap_chr02;
-#define zap_ver ((unsigned long)+0x15u)
+typedef zap_i8 zap_bool;
-#if defined(__cplusplus)
-}
+#if \
+ csys_arch_arm \
+ || csys_arch_ia32
+typedef zap_i8 zap_byte;
+typedef zap_i02 zap_ptr;
+typedef zap_i02 zap_sz;
+#else
+typedef zap_i8 zap_byte;
+typedef zap_i04 zap_ptr;
+typedef zap_i04 zap_sz;
#endif
+zap_priv_noret void zap_priv_trap(void);
+
+zap_priv_cdeclend
+
#endif