Merge some MSL headers into ours

This commit is contained in:
dbalatoni13 2025-01-12 14:23:45 +01:00
parent b0ed90ff26
commit ecdf79ec4c
14 changed files with 61 additions and 126 deletions

View file

@ -1,7 +1,7 @@
#ifndef _MSL_COMMON_ANSI_FILES_H
#define _MSL_COMMON_ANSI_FILES_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/stddef.h"
#include "stddef.h"
#ifdef __cplusplus
extern "C" {

View file

@ -1,7 +1,7 @@
#ifndef _MSL_COMMON_MEM_FUNCS_H
#define _MSL_COMMON_MEM_FUNCS_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/stddef.h"
#include "stddef.h"
#ifdef __cplusplus
extern "C" {

View file

@ -2,7 +2,7 @@
#define _MSL_COMMON_PRINTF_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/stdarg.h"
#include "stdarg.h"
#ifdef __cplusplus
extern "C" {

View file

@ -1,7 +1,7 @@
#ifndef _MSL_COMMON_SCANF_H
#define _MSL_COMMON_SCANF_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/stddef.h"
#include "stddef.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h"
#ifdef __cplusplus

View file

@ -1,39 +0,0 @@
#ifndef _MSL_COMMON_STDARG_H
#define _MSL_COMMON_STDARG_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __MWERKS__
typedef struct {
char gpr;
char fpr;
char reserved[2];
char* input_arg_area;
char* reg_save_area;
} __va_list[1];
typedef __va_list va_list;
#ifndef __MWERKS__
extern void __builtin_va_info(va_list*);
#endif
void* __va_arg(va_list v_list, unsigned char type);
#define va_start(ap, fmt) ((void)fmt, __builtin_va_info(&ap))
#define va_arg(ap, t) (*((t*)__va_arg(ap, _var_arg_typeof(t))))
#define va_end(ap) (void)0
#else
typedef __builtin_va_list va_list;
#define va_start(v, l) __builtin_va_start(v, l)
#define va_end(v) __builtin_va_end(v)
#define va_arg(v, l) __builtin_va_arg(v, l)
#endif
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_STDARG_H */

View file

@ -1,26 +0,0 @@
#ifndef _STDDEF_H_
#define _STDDEF_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __INTELLISENSE__
typedef unsigned int size_t;
typedef int ptrdiff_t;
#else
typedef unsigned long size_t;
typedef long ptrdiff_t;
#endif
#define offsetof(type, member) ((size_t) & (((type*)0)->member))
#ifndef NULL
#define NULL 0
#endif
#ifdef __cplusplus
};
#endif
#endif

View file

@ -1,36 +0,0 @@
#ifndef _MSL_COMMON_STRING_H
#define _MSL_COMMON_STRING_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/stddef.h"
#ifdef __cplusplus
extern "C" {
#endif
__declspec(section ".init") void* memcpy(void* dest, const void* src, size_t n);
__declspec(section ".init") void __fill_mem(void* dest, int val, size_t count);
__declspec(section ".init") void* memset(void* dest, int val, size_t count);
int memcmp(const void* lhs, const void* rhs, size_t count);
void* __memrchr(const void* ptr, int ch, size_t count);
void* memchr(const void* ptr, int ch, size_t count);
void* memmove(void* dst, const void* src, size_t n);
char* strrchr(const char* str, int c);
char* strchr(const char* str, int c);
int strncmp(const char* str1, const char* str2, size_t n);
int strcmp(const char* str1, const char* str2);
char* strcat(char* dst, const char* src);
char* strncpy(char* dst, const char* src, size_t n);
char* strcpy(char* dst, const char* src);
size_t strlen(const char* str);
#ifdef __cplusplus
};
namespace std {
using ::strlen;
using ::strrchr;
}; // namespace std
#endif
#endif /* _MSL_COMMON_STRING_H */

View file

@ -1,19 +1,39 @@
#ifndef STDARG_H
#define STDARG_H
#ifndef _MSL_COMMON_STDARG_H
#define _MSL_COMMON_STDARG_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __MWERKS__
typedef struct {
char gpr;
char fpr;
char reserved[2];
char* input_arg_area;
char* reg_save_area;
char gpr;
char fpr;
char reserved[2];
char* input_arg_area;
char* reg_save_area;
} __va_list[1];
typedef __va_list va_list;
#ifndef __MWERKS__
extern void __builtin_va_info(va_list*);
#endif
void* __va_arg(va_list v_list, unsigned char type);
#define va_start(ap, fmt) ((void) fmt, __builtin_va_info(&ap))
#define va_arg(ap, t) (*((t*) __va_arg(ap, _var_arg_typeof(t))))
#define va_end(ap) (void) 0
#define va_start(ap, fmt) ((void)fmt, __builtin_va_info(&ap))
#define va_arg(ap, t) (*((t*)__va_arg(ap, _var_arg_typeof(t))))
#define va_end(ap) (void)0
#endif
#else
typedef __builtin_va_list va_list;
#define va_start(v, l) __builtin_va_start(v, l)
#define va_end(v) __builtin_va_end(v)
#define va_arg(v, l) __builtin_va_arg(v, l)
#endif
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_STDARG_H */

View file

@ -10,8 +10,13 @@ extern "C" {
/* These break 1.2.5 */
//typedef __typeof__(sizeof(0)) size_t;
//typedef __typeof__((char*)0 - (char*)0) ptrdiff_t;
#ifdef __INTELLISENSE__
typedef unsigned int size_t;
typedef int ptrdiff_t;
#else
typedef unsigned long size_t;
typedef long ptrdiff_t;
#endif
#ifndef NULL
#define NULL 0L
#endif
@ -20,4 +25,4 @@ typedef long ptrdiff_t;
}
#endif
#endif
#endif

View file

@ -1,11 +1,22 @@
#ifndef _STRING_H_
#define _STRING_H_
typedef unsigned long size_t;
#include "stddef.h"
void* memcpy(void* dst, const void* src, size_t n);
void* memset(void* dst, int val, size_t n);
#ifdef __MWERKS__
__declspec(section ".init") void* memcpy(void* dest, const void* src, size_t n);
__declspec(section ".init") void __fill_mem(void* dest, int val, size_t count);
__declspec(section ".init") void* memset(void* dest, int val, size_t count);
#else
void* memcpy(void* dest, const void* src, size_t n);
void __fill_mem(void* dest, int val, size_t count);
void* memset(void* dest, int val, size_t count);
#endif
int memcmp(const void* lhs, const void* rhs, size_t count);
void* __memrchr(const void* ptr, int ch, size_t count);
void* memchr(const void* ptr, int ch, size_t count);
void* memmove(void* dst, const void* src, size_t n);
char* strrchr(const char* str, int c);
char* strchr(const char* str, int c);
int strncmp(const char* str1, const char* str2, size_t n);
@ -15,4 +26,4 @@ char* strncpy(char* dst, const char* src, size_t n);
char* strcpy(char* dst, const char* src);
size_t strlen(const char* str);
#endif
#endif

View file

@ -1,7 +1,7 @@
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/direct_io.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/buffer_io.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/misc_io.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/string.h"
#include "string.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/wchar_io.h"
size_t fwrite(const void* buffer, size_t size, size_t count, FILE* stream)

View file

@ -1,4 +1,4 @@
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/string.h"
#include "string.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/mem_funcs.h"
void* memmove(void* dst, const void* src, size_t n)

View file

@ -5,9 +5,9 @@
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/scanf.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/stdio.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/stdlib.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/string.h"
#include "string.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/wchar_io.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/stdarg.h"
#include "stdarg.h"
extern void __num2dec(const decform*, double, decimal*);

View file

@ -1,4 +1,4 @@
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/string.h"
#include "string.h"
static int K1 = 0x80808080;
static int K2 = 0xFEFEFEFF;