summaryrefslogtreecommitdiffhomepage
path: root/src/internal/ntux_nolibc_impl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/internal/ntux_nolibc_impl.c')
-rw-r--r--src/internal/ntux_nolibc_impl.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/internal/ntux_nolibc_impl.c b/src/internal/ntux_nolibc_impl.c
new file mode 100644
index 0000000..1b5867d
--- /dev/null
+++ b/src/internal/ntux_nolibc_impl.c
@@ -0,0 +1,73 @@
+/***********************************************************/
+/* ntux: native translation und extension */
+/* Copyright (C) 2016 Z. Gilboa */
+/* Released under GPLv2 and GPLv3; see COPYING.NTUX. */
+/***********************************************************/
+
+#include <ntapi/ntapi.h>
+
+extern const ntapi_vtbl * ntux_ntapi;
+
+void * ntux_memcpy(void * dst, const void * src, size_t n)
+{
+ return ntux_ntapi->tt_generic_memcpy(dst,src,n);
+}
+
+void * ntux_memset(void * ch, int c, size_t n)
+{
+ return ntux_ntapi->tt_generic_memset(ch,c,n);
+}
+
+char * ntux_strcpy(char * dst, const char * src)
+{
+ return ntux_ntapi->tt_generic_memcpy(
+ dst,src,
+ ntux_ntapi->tt_string_null_offset_multibyte(src));
+}
+
+size_t ntux_strlen(const char * ch)
+{
+ return ntux_ntapi->tt_string_null_offset_multibyte(ch);
+}
+
+int ntux_strcmp(const char * a, const char * b)
+{
+ return ntux_ntapi->tt_strcmp_multibyte(a,b);
+}
+
+int ntux_strncmp(const char * a, const char * b, size_t n)
+{
+ return ntux_ntapi->tt_strncmp_multibyte(a,b,n);
+}
+
+char * ntux_strchr(const char * ch, int c)
+{
+ for (; *ch; ch++)
+ if (*ch == c)
+ return (char *)ch;
+ return 0;
+}
+
+char * ntux_strrchr(const char * ch, int c)
+{
+ const char * base;
+
+ base = ch;
+ ch += ntux_ntapi->tt_string_null_offset_multibyte(ch);
+
+ for (; ch >= base; ch--)
+ if (*ch == c)
+ return (char *)ch;
+ return 0;
+}
+
+#ifdef NTUX_EXPORT
+int __stdcall ntux_entry_point(void * hinstance, uint32_t reason, void * reserved)
+{
+ (void)hinstance;
+ (void)reason;
+ (void)reserved;
+
+ return 1;
+}
+#endif