diff --git a/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h b/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h index 924c0b2d..f06c55df 100644 --- a/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h +++ b/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h @@ -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" { diff --git a/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/mem_funcs.h b/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/mem_funcs.h index 7d6853c3..0e245466 100644 --- a/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/mem_funcs.h +++ b/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/mem_funcs.h @@ -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" { diff --git a/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/printf.h b/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/printf.h index 0184466f..e716867f 100644 --- a/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/printf.h +++ b/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/printf.h @@ -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" { diff --git a/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/scanf.h b/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/scanf.h index f1bb9399..c6451e34 100644 --- a/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/scanf.h +++ b/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/scanf.h @@ -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 diff --git a/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/stdarg.h b/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/stdarg.h deleted file mode 100644 index e2cceee7..00000000 --- a/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/stdarg.h +++ /dev/null @@ -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 */ diff --git a/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/stddef.h b/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/stddef.h deleted file mode 100644 index dfc77467..00000000 --- a/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/stddef.h +++ /dev/null @@ -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 diff --git a/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/string.h b/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/string.h deleted file mode 100644 index 2bfbd8fa..00000000 --- a/include/PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/string.h +++ /dev/null @@ -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 */ diff --git a/include/stdarg.h b/include/stdarg.h index 1ca0f853..e2cceee7 100644 --- a/include/stdarg.h +++ b/include/stdarg.h @@ -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 \ No newline at end of file +#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 */ diff --git a/include/stddef.h b/include/stddef.h index 5a133946..71816c2b 100644 --- a/include/stddef.h +++ b/include/stddef.h @@ -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 \ No newline at end of file +#endif diff --git a/include/string.h b/include/string.h index 583a906d..92f8f122 100644 --- a/include/string.h +++ b/include/string.h @@ -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 \ No newline at end of file +#endif diff --git a/src/MSL_C.PPCEABI.bare.H/direct_io.c b/src/MSL_C.PPCEABI.bare.H/direct_io.c index ba963b42..51184220 100644 --- a/src/MSL_C.PPCEABI.bare.H/direct_io.c +++ b/src/MSL_C.PPCEABI.bare.H/direct_io.c @@ -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) diff --git a/src/MSL_C.PPCEABI.bare.H/mem.c b/src/MSL_C.PPCEABI.bare.H/mem.c index 519a6f56..63a4434f 100644 --- a/src/MSL_C.PPCEABI.bare.H/mem.c +++ b/src/MSL_C.PPCEABI.bare.H/mem.c @@ -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) diff --git a/src/MSL_C.PPCEABI.bare.H/printf.c b/src/MSL_C.PPCEABI.bare.H/printf.c index 4fe8c869..21d248da 100644 --- a/src/MSL_C.PPCEABI.bare.H/printf.c +++ b/src/MSL_C.PPCEABI.bare.H/printf.c @@ -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*); diff --git a/src/MSL_C.PPCEABI.bare.H/string.c b/src/MSL_C.PPCEABI.bare.H/string.c index c4681838..833447df 100644 --- a/src/MSL_C.PPCEABI.bare.H/string.c +++ b/src/MSL_C.PPCEABI.bare.H/string.c @@ -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;