summaryrefslogtreecommitdiff
path: root/zap/include
diff options
context:
space:
mode:
Diffstat (limited to 'zap/include')
-rw-r--r--zap/include/zap/base.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/zap/include/zap/base.h b/zap/include/zap/base.h
new file mode 100644
index 0000000..48e0fb1
--- /dev/null
+++ b/zap/include/zap/base.h
@@ -0,0 +1,68 @@
+/*
+ Copyright 2022 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 <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <susinfo.h>
+
+#if !defined(zap_hdr_base)
+#define zap_hdr_base
+
+#define zap_typlit_s10(_lit) ((int_least16_t)( _lit))
+#define zap_typlit_s20(_lit) ((int_least32_t)( _lit))
+#define zap_typlit_s40(_lit) ((int_least64_t)( _lit))
+#define zap_typlit_s8( _lit) ((int_least8_t)( _lit))
+#define zap_typlit_u10(_lit) ((uint_least16_t)(_lit))
+#define zap_typlit_u20(_lit) ((uint_least32_t)(_lit))
+#define zap_typlit_u40(_lit) ((uint_least64_t)(_lit))
+#define zap_typlit_u8( _lit) ((uint_least8_t)( _lit))
+#define zap_typlit_usz(_lit) ((size_t)( _lit))
+
+#define zap_ver zap_typlit_u64(0xB)
+
+#if defined(sus_lang_asm)
+
+.extern zap_fndbyte
+.extern zap_fndchr
+.extern zap_memcmp
+.extern zap_memcpy
+.extern zap_memeq
+.extern zap_memfill
+.extern zap_strcmp
+.extern zap_strcpy
+.extern zap_streq
+.extern zap_strfill
+.extern zap_strlen
+
+#else
+
+#if defined(sus_lang_cxx)
+extern "C" {
+#endif
+
+extern bool const zap_fastimpl;
+
+sus_attr_alloc sus_attr_allocsz(0x2) sus_attr_hot sus_attr_nothrw sus_attr_useret void * zap_memdup( void const * ptr, size_t num);
+sus_attr_hot sus_attr_nothrw sus_attr_useret size_t zap_fndbyte( void const * ptr, size_t num, uint_least8_t byte);
+sus_attr_hot sus_attr_nothrw sus_attr_useret size_t zap_fndchr( char const * str, char chr);
+sus_attr_hot sus_attr_nothrw sus_attr_useret int_least8_t zap_memcmp( void const * lstr,size_t num, void const * rstr);
+sus_attr_hot sus_attr_nothrw void zap_memcpy( void const * in, size_t num, void * out);
+sus_attr_hot sus_attr_nothrw sus_attr_useret bool zap_memeq( void const * lptr,size_t num, void const * rptr);
+sus_attr_hot sus_attr_nothrw void zap_memfill( void * ptr, size_t num, uint_least8_t val);
+sus_attr_hot sus_attr_nothrw sus_attr_useret int_least8_t zap_strcmp( char const * lstr,char const * rstr);
+sus_attr_hot sus_attr_nothrw sus_attr_useret size_t zap_strcpy( char const * in, char * out);
+sus_attr_alloc sus_attr_hot sus_attr_nothrw sus_attr_useret char * zap_strdup( char const * str);
+sus_attr_hot sus_attr_nothrw sus_attr_useret bool zap_streq( char const * lstr,char const * rstr);
+sus_attr_hot sus_attr_nothrw void zap_strfill( char * lstr,char chr);
+sus_attr_hot sus_attr_nothrw sus_attr_useret size_t zap_strlen( char const * str);
+
+#endif
+#if defined(sus_lang_cxx)
+}
+#endif
+
+#endif