Import gx, PadClamp, rest of mtx, TRK 2.6 and MSL (#525)

* Match mtx and Padclamp.c

* Match the rest of GX

* Import TRK 2.6

* Import MSL headers and files

* Merge some MSL headers into ours
This commit is contained in:
dbalatoni13 2025-01-12 15:11:23 +01:00 committed by GitHub
parent a79294aac0
commit cdb1d1fc37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
113 changed files with 11219 additions and 394 deletions

View file

@ -0,0 +1,18 @@
#ifndef _MSL_COMMON_FILE_POS_H
#define _MSL_COMMON_FILE_POS_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h"
#ifdef __cplusplus
extern "C" {
#endif
int fseek(FILE* file, unsigned long offset, int mode);
int _fseek(FILE* file, fpos_t offset, int mode);
long ftell(FILE* file);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_FILE_POS_H */

View file

@ -0,0 +1,17 @@
#ifndef _MSL_COMMON_ABORT_EXIT_H
#define _MSL_COMMON_ABORT_EXIT_H
#ifdef __cplusplus
extern "C" {
#endif
void exit(int status);
void abort(void);
extern void (*__stdio_exit)(void);
#ifdef __cplusplus
};
#endif
#endif /* _MSL_COMMON_ABORT_EXIT_H */

View file

@ -0,0 +1,16 @@
#ifndef _MSL_COMMON_ALLOC_H
#define _MSL_COMMON_ALLOC_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h"
#ifdef __cplusplus
extern "C" {
#endif
void free(void* ptr);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_ALLOC_H */

View file

@ -0,0 +1,133 @@
#ifndef _MSL_COMMON_ANSI_FILES_H
#define _MSL_COMMON_ANSI_FILES_H
#include "stddef.h"
#ifdef __cplusplus
extern "C" {
#endif
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
typedef unsigned long __file_handle;
typedef unsigned long fpos_t;
#ifndef __cplusplus
typedef unsigned short wchar_t;
#endif
#define set_error(file) \
do { \
(file)->file_state.error = 1; \
(file)->buffer_length = 0; \
} while (0)
enum __file_kinds {
__closed_file,
__disk_file,
__console_file,
__string_file,
__unavailable_file,
};
enum __file_orientation {
/* 0x0 */ UNORIENTED,
/* 0x1 */ CHAR_ORIENTED,
/* 0x2 */ WIDE_ORIENTED,
};
typedef struct _file_modes {
unsigned int open_mode : 2;
unsigned int io_mode : 3;
unsigned int buffer_mode : 2;
unsigned int file_kind : 3;
unsigned int file_orientation : 2;
unsigned int binary_io : 1;
} file_modes;
enum __io_modes {
__read = 1,
__write = 2,
__read_write = 3,
__append = 4,
};
enum __io_states {
__neutral,
__writing,
__reading,
__rereading,
};
enum __io_results {
__no_io_error,
__io_error,
__io_EOF,
};
typedef struct _file_states {
unsigned int io_state : 3;
unsigned int free_buffer : 1;
unsigned char eof;
unsigned char error;
} file_states;
typedef void (*__idle_proc)(void);
typedef int (*__pos_proc)(__file_handle file, fpos_t* position, int mode,
__idle_proc idle_proc);
typedef int (*__io_proc)(__file_handle file, unsigned char* buff, size_t* count,
__idle_proc idle_proc);
typedef int (*__close_proc)(__file_handle file);
typedef struct _FILE {
__file_handle handle;
file_modes file_mode;
file_states file_state;
char char_buffer;
char char_buffer_overflow;
char ungetc_buffer[2];
wchar_t ungetc_wide_buffer[2];
unsigned long position;
unsigned char* buffer;
unsigned long buffer_size;
unsigned char* buffer_ptr;
unsigned long buffer_length;
unsigned long buffer_alignment;
unsigned long save_buffer_length;
unsigned long buffer_position;
__pos_proc position_fn;
__io_proc read_fn;
__io_proc write_fn;
__close_proc close_fn;
__idle_proc idle_fn;
} FILE;
typedef struct _files {
FILE _stdin;
FILE _stdout;
FILE _stderr;
} files;
#define _IONBF 0
#define _IOLBF 1
#define _IOFBF 2
extern files __files;
extern int __close_console(__file_handle file);
extern int __write_console(__file_handle file, unsigned char* buf,
size_t* count, __idle_proc idle_fn);
extern int __read_console(__file_handle file, unsigned char* buf, size_t* count,
__idle_proc idle_fn);
unsigned int __flush_all(void);
void __close_all(void);
#ifdef __cplusplus
};
#endif
#endif /* _MSL_COMMON_ANSI_FILES_H */

View file

@ -0,0 +1,36 @@
#ifndef _MSL_COMMON_ANSI_FP_H
#define _MSL_COMMON_ANSI_FP_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/float.h"
#define SIGDIGLEN 36
typedef struct decimal {
char sign;
char unk1;
short exp;
struct {
unsigned char length;
unsigned char text[36];
unsigned char unk41;
} sig;
} decimal;
typedef struct decform {
char style;
char unk1;
short digits;
} decform;
/* void __ull2dec(decimal*, u64);
void __timesdec(decimal*, const decimal*, const decimal*);
void __str2dec(decimal*, const char*, short);
void __two_exp(decimal*, s16);
BOOL __equals_dec(const decimal*, const decimal*);
BOOL __less_dec(const decimal*, const decimal*);
void __minus_dec(decimal*, const decimal*, const decimal*);
void __num2dec_internal(decimal*, f64);
void __num2dec(const decform*, f64, decimal*);
f64 __dec2num(const decimal*); */
#endif

View file

@ -0,0 +1,19 @@
#ifndef _MSL_COMMON_ARITH_H
#define _MSL_COMMON_ARITH_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
int quot; /* quotient */
int rem; /* remainder */
} div_t;
div_t div(int numerator, int denominator);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_ARITH_H */

View file

@ -0,0 +1,11 @@
#ifndef _MSL_COMMON_BUFFER_IO_H
#define _MSL_COMMON_BUFFER_IO_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h"
enum { __align_buffer, __dont_align_buffer };
void __prep_buffer(FILE* file);
int __flush_buffer(FILE* file, size_t* bytes_flushed);
#endif /* _MSL_COMMON_BUFFER_IO_H */

View file

@ -0,0 +1,17 @@
#ifndef _MSL_COMMON_CHAR_IO_H
#define _MSL_COMMON_CHAR_IO_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h"
#ifdef __cplusplus
extern "C" {
#endif
int fputs(const char* str, FILE* stream);
int __put_char(int c, FILE* stream);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_CHAR_IO_H */

View file

@ -0,0 +1,30 @@
#ifndef _MSL_COMMON_CRITICAL_REGIONS_H
#define _MSL_COMMON_CRITICAL_REGIONS_H
#ifdef __cplusplus
extern "C" {
#endif
enum critical_regions {
atexit_funcs_access,
malloc_pool_access,
stdin_access,
stdout_access,
stderr_access,
files_access,
console_status_access,
signal_funcs_access,
thread_access,
num_critical_regions
};
void __init_critical_regions(void);
void __kill_critical_regions(void);
void __begin_critical_region(int region);
void __end_critical_region(int region);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,76 @@
#ifndef _MSL_COMMON_CTYPE_H
#define _MSL_COMMON_CTYPE_H
#ifdef __cplusplus
extern "C" {
#endif
#define EOF -1L
extern const unsigned char __ctype_map[];
extern const unsigned char __lower_map[];
extern const unsigned char __upper_map[];
#define __control_char 0x01
#define __motion_char 0x02
#define __space_char 0x04
#define __punctuation 0x08
#define __digit 0x10
#define __hex_digit 0x20
#define __lower_case 0x40
#define __upper_case 0x80
#define __letter (__lower_case | __upper_case)
#define __alphanumeric (__letter | __digit)
#define __graphic (__alphanumeric | __punctuation)
#define __printable (__graphic | __space_char)
#define __whitespace (__motion_char | __space_char)
#define __control (__motion_char | __control_char)
#define __zero_fill(c) ((int)(unsigned char)(c))
int tolower(int c);
int toupper(int c);
inline int isalpha(int c)
{
return (int)(__ctype_map[(unsigned char)c] & __letter);
}
inline int isdigit(int c)
{
return (int)(__ctype_map[(unsigned char)c] & __digit);
}
inline int isspace(int c)
{
return (int)(__ctype_map[(unsigned char)c] & __whitespace);
}
inline int isupper(int c)
{
return (int)(__ctype_map[(unsigned char)c] & __upper_case);
}
inline int isxdigit(int c)
{
return (int)(__ctype_map[(unsigned char)c] & __hex_digit);
}
inline int _tolower(int c)
{
return (c == -1 ? -1 : (int)__lower_map[(unsigned char)c]);
}
#ifdef __cplusplus
};
namespace std {
inline int tolower(int c)
{
return (c == -1 ? -1 : (int)__lower_map[(unsigned char)c]);
}
inline int toupper(int c)
{
return (c == -1 ? -1 : (int)__upper_map[(unsigned char)c]);
}
}; // namespace std
#endif
#endif /* _MSL_COMMON_CTYPE_H */

View file

@ -0,0 +1,17 @@
#ifndef _MSL_COMMON_DIRECT_IO_H
#define _MSL_COMMON_DIRECT_IO_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h"
#ifdef __cplusplus
extern "C" {
#endif
size_t __fwrite(const void* buffer, size_t size, size_t count, FILE* stream);
size_t fwrite(const void* buffer, size_t size, size_t count, FILE* stream);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_DIRECT_IO_H */

View file

@ -0,0 +1,20 @@
#ifndef MSL_COMMON_SRC_ERRNO_H
#define MSL_COMMON_SRC_ERRNO_H
#ifdef __cplusplus
extern "C" {
#endif
#define ENOERR 0
#define EDOM 33
#define ERANGE 34
#define EFPOS 40
#define ESIGPARM 36
extern int errno;
#ifdef __cplusplus
}
#endif
#endif /* MSL_COMMON_SRC_ERRNO_H */

View file

@ -0,0 +1,15 @@
#ifndef _MSL_COMMON_EXTRAS_H
#define _MSL_COMMON_EXTRAS_H
#ifdef __cplusplus
extern "C" {
#endif
int strnicmp(const char* str1, const char* str2, int n);
int stricmp(const char* str1, const char* str2);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_EXTRAS_H */

View file

@ -0,0 +1,18 @@
#ifndef _MSL_COMMON_FILE_IO_H
#define _MSL_COMMON_FILE_IO_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h"
#ifdef __cplusplus
extern "C" {
#endif
int __msl_strnicmp(const char* str1, const char* str2, int n);
int fflush(FILE* file);
int fclose(FILE* file);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_FILE_IO_H */

View file

@ -0,0 +1,92 @@
#ifndef _MSL_COMMON_FLOAT_H
#define _MSL_COMMON_FLOAT_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common_Embedded/Math/fdlibm.h"
#define FP_SNAN 0
#define FP_QNAN 1
#define FP_INFINITE 2
#define FP_ZERO 3
#define FP_NORMAL 4
#define FP_SUBNORMAL 5
#define FP_NAN FP_QNAN
#define fpclassify(x) \
((sizeof(x) == sizeof(float)) ? __fpclassifyf(x) : __fpclassifyd(x))
#define signbit(x) \
((sizeof(x) == sizeof(float)) ? __signbitf(x) : __signbitd(x))
#define isfinite(x) ((fpclassify(x) > 2))
#define isnan(x) ((fpclassify(x) == FP_NAN))
#define isinf(x) ((fpclassify(x) == FP_INFINITE))
#define __signbitf(x) ((int)(__HI(x) & 0x80000000))
// TODO: OK?
#define __signbitd(x) ((int)(__HI(x) & 0x80000000))
extern unsigned long __float_nan[];
extern unsigned long __float_huge[];
extern unsigned long __float_max[];
extern unsigned long __float_epsilon[];
inline int __fpclassifyf(float __value)
{
unsigned long integer = *(unsigned long*)&__value;
switch (integer & 0x7f800000) {
case 0x7f800000:
if ((integer & 0x7fffff) != 0) {
return FP_QNAN;
}
return FP_INFINITE;
case 0:
if ((integer & 0x7fffff) != 0) {
return FP_SUBNORMAL;
}
return FP_ZERO;
}
return FP_NORMAL;
}
inline int __fpclassifyd(double __value)
{
switch (__HI(__value) & 0x7ff00000) {
case 0x7ff00000: {
if ((__HI(__value) & 0x000fffff) || (__LO(__value) & 0xffffffff))
return FP_QNAN;
else
return FP_INFINITE;
break;
}
case 0: {
if ((__HI(__value) & 0x000fffff) || (__LO(__value) & 0xffffffff))
return FP_SUBNORMAL;
else
return FP_ZERO;
break;
}
}
return FP_NORMAL;
}
#define FLT_MANT_DIG 24
#define FLT_DIG 6
#define FLT_MIN_EXP (-125)
#define FLT_MIN_10_EXP (-37)
#define FLT_MAX_EXP 128
#define FLT_MAX_10_EXP 38
#define FLT_MAX 3.40282346638528860e+38f
#define FLT_EPSILON 1.1920928955078125e-07f
#define DBL_MANT_DIG 53
#define DBL_DIG 15
#define DBL_MIN_EXP (-1021)
#define DBL_MIN_10_EXP (-308)
#define DBL_MAX_EXP 1024
#define DBL_MAX_10_EXP 308
#endif /* _MSL_COMMON_FLOAT_H */

View file

@ -0,0 +1,93 @@
#ifndef _STD_LIMITS_H
#define _STD_LIMITS_H
#ifdef __cplusplus
extern "C" {
#endif
#define CHAR_BIT 8
#define SCHAR_MIN (-0x7F - 1)
#define SCHAR_MAX 0x7F
#define UCHAR_MAX 0xFF
#define CHAR_MIN 0
#define CHAR_MAX SCHAR_MAX
#define SHRT_MIN (-0x7FFF - 1)
#define SHRT_MAX 0x7FFF
#define USHRT_MAX 0xFFFF
#define INT_MIN (-0x7FFFFFFF - 1)
#define INT_MAX 0x7FFFFFFF
#define UINT_MAX 0xFFFFFFFF
#define LONG_MIN (-0x7FFFFFFFL - 1)
#define LONG_MAX 0x7FFFFFFFL
#define ULONG_MAX 0xFFFFFFFFUL
#define LLONG_MIN (-0x7FFFFFFFFFFFFFFFLL - 1)
#define LLONG_MAX 0x7FFFFFFFFFFFFFFFLL
#define ULLONG_MAX 0xFFFFFFFFFFFFFFFFULL
#ifdef __cplusplus
}
namespace std {
template <typename T> class numeric_limits {
public:
inline static T min();
inline static T max();
};
template <> class numeric_limits<char> {
public:
inline static char min() { return -0x80; }
inline static char max() { return 0x7F; }
};
template <> class numeric_limits<short> {
public:
inline static short min() { return -0x8000; }
inline static short max() { return 0x7FFF; }
};
template <> class numeric_limits<int> {
public:
inline static int min() { return -0x80000000; }
inline static int max() { return 0x7FFFFFFF; }
};
template <> class numeric_limits<long> {
public:
inline static long min() { return -0x80000000; }
inline static long max() { return 0x7FFFFFFF; }
};
template <> class numeric_limits<unsigned char> {
public:
inline static unsigned char min() { return 0x0; }
inline static unsigned char max() { return 0xFF; }
};
template <> class numeric_limits<unsigned short> {
public:
inline static unsigned short min() { return 0x0; }
inline static unsigned short max() { return 0xFFFF; }
};
template <> class numeric_limits<unsigned int> {
public:
inline static unsigned int min() { return 0x0; }
inline static unsigned int max() { return 0xFFFFFFFF; }
};
template <> class numeric_limits<unsigned long> {
public:
inline static unsigned long min() { return 0x0; }
inline static unsigned long max() { return 0xFFFFFFFF; }
};
} // namespace std
#endif
#endif

View file

@ -0,0 +1,106 @@
#ifndef MSL_MATH_H_
#define MSL_MATH_H_
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/float.h"
#define NAN (*(float*)__float_nan)
#define HUGE_VALF (*(float*)__float_huge)
#define M_PI 3.14159265358979323846f
#define M_SQRT3 1.73205f
#define DEG_TO_RAD(degrees) (degrees * (M_PI / 180.0f))
#define RAD_TO_DEG(radians) \
(radians \
* (180.0f / M_PI + 0.000005f)) // the 0.000005f is probably a fakematch
#ifdef __cplusplus
extern "C" {
#endif
int abs(int);
double acos(double);
float acosf(float);
double asin(double);
double atan(double);
double atan2(double, double);
double ceil(double);
double copysign(double, double);
double cos(double);
float cosf(float);
double exp(double);
extern double __fabs(double);
extern float __fabsf(float);
inline double fabs(double f) { return __fabs(f); }
double __frsqrte(double);
float __fres(float);
double floor(double);
double fmod(double, double);
double frexp(double, int*);
double ldexp(double, int);
double modf(double, double*);
double pow(double, double);
double sin(double);
float sinf(float);
double tan(double);
float tanf(float);
extern inline double sqrt(double x)
{
if (x > 0.0) {
double guess = __frsqrte(x); /* returns an approximation to */
guess
= .5 * guess * (3.0 - guess * guess * x); /* now have 8 sig bits */
guess
= .5 * guess * (3.0 - guess * guess * x); /* now have 16 sig bits */
guess
= .5 * guess * (3.0 - guess * guess * x); /* now have 32 sig bits */
guess = .5 * guess
* (3.0 - guess * guess * x); /* now have > 53 sig bits */
return x * guess;
} else if (x == 0)
return 0;
else if (x)
return NAN;
return HUGE_VALF;
}
#ifdef __cplusplus
};
namespace std {
inline float fabsf(float f) { return fabs(f); }
inline float abs(float f) { return fabsf(f); }
inline float fmodf(float x, float y) { return fmod(x, y); }
inline float atan2f(float y, float x) { return (float)atan2(y, x); }
inline float sinf(float x) { return sin(x); }
inline float cosf(float x) { return cos(x); }
inline float tanf(float x) { return tan(x); }
extern inline float sqrtf(float x)
{
const double _half = .5;
const double _three = 3.0;
volatile float y;
if (x > 0.0f) {
double guess = __frsqrte((double)x); // returns an approximation to
guess = _half * guess
* (_three - guess * guess * x); // now have 12 sig bits
guess = _half * guess
* (_three - guess * guess * x); // now have 24 sig bits
guess = _half * guess
* (_three - guess * guess * x); // now have 32 sig bits
y = (float)(x * guess);
return y;
}
return x;
}
}; // namespace std
#endif
#endif

View file

@ -0,0 +1,16 @@
#ifndef _MSL_COMMON_MBSTRING_H
#define _MSL_COMMON_MBSTRING_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/wchar_io.h"
#ifdef __cplusplus
extern "C" {
#endif
size_t wcstombs(char* dst, const wchar_t* src, size_t n);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_MBSTRING_H */

View file

@ -0,0 +1,19 @@
#ifndef _MSL_COMMON_MEM_FUNCS_H
#define _MSL_COMMON_MEM_FUNCS_H
#include "stddef.h"
#ifdef __cplusplus
extern "C" {
#endif
void __copy_longs_rev_unaligned(void* dst, const void* src, size_t n);
void __copy_longs_unaligned(void* dst, const void* src, size_t n);
void __copy_longs_rev_aligned(void* dst, const void* src, size_t n);
void __copy_longs_aligned(void* dst, const void* src, size_t n);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_MEM_FUNCS_H */

View file

@ -0,0 +1,14 @@
#ifndef _MSL_COMMON_MISC_IO_H
#define _MSL_COMMON_MISC_IO_H
#ifdef __cplusplus
extern "C" {
#endif
void __stdio_atexit(void);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_MISC_IO_H */

View file

@ -0,0 +1,22 @@
#ifndef _MSL_COMMON_PRINTF_H
#define _MSL_COMMON_PRINTF_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h"
#include "stdarg.h"
#ifdef __cplusplus
extern "C" {
#endif
int fprintf(FILE* stream, const char* format, ...);
int printf(const char* format, ...);
int sprintf(char* s, const char* format, ...);
int snprintf(char* s, size_t n, const char* format, ...);
int vsnprintf(char* s, size_t n, const char* format, va_list arg);
int vprintf(const char* format, va_list arg);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_PRINTF_H */

View file

@ -0,0 +1,43 @@
#ifndef _MSL_COMMON_SCANF_H
#define _MSL_COMMON_SCANF_H
#include "stddef.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h"
#ifdef __cplusplus
extern "C" {
#endif
enum __ReadProcActions { __GetAChar, __UngetAChar, __TestForError };
enum __WReadProcActions { __GetAwChar, __UngetAwChar, __TestForwcsError };
typedef struct {
char* CharStr;
size_t MaxCharCount;
size_t CharsWritten;
} __OutStrCtrl;
typedef struct {
char* NextChar;
int NullCharDetected;
} __InStrCtrl;
typedef struct {
wchar_t* wCharStr;
size_t MaxCharCount;
size_t CharsWritten;
} __wOutStrCtrl;
typedef struct {
wchar_t* wNextChar;
int wNullCharDetected;
} __wInStrCtrl;
int __StringRead(void* str, int ch, int behavior);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_SCANF_H */

View file

@ -0,0 +1,16 @@
#ifndef _MSL_COMMON_SIGNAL_H
#define _MSL_COMMON_SIGNAL_H
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*__signal_func_ptr)(int);
int raise(int sig);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_SIGNAL_H */

View file

@ -0,0 +1,13 @@
#ifndef MSL_STDIO_H_
#define MSL_STDIO_H_
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/char_io.h" // IWYU pragma: export
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/file_io.h" // IWYU pragma: export
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/printf.h" // IWYU pragma: export
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/extras.h" // IWYU pragma: export
#define stdin (&__files._stdin)
#define stdout (&__files._stdout)
#define stderr (&__files._stderr)
#endif

View file

@ -0,0 +1,9 @@
#ifndef MSL_STDLIB_H_
#define MSL_STDLIB_H_
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/abort_exit.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/arith.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/mbstring.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/strtoul.h"
#endif

View file

@ -0,0 +1,18 @@
#ifndef _MSL_COMMON_STRTOUL_H
#define _MSL_COMMON_STRTOUL_H
#ifdef __cplusplus
extern "C" {
#endif
long strtol(const char* str, char** end, int base);
unsigned long strtoul(const char* str, char** end, int base);
unsigned long __strtoul(int base, int max_width,
int (*ReadProc)(void*, int, int), void* ReadProcArg,
int* chars_scanned, int* negative, int* overflow);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_STRTOUL_H */

View file

@ -0,0 +1,12 @@
#ifndef _MSL_COMMON_WCHAR_IO_H
#define _MSL_COMMON_WCHAR_IO_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h"
#ifndef __cplusplus
typedef unsigned short wchar_t;
#endif
int fwide(FILE* file, int mode);
#endif /* _MSL_COMMON_WCHAR_IO_H */

View file

@ -0,0 +1,234 @@
#ifndef _FDLIBM_H
#define _FDLIBM_H
/* @(#)fdlibm.h 1.5 04/04/22 */
/**
* ====================================================
* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
*
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
#ifdef __cplusplus
extern "C" {
#endif // ifdef __cplusplus
/* Sometimes it's necessary to define __LITTLE_ENDIAN explicitly
but these catch some common cases. */
#if defined(i386) || defined(i486) || defined(intel) || defined(x86) \
|| defined(i86pc) || defined(__alpha) || defined(__osf__)
#define __LITTLE_ENDIAN
#endif
#ifdef __LITTLE_ENDIAN
#define __HI(x) *(1 + (int*)&x)
#define __LO(x) *(int*)&x
#define __HIp(x) *(1 + (int*)x)
#define __LOp(x) *(int*)x
#else
#define __HI(x) *(int*)&x
#define __LO(x) *(1 + (int*)&x)
#define __HIp(x) *(int*)x
#define __LOp(x) *(1 + (int*)x)
#endif
// NOTE: should be enabled according to w_atan2.c
#define _IEEE_LIBM
// TODO: should __STDC__ actually be defined?
// #ifdef __STDC__
#define __P(p) p
// #else
// #define __P(p) ()
// #endif
/**
* ANSI/POSIX
*/
extern int signgam;
#define MAXFLOAT ((f32)3.40282346638528860e+38)
enum fdversion { fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix };
#define _LIB_VERSION_TYPE enum fdversion
#define _LIB_VERSION _fdlib_version
/* if global variable _LIB_VERSION is not desirable, one may
* change the following to be a constant by:
* #define _LIB_VERSION_TYPE const enum version
* In that case, after one initializes the value _LIB_VERSION (see
* s_lib_version.c) during compile time, it cannot be modified
* in the middle of a program
*/
extern _LIB_VERSION_TYPE _LIB_VERSION;
#define _IEEE_ fdlibm_ieee
#define _SVID_ fdlibm_svid
#define _XOPEN_ fdlibm_xopen
#define _POSIX_ fdlibm_posix
struct exception {
int type;
char* name;
double arg1;
double arg2;
double retval;
};
#define HUGE MAXFLOAT
/**
* set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
* (one may replace the following line by "#include <values.h>")
*/
#define X_TLOSS 1.41484755040568800000e+16
#define DOMAIN 1
#define SING 2
#define OVERFLOW 3
#define UNDERFLOW 4
#define TLOSS 5
#define PLOSS 6
/**
* ANSI/POSIX
*/
extern double acos __P((double));
extern double asin __P((double));
extern double atan __P((double));
extern double atan2 __P((double, double));
extern double cos __P((double));
extern double sin __P((double));
extern double tan __P((double));
extern double cosh __P((double));
extern double sinh __P((double));
extern double tanh __P((double));
extern double exp __P((double));
extern double frexp __P((double, int*));
extern double ldexp __P((double, int));
extern double scalbn __P((double, int));
extern double log __P((double));
extern double log10 __P((double));
extern double modf __P((double, double*));
extern double pow __P((double, double));
extern double sqrt __P((double));
extern double ceil __P((double));
extern double fabs __P((double));
// NOTE: I have no idea how they got it to mangle like this
extern double fabs__Fd(double);
extern double floor __P((double));
extern double fmod __P((double, double));
extern double erf __P((double));
extern double erfc __P((double));
extern double gamma __P((double));
extern double hypot __P((double, double));
extern int isnan __P((double));
extern int finite __P((double));
extern double j0 __P((double));
extern double j1 __P((double));
extern double jn __P((int, double));
extern double lgamma __P((double));
extern double y0 __P((double));
extern double y1 __P((double));
extern double yn __P((int, double));
extern double acosh __P((double));
extern double asinh __P((double));
extern double atanh __P((double));
extern double cbrt __P((double));
extern double logb __P((double));
extern double nextafter __P((double, double));
extern double remainder __P((double, double));
#ifdef _SCALB_INT
extern double scalb __P((double, int));
#else
extern double scalb __P((double, double));
#endif
extern int matherr __P((struct exception*));
/**
* IEEE Test Vector
*/
extern double significand __P((double));
/**
* Functions callable from C, intended to support IEEE arithmetic.
*/
extern double copysign __P((double, double));
extern int ilogb __P((double));
extern double rint __P((double));
extern double scalbn __P((double, int));
/**
* BSD math library entry points
*/
extern double expm1 __P((double));
extern double log1p __P((double));
/**
* Reentrant version of gamma & lgamma; passes signgam back by reference
* as the second argument; user must allocate space for signgam.
*/
#ifdef _REENTRANT
extern double gamma_r __P((double, int*));
extern double lgamma_r __P((double, int*));
#endif /* _REENTRANT */
/* ieee style elementary functions */
extern double __ieee754_sqrt __P((double));
extern double __ieee754_acos __P((double));
extern double __ieee754_acosh __P((double));
extern double __ieee754_log __P((double));
extern double __ieee754_atanh __P((double));
extern double __ieee754_asin __P((double));
extern double __ieee754_atan2 __P((double, double));
extern double __ieee754_exp __P((double));
extern double __ieee754_cosh __P((double));
extern double __ieee754_fmod __P((double, double));
extern double __ieee754_pow __P((double, double));
extern double __ieee754_lgamma_r __P((double, int*));
extern double __ieee754_gamma_r __P((double, int*));
extern double __ieee754_lgamma __P((double));
extern double __ieee754_gamma __P((double));
extern double __ieee754_log10 __P((double));
extern double __ieee754_sinh __P((double));
extern double __ieee754_hypot __P((double, double));
extern double __ieee754_j0 __P((double));
extern double __ieee754_j1 __P((double));
extern double __ieee754_y0 __P((double));
extern double __ieee754_y1 __P((double));
extern double __ieee754_jn __P((int, double));
extern double __ieee754_yn __P((int, double));
extern double __ieee754_remainder __P((double, double));
extern int __ieee754_rem_pio2 __P((double, double*));
#ifdef _SCALB_INT
extern double __ieee754_scalb __P((double, int));
#else
extern double __ieee754_scalb __P((double, double));
#endif
/* fdlibm kernel function */
extern double __kernel_standard __P((double, double, int));
extern double __kernel_sin __P((double, double, int));
extern double __kernel_cos __P((double, double));
extern double __kernel_tan __P((double, double, int));
extern int __kernel_rem_pio2 __P((double*, double*, int, int, int, const int*));
#ifdef __cplusplus
};
#endif // ifdef __cplusplus
#endif