Add SDK/CRT string routines and headers

This commit is contained in:
2024-08-08 08:04:59 -04:00
parent 70489d6d39
commit 8ff7a75afc
8 changed files with 357 additions and 10 deletions

60
SDK/CRT/INC/stddef.h Normal file
View File

@@ -0,0 +1,60 @@
/*++
Copyright (c) 2024, Quinn Stephens.
Provided under the BSD 3-Clause license.
Module Name:
stddef.h
Abstract:
Provides standard types and definitions.
--*/
#pragma once
#ifndef _STDDEF_H
#define _STDDEF_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void*)0)
#endif
#endif
#ifndef _SIZE_T_DEFINED
#define _SIZE_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 size_t;
#else
typedef unsigned int size_t;
#endif
#endif
#ifndef _PTRDIFF_T_DEFINED
#define _PTRDIFF_T_DEFINED
#ifdef _WIN64
typedef __int64 ptrdiff_t;
#else
typedef long int ptrdiff_t;
#endif
#endif
#ifndef _WCHAR_T_DEFINED
#define _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#endif
#ifdef __cplusplus
}
#endif
#endif /* !_STDDEF_H */

37
SDK/CRT/INC/string.h Normal file
View File

@@ -0,0 +1,37 @@
/*++
Copyright (c) 2024, Quinn Stephens.
Provided under the BSD 3-Clause license.
Module Name:
string.h
Abstract:
Provides definitions for string routines.
--*/
#pragma once
#ifndef _STRING_H
#define _STRING_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
size_t strlen(const char *str);
size_t strnlen(const char *str, size_t maxlen);
void *memset(void *dest, int c, size_t count);
void *memcpy(void *dest, const void *src, size_t count);
#ifdef __cplusplus
}
#endif
#endif /* !_STRING_H */

37
SDK/CRT/INC/wchar.h Normal file
View File

@@ -0,0 +1,37 @@
/*++
Copyright (c) 2024, Quinn Stephens.
Provided under the BSD 3-Clause license.
Module Name:
wchar.h
Abstract:
Provides definitions for wide string routines.
--*/
#pragma once
#ifndef _WCHAR_H
#define _WCHAR_H
#ifdef __cplusplus
extern "C" {
#endif
#include <string.h>
size_t wcslen(const wchar_t *str);
size_t wcsnlen(const wchar_t *str, size_t maxlen);
wchar_t *wmemset(wchar_t *dest, wchar_t c, size_t count);
wchar_t *wmemcpy(wchar_t *dest, const wchar_t *src, size_t count);
#ifdef __cplusplus
}
#endif
#endif /* !_WCHAR_H */