From 5773ee904cc2e3a4ead5b88c9d1523b8d56b19a0 Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Wed, 27 Dec 2023 21:07:21 -0800 Subject: [PATCH 1/4] reorganize MSL_C/Runtime files. wip, notmatching --- config/GZLE01/splits.txt | 110 +- config/GZLJ01/splits.txt | 110 +- config/GZLP01/splits.txt | 110 +- configure.py | 117 +- include/JSystem/JGeometry.h | 4 +- include/JSystem/JMath/JMATrigonometric.h | 2 +- include/JSystem/JUtility/JUTConsole.h | 2 +- include/JSystem/JUtility/JUTDirectPrint.h | 2 +- include/JSystem/JUtility/JUTException.h | 2 +- include/JSystem/JUtility/JUTFont.h | 2 +- include/MSL_C/MSL_Common/Src/FILE_POS.h | 18 - include/MSL_C/MSL_Common/Src/alloc.h | 17 - include/MSL_C/MSL_Common/Src/arith.h | 19 - include/MSL_C/MSL_Common/Src/buffer_io.h | 11 - include/MSL_C/MSL_Common/Src/file_io.h | 18 - include/MSL_C/MSL_Common/Src/limits | 70 - include/MSL_C/MSL_Common/Src/mbstring.h | 16 - include/MSL_C/MSL_Common/Src/mem.h | 19 - include/MSL_C/MSL_Common/Src/misc_io.h | 14 - include/MSL_C/MSL_Common/Src/printf.h | 22 - include/MSL_C/MSL_Common/Src/scanf.h | 14 - include/MSL_C/MSL_Common/Src/signal.h | 14 - include/MSL_C/MSL_Common/Src/string.h | 26 - include/MSL_C/MSL_Common/Src/strtoul.h | 16 - include/MSL_C/MSL_Common/Src/wchar_io.h | 12 - .../MSL_C/MSL_Common_Embedded/Src/ansi_fp.h | 4 - include/MSL_C/Math/Double_precision/e_acos.h | 4 - include/MSL_C/Math/Double_precision/e_asin.h | 4 - include/MSL_C/Math/Double_precision/e_atan2.h | 4 - include/MSL_C/Math/Double_precision/e_exp.h | 4 - include/MSL_C/Math/Double_precision/e_fmod.h | 4 - include/MSL_C/Math/Double_precision/e_pow.h | 4 - .../MSL_C/Math/Double_precision/e_rem_pio2.h | 4 - include/MSL_C/Math/Double_precision/e_sqrt.h | 4 - include/MSL_C/Math/Double_precision/k_cos.h | 4 - .../MSL_C/Math/Double_precision/k_rem_pio2.h | 4 - include/MSL_C/Math/Double_precision/k_sin.h | 4 - include/MSL_C/Math/Double_precision/k_tan.h | 4 - include/MSL_C/Math/Double_precision/s_atan.h | 4 - include/MSL_C/Math/Double_precision/s_ceil.h | 4 - .../MSL_C/Math/Double_precision/s_copysign.h | 4 - include/MSL_C/Math/Double_precision/s_cos.h | 4 - include/MSL_C/Math/Double_precision/s_floor.h | 4 - include/MSL_C/Math/Double_precision/s_frexp.h | 4 - include/MSL_C/Math/Double_precision/s_ldexp.h | 4 - include/MSL_C/Math/Double_precision/s_modf.h | 4 - include/MSL_C/Math/Double_precision/s_sin.h | 4 - include/MSL_C/Math/Double_precision/s_tan.h | 4 - include/MSL_C/Math/Double_precision/w_acos.h | 4 - include/MSL_C/Math/Double_precision/w_asin.h | 4 - include/MSL_C/Math/Double_precision/w_atan2.h | 4 - include/MSL_C/Math/Double_precision/w_exp.h | 4 - include/MSL_C/Math/Double_precision/w_fmod.h | 6 - include/MSL_C/Math/Double_precision/w_pow.h | 4 - include/MSL_C/Math/Double_precision/w_sqrt.h | 4 - include/MSL_C/algorithm.h | 15 - include/MSL_C/bitset.h | 15 - include/MSL_C/float.h | 10 - include/MSL_C/stdlib.h | 9 - include/MSL_C/string.h | 9 - include/Runtime.PPCEABI.H/__mem.h | 16 - include/SSystem/SComponent/c_m3d.h | 2 +- include/SSystem/SComponent/c_xyz.h | 2 +- include/d/d_event_manager.h | 2 +- include/dolphin/os/OS.h | 2 +- include/dolphin/types.h | 2 +- include/f_op/f_op_actor_mng.h | 2 +- include/m_Do/m_Do_printf.h | 2 +- src/DynamicLink.cpp | 2 +- src/JSystem/J2DGraph/J2DPrint.cpp | 2 +- src/JSystem/J3DGraphBase/J3DMatBlock.cpp | 2 +- src/JSystem/J3DGraphBase/J3DPacket.cpp | 2 +- src/JSystem/J3DU/J3DUClipper.cpp | 2 +- src/JSystem/JAudio/JAIBasic.cpp | 2 +- src/JSystem/JAudio/JAIInitData.cpp | 2 +- src/JSystem/JAudio/JAISequenceMgr.cpp | 2 +- src/JSystem/JAudio/JAIStreamMgr.cpp | 2 +- src/JSystem/JAudio/JASCalc.cpp | 2 +- src/JSystem/JAudio/JASHardStream.cpp | 2 +- src/JSystem/JAudio/JASWaveArcLoader.cpp | 2 +- src/JSystem/JKernel/JKRAram.cpp | 2 +- src/JSystem/JKernel/JKRAramArchive.cpp | 4 +- src/JSystem/JKernel/JKRArchivePri.cpp | 4 +- src/JSystem/JKernel/JKRCompArchive.cpp | 4 +- src/JSystem/JKernel/JKRDvdAramRipper.cpp | 2 +- src/JSystem/JKernel/JKRDvdArchive.cpp | 4 +- src/JSystem/JKernel/JKRDvdRipper.cpp | 2 +- src/JSystem/JKernel/JKRExpHeap.cpp | 2 +- src/JSystem/JKernel/JKRFileCache.cpp | 4 +- src/JSystem/JKernel/JKRFileLoader.cpp | 4 +- src/JSystem/JKernel/JKRMemArchive.cpp | 2 +- src/JSystem/JKernel/JKRSolidHeap.cpp | 2 +- src/JSystem/JKernel/JKRStdHeap.cpp | 2 +- src/JSystem/JMath/JMath.cpp | 2 +- src/JSystem/JParticle/JPAResourceManager.cpp | 2 +- src/JSystem/JSupport/JSUMemoryStream.cpp | 2 +- src/JSystem/JUtility/JUTAssert.cpp | 2 +- src/JSystem/JUtility/JUTConsole.cpp | 4 +- src/JSystem/JUtility/JUTDbPrint.cpp | 4 +- src/JSystem/JUtility/JUTDirectPrint.cpp | 2 +- src/JSystem/JUtility/JUTException.cpp | 8 +- src/JSystem/JUtility/JUTGamePad.cpp | 2 +- src/JSystem/JUtility/JUTNameTab.cpp | 2 +- .../MSL_C++/MSL_Common/Include/algorithm.h | 48 + .../MSL/MSL_C++/MSL_Common/Include/bitset.h | 81 ++ .../MSL_C++/MSL_Common/Include}/functional.h | 3 +- .../MSL/MSL_C++/MSL_Common/Include}/new.h | 2 +- .../MSL/MSL_C++/MSL_Common/Include}/utility.h | 0 .../MSL/MSL_C/MSL_Common/Include/FILE_POS.h | 18 + .../MSL_C/MSL_Common/Include}/abort_exit.h | 6 +- .../MSL/MSL_C/MSL_Common/Include/alloc.h | 16 + .../MSL_C/MSL_Common/Include}/ansi_files.h | 14 +- .../MSL/MSL_C/MSL_Common/Include/ansi_fp.h | 36 + .../MSL/MSL_C/MSL_Common/Include/arith.h | 19 + .../MSL/MSL_C/MSL_Common/Include/buffer_io.h | 11 + .../MSL/MSL_C/MSL_Common/Include}/char_io.h | 8 +- .../MSL_Common/Include/critical_regions.h | 30 + .../MSL/MSL_C/MSL_Common/Include}/ctype.h | 15 +- .../MSL/MSL_C/MSL_Common/Include}/direct_io.h | 8 +- .../MSL/MSL_C/MSL_Common/Include/errno.h | 20 + .../MSL/MSL_C/MSL_Common/Include}/extras.h | 6 +- .../MSL/MSL_C/MSL_Common/Include/file_io.h | 18 + .../MSL/MSL_C/MSL_Common/Include}/float.h | 59 +- .../MSL/MSL_C/MSL_Common/Include/limits.h | 102 ++ .../MSL/MSL_C/MSL_Common/Include}/math.h | 8 +- .../MSL/MSL_C/MSL_Common/Include/mbstring.h | 16 + .../MSL/MSL_C/MSL_Common/Include}/mem_funcs.h | 8 +- .../MSL/MSL_C/MSL_Common/Include/misc_io.h | 14 + .../MSL/MSL_C/MSL_Common/Include/printf.h | 22 + .../MSL/MSL_C/MSL_Common/Include/scanf.h | 43 + .../MSL/MSL_C/MSL_Common/Include/signal.h | 16 + .../MSL/MSL_C/MSL_Common/Include}/stddef.h | 4 +- .../MSL/MSL_C/MSL_Common/Include}/stdio.h | 7 +- .../MSL/MSL_C/MSL_Common/Include/stdlib.h | 9 + .../MSL/MSL_C/MSL_Common/Include/string.h | 31 + .../MSL/MSL_C/MSL_Common/Include/strtoul.h | 17 + .../MSL/MSL_C/MSL_Common/Include/wchar_io.h | 12 + .../MSL/MSL_C/MSL_Common/Src/FILE_POS.c | 99 ++ .../MSL/MSL_C/MSL_Common/Src/abort_exit.c | 45 + .../MSL/MSL_C/MSL_Common/Src/alloc.c | 345 +++++ .../MSL/MSL_C/MSL_Common/Src/ansi_files.c | 149 ++ .../MSL/MSL_C/MSL_Common/Src/arith.c | 35 + .../MSL/MSL_C/MSL_Common/Src/buffer_io.c | 41 + .../MSL/MSL_C/MSL_Common/Src/ctype.c | 78 ++ .../MSL/MSL_C/MSL_Common/Src/direct_io.c | 117 ++ .../MSL/MSL_C/MSL_Common/Src/errno.c | 3 + .../MSL/MSL_C/MSL_Common/Src/file_io.c | 69 + .../MSL/MSL_C/MSL_Common/Src/float.c | 5 + .../MSL/MSL_C/MSL_Common/Src/mbstring.c | 64 + .../MSL/MSL_C/MSL_Common/Src/mem.c | 81 ++ .../MSL/MSL_C/MSL_Common/Src/mem_funcs.c | 217 +++ .../MSL/MSL_C/MSL_Common/Src/misc_io.c | 7 + .../MSL/MSL_C/MSL_Common/Src/printf.c | 1232 +++++++++++++++++ .../MSL/MSL_C/MSL_Common/Src/scanf.c | 33 + .../MSL/MSL_C/MSL_Common/Src/string.c | 238 ++++ .../MSL/MSL_C/MSL_Common/Src/strtoul.c | 200 +++ .../MSL/MSL_C/MSL_Common/Src/wchar_io.c | 21 + .../Math/Double_precision/e_acos.c | 105 ++ .../Math/Double_precision/e_asin.c | 116 ++ .../Math/Double_precision/e_atan2.c | 143 ++ .../Math/Double_precision/e_fmod.c | 167 +++ .../Math/Double_precision/e_rem_pio2.c | 180 +++ .../Math/Double_precision/k_cos.c | 93 ++ .../Math/Double_precision/k_rem_pio2.c | 353 +++++ .../Math/Double_precision/k_sin.c | 80 ++ .../Math/Double_precision/k_tan.c | 180 +++ .../Math/Double_precision/s_atan.c | 143 ++ .../Math/Double_precision/s_copysign.c | 30 + .../Math/Double_precision/s_cos.c | 81 ++ .../Math/Double_precision/s_floor.c | 89 ++ .../Math/Double_precision/s_frexp.c | 57 + .../Math/Double_precision/s_ldexp.c | 58 + .../Math/Double_precision/s_modf.c | 79 ++ .../Math/Double_precision/s_sin.c | 82 ++ .../Math/Double_precision/s_tan.c | 73 + .../Math/Double_precision/w_acos.c | 6 + .../Math/Double_precision/w_asin.c | 6 + .../Math/Double_precision/w_atan2.c | 6 + .../Math/Double_precision/w_fmod.c | 6 + .../Math/Include}/fdlibm.h | 14 +- .../MSL_C/MSL_Common_Embedded/Src/ansi_fp.c | 567 ++++++++ .../MSL_Common_Embedded/Src/uart_console_io.c | 34 + .../Include}/critical_regions.gamecube.h | 2 + .../MSL/MSL_C/PPC_EABI/Include}/math_ppc.h | 2 + .../PPC_EABI/Include}/uart_console_io_gcn.h | 2 +- .../MSL/MSL_C/PPC_EABI/Src/math_ppc.c | 18 + .../Runtime/Inc}/CPlusLibPPC.h | 0 .../Runtime/Inc}/GCN_mem_alloc.h | 1 + .../Runtime/Inc}/Gecko_ExceptionPPC.h | 1 + .../Runtime/Inc}/NMWException.h | 10 +- .../Runtime/Inc}/__init_cpp_exceptions.h | 0 .../Runtime/Inc}/__ppc_eabi_linker.h | 0 .../Runtime/Inc}/__va_arg.h | 6 +- .../Runtime/Inc}/global_destructor_chain.h | 1 + .../PowerPC_EABI_Support/Runtime/Inc}/ptmf.h | 5 - .../Runtime/Inc}/runtime.h | 0 .../Runtime/Src}/CPlusLibPPC.cp | 0 .../Runtime/Src/GCN_Mem_Alloc.c} | 3 +- .../Runtime/Src}/Gecko_ExceptionPPC.cp | 4 +- .../Runtime/Src/NMWException.cp | 1 + .../Runtime/Src}/__init_cpp_exceptions.cpp | 4 +- .../Runtime/Src}/__mem.c | 2 +- .../Runtime/Src}/__va_arg.c | 4 +- .../Runtime/Src}/global_destructor_chain.c | 2 +- .../Runtime/Src}/ptmf.c | 2 +- .../Runtime/Src/runtime.c | 777 +++++++++++ src/Runtime.PPCEABI.H/NMWException.cp | 1 - src/Runtime.PPCEABI.H/runtime.c | 1 - src/SSystem/SComponent/c_data_tbl.cpp | 2 +- src/SSystem/SComponent/c_lib.cpp | 2 +- src/SSystem/SComponent/c_m2d_g_box.cpp | 2 +- src/SSystem/SComponent/c_m3d.cpp | 2 +- src/SSystem/SComponent/c_m3d_g_cyl.cpp | 2 +- src/SSystem/SComponent/c_m3d_g_sph.cpp | 2 +- src/SSystem/SComponent/c_math.cpp | 2 +- src/SSystem/SComponent/c_xyz.cpp | 2 +- src/c/c_dylink.cpp | 2 +- src/d/actor/d_a_bg.cpp | 1 + src/d/d_com_inf_game.cpp | 2 +- src/d/d_kankyo.cpp | 2 +- src/d/d_resorce.cpp | 4 +- src/d/d_s_logo.cpp | 2 +- src/d/d_s_play.cpp | 2 +- src/d/d_s_room.cpp | 3 +- src/d/d_save.cpp | 4 +- src/d/d_stage.cpp | 2 +- src/m_Do/m_Do_MemCard.cpp | 2 +- src/m_Do/m_Do_hostIO.cpp | 2 +- src/m_Do/m_Do_main.cpp | 2 +- src/m_Do/m_Do_printf.cpp | 2 +- 230 files changed, 7620 insertions(+), 900 deletions(-) delete mode 100644 include/MSL_C/MSL_Common/Src/FILE_POS.h delete mode 100644 include/MSL_C/MSL_Common/Src/alloc.h delete mode 100644 include/MSL_C/MSL_Common/Src/arith.h delete mode 100644 include/MSL_C/MSL_Common/Src/buffer_io.h delete mode 100644 include/MSL_C/MSL_Common/Src/file_io.h delete mode 100644 include/MSL_C/MSL_Common/Src/limits delete mode 100644 include/MSL_C/MSL_Common/Src/mbstring.h delete mode 100644 include/MSL_C/MSL_Common/Src/mem.h delete mode 100644 include/MSL_C/MSL_Common/Src/misc_io.h delete mode 100644 include/MSL_C/MSL_Common/Src/printf.h delete mode 100644 include/MSL_C/MSL_Common/Src/scanf.h delete mode 100644 include/MSL_C/MSL_Common/Src/signal.h delete mode 100644 include/MSL_C/MSL_Common/Src/string.h delete mode 100644 include/MSL_C/MSL_Common/Src/strtoul.h delete mode 100644 include/MSL_C/MSL_Common/Src/wchar_io.h delete mode 100644 include/MSL_C/MSL_Common_Embedded/Src/ansi_fp.h delete mode 100644 include/MSL_C/Math/Double_precision/e_acos.h delete mode 100644 include/MSL_C/Math/Double_precision/e_asin.h delete mode 100644 include/MSL_C/Math/Double_precision/e_atan2.h delete mode 100644 include/MSL_C/Math/Double_precision/e_exp.h delete mode 100644 include/MSL_C/Math/Double_precision/e_fmod.h delete mode 100644 include/MSL_C/Math/Double_precision/e_pow.h delete mode 100644 include/MSL_C/Math/Double_precision/e_rem_pio2.h delete mode 100644 include/MSL_C/Math/Double_precision/e_sqrt.h delete mode 100644 include/MSL_C/Math/Double_precision/k_cos.h delete mode 100644 include/MSL_C/Math/Double_precision/k_rem_pio2.h delete mode 100644 include/MSL_C/Math/Double_precision/k_sin.h delete mode 100644 include/MSL_C/Math/Double_precision/k_tan.h delete mode 100644 include/MSL_C/Math/Double_precision/s_atan.h delete mode 100644 include/MSL_C/Math/Double_precision/s_ceil.h delete mode 100644 include/MSL_C/Math/Double_precision/s_copysign.h delete mode 100644 include/MSL_C/Math/Double_precision/s_cos.h delete mode 100644 include/MSL_C/Math/Double_precision/s_floor.h delete mode 100644 include/MSL_C/Math/Double_precision/s_frexp.h delete mode 100644 include/MSL_C/Math/Double_precision/s_ldexp.h delete mode 100644 include/MSL_C/Math/Double_precision/s_modf.h delete mode 100644 include/MSL_C/Math/Double_precision/s_sin.h delete mode 100644 include/MSL_C/Math/Double_precision/s_tan.h delete mode 100644 include/MSL_C/Math/Double_precision/w_acos.h delete mode 100644 include/MSL_C/Math/Double_precision/w_asin.h delete mode 100644 include/MSL_C/Math/Double_precision/w_atan2.h delete mode 100644 include/MSL_C/Math/Double_precision/w_exp.h delete mode 100644 include/MSL_C/Math/Double_precision/w_fmod.h delete mode 100644 include/MSL_C/Math/Double_precision/w_pow.h delete mode 100644 include/MSL_C/Math/Double_precision/w_sqrt.h delete mode 100644 include/MSL_C/algorithm.h delete mode 100644 include/MSL_C/bitset.h delete mode 100644 include/MSL_C/float.h delete mode 100644 include/MSL_C/stdlib.h delete mode 100644 include/MSL_C/string.h delete mode 100644 include/Runtime.PPCEABI.H/__mem.h create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/algorithm.h create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/bitset.h rename {include/MSL_C => src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include}/functional.h (73%) rename {include/MSL_C => src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include}/new.h (74%) rename {include/MSL_C => src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include}/utility.h (100%) create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/FILE_POS.h rename {include/MSL_C/MSL_Common/Src => src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include}/abort_exit.h (56%) create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/alloc.h rename {include/MSL_C/MSL_Common/Src => src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include}/ansi_files.h (91%) create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/ansi_fp.h create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/arith.h create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/buffer_io.h rename {include/MSL_C/MSL_Common/Src => src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include}/char_io.h (50%) create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/critical_regions.h rename {include/MSL_C/MSL_Common/Src => src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include}/ctype.h (50%) rename {include/MSL_C/MSL_Common/Src => src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include}/direct_io.h (59%) create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/errno.h rename {include/MSL_C/MSL_Common/Src => src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include}/extras.h (63%) create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/file_io.h rename {include/MSL_C/MSL_Common/Src => src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include}/float.h (53%) create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/limits.h rename {include/MSL_C => src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include}/math.h (93%) create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/mbstring.h rename {include/MSL_C/MSL_Common/Src => src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include}/mem_funcs.h (69%) create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/misc_io.h create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/printf.h create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/scanf.h create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/signal.h rename {include/MSL_C/MSL_Common/Src => src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include}/stddef.h (81%) rename {include/MSL_C => src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include}/stdio.h (54%) create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/stdlib.h create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/string.h create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/strtoul.h create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wchar_io.h create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/FILE_POS.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/abort_exit.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/alloc.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/ansi_files.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/arith.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/buffer_io.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/ctype.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/direct_io.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/errno.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/file_io.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mbstring.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mem.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mem_funcs.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/misc_io.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/printf.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/scanf.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/string.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/strtoul.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/wchar_io.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_acos.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_asin.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_atan2.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_fmod.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_rem_pio2.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_cos.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_rem_pio2.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_sin.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_tan.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_atan.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_copysign.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_cos.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_floor.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_frexp.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_ldexp.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_modf.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_sin.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_tan.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_acos.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_asin.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_atan2.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_fmod.c rename {include => src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Include}/fdlibm.h (97%) create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Src/ansi_fp.c create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Src/uart_console_io.c rename {include/MSL_C/PPC_EABI/Src => src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Include}/critical_regions.gamecube.h (98%) rename {include/MSL_C/PPC_EABI/Src => src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Include}/math_ppc.h (98%) rename {include/MSL_C/PPC_EABI/Src => src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Include}/uart_console_io_gcn.h (75%) create mode 100644 src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Src/math_ppc.c rename {include/Runtime.PPCEABI.H => src/PowerPC_EABI_Support/Runtime/Inc}/CPlusLibPPC.h (100%) rename {include/Runtime.PPCEABI.H => src/PowerPC_EABI_Support/Runtime/Inc}/GCN_mem_alloc.h (98%) rename {include/Runtime.PPCEABI.H => src/PowerPC_EABI_Support/Runtime/Inc}/Gecko_ExceptionPPC.h (98%) rename {include/Runtime.PPCEABI.H => src/PowerPC_EABI_Support/Runtime/Inc}/NMWException.h (77%) rename {include/Runtime.PPCEABI.H => src/PowerPC_EABI_Support/Runtime/Inc}/__init_cpp_exceptions.h (100%) rename {include/Runtime.PPCEABI.H => src/PowerPC_EABI_Support/Runtime/Inc}/__ppc_eabi_linker.h (100%) rename {include/Runtime.PPCEABI.H => src/PowerPC_EABI_Support/Runtime/Inc}/__va_arg.h (86%) rename {include/Runtime.PPCEABI.H => src/PowerPC_EABI_Support/Runtime/Inc}/global_destructor_chain.h (99%) rename {include/Runtime.PPCEABI.H => src/PowerPC_EABI_Support/Runtime/Inc}/ptmf.h (67%) rename {include/Runtime.PPCEABI.H => src/PowerPC_EABI_Support/Runtime/Inc}/runtime.h (100%) rename src/{Runtime.PPCEABI.H => PowerPC_EABI_Support/Runtime/Src}/CPlusLibPPC.cp (100%) rename src/{Runtime.PPCEABI.H/GCN_mem_alloc.c => PowerPC_EABI_Support/Runtime/Src/GCN_Mem_Alloc.c} (93%) rename src/{Runtime.PPCEABI.H => PowerPC_EABI_Support/Runtime/Src}/Gecko_ExceptionPPC.cp (89%) create mode 100644 src/PowerPC_EABI_Support/Runtime/Src/NMWException.cp rename src/{Runtime.PPCEABI.H => PowerPC_EABI_Support/Runtime/Src}/__init_cpp_exceptions.cpp (91%) rename src/{Runtime.PPCEABI.H => PowerPC_EABI_Support/Runtime/Src}/__mem.c (97%) rename src/{Runtime.PPCEABI.H => PowerPC_EABI_Support/Runtime/Src}/__va_arg.c (95%) rename src/{Runtime.PPCEABI.H => PowerPC_EABI_Support/Runtime/Src}/global_destructor_chain.c (94%) rename src/{Runtime.PPCEABI.H => PowerPC_EABI_Support/Runtime/Src}/ptmf.c (96%) create mode 100644 src/PowerPC_EABI_Support/Runtime/Src/runtime.c delete mode 100644 src/Runtime.PPCEABI.H/NMWException.cp delete mode 100644 src/Runtime.PPCEABI.H/runtime.c diff --git a/config/GZLE01/splits.txt b/config/GZLE01/splits.txt index 745a49096..8e0b9a5e1 100644 --- a/config/GZLE01/splits.txt +++ b/config/GZLE01/splits.txt @@ -1704,7 +1704,7 @@ d/d_wpot_water.cpp: .sbss start:0x803F7300 end:0x803F7308 .sdata2 start:0x803FBB00 end:0x803FBB20 -Runtime.PPCEABI.H/__mem.c: +PowerPC_EABI_Support/Runtime/Src/__mem.c: .init start:0x800033A8 end:0x800034E0 DynamicLink.cpp: @@ -3748,215 +3748,215 @@ dolphin/gd/GDGeometry.c: .text start:0x80327E70 end:0x80328880 .data start:0x803A1FB8 end:0x803A2020 -Runtime.PPCEABI.H/__va_arg.c: +PowerPC_EABI_Support/Runtime/Src/__va_arg.c: .text start:0x80328880 end:0x80328948 -Runtime.PPCEABI.H/global_destructor_chain.c: +PowerPC_EABI_Support/Runtime/Src/global_destructor_chain.c: .text start:0x80328948 end:0x803289A8 .dtors start:0x80338828 end:0x8033882C .sbss start:0x803F7CB0 end:0x803F7CB8 -Runtime.PPCEABI.H/CPlusLibPPC.cp: +PowerPC_EABI_Support/Runtime/Src/CPlusLibPPC.cp: .text start:0x803289A8 end:0x803289D8 -Runtime.PPCEABI.H/NMWException.cp: +PowerPC_EABI_Support/Runtime/Src/NMWException.cp: extab start:0x80005620 end:0x80005668 extabindex start:0x80005680 end:0x800056BC .text start:0x803289D8 end:0x80328D7C -Runtime.PPCEABI.H/ptmf.c: +PowerPC_EABI_Support/Runtime/Src/ptmf.c: .text start:0x80328D7C end:0x80328E10 .rodata start:0x80370FB8 end:0x80370FC8 -Runtime.PPCEABI.H/runtime.c: +PowerPC_EABI_Support/Runtime/Src/runtime.c: .text start:0x80328E10 end:0x803294EC .rodata start:0x80370FC8 end:0x80370FE0 -Runtime.PPCEABI.H/__init_cpp_exceptions.cpp: +PowerPC_EABI_Support/Runtime/Src/__init_cpp_exceptions.cpp: .text start:0x803294EC end:0x80329568 .ctors start:0x80338680 end:0x80338684 .dtors start:0x80338820 end:0x80338828 .sdata start:0x803F67F0 end:0x803F67F8 -Runtime.PPCEABI.H/Gecko_ExceptionPPC.cp: +PowerPC_EABI_Support/Runtime/Src/Gecko_ExceptionPPC.cp: .text start:0x80329568 end:0x803295D0 .bss start:0x803F1AB8 end:0x803F1AC8 -Runtime.PPCEABI.H/GCN_mem_alloc.c: +PowerPC_EABI_Support/Runtime/Src/GCN_mem_alloc.c: .text start:0x803295D0 end:0x80329688 .rodata start:0x80370FE0 end:0x80371058 -MSL_C/MSL_Common/abort_exit.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/abort_exit.c: .text start:0x80329688 end:0x80329754 .bss start:0x803F1AC8 end:0x803F1BC8 .sbss start:0x803F7CB8 end:0x803F7CC8 -MSL_C/MSL_Common/alloc.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/alloc.c: .text start:0x80329754 end:0x80329CBC .rodata start:0x80371058 end:0x80371070 .bss start:0x803F1BC8 end:0x803F1C00 .sbss start:0x803F7CC8 end:0x803F7CD0 -MSL_C/MSL_Common/errno.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/errno.c: .sbss start:0x803F7CD0 end:0x803F7CD8 -MSL_C/MSL_Common/ansi_files.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/ansi_files.c: .text start:0x80329CBC end:0x80329DC4 .data start:0x803A2020 end:0x803A2160 .bss start:0x803F1C00 end:0x803F1F00 -MSL_C/MSL_Common_Embedded/ansi_fp.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Src/ansi_fp.c: .text start:0x80329DC4 end:0x8032A9DC .rodata start:0x80371070 end:0x80371150 .data start:0x803A2160 end:0x803A2288 .sdata2 start:0x803FCBB8 end:0x803FCBC0 -MSL_C/MSL_Common/arith.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/arith.c: .text start:0x8032A9DC end:0x8032AA54 -MSL_C/MSL_Common/buffer_io.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/buffer_io.c: .text start:0x8032AA54 end:0x8032AB4C -MSL_C/MSL_Common/ctype.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/ctype.c: .text start:0x8032AB4C end:0x8032AB70 .data start:0x803A2288 end:0x803A2588 -MSL_C/MSL_Common/direct_io.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/direct_io.c: .text start:0x8032AB70 end:0x8032AE9C -MSL_C/MSL_Common/file_io.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/file_io.c: .text start:0x8032AE9C end:0x8032B094 -MSL_C/MSL_Common/FILE_POS.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/FILE_POS.c: .text start:0x8032B094 end:0x8032B360 -MSL_C/MSL_Common/mbstring.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mbstring.c: .text start:0x8032B360 end:0x8032B4A4 .sdata2 start:0x803FCBC0 end:0x803FCBC8 -MSL_C/MSL_Common/mem.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mem.c: .text start:0x8032B4A4 end:0x8032B614 -MSL_C/MSL_Common/mem_funcs.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mem_funcs.c: .text start:0x8032B614 end:0x8032B8F4 -MSL_C/MSL_Common/misc_io.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/misc_io.c: .text start:0x8032B8F4 end:0x8032B904 -MSL_C/MSL_Common/printf.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/printf.c: .text start:0x8032B904 end:0x8032D9FC .rodata start:0x80371150 end:0x80371178 .data start:0x803A2588 end:0x803A27B8 .sdata start:0x803F67F8 end:0x803F6800 .sdata2 start:0x803FCBC8 end:0x803FCBD0 -MSL_C/MSL_Common/float.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c: .sdata start:0x803F6800 end:0x803F6808 -MSL_C/MSL_Common/scanf.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/scanf.c: .text start:0x8032D9FC end:0x8032DA8C -MSL_C/MSL_Common/string.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/string.c: .text start:0x8032DA8C end:0x8032DDB0 -MSL_C/MSL_Common/strtoul.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/strtoul.c: .text start:0x8032DDB0 end:0x8032E2C4 .data start:0x803A27B8 end:0x803A2800 -MSL_C/MSL_Common/uart_console_io.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Src/uart_console_io.c: .text start:0x8032E2C4 end:0x8032E390 .sbss start:0x803F7CD8 end:0x803F7CE0 -MSL_C/MSL_Common/wchar_io.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/wchar_io.c: .text start:0x8032E390 end:0x8032E418 -MSL_C/Math/Double_precision/e_acos.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_acos.c: .text start:0x8032E418 end:0x8032E728 .sdata2 start:0x803FCBD0 end:0x803FCC60 -MSL_C/Math/Double_precision/e_asin.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_asin.c: .text start:0x8032E728 end:0x8032E98C .sdata2 start:0x803FCC60 end:0x803FCCF8 -MSL_C/Math/Double_precision/e_atan2.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_atan2.c: .text start:0x8032E98C end:0x8032EC1C .sdata2 start:0x803FCCF8 end:0x803FCD50 -MSL_C/Math/Double_precision/e_fmod.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_fmod.c: .text start:0x8032EC1C end:0x8032EF58 .rodata start:0x80371178 end:0x80371188 -MSL_C/Math/Double_precision/e_rem_pio2.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_rem_pio2.c: .text start:0x8032EF58 end:0x8032F2F8 .rodata start:0x80371188 end:0x80371310 .sdata2 start:0x803FCD50 end:0x803FCDA8 -MSL_C/Math/Double_precision/k_cos.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_cos.c: .text start:0x8032F2F8 end:0x8032F3EC .sdata2 start:0x803FCDA8 end:0x803FCDF0 -MSL_C/Math/Double_precision/k_rem_pio2.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_rem_pio2.c: .text start:0x8032F3EC end:0x80330240 .rodata start:0x80371310 end:0x80371360 .sdata2 start:0x803FCDF0 end:0x803FCE30 -MSL_C/Math/Double_precision/k_sin.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_sin.c: .text start:0x80330240 end:0x803302E0 .sdata2 start:0x803FCE30 end:0x803FCE68 -MSL_C/Math/Double_precision/k_tan.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_tan.c: .text start:0x803302E0 end:0x803304F4 .rodata start:0x80371360 end:0x803713C8 .sdata2 start:0x803FCE68 end:0x803FCEA0 -MSL_C/Math/Double_precision/s_atan.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_atan.c: .text start:0x803304F4 end:0x803306F4 .rodata start:0x803713C8 end:0x80371460 .sdata2 start:0x803FCEA0 end:0x803FCEC8 -MSL_C/Math/Double_precision/s_copysign.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_copysign.c: .text start:0x803306F4 end:0x8033071C -MSL_C/Math/Double_precision/s_cos.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_cos.c: .text start:0x8033071C end:0x803307F0 .sdata2 start:0x803FCEC8 end:0x803FCED0 -MSL_C/Math/Double_precision/s_floor.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_floor.c: .text start:0x803307F0 end:0x80330938 .sdata2 start:0x803FCED0 end:0x803FCEE0 -MSL_C/Math/Double_precision/s_frexp.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_frexp.c: .text start:0x80330938 end:0x803309C4 .sdata2 start:0x803FCEE0 end:0x803FCEE8 -MSL_C/Math/Double_precision/s_ldexp.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_ldexp.c: .text start:0x803309C4 end:0x80330B88 .sdata2 start:0x803FCEE8 end:0x803FCF10 -MSL_C/Math/Double_precision/s_modf.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_modf.c: .text start:0x80330B88 end:0x80330C84 -MSL_C/Math/Double_precision/s_sin.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_sin.c: .text start:0x80330C84 end:0x80330D5C .sdata2 start:0x803FCF10 end:0x803FCF18 -MSL_C/Math/Double_precision/s_tan.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_tan.c: .text start:0x80330D5C end:0x80330DD4 .sdata2 start:0x803FCF18 end:0x803FCF20 -MSL_C/Math/Double_precision/w_acos.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_acos.c: .text start:0x80330DD4 end:0x80330DF4 -MSL_C/Math/Double_precision/w_asin.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_asin.c: .text start:0x80330DF4 end:0x80330E14 -MSL_C/Math/Double_precision/w_atan2.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_atan2.c: .text start:0x80330E14 end:0x80330E34 -MSL_C/Math/Double_precision/w_fmod.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_fmod.c: .text start:0x80330E34 end:0x80330E54 -MSL_C/PPC_EABI/math_ppc.c: +PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Src/math_ppc.c: .text start:0x80330E54 end:0x80330EE4 TRK_MINNOW_DOLPHIN/Portable/mainloop.c: diff --git a/config/GZLJ01/splits.txt b/config/GZLJ01/splits.txt index 302954447..41c41a67b 100644 --- a/config/GZLJ01/splits.txt +++ b/config/GZLJ01/splits.txt @@ -1704,7 +1704,7 @@ d/d_wpot_water.cpp: .sbss start:0x803EA7A0 end:0x803EA7A8 .sdata2 start:0x803EEFD8 end:0x803EEFF8 -Runtime.PPCEABI.H/__mem.c: +PowerPC_EABI_Support/Runtime/Src/__mem.c: .init start:0x800033A8 end:0x800034E0 DynamicLink.cpp: @@ -3744,215 +3744,215 @@ dolphin/gd/GDGeometry.c: .text start:0x80325874 end:0x80326284 .data start:0x803954D8 end:0x80395540 -Runtime.PPCEABI.H/__va_arg.c: +PowerPC_EABI_Support/Runtime/Src/__va_arg.c: .text start:0x80326284 end:0x8032634C -Runtime.PPCEABI.H/global_destructor_chain.c: +PowerPC_EABI_Support/Runtime/Src/global_destructor_chain.c: .text start:0x8032634C end:0x803263AC .dtors start:0x80336228 end:0x8033622C .sbss start:0x803EB150 end:0x803EB158 -Runtime.PPCEABI.H/CPlusLibPPC.cp: +PowerPC_EABI_Support/Runtime/Src/CPlusLibPPC.cp: .text start:0x803263AC end:0x803263DC -Runtime.PPCEABI.H/NMWException.cp: +PowerPC_EABI_Support/Runtime/Src/NMWException.cp: extab start:0x80005620 end:0x80005668 extabindex start:0x80005680 end:0x800056BC .text start:0x803263DC end:0x80326780 -Runtime.PPCEABI.H/ptmf.c: +PowerPC_EABI_Support/Runtime/Src/ptmf.c: .text start:0x80326780 end:0x80326814 .rodata start:0x80364458 end:0x80364468 -Runtime.PPCEABI.H/runtime.c: +PowerPC_EABI_Support/Runtime/Src/runtime.c: .text start:0x80326814 end:0x80326EF0 .rodata start:0x80364468 end:0x80364480 -Runtime.PPCEABI.H/__init_cpp_exceptions.cpp: +PowerPC_EABI_Support/Runtime/Src/__init_cpp_exceptions.cpp: .text start:0x80326EF0 end:0x80326F6C .ctors start:0x80336080 end:0x80336084 .dtors start:0x80336220 end:0x80336228 .sdata start:0x803E9CC8 end:0x803E9CD0 -Runtime.PPCEABI.H/Gecko_ExceptionPPC.cp: +PowerPC_EABI_Support/Runtime/Src/Gecko_ExceptionPPC.cp: .text start:0x80326F6C end:0x80326FD4 .bss start:0x803E4F98 end:0x803E4FA8 -Runtime.PPCEABI.H/GCN_mem_alloc.c: +PowerPC_EABI_Support/Runtime/Src/GCN_mem_alloc.c: .text start:0x80326FD4 end:0x8032708C .rodata start:0x80364480 end:0x803644F8 -MSL_C/MSL_Common/abort_exit.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/abort_exit.c: .text start:0x8032708C end:0x80327158 .bss start:0x803E4FA8 end:0x803E50A8 .sbss start:0x803EB158 end:0x803EB168 -MSL_C/MSL_Common/alloc.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/alloc.c: .text start:0x80327158 end:0x803276C0 .rodata start:0x803644F8 end:0x80364510 .bss start:0x803E50A8 end:0x803E50E0 .sbss start:0x803EB168 end:0x803EB170 -MSL_C/MSL_Common/errno.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/errno.c: .sbss start:0x803EB170 end:0x803EB178 -MSL_C/MSL_Common/ansi_files.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/ansi_files.c: .text start:0x803276C0 end:0x803277C8 .data start:0x80395540 end:0x80395680 .bss start:0x803E50E0 end:0x803E53E0 -MSL_C/MSL_Common_Embedded/ansi_fp.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Src/ansi_fp.c: .text start:0x803277C8 end:0x803283E0 .rodata start:0x80364510 end:0x803645F0 .data start:0x80395680 end:0x803957A8 .sdata2 start:0x803F0088 end:0x803F0090 -MSL_C/MSL_Common/arith.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/arith.c: .text start:0x803283E0 end:0x80328458 -MSL_C/MSL_Common/buffer_io.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/buffer_io.c: .text start:0x80328458 end:0x80328550 -MSL_C/MSL_Common/ctype.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/ctype.c: .text start:0x80328550 end:0x80328574 .data start:0x803957A8 end:0x80395AA8 -MSL_C/MSL_Common/direct_io.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/direct_io.c: .text start:0x80328574 end:0x803288A0 -MSL_C/MSL_Common/file_io.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/file_io.c: .text start:0x803288A0 end:0x80328A98 -MSL_C/MSL_Common/FILE_POS.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/FILE_POS.c: .text start:0x80328A98 end:0x80328D64 -MSL_C/MSL_Common/mbstring.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mbstring.c: .text start:0x80328D64 end:0x80328EA8 .sdata2 start:0x803F0090 end:0x803F0098 -MSL_C/MSL_Common/mem.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mem.c: .text start:0x80328EA8 end:0x80329018 -MSL_C/MSL_Common/mem_funcs.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mem_funcs.c: .text start:0x80329018 end:0x803292F8 -MSL_C/MSL_Common/misc_io.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/misc_io.c: .text start:0x803292F8 end:0x80329308 -MSL_C/MSL_Common/printf.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/printf.c: .text start:0x80329308 end:0x8032B400 .rodata start:0x803645F0 end:0x80364618 .data start:0x80395AA8 end:0x80395CD8 .sdata start:0x803E9CD0 end:0x803E9CD8 .sdata2 start:0x803F0098 end:0x803F00A0 -MSL_C/MSL_Common/float.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c: .sdata start:0x803E9CD8 end:0x803E9CE0 -MSL_C/MSL_Common/scanf.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/scanf.c: .text start:0x8032B400 end:0x8032B490 -MSL_C/MSL_Common/string.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/string.c: .text start:0x8032B490 end:0x8032B7B4 -MSL_C/MSL_Common/strtoul.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/strtoul.c: .text start:0x8032B7B4 end:0x8032BCC8 .data start:0x80395CD8 end:0x80395D20 -MSL_C/MSL_Common/uart_console_io.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Src/uart_console_io.c: .text start:0x8032BCC8 end:0x8032BD94 .sbss start:0x803EB178 end:0x803EB180 -MSL_C/MSL_Common/wchar_io.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/wchar_io.c: .text start:0x8032BD94 end:0x8032BE1C -MSL_C/Math/Double_precision/e_acos.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_acos.c: .text start:0x8032BE1C end:0x8032C12C .sdata2 start:0x803F00A0 end:0x803F0130 -MSL_C/Math/Double_precision/e_asin.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_asin.c: .text start:0x8032C12C end:0x8032C390 .sdata2 start:0x803F0130 end:0x803F01C8 -MSL_C/Math/Double_precision/e_atan2.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_atan2.c: .text start:0x8032C390 end:0x8032C620 .sdata2 start:0x803F01C8 end:0x803F0220 -MSL_C/Math/Double_precision/e_fmod.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_fmod.c: .text start:0x8032C620 end:0x8032C95C .rodata start:0x80364618 end:0x80364628 -MSL_C/Math/Double_precision/e_rem_pio2.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_rem_pio2.c: .text start:0x8032C95C end:0x8032CCFC .rodata start:0x80364628 end:0x803647B0 .sdata2 start:0x803F0220 end:0x803F0278 -MSL_C/Math/Double_precision/k_cos.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_cos.c: .text start:0x8032CCFC end:0x8032CDF0 .sdata2 start:0x803F0278 end:0x803F02C0 -MSL_C/Math/Double_precision/k_rem_pio2.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_rem_pio2.c: .text start:0x8032CDF0 end:0x8032DC44 .rodata start:0x803647B0 end:0x80364800 .sdata2 start:0x803F02C0 end:0x803F0300 -MSL_C/Math/Double_precision/k_sin.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_sin.c: .text start:0x8032DC44 end:0x8032DCE4 .sdata2 start:0x803F0300 end:0x803F0338 -MSL_C/Math/Double_precision/k_tan.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_tan.c: .text start:0x8032DCE4 end:0x8032DEF8 .rodata start:0x80364800 end:0x80364868 .sdata2 start:0x803F0338 end:0x803F0370 -MSL_C/Math/Double_precision/s_atan.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_atan.c: .text start:0x8032DEF8 end:0x8032E0F8 .rodata start:0x80364868 end:0x80364900 .sdata2 start:0x803F0370 end:0x803F0398 -MSL_C/Math/Double_precision/s_copysign.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_copysign.c: .text start:0x8032E0F8 end:0x8032E120 -MSL_C/Math/Double_precision/s_cos.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_cos.c: .text start:0x8032E120 end:0x8032E1F4 .sdata2 start:0x803F0398 end:0x803F03A0 -MSL_C/Math/Double_precision/s_floor.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_floor.c: .text start:0x8032E1F4 end:0x8032E33C .sdata2 start:0x803F03A0 end:0x803F03B0 -MSL_C/Math/Double_precision/s_frexp.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_frexp.c: .text start:0x8032E33C end:0x8032E3C8 .sdata2 start:0x803F03B0 end:0x803F03B8 -MSL_C/Math/Double_precision/s_ldexp.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_ldexp.c: .text start:0x8032E3C8 end:0x8032E58C .sdata2 start:0x803F03B8 end:0x803F03E0 -MSL_C/Math/Double_precision/s_modf.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_modf.c: .text start:0x8032E58C end:0x8032E688 -MSL_C/Math/Double_precision/s_sin.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_sin.c: .text start:0x8032E688 end:0x8032E760 .sdata2 start:0x803F03E0 end:0x803F03E8 -MSL_C/Math/Double_precision/s_tan.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_tan.c: .text start:0x8032E760 end:0x8032E7D8 .sdata2 start:0x803F03E8 end:0x803F03F0 -MSL_C/Math/Double_precision/w_acos.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_acos.c: .text start:0x8032E7D8 end:0x8032E7F8 -MSL_C/Math/Double_precision/w_asin.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_asin.c: .text start:0x8032E7F8 end:0x8032E818 -MSL_C/Math/Double_precision/w_atan2.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_atan2.c: .text start:0x8032E818 end:0x8032E838 -MSL_C/Math/Double_precision/w_fmod.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_fmod.c: .text start:0x8032E838 end:0x8032E858 -MSL_C/PPC_EABI/math_ppc.c: +PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Src/math_ppc.c: .text start:0x8032E858 end:0x8032E8E8 TRK_MINNOW_DOLPHIN/Portable/mainloop.c: diff --git a/config/GZLP01/splits.txt b/config/GZLP01/splits.txt index 9a90227af..97b319956 100644 --- a/config/GZLP01/splits.txt +++ b/config/GZLP01/splits.txt @@ -1704,7 +1704,7 @@ d/d_wpot_water.cpp: .sbss start:0x803FEB20 end:0x803FEB28 .sdata2 start:0x80403350 end:0x80403370 -Runtime.PPCEABI.H/__mem.c: +PowerPC_EABI_Support/Runtime/Src/__mem.c: .init start:0x800033A8 end:0x800034E0 DynamicLink.cpp: @@ -3748,215 +3748,215 @@ dolphin/gd/GDGeometry.c: .text start:0x8032D3C8 end:0x8032DDD8 .data start:0x803A8CB8 end:0x803A8D20 -Runtime.PPCEABI.H/__va_arg.c: +PowerPC_EABI_Support/Runtime/Src/__va_arg.c: .text start:0x8032DDD8 end:0x8032DEA0 -Runtime.PPCEABI.H/global_destructor_chain.c: +PowerPC_EABI_Support/Runtime/Src/global_destructor_chain.c: .text start:0x8032DEA0 end:0x8032DF00 .dtors start:0x8033DD68 end:0x8033DD6C .sbss start:0x803FF4D0 end:0x803FF4D8 -Runtime.PPCEABI.H/CPlusLibPPC.cp: +PowerPC_EABI_Support/Runtime/Src/CPlusLibPPC.cp: .text start:0x8032DF00 end:0x8032DF30 -Runtime.PPCEABI.H/NMWException.cp: +PowerPC_EABI_Support/Runtime/Src/NMWException.cp: extab start:0x80005620 end:0x80005668 extabindex start:0x80005680 end:0x800056BC .text start:0x8032DF30 end:0x8032E2D4 -Runtime.PPCEABI.H/ptmf.c: +PowerPC_EABI_Support/Runtime/Src/ptmf.c: .text start:0x8032E2D4 end:0x8032E368 .rodata start:0x80377C98 end:0x80377CA8 -Runtime.PPCEABI.H/runtime.c: +PowerPC_EABI_Support/Runtime/Src/runtime.c: .text start:0x8032E368 end:0x8032EA44 .rodata start:0x80377CA8 end:0x80377CC0 -Runtime.PPCEABI.H/__init_cpp_exceptions.cpp: +PowerPC_EABI_Support/Runtime/Src/__init_cpp_exceptions.cpp: .text start:0x8032EA44 end:0x8032EAC0 .ctors start:0x8033DBC0 end:0x8033DBC4 .dtors start:0x8033DD60 end:0x8033DD68 .sdata start:0x803FDFE8 end:0x803FDFF0 -Runtime.PPCEABI.H/Gecko_ExceptionPPC.cp: +PowerPC_EABI_Support/Runtime/Src/Gecko_ExceptionPPC.cp: .text start:0x8032EAC0 end:0x8032EB28 .bss start:0x803F92B8 end:0x803F92C8 -Runtime.PPCEABI.H/GCN_mem_alloc.c: +PowerPC_EABI_Support/Runtime/Src/GCN_mem_alloc.c: .text start:0x8032EB28 end:0x8032EBE0 .rodata start:0x80377CC0 end:0x80377D38 -MSL_C/MSL_Common/abort_exit.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/abort_exit.c: .text start:0x8032EBE0 end:0x8032ECAC .bss start:0x803F92C8 end:0x803F93C8 .sbss start:0x803FF4D8 end:0x803FF4E8 -MSL_C/MSL_Common/alloc.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/alloc.c: .text start:0x8032ECAC end:0x8032F214 .rodata start:0x80377D38 end:0x80377D50 .bss start:0x803F93C8 end:0x803F9400 .sbss start:0x803FF4E8 end:0x803FF4F0 -MSL_C/MSL_Common/errno.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/errno.c: .sbss start:0x803FF4F0 end:0x803FF4F8 -MSL_C/MSL_Common/ansi_files.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/ansi_files.c: .text start:0x8032F214 end:0x8032F31C .data start:0x803A8D20 end:0x803A8E60 .bss start:0x803F9400 end:0x803F9700 -MSL_C/MSL_Common_Embedded/ansi_fp.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Src/ansi_fp.c: .text start:0x8032F31C end:0x8032FF34 .rodata start:0x80377D50 end:0x80377E30 .data start:0x803A8E60 end:0x803A8F88 .sdata2 start:0x80404408 end:0x80404410 -MSL_C/MSL_Common/arith.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/arith.c: .text start:0x8032FF34 end:0x8032FFAC -MSL_C/MSL_Common/buffer_io.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/buffer_io.c: .text start:0x8032FFAC end:0x803300A4 -MSL_C/MSL_Common/ctype.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/ctype.c: .text start:0x803300A4 end:0x803300C8 .data start:0x803A8F88 end:0x803A9288 -MSL_C/MSL_Common/direct_io.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/direct_io.c: .text start:0x803300C8 end:0x803303F4 -MSL_C/MSL_Common/file_io.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/file_io.c: .text start:0x803303F4 end:0x803305EC -MSL_C/MSL_Common/FILE_POS.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/FILE_POS.c: .text start:0x803305EC end:0x803308B8 -MSL_C/MSL_Common/mbstring.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mbstring.c: .text start:0x803308B8 end:0x803309FC .sdata2 start:0x80404410 end:0x80404418 -MSL_C/MSL_Common/mem.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mem.c: .text start:0x803309FC end:0x80330B6C -MSL_C/MSL_Common/mem_funcs.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mem_funcs.c: .text start:0x80330B6C end:0x80330E4C -MSL_C/MSL_Common/misc_io.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/misc_io.c: .text start:0x80330E4C end:0x80330E5C -MSL_C/MSL_Common/printf.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/printf.c: .text start:0x80330E5C end:0x80332F54 .rodata start:0x80377E30 end:0x80377E58 .data start:0x803A9288 end:0x803A94B8 .sdata start:0x803FDFF0 end:0x803FDFF8 .sdata2 start:0x80404418 end:0x80404420 -MSL_C/MSL_Common/float.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c: .sdata start:0x803FDFF8 end:0x803FE000 -MSL_C/MSL_Common/scanf.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/scanf.c: .text start:0x80332F54 end:0x80332FE4 -MSL_C/MSL_Common/string.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/string.c: .text start:0x80332FE4 end:0x80333308 -MSL_C/MSL_Common/strtoul.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/strtoul.c: .text start:0x80333308 end:0x8033381C .data start:0x803A94B8 end:0x803A9500 -MSL_C/MSL_Common/uart_console_io.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Src/uart_console_io.c: .text start:0x8033381C end:0x803338E8 .sbss start:0x803FF4F8 end:0x803FF500 -MSL_C/MSL_Common/wchar_io.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/wchar_io.c: .text start:0x803338E8 end:0x80333970 -MSL_C/Math/Double_precision/e_acos.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_acos.c: .text start:0x80333970 end:0x80333C80 .sdata2 start:0x80404420 end:0x804044B0 -MSL_C/Math/Double_precision/e_asin.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_asin.c: .text start:0x80333C80 end:0x80333EE4 .sdata2 start:0x804044B0 end:0x80404548 -MSL_C/Math/Double_precision/e_atan2.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_atan2.c: .text start:0x80333EE4 end:0x80334174 .sdata2 start:0x80404548 end:0x804045A0 -MSL_C/Math/Double_precision/e_fmod.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_fmod.c: .text start:0x80334174 end:0x803344B0 .rodata start:0x80377E58 end:0x80377E68 -MSL_C/Math/Double_precision/e_rem_pio2.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_rem_pio2.c: .text start:0x803344B0 end:0x80334850 .rodata start:0x80377E68 end:0x80377FF0 .sdata2 start:0x804045A0 end:0x804045F8 -MSL_C/Math/Double_precision/k_cos.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_cos.c: .text start:0x80334850 end:0x80334944 .sdata2 start:0x804045F8 end:0x80404640 -MSL_C/Math/Double_precision/k_rem_pio2.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_rem_pio2.c: .text start:0x80334944 end:0x80335798 .rodata start:0x80377FF0 end:0x80378040 .sdata2 start:0x80404640 end:0x80404680 -MSL_C/Math/Double_precision/k_sin.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_sin.c: .text start:0x80335798 end:0x80335838 .sdata2 start:0x80404680 end:0x804046B8 -MSL_C/Math/Double_precision/k_tan.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_tan.c: .text start:0x80335838 end:0x80335A4C .rodata start:0x80378040 end:0x803780A8 .sdata2 start:0x804046B8 end:0x804046F0 -MSL_C/Math/Double_precision/s_atan.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_atan.c: .text start:0x80335A4C end:0x80335C4C .rodata start:0x803780A8 end:0x80378140 .sdata2 start:0x804046F0 end:0x80404718 -MSL_C/Math/Double_precision/s_copysign.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_copysign.c: .text start:0x80335C4C end:0x80335C74 -MSL_C/Math/Double_precision/s_cos.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_cos.c: .text start:0x80335C74 end:0x80335D48 .sdata2 start:0x80404718 end:0x80404720 -MSL_C/Math/Double_precision/s_floor.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_floor.c: .text start:0x80335D48 end:0x80335E90 .sdata2 start:0x80404720 end:0x80404730 -MSL_C/Math/Double_precision/s_frexp.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_frexp.c: .text start:0x80335E90 end:0x80335F1C .sdata2 start:0x80404730 end:0x80404738 -MSL_C/Math/Double_precision/s_ldexp.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_ldexp.c: .text start:0x80335F1C end:0x803360E0 .sdata2 start:0x80404738 end:0x80404760 -MSL_C/Math/Double_precision/s_modf.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_modf.c: .text start:0x803360E0 end:0x803361DC -MSL_C/Math/Double_precision/s_sin.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_sin.c: .text start:0x803361DC end:0x803362B4 .sdata2 start:0x80404760 end:0x80404768 -MSL_C/Math/Double_precision/s_tan.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_tan.c: .text start:0x803362B4 end:0x8033632C .sdata2 start:0x80404768 end:0x80404770 -MSL_C/Math/Double_precision/w_acos.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_acos.c: .text start:0x8033632C end:0x8033634C -MSL_C/Math/Double_precision/w_asin.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_asin.c: .text start:0x8033634C end:0x8033636C -MSL_C/Math/Double_precision/w_atan2.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_atan2.c: .text start:0x8033636C end:0x8033638C -MSL_C/Math/Double_precision/w_fmod.c: +PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_fmod.c: .text start:0x8033638C end:0x803363AC -MSL_C/PPC_EABI/math_ppc.c: +PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Src/math_ppc.c: .text start:0x803363AC end:0x8033643C TRK_MINNOW_DOLPHIN/Portable/mainloop.c: diff --git a/configure.py b/configure.py index 64eaadb34..5f1afbc9c 100644 --- a/configure.py +++ b/configure.py @@ -155,6 +155,11 @@ cflags_base = [ "-multibyte", "-i include", "-i src", + "-i src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include", + "-i src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Include", + "-i src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Include", + "-i src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include", + "-i src/PowerPC_EABI_Support/Runtime/Inc", f"-DVERSION={version_num}", ] if config.debug: @@ -1066,16 +1071,16 @@ config.libs = [ "cflags": cflags_runtime, "host": False, "objects": [ - Object(Matching, "Runtime.PPCEABI.H/__mem.c"), - Object(Matching, "Runtime.PPCEABI.H/__va_arg.c"), - Object(Matching, "Runtime.PPCEABI.H/global_destructor_chain.c"), - Object(Matching, "Runtime.PPCEABI.H/CPlusLibPPC.cp"), - Object(NonMatching, "Runtime.PPCEABI.H/NMWException.cp"), - Object(Matching, "Runtime.PPCEABI.H/ptmf.c"), - Object(NonMatching, "Runtime.PPCEABI.H/runtime.c"), - Object(Matching, "Runtime.PPCEABI.H/__init_cpp_exceptions.cpp"), - Object(Matching, "Runtime.PPCEABI.H/Gecko_ExceptionPPC.cp"), - Object(Matching, "Runtime.PPCEABI.H/GCN_mem_alloc.c", extra_cflags=["-str reuse,nopool,readonly"]), + Object(Matching, "PowerPC_EABI_Support/Runtime/Src/__mem.c"), + Object(Matching, "PowerPC_EABI_Support/Runtime/Src/__va_arg.c"), + Object(Matching, "PowerPC_EABI_Support/Runtime/Src/global_destructor_chain.c"), + Object(Matching, "PowerPC_EABI_Support/Runtime/Src/CPlusLibPPC.cp"), + Object(NonMatching, "PowerPC_EABI_Support/Runtime/Src/NMWException.cp"), + Object(Matching, "PowerPC_EABI_Support/Runtime/Src/ptmf.c"), + Object(NonMatching, "PowerPC_EABI_Support/Runtime/Src/runtime.c"), + Object(Matching, "PowerPC_EABI_Support/Runtime/Src/__init_cpp_exceptions.cpp"), + Object(Matching, "PowerPC_EABI_Support/Runtime/Src/Gecko_ExceptionPPC.cp"), + Object(Matching, "PowerPC_EABI_Support/Runtime/Src/GCN_mem_alloc.c", extra_cflags=["-str reuse,nopool,readonly"]), ], }, { @@ -1084,51 +1089,51 @@ config.libs = [ "cflags": cflags_runtime, "host": False, "objects": [ - Object(NonMatching, "MSL_C/MSL_Common/abort_exit.c"), - Object(NonMatching, "MSL_C/MSL_Common/alloc.c"), - Object(NonMatching, "MSL_C/MSL_Common/errno.c"), - Object(NonMatching, "MSL_C/MSL_Common/ansi_files.c"), - Object(NonMatching, "MSL_C/MSL_Common_Embedded/ansi_fp.c"), - Object(NonMatching, "MSL_C/MSL_Common/arith.c"), - Object(NonMatching, "MSL_C/MSL_Common/buffer_io.c"), - Object(NonMatching, "MSL_C/MSL_Common/ctype.c"), - Object(NonMatching, "MSL_C/MSL_Common/direct_io.c"), - Object(NonMatching, "MSL_C/MSL_Common/file_io.c"), - Object(NonMatching, "MSL_C/MSL_Common/FILE_POS.c"), - Object(NonMatching, "MSL_C/MSL_Common/mbstring.c"), - Object(NonMatching, "MSL_C/MSL_Common/mem.c"), - Object(NonMatching, "MSL_C/MSL_Common/mem_funcs.c"), - Object(NonMatching, "MSL_C/MSL_Common/misc_io.c"), - Object(NonMatching, "MSL_C/MSL_Common/printf.c"), - Object(NonMatching, "MSL_C/MSL_Common/float.c"), - Object(NonMatching, "MSL_C/MSL_Common/scanf.c"), - Object(NonMatching, "MSL_C/MSL_Common/string.c"), - Object(NonMatching, "MSL_C/MSL_Common/strtoul.c"), - Object(NonMatching, "MSL_C/MSL_Common/uart_console_io.c"), - Object(NonMatching, "MSL_C/MSL_Common/wchar_io.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/e_acos.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/e_asin.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/e_atan2.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/e_fmod.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/e_rem_pio2.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/k_cos.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/k_rem_pio2.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/k_sin.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/k_tan.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/s_atan.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/s_copysign.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/s_cos.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/s_floor.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/s_frexp.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/s_ldexp.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/s_modf.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/s_sin.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/s_tan.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/w_acos.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/w_asin.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/w_atan2.c"), - Object(NonMatching, "MSL_C/Math/Double_precision/w_fmod.c"), - Object(NonMatching, "MSL_C/PPC_EABI/math_ppc.c"), + Object(NonMatching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/abort_exit.c"), + Object(NonMatching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/alloc.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/errno.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/ansi_files.c"), + Object(NonMatching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Src/ansi_fp.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/arith.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/buffer_io.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/ctype.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/direct_io.c"), + Object(NonMatching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/file_io.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/FILE_POS.c"), + Object(NonMatching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mbstring.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mem.c"), + Object(NonMatching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mem_funcs.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/misc_io.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/printf.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/scanf.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/string.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/strtoul.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Src/uart_console_io.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/wchar_io.c"), + Object(NonMatching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_acos.c"), + Object(NonMatching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_asin.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_atan2.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_fmod.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_rem_pio2.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_cos.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_rem_pio2.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_sin.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_tan.c"), + Object(NonMatching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_atan.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_copysign.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_cos.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_floor.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_frexp.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_ldexp.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_modf.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_sin.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_tan.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_acos.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_asin.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_atan2.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_fmod.c"), + Object(Matching, "PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Src/math_ppc.c"), ], }, { @@ -1202,7 +1207,7 @@ config.libs = [ Object( Matching, "REL/global_destructor_chain.c", - source="Runtime.PPCEABI.H/global_destructor_chain.c", + source="PowerPC_EABI_Support/Runtime/Src/global_destructor_chain.c", ), ], }, diff --git a/include/JSystem/JGeometry.h b/include/JSystem/JGeometry.h index 89391f18e..6c92d88d9 100644 --- a/include/JSystem/JGeometry.h +++ b/include/JSystem/JGeometry.h @@ -2,8 +2,8 @@ #define JGEOMETRY_H #include "dolphin/mtx/vec.h" -#include "MSL_C/float.h" -#include "MSL_C/math.h" +#include "float.h" +#include "math.h" namespace JGeometry { diff --git a/include/JSystem/JMath/JMATrigonometric.h b/include/JSystem/JMath/JMATrigonometric.h index d57bd234e..d9178e04b 100644 --- a/include/JSystem/JMath/JMATrigonometric.h +++ b/include/JSystem/JMath/JMATrigonometric.h @@ -2,7 +2,7 @@ #define JMATRIGONOMETRIC_H #include "dolphin/types.h" -#include "MSL_C/utility.h" +#include "utility.h" extern u32 jmaSinShift; extern f32 *jmaSinTable; diff --git a/include/JSystem/JUtility/JUTConsole.h b/include/JSystem/JUtility/JUTConsole.h index 8b8ef1b5e..380235731 100644 --- a/include/JSystem/JUtility/JUTConsole.h +++ b/include/JSystem/JUtility/JUTConsole.h @@ -4,7 +4,7 @@ #include "JSystem/JGadget/linklist.h" #include "JSystem/JKernel/JKRDisposer.h" #include "JSystem/JUtility/JUTFont.h" -#include "Runtime.PPCEABI.H/__va_arg.h" +#include "__va_arg.h" #include "dolphin/types.h" class JUTConsole : public JKRDisposer { diff --git a/include/JSystem/JUtility/JUTDirectPrint.h b/include/JSystem/JUtility/JUTDirectPrint.h index 9753ba2d0..d55010456 100644 --- a/include/JSystem/JUtility/JUTDirectPrint.h +++ b/include/JSystem/JUtility/JUTDirectPrint.h @@ -2,7 +2,7 @@ #define JUTDIRECTPRINT_H #include "JSystem/JUtility/TColor.h" -#include "Runtime.PPCEABI.H/__va_arg.h" +#include "__va_arg.h" namespace std { diff --git a/include/JSystem/JUtility/JUTException.h b/include/JSystem/JUtility/JUTException.h index ba98b0270..2bf1ae899 100644 --- a/include/JSystem/JUtility/JUTException.h +++ b/include/JSystem/JUtility/JUTException.h @@ -3,7 +3,7 @@ #include "JSystem/JKernel/JKRThread.h" #include "JSystem/JUtility/JUTGamePad.h" -#include "Runtime.PPCEABI.H/__va_arg.h" +#include "__va_arg.h" #include "dolphin/gx/GXEnum.h" #include "dolphin/os/OSError.h" #include "dolphin/types.h" diff --git a/include/JSystem/JUtility/JUTFont.h b/include/JSystem/JUtility/JUTFont.h index 9b9d38038..982dc3c4b 100644 --- a/include/JSystem/JUtility/JUTFont.h +++ b/include/JSystem/JUtility/JUTFont.h @@ -2,7 +2,7 @@ #define JUTFONT_H #include "JSystem/JUtility/TColor.h" -#include "MSL_C/string.h" +#include "string.h" struct BlockHeader { const BlockHeader* getNext() const { diff --git a/include/MSL_C/MSL_Common/Src/FILE_POS.h b/include/MSL_C/MSL_Common/Src/FILE_POS.h deleted file mode 100644 index 867b19194..000000000 --- a/include/MSL_C/MSL_Common/Src/FILE_POS.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef MSL_COMMON_SRC_FILE_POS_H -#define MSL_COMMON_SRC_FILE_POS_H - -#include "MSL_C/MSL_Common/Src/ansi_files.h" - -#ifdef __cplusplus -extern "C" { -#endif - -int fseek(FILE* file, long offset, int mode); -int _fseek(FILE* file, fpos_t offset, int mode); -long ftell(FILE* file); - -#ifdef __cplusplus -} -#endif - -#endif /* MSL_COMMON_SRC_FILE_POS_H */ diff --git a/include/MSL_C/MSL_Common/Src/alloc.h b/include/MSL_C/MSL_Common/Src/alloc.h deleted file mode 100644 index 36617e395..000000000 --- a/include/MSL_C/MSL_Common/Src/alloc.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef MSL_COMMON_SRC_ALLOC_H -#define MSL_COMMON_SRC_ALLOC_H - -#include "MSL_C/MSL_Common/Src/ansi_files.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void free(FILE* file); -void __pool_free(int** param_1, unsigned int** param_2); - -#ifdef __cplusplus -} -#endif - -#endif /* MSL_COMMON_SRC_ALLOC_H */ diff --git a/include/MSL_C/MSL_Common/Src/arith.h b/include/MSL_C/MSL_Common/Src/arith.h deleted file mode 100644 index 0cf3316b0..000000000 --- a/include/MSL_C/MSL_Common/Src/arith.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef MSL_COMMON_SRC_ARITH_H -#define MSL_COMMON_SRC_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_SRC_ARITH_H */ diff --git a/include/MSL_C/MSL_Common/Src/buffer_io.h b/include/MSL_C/MSL_Common/Src/buffer_io.h deleted file mode 100644 index e020d543a..000000000 --- a/include/MSL_C/MSL_Common/Src/buffer_io.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef MSL_COMMON_SRC_BUFFER_IO_H -#define MSL_COMMON_SRC_BUFFER_IO_H - -#include "MSL_C/MSL_Common/Src/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_SRC_BUFFER_IO_H */ diff --git a/include/MSL_C/MSL_Common/Src/file_io.h b/include/MSL_C/MSL_Common/Src/file_io.h deleted file mode 100644 index 0fe744692..000000000 --- a/include/MSL_C/MSL_Common/Src/file_io.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef MSL_COMMON_SRC_FILE_IO_H -#define MSL_COMMON_SRC_FILE_IO_H - -#include "MSL_C/MSL_Common/Src/ansi_files.h" - -#ifdef __cplusplus -extern "C" { -#endif - -int __msl_strnicmp(const char* str1, const char* str2, size_t n); -int fflush(FILE* file); -int fclose(FILE* file); - -#ifdef __cplusplus -} -#endif - -#endif /* MSL_COMMON_SRC_FILE_IO_H */ diff --git a/include/MSL_C/MSL_Common/Src/limits b/include/MSL_C/MSL_Common/Src/limits deleted file mode 100644 index 3a3f49b91..000000000 --- a/include/MSL_C/MSL_Common/Src/limits +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef _STD_LIMITS_H -#define _STD_LIMITS_H - -namespace std { -template -class numeric_limits { -public: - inline static T min(); - inline static T max(); -}; - -template <> -class numeric_limits { -public: - inline static char min() { return -0x80; } - inline static char max() { return 0x7F; } -}; - -template <> -class numeric_limits { -public: - inline static short min() { return -0x8000; } - inline static short max() { return 0x7FFF; } -}; - -template <> -class numeric_limits { -public: - inline static int min() { return -0x80000000; } - inline static int max() { return 0x7FFFFFFF; } -}; - -template <> -class numeric_limits { -public: - inline static long min() { return -0x80000000; } - inline static long max() { return 0x7FFFFFFF; } -}; - -template <> -class numeric_limits { -public: - inline static unsigned char min() { return 0x0; } - inline static unsigned char max() { return 0xFF; } -}; - -template <> -class numeric_limits { -public: - inline static unsigned short min() { return 0x0; } - inline static unsigned short max() { return 0xFFFF; } -}; - -template <> -class numeric_limits { -public: - inline static unsigned int min() { return 0x0; } - inline static unsigned int max() { return 0xFFFFFFFF; } -}; - -template <> -class numeric_limits { -public: - inline static unsigned long min() { return 0x0; } - inline static unsigned long max() { return 0xFFFFFFFF; } -}; - -} // namespace std - -#endif diff --git a/include/MSL_C/MSL_Common/Src/mbstring.h b/include/MSL_C/MSL_Common/Src/mbstring.h deleted file mode 100644 index e42bcd0ed..000000000 --- a/include/MSL_C/MSL_Common/Src/mbstring.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef MSL_COMMON_SRC_MBSTRING_H -#define MSL_COMMON_SRC_MBSTRING_H - -#include "MSL_C/MSL_Common/Src/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_SRC_MBSTRING_H */ diff --git a/include/MSL_C/MSL_Common/Src/mem.h b/include/MSL_C/MSL_Common/Src/mem.h deleted file mode 100644 index 1cca85f19..000000000 --- a/include/MSL_C/MSL_Common/Src/mem.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef MSL_COMMON_SRC_MEM_H -#define MSL_COMMON_SRC_MEM_H - -#include "MSL_C/MSL_Common/Src/stddef.h" - -#ifdef __cplusplus -extern "C" { -#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); - -#ifdef __cplusplus -} -#endif - -#endif /* MSL_COMMON_SRC_MEM_H */ diff --git a/include/MSL_C/MSL_Common/Src/misc_io.h b/include/MSL_C/MSL_Common/Src/misc_io.h deleted file mode 100644 index 386046291..000000000 --- a/include/MSL_C/MSL_Common/Src/misc_io.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef MSL_COMMON_SRC_MISC_IO_H -#define MSL_COMMON_SRC_MISC_IO_H - -#ifdef __cplusplus -extern "C" { -#endif - -void __stdio_atexit(void); - -#ifdef __cplusplus -} -#endif - -#endif /* MSL_COMMON_SRC_MISC_IO_H */ diff --git a/include/MSL_C/MSL_Common/Src/printf.h b/include/MSL_C/MSL_Common/Src/printf.h deleted file mode 100644 index 5b1a7ccd6..000000000 --- a/include/MSL_C/MSL_Common/Src/printf.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef MSL_COMMON_SRC_PRINTF_H -#define MSL_COMMON_SRC_PRINTF_H - -#include "MSL_C/MSL_Common/Src/ansi_files.h" -#include "Runtime.PPCEABI.H/__va_arg.h" - -#ifdef __cplusplus -extern "C" { -#endif - -int fprintf(FILE* stream, const char* format, ...); -int printf(const char* format, ...); -int sprintf(const char* str, const char* format, ...); -int snprintf(const char* str, size_t n, const char* format, ...); -int vsnprintf(char* str, size_t n, const char* format, va_list arg); -int vprintf(const char* format, va_list arg); - -#ifdef __cplusplus -} -#endif - -#endif /* MSL_COMMON_SRC_PRINTF_H */ diff --git a/include/MSL_C/MSL_Common/Src/scanf.h b/include/MSL_C/MSL_Common/Src/scanf.h deleted file mode 100644 index d0a323df5..000000000 --- a/include/MSL_C/MSL_Common/Src/scanf.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef MSL_COMMON_SRC_SCANF_H -#define MSL_COMMON_SRC_SCANF_H - -#ifdef __cplusplus -extern "C" { -#endif - -int __StringRead(char* str, int ch, int behavior); - -#ifdef __cplusplus -} -#endif - -#endif /* MSL_COMMON_SRC_SCANF_H */ diff --git a/include/MSL_C/MSL_Common/Src/signal.h b/include/MSL_C/MSL_Common/Src/signal.h deleted file mode 100644 index 5906c8e88..000000000 --- a/include/MSL_C/MSL_Common/Src/signal.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef MSL_COMMON_SRC_SIGNAL_H -#define MSL_COMMON_SRC_SIGNAL_H - -#ifdef __cplusplus -extern "C" { -#endif - -int raise(int sig); - -#ifdef __cplusplus -} -#endif - -#endif /* MSL_COMMON_SRC_SIGNAL_H */ diff --git a/include/MSL_C/MSL_Common/Src/string.h b/include/MSL_C/MSL_Common/Src/string.h deleted file mode 100644 index 8a0a3f97b..000000000 --- a/include/MSL_C/MSL_Common/Src/string.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef MSL_COMMON_SRC_STRING_H -#define MSL_COMMON_SRC_STRING_H - -#include "MSL_C/MSL_Common/Src/stddef.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void* memcpy(void* dst, const void* src, size_t n); -void* memset(void* dst, int val, 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 -} -#endif - -#endif /* MSL_COMMON_SRC_STRING_H */ diff --git a/include/MSL_C/MSL_Common/Src/strtoul.h b/include/MSL_C/MSL_Common/Src/strtoul.h deleted file mode 100644 index a28881575..000000000 --- a/include/MSL_C/MSL_Common/Src/strtoul.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef MSL_COMMON_SRC_STRTOUL_H -#define MSL_COMMON_SRC_STRTOUL_H - -#ifdef __cplusplus -extern "C" { -#endif - -long strtol(const char* str, char** endptr, int base); -unsigned long strtoul(const char* str, char** endptr, int base); -unsigned long __strtoul(const char* str, char** endptr, int base); - -#ifdef __cplusplus -} -#endif - -#endif /* MSL_COMMON_SRC_STRTOUL_H */ diff --git a/include/MSL_C/MSL_Common/Src/wchar_io.h b/include/MSL_C/MSL_Common/Src/wchar_io.h deleted file mode 100644 index be6fb6378..000000000 --- a/include/MSL_C/MSL_Common/Src/wchar_io.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef MSL_COMMON_SRC_WCHAR_IO_H -#define MSL_COMMON_SRC_WCHAR_IO_H - -#include "MSL_C/MSL_Common/Src/ansi_files.h" - -#ifndef __cplusplus -typedef unsigned short wchar_t; -#endif - -int fwide(FILE* file, int mode); - -#endif /* MSL_COMMON_SRC_WCHAR_IO_H */ diff --git a/include/MSL_C/MSL_Common_Embedded/Src/ansi_fp.h b/include/MSL_C/MSL_Common_Embedded/Src/ansi_fp.h deleted file mode 100644 index d4aac53f0..000000000 --- a/include/MSL_C/MSL_Common_Embedded/Src/ansi_fp.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MSL_COMMON_EMBEDDED_SRC_ANSI_FP_H -#define MSL_COMMON_EMBEDDED_SRC_ANSI_FP_H - -#endif /* MSL_COMMON_EMBEDDED_SRC_ANSI_FP_H */ diff --git a/include/MSL_C/Math/Double_precision/e_acos.h b/include/MSL_C/Math/Double_precision/e_acos.h deleted file mode 100644 index f2e104c3f..000000000 --- a/include/MSL_C/Math/Double_precision/e_acos.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_E_ACOS_H -#define MATH_DOUBLE_PRECISION_E_ACOS_H - -#endif /* MATH_DOUBLE_PRECISION_E_ACOS_H */ diff --git a/include/MSL_C/Math/Double_precision/e_asin.h b/include/MSL_C/Math/Double_precision/e_asin.h deleted file mode 100644 index c6ce59d98..000000000 --- a/include/MSL_C/Math/Double_precision/e_asin.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_E_ASIN_H -#define MATH_DOUBLE_PRECISION_E_ASIN_H - -#endif /* MATH_DOUBLE_PRECISION_E_ASIN_H */ diff --git a/include/MSL_C/Math/Double_precision/e_atan2.h b/include/MSL_C/Math/Double_precision/e_atan2.h deleted file mode 100644 index 4bbc9a36a..000000000 --- a/include/MSL_C/Math/Double_precision/e_atan2.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_E_ATAN2_H -#define MATH_DOUBLE_PRECISION_E_ATAN2_H - -#endif /* MATH_DOUBLE_PRECISION_E_ATAN2_H */ diff --git a/include/MSL_C/Math/Double_precision/e_exp.h b/include/MSL_C/Math/Double_precision/e_exp.h deleted file mode 100644 index 3ce11ba14..000000000 --- a/include/MSL_C/Math/Double_precision/e_exp.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_E_EXP_H -#define MATH_DOUBLE_PRECISION_E_EXP_H - -#endif /* MATH_DOUBLE_PRECISION_E_EXP_H */ diff --git a/include/MSL_C/Math/Double_precision/e_fmod.h b/include/MSL_C/Math/Double_precision/e_fmod.h deleted file mode 100644 index 28be34973..000000000 --- a/include/MSL_C/Math/Double_precision/e_fmod.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_E_FMOD_H -#define MATH_DOUBLE_PRECISION_E_FMOD_H - -#endif /* MATH_DOUBLE_PRECISION_E_FMOD_H */ diff --git a/include/MSL_C/Math/Double_precision/e_pow.h b/include/MSL_C/Math/Double_precision/e_pow.h deleted file mode 100644 index 6143b168c..000000000 --- a/include/MSL_C/Math/Double_precision/e_pow.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_E_POW_H -#define MATH_DOUBLE_PRECISION_E_POW_H - -#endif /* MATH_DOUBLE_PRECISION_E_POW_H */ diff --git a/include/MSL_C/Math/Double_precision/e_rem_pio2.h b/include/MSL_C/Math/Double_precision/e_rem_pio2.h deleted file mode 100644 index d020608cd..000000000 --- a/include/MSL_C/Math/Double_precision/e_rem_pio2.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_E_REM_PIO2_H -#define MATH_DOUBLE_PRECISION_E_REM_PIO2_H - -#endif /* MATH_DOUBLE_PRECISION_E_REM_PIO2_H */ diff --git a/include/MSL_C/Math/Double_precision/e_sqrt.h b/include/MSL_C/Math/Double_precision/e_sqrt.h deleted file mode 100644 index 5804aad83..000000000 --- a/include/MSL_C/Math/Double_precision/e_sqrt.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_E_SQRT_H -#define MATH_DOUBLE_PRECISION_E_SQRT_H - -#endif /* MATH_DOUBLE_PRECISION_E_SQRT_H */ diff --git a/include/MSL_C/Math/Double_precision/k_cos.h b/include/MSL_C/Math/Double_precision/k_cos.h deleted file mode 100644 index e88277956..000000000 --- a/include/MSL_C/Math/Double_precision/k_cos.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_K_COS_H -#define MATH_DOUBLE_PRECISION_K_COS_H - -#endif /* MATH_DOUBLE_PRECISION_K_COS_H */ diff --git a/include/MSL_C/Math/Double_precision/k_rem_pio2.h b/include/MSL_C/Math/Double_precision/k_rem_pio2.h deleted file mode 100644 index 090a21cdb..000000000 --- a/include/MSL_C/Math/Double_precision/k_rem_pio2.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_K_REM_PIO2_H -#define MATH_DOUBLE_PRECISION_K_REM_PIO2_H - -#endif /* MATH_DOUBLE_PRECISION_K_REM_PIO2_H */ diff --git a/include/MSL_C/Math/Double_precision/k_sin.h b/include/MSL_C/Math/Double_precision/k_sin.h deleted file mode 100644 index 232328231..000000000 --- a/include/MSL_C/Math/Double_precision/k_sin.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_K_SIN_H -#define MATH_DOUBLE_PRECISION_K_SIN_H - -#endif /* MATH_DOUBLE_PRECISION_K_SIN_H */ diff --git a/include/MSL_C/Math/Double_precision/k_tan.h b/include/MSL_C/Math/Double_precision/k_tan.h deleted file mode 100644 index 6e9427bd1..000000000 --- a/include/MSL_C/Math/Double_precision/k_tan.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_K_TAN_H -#define MATH_DOUBLE_PRECISION_K_TAN_H - -#endif /* MATH_DOUBLE_PRECISION_K_TAN_H */ diff --git a/include/MSL_C/Math/Double_precision/s_atan.h b/include/MSL_C/Math/Double_precision/s_atan.h deleted file mode 100644 index 38ff7ec79..000000000 --- a/include/MSL_C/Math/Double_precision/s_atan.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_S_ATAN_H -#define MATH_DOUBLE_PRECISION_S_ATAN_H - -#endif /* MATH_DOUBLE_PRECISION_S_ATAN_H */ diff --git a/include/MSL_C/Math/Double_precision/s_ceil.h b/include/MSL_C/Math/Double_precision/s_ceil.h deleted file mode 100644 index 059f3f786..000000000 --- a/include/MSL_C/Math/Double_precision/s_ceil.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_S_CEIL_H -#define MATH_DOUBLE_PRECISION_S_CEIL_H - -#endif /* MATH_DOUBLE_PRECISION_S_CEIL_H */ diff --git a/include/MSL_C/Math/Double_precision/s_copysign.h b/include/MSL_C/Math/Double_precision/s_copysign.h deleted file mode 100644 index 62b074745..000000000 --- a/include/MSL_C/Math/Double_precision/s_copysign.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_S_COPYSIGN_H -#define MATH_DOUBLE_PRECISION_S_COPYSIGN_H - -#endif /* MATH_DOUBLE_PRECISION_S_COPYSIGN_H */ diff --git a/include/MSL_C/Math/Double_precision/s_cos.h b/include/MSL_C/Math/Double_precision/s_cos.h deleted file mode 100644 index 25f41b267..000000000 --- a/include/MSL_C/Math/Double_precision/s_cos.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_S_COS_H -#define MATH_DOUBLE_PRECISION_S_COS_H - -#endif /* MATH_DOUBLE_PRECISION_S_COS_H */ diff --git a/include/MSL_C/Math/Double_precision/s_floor.h b/include/MSL_C/Math/Double_precision/s_floor.h deleted file mode 100644 index 97f029f62..000000000 --- a/include/MSL_C/Math/Double_precision/s_floor.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_S_FLOOR_H -#define MATH_DOUBLE_PRECISION_S_FLOOR_H - -#endif /* MATH_DOUBLE_PRECISION_S_FLOOR_H */ diff --git a/include/MSL_C/Math/Double_precision/s_frexp.h b/include/MSL_C/Math/Double_precision/s_frexp.h deleted file mode 100644 index 4b2737e6a..000000000 --- a/include/MSL_C/Math/Double_precision/s_frexp.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_S_FREXP_H -#define MATH_DOUBLE_PRECISION_S_FREXP_H - -#endif /* MATH_DOUBLE_PRECISION_S_FREXP_H */ diff --git a/include/MSL_C/Math/Double_precision/s_ldexp.h b/include/MSL_C/Math/Double_precision/s_ldexp.h deleted file mode 100644 index a989a3342..000000000 --- a/include/MSL_C/Math/Double_precision/s_ldexp.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_S_LDEXP_H -#define MATH_DOUBLE_PRECISION_S_LDEXP_H - -#endif /* MATH_DOUBLE_PRECISION_S_LDEXP_H */ diff --git a/include/MSL_C/Math/Double_precision/s_modf.h b/include/MSL_C/Math/Double_precision/s_modf.h deleted file mode 100644 index 550b845c0..000000000 --- a/include/MSL_C/Math/Double_precision/s_modf.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_S_MODF_H -#define MATH_DOUBLE_PRECISION_S_MODF_H - -#endif /* MATH_DOUBLE_PRECISION_S_MODF_H */ diff --git a/include/MSL_C/Math/Double_precision/s_sin.h b/include/MSL_C/Math/Double_precision/s_sin.h deleted file mode 100644 index c7bb02e1f..000000000 --- a/include/MSL_C/Math/Double_precision/s_sin.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_S_SIN_H -#define MATH_DOUBLE_PRECISION_S_SIN_H - -#endif /* MATH_DOUBLE_PRECISION_S_SIN_H */ diff --git a/include/MSL_C/Math/Double_precision/s_tan.h b/include/MSL_C/Math/Double_precision/s_tan.h deleted file mode 100644 index e70764073..000000000 --- a/include/MSL_C/Math/Double_precision/s_tan.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_S_TAN_H -#define MATH_DOUBLE_PRECISION_S_TAN_H - -#endif /* MATH_DOUBLE_PRECISION_S_TAN_H */ diff --git a/include/MSL_C/Math/Double_precision/w_acos.h b/include/MSL_C/Math/Double_precision/w_acos.h deleted file mode 100644 index 4bb7fb2b5..000000000 --- a/include/MSL_C/Math/Double_precision/w_acos.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_W_ACOS_H -#define MATH_DOUBLE_PRECISION_W_ACOS_H - -#endif /* MATH_DOUBLE_PRECISION_W_ACOS_H */ diff --git a/include/MSL_C/Math/Double_precision/w_asin.h b/include/MSL_C/Math/Double_precision/w_asin.h deleted file mode 100644 index 4a5074f16..000000000 --- a/include/MSL_C/Math/Double_precision/w_asin.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_W_ASIN_H -#define MATH_DOUBLE_PRECISION_W_ASIN_H - -#endif /* MATH_DOUBLE_PRECISION_W_ASIN_H */ diff --git a/include/MSL_C/Math/Double_precision/w_atan2.h b/include/MSL_C/Math/Double_precision/w_atan2.h deleted file mode 100644 index 13eb5ee3d..000000000 --- a/include/MSL_C/Math/Double_precision/w_atan2.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_W_ATAN2_H -#define MATH_DOUBLE_PRECISION_W_ATAN2_H - -#endif /* MATH_DOUBLE_PRECISION_W_ATAN2_H */ diff --git a/include/MSL_C/Math/Double_precision/w_exp.h b/include/MSL_C/Math/Double_precision/w_exp.h deleted file mode 100644 index 3566b0006..000000000 --- a/include/MSL_C/Math/Double_precision/w_exp.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_W_EXP_H -#define MATH_DOUBLE_PRECISION_W_EXP_H - -#endif /* MATH_DOUBLE_PRECISION_W_EXP_H */ diff --git a/include/MSL_C/Math/Double_precision/w_fmod.h b/include/MSL_C/Math/Double_precision/w_fmod.h deleted file mode 100644 index 11308c818..000000000 --- a/include/MSL_C/Math/Double_precision/w_fmod.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_W_FMOD_H -#define MATH_DOUBLE_PRECISION_W_FMOD_H - -double fmod(double, double); - -#endif /* MATH_DOUBLE_PRECISION_W_FMOD_H */ diff --git a/include/MSL_C/Math/Double_precision/w_pow.h b/include/MSL_C/Math/Double_precision/w_pow.h deleted file mode 100644 index af6bbd6ee..000000000 --- a/include/MSL_C/Math/Double_precision/w_pow.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_W_POW_H -#define MATH_DOUBLE_PRECISION_W_POW_H - -#endif /* MATH_DOUBLE_PRECISION_W_POW_H */ diff --git a/include/MSL_C/Math/Double_precision/w_sqrt.h b/include/MSL_C/Math/Double_precision/w_sqrt.h deleted file mode 100644 index 43de3b1ac..000000000 --- a/include/MSL_C/Math/Double_precision/w_sqrt.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MATH_DOUBLE_PRECISION_W_SQRT_H -#define MATH_DOUBLE_PRECISION_W_SQRT_H - -#endif /* MATH_DOUBLE_PRECISION_W_SQRT_H */ diff --git a/include/MSL_C/algorithm.h b/include/MSL_C/algorithm.h deleted file mode 100644 index dc2684d35..000000000 --- a/include/MSL_C/algorithm.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef MSL_ALGORITHM_H_ -#define MSL_ALGORITHM_H_ - -namespace std { -template -ForwardIterator lower_bound(ForwardIterator first, ForwardIterator last, const T& val); - -template -ForwardIterator upper_bound(ForwardIterator first, ForwardIterator last, const T& val); - -template -InputIt find_if(InputIt first, InputIt last, UnaryPredicate p); -} // namespace std - -#endif diff --git a/include/MSL_C/bitset.h b/include/MSL_C/bitset.h deleted file mode 100644 index e48e32efc..000000000 --- a/include/MSL_C/bitset.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef MSL_BITSET_H_ -#define MSL_BITSET_H_ - -namespace std { -template -class bitset { - bitset(); - - void set(size_t pos, bool val); - void reset(size_t pos); - bool test(size_t pos) const; -}; -} // namespace std - -#endif diff --git a/include/MSL_C/float.h b/include/MSL_C/float.h deleted file mode 100644 index a262530e4..000000000 --- a/include/MSL_C/float.h +++ /dev/null @@ -1,10 +0,0 @@ - -#ifndef MSL_FLOAT_H_ -#define MSL_FLOAT_H_ - -#include "MSL_C/MSL_Common/Src/float.h" - -#define FLT_MAX (*(float*)__float_max) -#define FLT_EPSILON (*(float*)__float_epsilon) - -#endif diff --git a/include/MSL_C/stdlib.h b/include/MSL_C/stdlib.h deleted file mode 100644 index d4d322252..000000000 --- a/include/MSL_C/stdlib.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef MSL_STDLIB_H_ -#define MSL_STDLIB_H_ - -#include "MSL_C/MSL_Common/Src/abort_exit.h" -#include "MSL_C/MSL_Common/Src/arith.h" -#include "MSL_C/MSL_Common/Src/mbstring.h" -#include "MSL_C/MSL_Common/Src/strtoul.h" - -#endif diff --git a/include/MSL_C/string.h b/include/MSL_C/string.h deleted file mode 100644 index 418cdc48f..000000000 --- a/include/MSL_C/string.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef MSL_STRING_H_ -#define MSL_STRING_H_ - -#include "MSL_C/MSL_Common/Src/extras.h" -#include "MSL_C/MSL_Common/Src/mem.h" -#include "MSL_C/MSL_Common/Src/string.h" -#include "MSL_C/MSL_Common/Src/printf.h" - -#endif diff --git a/include/Runtime.PPCEABI.H/__mem.h b/include/Runtime.PPCEABI.H/__mem.h deleted file mode 100644 index ab53e58f9..000000000 --- a/include/Runtime.PPCEABI.H/__mem.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef RUNTIME_MEM_H -#define RUNTIME_MEM_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); - -#ifdef __cplusplus -} -#endif - -#endif /* RUNTIME_MEM_H */ diff --git a/include/SSystem/SComponent/c_m3d.h b/include/SSystem/SComponent/c_m3d.h index 390a55921..959768a57 100644 --- a/include/SSystem/SComponent/c_m3d.h +++ b/include/SSystem/SComponent/c_m3d.h @@ -1,7 +1,7 @@ #ifndef C_M3D_H_ #define C_M3D_H_ -#include "MSL_C/math.h" +#include "math.h" #include "dolphin/types.h" #include "dolphin/mtx/vec.h" #include "dolphin/mtx/mtx.h" diff --git a/include/SSystem/SComponent/c_xyz.h b/include/SSystem/SComponent/c_xyz.h index 32e1e7e20..02332ba7d 100644 --- a/include/SSystem/SComponent/c_xyz.h +++ b/include/SSystem/SComponent/c_xyz.h @@ -1,7 +1,7 @@ #ifndef C_XYZ_H #define C_XYZ_H -#include "MSL_C/math.h" +#include "math.h" #include "dolphin/mtx/vec.h" struct cXy { diff --git a/include/d/d_event_manager.h b/include/d/d_event_manager.h index bd684ba06..33bdf6a6a 100644 --- a/include/d/d_event_manager.h +++ b/include/d/d_event_manager.h @@ -3,7 +3,7 @@ #include "SSystem/SComponent/c_xyz.h" #include "d/d_event_data.h" -#include "MSL_C/string.h" +#include "string.h" class fopAc_ac_c; diff --git a/include/dolphin/os/OS.h b/include/dolphin/os/OS.h index d57e44d5e..247a41741 100644 --- a/include/dolphin/os/OS.h +++ b/include/dolphin/os/OS.h @@ -1,7 +1,7 @@ #ifndef OS_H_ #define OS_H_ -#include "Runtime.PPCEABI.H/__va_arg.h" +#include "__va_arg.h" #include "dolphin/dvd/dvd.h" #include "dolphin/os/OSAlarm.h" diff --git a/include/dolphin/types.h b/include/dolphin/types.h index 68fe0a852..6c2aabdd9 100644 --- a/include/dolphin/types.h +++ b/include/dolphin/types.h @@ -33,7 +33,7 @@ typedef int BOOL; (((u32)ptr[offset] << 24) | ((u32)ptr[offset + 1] << 16) | ((u32)ptr[offset + 2] << 8) | \ (u32)ptr[offset + 3]); -#include "MSL_C/MSL_Common/Src/stddef.h" +#include "stddef.h" #define INT32_MAX (0x7fffffff) #define UINT32_MAX (0xffffffff) diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index 6e763ff71..3403904fe 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -1,7 +1,7 @@ #ifndef F_OP_ACTOR_MNG_H_ #define F_OP_ACTOR_MNG_H_ -#include "MSL_C/new.h" +#include "new.h" #include "f_op/f_op_actor.h" #include "f_op/f_op_actor_iter.h" #include "f_pc/f_pc_manager.h" diff --git a/include/m_Do/m_Do_printf.h b/include/m_Do/m_Do_printf.h index e92986917..a3f6b3a80 100644 --- a/include/m_Do/m_Do_printf.h +++ b/include/m_Do/m_Do_printf.h @@ -1,7 +1,7 @@ #ifndef M_DO_M_DO_PRINTF_H #define M_DO_M_DO_PRINTF_H -#include "Runtime.PPCEABI.H/__va_arg.h" +#include "__va_arg.h" #include "m_Do/m_Do_main.h" extern "C" { diff --git a/src/DynamicLink.cpp b/src/DynamicLink.cpp index 2402654b0..6f43df0e8 100644 --- a/src/DynamicLink.cpp +++ b/src/DynamicLink.cpp @@ -10,7 +10,7 @@ #include "JSystem/JKernel/JKRFileCache.h" #include "JSystem/JUtility/JUTAssert.h" #include "JSystem/JUtility/JUTConsole.h" -#include "MSL_C/stdio.h" +#include "stdio.h" #include "REL/executor.h" #include "m_Do/m_Do_dvd_thread.h" #include "m_Do/m_Do_ext.h" diff --git a/src/JSystem/J2DGraph/J2DPrint.cpp b/src/JSystem/J2DGraph/J2DPrint.cpp index b99bdb4c2..ec845514d 100644 --- a/src/JSystem/J2DGraph/J2DPrint.cpp +++ b/src/JSystem/J2DGraph/J2DPrint.cpp @@ -6,7 +6,7 @@ #include "JSystem/J2DGraph/J2DPrint.h" #include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JUtility/JUTAssert.h" -#include "MSL_C/stdlib.h" +#include "stdlib.h" #include "dolphin/types.h" char* J2DPrint::mStrBuff; diff --git a/src/JSystem/J3DGraphBase/J3DMatBlock.cpp b/src/JSystem/J3DGraphBase/J3DMatBlock.cpp index 2ecc73c36..a900126bd 100644 --- a/src/JSystem/J3DGraphBase/J3DMatBlock.cpp +++ b/src/JSystem/J3DGraphBase/J3DMatBlock.cpp @@ -12,7 +12,7 @@ #include "dolphin/gd/GDBase.h" #include "dolphin/os/OS.h" #include "dolphin/types.h" -#include "MSL_C/string.h" +#include "string.h" inline GXAttnFn J3DColorChan::getAttnFn() { u8 attnFnTbl[] = { GX_AF_NONE, GX_AF_SPEC, GX_AF_NONE, GX_AF_SPOT }; diff --git a/src/JSystem/J3DGraphBase/J3DPacket.cpp b/src/JSystem/J3DGraphBase/J3DPacket.cpp index ce86b8c04..9db6d3173 100644 --- a/src/JSystem/J3DGraphBase/J3DPacket.cpp +++ b/src/JSystem/J3DGraphBase/J3DPacket.cpp @@ -8,7 +8,7 @@ #include "JSystem/J3DGraphBase/J3DSys.h" #include "JSystem/J3DGraphAnimator/J3DModel.h" #include "JSystem/JKernel/JKRHeap.h" -#include "MSL_C/string.h" +#include "string.h" #include "dolphin/gx/GX.h" #include "dolphin/os/OS.h" diff --git a/src/JSystem/J3DU/J3DUClipper.cpp b/src/JSystem/J3DU/J3DUClipper.cpp index 8e7406612..4f761c661 100644 --- a/src/JSystem/J3DU/J3DUClipper.cpp +++ b/src/JSystem/J3DU/J3DUClipper.cpp @@ -6,7 +6,7 @@ #include "JSystem/J3DU/J3DUClipper.h" #include "JSystem/J3DGraphAnimator/J3DModel.h" #include "JSystem/J3DGraphAnimator/J3DModelData.h" -#include "MSL_C/math.h" +#include "math.h" // Needed for the .rodata section to match. static const f32 dummy1[3] = {1.0f, 1.0f, 1.0f}; diff --git a/src/JSystem/JAudio/JAIBasic.cpp b/src/JSystem/JAudio/JAIBasic.cpp index ee1c53e42..e9e35e348 100644 --- a/src/JSystem/JAudio/JAIBasic.cpp +++ b/src/JSystem/JAudio/JAIBasic.cpp @@ -13,7 +13,7 @@ #include "JSystem/JKernel/JKRArchive.h" #include "JSystem/JKernel/JKRSolidHeap.h" #include "JSystem/JUtility/JUTAssert.h" -#include "MSL_C/string.h" +#include "string.h" namespace JAIInitData = JAInter::InitData; namespace JAISequenceMgr = JAInter::SequenceMgr; diff --git a/src/JSystem/JAudio/JAIInitData.cpp b/src/JSystem/JAudio/JAIInitData.cpp index 08618255c..445348205 100644 --- a/src/JSystem/JAudio/JAIInitData.cpp +++ b/src/JSystem/JAudio/JAIInitData.cpp @@ -13,7 +13,7 @@ #include "JSystem/JAudio/JASSystemHeap.h" #include "JSystem/JKernel/JKRSolidHeap.h" #include "JSystem/JUtility/JUTAssert.h" -#include "MSL_C/string.h" +#include "string.h" u32* JAInter::InitData::aafPointer; diff --git a/src/JSystem/JAudio/JAISequenceMgr.cpp b/src/JSystem/JAudio/JAISequenceMgr.cpp index a54633be2..e66ab8306 100644 --- a/src/JSystem/JAudio/JAISequenceMgr.cpp +++ b/src/JSystem/JAudio/JAISequenceMgr.cpp @@ -7,7 +7,7 @@ #include "JSystem/JAudio/JAIBasic.h" #include "JSystem/JAudio/JAIGlobalParameter.h" #include "JSystem/JKernel/JKRSolidHeap.h" -#include "MSL_C/string.h" +#include "string.h" JAInter::LinkSound JAInter::SequenceMgr::seqControl; JAInter::SeqUpdateData* JAInter::SequenceMgr::seqTrackInfo; diff --git a/src/JSystem/JAudio/JAIStreamMgr.cpp b/src/JSystem/JAudio/JAIStreamMgr.cpp index 000b37a84..5982389c5 100644 --- a/src/JSystem/JAudio/JAIStreamMgr.cpp +++ b/src/JSystem/JAudio/JAIStreamMgr.cpp @@ -8,7 +8,7 @@ #include "JSystem/JAudio/JASDSPInterface.h" #include "JSystem/JAudio/JASSystemHeap.h" #include "JSystem/JKernel/JKRSolidHeap.h" -#include "MSL_C/string.h" +#include "string.h" #include "dolphin/os/OS.h" s16 JAInter::StreamLib::filter_table[32] = { diff --git a/src/JSystem/JAudio/JASCalc.cpp b/src/JSystem/JAudio/JASCalc.cpp index 93ecbddf9..d5e3034ee 100644 --- a/src/JSystem/JAudio/JASCalc.cpp +++ b/src/JSystem/JAudio/JASCalc.cpp @@ -7,7 +7,7 @@ #include "JSystem/JAudio/JASSystemHeap.h" #include "JSystem/JKernel/JKRSolidHeap.h" #include "JSystem/JUtility/JUTAssert.h" -#include "MSL_C/math.h" +#include "math.h" f32* JASystem::Calc::JASC_SINTABLE; f32* JASystem::Calc::JASC_DOL2TABLE; diff --git a/src/JSystem/JAudio/JASHardStream.cpp b/src/JSystem/JAudio/JASHardStream.cpp index 0e7afe4bf..95f07b31e 100644 --- a/src/JSystem/JAudio/JASHardStream.cpp +++ b/src/JSystem/JAudio/JASHardStream.cpp @@ -5,7 +5,7 @@ #include "JSystem/JAudio/JASHardStream.h" #include "JSystem/JUtility/JUTAssert.h" -#include "MSL_C/string.h" +#include "string.h" #include "dolphin/ai/ai.h" #include "dolphin/dvd/dvd.h" #include "dolphin/os/OS.h" diff --git a/src/JSystem/JAudio/JASWaveArcLoader.cpp b/src/JSystem/JAudio/JASWaveArcLoader.cpp index e5ca11269..a259f5728 100644 --- a/src/JSystem/JAudio/JASWaveArcLoader.cpp +++ b/src/JSystem/JAudio/JASWaveArcLoader.cpp @@ -8,7 +8,7 @@ #include "JSystem/JAudio/JASSystemHeap.h" #include "JSystem/JKernel/JKRDvdAramRipper.h" #include "JSystem/JUtility/JUTAssert.h" -#include "MSL_C/string.h" +#include "string.h" const u32 DIR_MAX = 64; diff --git a/src/JSystem/JKernel/JKRAram.cpp b/src/JSystem/JKernel/JKRAram.cpp index 5df365366..885d216e8 100644 --- a/src/JSystem/JKernel/JKRAram.cpp +++ b/src/JSystem/JKernel/JKRAram.cpp @@ -10,7 +10,7 @@ #include "JSystem/JKernel/JKRExpHeap.h" #include "JSystem/JUtility/JUTAssert.h" #include "JSystem/JUtility/JUTException.h" -#include "MSL_C/string.h" +#include "string.h" #include "dolphin/ar/ar.h" #include "dolphin/ar/arq.h" #include "dolphin/os/OS.h" diff --git a/src/JSystem/JKernel/JKRAramArchive.cpp b/src/JSystem/JKernel/JKRAramArchive.cpp index 050883c69..7398956bc 100644 --- a/src/JSystem/JKernel/JKRAramArchive.cpp +++ b/src/JSystem/JKernel/JKRAramArchive.cpp @@ -13,8 +13,8 @@ #include "JSystem/JKernel/JKRDvdAramRipper.h" #include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JUtility/JUTAssert.h" -#include "MSL_C/math.h" -#include "MSL_C/string.h" +#include "math.h" +#include "string.h" #include "dolphin/os/OS.h" /* 802B9FE0-802BA088 .text __ct__14JKRAramArchiveFlQ210JKRArchive15EMountDirection */ diff --git a/src/JSystem/JKernel/JKRArchivePri.cpp b/src/JSystem/JKernel/JKRArchivePri.cpp index 133fbb8c8..731372f31 100644 --- a/src/JSystem/JKernel/JKRArchivePri.cpp +++ b/src/JSystem/JKernel/JKRArchivePri.cpp @@ -5,8 +5,8 @@ #include "JSystem/JKernel/JKRArchive.h" #include "JSystem/JKernel/JKRHeap.h" -#include "MSL_C/MSL_Common/Src/ctype.h" -#include "MSL_C/string.h" +#include "ctype.h" +#include "string.h" #include "dolphin/types.h" u32 JKRArchive::sCurrentDirID; diff --git a/src/JSystem/JKernel/JKRCompArchive.cpp b/src/JSystem/JKernel/JKRCompArchive.cpp index 83fd9cfe0..d4647a7cf 100644 --- a/src/JSystem/JKernel/JKRCompArchive.cpp +++ b/src/JSystem/JKernel/JKRCompArchive.cpp @@ -15,8 +15,8 @@ #include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JKernel/JKRMemArchive.h" #include "JSystem/JUtility/JUTAssert.h" -#include "MSL_C/math.h" -#include "MSL_C/string.h" +#include "math.h" +#include "string.h" #include "dolphin/os/OS.h" /* 802BB82C-802BB8D4 .text __ct__14JKRCompArchiveFlQ210JKRArchive15EMountDirection */ diff --git a/src/JSystem/JKernel/JKRDvdAramRipper.cpp b/src/JSystem/JKernel/JKRDvdAramRipper.cpp index 000b2df05..16703a8ae 100644 --- a/src/JSystem/JKernel/JKRDvdAramRipper.cpp +++ b/src/JSystem/JKernel/JKRDvdAramRipper.cpp @@ -12,7 +12,7 @@ #include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JSupport/JSUFileStream.h" #include "JSystem/JUtility/JUTAssert.h" -#include "MSL_C/string.h" +#include "string.h" #include "dolphin/os/OSCache.h" #include "dolphin/os/OSInterrupt.h" #include "dolphin/vi/vi.h" diff --git a/src/JSystem/JKernel/JKRDvdArchive.cpp b/src/JSystem/JKernel/JKRDvdArchive.cpp index 39d04ab80..b84dea67a 100644 --- a/src/JSystem/JKernel/JKRDvdArchive.cpp +++ b/src/JSystem/JKernel/JKRDvdArchive.cpp @@ -9,8 +9,8 @@ #include "JSystem/JKernel/JKRDvdRipper.h" #include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JUtility/JUTAssert.h" -#include "MSL_C/math.h" -#include "MSL_C/string.h" +#include "math.h" +#include "string.h" #include "dolphin/os/OS.h" /* 802BABD4-802BAC7C .text __ct__13JKRDvdArchiveFlQ210JKRArchive15EMountDirection */ diff --git a/src/JSystem/JKernel/JKRDvdRipper.cpp b/src/JSystem/JKernel/JKRDvdRipper.cpp index da435697e..f5cdbda52 100644 --- a/src/JSystem/JKernel/JKRDvdRipper.cpp +++ b/src/JSystem/JKernel/JKRDvdRipper.cpp @@ -7,7 +7,7 @@ #include "JSystem/JKernel/JKRDecomp.h" #include "JSystem/JKernel/JKRDvdFile.h" #include "JSystem/JUtility/JUTAssert.h" -#include "MSL_C/string.h" +#include "string.h" #include "dolphin/os/OS.h" #include "dolphin/vi/vi.h" #include "global.h" diff --git a/src/JSystem/JKernel/JKRExpHeap.cpp b/src/JSystem/JKernel/JKRExpHeap.cpp index 98835901e..e4890eeba 100644 --- a/src/JSystem/JKernel/JKRExpHeap.cpp +++ b/src/JSystem/JKernel/JKRExpHeap.cpp @@ -10,7 +10,7 @@ #include "JSystem/JUtility/JUTException.h" #include "dolphin/os/OS.h" #include "dolphin/types.h" -#include "MSL_C/new.h" +#include "new.h" /* 802B1558-802B15D0 .text createRoot__10JKRExpHeapFib */ JKRExpHeap* JKRExpHeap::createRoot(int maxHeaps, bool errorFlag) { diff --git a/src/JSystem/JKernel/JKRFileCache.cpp b/src/JSystem/JKernel/JKRFileCache.cpp index 7f91ceff4..95334515a 100644 --- a/src/JSystem/JKernel/JKRFileCache.cpp +++ b/src/JSystem/JKernel/JKRFileCache.cpp @@ -8,8 +8,8 @@ #include "JSystem/JKernel/JKRFileFinder.h" #include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JUtility/JUTAssert.h" -#include "MSL_C/MSL_Common/Src/ctype.h" -#include "MSL_C/string.h" +#include "ctype.h" +#include "string.h" #include "global.h" /* 802B6FEC-802B70EC .text mount__12JKRFileCacheFPCcP7JKRHeapPCc */ diff --git a/src/JSystem/JKernel/JKRFileLoader.cpp b/src/JSystem/JKernel/JKRFileLoader.cpp index 3c28189a3..99ed5a936 100644 --- a/src/JSystem/JKernel/JKRFileLoader.cpp +++ b/src/JSystem/JKernel/JKRFileLoader.cpp @@ -4,8 +4,8 @@ // #include "JSystem/JKernel/JKRFileLoader.h" -#include "MSL_C/string.h" -#include "MSL_C/MSL_Common/Src/ctype.h" +#include "string.h" +#include "ctype.h" #include "global.h" JKRFileLoader* JKRFileLoader::sCurrentVolume; diff --git a/src/JSystem/JKernel/JKRMemArchive.cpp b/src/JSystem/JKernel/JKRMemArchive.cpp index e8d5b8fa1..8d0456640 100644 --- a/src/JSystem/JKernel/JKRMemArchive.cpp +++ b/src/JSystem/JKernel/JKRMemArchive.cpp @@ -8,7 +8,7 @@ #include "JSystem/JKernel/JKRDvdRipper.h" #include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JUtility/JUTAssert.h" -#include "MSL_C/string.h" +#include "string.h" /* 802B9568-802B95A4 .text __ct__13JKRMemArchiveFv */ JKRMemArchive::JKRMemArchive() {} diff --git a/src/JSystem/JKernel/JKRSolidHeap.cpp b/src/JSystem/JKernel/JKRSolidHeap.cpp index 16056ae6e..3bf26df33 100644 --- a/src/JSystem/JKernel/JKRSolidHeap.cpp +++ b/src/JSystem/JKernel/JKRSolidHeap.cpp @@ -6,7 +6,7 @@ #include "JSystem/JKernel/JKRSolidHeap.h" #include "JSystem/JUtility/JUTAssert.h" #include "JSystem/JUtility/JUTConsole.h" -#include "MSL_C/new.h" +#include "new.h" #include "global.h" /* 802B3290-802B333C .text create__12JKRSolidHeapFUlP7JKRHeapb */ diff --git a/src/JSystem/JKernel/JKRStdHeap.cpp b/src/JSystem/JKernel/JKRStdHeap.cpp index e7cac7c45..df189e313 100644 --- a/src/JSystem/JKernel/JKRStdHeap.cpp +++ b/src/JSystem/JKernel/JKRStdHeap.cpp @@ -6,7 +6,7 @@ #include "JSystem/JKernel/JKRStdHeap.h" #include "JSystem/JUtility/JUTAssert.h" #include "JSystem/JUtility/JUTConsole.h" -#include "MSL_C/new.h" +#include "new.h" #include "global.h" /* 802B0F34-802B0FE0 .text create__10JKRStdHeapFUlP7JKRHeapb */ diff --git a/src/JSystem/JMath/JMath.cpp b/src/JSystem/JMath/JMath.cpp index 4b96227ce..7c4fcb375 100644 --- a/src/JSystem/JMath/JMath.cpp +++ b/src/JSystem/JMath/JMath.cpp @@ -5,7 +5,7 @@ #include "JSystem/JMath/JMath.h" #include "JSystem/JMath/JMATrigonometric.h" -#include "MSL_C/math.h" +#include "math.h" #include "dolphin/types.h" u16 jmaSinTableSize; diff --git a/src/JSystem/JParticle/JPAResourceManager.cpp b/src/JSystem/JParticle/JPAResourceManager.cpp index a155fe227..6a3828e48 100644 --- a/src/JSystem/JParticle/JPAResourceManager.cpp +++ b/src/JSystem/JParticle/JPAResourceManager.cpp @@ -8,7 +8,7 @@ #include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JUtility/JUTAssert.h" #include "JSystem/JUtility/JUTTexture.h" -#include "MSL_C/string.h" +#include "string.h" /* 80258CAC-80258D54 .text __ct__18JPATextureResourceFUlP7JKRHeap */ JPATextureResource::JPATextureResource(u32 num, JKRHeap* heap) { diff --git a/src/JSystem/JSupport/JSUMemoryStream.cpp b/src/JSystem/JSupport/JSUMemoryStream.cpp index 3981aeba0..2ff1d4454 100644 --- a/src/JSystem/JSupport/JSUMemoryStream.cpp +++ b/src/JSystem/JSupport/JSUMemoryStream.cpp @@ -4,7 +4,7 @@ // #include "JSystem/JSupport/JSUMemoryStream.h" -#include "MSL_c/string.h" +#include "string.h" /* 802BF704-802BF718 .text setBuffer__20JSUMemoryInputStreamFPCvl */ void JSUMemoryInputStream::setBuffer(void const* pBuffer, s32 length) { diff --git a/src/JSystem/JUtility/JUTAssert.cpp b/src/JSystem/JUtility/JUTAssert.cpp index 056885bdf..035a54779 100644 --- a/src/JSystem/JUtility/JUTAssert.cpp +++ b/src/JSystem/JUtility/JUTAssert.cpp @@ -7,7 +7,7 @@ #include "JSystem/JUtility/JUTConsole.h" #include "JSystem/JUtility/JUTDbPrint.h" #include "JSystem/JUtility/JUTDirectPrint.h" -#include "MSL_C/stdio.h" +#include "stdio.h" #include "dolphin/vi/vi.h" namespace JUTAssertion { diff --git a/src/JSystem/JUtility/JUTConsole.cpp b/src/JSystem/JUtility/JUTConsole.cpp index a6117add9..903eb6e4e 100644 --- a/src/JSystem/JUtility/JUTConsole.cpp +++ b/src/JSystem/JUtility/JUTConsole.cpp @@ -9,8 +9,8 @@ #include "JSystem/JUtility/JUTAssert.h" #include "JSystem/JUtility/JUTDirectPrint.h" #include "JSystem/JUtility/JUTVideo.h" -#include "MSL_C/new.h" -#include "MSL_C/stdio.h" +#include "new.h" +#include "stdio.h" #include "dolphin/types.h" JUTConsoleManager* JUTConsoleManager::sManager; diff --git a/src/JSystem/JUtility/JUTDbPrint.cpp b/src/JSystem/JUtility/JUTDbPrint.cpp index 6bdd5e15c..a39373d67 100644 --- a/src/JSystem/JUtility/JUTDbPrint.cpp +++ b/src/JSystem/JUtility/JUTDbPrint.cpp @@ -7,8 +7,8 @@ #include "JSystem/J2DGraph/J2DOrthoGraph.h" #include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JUtility/JUTVideo.h" -#include "MSL_C/stdio.h" -#include "Runtime.PPCEABI.H/__va_arg.h" +#include "stdio.h" +#include "__va_arg.h" #include "dolphin/types.h" /* 802C328C-802C32D4 .text __ct__10JUTDbPrintFP7JUTFontP7JKRHeap */ diff --git a/src/JSystem/JUtility/JUTDirectPrint.cpp b/src/JSystem/JUtility/JUTDirectPrint.cpp index 3e68a7b18..718c72e83 100644 --- a/src/JSystem/JUtility/JUTDirectPrint.cpp +++ b/src/JSystem/JUtility/JUTDirectPrint.cpp @@ -4,7 +4,7 @@ // #include "JSystem/JUtility/JUTDirectPrint.h" -#include "MSL_C/stdio.h" +#include "stdio.h" #include "dolphin/os/OSCache.h" JUTDirectPrint* JUTDirectPrint::sDirectPrint; diff --git a/src/JSystem/JUtility/JUTException.cpp b/src/JSystem/JUtility/JUTException.cpp index 2c8ba35e4..6151c1174 100644 --- a/src/JSystem/JUtility/JUTException.cpp +++ b/src/JSystem/JUtility/JUTException.cpp @@ -7,10 +7,10 @@ #include "JSystem/JUtility/JUTConsole.h" #include "JSystem/JUtility/JUTDirectFile.h" #include "JSystem/JUtility/JUTDirectPrint.h" -#include "MSL_C/math.h" -#include "MSL_C/stdio.h" -#include "MSL_C/stdlib.h" -#include "MSL_C/new.h" +#include "math.h" +#include "stdio.h" +#include "stdlib.h" +#include "new.h" #include "dolphin/base/PPCArch.h" #include "dolphin/gx/GX.h" #include "dolphin/os/OS.h" diff --git a/src/JSystem/JUtility/JUTGamePad.cpp b/src/JSystem/JUtility/JUTGamePad.cpp index 66f8e525e..b8b5eb216 100644 --- a/src/JSystem/JUtility/JUTGamePad.cpp +++ b/src/JSystem/JUtility/JUTGamePad.cpp @@ -4,7 +4,7 @@ // #include "JSystem/JUtility/JUTGamePad.h" -#include "MSL_C/math.h" +#include "math.h" #include "dolphin/os/OS.h" u32 channel_mask[4] = {0x80000000, 0x40000000, 0x20000000, 0x10000000}; diff --git a/src/JSystem/JUtility/JUTNameTab.cpp b/src/JSystem/JUtility/JUTNameTab.cpp index b741f0515..b4039f3aa 100644 --- a/src/JSystem/JUtility/JUTNameTab.cpp +++ b/src/JSystem/JUtility/JUTNameTab.cpp @@ -5,7 +5,7 @@ #include "JSystem/JUtility/JUTNameTab.h" #include "JSystem/JUtility/JUTAssert.h" -#include "MSL_C/string.h" +#include "string.h" JUTNameTab::JUTNameTab() { setResource(NULL); diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/algorithm.h b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/algorithm.h new file mode 100644 index 000000000..9ffe91876 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/algorithm.h @@ -0,0 +1,48 @@ +#ifndef MSL_ALGORITHM_H_ +#define MSL_ALGORITHM_H_ + +namespace std { +template +ForwardIterator lower_bound(ForwardIterator first, ForwardIterator last, const T& val); + +template +ForwardIterator upper_bound(ForwardIterator first, ForwardIterator last, const T& val); + +template +InputIt find_if(InputIt first, InputIt last, UnaryPredicate p); + +/* +template +struct __fill_n { + OutputIt fill_n(OutputIt first, Size count, const unsigned long& value); +}; + +template<> +unsigned long* __fill_n::fill_n(unsigned long* first, long count, const unsigned long& value) { + for (; count > 0; count--) { + *first++ = value; + } + return first; +} + +template +OutputIt fill_n(OutputIt first, Size count, const T& value) { + return __fill_n::fill_n(first, count, value); +} + + +template +void __fill(ForwardIt first, ForwardIt last, const T& value, std::random_access_iterator_tag param_3) { + fill_n(first, last - first, value); +} +*/ + +template +void fill(ForwardIt first, ForwardIt last, const T& value) { + for (; first != last; ++first){ + *first = value; + } +} +} // namespace std + +#endif diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/bitset.h b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/bitset.h new file mode 100644 index 000000000..1bdd4f0fa --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/bitset.h @@ -0,0 +1,81 @@ +#ifndef MSL_BITSET_H_ +#define MSL_BITSET_H_ + +#include "algorithm.h" +#include "stdio.h" +#include "stdlib.h" + +namespace std { +// TODO: where does this go? +inline void __msl_error(const char* param_0) { + fprintf(stderr, param_0); + abort(); +} + +template class __bitset_base { +public: + __bitset_base(); + + bool test(size_t pos) const; + bool any() const; + void set(size_t pos, bool val); + void reset(size_t pos); +private: + size_t data[N]; +}; + +template __bitset_base::__bitset_base() { + std::fill(data, data + N, 0); +} + +template bool __bitset_base::test(size_t pos) const { + size_t i = pos / (sizeof(size_t) * 8); + size_t mask = 1 << (pos % (sizeof(size_t) * 8)); + return data[i] & mask; +} + +template void __bitset_base::set(size_t pos, bool val) { + size_t i = pos / (sizeof(size_t) * 8); + size_t mask = 1 << (pos % (sizeof(size_t) * 8)); + if (val) { + data[i] |= mask; + } else { + data[i] &= ~mask; + } +} + +template void __bitset_base::reset(size_t pos) { + size_t i = pos / (sizeof(size_t) * 8); + size_t mask = 1 << (pos % (sizeof(size_t) * 8)); + data[i] &= ~mask; +} + +template class bitset : private __bitset_base<(N - 1) / (sizeof(size_t) * 8) + 1> { +public: + typedef __bitset_base<(N - 1) / (sizeof(size_t) * 8) + 1> base; + + bitset() {}; + + void set(size_t pos, bool val) { + if (pos >= N) { + __msl_error("index out of range of bitset::set"); + } + base::set(pos, val); + } + void reset(size_t pos) { + if (pos >= N) { + __msl_error("index out of range of bitset::reset"); + } + base::reset(pos); + } + bool test(size_t pos) const { + if (pos >= N) { + __msl_error("index out of range of bitset::test"); + } + return base::test(pos); + } + bool any() const; +}; +} // namespace std + +#endif diff --git a/include/MSL_C/functional.h b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/functional.h similarity index 73% rename from include/MSL_C/functional.h rename to src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/functional.h index d7373a7ec..8a11caaea 100644 --- a/include/MSL_C/functional.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/functional.h @@ -2,8 +2,7 @@ #define MSL_FUNCTIONAL_H_ namespace std { -template -struct less {}; +template struct less {}; } // namespace std #endif diff --git a/include/MSL_C/new.h b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/new.h similarity index 74% rename from include/MSL_C/new.h rename to src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/new.h index 17053c7f6..55eaba995 100644 --- a/include/MSL_C/new.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/new.h @@ -1,7 +1,7 @@ #ifndef MSL_NEW_H_ #define MSL_NEW_H_ -#include "MSL_C/MSL_Common/Src/stddef.h" +#include "stddef.h" inline void* operator new(size_t size, void* ptr) { return ptr; diff --git a/include/MSL_C/utility.h b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/utility.h similarity index 100% rename from include/MSL_C/utility.h rename to src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/utility.h diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/FILE_POS.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/FILE_POS.h new file mode 100644 index 000000000..386fc29fd --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/FILE_POS.h @@ -0,0 +1,18 @@ +#ifndef _MSL_COMMON_FILE_POS_H +#define _MSL_COMMON_FILE_POS_H + +#include "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 */ diff --git a/include/MSL_C/MSL_Common/Src/abort_exit.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/abort_exit.h similarity index 56% rename from include/MSL_C/MSL_Common/Src/abort_exit.h rename to src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/abort_exit.h index 80eea6390..7c62fe70f 100644 --- a/include/MSL_C/MSL_Common/Src/abort_exit.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/abort_exit.h @@ -1,5 +1,5 @@ -#ifndef MSL_COMMON_SRC_ABORT_EXIT_H -#define MSL_COMMON_SRC_ABORT_EXIT_H +#ifndef _MSL_COMMON_ABORT_EXIT_H +#define _MSL_COMMON_ABORT_EXIT_H #ifdef __cplusplus extern "C" { @@ -14,4 +14,4 @@ extern void (*__stdio_exit)(void); }; #endif -#endif /* MSL_COMMON_SRC_ABORT_EXIT_H */ +#endif /* _MSL_COMMON_ABORT_EXIT_H */ diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/alloc.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/alloc.h new file mode 100644 index 000000000..085c40d48 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/alloc.h @@ -0,0 +1,16 @@ +#ifndef _MSL_COMMON_ALLOC_H +#define _MSL_COMMON_ALLOC_H + +#include "ansi_files.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void free(void* ptr); + +#ifdef __cplusplus +} +#endif + +#endif /* _MSL_COMMON_ALLOC_H */ diff --git a/include/MSL_C/MSL_Common/Src/ansi_files.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/ansi_files.h similarity index 91% rename from include/MSL_C/MSL_Common/Src/ansi_files.h rename to src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/ansi_files.h index 4aee7fc17..d4d3b843a 100644 --- a/include/MSL_C/MSL_Common/Src/ansi_files.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/ansi_files.h @@ -1,7 +1,7 @@ -#ifndef MSL_COMMON_SRC_ANSI_FILES_H -#define MSL_COMMON_SRC_ANSI_FILES_H +#ifndef _MSL_COMMON_ANSI_FILES_H +#define _MSL_COMMON_ANSI_FILES_H -#include "MSL_C/MSL_Common/Src/stddef.h" +#include "stddef.h" #ifdef __cplusplus extern "C" { @@ -116,10 +116,8 @@ typedef struct _files { 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); +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); @@ -128,4 +126,4 @@ void __close_all(void); }; #endif -#endif /* MSL_COMMON_SRC_ANSI_FILES_H */ +#endif /* _MSL_COMMON_ANSI_FILES_H */ diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/ansi_fp.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/ansi_fp.h new file mode 100644 index 000000000..82152fbc2 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/ansi_fp.h @@ -0,0 +1,36 @@ +#ifndef _MSL_COMMON_ANSI_FP_H +#define _MSL_COMMON_ANSI_FP_H + +#include "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*, s32); +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 \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/arith.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/arith.h new file mode 100644 index 000000000..f1d0bd6d8 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/arith.h @@ -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 */ diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/buffer_io.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/buffer_io.h new file mode 100644 index 000000000..07fcf209e --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/buffer_io.h @@ -0,0 +1,11 @@ +#ifndef _MSL_COMMON_BUFFER_IO_H +#define _MSL_COMMON_BUFFER_IO_H + +#include "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 */ diff --git a/include/MSL_C/MSL_Common/Src/char_io.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/char_io.h similarity index 50% rename from include/MSL_C/MSL_Common/Src/char_io.h rename to src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/char_io.h index 47f7ac4ed..a21f2e1bb 100644 --- a/include/MSL_C/MSL_Common/Src/char_io.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/char_io.h @@ -1,7 +1,7 @@ -#ifndef MSL_COMMON_SRC_CHAR_IO_H -#define MSL_COMMON_SRC_CHAR_IO_H +#ifndef _MSL_COMMON_CHAR_IO_H +#define _MSL_COMMON_CHAR_IO_H -#include "MSL_C/MSL_Common/Src/ansi_files.h" +#include "ansi_files.h" #ifdef __cplusplus extern "C" { @@ -14,4 +14,4 @@ int __put_char(int c, FILE* stream); } #endif -#endif /* MSL_COMMON_SRC_CHAR_IO_H */ +#endif /* _MSL_COMMON_CHAR_IO_H */ diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/critical_regions.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/critical_regions.h new file mode 100644 index 000000000..a36c75d6c --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/critical_regions.h @@ -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 \ No newline at end of file diff --git a/include/MSL_C/MSL_Common/Src/ctype.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/ctype.h similarity index 50% rename from include/MSL_C/MSL_Common/Src/ctype.h rename to src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/ctype.h index 86290cf26..067a24b2f 100644 --- a/include/MSL_C/MSL_Common/Src/ctype.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/ctype.h @@ -1,5 +1,5 @@ -#ifndef MSL_COMMON_SRC_CTYPE_H -#define MSL_COMMON_SRC_CTYPE_H +#ifndef _MSL_COMMON_CTYPE_H +#define _MSL_COMMON_CTYPE_H #ifdef __cplusplus extern "C" { @@ -30,8 +30,17 @@ extern unsigned char __upper_map[]; int tolower(int); +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); } +// added underscore to avoid naming conflicts +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]); } + #ifdef __cplusplus } #endif -#endif /* MSL_COMMON_SRC_CTYPE_H */ +#endif /* _MSL_COMMON_CTYPE_H */ diff --git a/include/MSL_C/MSL_Common/Src/direct_io.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/direct_io.h similarity index 59% rename from include/MSL_C/MSL_Common/Src/direct_io.h rename to src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/direct_io.h index a15d4ee90..c16943b43 100644 --- a/include/MSL_C/MSL_Common/Src/direct_io.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/direct_io.h @@ -1,7 +1,7 @@ -#ifndef MSL_COMMON_SRC_DIRECT_IO_H -#define MSL_COMMON_SRC_DIRECT_IO_H +#ifndef _MSL_COMMON_DIRECT_IO_H +#define _MSL_COMMON_DIRECT_IO_H -#include "MSL_C/MSL_Common/Src/ansi_files.h" +#include "ansi_files.h" #ifdef __cplusplus extern "C" { @@ -14,4 +14,4 @@ size_t fwrite(const void* buffer, size_t size, size_t count, FILE* stream); } #endif -#endif /* MSL_COMMON_SRC_DIRECT_IO_H */ +#endif /* _MSL_COMMON_DIRECT_IO_H */ diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/errno.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/errno.h new file mode 100644 index 000000000..ef77faf34 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/errno.h @@ -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 */ \ No newline at end of file diff --git a/include/MSL_C/MSL_Common/Src/extras.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/extras.h similarity index 63% rename from include/MSL_C/MSL_Common/Src/extras.h rename to src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/extras.h index 2b89fc3fe..4d8e8b62e 100644 --- a/include/MSL_C/MSL_Common/Src/extras.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/extras.h @@ -1,5 +1,5 @@ -#ifndef MSL_COMMON_SRC_EXTRAS_H -#define MSL_COMMON_SRC_EXTRAS_H +#ifndef _MSL_COMMON_EXTRAS_H +#define _MSL_COMMON_EXTRAS_H #ifdef __cplusplus extern "C" { @@ -12,4 +12,4 @@ int stricmp(const char* str1, const char* str2); } #endif -#endif /* MSL_COMMON_SRC_EXTRAS_H */ +#endif /* _MSL_COMMON_EXTRAS_H */ diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/file_io.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/file_io.h new file mode 100644 index 000000000..a6cc390b4 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/file_io.h @@ -0,0 +1,18 @@ +#ifndef _MSL_COMMON_FILE_IO_H +#define _MSL_COMMON_FILE_IO_H + +#include "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 */ diff --git a/include/MSL_C/MSL_Common/Src/float.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/float.h similarity index 53% rename from include/MSL_C/MSL_Common/Src/float.h rename to src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/float.h index c7e04050e..10fab57c0 100644 --- a/include/MSL_C/MSL_Common/Src/float.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/float.h @@ -1,5 +1,5 @@ -#ifndef MSL_COMMON_SRC_FLOAT_H -#define MSL_COMMON_SRC_FLOAT_H +#ifndef _MSL_COMMON_FLOAT_H +#define _MSL_COMMON_FLOAT_H #include "fdlibm.h" @@ -16,10 +16,10 @@ #define signbit(x) ((sizeof(x) == sizeof(float)) ? __signbitf(x) : __signbitd(x)) #define isfinite(x) ((fpclassify(x) > 2)) -#define __signbitf(x) ((*(unsigned char*)&(x)) & 0x80) +#define __signbitf(x) ((int)(__HI(x) & 0x80000000)) // TODO: OK? -#define __signbitd(x) ((*(unsigned char*)&(x)) & 0x80) +#define __signbitd(x) ((int)(__HI(x) & 0x80000000)) extern unsigned long __float_nan[]; extern unsigned long __float_huge[]; @@ -48,22 +48,39 @@ inline int __fpclassifyf(float __value) { 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; + 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; } -#endif /* MSL_COMMON_SRC_FLOAT_H */ +#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 (*(float*) __float_max) +#define FLT_EPSILON (*(float*) __float_epsilon) + +#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 */ diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/limits.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/limits.h new file mode 100644 index 000000000..55110c724 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/limits.h @@ -0,0 +1,102 @@ +#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 +class numeric_limits { +public: + inline static T min(); + inline static T max(); +}; + +template <> +class numeric_limits { +public: + inline static char min() { return -0x80; } + inline static char max() { return 0x7F; } +}; + +template <> +class numeric_limits { +public: + inline static short min() { return -0x8000; } + inline static short max() { return 0x7FFF; } +}; + +template <> +class numeric_limits { +public: + inline static int min() { return -0x80000000; } + inline static int max() { return 0x7FFFFFFF; } +}; + +template <> +class numeric_limits { +public: + inline static long min() { return -0x80000000; } + inline static long max() { return 0x7FFFFFFF; } +}; + +template <> +class numeric_limits { +public: + inline static unsigned char min() { return 0x0; } + inline static unsigned char max() { return 0xFF; } +}; + +template <> +class numeric_limits { +public: + inline static unsigned short min() { return 0x0; } + inline static unsigned short max() { return 0xFFFF; } +}; + +template <> +class numeric_limits { +public: + inline static unsigned int min() { return 0x0; } + inline static unsigned int max() { return 0xFFFFFFFF; } +}; + +template <> +class numeric_limits { +public: + inline static unsigned long min() { return 0x0; } + inline static unsigned long max() { return 0xFFFFFFFF; } +}; + +} // namespace std +#endif +#endif \ No newline at end of file diff --git a/include/MSL_C/math.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h similarity index 93% rename from include/MSL_C/math.h rename to src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h index afabafac9..61dac6202 100644 --- a/include/MSL_C/math.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/math.h @@ -1,14 +1,16 @@ #ifndef MSL_MATH_H_ #define MSL_MATH_H_ -#include "MSL_C/MSL_Common/Src/float.h" +#include "float.h" -#define NAN (*(float*)__float_nan) -#define HUGE_VALF (*(float*)__float_huge) +#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)) #ifdef __cplusplus extern "C" { diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/mbstring.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/mbstring.h new file mode 100644 index 000000000..945748b13 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/mbstring.h @@ -0,0 +1,16 @@ +#ifndef _MSL_COMMON_MBSTRING_H +#define _MSL_COMMON_MBSTRING_H + +#include "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 */ diff --git a/include/MSL_C/MSL_Common/Src/mem_funcs.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/mem_funcs.h similarity index 69% rename from include/MSL_C/MSL_Common/Src/mem_funcs.h rename to src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/mem_funcs.h index a5c911071..0e2454660 100644 --- a/include/MSL_C/MSL_Common/Src/mem_funcs.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/mem_funcs.h @@ -1,7 +1,7 @@ -#ifndef MSL_COMMON_SRC_MEM_FUNCS_H -#define MSL_COMMON_SRC_MEM_FUNCS_H +#ifndef _MSL_COMMON_MEM_FUNCS_H +#define _MSL_COMMON_MEM_FUNCS_H -#include "MSL_C/MSL_Common/Src/stddef.h" +#include "stddef.h" #ifdef __cplusplus extern "C" { @@ -16,4 +16,4 @@ void __copy_longs_aligned(void* dst, const void* src, size_t n); } #endif -#endif /* MSL_COMMON_SRC_MEM_FUNCS_H */ +#endif /* _MSL_COMMON_MEM_FUNCS_H */ diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/misc_io.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/misc_io.h new file mode 100644 index 000000000..715f282a1 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/misc_io.h @@ -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 */ diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/printf.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/printf.h new file mode 100644 index 000000000..2adaa7d02 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/printf.h @@ -0,0 +1,22 @@ +#ifndef _MSL_COMMON_PRINTF_H +#define _MSL_COMMON_PRINTF_H + +#include "ansi_files.h" +#include "__va_arg.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 */ diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/scanf.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/scanf.h new file mode 100644 index 000000000..ca142dc1c --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/scanf.h @@ -0,0 +1,43 @@ +#ifndef _MSL_COMMON_SCANF_H +#define _MSL_COMMON_SCANF_H + +#include "stddef.h" +#include "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 */ diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/signal.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/signal.h new file mode 100644 index 000000000..58fc22abb --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/signal.h @@ -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 */ diff --git a/include/MSL_C/MSL_Common/Src/stddef.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/stddef.h similarity index 81% rename from include/MSL_C/MSL_Common/Src/stddef.h rename to src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/stddef.h index 7d93b6504..dacf39977 100644 --- a/include/MSL_C/MSL_Common/Src/stddef.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/stddef.h @@ -13,12 +13,14 @@ 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 \ No newline at end of file diff --git a/include/MSL_C/stdio.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/stdio.h similarity index 54% rename from include/MSL_C/stdio.h rename to src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/stdio.h index 7c4ff318e..e8f88ac8f 100644 --- a/include/MSL_C/stdio.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/stdio.h @@ -1,9 +1,10 @@ #ifndef MSL_STDIO_H_ #define MSL_STDIO_H_ -#include "MSL_C/MSL_Common/Src/char_io.h" -#include "MSL_C/MSL_Common/Src/file_io.h" -#include "MSL_C/MSL_Common/Src/printf.h" +#include "char_io.h" +#include "file_io.h" +#include "printf.h" +#include "extras.h" #define stdin (&__files._stdin) #define stdout (&__files._stdout) diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/stdlib.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/stdlib.h new file mode 100644 index 000000000..2ce2e5c80 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/stdlib.h @@ -0,0 +1,9 @@ +#ifndef MSL_STDLIB_H_ +#define MSL_STDLIB_H_ + +#include "abort_exit.h" +#include "arith.h" +#include "mbstring.h" +#include "strtoul.h" + +#endif diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/string.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/string.h new file mode 100644 index 000000000..e8878af9f --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/string.h @@ -0,0 +1,31 @@ +#ifndef _MSL_COMMON_STRING_H +#define _MSL_COMMON_STRING_H + +#include "stddef.h" +#include "extras.h" + +#ifdef __cplusplus +extern "C" { +#endif + +__declspec(section ".init") void* memcpy(void* dest, const void* src, size_t n); +__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 +} +#endif + +#endif /* _MSL_COMMON_STRING_H */ diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/strtoul.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/strtoul.h new file mode 100644 index 000000000..c10340bf1 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/strtoul.h @@ -0,0 +1,17 @@ +#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 */ diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wchar_io.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wchar_io.h new file mode 100644 index 000000000..711bb395b --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/wchar_io.h @@ -0,0 +1,12 @@ +#ifndef _MSL_COMMON_WCHAR_IO_H +#define _MSL_COMMON_WCHAR_IO_H + +#include "ansi_files.h" + +#ifndef __cplusplus +typedef unsigned short wchar_t; +#endif + +int fwide(FILE* file, int mode); + +#endif /* _MSL_COMMON_WCHAR_IO_H */ diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/FILE_POS.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/FILE_POS.c new file mode 100644 index 000000000..224c68145 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/FILE_POS.c @@ -0,0 +1,99 @@ +#include "FILE_POS.h" +#include "buffer_io.h" +#include "critical_regions.h" +#include "errno.h" + +long ftell(FILE* stream) { + int retval; + retval = (long)_ftell(stream); + return retval; +} + +inline int _ftell(FILE* file) { + int charsInUndoBuffer = 0; + int position; + + unsigned char tmp_kind = file->file_mode.file_kind; + if (!(tmp_kind == __disk_file || tmp_kind == __console_file) || file->file_state.error) { + errno = 0x28; + return -1; + } + + if (file->file_state.io_state == __neutral) + return (file->position); + + position = file->buffer_position + (file->buffer_ptr - file->buffer); + + if (file->file_state.io_state >= __rereading) { + charsInUndoBuffer = file->file_state.io_state - __rereading + 1; + position -= charsInUndoBuffer; + } + + return (position); +} + +int _fseek(FILE* file, unsigned long offset, int whence) { + int bufferCode; + int pos; + int adjust; + unsigned long state; + int buffLen; + + unsigned char* ptr; + + if (file->file_mode.file_kind != 1 || file->file_state.error != 0) { + errno = 0x28; + return -1; + } + + if (file->file_state.io_state == 1) { + if (__flush_buffer(file, NULL) != 0) { + file->file_state.error = 1; + file->buffer_length = 0; + errno = 0x28; + return -1; + } + } + + if (whence == SEEK_CUR) { + whence = SEEK_SET; + offset += _ftell(file); + } + + if ((whence != SEEK_END) && (file->file_mode.io_mode != 3) && + (file->file_state.io_state == 2 || file->file_state.io_state == 3)) + { + if ((offset >= file->position) || !(offset >= file->buffer_position)) { + file->file_state.io_state = 0; + } else { + file->buffer_ptr = file->buffer + (offset - file->buffer_position); + file->buffer_length = file->position - offset; + file->file_state.io_state = 2; + } + } else { + file->file_state.io_state = 0; + } + + if (file->file_state.io_state == 0) { + if (file->position_fn != NULL && + (int)file->position_fn(file->handle, &offset, whence, file->idle_fn)) + { + file->file_state.error = 1; + file->buffer_length = 0; + errno = 0x28; + return -1; + } else { + file->file_state.eof = 0; + file->position = offset; + file->buffer_length = 0; + } + } + + return 0; +} + +int fseek(FILE* stream, unsigned long offset, int whence) { + int code; + code = _fseek(stream, offset, whence); + return code; +} diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/abort_exit.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/abort_exit.c new file mode 100644 index 000000000..9b7081d51 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/abort_exit.c @@ -0,0 +1,45 @@ +#include "abort_exit.h" +#include "critical_regions.h" +#include "stddef.h" + +extern void (*__destroy_global_chain_reference[])(void); + +static void (*__atexit_funcs[64])(void); + +static void (*__console_exit)(void); + +void (*__stdio_exit)(void); + +static int __atexit_curr_func; + +static int __aborting; + +void exit(int status) { + int i; + void (**dtor)(void); + + if (!__aborting) { + __destroy_global_chain(); + + dtor = __destroy_global_chain_reference; + while (*dtor != NULL) { + (*dtor)(); + dtor++; + } + + if (__stdio_exit != NULL) { + __stdio_exit(); + __stdio_exit = NULL; + } + } + + while (__atexit_curr_func > 0) + __atexit_funcs[--__atexit_curr_func](); + + if (__console_exit != NULL) { + __console_exit(); + __console_exit = NULL; + } + + _ExitProcess(); +} diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/alloc.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/alloc.c new file mode 100644 index 000000000..d04885df0 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/alloc.c @@ -0,0 +1,345 @@ +#include "alloc.h" +#include "critical_regions.h" +#include "string.h" + +typedef struct Block { + struct Block* prev; + struct Block* next; + unsigned long max_size; + unsigned long size; +} Block; + +typedef struct SubBlock { + unsigned long size; + Block* block; + struct SubBlock* prev; + struct SubBlock* next; +} SubBlock; + +struct FixSubBlock; + +typedef struct FixBlock { + struct FixBlock* prev_; + struct FixBlock* next_; + unsigned long client_size_; + struct FixSubBlock* start_; + unsigned long n_allocated_; +} FixBlock; + +typedef struct FixSubBlock { + FixBlock* block_; + struct FixSubBlock* next_; +} FixSubBlock; + +typedef struct FixStart { + FixBlock* tail_; + FixBlock* head_; +} FixStart; + +typedef struct __mem_pool_obj { + Block* start_; + FixStart fix_start[6]; +} __mem_pool_obj; + +typedef struct __mem_pool { + void* reserved[14]; +} __mem_pool; + +typedef long tag_word; + +typedef struct block_header { + tag_word tag; + struct block_header* prev; + struct block_header* next; +} block_header; + +typedef struct list_header { + block_header* rover; + block_header header; +} list_header; + +typedef struct heap_header { + struct heap_header* prev; + struct heap_header* next; +} heap_header; + +struct mem_pool_obj; +typedef void* (*sys_alloc_ptr)(unsigned long, struct mem_pool_obj*); +typedef void (*sys_free_ptr)(void*, struct mem_pool_obj*); + +typedef struct pool_options { + sys_alloc_ptr sys_alloc_func; + sys_free_ptr sys_free_func; + unsigned long min_heap_size; + int always_search_first; +} pool_options; + +typedef struct mem_pool_obj { + list_header free_list; + pool_options options; + heap_header* heap_list; + void* userData; + +} mem_pool_obj; + +mem_pool_obj __malloc_pool; +static int initialized = 0; + +static SubBlock* SubBlock_merge_prev(SubBlock*, SubBlock**); +static void SubBlock_merge_next(SubBlock*, SubBlock**); + +static const unsigned long fix_pool_sizes[] = {4, 12, 20, 36, 52, 68}; + +#define SubBlock_size(ths) ((ths)->size & 0xFFFFFFF8) +#define SubBlock_block(ths) ((Block*)((unsigned long)((ths)->block) & ~0x1)) +#define Block_size(ths) ((ths)->size & 0xFFFFFFF8) +#define Block_start(ths) (*(SubBlock**)((char*)(ths) + Block_size((ths)) - sizeof(unsigned long))) + +#define SubBlock_set_free(ths) \ + unsigned long this_size = SubBlock_size((ths)); \ + (ths)->size &= ~0x2; \ + *(unsigned long*)((char*)(ths) + this_size) &= ~0x4; \ + *(unsigned long*)((char*)(ths) + this_size - sizeof(unsigned long)) = this_size + +#define SubBlock_is_free(ths) !((ths)->size & 2) +#define SubBlock_set_size(ths, sz) \ + (ths)->size &= ~0xFFFFFFF8; \ + (ths)->size |= (sz) & 0xFFFFFFF8; \ + if (SubBlock_is_free((ths))) \ + *(unsigned long*)((char*)(ths) + (sz) - sizeof(unsigned long)) = (sz) + +#define SubBlock_from_pointer(ptr) ((SubBlock*)((char*)(ptr)-8)) +#define FixSubBlock_from_pointer(ptr) ((FixSubBlock*)((char*)(ptr)-4)) + +#define FixBlock_client_size(ths) ((ths)->client_size_) +#define FixSubBlock_size(ths) (FixBlock_client_size((ths)->block_)) + +#define classify(ptr) (*(unsigned long*)((char*)(ptr) - sizeof(unsigned long)) & 1) +#define __msize_inline(ptr) \ + (!classify(ptr) ? FixSubBlock_size(FixSubBlock_from_pointer(ptr)) : \ + SubBlock_size(SubBlock_from_pointer(ptr)) - 8) + +#define Block_empty(ths) \ + (_sb = (SubBlock*)((char*)(ths) + 16)), \ + SubBlock_is_free(_sb) && SubBlock_size(_sb) == Block_size((ths)) - 24 + +void __sys_free(); + +static inline SubBlock* SubBlock_merge_prev(SubBlock* ths, SubBlock** start) { + unsigned long prevsz; + SubBlock* p; + + if (!(ths->size & 0x04)) { + prevsz = *(unsigned long*)((char*)ths - sizeof(unsigned long)); + if (prevsz & 0x2) + return ths; + p = (SubBlock*)((char*)ths - prevsz); + SubBlock_set_size(p, prevsz + SubBlock_size(ths)); + + if (*start == ths) + *start = (*start)->next; + ths->next->prev = ths->prev; + ths->next->prev->next = ths->next; + return p; + } + return ths; +} + +void Block_link(Block* ths, SubBlock* sb) { + SubBlock** st; + SubBlock_set_free(sb); + st = &Block_start(ths); + + if (*st != 0) { + sb->prev = (*st)->prev; + sb->prev->next = sb; + sb->next = *st; + (*st)->prev = sb; + *st = sb; + *st = SubBlock_merge_prev(*st, st); + SubBlock_merge_next(*st, st); + } else { + *st = sb; + sb->prev = sb; + sb->next = sb; + } + if (ths->max_size < SubBlock_size(*st)) + ths->max_size = SubBlock_size(*st); +} + +static void SubBlock_merge_next(SubBlock* pBlock, SubBlock** pStart) { + SubBlock* next_sub_block; + unsigned long this_cur_size; + + next_sub_block = (SubBlock*)((char*)pBlock + (pBlock->size & 0xFFFFFFF8)); + + if (!(next_sub_block->size & 2)) { + this_cur_size = (pBlock->size & 0xFFFFFFF8) + (next_sub_block->size & 0xFFFFFFF8); + + pBlock->size &= ~0xFFFFFFF8; + pBlock->size |= this_cur_size & 0xFFFFFFF8; + + if (!(pBlock->size & 2)) { + *(unsigned long*)((char*)(pBlock) + (this_cur_size)-4) = (this_cur_size); + } + + if (!(pBlock->size & 2)) { + *(unsigned long*)((char*)pBlock + this_cur_size) &= ~4; + } else { + *(unsigned long*)((char*)pBlock + this_cur_size) |= 4; + } + + if (*pStart == next_sub_block) { + *pStart = (*pStart)->next; + } + + if (*pStart == next_sub_block) { + *pStart = 0; + } + + next_sub_block->next->prev = next_sub_block->prev; + next_sub_block->prev->next = next_sub_block->next; + } +} + +static inline Block* __unlink(__mem_pool_obj* pool_obj, Block* bp) { + Block* result = bp->next; + if (result == bp) { + result = 0; + } + + if (pool_obj->start_ == bp) { + pool_obj->start_ = result; + } + + if (result != 0) { + result->prev = bp->prev; + result->prev->next = result; + } + + bp->next = 0; + bp->prev = 0; + return result; +} + +static inline void deallocate_from_var_pools(__mem_pool_obj* pool_obj, void* ptr) { + SubBlock* sb = SubBlock_from_pointer(ptr); + SubBlock* _sb; + + Block* bp = SubBlock_block(sb); + Block_link(bp, sb); + + if (Block_empty(bp)) { + __unlink(pool_obj, bp); + __sys_free(bp); + } +} + +inline void __init_pool_obj(__mem_pool* pool_obj) { + memset(pool_obj, 0, sizeof(__mem_pool_obj)); +} + +static inline __mem_pool* get_malloc_pool(void) { + static __mem_pool protopool; + static unsigned char init = 0; + if (!init) { + __init_pool_obj(&protopool); + init = 1; + } + + return &protopool; +} + +static void deallocate_from_fixed_pools(__mem_pool_obj* pool_obj, void* ptr, unsigned long size) { + unsigned long i = 0; + FixSubBlock* p; + FixBlock* b; + FixStart* fs; + + while (size > fix_pool_sizes[i]) { + ++i; + } + + fs = &pool_obj->fix_start[i]; + p = FixSubBlock_from_pointer(ptr); + b = p->block_; + + if (b->start_ == 0 && fs->head_ != b) { + if (fs->tail_ == b) { + fs->head_ = fs->head_->prev_; + fs->tail_ = fs->tail_->prev_; + } else { + b->prev_->next_ = b->next_; + b->next_->prev_ = b->prev_; + b->next_ = fs->head_; + b->prev_ = b->next_->prev_; + b->prev_->next_ = b; + b->next_->prev_ = b; + fs->head_ = b; + } + } + + p->next_ = b->start_; + b->start_ = p; + + if (--b->n_allocated_ == 0) { + if (fs->head_ == b) { + fs->head_ = b->next_; + } + + if (fs->tail_ == b) { + fs->tail_ = b->prev_; + } + + b->prev_->next_ = b->next_; + b->next_->prev_ = b->prev_; + + if (fs->head_ == b) { + fs->head_ = 0; + } + + if (fs->tail_ == b) { + fs->tail_ = 0; + } + + deallocate_from_var_pools(pool_obj, b); + } +} + +static inline void __pool_free(__mem_pool* pool, void* ptr) { + __mem_pool_obj* pool_obj; + unsigned long size; + + if (ptr == 0) { + return; + } + + pool_obj = (__mem_pool_obj*)pool; + size = __msize_inline(ptr); + + if (size <= 68) { + deallocate_from_fixed_pools(pool_obj, ptr, size); + } else { + deallocate_from_var_pools(pool_obj, ptr); + } +} + +void free(void* ptr) { + //__pool_free(get_malloc_pool(), ptr); + + __mem_pool_obj* pool_obj; + unsigned long size; + + if (ptr == 0) { + return; + } + + pool_obj = (__mem_pool_obj*)get_malloc_pool(); + size = __msize_inline(ptr); + + if (size <= 68) { + deallocate_from_fixed_pools(pool_obj, ptr, size); + } else { + deallocate_from_var_pools(pool_obj, ptr); + } +} diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/ansi_files.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/ansi_files.c new file mode 100644 index 000000000..4ed4f8098 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/ansi_files.c @@ -0,0 +1,149 @@ +#include "ansi_files.h" +#include "file_io.h" +#include "critical_regions.h" + +static unsigned char stdin_buff[0x100]; + +static unsigned char stdout_buff[0x100]; + +static unsigned char stderr_buff[0x100]; + +extern files __files = { + { + 0, + 0, + 1, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + {0, 0}, + {0, 0}, + 0, + stdin_buff, + 0x00000100, + stdin_buff, + 0, + 0, + 0, + 0, + NULL, + __read_console, + __write_console, + __close_console, + NULL, + &__files._stdout, + }, + { + 1, + 0, + 2, + 1, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + {0, 0}, + {0, 0}, + 0, + stdout_buff, + 0x00000100, + stdout_buff, + 0, + 0, + 0, + 0, + NULL, + __read_console, + __write_console, + __close_console, + NULL, + &__files._stderr, + }, + { + 2, + 0, + 2, + 0, + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + {0, 0}, + {0, 0}, + 0, + stderr_buff, + 0x00000100, + stderr_buff, + 0, + 0, + 0, + 0, + NULL, + __read_console, + __write_console, + __close_console, + NULL, + &__files.empty, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0}, + {0, 0}, 0, NULL, 0x00000000, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, + }, +}; + +void __close_all(void) { + FILE* file = &__files._stdin; + FILE* last_file; + + while (file != NULL) { + if (file->file_mode.file_kind != __closed_file) { + fclose(file); + } + + last_file = file; + file = file->next_file; + + if (last_file->is_dynamically_allocated) { + free(last_file); + } else { + last_file->file_mode.file_kind = __unavailable_file; + if (file != NULL && file->is_dynamically_allocated) { + last_file->next_file = NULL; + } + } + } +} + +unsigned int __flush_all(void) { + unsigned int ret = 0; + FILE* file = &__files._stdin; + + while (file) { + if (file->file_mode.file_kind != __closed_file && fflush(file)) { + ret = -1; + } + file = file->next_file; + } + + return ret; +} diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/arith.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/arith.c new file mode 100644 index 000000000..7b79f0d12 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/arith.c @@ -0,0 +1,35 @@ +#include "arith.h" + +int abs(int n) { + if (n < 0) + return (-n); + else + return (n); +} + +long labs(long x) { + if (x < 0) + return -x; + else + return x; +} + +div_t div(int numerator, int denominator) { + div_t ret; + int i = 1; + int j = 1; + + if (numerator < 0 ) { + numerator = -numerator; + i = -1; + } + + if (denominator < 0) { + denominator = -denominator; + j = -1; + } + + ret.quot = (numerator / denominator) * (i * j); + ret.rem = numerator * i - j * (ret.quot * denominator); + return ret; +} diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/buffer_io.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/buffer_io.c new file mode 100644 index 000000000..2f3599a0c --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/buffer_io.c @@ -0,0 +1,41 @@ +#include "buffer_io.h" + +inline void __convert_from_newlines(unsigned char* buf, size_t* n) {} + +inline void __convert_to_newlines(unsigned char* buf, size_t* n) {} + +void __prep_buffer(FILE* file) { + file->buffer_ptr = file->buffer; + file->buffer_length = file->buffer_size; + file->buffer_length -= file->position & file->buffer_alignment; + file->buffer_position = file->position; +} + +int __flush_buffer(FILE* file, size_t* bytes_flushed) { + size_t buffer_len; + int ioresult; + + buffer_len = file->buffer_ptr - file->buffer; + + if (buffer_len) { + file->buffer_length = buffer_len; + + if (!file->file_mode.binary_io) + __convert_from_newlines(file->buffer, (size_t*)&file->buffer_length); + + ioresult = (*file->write_fn)(file->handle, file->buffer, (size_t*)&file->buffer_length, + file->idle_fn); + + if (bytes_flushed) + *bytes_flushed = file->buffer_length; + + if (ioresult) + return (ioresult); + + file->position += file->buffer_length; + } + + __prep_buffer(file); + + return 0; +} diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/ctype.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/ctype.c new file mode 100644 index 000000000..a4851f08c --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/ctype.c @@ -0,0 +1,78 @@ +#include "ctype.h" + +#define ctrl __control_char +#define motn __motion_char +#define spac __space_char +#define punc __punctuation +#define digi __digit +#define hexd __hex_digit +#define lowc __lower_case +#define uppc __upper_case +#define dhex (hexd | digi) +#define uhex (hexd | uppc) +#define lhex (hexd | lowc) + +unsigned char __ctype_map[256] = { + // clang-format off + ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, motn, motn, motn, motn, motn, ctrl, ctrl, + ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, ctrl, + spac, punc, punc, punc, punc, punc, punc, punc, punc, punc, punc, punc, punc, punc, punc, punc, + dhex, dhex, dhex, dhex, dhex, dhex, dhex, dhex, dhex, dhex, punc, punc, punc, punc, punc, punc, + punc, uhex, uhex, uhex, uhex, uhex, uhex, uppc, uppc, uppc, uppc, uppc, uppc, uppc, uppc, uppc, + uppc, uppc, uppc, uppc, uppc, uppc, uppc, uppc, uppc, uppc, uppc, punc, punc, punc, punc, punc, + punc, lhex, lhex, lhex, lhex, lhex, lhex, lowc, lowc, lowc, lowc, lowc, lowc, lowc, lowc, lowc, + lowc, lowc, lowc, lowc, lowc, lowc, lowc, lowc, lowc, lowc, lowc, punc, punc, punc, punc, ctrl, + // clang-format on +}; + +unsigned char __lower_map[256] = { + // clang-format off + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, + ' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '[', '\\', ']', '^', '_', + '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 0x7F, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, + 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, + 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, + 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, + 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, + // clang-format on +}; + +int tolower(int __c) { + { + if (__c == -1) { + return 0xffffffff; + } + + return (unsigned int)__lower_map[__c & 0xff]; + } +} + +/* ############################################################################################## */ +unsigned char __upper_map[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, + ' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~', 0x7F, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, + 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, + 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, + 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, + 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, + // clang-format on +}; diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/direct_io.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/direct_io.c new file mode 100644 index 000000000..773ed63e5 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/direct_io.c @@ -0,0 +1,117 @@ +#include "direct_io.h" +#include "critical_regions.h" +#include "misc_io.h" +#include "string.h" +#include "wchar_io.h" + +size_t fwrite(const void* buffer, size_t size, size_t count, FILE* stream) { + size_t retval; + retval = __fwrite(buffer, size, count, stream); + return (retval); +} + +size_t __fwrite(const void* buffer, size_t size, size_t count, FILE* stream) { + unsigned char* write_ptr; + size_t num_bytes, bytes_to_go, bytes_written; + int ioresult, always_buffer; + +#ifndef __NO_WIDE_CHAR + if (fwide(stream, 0) == 0) + fwide(stream, -1); +#endif + + bytes_to_go = size * count; + + if (!bytes_to_go || stream->file_state.error || stream->file_mode.file_kind == __closed_file) + return 0; + + if (stream->file_mode.file_kind == __console_file) + __stdio_atexit(); + + always_buffer = !stream->file_mode.binary_io || stream->file_mode.buffer_mode == _IOFBF || + stream->file_mode.buffer_mode == _IOLBF; + + if (stream->file_state.io_state == __neutral) { + if (stream->file_mode.io_mode & __write) { + if (stream->file_mode.io_mode & __append) { + if (fseek(stream, 0, SEEK_END)) + return 0; + } + stream->file_state.io_state = __writing; + + __prep_buffer(stream); + } + } + + if (stream->file_state.io_state != __writing) { + set_error(stream); + return 0; + } + + write_ptr = (unsigned char*)buffer; + bytes_written = 0; + + if (bytes_to_go && (stream->buffer_ptr != stream->buffer || always_buffer)) { + stream->buffer_length = stream->buffer_size - (stream->buffer_ptr - stream->buffer); + + do { + unsigned char* newline = NULL; + + num_bytes = stream->buffer_length; + + if (num_bytes > bytes_to_go) + num_bytes = bytes_to_go; + if (stream->file_mode.buffer_mode == _IOLBF && num_bytes) + if ((newline = (unsigned char*)__memrchr(write_ptr, '\n', num_bytes)) != NULL) + num_bytes = newline + 1 - write_ptr; + + if (num_bytes) { + memcpy(stream->buffer_ptr, write_ptr, num_bytes); + + write_ptr += num_bytes; + bytes_written += num_bytes; + bytes_to_go -= num_bytes; + + stream->buffer_ptr += num_bytes; + stream->buffer_length -= num_bytes; + } + if (!stream->buffer_length || newline != NULL || + (stream->file_mode.buffer_mode == _IONBF)) + { + ioresult = __flush_buffer(stream, NULL); + + if (ioresult) { + set_error(stream); + bytes_to_go = 0; + break; + } + } + } while (bytes_to_go && always_buffer); + } + + if (bytes_to_go && !always_buffer) { + unsigned char* save_buffer = stream->buffer; + size_t save_size = stream->buffer_size; + + stream->buffer = write_ptr; + stream->buffer_size = bytes_to_go; + stream->buffer_ptr = write_ptr + bytes_to_go; + + if (__flush_buffer(stream, &num_bytes) != __no_io_error) + set_error(stream); + + bytes_written += num_bytes; + + stream->buffer = save_buffer; + stream->buffer_size = save_size; + + __prep_buffer(stream); + + stream->buffer_length = 0; + } + + if (stream->file_mode.buffer_mode != _IOFBF) + stream->buffer_length = 0; + + return ((bytes_written + size - 1) / size); +} diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/errno.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/errno.c new file mode 100644 index 000000000..afee599b7 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/errno.c @@ -0,0 +1,3 @@ +#include "errno.h" + +int errno; diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/file_io.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/file_io.c new file mode 100644 index 000000000..02fe091ae --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/file_io.c @@ -0,0 +1,69 @@ +#include "file_io.h" +#include "buffer_io.h" +#include "ctype.h" + +int fclose(FILE* file) { + int flush_result, close_result; + + if (file == NULL) + return (-1); + if (file->file_mode.file_kind == __closed_file) + return (0); + + flush_result = fflush(file); + + close_result = (*file->close_fn)(file->handle); + + file->file_mode.file_kind = __closed_file; + file->handle = NULL; + + if (file->file_state.free_buffer) + free((FILE*)file->buffer); + return ((flush_result || close_result) ? -1 : 0); +} + +int fflush(FILE* file) { + int pos; + + if (file == NULL) { + return __flush_all(); + } + + if (file->file_state.error != 0 || file->file_mode.file_kind == __closed_file) { + return -1; + } + + if (file->file_mode.io_mode == __read) { + return 0; + } + + if (file->file_state.io_state >= __rereading) { + file->file_state.io_state = __reading; + } + + if (file->file_state.io_state == __reading) { + file->buffer_length = 0; + } + + if (file->file_state.io_state != __writing) { + file->file_state.io_state = __neutral; + return 0; + } + + if (file->file_mode.file_kind != __disk_file) { + pos = 0; + } else { + pos = ftell(file); + } + + if (__flush_buffer(file, 0) != 0) { + file->file_state.error = 1; + file->buffer_length = 0; + return -1; + } + + file->file_state.io_state = __neutral; + file->position = pos; + file->buffer_length = 0; + return 0; +} diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c new file mode 100644 index 000000000..4ae0f7c1a --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c @@ -0,0 +1,5 @@ +#include "float.h" + +unsigned long __float_nan[] = {0x7FFFFFFF}; + +unsigned long __float_huge[] = {0x7F800000}; diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mbstring.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mbstring.c new file mode 100644 index 000000000..4b7d2b965 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mbstring.c @@ -0,0 +1,64 @@ +#include "mbstring.h" +#include "string.h" + +static int unicode_to_UTF8(char* s, wchar_t wchar) { + int number_of_bytes; + wchar_t wide_char; + char* target_ptr; + char first_byte_mark[4] = { 0x00, 0x00, 0xc0, 0xe0 }; + + if (!s) + return (0); + + wide_char = wchar; + if (wide_char < 0x0080) + number_of_bytes = 1; + else if (wide_char < 0x0800) + number_of_bytes = 2; + else + number_of_bytes = 3; + + target_ptr = s + number_of_bytes; + + switch (number_of_bytes) { + case 3: + *--target_ptr = (wide_char & 0x003f) | 0x80; + wide_char >>= 6; + case 2: + *--target_ptr = (wide_char & 0x003f) | 0x80; + wide_char >>= 6; + case 1: + *--target_ptr = wide_char | first_byte_mark[number_of_bytes]; + } + + return number_of_bytes; +} + +inline int wctomb(char* s, wchar_t wchar) { return (unicode_to_UTF8(s, wchar)); } + +size_t wcstombs(char* s, const wchar_t* pwcs, size_t n) { + int chars_written = 0; + int result; + char temp[3]; + wchar_t* source; + + if (!s || !pwcs) + return (0); + + source = (wchar_t*)pwcs; + while (chars_written <= n) { + if (!*source) { + *(s + chars_written) = '\0'; + break; + } else { + result = wctomb(temp, *source++); + if ((chars_written + result) <= n) { + strncpy(s + chars_written, temp, result); + chars_written += result; + } else + break; + } + } + + return chars_written; +} diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mem.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mem.c new file mode 100644 index 000000000..267697817 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mem.c @@ -0,0 +1,81 @@ +#include "string.h" + +void* memmove(void* dst, const void* src, size_t n) { + unsigned char* csrc; + unsigned char* cdst; + + int reverse = (unsigned int)src < (unsigned int)dst; + + if (n >= 32) { + if (((unsigned int)dst ^ (unsigned int)src) & 3) { + if (!reverse) { + __copy_longs_unaligned(dst, src, n); + } else { + __copy_longs_rev_unaligned(dst, src, n); + } + } else { + if (!reverse) { + __copy_longs_aligned(dst, src, n); + } else { + __copy_longs_rev_aligned(dst, src, n); + } + } + + return dst; + } else { + if (!reverse) { + csrc = ((unsigned char*)src) - 1; + cdst = ((unsigned char*)dst) - 1; + n++; + + while (--n > 0) { + *++cdst = *++csrc; + } + } else { + csrc = (unsigned char*)src + n; + cdst = (unsigned char*)dst + n; + n++; + + while (--n > 0) { + *--cdst = *--csrc; + } + } + } + + return dst; +} + +void* memchr(const void* ptr, int ch, size_t count) { + const unsigned char* p; + + unsigned long v = (ch & 0xff); + + for (p = (unsigned char*)ptr - 1, count++; --count;) + if ((*++p & 0xff) == v) + return (void*)p; + + return NULL; +} + +void* __memrchr(const void* ptr, int ch, size_t count) { + const unsigned char* p; + + unsigned long v = (ch & 0xff); + + for (p = (unsigned char*)ptr + count, count++; --count;) + if (*--p == v) + return (void*)p; + + return NULL; +} + +int memcmp(const void* lhs, const void* rhs, size_t count) { + const unsigned char* p1; + const unsigned char* p2; + + for (p1 = (const unsigned char*)lhs - 1, p2 = (const unsigned char*)rhs - 1, count++; --count;) + if (*++p1 != *++p2) + return ((*p1 < *p2) ? -1 : +1); + + return 0; +} diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mem_funcs.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mem_funcs.c new file mode 100644 index 000000000..f06bc3c30 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/mem_funcs.c @@ -0,0 +1,217 @@ +#include "mem_funcs.h" + +#define cps ((unsigned char*)src) +#define cpd ((unsigned char*)dst) +#define lps ((unsigned long*)src) +#define lpd ((unsigned long*)dst) +#define deref_auto_inc(p) *++(p) + +void __copy_longs_aligned(void* dst, const void* src, size_t n) { + unsigned long i; + + i = (-(unsigned long)dst) & 3; + + cps = ((unsigned char*)src) - 1; + cpd = ((unsigned char*)dst) - 1; + + if (i) { + n -= i; + + do + deref_auto_inc(cpd) = deref_auto_inc(cps); + while (--i); + } + + lps = ((unsigned long*)(cps + 1)) - 1; + lpd = ((unsigned long*)(cpd + 1)) - 1; + + i = n >> 5; + + if (i) + do { + deref_auto_inc(lpd) = deref_auto_inc(lps); + deref_auto_inc(lpd) = deref_auto_inc(lps); + deref_auto_inc(lpd) = deref_auto_inc(lps); + deref_auto_inc(lpd) = deref_auto_inc(lps); + deref_auto_inc(lpd) = deref_auto_inc(lps); + deref_auto_inc(lpd) = deref_auto_inc(lps); + deref_auto_inc(lpd) = deref_auto_inc(lps); + deref_auto_inc(lpd) = deref_auto_inc(lps); + } while (--i); + + i = (n & 31) >> 2; + + if (i) + do + deref_auto_inc(lpd) = deref_auto_inc(lps); + while (--i); + + cps = ((unsigned char*)(lps + 1)) - 1; + cpd = ((unsigned char*)(lpd + 1)) - 1; + + n &= 3; + + if (n) + do + deref_auto_inc(cpd) = deref_auto_inc(cps); + while (--n); + + return; +} + +void __copy_longs_rev_aligned(void* dst, const void* src, size_t n) { + unsigned long i; + + cps = ((unsigned char*)src) + n; + cpd = ((unsigned char*)dst) + n; + + i = ((unsigned long)cpd) & 3; + + if (i) { + n -= i; + + do + *--cpd = *--cps; + while (--i); + } + + i = n >> 5; + + if (i) + do { + *--lpd = *--lps; + *--lpd = *--lps; + *--lpd = *--lps; + *--lpd = *--lps; + *--lpd = *--lps; + *--lpd = *--lps; + *--lpd = *--lps; + *--lpd = *--lps; + } while (--i); + + i = (n & 31) >> 2; + + if (i) + do + *--lpd = *--lps; + while (--i); + + n &= 3; + + if (n) + do + *--cpd = *--cps; + while (--n); + + return; +} + +void __copy_longs_unaligned(void* dst, const void* src, size_t n) { + unsigned long i, v1, v2; + unsigned int src_offset, left_shift, right_shift; + + i = (-(unsigned long)dst) & 3; + + cps = ((unsigned char*)src) - 1; + cpd = ((unsigned char*)dst) - 1; + + if (i) { + n -= i; + + do + deref_auto_inc(cpd) = deref_auto_inc(cps); + while (--i); + } + + src_offset = ((unsigned int)(cps + 1)) & 3; + + left_shift = src_offset << 3; + right_shift = 32 - left_shift; + + cps -= src_offset; + + lps = ((unsigned long*)(cps + 1)) - 1; + lpd = ((unsigned long*)(cpd + 1)) - 1; + + i = n >> 3; + + v1 = deref_auto_inc(lps); + + do { + v2 = deref_auto_inc(lps); + deref_auto_inc(lpd) = (v1 << left_shift) | (v2 >> right_shift); + v1 = deref_auto_inc(lps); + deref_auto_inc(lpd) = (v2 << left_shift) | (v1 >> right_shift); + } while (--i); + + if (n & 4) { + v2 = deref_auto_inc(lps); + deref_auto_inc(lpd) = (v1 << left_shift) | (v2 >> right_shift); + } + + cps = ((unsigned char*)(lps + 1)) - 1; + cpd = ((unsigned char*)(lpd + 1)) - 1; + + n &= 3; + + if (n) { + cps -= 4 - src_offset; + do + deref_auto_inc(cpd) = deref_auto_inc(cps); + while (--n); + } + + return; +} + +void __copy_longs_rev_unaligned(void* dst, const void* src, size_t n) { + unsigned long i, v1, v2; + unsigned int src_offset, left_shift, right_shift; + + cps = ((unsigned char*)src) + n; + cpd = ((unsigned char*)dst) + n; + + i = ((unsigned long)cpd) & 3; + + if (i) { + n -= i; + + do + *--cpd = *--cps; + while (--i); + } + + src_offset = ((unsigned int)cps) & 3; + + left_shift = src_offset << 3; + right_shift = 32 - left_shift; + + cps += 4 - src_offset; + + i = n >> 3; + + v1 = *--lps; + + do { + v2 = *--lps; + *--lpd = (v2 << left_shift) | (v1 >> right_shift); + v1 = *--lps; + *--lpd = (v1 << left_shift) | (v2 >> right_shift); + } while (--i); + + if (n & 4) { + v2 = *--lps; + *--lpd = (v2 << left_shift) | (v1 >> right_shift); + } + + n &= 3; + + if (n) { + cps += src_offset; + do + *--cpd = *--cps; + while (--n); + } + + return; +} diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/misc_io.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/misc_io.c new file mode 100644 index 000000000..61bc21251 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/misc_io.c @@ -0,0 +1,7 @@ +#include "misc_io.h" +#include "abort_exit.h" +#include "ansi_files.h" + +void __stdio_atexit(void) { + __stdio_exit = __close_all; +} diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/printf.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/printf.c new file mode 100644 index 000000000..128eaed85 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/printf.c @@ -0,0 +1,1232 @@ +#include "printf.h" +#include "ansi_fp.h" +#include "critical_regions.h" +#include "ctype.h" +#include "string.h" +#include "scanf.h" +#include "stdio.h" +#include "stdlib.h" +#include "string.h" +#include "wchar_io.h" + +#define TARGET_FLOAT_BITS 64 +#define TARGET_FLOAT_BYTES (TARGET_FLOAT_BITS / 8) +#define TARGET_FLOAT_MAX_EXP LDBL_MAX_EXP +#define TARGET_FLOAT_MANT_DIG LDBL_MANT_DIG +#define TARGET_FLOAT_IMPLICIT_J_BIT 1 +#define TARGET_FLOAT_MANT_BITS (TARGET_FLOAT_MANT_DIG - TARGET_FLOAT_IMPLICIT_J_BIT) +#define TARGET_FLOAT_EXP_BITS (TARGET_FLOAT_BITS - TARGET_FLOAT_MANT_BITS - 1) + +#define PTRDIFF __typeof__((char*)0 - (char*)0) +typedef PTRDIFF ptrdiff_t; + +enum justification_options { left_justification, right_justification, zero_fill }; + +enum sign_options { only_minus, sign_always, space_holder }; + +enum argument_options { + normal_argument, + char_argument, + short_argument, + long_argument, + long_long_argument, + long_double_argument, + wchar_argument +}; + +typedef struct { + unsigned char justification_options; + unsigned char sign_options; + unsigned char precision_specified; + unsigned char alternate_form; + unsigned char argument_options; + unsigned char conversion_char; + int field_width; + int precision; +} print_format; + +static const char* parse_format(const char* format_string, va_list* arg, print_format* format) { + print_format f; + const char* s = format_string; + int c; + int flag_found; + f.justification_options = right_justification; + f.sign_options = only_minus; + f.precision_specified = 0; + f.alternate_form = 0; + f.argument_options = normal_argument; + f.field_width = 0; + f.precision = 0; + + if ((c = *++s) == '%') { + f.conversion_char = c; + *format = f; + return ((const char*)s + 1); + } + + for (;;) { + flag_found = 1; + + switch (c) { + case '-': + f.justification_options = left_justification; + break; + case '+': + f.sign_options = sign_always; + break; + case ' ': + if (f.sign_options != sign_always) { + f.sign_options = space_holder; + } + break; + case '#': + f.alternate_form = 1; + break; + case '0': + if (f.justification_options != left_justification) { + f.justification_options = zero_fill; + } + break; + default: + flag_found = 0; + break; + } + + if (flag_found) { + c = *++s; + } else { + break; + } + } + + if (c == '*') { + if ((f.field_width = va_arg(*arg, int)) < 0) { + f.justification_options = left_justification; + f.field_width = -f.field_width; + } + + c = *++s; + } else { + while (isdigit(c)) { + f.field_width = (f.field_width * 10) + (c - '0'); + c = *++s; + } + } + + if (f.field_width > 509) { + f.conversion_char = 0xFF; + *format = f; + return ((const char*)s + 1); + } + + if (c == '.') { + f.precision_specified = 1; + + if ((c = *++s) == '*') { + if ((f.precision = va_arg(*arg, int)) < 0) { + f.precision_specified = 0; + } + + c = *++s; + } else { + while (isdigit(c)) { + f.precision = (f.precision * 10) + (c - '0'); + c = *++s; + } + } + } + + flag_found = 1; + + switch (c) { + case 'h': + f.argument_options = short_argument; + + if (s[1] == 'h') { + f.argument_options = char_argument; + c = *++s; + } + + break; + + case 'l': + f.argument_options = long_argument; + + if (s[1] == 'l') { + f.argument_options = long_long_argument; + c = *++s; + } + + break; + + case 'L': + f.argument_options = long_double_argument; + break; + default: + flag_found = 0; + break; + } + + if (flag_found) { + c = *++s; + } + + f.conversion_char = c; + + switch (c) { + case 'd': + case 'i': + case 'u': + case 'o': + case 'x': + case 'X': + if (f.argument_options == long_double_argument) { + f.conversion_char = 0xFF; + break; + } + + if (!f.precision_specified) { + f.precision = 1; + } else if (f.justification_options == zero_fill) { + f.justification_options = right_justification; + } + break; + + case 'f': + case 'F': + if (f.argument_options == short_argument || f.argument_options == long_long_argument) { + f.conversion_char = 0xFF; + break; + } + + if (!f.precision_specified) { + f.precision = 6; + } + break; + + case 'a': + case 'A': + if (!f.precision_specified) { + f.precision = 0xD; + } + + if (f.argument_options == short_argument || f.argument_options == long_long_argument || + f.argument_options == char_argument) + { + f.conversion_char = 0xFF; + } + + break; + + case 'g': + case 'G': + if (!f.precision) { + f.precision = 1; + } + + case 'e': + case 'E': + if (f.argument_options == short_argument || f.argument_options == long_long_argument || + f.argument_options == char_argument) + { + f.conversion_char = 0xFF; + break; + } + + if (!f.precision_specified) { + f.precision = 6; + } + break; + + case 'p': + f.conversion_char = 'x'; + f.alternate_form = 1; + f.argument_options = long_argument; + f.precision = 8; + break; + + case 'c': + if (f.argument_options == long_argument) { + f.argument_options = wchar_argument; + } else { + if (f.precision_specified || f.argument_options != normal_argument) { + f.conversion_char = 0xFF; + } + } + + break; + + case 's': + if (f.argument_options == long_argument) { + f.argument_options = wchar_argument; + } else { + if (f.argument_options != normal_argument) { + f.conversion_char = 0xFF; + } + } + + break; + + case 'n': + if (f.argument_options == long_double_argument) { + f.conversion_char = 0xFF; + } + + break; + + default: + f.conversion_char = 0xFF; + break; + } + + *format = f; + return ((const char*)s + 1); +} + +static char* long2str(signed long num, char* buff, print_format format) { + unsigned long unsigned_num, base; + char* p; + int n, digits; + int minus = 0; + unsigned_num = num; + minus = 0; + + p = buff; + *--p = 0; + digits = 0; + + if (!num && !format.precision && !(format.alternate_form && format.conversion_char == 'o')) { + return p; + } + + switch (format.conversion_char) { + case 'd': + case 'i': + base = 10; + + if (num < 0) { + unsigned_num = -unsigned_num; + minus = 1; + } + break; + + case 'o': + base = 8; + format.sign_options = only_minus; + break; + + case 'u': + base = 10; + format.sign_options = only_minus; + break; + + case 'x': + case 'X': + base = 16; + format.sign_options = only_minus; + break; + } + + do { + n = unsigned_num % base; + unsigned_num /= base; + + if (n < 10) { + n += '0'; + } else { + n -= 10; + + if (format.conversion_char == 'x') { + n += 'a'; + } else { + n += 'A'; + } + } + + *--p = n; + ++digits; + } while (unsigned_num != 0); + + if (base == 8 && format.alternate_form && *p != '0') { + *--p = '0'; + ++digits; + } + + if (format.justification_options == zero_fill) { + format.precision = format.field_width; + + if (minus || format.sign_options != only_minus) + --format.precision; + + if (base == 16 && format.alternate_form) + format.precision -= 2; + } + + if (buff - p + format.precision > 509) + return (0); + + while (digits < format.precision) { + *--p = '0'; + ++digits; + } + + if (base == 16 && format.alternate_form) { + *--p = format.conversion_char; + *--p = '0'; + } + + if (minus) { + *--p = '-'; + } else if (format.sign_options == sign_always) { + *--p = '+'; + } else if (format.sign_options == space_holder) { + *--p = ' '; + } + + return p; +} + +static char* longlong2str(signed long long num, char* pBuf, print_format fmt) { + unsigned long long unsigned_num, base; + char* p; + int n, digits; + int minus = 0; + unsigned_num = num; + minus = 0; + p = pBuf; + *--p = 0; + digits = 0; + + if (!num && !fmt.precision && !(fmt.alternate_form && fmt.conversion_char == 'o')) { + return p; + } + + switch (fmt.conversion_char) { + case 'd': + case 'i': + base = 10; + + if (num < 0) { + unsigned_num = -unsigned_num; + minus = 1; + } + break; + case 'o': + base = 8; + fmt.sign_options = only_minus; + break; + case 'u': + base = 10; + fmt.sign_options = only_minus; + break; + case 'x': + case 'X': + base = 16; + fmt.sign_options = only_minus; + break; + } + + do { + n = unsigned_num % base; + unsigned_num /= base; + + if (n < 10) { + n += '0'; + } else { + n -= 10; + if (fmt.conversion_char == 'x') { + n += 'a'; + } else { + n += 'A'; + } + } + + *--p = n; + ++digits; + } while (unsigned_num != 0); + + if (base == 8 && fmt.alternate_form && *p != '0') { + *--p = '0'; + ++digits; + } + + if (fmt.justification_options == zero_fill) { + fmt.precision = fmt.field_width; + + if (minus || fmt.sign_options != only_minus) { + --fmt.precision; + } + + if (base == 16 && fmt.alternate_form) { + fmt.precision -= 2; + } + } + + if (pBuf - p + fmt.precision > 509) { + return 0; + } + + while (digits < fmt.precision) { + *--p = '0'; + ++digits; + } + + if (base == 16 && fmt.alternate_form) { + *--p = fmt.conversion_char; + *--p = '0'; + } + + if (minus) { + *--p = '-'; + } else if (fmt.sign_options == sign_always) { + *--p = '+'; + } else if (fmt.sign_options == space_holder) { + *--p = ' '; + } + + return p; +} + +static char* double2hex(long double num, char* buff, print_format format) { + int offset, what_nibble = 0; + char* wrk_byte_ptr; + char *p, *q; + char working_byte; + long double ld; + signed short* sptr; + signed short snum; + signed long exp; + print_format exp_format; + int hex_precision; + decform form; + decimal dec; + + p = buff; + ld = num; + sptr = (signed short*)&ld; + + if (format.precision > 509) { + return 0; + } + + form.style = (char)0; + form.digits = 0x20; + __num2dec(&form, num, &dec); + + if (*dec.sig.text == 'I') { + if (*sptr & 0x8000) { + p = buff - 5; + if (format.conversion_char == 'A') + strcpy(p, "-INF"); + else + strcpy(p, "-inf"); + } else { + p = buff - 4; + if (format.conversion_char == 'A') + strcpy(p, "INF"); + else + strcpy(p, "inf"); + } + + return p; + } else if (*dec.sig.text == 'N') { + if (*(char*)&num & 0x80) { + p = buff - 5; + if (format.conversion_char == 'A') + strcpy(p, "-NAN"); + else + strcpy(p, "-nan"); + } else { + p = buff - 4; + if (format.conversion_char == 'A') + strcpy(p, "NAN"); + else + strcpy(p, "nan"); + } + + return p; + } + + exp_format.justification_options = right_justification; + exp_format.sign_options = sign_always; + exp_format.precision_specified = 0; + exp_format.alternate_form = 0; + exp_format.argument_options = normal_argument; + exp_format.field_width = 0; + exp_format.precision = 1; + exp_format.conversion_char = 'd'; + + snum = (*sptr & 0x7ff0) >> 4; + + exp = snum - 0x3FF; + + p = long2str(exp, buff, exp_format); + if (format.conversion_char == 'a') + *--p = 'p'; + else + *--p = 'P'; + + q = (char*)# + + for (hex_precision = format.precision; hex_precision >= 1; hex_precision--) { + working_byte = *(q + (hex_precision / 2) + 1); + if (hex_precision % 2) + working_byte = working_byte & 0x0f; + else + working_byte = (working_byte >> 4) & 0x0f; + + if (working_byte < 10) { + working_byte += '0'; + } else { + working_byte -= 10; + + if (format.conversion_char == 'a') { + working_byte += 'a'; + } else { + working_byte += 'A'; + } + } + + *--p = working_byte; + } + + if (format.precision || format.alternate_form) { + *--p = '.'; + } + + *--p = '1'; + + if (format.conversion_char == 'a') { + *--p = 'x'; + } else { + *--p = 'X'; + } + + *--p = '0'; + + if (*sptr & 0x8000) { + *--p = '-'; + } else if (format.sign_options == sign_always) { + *--p = '+'; + } else if (format.sign_options == space_holder) { + *--p = ' '; + } + + return p; +} + +static void round_decimal(decimal* dec, int new_length) { + char c; + char* p; + int carry; + + if (new_length < 0) { + return_zero: + dec->exp = 0; + dec->sig.length = 1; + *dec->sig.text = '0'; + return; + } + + if (new_length >= dec->sig.length) { + return; + } + + p = (char*)dec->sig.text + new_length + 1; + c = *--p - '0'; + + if (c == 5) { + char* q = &((char*)dec->sig.text)[dec->sig.length]; + + while (--q > p && *q == '0') + ; + carry = (q == p) ? p[-1] & 1 : 1; + } else { + carry = (c > 5); + } + + while (new_length != 0) { + c = *--p - '0' + carry; + + if ((carry = (c > 9)) != 0 || c == 0) { + --new_length; + } else { + *p = c + '0'; + break; + } + } + + if (carry != 0) { + dec->exp += 1; + dec->sig.length = 1; + *dec->sig.text = '1'; + return; + } else if (new_length == 0) { + goto return_zero; + } + + dec->sig.length = new_length; +} + +static char* float2str(long double num, char* buff, print_format format) { + decimal dec; + decform form; + char* p; + char* q; + int n, digits, sign; + int int_digits, frac_digits; + int radix_marker; + + radix_marker = '.'; + + if (format.precision > 509) { + return 0; + } + + form.style = 0; + form.digits = 0x20; + __num2dec(&form, num, &dec); + p = (char*)dec.sig.text + dec.sig.length; + + while (dec.sig.length > 1 && *--p == '0') { + --dec.sig.length; + ++dec.exp; + } + + switch (*dec.sig.text) { + case '0': + dec.exp = 0; + break; + case 'I': + if (num < 0) { + p = buff - 5; + + if (isupper(format.conversion_char)) { + strcpy(p, "-INF"); + } else { + strcpy(p, "-inf"); + } + } else { + p = buff - 4; + if (isupper(format.conversion_char)) { + strcpy(p, "INF"); + } else { + strcpy(p, "inf"); + } + } + + return p; + + case 'N': + if (dec.sign) { + p = buff - 5; + + if (isupper(format.conversion_char)) { + strcpy(p, "-NAN"); + } else { + strcpy(p, "-nan"); + } + } else { + p = buff - 4; + if (isupper(format.conversion_char)) { + strcpy(p, "NAN"); + } else { + strcpy(p, "nan"); + } + } + + return p; + } + + dec.exp += dec.sig.length - 1; + p = buff; + *--p = 0; + + switch (format.conversion_char) { + case 'g': + case 'G': + + if (dec.sig.length > format.precision) { + round_decimal(&dec, format.precision); + } + + if (dec.exp < -4 || dec.exp >= format.precision) { + if (format.alternate_form) { + --format.precision; + } else { + format.precision = dec.sig.length - 1; + } + + if (format.conversion_char == 'g') { + format.conversion_char = 'e'; + } else { + format.conversion_char = 'E'; + } + + goto e_format; + } + + if (format.alternate_form) { + format.precision -= dec.exp + 1; + } else { + if ((format.precision = dec.sig.length - (dec.exp + 1)) < 0) { + format.precision = 0; + } + } + + goto f_format; + + case 'e': + case 'E': + e_format: + + if (dec.sig.length > format.precision + 1) { + round_decimal(&dec, format.precision + 1); + } + + n = dec.exp; + sign = '+'; + + if (n < 0) { + n = -n; + sign = '-'; + } + + for (digits = 0; n || digits < 2; ++digits) { + *--p = n % 10 + '0'; + n /= 10; + } + + *--p = sign; + *--p = format.conversion_char; + + if (buff - p + format.precision > 509) { + return 0; + } + + if (dec.sig.length < format.precision + 1) { + for (n = format.precision + 1 - dec.sig.length + 1; --n;) { + *--p = '0'; + } + } + + for (n = dec.sig.length, q = (char*)dec.sig.text + dec.sig.length; --n;) { + *--p = *--q; + } + + if (format.precision || format.alternate_form) { + *--p = radix_marker; + } + + *--p = *dec.sig.text; + + if (dec.sign) + *--p = '-'; + else if (format.sign_options == sign_always) + *--p = '+'; + else if (format.sign_options == space_holder) + *--p = ' '; + + break; + + case 'f': + case 'F': + f_format: + + if ((frac_digits = -dec.exp + dec.sig.length - 1) < 0) + frac_digits = 0; + + if (frac_digits > format.precision) { + round_decimal(&dec, dec.sig.length - (frac_digits - format.precision)); + + if ((frac_digits = -dec.exp + dec.sig.length - 1) < 0) + frac_digits = 0; + } + + if ((int_digits = dec.exp + 1) < 0) + int_digits = 0; + + if (int_digits + frac_digits > 509) + return 0; + + q = (char*)dec.sig.text + dec.sig.length; + + for (digits = 0; digits < (format.precision - frac_digits); ++digits) + *--p = '0'; + + for (digits = 0; digits < frac_digits && digits < dec.sig.length; ++digits) + *--p = *--q; + + for (; digits < frac_digits; ++digits) + *--p = '0'; + + if (format.precision || format.alternate_form) + *--p = radix_marker; + + if (int_digits) { + for (digits = 0; digits < int_digits - dec.sig.length; ++digits) { + *--p = '0'; + } + + for (; digits < int_digits; ++digits) { + *--p = *--q; + } + } else { + *--p = '0'; + } + + if (dec.sign) { + *--p = '-'; + } else if (format.sign_options == sign_always) { + *--p = '+'; + } else if (format.sign_options == space_holder) { + *--p = ' '; + } + + break; + } + + return p; +} + +static int __pformatter(void* (*WriteProc)(void*, const char*, size_t), void* WriteProcArg, + const char* format_str, va_list arg) { + int num_chars, chars_written, field_width; + const char* format_ptr; + const char* curr_format; + print_format format; + signed long long_num; + signed long long long_long_num; + long double long_double_num; + char buff[512]; + char* buff_ptr; + char* string_end; + char fill_char = ' '; + + format_ptr = format_str; + chars_written = 0; + + while (*format_ptr) { + if (!(curr_format = strchr(format_ptr, '%'))) { + num_chars = strlen(format_ptr); + chars_written += num_chars; + + if (num_chars && !(*WriteProc)(WriteProcArg, format_ptr, num_chars)) { + return -1; + } + + break; + } + + num_chars = curr_format - format_ptr; + chars_written += num_chars; + + if (num_chars && !(*WriteProc)(WriteProcArg, format_ptr, num_chars)) { + return -1; + } + + format_ptr = curr_format; + format_ptr = parse_format(format_ptr, (va_list*)arg, &format); + + switch (format.conversion_char) { + case 'd': + case 'i': + if (format.argument_options == long_argument) { + long_num = va_arg(arg, signed long); + } else if (format.argument_options == long_long_argument) { + long_long_num = va_arg(arg, signed long long); + } else { + long_num = va_arg(arg, int); + } + + if (format.argument_options == short_argument) { + long_num = (signed short)long_num; + } + + if (format.argument_options == char_argument) { + long_num = (signed char)long_num; + } + + if ((format.argument_options == long_long_argument)) { + if (!(buff_ptr = longlong2str(long_long_num, buff + 512, format))) { + goto conversion_error; + } + } else { + if (!(buff_ptr = long2str(long_num, buff + 512, format))) { + goto conversion_error; + } + } + + num_chars = buff + 512 - 1 - buff_ptr; + break; + + case 'o': + case 'u': + case 'x': + case 'X': + if (format.argument_options == long_argument) { + long_num = va_arg(arg, unsigned long); + } else if (format.argument_options == long_long_argument) { + long_long_num = va_arg(arg, signed long long); + } else { + long_num = va_arg(arg, unsigned int); + } + + if (format.argument_options == short_argument) { + long_num = (unsigned short)long_num; + } + + if (format.argument_options == char_argument) { + long_num = (unsigned char)long_num; + } + + if ((format.argument_options == long_long_argument)) { + if (!(buff_ptr = longlong2str(long_long_num, buff + 512, format))) { + goto conversion_error; + } + } else { + if (!(buff_ptr = long2str(long_num, buff + 512, format))) { + goto conversion_error; + } + } + + num_chars = buff + 512 - 1 - buff_ptr; + break; + + case 'f': + case 'F': + case 'e': + case 'E': + case 'g': + case 'G': + if (format.argument_options == long_double_argument) { + long_double_num = va_arg(arg, long double); + } else { + long_double_num = va_arg(arg, f64); + } + + if (!(buff_ptr = float2str(long_double_num, buff + 512, format))) { + goto conversion_error; + } + + num_chars = buff + 512 - 1 - buff_ptr; + break; + + case 'a': + case 'A': + if (format.argument_options == long_double_argument) { + long_double_num = va_arg(arg, long double); + } else { + long_double_num = va_arg(arg, f64); + } + + if (!(buff_ptr = double2hex(long_double_num, buff + 512, format))) { + goto conversion_error; + } + + num_chars = buff + 512 - 1 - buff_ptr; + break; + + case 's': + if (format.argument_options == wchar_argument) { + wchar_t* wcs_ptr = va_arg(arg, wchar_t*); + + if (wcs_ptr == NULL) { + wcs_ptr = L""; + } + + if ((num_chars = wcstombs(buff, wcs_ptr, sizeof(buff))) < 0) { + goto conversion_error; + } + + buff_ptr = &buff[0]; + } else { + buff_ptr = va_arg(arg, char*); + } + + if (buff_ptr == NULL) { + buff_ptr = ""; + } + + if (format.alternate_form) { + num_chars = (unsigned char)*buff_ptr++; + + if (format.precision_specified && num_chars > format.precision) { + num_chars = format.precision; + } + } else if (format.precision_specified) { + num_chars = format.precision; + + if ((string_end = (char*)memchr((unsigned char*)buff_ptr, 0, num_chars)) != 0) { + num_chars = string_end - buff_ptr; + } + } else { + num_chars = strlen(buff_ptr); + } + + break; + + case 'n': + buff_ptr = va_arg(arg, char*); + + switch (format.argument_options) { + case normal_argument: + *(int*)buff_ptr = chars_written; + break; + case short_argument: + *(signed short*)buff_ptr = chars_written; + break; + case long_argument: + *(signed long*)buff_ptr = chars_written; + break; + case long_long_argument: + *(signed long long*)buff_ptr = chars_written; + break; + } + + continue; + + case 'c': + buff_ptr = buff; + *buff_ptr = va_arg(arg, int); + num_chars = 1; + break; + + case '%': + buff_ptr = buff; + *buff_ptr = '%'; + num_chars = 1; + break; + + case 0xFF: + default: + conversion_error: + num_chars = strlen(curr_format); + chars_written += num_chars; + + if (num_chars && !(*WriteProc)(WriteProcArg, curr_format, num_chars)) { + return -1; + } + + return chars_written; + break; + } + + field_width = num_chars; + + if (format.justification_options != left_justification) { + fill_char = (format.justification_options == zero_fill) ? '0' : ' '; + + if (((*buff_ptr == '+') || (*buff_ptr == '-') || (*buff_ptr == ' ')) && + (fill_char == '0')) + { + if ((*WriteProc)(WriteProcArg, buff_ptr, 1) == 0) { + return -1; + } + + ++buff_ptr; + num_chars--; + } + + while (field_width < format.field_width) { + if ((*WriteProc)(WriteProcArg, &fill_char, 1) == 0) { + return -1; + } + + ++field_width; + } + } + + if (num_chars && !(*WriteProc)(WriteProcArg, buff_ptr, num_chars)) { + return -1; + } + + if (format.justification_options == left_justification) { + while (field_width < format.field_width) { + char blank = ' '; + + if ((*WriteProc)(WriteProcArg, &blank, 1) == 0) { + return -1; + } + + ++field_width; + } + } + + chars_written += field_width; + } + + return chars_written; +} + +static void* __FileWrite(void* pFile, const char* pBuffer, size_t char_num) { + return (fwrite(pBuffer, 1, char_num, (FILE*)pFile) == char_num ? pFile : 0); +} + +static void* __StringWrite(void* pCtrl, const char* pBuffer, size_t char_num) { + size_t chars; + __OutStrCtrl* ctrl = (__OutStrCtrl*)pCtrl; + void* res; + + chars = ((ctrl->CharsWritten + char_num) <= ctrl->MaxCharCount) ? + char_num : + ctrl->MaxCharCount - ctrl->CharsWritten; + res = memcpy(ctrl->CharStr + ctrl->CharsWritten, pBuffer, chars); + ctrl->CharsWritten += chars; + return (void*)1; +} + +int printf(const char* format, ...) { + int res; + + if (fwide(stdout, -1) >= 0) { + return -1; + } + + { + va_list args; + va_start(args, format); + res = __pformatter(&__FileWrite, (void*)stdout, format, args); + } + + return res; +} + +int vprintf(const char* format, va_list arg) { + int ret; + + if (fwide(stdout, -1) >= 0) { + return -1; + } + + ret = __pformatter(&__FileWrite, (void*)stdout, format, arg); + return ret; +} + +int vsnprintf(char* s, size_t n, const char* format, va_list arg) { + int end; + __OutStrCtrl osc; + osc.CharStr = s; + osc.MaxCharCount = n; + osc.CharsWritten = 0; + + end = __pformatter(&__StringWrite, &osc, format, arg); + + if (s) { + s[(end < n) ? end : n - 1] = '\0'; + } + + return end; +} + +int snprintf(char* s, size_t n, const char* format, ...) { + va_list args; + va_start(args, format); + return vsnprintf(s, n, format, args); +} + +int sprintf(char* s, const char* format, ...) { + va_list args; + va_start(args, format); + return vsnprintf(s, 0xFFFFFFFF, format, args); +} diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/scanf.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/scanf.c new file mode 100644 index 000000000..ec5fb5536 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/scanf.c @@ -0,0 +1,33 @@ +#include "scanf.h" + +int __StringRead(void* pPtr, int ch, int act) { + char ret; + __InStrCtrl* Iscp = (__InStrCtrl*)pPtr; + + switch (act) { + case __GetAChar: + ret = *(Iscp->NextChar); + + if (ret == '\0') { + Iscp->NullCharDetected = 1; + return -1; + } else { + Iscp->NextChar++; + return (unsigned char)ret; + } + + case __UngetAChar: + if (Iscp->NullCharDetected == 0) { + Iscp->NextChar--; + } else { + Iscp->NullCharDetected = 0; + } + + return ch; + + case __TestForError: + return Iscp->NullCharDetected; + } + + return 0; +} diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/string.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/string.c new file mode 100644 index 000000000..1025b855f --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/string.c @@ -0,0 +1,238 @@ +#include "string.h" + +#define K1 0x80808080 +#define K2 0xFEFEFEFF + +size_t strlen(const char* str) { + size_t len = -1; + unsigned char* p = (unsigned char*)str - 1; + + do { + len++; + } while (*++p); + + return len; +} + +char* strcpy(char* dst, const char* src) { + register unsigned char *destb, *fromb; + register unsigned long w, t, align; + + fromb = (unsigned char*)src; + destb = (unsigned char*)dst; + + if ((align = ((int)fromb & 3)) != ((int)destb & 3)) { + goto bytecopy; + } + + if (align) { + if ((*destb = *fromb) == 0) { + return dst; + } + + for (align = 3 - align; align; align--) { + if ((*(++destb) = *(++fromb)) == 0) { + return dst; + } + } + ++destb; + ++fromb; + } + + w = *((int*)(fromb)); + + t = w + K2; + + t &= K1; + if (t) { + goto bytecopy; + } + --((int*)(destb)); + + do { + *(++((int*)(destb))) = w; + w = *(++((int*)(fromb))); + + t = w + K2; + t &= K1; + if (t) { + goto adjust; + } + } while (1); + +adjust: + ++((int*)(destb)); + +bytecopy: + if ((*destb = *fromb) == 0) { + return dst; + } + + do { + if ((*(++destb) = *(++fromb)) == 0) { + return dst; + } + } while (1); + + return dst; +} + +char* strncpy(char* dst, const char* src, size_t n) { + const unsigned char* p = (const unsigned char*)src - 1; + unsigned char* q = (unsigned char*)dst - 1; + + n++; + while (--n) { + if (!(*++q = *++p)) { + while (--n) { + *++q = 0; + } + break; + } + } + + return dst; +} + +char* strcat(char* dst, const char* src) { + const unsigned char* p = (unsigned char*)src - 1; + unsigned char* q = (unsigned char*)dst - 1; + + while (*++q) { + } + + q--; + + while (*++q = *++p) { + } + + return dst; +} + +int strcmp(const char* str1, const char* str2) { + register unsigned char* left = (unsigned char*)str1; + register unsigned char* right = (unsigned char*)str2; + unsigned long align, l1, r1, x; + + l1 = *left; + r1 = *right; + if (l1 - r1) { + return l1 - r1; + } + + if ((align = ((int)left & 3)) != ((int)right & 3)) { + goto bytecopy; + } + + if (align) { + if (l1 == 0) { + return 0; + } + for (align = 3 - align; align; align--) { + l1 = *(++left); + r1 = *(++right); + if (l1 - r1) { + return l1 - r1; + } + if (l1 == 0) { + return 0; + } + } + left++; + right++; + } + + l1 = *(int*)left; + r1 = *(int*)right; + x = l1 + K2; + if (x & K1) { + goto adjust; + } + + while (l1 == r1) { + l1 = *(++((int*)(left))); + r1 = *(++((int*)(right))); + x = l1 + K2; + if (x & K1) { + goto adjust; + } + } + + if (l1 > r1) { + return 1; + } + return -1; + +adjust: + l1 = *left; + r1 = *right; + if (l1 - r1) { + return l1 - r1; + } + +bytecopy: + if (l1 == 0) { + return 0; + } + + do { + l1 = *(++left); + r1 = *(++right); + if (l1 - r1) { + return l1 - r1; + } + if (l1 == 0) { + return 0; + } + } while (1); +} + +int strncmp(const char* str1, const char* str2, size_t n) { + const unsigned char* p1 = (unsigned char*)str1 - 1; + const unsigned char* p2 = (unsigned char*)str2 - 1; + unsigned long c1, c2; + + n++; + while (--n) { + if ((c1 = *++p1) != (c2 = *++p2)) { + return c1 - c2; + } else if (c1 == 0) { + break; + } + } + + return 0; +} + +char* strchr(const char* str, int c) { + const unsigned char* p = (unsigned char*)str - 1; + unsigned long chr = (c & 0xFF); + + unsigned long ch; + while (ch = *++p) { + if (ch == chr) { + return (char*)p; + } + } + + return chr ? NULL : (char*)p; +} + +char* strrchr(const char* str, int c) { + const unsigned char* p = (unsigned char*)str - 1; + const unsigned char* q = NULL; + unsigned long chr = (c & 0xFF); + + unsigned long ch; + while (ch = *++p) { + if (ch == chr) { + q = p; + } + } + + if (q != NULL) { + return (char*)q; + } + + return chr ? NULL : (char*)p; +} diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/strtoul.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/strtoul.c new file mode 100644 index 000000000..212dc341d --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/strtoul.c @@ -0,0 +1,200 @@ +#include "strtoul.h" +#include "ctype.h" +#include "errno.h" +#include "limits.h" +#include "scanf.h" + +enum scan_states { + start = 0x01, + check_for_zero = 0x02, + leading_zero = 0x04, + need_digit = 0x08, + digit_loop = 0x10, + finished = 0x20, + failure = 0x40 +}; + +#define final_state(scan_state) (scan_state & (finished | failure)) +#define success(scan_state) (scan_state & (leading_zero | digit_loop | finished)) +#define fetch() (count++, (*ReadProc)(ReadProcArg, 0, __GetAChar)) +#define unfetch(c) (*ReadProc)(ReadProcArg, c, __UngetAChar) + +unsigned long __strtoul(int base, int max_width, int (*ReadProc)(void*, int, int), + void* ReadProcArg, int* chars_scanned, int* negative, int* overflow) { + int scan_state = start; + int count = 0; + int spaces = 0; + unsigned long value = 0; + unsigned long value_max = 0; + int c; + + *negative = *overflow = 0; + + if (base < 0 || base == 1 || base > 36 || max_width < 1) { + scan_state = failure; + } else { + c = fetch(); + } + + if (base != 0) { + value_max = ULONG_MAX / base; + } + + while (count <= max_width && c != -1 && !final_state(scan_state)) { + switch (scan_state) { + case start: + if (isspace(c)) { + c = fetch(); + count--; + spaces++; + break; + } + + if (c == '+') { + c = fetch(); + } else if (c == '-') { + c = fetch(); + *negative = 1; + } + + scan_state = check_for_zero; + break; + + case check_for_zero: + if (base == 0 || base == 16) { + if (c == '0') { + scan_state = leading_zero; + c = fetch(); + break; + } + } + + scan_state = need_digit; + break; + + case 4: + if (c == 'X' || c == 'x') { + base = 16; + scan_state = need_digit; + c = fetch(); + break; + } + + if (base == 0) { + base = 8; + } + + scan_state = digit_loop; + break; + + case need_digit: + case digit_loop: + if (base == 0) { + base = 10; + } + + if (!value_max) { + value_max = ULONG_MAX / base; + } + + if (isdigit(c)) { + if ((c -= '0') >= base) { + if (scan_state == digit_loop) { + scan_state = finished; + } else { + scan_state = failure; + } + + c += '0'; + break; + } + } else if (!isalpha(c) || (toupper(c) - 'A' + 10) >= base) { + if (scan_state == digit_loop) { + scan_state = finished; + } else { + scan_state = failure; + } + + break; + } else { + c = toupper(c) - 'A' + 10; + } + + if (value > value_max) { + *overflow = 1; + } + + value *= base; + + if (c > (ULONG_MAX - value)) { + *overflow = 1; + } + + value += c; + scan_state = digit_loop; + c = fetch(); + break; + } + } + + if (!success(scan_state)) { + count = 0; + value = 0; + *chars_scanned = 0; + } else { + count--; + *chars_scanned = count + spaces; + } + + unfetch(c); + return value; +} + +unsigned long strtoul(const char* str, char** end, int base) { + unsigned long value; + int count, negative, overflow; + + __InStrCtrl isc; + isc.NextChar = (char*)str; + isc.NullCharDetected = 0; + + value = __strtoul(base, 0x7FFFFFFF, &__StringRead, (void*)&isc, &count, &negative, &overflow); + + if (end) { + *end = (char*)str + count; + } + + if (overflow) { + value = ULONG_MAX; + errno = 0x22; + } else if (negative) { + value = -value; + } + + return value; +} + +long strtol(const char* str, char** end, int base) { + unsigned long uvalue; + long svalue; + int count, negative, overflow; + + __InStrCtrl isc; + isc.NextChar = (char*)str; + isc.NullCharDetected = 0; + + uvalue = __strtoul(base, 0x7FFFFFFF, &__StringRead, (void*)&isc, &count, &negative, &overflow); + + if (end) { + *end = (char*)str + count; + } + + if (overflow || (!negative && uvalue > LONG_MAX) || (negative && uvalue > -LONG_MIN)) { + svalue = (negative ? -LONG_MIN : LONG_MAX); + errno = ERANGE; + } else { + svalue = (negative ? (long)-uvalue : (long)uvalue); + } + + return svalue; +} diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/wchar_io.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/wchar_io.c new file mode 100644 index 000000000..699e2721d --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/wchar_io.c @@ -0,0 +1,21 @@ +#include "wchar_io.h" + +int fwide(FILE* file, int mode) { + if (file == NULL || file->file_mode.file_kind == __closed_file) { + return 0; + } + + switch (file->file_mode.file_orientation) { + case UNORIENTED: + if (mode > 0) { + file->file_mode.file_orientation = WIDE_ORIENTED; + } else if (mode < 0) { + file->file_mode.file_orientation = CHAR_ORIENTED; + } + return mode; + case WIDE_ORIENTED: + return 1; + case CHAR_ORIENTED: + return -1; + } +} diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_acos.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_acos.c new file mode 100644 index 000000000..1bbd7a6e3 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_acos.c @@ -0,0 +1,105 @@ + +/* @(#)e_acos.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* __ieee754_acos(x) + * Method : + * acos(x) = pi/2 - asin(x) + * acos(-x) = pi/2 + asin(x) + * For |x|<=0.5 + * acos(x) = pi/2 - (x + x*x^2*R(x^2)) (see asin.c) + * For x>0.5 + * acos(x) = pi/2 - (pi/2 - 2asin(sqrt((1-x)/2))) + * = 2asin(sqrt((1-x)/2)) + * = 2s + 2s*z*R(z) ...z=(1-x)/2, s=sqrt(z) + * = 2f + (2c + 2s*z*R(z)) + * where f=hi part of s, and c = (z-f*f)/(s+f) is the correction term + * for f so that f+c ~ sqrt(z). + * For x<-0.5 + * acos(x) = pi - 2asin(sqrt((1-|x|)/2)) + * = pi - 0.5*(s+s*z*R(z)), where z=(1-|x|)/2,s=sqrt(z) + * + * Special cases: + * if x is NaN, return x itself; + * if |x|>1, return NaN with invalid signal. + * + * Function needed: sqrt + */ + +#include "math.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif +one= 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ +pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */ +pio2_hi = 1.57079632679489655800e+00, /* 0x3FF921FB, 0x54442D18 */ +pio2_lo = 6.12323399573676603587e-17, /* 0x3C91A626, 0x33145C07 */ +pS0 = 1.66666666666666657415e-01, /* 0x3FC55555, 0x55555555 */ +pS1 = -3.25565818622400915405e-01, /* 0xBFD4D612, 0x03EB6F7D */ +pS2 = 2.01212532134862925881e-01, /* 0x3FC9C155, 0x0E884455 */ +pS3 = -4.00555345006794114027e-02, /* 0xBFA48228, 0xB5688F3B */ +pS4 = 7.91534994289814532176e-04, /* 0x3F49EFE0, 0x7501B288 */ +pS5 = 3.47933107596021167570e-05, /* 0x3F023DE1, 0x0DFDF709 */ +qS1 = -2.40339491173441421878e+00, /* 0xC0033A27, 0x1C8A2D4B */ +qS2 = 2.02094576023350569471e+00, /* 0x40002AE5, 0x9C598AC8 */ +qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */ +qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */ + +#ifdef __STDC__ + double __ieee754_acos(double x) +#else + double __ieee754_acos(x) + double x; +#endif +{ + double z,p,q,r,w,s,c,df; + int hx,ix; + hx = __HI(x); + ix = hx&0x7fffffff; + if(ix>=0x3ff00000) { /* |x| >= 1 */ + if(((ix-0x3ff00000)|__LO(x))==0) { /* |x|==1 */ + if(hx>0) return 0.0; /* acos(1) = 0 */ + else return pi+2.0*pio2_lo; /* acos(-1)= pi */ + } + return NAN; /* acos(|x|>1) is NaN */ + } + if(ix<0x3fe00000) { /* |x| < 0.5 */ + if(ix<=0x3c600000) return pio2_hi+pio2_lo;/*if|x|<2**-57*/ + z = x*x; + p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); + q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); + r = p/q; + return pio2_hi - (x - (pio2_lo-x*r)); + } else if (hx<0) { /* x < -0.5 */ + z = (one+x)*0.5; + p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); + q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); + s = sqrt(z); + r = p/q; + w = r*s-pio2_lo; + return pi - 2.0*(s+w); + } else { /* x > 0.5 */ + z = (one-x)*0.5; + s = sqrt(z); + df = s; + __LO(df) = 0; + c = (z-df*df)/(s+df); + p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); + q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); + r = p/q; + w = r*s+c; + return 2.0*(df+w); + } +} \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_asin.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_asin.c new file mode 100644 index 000000000..8f40d9022 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_asin.c @@ -0,0 +1,116 @@ + +/* @(#)e_asin.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* __ieee754_asin(x) + * Method : + * Since asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ... + * we approximate asin(x) on [0,0.5] by + * asin(x) = x + x*x^2*R(x^2) + * where + * R(x^2) is a rational approximation of (asin(x)-x)/x^3 + * and its remez error is bounded by + * |(asin(x)-x)/x^3 - R(x^2)| < 2^(-58.75) + * + * For x in [0.5,1] + * asin(x) = pi/2-2*asin(sqrt((1-x)/2)) + * Let y = (1-x), z = y/2, s := sqrt(z), and pio2_hi+pio2_lo=pi/2; + * then for x>0.98 + * asin(x) = pi/2 - 2*(s+s*z*R(z)) + * = pio2_hi - (2*(s+s*z*R(z)) - pio2_lo) + * For x<=0.98, let pio4_hi = pio2_hi/2, then + * f = hi part of s; + * c = sqrt(z) - f = (z-f*f)/(s+f) ...f+c=sqrt(z) + * and + * asin(x) = pi/2 - 2*(s+s*z*R(z)) + * = pio4_hi+(pio4-2s)-(2s*z*R(z)-pio2_lo) + * = pio4_hi+(pio4-2f)-(2s*z*R(z)-(pio2_lo+2c)) + * + * Special cases: + * if x is NaN, return x itself; + * if |x|>1, return NaN with invalid signal. + * + */ + +#include "math.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif + one + = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ + huge = 1.000e+300, pio2_hi = 1.57079632679489655800e+00, /* 0x3FF921FB, 0x54442D18 */ + pio2_lo = 6.12323399573676603587e-17, /* 0x3C91A626, 0x33145C07 */ + pio4_hi = 7.85398163397448278999e-01, /* 0x3FE921FB, 0x54442D18 */ + /* coefficient for R(x^2) */ + pS0 = 1.66666666666666657415e-01, /* 0x3FC55555, 0x55555555 */ + pS1 = -3.25565818622400915405e-01, /* 0xBFD4D612, 0x03EB6F7D */ + pS2 = 2.01212532134862925881e-01, /* 0x3FC9C155, 0x0E884455 */ + pS3 = -4.00555345006794114027e-02, /* 0xBFA48228, 0xB5688F3B */ + pS4 = 7.91534994289814532176e-04, /* 0x3F49EFE0, 0x7501B288 */ + pS5 = 3.47933107596021167570e-05, /* 0x3F023DE1, 0x0DFDF709 */ + qS1 = -2.40339491173441421878e+00, /* 0xC0033A27, 0x1C8A2D4B */ + qS2 = 2.02094576023350569471e+00, /* 0x40002AE5, 0x9C598AC8 */ + qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */ + qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */ + +#ifdef __STDC__ +double __ieee754_asin(double x) +#else +double __ieee754_asin(x) double x; +#endif +{ + double t, w, p, q, c, r, s; + int hx, ix; + hx = __HI(x); + ix = hx & 0x7fffffff; + if (ix >= 0x3ff00000) { /* |x|>= 1 */ + if (((ix - 0x3ff00000) | __LO(x)) == 0) + /* asin(1)=+-pi/2 with inexact */ + return x * pio2_hi + x * pio2_lo; + return NAN; /* asin(|x|>1) is NaN */ + } else if (ix < 0x3fe00000) { /* |x|<0.5 */ + if (ix < 0x3e400000) { /* if |x| < 2**-27 */ + if (huge + x > one) + return x; /* return x with inexact if x!=0*/ + } else + t = x * x; + p = t * (pS0 + t * (pS1 + t * (pS2 + t * (pS3 + t * (pS4 + t * pS5))))); + q = one + t * (qS1 + t * (qS2 + t * (qS3 + t * qS4))); + w = p / q; + return x + x * w; + } + /* 1> |x|>= 0.5 */ + w = one - fabs(x); + t = w * 0.5; + p = t * (pS0 + t * (pS1 + t * (pS2 + t * (pS3 + t * (pS4 + t * pS5))))); + q = one + t * (qS1 + t * (qS2 + t * (qS3 + t * qS4))); + s = sqrt(t); + if (ix >= 0x3FEF3333) { /* if |x| > 0.975 */ + w = p / q; + t = pio2_hi - (2.0 * (s + s * w) - pio2_lo); + } else { + w = s; + __LO(w) = 0; + c = (t - w * w) / (s + w); + r = p / q; + p = 2.0 * s * r - (pio2_lo - 2.0 * c); + q = pio4_hi - 2.0 * w; + t = pio4_hi - (p - q); + } + if (hx > 0) + return t; + else + return -t; +} \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_atan2.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_atan2.c new file mode 100644 index 000000000..5a7863be0 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_atan2.c @@ -0,0 +1,143 @@ + +/* @(#)e_atan2.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + * + */ + +/* __ieee754_atan2(y,x) + * Method : + * 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x). + * 2. Reduce x to positive by (if x and y are unexceptional): + * ARG (x+iy) = arctan(y/x) ... if x > 0, + * ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0, + * + * Special cases: + * + * ATAN2((anything), NaN ) is NaN; + * ATAN2(NAN , (anything) ) is NaN; + * ATAN2(+-0, +(anything but NaN)) is +-0 ; + * ATAN2(+-0, -(anything but NaN)) is +-pi ; + * ATAN2(+-(anything but 0 and NaN), 0) is +-pi/2; + * ATAN2(+-(anything but INF and NaN), +INF) is +-0 ; + * ATAN2(+-(anything but INF and NaN), -INF) is +-pi; + * ATAN2(+-INF,+INF ) is +-pi/4 ; + * ATAN2(+-INF,-INF ) is +-3pi/4; + * ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2; + * + * Constants: + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#include "fdlibm.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif + tiny + = 1.0e-300, + zero = 0.0, pi_o_4 = 7.8539816339744827900E-01, /* 0x3FE921FB, 0x54442D18 */ + pi_o_2 = 1.5707963267948965580E+00, /* 0x3FF921FB, 0x54442D18 */ + pi = 3.1415926535897931160E+00, /* 0x400921FB, 0x54442D18 */ + pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */ + +#ifdef __STDC__ +double __ieee754_atan2(double y, double x) +#else +double __ieee754_atan2(y, x) double y, x; +#endif +{ + double z; + int k, m, hx, hy, ix, iy; + unsigned lx, ly; + + hx = __HI(x); + ix = hx & 0x7fffffff; + lx = __LO(x); + hy = __HI(y); + iy = hy & 0x7fffffff; + ly = __LO(y); + if (((ix | ((lx | -lx) >> 31)) > 0x7ff00000) || ((iy | ((ly | -ly) >> 31)) > 0x7ff00000)) /* x or y is NaN */ + return x + y; + if ((hx - 0x3ff00000 | lx) == 0) + return atan(y); /* x=1.0 */ + m = ((hy >> 31) & 1) | ((hx >> 30) & 2); /* 2*sign(x)+sign(y) */ + + /* when y = 0 */ + if ((iy | ly) == 0) { + switch (m) { + case 0: + case 1: + return y; /* atan(+-0,+anything)=+-0 */ + case 2: + return pi + tiny; /* atan(+0,-anything) = pi */ + case 3: + return -pi - tiny; /* atan(-0,-anything) =-pi */ + } + } + /* when x = 0 */ + if ((ix | lx) == 0) + return (hy < 0) ? -pi_o_2 - tiny : pi_o_2 + tiny; + + /* when x is INF */ + if (ix == 0x7ff00000) { + if (iy == 0x7ff00000) { + switch (m) { + case 0: + return pi_o_4 + tiny; /* atan(+INF,+INF) */ + case 1: + return -pi_o_4 - tiny; /* atan(-INF,+INF) */ + case 2: + return 3.0 * pi_o_4 + tiny; /*atan(+INF,-INF)*/ + case 3: + return -3.0 * pi_o_4 - tiny; /*atan(-INF,-INF)*/ + } + } else { + switch (m) { + case 0: + return zero; /* atan(+...,+INF) */ + case 1: + return -zero; /* atan(-...,+INF) */ + case 2: + return pi + tiny; /* atan(+...,-INF) */ + case 3: + return -pi - tiny; /* atan(-...,-INF) */ + } + } + } + /* when y is INF */ + if (iy == 0x7ff00000) + return (hy < 0) ? -pi_o_2 - tiny : pi_o_2 + tiny; + + /* compute y/x */ + k = (iy - ix) >> 20; + if (k > 60) + z = pi_o_2 + 0.5 * pi_lo; /* |y/x| > 2**60 */ + else if (hx < 0 && k < -60) + z = 0.0; /* |y|/x < -2**60 */ + else + z = atan(__fabs(y / x)); /* safe to do y/x */ + switch (m) { + case 0: + return z; /* atan(+,+) */ + case 1: + __HI(z) ^= 0x80000000; + return z; /* atan(-,+) */ + case 2: + return pi - (z - pi_lo); /* atan(+,-) */ + default: /* case 3 */ + return (z - pi_lo) - pi; /* atan(-,-) */ + } +} \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_fmod.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_fmod.c new file mode 100644 index 000000000..200db3bc9 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_fmod.c @@ -0,0 +1,167 @@ + +/* @(#)e_fmod.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * __ieee754_fmod(x,y) + * Return x mod y in exact arithmetic + * Method: shift and subtract + */ + +#include "fdlibm.h" + +#ifdef __STDC__ +static const double one = 1.0, Zero[] = { + 0.0, + -0.0, +}; +#else +static double one = 1.0, Zero[] = { + 0.0, + -0.0, +}; +#endif + +#ifdef __STDC__ +double __ieee754_fmod(double x, double y) +#else +double __ieee754_fmod(x, y) double x, y; +#endif +{ + int n, hx, hy, hz, ix, iy, sx, i; + unsigned lx, ly, lz; + + hx = __HI(x); /* high word of x */ + lx = __LO(x); /* low word of x */ + hy = __HI(y); /* high word of y */ + ly = __LO(y); /* low word of y */ + sx = hx & 0x80000000; /* sign of x */ + hx ^= sx; /* |x| */ + hy &= 0x7fffffff; /* |y| */ + + /* purge off exception values */ + if ((hy | ly) == 0 || (hx >= 0x7ff00000) || /* y=0,or x not finite */ + ((hy | ((ly | -ly) >> 31)) > 0x7ff00000)) /* or y is NaN */ + return (x * y) / (x * y); + if (hx <= hy) { + if ((hx < hy) || (lx < ly)) + return x; /* |x|<|y| return x */ + if (lx == ly) + return Zero[(unsigned)sx >> 31]; /* |x|=|y| return x*0*/ + } + + /* determine ix = ilogb(x) */ + if (hx < 0x00100000) { /* subnormal x */ + if (hx == 0) { + for (ix = -1043, i = lx; i > 0; i <<= 1) + ix -= 1; + } else { + for (ix = -1022, i = (hx << 11); i > 0; i <<= 1) + ix -= 1; + } + } else + ix = (hx >> 20) - 1023; + + /* determine iy = ilogb(y) */ + if (hy < 0x00100000) { /* subnormal y */ + if (hy == 0) { + for (iy = -1043, i = ly; i > 0; i <<= 1) + iy -= 1; + } else { + for (iy = -1022, i = (hy << 11); i > 0; i <<= 1) + iy -= 1; + } + } else + iy = (hy >> 20) - 1023; + + /* set up {hx,lx}, {hy,ly} and align y to x */ + if (ix >= -1022) + hx = 0x00100000 | (0x000fffff & hx); + else { /* subnormal x, shift x to normal */ + n = -1022 - ix; + if (n <= 31) { + hx = (hx << n) | (lx >> (32 - n)); + lx <<= n; + } else { + hx = lx << (n - 32); + lx = 0; + } + } + if (iy >= -1022) + hy = 0x00100000 | (0x000fffff & hy); + else { /* subnormal y, shift y to normal */ + n = -1022 - iy; + if (n <= 31) { + hy = (hy << n) | (ly >> (32 - n)); + ly <<= n; + } else { + hy = ly << (n - 32); + ly = 0; + } + } + + /* fix point fmod */ + n = ix - iy; + while (n--) { + hz = hx - hy; + lz = lx - ly; + if (lx < ly) + hz -= 1; + if (hz < 0) { + hx = hx + hx + (lx >> 31); + lx = lx + lx; + } else { + if ((hz | lz) == 0) /* return sign(x)*0 */ + return Zero[(unsigned)sx >> 31]; + hx = hz + hz + (lz >> 31); + lx = lz + lz; + } + } + hz = hx - hy; + lz = lx - ly; + if (lx < ly) + hz -= 1; + if (hz >= 0) { + hx = hz; + lx = lz; + } + + /* convert back to floating value and restore the sign */ + if ((hx | lx) == 0) /* return sign(x)*0 */ + return Zero[(unsigned)sx >> 31]; + while (hx < 0x00100000) { /* normalize x */ + hx = hx + hx + (lx >> 31); + lx = lx + lx; + iy -= 1; + } + if (iy >= -1022) { /* normalize output */ + hx = ((hx - 0x00100000) | ((iy + 1023) << 20)); + __HI(x) = hx | sx; + __LO(x) = lx; + } else { /* subnormal output */ + n = -1022 - iy; + if (n <= 20) { + lx = (lx >> n) | ((unsigned)hx << (32 - n)); + hx >>= n; + } else if (n <= 31) { + lx = (hx << (32 - n)) | (lx >> n); + hx = sx; + } else { + lx = hx >> (n - 32); + hx = sx; + } + __HI(x) = hx | sx; + __LO(x) = lx; + x *= one; /* create necessary signal */ + } + return x; /* exact output */ +} \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_rem_pio2.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_rem_pio2.c new file mode 100644 index 000000000..96987b851 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/e_rem_pio2.c @@ -0,0 +1,180 @@ + +/* @(#)e_rem_pio2.c 1.4 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + * + */ + +/* __ieee754_rem_pio2(x,y) + * + * return the remainder of x rem pi/2 in y[0]+y[1] + * use __kernel_rem_pio2() + */ + +#include "math.h" + +/* + * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi + */ +#ifdef __STDC__ +static const int two_over_pi[] = { +#else +static int two_over_pi[] = { +#endif + 0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, 0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, + 0x246E3A, 0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, 0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, + 0x7026B4, 0x5F7E41, 0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8, 0x97FFDE, 0x05980F, 0xEF2F11, + 0x8B5A0A, 0x6D1F6D, 0x367ECF, 0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, 0xF17B3D, 0x0739F7, + 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08, 0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3, 0x91615E, + 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880, 0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B, +}; + +#ifdef __STDC__ +static const int npio2_hw[] = { +#else +static int npio2_hw[] = { +#endif + 0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C, 0x4025FDBB, 0x402921FB, 0x402C463A, 0x402F6A7A, 0x4031475C, + 0x4032D97C, 0x40346B9C, 0x4035FDBB, 0x40378FDB, 0x403921FB, 0x403AB41B, 0x403C463A, 0x403DD85A, 0x403F6A7A, 0x40407E4C, 0x4041475C, + 0x4042106C, 0x4042D97C, 0x4043A28C, 0x40446B9C, 0x404534AC, 0x4045FDBB, 0x4046C6CB, 0x40478FDB, 0x404858EB, 0x404921FB, +}; + +/* + * invpio2: 53 bits of 2/pi + * pio2_1: first 33 bit of pi/2 + * pio2_1t: pi/2 - pio2_1 + * pio2_2: second 33 bit of pi/2 + * pio2_2t: pi/2 - (pio2_1+pio2_2) + * pio2_3: third 33 bit of pi/2 + * pio2_3t: pi/2 - (pio2_1+pio2_2+pio2_3) + */ + +#ifdef __STDC__ +static const double +#else +static double +#endif + zero + = 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ + half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ + two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ + invpio2 = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ + pio2_1 = 1.57079632673412561417e+00, /* 0x3FF921FB, 0x54400000 */ + pio2_1t = 6.07710050650619224932e-11, /* 0x3DD0B461, 0x1A626331 */ + pio2_2 = 6.07710050630396597660e-11, /* 0x3DD0B461, 0x1A600000 */ + pio2_2t = 2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */ + pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */ + pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ + +#ifdef __STDC__ +int __ieee754_rem_pio2(double x, double* y) +#else +int __ieee754_rem_pio2(x, y) double x, y[]; +#endif +{ + double z, w, t, r, fn; + double tx[3]; + int e0, i, j, nx, n, ix, hx; + + hx = __HI(x); /* high word of x */ + ix = hx & 0x7fffffff; + if (ix <= 0x3fe921fb) /* |x| ~<= pi/4 , no need for reduction */ + { + y[0] = x; + y[1] = 0; + return 0; + } + if (ix < 0x4002d97c) { /* |x| < 3pi/4, special case with n=+-1 */ + if (hx > 0) { + z = x - pio2_1; + if (ix != 0x3ff921fb) { /* 33+53 bit pi is good enough */ + y[0] = z - pio2_1t; + y[1] = (z - y[0]) - pio2_1t; + } else { /* near pi/2, use 33+33+53 bit pi */ + z -= pio2_2; + y[0] = z - pio2_2t; + y[1] = (z - y[0]) - pio2_2t; + } + return 1; + } else { /* negative x */ + z = x + pio2_1; + if (ix != 0x3ff921fb) { /* 33+53 bit pi is good enough */ + y[0] = z + pio2_1t; + y[1] = (z - y[0]) + pio2_1t; + } else { /* near pi/2, use 33+33+53 bit pi */ + z += pio2_2; + y[0] = z + pio2_2t; + y[1] = (z - y[0]) + pio2_2t; + } + return -1; + } + } + if (ix <= 0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */ + t = fabs(x); + n = (int)(t * invpio2 + half); + fn = (double)n; + r = t - fn * pio2_1; + w = fn * pio2_1t; /* 1st round good to 85 bit */ + if (n < 32 && ix != npio2_hw[n - 1]) { + y[0] = r - w; /* quick check no cancellation */ + } else { + j = ix >> 20; + y[0] = r - w; + i = j - (((__HI(y[0])) >> 20) & 0x7ff); + if (i > 16) { /* 2nd iteration needed, good to 118 */ + t = r; + r = t - fn * pio2_2; + w = fn * pio2_2t - ((t - r) - fn * pio2_2); + y[0] = r - w; + i = j - (((__HI(y[0])) >> 20) & 0x7ff); + if (i > 49) { /* 3rd iteration need, 151 bits acc */ + t = r; /* will cover all possible cases */ + w = fn * pio2_3; + r = t - w; + w = fn * pio2_3t - ((t - r) - w); + y[0] = r - w; + } + } + } + y[1] = (r - y[0]) - w; + if (hx < 0) { + y[0] = -y[0]; + y[1] = -y[1]; + return -n; + } else + return n; + } + /* + * all other (large) arguments + */ + if (ix >= 0x7ff00000) { /* x is inf or NaN */ + y[0] = y[1] = x - x; + return 0; + } + /* set z = scalbn(|x|,ilogb(x)-23) */ + __LO(z) = __LO(x); + e0 = (ix >> 20) - 1046; /* e0 = ilogb(z)-23; */ + __HI(z) = ix - (e0 << 20); + for (i = 0; i < 2; i++) { + tx[i] = (double)((int)(z)); + z = (z - tx[i]) * two24; + } + tx[2] = z; + nx = 3; + while (tx[nx - 1] == zero) + nx--; /* skip zero term */ + n = __kernel_rem_pio2(tx, y, e0, nx, 2, two_over_pi); + if (hx < 0) { + y[0] = -y[0]; + y[1] = -y[1]; + return -n; + } + return n; +} \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_cos.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_cos.c new file mode 100644 index 000000000..5db423ec4 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_cos.c @@ -0,0 +1,93 @@ + +/* @(#)k_cos.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * __kernel_cos( x, y ) + * kernel cos function on [-pi/4, pi/4], pi/4 ~ 0.785398164 + * Input x is assumed to be bounded by ~pi/4 in magnitude. + * Input y is the tail of x. + * + * Algorithm + * 1. Since cos(-x) = cos(x), we need only to consider positive x. + * 2. if x < 2^-27 (hx<0x3e400000 0), return 1 with inexact if x!=0. + * 3. cos(x) is approximated by a polynomial of degree 14 on + * [0,pi/4] + * 4 14 + * cos(x) ~ 1 - x*x/2 + C1*x + ... + C6*x + * where the remez error is + * + * | 2 4 6 8 10 12 14 | -58 + * |cos(x)-(1-.5*x +C1*x +C2*x +C3*x +C4*x +C5*x +C6*x )| <= 2 + * | | + * + * 4 6 8 10 12 14 + * 4. let r = C1*x +C2*x +C3*x +C4*x +C5*x +C6*x , then + * cos(x) = 1 - x*x/2 + r + * since cos(x+y) ~ cos(x) - sin(x)*y + * ~ cos(x) - x*y, + * a correction term is necessary in cos(x) and hence + * cos(x+y) = 1 - (x*x/2 - (r - x*y)) + * For better accuracy when x > 0.3, let qx = |x|/4 with + * the last 32 bits mask off, and if x > 0.78125, let qx = 0.28125. + * Then + * cos(x+y) = (1-qx) - ((x*x/2-qx) - (r-x*y)). + * Note that 1-qx and (x*x/2-qx) is EXACT here, and the + * magnitude of the latter is at least a quarter of x*x/2, + * thus, reducing the rounding error in the subtraction. + */ + +#include "fdlibm.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif + one + = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ + C1 = 4.16666666666666019037e-02, /* 0x3FA55555, 0x5555554C */ + C2 = -1.38888888888741095749e-03, /* 0xBF56C16C, 0x16C15177 */ + C3 = 2.48015872894767294178e-05, /* 0x3EFA01A0, 0x19CB1590 */ + C4 = -2.75573143513906633035e-07, /* 0xBE927E4F, 0x809C52AD */ + C5 = 2.08757232129817482790e-09, /* 0x3E21EE9E, 0xBDB4B1C4 */ + C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */ + +#ifdef __STDC__ +double __kernel_cos(double x, double y) +#else +double __kernel_cos(x, y) double x, y; +#endif +{ + double a, hz, z, r, qx; + int ix; + ix = __HI(x) & 0x7fffffff; /* ix = |x|'s high word*/ + if (ix < 0x3e400000) { /* if x < 2**27 */ + if (((int)x) == 0) + return one; /* generate inexact */ + } + z = x * x; + r = z * (C1 + z * (C2 + z * (C3 + z * (C4 + z * (C5 + z * C6))))); + if (ix < 0x3FD33333) /* if |x| < 0.3 */ + return one - (0.5 * z - (z * r - x * y)); + else { + if (ix > 0x3fe90000) { /* x > 0.78125 */ + qx = 0.28125; + } else { + __HI(qx) = ix - 0x00200000; /* x/4 */ + __LO(qx) = 0; + } + hz = 0.5 * z - qx; + a = one - qx; + return a - (hz - (z * r - x * y)); + } +} \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_rem_pio2.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_rem_pio2.c new file mode 100644 index 000000000..b08e3c9de --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_rem_pio2.c @@ -0,0 +1,353 @@ + +/* @(#)k_rem_pio2.c 1.2 95/01/04 */ +/* $Id: k_rem_pio2.c,v 1.2.14.1 2002/01/31 15:24:13 ceciliar Exp $ */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * __kernel_rem_pio2(x,y,e0,nx,prec,ipio2) + * double x[],y[]; int e0,nx,prec; int ipio2[]; + * + * __kernel_rem_pio2 return the last three digits of N with + * y = x - N*pi/2 + * so that |y| < pi/2. + * + * The method is to compute the integer (mod 8) and fraction parts of + * (2/pi)*x without doing the full multiplication. In general we + * skip the part of the product that are known to be a huge integer ( + * more accurately, = 0 mod 8 ). Thus the number of operations are + * independent of the exponent of the input. + * + * (2/pi) is represented by an array of 24-bit integers in ipio2[]. + * + * Input parameters: + * x[] The input value (must be positive) is broken into nx + * pieces of 24-bit integers in double precision format. + * x[i] will be the i-th 24 bit of x. The scaled exponent + * of x[0] is given in input parameter e0 (i.e., x[0]*2^e0 + * match x's up to 24 bits. + * + * Example of breaking a double positive z into x[0]+x[1]+x[2]: + * e0 = ilogb(z)-23 + * z = ldexp(z,-e0) + * for i = 0,1,2 + * x[i] = floor(z) + * z = (z-x[i])*2**24 + * + * + * y[] ouput result in an array of double precision numbers. + * The dimension of y[] is: + * 24-bit precision 1 + * 53-bit precision 2 + * 64-bit precision 2 + * 113-bit precision 3 + * The actual value is the sum of them. Thus for 113-bit + * precison, one may have to do something like: + * + * long double t,w,r_head, r_tail; + * t = (long double)y[2] + (long double)y[1]; + * w = (long double)y[0]; + * r_head = t+w; + * r_tail = w - (r_head - t); + * + * e0 The exponent of x[0] + * + * nx dimension of x[] + * + * prec an integer indicating the precision: + * 0 24 bits (single) + * 1 53 bits (double) + * 2 64 bits (extended) + * 3 113 bits (quad) + * + * ipio2[] + * integer array, contains the (24*i)-th to (24*i+23)-th + * bit of 2/pi after binary point. The corresponding + * floating value is + * + * ipio2[i] * 2^(-24(i+1)). + * + * External function: + * double ldexp(), floor(); + * + * + * Here is the description of some local variables: + * + * jk jk+1 is the initial number of terms of ipio2[] needed + * in the computation. The recommended value is 2,3,4, + * 6 for single, double, extended,and quad. + * + * jz local integer variable indicating the number of + * terms of ipio2[] used. + * + * jx nx - 1 + * + * jv index for pointing to the suitable ipio2[] for the + * computation. In general, we want + * ( 2^e0*x[0] * ipio2[jv-1]*2^(-24jv) )/8 + * is an integer. Thus + * e0-3-24*jv >= 0 or (e0-3)/24 >= jv + * Hence jv = max(0,(e0-3)/24). + * + * jp jp+1 is the number of terms in PIo2[] needed, jp = jk. + * + * q[] double array with integral value, representing the + * 24-bits chunk of the product of x and 2/pi. + * + * q0 the corresponding exponent of q[0]. Note that the + * exponent for q[i] would be q0-24*i. + * + * PIo2[] double precision array, obtained by cutting pi/2 + * into 24 bits chunks. + * + * f[] ipio2[] in floating point + * + * iq[] integer array by breaking up q[] in 24-bits chunk. + * + * fq[] final product of x*(2/pi) in fq[0],..,fq[jk] + * + * ih integer. If >0 it indicates q[] is >= 0.5, hence + * it also indicates the *sign* of the result. + * + */ + +/* + * Constants: + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#include "fdlibm.h" + +#ifdef __STDC__ +static const int init_jk[] = { 2, 3, 4, 6 }; +/* initial value for jk */ /*- cc 020130 -*/ +#else +static int init_jk[] = { 2, 3, 4, 6 }; /*- cc 020130 -*/ +#endif + +#ifdef __STDC__ +static const double PIo2[] = { +#else +static double PIo2[] = { +#endif + 1.57079625129699707031e+00, /* 0x3FF921FB, 0x40000000 */ + 7.54978941586159635335e-08, /* 0x3E74442D, 0x00000000 */ + 5.39030252995776476554e-15, /* 0x3CF84698, 0x80000000 */ + 3.28200341580791294123e-22, /* 0x3B78CC51, 0x60000000 */ + 1.27065575308067607349e-29, /* 0x39F01B83, 0x80000000 */ + 1.22933308981111328932e-36, /* 0x387A2520, 0x40000000 */ + 2.73370053816464559624e-44, /* 0x36E38222, 0x80000000 */ + 2.16741683877804819444e-51, /* 0x3569F31D, 0x00000000 */ +}; + +#ifdef __STDC__ +static const double +#else +static double +#endif + zero + = 0.0, + one = 1.0, two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ + twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */ + +#ifdef __STDC__ +int __kernel_rem_pio2(double* x, double* y, int e0, int nx, int prec, const int* ipio2) /*- cc 020130 -*/ +#else +int __kernel_rem_pio2(x, y, e0, nx, prec, ipio2) /*- cc 020130 -*/ + double x[], + y[]; +int e0, nx, prec; +int ipio2[]; /*- cc 020130 -*/ +#endif +{ + int jz, jx, jv, jp, jk, carry, n, iq[20], i, j, k, m, q0, ih; /*- cc 020130 -*/ + double z, fw, f[20], fq[20], q[20]; + + /* initialize jk*/ + jk = init_jk[prec]; + jp = jk; + + /* determine jx,jv,q0, note that 3>q0 */ + jx = nx - 1; + jv = (e0 - 3) / 24; + if (jv < 0) + jv = 0; + q0 = e0 - 24 * (jv + 1); + + /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */ + j = jv - jx; + m = jx + jk; + for (i = 0; i <= m; i++, j++) + f[i] = (j < 0) ? zero : (double)ipio2[j]; + + /* compute q[0],q[1],...q[jk] */ + for (i = 0; i <= jk; i++) { + for (j = 0, fw = 0.0; j <= jx; j++) + fw += x[j] * f[jx + i - j]; + q[i] = fw; + } + + jz = jk; +recompute: + /* distill q[] into iq[] reversingly */ + for (i = 0, j = jz, z = q[jz]; j > 0; i++, j--) { + fw = (double)((int)(twon24 * z)); /*- cc 020130 -*/ + iq[i] = (int)(z - two24 * fw); /*- cc 020130 -*/ + z = q[j - 1] + fw; + } + + /* compute n */ + z = ldexp(z, q0); /* actual value of z */ + z -= 8.0 * floor(z * 0.125); /* trim off integer >= 8 */ + n = (int)z; /*- cc 020130 -*/ + z -= (double)n; + ih = 0; + if (q0 > 0) { /* need iq[jz-1] to determine n */ + i = (iq[jz - 1] >> (24 - q0)); + n += i; + iq[jz - 1] -= i << (24 - q0); + ih = iq[jz - 1] >> (23 - q0); + } else if (q0 == 0) + ih = iq[jz - 1] >> 23; + else if (z >= 0.5) + ih = 2; + + if (ih > 0) { /* q > 0.5 */ + n += 1; + carry = 0; + for (i = 0; i < jz; i++) { /* compute 1-q */ + j = iq[i]; + if (carry == 0) { + if (j != 0) { + carry = 1; + iq[i] = 0x1000000 - j; + } + } else + iq[i] = 0xffffff - j; + } + if (q0 > 0) { /* rare case: chance is 1 in 12 */ + switch (q0) { + case 1: + iq[jz - 1] &= 0x7fffff; + break; + case 2: + iq[jz - 1] &= 0x3fffff; + break; + } + } + if (ih == 2) { + z = one - z; + if (carry != 0) + z -= ldexp(one, q0); + } + } + + /* check if recomputation is needed */ + if (z == zero) { + j = 0; + for (i = jz - 1; i >= jk; i--) + j |= iq[i]; + if (j == 0) { /* need recomputation */ + for (k = 1; iq[jk - k] == 0; k++) + ; /* k = no. of terms needed */ + + for (i = jz + 1; i <= jz + k; i++) { /* add q[jz+1] to q[jz+k] */ + f[jx + i] = (double)ipio2[jv + i]; + for (j = 0, fw = 0.0; j <= jx; j++) + fw += x[j] * f[jx + i - j]; + q[i] = fw; + } + jz += k; + goto recompute; + } + } + + /* chop off zero terms */ + if (z == 0.0) { + jz -= 1; + q0 -= 24; + while (iq[jz] == 0) { + jz--; + q0 -= 24; + } + } else { /* break z into 24-bit if necessary */ + z = ldexp(z, -q0); + if (z >= two24) { + fw = (double)((int)(twon24 * z)); /*- cc 020130 -*/ + iq[jz] = (int)(z - two24 * fw); /*- cc 020130 -*/ + jz += 1; + q0 += 24; + iq[jz] = (int)fw; /*- cc 020130 -*/ + } else + iq[jz] = (int)z; /*- cc 020130 -*/ + } + + /* convert integer "bit" chunk to floating-point value */ + fw = ldexp(one, q0); + for (i = jz; i >= 0; i--) { + q[i] = fw * (double)iq[i]; + fw *= twon24; + } + + /* compute PIo2[0,...,jp]*q[jz,...,0] */ + for (i = jz; i >= 0; i--) { + for (fw = 0.0, k = 0; k <= jp && k <= jz - i; k++) + fw += PIo2[k] * q[i + k]; + fq[jz - i] = fw; + } + + /* compress fq[] into y[] */ + switch (prec) { + case 0: + fw = 0.0; + for (i = jz; i >= 0; i--) + fw += fq[i]; + y[0] = (ih == 0) ? fw : -fw; + break; + case 1: + case 2: + fw = 0.0; + for (i = jz; i >= 0; i--) + fw += fq[i]; + y[0] = (ih == 0) ? fw : -fw; + fw = fq[0] - fw; + for (i = 1; i <= jz; i++) + fw += fq[i]; + y[1] = (ih == 0) ? fw : -fw; + break; + case 3: /* painful */ + for (i = jz; i > 0; i--) { + fw = fq[i - 1] + fq[i]; + fq[i] += fq[i - 1] - fw; + fq[i - 1] = fw; + } + for (i = jz; i > 1; i--) { + fw = fq[i - 1] + fq[i]; + fq[i] += fq[i - 1] - fw; + fq[i - 1] = fw; + } + for (fw = 0.0, i = jz; i >= 2; i--) + fw += fq[i]; + if (ih == 0) { + y[0] = fq[0]; + y[1] = fq[1]; + y[2] = fw; + } else { + y[0] = -fq[0]; + y[1] = -fq[1]; + y[2] = -fw; + } + } + return n & 7; +} \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_sin.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_sin.c new file mode 100644 index 000000000..3d18dff32 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_sin.c @@ -0,0 +1,80 @@ + +/* @(#)k_sin.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* __kernel_sin( x, y, iy) + * kernel sin function on [-pi/4, pi/4], pi/4 ~ 0.7854 + * Input x is assumed to be bounded by ~pi/4 in magnitude. + * Input y is the tail of x. + * Input iy indicates whether y is 0. (if iy=0, y assume to be 0). + * + * Algorithm + * 1. Since sin(-x) = -sin(x), we need only to consider positive x. + * 2. if x < 2^-27 (hx<0x3e400000 0), return x with inexact if x!=0. + * 3. sin(x) is approximated by a polynomial of degree 13 on + * [0,pi/4] + * 3 13 + * sin(x) ~ x + S1*x + ... + S6*x + * where + * + * |sin(x) 2 4 6 8 10 12 | -58 + * |----- - (1+S1*x +S2*x +S3*x +S4*x +S5*x +S6*x )| <= 2 + * | x | + * + * 4. sin(x+y) = sin(x) + sin'(x')*y + * ~ sin(x) + (1-x*x/2)*y + * For better accuracy, let + * 3 2 2 2 2 + * r = x *(S2+x *(S3+x *(S4+x *(S5+x *S6)))) + * then 3 2 + * sin(x) = x + (S1*x + (x *(r-y/2)+y)) + */ + +#include "fdlibm.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif + half + = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ + S1 = -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */ + S2 = 8.33333333332248946124e-03, /* 0x3F811111, 0x1110F8A6 */ + S3 = -1.98412698298579493134e-04, /* 0xBF2A01A0, 0x19C161D5 */ + S4 = 2.75573137070700676789e-06, /* 0x3EC71DE3, 0x57B1FE7D */ + S5 = -2.50507602534068634195e-08, /* 0xBE5AE5E6, 0x8A2B9CEB */ + S6 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */ + +#ifdef __STDC__ +double __kernel_sin(double x, double y, int iy) +#else +double __kernel_sin(x, y, iy) double x, y; +int iy; /* iy=0 if y is zero */ +#endif +{ + double z, r, v; + int ix; + ix = __HI(x) & 0x7fffffff; /* high word of x */ + if (ix < 0x3e400000) /* |x| < 2**-27 */ + { + if ((int)x == 0) + return x; + } /* generate inexact */ + z = x * x; + v = z * x; + r = S2 + z * (S3 + z * (S4 + z * (S5 + z * S6))); + if (iy == 0) + return x + v * (S1 + z * r); + else + return x - ((z * (half * y - v * r) - y) - v * S1); +} \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_tan.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_tan.c new file mode 100644 index 000000000..e90d19fde --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/k_tan.c @@ -0,0 +1,180 @@ +//=========================================================================== +// +// k_tan.c +// +// Part of the standard mathematical function library +// +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license/ +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour +// Date: 1998-02-13 +// Purpose: +// Description: +// Usage: +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +// Derived from code with the following copyright + +/* @(#)k_tan.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* __kernel_tan( x, y, k ) + * kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854 + * Input x is assumed to be bounded by ~pi/4 in magnitude. + * Input y is the tail of x. + * Input k indicates whether tan (if k=1) or + * -1/tan (if k= -1) is returned. + * + * Algorithm + * 1. Since tan(-x) = -tan(x), we need only to consider positive x. + * 2. if x < 2^-28 (hx<0x3e300000 0), return x with inexact if x!=0. + * 3. tan(x) is approximated by a odd polynomial of degree 27 on + * [0,0.67434] + * 3 27 + * tan(x) ~ x + T1*x + ... + T13*x + * where + * + * |tan(x) 2 4 26 | -59.2 + * |----- - (1+T1*x +T2*x +.... +T13*x )| <= 2 + * | x | + * + * Note: tan(x+y) = tan(x) + tan'(x)*y + * ~ tan(x) + (1+x*x)*y + * Therefore, for better accuracy in computing tan(x+y), let + * 3 2 2 2 2 + * r = x *(T2+x *(T3+x *(...+x *(T12+x *T13)))) + * then + * 3 2 + * tan(x+y) = x + (T1*x + (x *(r+y)+y)) + * + * 4. For x in [0.67434,pi/4], let y = pi/4 - x, then + * tan(x) = tan(pi/4-y) = (1-tan(y))/(1+tan(y)) + * = 1 - 2*(tan(y) - (tan(y)^2)/(1+tan(y))) + */ + +#include "math.h" +static const double one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ + pio4 = 7.85398163397448278999e-01, /* 0x3FE921FB, 0x54442D18 */ + pio4lo = 3.06161699786838301793e-17, /* 0x3C81A626, 0x33145C07 */ + T[] = { + 3.33333333333334091986e-01, /* 0x3FD55555, 0x55555563 */ + 1.33333333333201242699e-01, /* 0x3FC11111, 0x1110FE7A */ + 5.39682539762260521377e-02, /* 0x3FABA1BA, 0x1BB341FE */ + 2.18694882948595424599e-02, /* 0x3F9664F4, 0x8406D637 */ + 8.86323982359930005737e-03, /* 0x3F8226E3, 0xE96E8493 */ + 3.59207910759131235356e-03, /* 0x3F6D6D22, 0xC9560328 */ + 1.45620945432529025516e-03, /* 0x3F57DBC8, 0xFEE08315 */ + 5.88041240820264096874e-04, /* 0x3F4344D8, 0xF2F26501 */ + 2.46463134818469906812e-04, /* 0x3F3026F7, 0x1A8D1068 */ + 7.81794442939557092300e-05, /* 0x3F147E88, 0xA03792A6 */ + 7.14072491382608190305e-05, /* 0x3F12B80F, 0x32F0A7E9 */ + -1.85586374855275456654e-05, /* 0xBEF375CB, 0xDB605373 */ + 2.59073051863633712884e-05, /* 0x3EFB2A70, 0x74BF7AD4 */ + }; + +double __kernel_tan(double x, double y, int iy) +{ + double z, r, v, w, s; + int ix, hx; + hx = __HI(x); /* high word of x */ + ix = hx & 0x7fffffff; /* high word of |x| */ + if (ix < 0x3e300000) /* x < 2**-28 */ + { + if ((int)x == 0) { /* generate inexact */ + if (((ix | __LO(x)) | (iy + 1)) == 0) { + double ret = fabs(x); + return one / ret; + } else + return (iy == 1) ? x : -one / x; + } + } + if (ix >= 0x3FE59428) { /* |x|>=0.6744 */ + if (hx < 0) { + x = -x; + y = -y; + } + z = pio4 - x; + w = pio4lo - y; + x = z + w; + y = 0.0; + } + z = x * x; + w = z * z; + /* Break x^5*(T[1]+x^2*T[2]+...) into + * x^5(T[1]+x^4*T[3]+...+x^20*T[11]) + + * x^5(x^2*(T[2]+x^4*T[4]+...+x^22*[T12])) + */ + r = T[1] + w * (T[3] + w * (T[5] + w * (T[7] + w * (T[9] + w * T[11])))); + v = z * (T[2] + w * (T[4] + w * (T[6] + w * (T[8] + w * (T[10] + w * T[12]))))); + s = z * x; + r = y + z * (s * (r + v) + y); + r += T[0] * s; + w = x + r; + if (ix >= 0x3FE59428) { + v = (double)iy; + return (double)(1 - ((hx >> 30) & 2)) * (v - 2.0 * (x - (w * w / (w + v) - r))); + } + if (iy == 1) + return w; + else { /* if allow error up to 2 ulp, + simply return -1.0/(x+r) here */ + /* compute -1.0/(x+r) accurately */ + double a, t; + z = w; + __LO(z) = 0; + v = r - (z - x); /* z+v = r+x */ + t = a = -1.0 / w; /* a = -1.0/w */ + __LO(t) = 0; + s = 1.0 + t * z; + return t + a * (s + t * v); + } +} + +// EOF k_tan.c \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_atan.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_atan.c new file mode 100644 index 000000000..0f88ef2fc --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_atan.c @@ -0,0 +1,143 @@ + +/* @(#)s_atan.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + * + */ + +/* atan(x) + * Method + * 1. Reduce x to positive by atan(x) = -atan(-x). + * 2. According to the integer k=4t+0.25 chopped, t=x, the argument + * is further reduced to one of the following intervals and the + * arctangent of t is evaluated by the corresponding formula: + * + * [0,7/16] atan(x) = t-t^3*(a1+t^2*(a2+...(a10+t^2*a11)...) + * [7/16,11/16] atan(x) = atan(1/2) + atan( (t-0.5)/(1+t/2) ) + * [11/16.19/16] atan(x) = atan( 1 ) + atan( (t-1)/(1+t) ) + * [19/16,39/16] atan(x) = atan(3/2) + atan( (t-1.5)/(1+1.5t) ) + * [39/16,INF] atan(x) = atan(INF) + atan( -1/t ) + * + * Constants: + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough + * to produce the hexadecimal values shown. + */ + +#include "fdlibm.h" + +#ifdef __STDC__ +static const double atanhi[] = { +#else +static double atanhi[] = { +#endif + 4.63647609000806093515e-01, /* atan(0.5)hi 0x3FDDAC67, 0x0561BB4F */ + 7.85398163397448278999e-01, /* atan(1.0)hi 0x3FE921FB, 0x54442D18 */ + 9.82793723247329054082e-01, /* atan(1.5)hi 0x3FEF730B, 0xD281F69B */ + 1.57079632679489655800e+00, /* atan(inf)hi 0x3FF921FB, 0x54442D18 */ +}; + +#ifdef __STDC__ +static const double atanlo[] = { +#else +static double atanlo[] = { +#endif + 2.26987774529616870924e-17, /* atan(0.5)lo 0x3C7A2B7F, 0x222F65E2 */ + 3.06161699786838301793e-17, /* atan(1.0)lo 0x3C81A626, 0x33145C07 */ + 1.39033110312309984516e-17, /* atan(1.5)lo 0x3C700788, 0x7AF0CBBD */ + 6.12323399573676603587e-17, /* atan(inf)lo 0x3C91A626, 0x33145C07 */ +}; + +#ifdef __STDC__ +static const double aT[] = { +#else +static double aT[] = { +#endif + 3.33333333333329318027e-01, /* 0x3FD55555, 0x5555550D */ + -1.99999999998764832476e-01, /* 0xBFC99999, 0x9998EBC4 */ + 1.42857142725034663711e-01, /* 0x3FC24924, 0x920083FF */ + -1.11111104054623557880e-01, /* 0xBFBC71C6, 0xFE231671 */ + 9.09088713343650656196e-02, /* 0x3FB745CD, 0xC54C206E */ + -7.69187620504482999495e-02, /* 0xBFB3B0F2, 0xAF749A6D */ + 6.66107313738753120669e-02, /* 0x3FB10D66, 0xA0D03D51 */ + -5.83357013379057348645e-02, /* 0xBFADDE2D, 0x52DEFD9A */ + 4.97687799461593236017e-02, /* 0x3FA97B4B, 0x24760DEB */ + -3.65315727442169155270e-02, /* 0xBFA2B444, 0x2C6A6C2F */ + 1.62858201153657823623e-02, /* 0x3F90AD3A, 0xE322DA11 */ +}; + +#ifdef __STDC__ +static const double +#else +static double +#endif + one + = 1.0, + huge = 1.0e300; + +#ifdef __STDC__ +double atan(double x) +#else +double atan(x) double x; +#endif +{ + double w, s1, s2, z; + int ix, hx, id; + + hx = __HI(x); + ix = hx & 0x7fffffff; + if (ix >= 0x44100000) { /* if |x| >= 2^66 */ + if (ix > 0x7ff00000 || (ix == 0x7ff00000 && (__LO(x) != 0))) + return x + x; /* NaN */ + if (hx > 0) + return atanhi[3] + atanlo[3]; + else + return -atanhi[3] - atanlo[3]; + } + if (ix < 0x3fdc0000) { /* |x| < 0.4375 */ + if (ix < 0x3e200000) { /* |x| < 2^-29 */ + if (huge + x > one) + return x; /* raise inexact */ + } + id = -1; + } else { + x = __fabs(x); + if (ix < 0x3ff30000) { /* |x| < 1.1875 */ + if (ix < 0x3fe60000) { /* 7/16 <=|x|<11/16 */ + id = 0; + x = (2.0 * x - one) / (2.0 + x); + } else { /* 11/16<=|x|< 19/16 */ + id = 1; + x = (x - one) / (x + one); + } + } else { + if (ix < 0x40038000) { /* |x| < 2.4375 */ + id = 2; + x = (x - 1.5) / (one + 1.5 * x); + } else { /* 2.4375 <= |x| < 2^66 */ + id = 3; + x = -1.0 / x; + } + } + } + /* end of argument reduction */ + z = x * x; + w = z * z; + /* break sum from i=0 to 10 aT[i]z**(i+1) into odd and even poly */ + s1 = z * (aT[0] + w * (aT[2] + w * (aT[4] + w * (aT[6] + w * (aT[8] + w * aT[10]))))); + s2 = w * (aT[1] + w * (aT[3] + w * (aT[5] + w * (aT[7] + w * aT[9])))); + if (id < 0) + return x - x * (s1 + s2); + else { + z = atanhi[id] - ((x * (s1 + s2) - atanlo[id]) - x); + return (hx < 0) ? -z : z; + } +} \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_copysign.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_copysign.c new file mode 100644 index 000000000..14fd4ae8c --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_copysign.c @@ -0,0 +1,30 @@ + +/* @(#)s_copysign.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * copysign(double x, double y) + * copysign(x,y) returns a value with the magnitude of x and + * with the sign bit of y. + */ + +#include "fdlibm.h" + +#ifdef __STDC__ +double copysign(double x, double y) +#else +double copysign(x, y) double x, y; +#endif +{ + __HI(x) = (__HI(x) & 0x7fffffff) | (__HI(y) & 0x80000000); + return x; +} \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_cos.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_cos.c new file mode 100644 index 000000000..f1d4d56d1 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_cos.c @@ -0,0 +1,81 @@ +/* @(#)s_cos.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* cos(x) + * Return cosine function of x. + * + * kernel function: + * __kernel_sin ... sine function on [-pi/4,pi/4] + * __kernel_cos ... cosine function on [-pi/4,pi/4] + * __ieee754_rem_pio2 ... argument reduction routine + * + * Method. + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * in [-pi/4 , +pi/4], and let n = k mod 4. + * We have + * + * n sin(x) cos(x) tan(x) + * ---------------------------------------------------------- + * 0 S C T + * 1 C -S -1/T + * 2 -S -C T + * 3 -C S -1/T + * ---------------------------------------------------------- + * + * Special cases: + * Let trig be any of sin, cos, or tan. + * trig(+-INF) is NaN, with signals; + * trig(NaN) is that NaN; + * + * Accuracy: + * TRIG(x) returns trig(x) nearly rounded + */ + +#include "fdlibm.h" + +#ifdef __STDC__ +double cos(double x) +#else +double cos(x) double x; +#endif +{ + double y[2], z = 0.0; + int n, ix; + + /* High word of x. */ + ix = __HI(x); + + /* |x| ~< pi/4 */ + ix &= 0x7fffffff; + if (ix <= 0x3fe921fb) + return __kernel_cos(x, z); + + /* cos(Inf or NaN) is NaN */ + else if (ix >= 0x7ff00000) + return x - x; + + /* argument reduction needed */ + else { + n = __ieee754_rem_pio2(x, y); + switch (n & 3) { + case 0: + return __kernel_cos(y[0], y[1]); + case 1: + return -__kernel_sin(y[0], y[1], 1); + case 2: + return -__kernel_cos(y[0], y[1]); + default: + return __kernel_sin(y[0], y[1], 1); + } + } +} \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_floor.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_floor.c new file mode 100644 index 000000000..3eea609ce --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_floor.c @@ -0,0 +1,89 @@ + +/* @(#)s_floor.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * floor(x) + * Return x rounded toward -inf to integral value + * Method: + * Bit twiddling. + * Exception: + * Inexact flag raised if x not equal to floor(x). + */ + +#include "fdlibm.h" + +#ifdef __STDC__ +static const double huge = 1.0e300; +#else +static double huge = 1.0e300; +#endif + +#ifdef __STDC__ +double floor(double x) +#else +double floor(x) double x; +#endif +{ + int i0, i1, j0; + unsigned i, j; + i0 = __HI(x); + i1 = __LO(x); + j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + if (j0 < 20) { + if (j0 < 0) { /* raise inexact if x != 0 */ + if (huge + x > 0.0) { /* return 0*sign(x) if |x|<1 */ + if (i0 >= 0) { + i0 = i1 = 0; + } else if (((i0 & 0x7fffffff) | i1) != 0) { + i0 = 0xbff00000; + i1 = 0; + } + } + } else { + i = (0x000fffff) >> j0; + if (((i0 & i) | i1) == 0) + return x; /* x is integral */ + if (huge + x > 0.0) { /* raise inexact flag */ + if (i0 < 0) + i0 += (0x00100000) >> j0; + i0 &= (~i); + i1 = 0; + } + } + } else if (j0 > 51) { + if (j0 == 0x400) + return x + x; /* inf or NaN */ + else + return x; /* x is integral */ + } else { + i = ((unsigned)(0xffffffff)) >> (j0 - 20); + if ((i1 & i) == 0) + return x; /* x is integral */ + if (huge + x > 0.0) { /* raise inexact flag */ + if (i0 < 0) { + if (j0 == 20) + i0 += 1; + else { + j = i1 + (1 << (52 - j0)); + if (j < i1) + i0 += 1; /* got a carry */ + i1 = j; + } + } + i1 &= (~i); + } + } + __HI(x) = i0; + __LO(x) = i1; + return x; +} \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_frexp.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_frexp.c new file mode 100644 index 000000000..48bcbf21e --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_frexp.c @@ -0,0 +1,57 @@ + +/* @(#)s_frexp.c 1.4 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * for non-zero x + * x = frexp(arg,&exp); + * return a double fp quantity x such that 0.5 <= |x| <1.0 + * and the corresponding binary exponent "exp". That is + * arg = x*2^exp. + * If arg is inf, 0.0, or NaN, then frexp(arg,&exp) returns arg + * with *exp=0. + */ + +#include "fdlibm.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif + two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */ + +#ifdef __STDC__ +double frexp(double x, int* eptr) +#else +double frexp(x, eptr) double x; +int* eptr; +#endif +{ + int hx, ix, lx; + hx = __HI(x); + ix = 0x7fffffff & hx; + lx = __LO(x); + *eptr = 0; + if (ix >= 0x7ff00000 || ((ix | lx) == 0)) + return x; /* 0,inf,nan */ + if (ix < 0x00100000) { /* subnormal */ + x *= two54; + hx = __HI(x); + ix = hx & 0x7fffffff; + *eptr = -54; + } + *eptr += (ix >> 20) - 1022; + hx = (hx & 0x800fffff) | 0x3fe00000; + __HI(x) = hx; + return x; +} \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_ldexp.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_ldexp.c new file mode 100644 index 000000000..fb238872d --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_ldexp.c @@ -0,0 +1,58 @@ +/* @(#)s_ldexp.c 1.2 95/01/04 */ +/* $Id: s_ldexp.c,v 1.3.14.1 2002/01/31 15:24:14 ceciliar Exp $ */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#include "math.h" /* for isfinite macro */ +static const double + + two54 + = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ + twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */ + big = 1.0e+300, tiny = 1.0e-300; + +double ldexp(double x, int n) +{ + long k, hx, lx; /*- cc 020130 -*/ + if (!isfinite(x) || x == 0.0) + return x; + + hx = __HI(x); + lx = __LO(x); + k = (hx & 0x7ff00000) >> 20; /* extract exponent */ + if (k == 0) { /* 0 or subnormal x */ + if ((lx | (hx & 0x7fffffff)) == 0) + return x; /* +-0 */ + x *= two54; + hx = __HI(x); + k = ((hx & 0x7ff00000) >> 20) - 54; + if (n < -50000) + return tiny * x; /*underflow*/ + } + if (k == 0x7ff) + return x + x; /* NaN or Inf */ + k = k + n; + if (k > 0x7fe) + return big * copysign(big, x); /* overflow */ + if (k > 0) /* normal result */ + { + __HI(x) = (hx & 0x800fffff) | (k << 20); + return x; + } + if (k <= -54) + if (n > 50000) /* in case integer overflow in n+k */ + return big * copysign(big, x); /*overflow*/ + else + return tiny * copysign(tiny, x); /*underflow*/ + k += 54; /* subnormal result */ + __HI(x) = (hx & 0x800fffff) | (k << 20); + return x * twom54; +} \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_modf.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_modf.c new file mode 100644 index 000000000..63357bb06 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_modf.c @@ -0,0 +1,79 @@ + +/* @(#)s_modf.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * modf(double x, double *iptr) + * return fraction part of x, and return x's integral part in *iptr. + * Method: + * Bit twiddling. + * + * Exception: + * No exception. + */ + +#include "fdlibm.h" + +#ifdef __STDC__ +static const double one = 1.0; +#else +static double one = 1.0; +#endif + +#ifdef __STDC__ +double modf(double x, double* iptr) +#else +double modf(x, iptr) double x, *iptr; +#endif +{ + int i0, i1, j0; + unsigned i; + i0 = __HI(x); /* high x */ + i1 = __LO(x); /* low x */ + j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; /* exponent of x */ + if (j0 < 20) { /* integer part in high x */ + if (j0 < 0) { /* |x|<1 */ + __HIp(iptr) = i0 & 0x80000000; + __LOp(iptr) = 0; /* *iptr = +-0 */ + return x; + } else { + i = (0x000fffff) >> j0; + if (((i0 & i) | i1) == 0) { /* x is integral */ + *iptr = x; + __HI(x) &= 0x80000000; + __LO(x) = 0; /* return +-0 */ + return x; + } else { + __HIp(iptr) = i0 & (~i); + __LOp(iptr) = 0; + return x - *iptr; + } + } + } else if (j0 > 51) { /* no fraction part */ + *iptr = x * one; + __HI(x) &= 0x80000000; + __LO(x) = 0; /* return +-0 */ + return x; + } else { /* fraction part in low x */ + i = ((unsigned)(0xffffffff)) >> (j0 - 20); + if ((i1 & i) == 0) { /* x is integral */ + *iptr = x; + __HI(x) &= 0x80000000; + __LO(x) = 0; /* return +-0 */ + return x; + } else { + __HIp(iptr) = i0; + __LOp(iptr) = i1 & (~i); + return x - *iptr; + } + } +} \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_sin.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_sin.c new file mode 100644 index 000000000..b2ba68868 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_sin.c @@ -0,0 +1,82 @@ + +/* @(#)s_sin.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* sin(x) + * Return sine function of x. + * + * kernel function: + * __kernel_sin ... sine function on [-pi/4,pi/4] + * __kernel_cos ... cose function on [-pi/4,pi/4] + * __ieee754_rem_pio2 ... argument reduction routine + * + * Method. + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * in [-pi/4 , +pi/4], and let n = k mod 4. + * We have + * + * n sin(x) cos(x) tan(x) + * ---------------------------------------------------------- + * 0 S C T + * 1 C -S -1/T + * 2 -S -C T + * 3 -C S -1/T + * ---------------------------------------------------------- + * + * Special cases: + * Let trig be any of sin, cos, or tan. + * trig(+-INF) is NaN, with signals; + * trig(NaN) is that NaN; + * + * Accuracy: + * TRIG(x) returns trig(x) nearly rounded + */ + +#include "fdlibm.h" + +#ifdef __STDC__ +double sin(double x) +#else +double sin(x) double x; +#endif +{ + double y[2], z = 0.0; + int n, ix; + + /* High word of x. */ + ix = __HI(x); + + /* |x| ~< pi/4 */ + ix &= 0x7fffffff; + if (ix <= 0x3fe921fb) + return __kernel_sin(x, z, 0); + + /* sin(Inf or NaN) is NaN */ + else if (ix >= 0x7ff00000) + return x - x; + + /* argument reduction needed */ + else { + n = __ieee754_rem_pio2(x, y); + switch (n & 3) { + case 0: + return __kernel_sin(y[0], y[1], 1); + case 1: + return __kernel_cos(y[0], y[1]); + case 2: + return -__kernel_sin(y[0], y[1], 1); + default: + return -__kernel_cos(y[0], y[1]); + } + } +} \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_tan.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_tan.c new file mode 100644 index 000000000..77d77a18a --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/s_tan.c @@ -0,0 +1,73 @@ + +/* @(#)s_tan.c 1.3 95/01/18 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunSoft, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* tan(x) + * Return tangent function of x. + * + * kernel function: + * __kernel_tan ... tangent function on [-pi/4,pi/4] + * __ieee754_rem_pio2 ... argument reduction routine + * + * Method. + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * in [-pi/4 , +pi/4], and let n = k mod 4. + * We have + * + * n sin(x) cos(x) tan(x) + * ---------------------------------------------------------- + * 0 S C T + * 1 C -S -1/T + * 2 -S -C T + * 3 -C S -1/T + * ---------------------------------------------------------- + * + * Special cases: + * Let trig be any of sin, cos, or tan. + * trig(+-INF) is NaN, with signals; + * trig(NaN) is that NaN; + * + * Accuracy: + * TRIG(x) returns trig(x) nearly rounded + */ + +#include "fdlibm.h" + +#ifdef __STDC__ +double tan(double x) +#else +double tan(x) double x; +#endif +{ + double y[2], z = 0.0; + int n, ix; + + /* High word of x. */ + ix = __HI(x); + + /* |x| ~< pi/4 */ + ix &= 0x7fffffff; + if (ix <= 0x3fe921fb) + return __kernel_tan(x, z, 1); + + /* tan(Inf or NaN) is NaN */ + else if (ix >= 0x7ff00000) + return x - x; /* NaN */ + + /* argument reduction needed */ + else { + n = __ieee754_rem_pio2(x, y); + return __kernel_tan(y[0], y[1], 1 - ((n & 1) << 1)); /* 1 -- n even + -1 -- n odd */ + } +} \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_acos.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_acos.c new file mode 100644 index 000000000..a6c331a10 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_acos.c @@ -0,0 +1,6 @@ +#include "fdlibm.h" + +/* 8036C6E0-8036C700 367020 0020+00 0/0 2/2 3/3 .text acos */ +double acos(double x) { + return __ieee754_acos(x); +} \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_asin.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_asin.c new file mode 100644 index 000000000..aa43f56c0 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_asin.c @@ -0,0 +1,6 @@ +#include "fdlibm.h" + +/* 8036C700-8036C720 367040 0020+00 0/0 2/2 0/0 .text asin */ +double asin(double x) { + return __ieee754_asin(x); +} diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_atan2.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_atan2.c new file mode 100644 index 000000000..8a2dd2ec7 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_atan2.c @@ -0,0 +1,6 @@ +#include "fdlibm.h" + +/* 8036C720-8036C740 367060 0020+00 0/0 6/6 0/0 .text atan2 */ +double atan2(double x, double y) { + return __ieee754_atan2(x, y); +} \ No newline at end of file diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_fmod.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_fmod.c new file mode 100644 index 000000000..2d24fd153 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Double_precision/w_fmod.c @@ -0,0 +1,6 @@ +#include "fdlibm.h" + +/* 8036C760-8036C780 3670A0 0020+00 0/0 8/8 0/0 .text fmod */ +double fmod(double x, double y) { + return __ieee754_fmod(x, y); +} diff --git a/include/fdlibm.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Include/fdlibm.h similarity index 97% rename from include/fdlibm.h rename to src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Include/fdlibm.h index 4d34b0a5b..407419ba5 100644 --- a/include/fdlibm.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Include/fdlibm.h @@ -37,11 +37,11 @@ extern "C" { #endif // TODO: should __STDC__ actually be defined? -// #ifdef __STDC__ +//#ifdef __STDC__ #define __P(p) p -// #else -// #define __P(p) () -// #endif +//#else +//#define __P(p) () +//#endif /* * ANSI/POSIX @@ -81,8 +81,8 @@ struct exception { #define HUGE MAXFLOAT /* - * set X_TLOSS = pi*2**52, which is possibly defined in - * (one may replace the following line by "#include ") + * set X_TLOSS = pi*2**52, which is possibly defined in > (bits_not_checked - n); + + while (bits_not_checked) { + if (!(x & mask)) { + result += mask_size; + x >>= mask_size; + bits_not_checked -= mask_size; + } else if (mask == 1) { + break; + } + + if (n > 1) { + n /= 2; + } + + if (mask > 1) { + mask >>= n; + mask_size -= n; + } + } + return result; +} + +static inline int __count_trailing_zero(double x) { + unsigned long* l = (unsigned long*)&x; + + if (l[1] != 0) { + return __count_trailing_zerol(l[1]); + } + + return (int)(sizeof(unsigned long) * CHAR_BIT + __count_trailing_zerol(l[0] | 0x00100000)); +} + +static inline int __must_round(const decimal* d, int digits) { + unsigned char const* i = d->sig.text + digits; + + if (*i > 5) { + return 1; + } + + if (*i < 5) { + return -1; + } + + { + unsigned char const* e = d->sig.text + d->sig.length; + + for (i++; i < e; i++) { + if (*i != 0) { + return 1; + } + } + } + + if (d->sig.text[digits - 1] & 1) { + return 1; + } + + return -1; +} + +static inline void __dorounddecup(decimal* d, int digits) { + unsigned char* b = d->sig.text; + unsigned char* i = b + digits - 1; + + while (1) { + if (*i < 9) { + *i += 1; + break; + } + if (i == b) { + *i = 1; + d->exp++; + break; + } + *i-- = 0; + } +} + +static inline void __rounddec(decimal* d, int digits) { + if (digits > 0 && digits < d->sig.length) { + int unkBool = __must_round(d, digits); + d->sig.length = digits; + + if (unkBool >= 0) { + __dorounddecup(d, digits); + } + } +} + +void __ull2dec(decimal* result, unsigned long long val) { + result->sign = 0; + + if (val == 0) { + result->exp = 0; + result->sig.length = 1; + result->sig.text[0] = 0; + return; + } + + if (val < 0) { + val = -val; + result->sign = 1; + } + + result->sig.length = 0; + + for (; val != 0; val /= 10) { + result->sig.text[result->sig.length++] = (unsigned char)(val % 10); + } + + { + unsigned char* i = result->sig.text; + unsigned char* j = result->sig.text + result->sig.length; + + for (; i < --j; ++i) { + unsigned char t = *i; + *i = *j; + *j = t; + } + } + + result->exp = result->sig.length - 1; +} + +void __timesdec(decimal* result, const decimal* x, const decimal* y) { + unsigned long accumulator = 0; + unsigned char mantissa[SIGDIGLEN * 2]; + int i = x->sig.length + y->sig.length - 1; + unsigned char* pDigit; + unsigned char* ip = mantissa + i + 1; + unsigned char* ep = ip; + + result->sign = 0; + + for (; i > 0; i--) { + int k = y->sig.length - 1; + int j = i - k - 1; + int l; + int t; + const unsigned char* jp; + const unsigned char* kp; + + if (j < 0) { + j = 0; + k = i - 1; + } + + jp = x->sig.text + j; + kp = y->sig.text + k; + l = k + 1; + t = x->sig.length - j; + + if (l > t) + l = t; + + for (; l > 0; l--, jp++, kp--) { + accumulator += *jp * *kp; + } + + *--ip = (unsigned char)(accumulator % 10); + accumulator /= 10; + } + + result->exp = (short)(x->exp + y->exp); + + if (accumulator) { + *--ip = (unsigned char)(accumulator); + result->exp++; + } + + for (i = 0; i < SIGDIGLEN && ip < ep; i++, ip++) { + result->sig.text[i] = *ip; + } + result->sig.length = (unsigned char)(i); + + if (ip < ep && *ip >= 5) { + if (*ip == 5) { + unsigned char* jp = ip + 1; + for (; jp < ep; jp++) { + if (*jp != 0) + goto round; + } + if ((ip[-1] & 1) == 0) + return; + } + round: + __dorounddecup(result, result->sig.length); + } +} + +void __str2dec(decimal* d, const char* s, short exp) { + int i; + + d->exp = exp; + d->sign = 0; + + for (i = 0; i < SIGDIGLEN && *s;) { + d->sig.text[i++] = *s++ - '0'; + } + d->sig.length = i; + + if (*s != 0) { + if (*s < 5) + return; + + { + const char* p = s + 1; + + for (; *p != 0; p++) { + if (*p != '0') + goto round; + } + + if ((d->sig.text[i - 1] & 1) == 0) + return; + } + round: + __dorounddecup(d, d->sig.length); + } +} + +static const char* const unused = "179769313486231580793729011405303420"; + +void __two_exp(decimal* result, long exp) { + switch (exp) { + case -64: + __str2dec(result, "542101086242752217003726400434970855712890625", -20); + return; + case -53: + __str2dec(result, "11102230246251565404236316680908203125", -16); + return; + case -32: + __str2dec(result, "23283064365386962890625", -10); + return; + case -16: + __str2dec(result, "152587890625", -5); + return; + case -8: + __str2dec(result, "390625", -3); + return; + case -7: + __str2dec(result, "78125", -3); + return; + case -6: + __str2dec(result, "15625", -2); + return; + case -5: + __str2dec(result, "3125", -2); + return; + case -4: + __str2dec(result, "625", -2); + return; + case -3: + __str2dec(result, "125", -1); + return; + case -2: + __str2dec(result, "25", -1); + return; + case -1: + __str2dec(result, "5", -1); + return; + case 0: + __str2dec(result, "1", 0); + return; + case 1: + __str2dec(result, "2", 0); + return; + case 2: + __str2dec(result, "4", 0); + return; + case 3: + __str2dec(result, "8", 0); + return; + case 4: + __str2dec(result, "16", 1); + return; + case 5: + __str2dec(result, "32", 1); + return; + case 6: + __str2dec(result, "64", 1); + return; + case 7: + __str2dec(result, "128", 2); + return; + case 8: + __str2dec(result, "256", 2); + return; + } + + { + decimal x2, temp; + + __two_exp(&x2, exp / 2); + __timesdec(result, &x2, &x2); + + if (exp & 1) { + temp = *result; + if (exp > 0) { + __str2dec(&x2, "2", 0); + } else { + __str2dec(&x2, "5", -1); + } + __timesdec(result, &temp, &x2); + } + } +} + +int inline __equals_dec(const decimal* x, const decimal* y) { + if (x->sig.text[0] == 0) { + if (y->sig.text[0] == 0) + return 1; + return 0; + } + if (y->sig.text[0] == 0) { + if (x->sig.text[0] == 0) + return 1; + return 0; + } + + if (x->exp == y->exp) { + int i; + int l = x->sig.length; + + if (l > y->sig.length) { + l = y->sig.length; + } + + for (i = 0; i < l; i++) { + if (x->sig.text[i] != y->sig.text[i]) { + return 0; + } + } + + if (l == x->sig.length) { + for (; i < y->sig.length; ++i) { + if (y->sig.text[i] != 0) { + return 0; + } + } + } else { + for (; i < x->sig.length; ++i) { + if (x->sig.text[i] != 0) { + return 0; + } + } + } + + return 1; + } + return 0; +} + +int inline __less_dec(const decimal* x, const decimal* y) { + if (x->sig.text[0] == 0) { + if (y->sig.text[0] != 0) + return 1; + return 0; + } + + if (y->sig.text[0] == 0) { + return 0; + } + + if (x->exp == y->exp) { + int i; + int l = x->sig.length; + + if (l > y->sig.length) { + l = y->sig.length; + } + + for (i = 0; i < l; i++) { + if (x->sig.text[i] < y->sig.text[i]) { + return 1; + } else if (y->sig.text[i] < x->sig.text[i]) { + return 0; + } + } + + if (l == x->sig.length) { + for (; i < y->sig.length; i++) { + if (y->sig.text[i] != 0) { + return 1; + } + } + } + return 0; + } + + return x->exp < y->exp; +} + +void inline __minus_dec(decimal* z, const decimal* x, const decimal* y) { + int zlen, dexp; + unsigned char *ib, *i, *ie; + unsigned char const *jb, *j, *jn; + + *z = *x; + + if (y->sig.text[0] == 0) + return; + + zlen = z->sig.length; + if (zlen < y->sig.length) + zlen = y->sig.length; + + dexp = z->exp - y->exp; + zlen += dexp; + + if (zlen > SIGDIGLEN) + zlen = SIGDIGLEN; + + while (z->sig.length < zlen) { + z->sig.text[z->sig.length++] = 0; + } + + ib = z->sig.text; + i = ib + zlen; + + if (y->sig.length + dexp < zlen) { + i = ib + (y->sig.length + dexp); + } + + jb = y->sig.text; + j = jb + (i - ib - dexp); + jn = j; + + while (i > ib && j > jb) { + i--; + j--; + if (*i < *j) { + unsigned char* k = i - 1; + while (*k == 0) + k--; + while (k != i) { + --*k; + *++k += 10; + } + } + *i -= *j; + } + + if (jn - jb < y->sig.length) { + int round_down = 0; + if (*jn < 5) + round_down = 1; + else if (*jn == 5) { + unsigned char const* ibPtr = y->sig.text + y->sig.length; + + for (j = jn + 1; j < ibPtr; j++) { + if (*j != 0) + goto done; + } + i = ib + (jn - jb) + dexp - 1; + if (*i & 1) + round_down = 1; + } + if (round_down) { + if (*i < 1) { + unsigned char* k = i - 1; + while (*k == 0) + k--; + while (k != i) { + --*k; + *++k += 10; + } + } + *i -= 1; + } + } +done: + for (i = ib; *i == 0; ++i) { + } + + if (i > ib) { + unsigned char dl = (unsigned char)(i - ib); + z->exp -= dl; + ie = ib + z->sig.length; + for (; i < ie; ++i, ++ib) + *ib = *i; + z->sig.length -= dl; + } + + ib = z->sig.text; + for (i = ib + z->sig.length; i > ib;) { + i--; + if (*i != 0) + break; + } + z->sig.length = (unsigned char)(i - ib + 1); +} + +void __num2dec_internal(decimal* d, double x) { + signed char sign = (signed char)(signbit(x) != 0); + + if (x == 0) { + d->sign = sign; + d->exp = 0; + d->sig.length = 1; + d->sig.text[0] = 0; + return; + } + + if (!isfinite(x)) { + d->sign = sign; + d->exp = 0; + d->sig.length = 1; + d->sig.text[0] = fpclassify(x) == 1 ? 'N' : 'I'; + return; + } + + if (sign != 0) { + x = -x; + } + + { + int exp; + double frac = frexp(x, &exp); + long num_bits_extract = DBL_MANT_DIG - __count_trailing_zero(frac); + double integer; + decimal int_d, pow2_d; + + __two_exp(&pow2_d, exp - num_bits_extract); + frac = modf(ldexp(frac, num_bits_extract), &integer); + __ull2dec(&int_d, (unsigned long long)integer); + __timesdec(d, &int_d, &pow2_d); + d->sign = sign; + } +} + +void __num2dec(const decform* form, double x, decimal* d) { + short digits = form->digits; + int i; + __num2dec_internal(d, x); + + if (d->sig.text[0] > 9) { + return; + } + + if (digits > SIGDIGLEN) { + digits = SIGDIGLEN; + } + + __rounddec(d, digits); + + while (d->sig.length < digits) { + d->sig.text[d->sig.length++] = 0; + } + + d->exp -= d->sig.length - 1; + + for (i = 0; i < d->sig.length; i++) { + d->sig.text[i] += '0'; + } +} diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Src/uart_console_io.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Src/uart_console_io.c new file mode 100644 index 000000000..23b145747 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Src/uart_console_io.c @@ -0,0 +1,34 @@ +int __TRK_write_console(int, int, int*, int); + +int __write_console(int param_0, int param_1, int* param_2, int param_3) { + if (__init_uart_console() != 0) { + return 1; + } + + if (WriteUARTN(param_1, *param_2) != 0) { + *param_2 = 0; + return 1; + } + + __TRK_write_console(param_0, param_1, param_2, param_3); + return 0; +} + +int __close_console() { + return 0; +} + +static inline int __init_uart_console(void) { + static int initialized = 0; + int ret = 0; + + if (initialized == 0) { + ret = InitializeUART(0xE100); + + if (ret == 0) { + initialized = 1; + } + } + + return ret; +} diff --git a/include/MSL_C/PPC_EABI/Src/critical_regions.gamecube.h b/src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Include/critical_regions.gamecube.h similarity index 98% rename from include/MSL_C/PPC_EABI/Src/critical_regions.gamecube.h rename to src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Include/critical_regions.gamecube.h index 71e111efd..fd099812d 100644 --- a/include/MSL_C/PPC_EABI/Src/critical_regions.gamecube.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Include/critical_regions.gamecube.h @@ -1,4 +1,6 @@ #ifndef PPC_EABI_SRC_CRITICAL_REGIONSGAMECUBE_H #define PPC_EABI_SRC_CRITICAL_REGIONSGAMECUBE_H + + #endif /* PPC_EABI_SRC_CRITICAL_REGIONSGAMECUBE_H */ diff --git a/include/MSL_C/PPC_EABI/Src/math_ppc.h b/src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Include/math_ppc.h similarity index 98% rename from include/MSL_C/PPC_EABI/Src/math_ppc.h rename to src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Include/math_ppc.h index 0458cd892..4882e9fa8 100644 --- a/include/MSL_C/PPC_EABI/Src/math_ppc.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Include/math_ppc.h @@ -1,4 +1,6 @@ #ifndef PPC_EABI_SRC_MATH_PPC_H #define PPC_EABI_SRC_MATH_PPC_H + + #endif /* PPC_EABI_SRC_MATH_PPC_H */ diff --git a/include/MSL_C/PPC_EABI/Src/uart_console_io_gcn.h b/src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Include/uart_console_io_gcn.h similarity index 75% rename from include/MSL_C/PPC_EABI/Src/uart_console_io_gcn.h rename to src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Include/uart_console_io_gcn.h index a821c1e85..e428ccd31 100644 --- a/include/MSL_C/PPC_EABI/Src/uart_console_io_gcn.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Include/uart_console_io_gcn.h @@ -1,6 +1,6 @@ #ifndef PPC_EABI_SRC_UART_CONSOLE_IO_GCN_H #define PPC_EABI_SRC_UART_CONSOLE_IO_GCN_H -#include "MSL_C/MSL_Common/Src/ansi_files.h" +#include "ansi_files.h" #endif /* PPC_EABI_SRC_UART_CONSOLE_IO_GCN_H */ diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Src/math_ppc.c b/src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Src/math_ppc.c new file mode 100644 index 000000000..3f6350835 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Src/math_ppc.c @@ -0,0 +1,18 @@ +#include "math_ppc.h" +#include "fdlibm.h" + +__declspec(weak) float acosf(float x) { + return acos(x); +} + +__declspec(weak) float cosf(float x) { + return cos(x); +} + +__declspec(weak) float sinf(float x) { + return sin(x); +} + +__declspec(weak) float tanf(float x) { + return tan(x); +} diff --git a/include/Runtime.PPCEABI.H/CPlusLibPPC.h b/src/PowerPC_EABI_Support/Runtime/Inc/CPlusLibPPC.h similarity index 100% rename from include/Runtime.PPCEABI.H/CPlusLibPPC.h rename to src/PowerPC_EABI_Support/Runtime/Inc/CPlusLibPPC.h diff --git a/include/Runtime.PPCEABI.H/GCN_mem_alloc.h b/src/PowerPC_EABI_Support/Runtime/Inc/GCN_mem_alloc.h similarity index 98% rename from include/Runtime.PPCEABI.H/GCN_mem_alloc.h rename to src/PowerPC_EABI_Support/Runtime/Inc/GCN_mem_alloc.h index 0b880b91b..06c3e1592 100644 --- a/include/Runtime.PPCEABI.H/GCN_mem_alloc.h +++ b/src/PowerPC_EABI_Support/Runtime/Inc/GCN_mem_alloc.h @@ -1,4 +1,5 @@ #ifndef GCN_MEM_ALLOC_H #define GCN_MEM_ALLOC_H + #endif /* GCN_MEM_ALLOC_H */ diff --git a/include/Runtime.PPCEABI.H/Gecko_ExceptionPPC.h b/src/PowerPC_EABI_Support/Runtime/Inc/Gecko_ExceptionPPC.h similarity index 98% rename from include/Runtime.PPCEABI.H/Gecko_ExceptionPPC.h rename to src/PowerPC_EABI_Support/Runtime/Inc/Gecko_ExceptionPPC.h index d4ba9ec84..bac6ad663 100644 --- a/include/Runtime.PPCEABI.H/Gecko_ExceptionPPC.h +++ b/src/PowerPC_EABI_Support/Runtime/Inc/Gecko_ExceptionPPC.h @@ -1,4 +1,5 @@ #ifndef GECKO_EXCEPTIONPPC_H #define GECKO_EXCEPTIONPPC_H + #endif /* GECKO_EXCEPTIONPPC_H */ diff --git a/include/Runtime.PPCEABI.H/NMWException.h b/src/PowerPC_EABI_Support/Runtime/Inc/NMWException.h similarity index 77% rename from include/Runtime.PPCEABI.H/NMWException.h rename to src/PowerPC_EABI_Support/Runtime/Inc/NMWException.h index 3767fb52f..1bf7d39e2 100644 --- a/include/Runtime.PPCEABI.H/NMWException.h +++ b/src/PowerPC_EABI_Support/Runtime/Inc/NMWException.h @@ -1,8 +1,7 @@ -#ifndef _NMWEXCEPTION -#define _NMWEXCEPTION +#ifndef NMWEXCEPTION_H +#define NMWEXCEPTION_H -#include "dolphin/types.h" -#include "Runtime.PPCEABI.H/__ppc_eabi_linker.h" +#include "__ppc_eabi_linker.h" #ifdef __cplusplus extern "C" { @@ -24,5 +23,4 @@ void __destroy_global_chain(void); #ifdef __cplusplus } #endif - -#endif // _NMWEXCEPTION +#endif /* NMWEXCEPTION_H */ diff --git a/include/Runtime.PPCEABI.H/__init_cpp_exceptions.h b/src/PowerPC_EABI_Support/Runtime/Inc/__init_cpp_exceptions.h similarity index 100% rename from include/Runtime.PPCEABI.H/__init_cpp_exceptions.h rename to src/PowerPC_EABI_Support/Runtime/Inc/__init_cpp_exceptions.h diff --git a/include/Runtime.PPCEABI.H/__ppc_eabi_linker.h b/src/PowerPC_EABI_Support/Runtime/Inc/__ppc_eabi_linker.h similarity index 100% rename from include/Runtime.PPCEABI.H/__ppc_eabi_linker.h rename to src/PowerPC_EABI_Support/Runtime/Inc/__ppc_eabi_linker.h diff --git a/include/Runtime.PPCEABI.H/__va_arg.h b/src/PowerPC_EABI_Support/Runtime/Inc/__va_arg.h similarity index 86% rename from include/Runtime.PPCEABI.H/__va_arg.h rename to src/PowerPC_EABI_Support/Runtime/Inc/__va_arg.h index 002836108..e45e0751d 100644 --- a/include/Runtime.PPCEABI.H/__va_arg.h +++ b/src/PowerPC_EABI_Support/Runtime/Inc/__va_arg.h @@ -19,7 +19,7 @@ extern "C" void* __va_arg(_va_list_struct*, int); void* __va_arg(_va_list_struct*, int); #endif -#if __INTELLISENSE__ +#if IN_VSCODE_EDITOR #define __builtin_va_info(...) #define _var_arg_typeof(...) #endif @@ -28,9 +28,9 @@ void* __va_arg(_va_list_struct*, int); // __builtin_va_info: initialize the __va_list_struct // _var_arg_typeof: convert type to integer for __va_arg #define __va_start(list, fmt) __builtin_va_info(&list) -// #define __va_arg(list, type) (*((type*)__va_arg(ap, _var_arg_typeof(type)))) +#define __va_arg(list, type) (*((type*)__va_arg(list, _var_arg_typeof(type)))) #define va_start __va_start -// #define va_arg __va_arg +#define va_arg __va_arg #define va_end __va_end #define va_list __va_list #define __va_end(list) ((void)0) diff --git a/include/Runtime.PPCEABI.H/global_destructor_chain.h b/src/PowerPC_EABI_Support/Runtime/Inc/global_destructor_chain.h similarity index 99% rename from include/Runtime.PPCEABI.H/global_destructor_chain.h rename to src/PowerPC_EABI_Support/Runtime/Inc/global_destructor_chain.h index 1f568e353..c344a3a75 100644 --- a/include/Runtime.PPCEABI.H/global_destructor_chain.h +++ b/src/PowerPC_EABI_Support/Runtime/Inc/global_destructor_chain.h @@ -1,4 +1,5 @@ #ifndef GLOBAL_DESTRUCTOR_CHAIN_H #define GLOBAL_DESTRUCTOR_CHAIN_H + #endif /* GLOBAL_DESTRUCTOR_CHAIN_H */ diff --git a/include/Runtime.PPCEABI.H/ptmf.h b/src/PowerPC_EABI_Support/Runtime/Inc/ptmf.h similarity index 67% rename from include/Runtime.PPCEABI.H/ptmf.h rename to src/PowerPC_EABI_Support/Runtime/Inc/ptmf.h index cc22aa42c..450d703ad 100644 --- a/include/Runtime.PPCEABI.H/ptmf.h +++ b/src/PowerPC_EABI_Support/Runtime/Inc/ptmf.h @@ -10,9 +10,4 @@ typedef struct __ptmf { } f_data; } __ptmf; -const __ptmf __ptmf_null; -long __ptmf_test(__ptmf* ptmf); -void __ptmf_cmpr(register __ptmf* this, register __ptmf* other); -void __ptmf_scall(...); - #endif /* PTMF_H */ diff --git a/include/Runtime.PPCEABI.H/runtime.h b/src/PowerPC_EABI_Support/Runtime/Inc/runtime.h similarity index 100% rename from include/Runtime.PPCEABI.H/runtime.h rename to src/PowerPC_EABI_Support/Runtime/Inc/runtime.h diff --git a/src/Runtime.PPCEABI.H/CPlusLibPPC.cp b/src/PowerPC_EABI_Support/Runtime/Src/CPlusLibPPC.cp similarity index 100% rename from src/Runtime.PPCEABI.H/CPlusLibPPC.cp rename to src/PowerPC_EABI_Support/Runtime/Src/CPlusLibPPC.cp diff --git a/src/Runtime.PPCEABI.H/GCN_mem_alloc.c b/src/PowerPC_EABI_Support/Runtime/Src/GCN_Mem_Alloc.c similarity index 93% rename from src/Runtime.PPCEABI.H/GCN_mem_alloc.c rename to src/PowerPC_EABI_Support/Runtime/Src/GCN_Mem_Alloc.c index e5eb716d3..7b5c45b41 100644 --- a/src/Runtime.PPCEABI.H/GCN_mem_alloc.c +++ b/src/PowerPC_EABI_Support/Runtime/Src/GCN_Mem_Alloc.c @@ -1,7 +1,6 @@ -#include "Runtime.PPCEABI.H/GCN_mem_alloc.h" +#include "GCN_mem_alloc.h" #include "dolphin/os/OS.h" - inline static void InitDefaultHeap() { void* arenaLo; void* arenaHi; diff --git a/src/Runtime.PPCEABI.H/Gecko_ExceptionPPC.cp b/src/PowerPC_EABI_Support/Runtime/Src/Gecko_ExceptionPPC.cp similarity index 89% rename from src/Runtime.PPCEABI.H/Gecko_ExceptionPPC.cp rename to src/PowerPC_EABI_Support/Runtime/Src/Gecko_ExceptionPPC.cp index 26405d657..aaef53c5d 100644 --- a/src/Runtime.PPCEABI.H/Gecko_ExceptionPPC.cp +++ b/src/PowerPC_EABI_Support/Runtime/Src/Gecko_ExceptionPPC.cp @@ -1,5 +1,5 @@ -#include "Runtime.PPCEABI.H/NMWException.h" -#include "Runtime.PPCEABI.H/__ppc_eabi_linker.h" +#include "NMWException.h" +#include "__ppc_eabi_linker.h" #if __MWERKS__ #pragma exceptions on diff --git a/src/PowerPC_EABI_Support/Runtime/Src/NMWException.cp b/src/PowerPC_EABI_Support/Runtime/Src/NMWException.cp new file mode 100644 index 000000000..97885901e --- /dev/null +++ b/src/PowerPC_EABI_Support/Runtime/Src/NMWException.cp @@ -0,0 +1 @@ +#include "NMWException.h" diff --git a/src/Runtime.PPCEABI.H/__init_cpp_exceptions.cpp b/src/PowerPC_EABI_Support/Runtime/Src/__init_cpp_exceptions.cpp similarity index 91% rename from src/Runtime.PPCEABI.H/__init_cpp_exceptions.cpp rename to src/PowerPC_EABI_Support/Runtime/Src/__init_cpp_exceptions.cpp index 8f02369b3..50caec44d 100644 --- a/src/Runtime.PPCEABI.H/__init_cpp_exceptions.cpp +++ b/src/PowerPC_EABI_Support/Runtime/Src/__init_cpp_exceptions.cpp @@ -1,5 +1,5 @@ -#include "Runtime.PPCEABI.H/NMWException.h" -#include "Runtime.PPCEABI.H/__ppc_eabi_linker.h" +#include "NMWException.h" +#include "__ppc_eabi_linker.h" #if __MWERKS__ #pragma exceptions off diff --git a/src/Runtime.PPCEABI.H/__mem.c b/src/PowerPC_EABI_Support/Runtime/Src/__mem.c similarity index 97% rename from src/Runtime.PPCEABI.H/__mem.c rename to src/PowerPC_EABI_Support/Runtime/Src/__mem.c index 6e4709d86..e4e282b3c 100644 --- a/src/Runtime.PPCEABI.H/__mem.c +++ b/src/PowerPC_EABI_Support/Runtime/Src/__mem.c @@ -1,5 +1,5 @@ #include "dolphin/types.h" -#include "Runtime.PPCEABI.H/__mem.h" +#include "string.h" void* memcpy(void* dst, const void* src, size_t n) { diff --git a/src/Runtime.PPCEABI.H/__va_arg.c b/src/PowerPC_EABI_Support/Runtime/Src/__va_arg.c similarity index 95% rename from src/Runtime.PPCEABI.H/__va_arg.c rename to src/PowerPC_EABI_Support/Runtime/Src/__va_arg.c index ed948223a..b2f5fc5b8 100644 --- a/src/Runtime.PPCEABI.H/__va_arg.c +++ b/src/PowerPC_EABI_Support/Runtime/Src/__va_arg.c @@ -1,4 +1,6 @@ -#include "Runtime.PPCEABI.H/__va_arg.h" +#include "__va_arg.h" + +#undef __va_arg void* __va_arg(va_list v_list, int type) { char* addr; diff --git a/src/Runtime.PPCEABI.H/global_destructor_chain.c b/src/PowerPC_EABI_Support/Runtime/Src/global_destructor_chain.c similarity index 94% rename from src/Runtime.PPCEABI.H/global_destructor_chain.c rename to src/PowerPC_EABI_Support/Runtime/Src/global_destructor_chain.c index a849ec0b8..ec01e8f38 100644 --- a/src/Runtime.PPCEABI.H/global_destructor_chain.c +++ b/src/PowerPC_EABI_Support/Runtime/Src/global_destructor_chain.c @@ -1,4 +1,4 @@ -#include "Runtime.PPCEABI.H/NMWException.h" +#include "NMWException.h" DestructorChain* __global_destructor_chain; diff --git a/src/Runtime.PPCEABI.H/ptmf.c b/src/PowerPC_EABI_Support/Runtime/Src/ptmf.c similarity index 96% rename from src/Runtime.PPCEABI.H/ptmf.c rename to src/PowerPC_EABI_Support/Runtime/Src/ptmf.c index 8ba0bd98c..42919e58c 100644 --- a/src/Runtime.PPCEABI.H/ptmf.c +++ b/src/PowerPC_EABI_Support/Runtime/Src/ptmf.c @@ -1,4 +1,4 @@ -#include "Runtime.PPCEABI.H/ptmf.h" +#include "ptmf.h" const __ptmf __ptmf_null = { 0, 0, 0 }; diff --git a/src/PowerPC_EABI_Support/Runtime/Src/runtime.c b/src/PowerPC_EABI_Support/Runtime/Src/runtime.c new file mode 100644 index 000000000..a32369336 --- /dev/null +++ b/src/PowerPC_EABI_Support/Runtime/Src/runtime.c @@ -0,0 +1,777 @@ +#include "PowerPC_EABI_Support/Runtime/Inc/runtime.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* macros for GPR/FPR resting and saving */ +#define SAVE_FPR(reg) _savefpr_##reg +#define RESTORE_FPR(reg) _restfpr_##reg +#define SAVE_GPR(reg) _savegpr_##reg +#define RESTORE_GPR(reg) _restgpr_##reg + +#define ENTRY_SAVE_FPR(reg) entry SAVE_FPR(reg) +#define ENTRY_RESTORE_FPR(reg) entry RESTORE_FPR(reg) +#define ENTRY_SAVE_GPR(reg) entry SAVE_GPR(reg) +#define ENTRY_RESTORE_GPR(reg) entry RESTORE_GPR(reg) + +#define save_restore_reg r11 + +asm void __div2u(void); +asm void __div2i(void); +asm void __mod2u(void); +asm void __mod2i(void); +asm void __shl2i(void); +asm void __shr2u(void); +asm void __shr2i(void); +asm void __cvt_dbl_usll(void); + +void SAVE_FPR(14)(void); +void SAVE_FPR(15)(void); +void SAVE_FPR(16)(void); +void SAVE_FPR(17)(void); +void SAVE_FPR(18)(void); +void SAVE_FPR(19)(void); +void SAVE_FPR(20)(void); +void SAVE_FPR(21)(void); +void SAVE_FPR(22)(void); +void SAVE_FPR(23)(void); +void SAVE_FPR(24)(void); +void SAVE_FPR(25)(void); +void SAVE_FPR(26)(void); +void SAVE_FPR(27)(void); +void SAVE_FPR(28)(void); +void SAVE_FPR(29)(void); +void SAVE_FPR(30)(void); +void SAVE_FPR(31)(void); + +void RESTORE_FPR(14)(void); +void RESTORE_FPR(15)(void); +void RESTORE_FPR(16)(void); +void RESTORE_FPR(17)(void); +void RESTORE_FPR(18)(void); +void RESTORE_FPR(19)(void); +void RESTORE_FPR(20)(void); +void RESTORE_FPR(21)(void); +void RESTORE_FPR(22)(void); +void RESTORE_FPR(23)(void); +void RESTORE_FPR(24)(void); +void RESTORE_FPR(25)(void); +void RESTORE_FPR(26)(void); +void RESTORE_FPR(27)(void); +void RESTORE_FPR(28)(void); +void RESTORE_FPR(29)(void); +void RESTORE_FPR(30)(void); +void RESTORE_FPR(31)(void); + +void SAVE_GPR(14)(void); +void SAVE_GPR(15)(void); +void SAVE_GPR(16)(void); +void SAVE_GPR(17)(void); +void SAVE_GPR(18)(void); +void SAVE_GPR(19)(void); +void SAVE_GPR(20)(void); +void SAVE_GPR(21)(void); +void SAVE_GPR(22)(void); +void SAVE_GPR(23)(void); +void SAVE_GPR(24)(void); +void SAVE_GPR(25)(void); +void SAVE_GPR(26)(void); +void SAVE_GPR(27)(void); +void SAVE_GPR(28)(void); +void SAVE_GPR(29)(void); +void SAVE_GPR(30)(void); +void SAVE_GPR(31)(void); + +void RESTORE_GPR(14)(void); +void RESTORE_GPR(15)(void); +void RESTORE_GPR(16)(void); +void RESTORE_GPR(17)(void); +void RESTORE_GPR(18)(void); +void RESTORE_GPR(19)(void); +void RESTORE_GPR(20)(void); +void RESTORE_GPR(21)(void); +void RESTORE_GPR(22)(void); +void RESTORE_GPR(23)(void); +void RESTORE_GPR(24)(void); +void RESTORE_GPR(25)(void); +void RESTORE_GPR(26)(void); +void RESTORE_GPR(27)(void); +void RESTORE_GPR(28)(void); +void RESTORE_GPR(29)(void); +void RESTORE_GPR(30)(void); +void RESTORE_GPR(31)(void); + +static const u32 __constants[] = { + 0x00000000, 0x00000000, 0x41F00000, 0x00000000, 0x41E00000, 0x00000000, +}; + +/** + * @note Address: 0x800C1B4C + * @note Size: 0x5C + */ +asm u32 __cvt_fp2unsigned(register f64 d) +{ +#ifdef __MWERKS__ // clang-format off + nofralloc + stwu r1,-16(r1) + lis r4, __constants@h + ori r4, r4, __constants@l + li r3,0 + lfd fp0,0(r4) + lfd fp3,8(r4) + lfd fp4,16(r4) + fcmpu cr0,fp1,fp0 + fcmpu cr6,fp1,fp3 + blt cr0, @exit + addi r3,r3,-1 + bge cr6,@exit + fcmpu cr7,fp1,fp4 + fmr fp2,fp1 + blt cr7,@1 + fsub fp2,fp1,fp4 +@1 fctiwz fp2,fp2 + stfd fp2,8(r1) + lwz r3,12(r1) + blt cr7,@exit + addis r3,r3,-0x8000 +@exit: + addi r1,r1,16 + blr +#endif // clang-format on +} + +/** + * @note Address: 0x800C1BA8 + * @note Size: 0x4C + */ +asm static void __save_fpr(void) { +#ifdef __MWERKS__ // clang-format off + nofralloc + stfd fp14,-144(save_restore_reg) + stfd fp15,-136(save_restore_reg) + stfd fp16,-128(save_restore_reg) + stfd fp17,-120(save_restore_reg) + stfd fp18,-112(save_restore_reg) + stfd fp19,-104(save_restore_reg) + stfd fp20,-96(save_restore_reg) + stfd fp21,-88(save_restore_reg) + stfd fp22,-80(save_restore_reg) + stfd fp23,-72(save_restore_reg) + stfd fp24,-64(save_restore_reg) + ENTRY_SAVE_FPR(25) + stfd fp25,-56(save_restore_reg) + ENTRY_SAVE_FPR(26) + stfd fp26,-48(save_restore_reg) + stfd fp27,-40(save_restore_reg) + ENTRY_SAVE_FPR(28) + stfd fp28,-32(save_restore_reg) + ENTRY_SAVE_FPR(29) + stfd fp29,-24(save_restore_reg) + stfd fp30,-16(save_restore_reg) + stfd fp31,-8(save_restore_reg) + blr +#endif // clang-format on +} + +/** + * @note Address: 0x800C1BF4 + * @note Size: 0x4C + */ +asm static void __restore_fpr(void) { +#ifdef __MWERKS__ // clang-format off + nofralloc + lfd fp14,-144(save_restore_reg) + lfd fp15,-136(save_restore_reg) + lfd fp16,-128(save_restore_reg) + lfd fp17,-120(save_restore_reg) + lfd fp18,-112(save_restore_reg) + lfd fp19,-104(save_restore_reg) + lfd fp20,-96(save_restore_reg) + lfd fp21,-88(save_restore_reg) + lfd fp22,-80(save_restore_reg) + lfd fp23,-72(save_restore_reg) + lfd fp24,-64(save_restore_reg) + ENTRY_RESTORE_FPR(25) + lfd fp25,-56(save_restore_reg) + ENTRY_RESTORE_FPR(26) + lfd fp26,-48(save_restore_reg) + lfd fp27,-40(save_restore_reg) + ENTRY_RESTORE_FPR(28) + lfd fp28,-32(save_restore_reg) + ENTRY_RESTORE_FPR(29) + lfd fp29,-24(save_restore_reg) + lfd fp30,-16(save_restore_reg) + lfd fp31,-8(save_restore_reg) + blr +#endif // clang-format on +} + +/** + * @note Address: 0x800C1C40 + * @note Size: 0x4C + */ +asm static void __save_gpr(void) { +#ifdef __MWERKS__ // clang-format off + nofralloc + ENTRY_SAVE_GPR(14) + stw r14,-72(save_restore_reg) + ENTRY_SAVE_GPR(15) + stw r15,-68(save_restore_reg) + ENTRY_SAVE_GPR(16) + stw r16,-64(save_restore_reg) + ENTRY_SAVE_GPR(17) + stw r17,-60(save_restore_reg) + ENTRY_SAVE_GPR(18) + stw r18,-56(save_restore_reg) + ENTRY_SAVE_GPR(19) + stw r19,-52(save_restore_reg) + ENTRY_SAVE_GPR(20) + stw r20,-48(save_restore_reg) + ENTRY_SAVE_GPR(21) + stw r21,-44(save_restore_reg) + ENTRY_SAVE_GPR(22) + stw r22,-40(save_restore_reg) + ENTRY_SAVE_GPR(23) + stw r23,-36(save_restore_reg) + ENTRY_SAVE_GPR(24) + stw r24,-32(save_restore_reg) + ENTRY_SAVE_GPR(25) + stw r25,-28(save_restore_reg) + ENTRY_SAVE_GPR(26) + stw r26,-24(save_restore_reg) + ENTRY_SAVE_GPR(27) + stw r27,-20(save_restore_reg) + ENTRY_SAVE_GPR(28) + stw r28,-16(save_restore_reg) + ENTRY_SAVE_GPR(29) + stw r29,-12(save_restore_reg) + stw r30,-8(save_restore_reg) + stw r31,-4(save_restore_reg) + blr +#endif // clang-format on +} + +/** + * @note Address: 0x800C1C8C + * @note Size: 0x4C + */ +asm static void __restore_gpr(void) { +#ifdef __MWERKS__ // clang-format off + nofralloc + ENTRY_RESTORE_GPR(14) + lwz r14,-72(save_restore_reg) + ENTRY_RESTORE_GPR(15) + lwz r15,-68(save_restore_reg) + ENTRY_RESTORE_GPR(16) + lwz r16,-64(save_restore_reg) + ENTRY_RESTORE_GPR(17) + lwz r17,-60(save_restore_reg) + ENTRY_RESTORE_GPR(18) + lwz r18,-56(save_restore_reg) + ENTRY_RESTORE_GPR(19) + lwz r19,-52(save_restore_reg) + ENTRY_RESTORE_GPR(20) + lwz r20,-48(save_restore_reg) + ENTRY_RESTORE_GPR(21) + lwz r21,-44(save_restore_reg) + ENTRY_RESTORE_GPR(22) + lwz r22,-40(save_restore_reg) + ENTRY_RESTORE_GPR(23) + lwz r23,-36(save_restore_reg) + ENTRY_RESTORE_GPR(24) + lwz r24,-32(save_restore_reg) + ENTRY_RESTORE_GPR(25) + lwz r25,-28(save_restore_reg) + ENTRY_RESTORE_GPR(26) + lwz r26,-24(save_restore_reg) + ENTRY_RESTORE_GPR(27) + lwz r27,-20(save_restore_reg) + ENTRY_RESTORE_GPR(28) + lwz r28,-16(save_restore_reg) + ENTRY_RESTORE_GPR(29) + lwz r29,-12(save_restore_reg) + lwz r30,-8(save_restore_reg) + lwz r31,-4(save_restore_reg) + blr +#endif // clang-format on +} + +/** + * @note Address: 0x800C1CD8 + * @note Size: 0xEC + */ +asm void __div2u(void) { +#ifdef __MWERKS__ // clang-format off + nofralloc + cmpwi cr0,r3,0 + cntlzw r0,r3 + cntlzw r9,r4 + bne cr0,lab1 + addi r0,r9,32 +lab1: + cmpwi cr0,r5,0 + cntlzw r9,r5 + cntlzw r10,r6 + bne cr0,lab2 + addi r9,r10,32 +lab2: + cmpw cr0,r0,r9 + subfic r10,r0,64 + bgt cr0,lab9 + addi r9,r9,1 + subfic r9,r9,64 + add r0,r0,r9 + subf r9,r9,r10 + mtctr r9 + cmpwi cr0,r9,32 + addi r7,r9,-32 + blt cr0,lab3 + srw r8,r3,r7 + li r7,0 + b lab4 +lab3: + srw r8,r4,r9 + subfic r7,r9,32 + slw r7,r3,r7 + or r8,r8,r7 + srw r7,r3,r9 +lab4: + cmpwi cr0,r0,32 + addic r9,r0,-32 + blt cr0,lab5 + slw r3,r4,r9 + li r4,0 + b lab6 +lab5: + slw r3,r3,r0 + subfic r9,r0,32 + srw r9,r4,r9 + or r3,r3,r9 + slw r4,r4,r0 +lab6: + li r10,-1 + addic r7,r7,0 +lab7: + adde r4,r4,r4 + adde r3,r3,r3 + adde r8,r8,r8 + adde r7,r7,r7 + subfc r0,r6,r8 + subfe. r9,r5,r7 + blt cr0,lab8 + mr r8,r0 + mr r7,r9 + addic r0,r10,1 +lab8: + bdnz lab7 + adde r4,r4,r4 + adde r3,r3,r3 + blr +lab9: + li r4,0 + li r3,0 + blr +#endif // clang-format on +} + +/** + * @note Address: 0x800C1DC4 + * @note Size: 0x138 + */ +asm void __div2i(void) { +#ifdef __MWERKS__ // clang-format off + nofralloc + stwu r1,-16(r1) + rlwinm. r9,r3,0,0,0 + beq cr0,positive1 + subfic r4,r4,0 + subfze r3,r3 +positive1: + stw r9,8(r1) + rlwinm. r10,r5,0,0,0 + beq cr0,positive2 + subfic r6,r6,0 + subfze r5,r5 +positive2: + stw r10,12(r1) + cmpwi cr0,r3,0 + cntlzw r0,r3 + cntlzw r9,r4 + bne cr0,lab1 + addi r0,r9,32 +lab1: + cmpwi cr0,r5,0 + cntlzw r9,r5 + cntlzw r10,r6 + bne cr0,lab2 + addi r9,r10,32 +lab2: + cmpw cr0,r0,r9 + subfic r10,r0,64 + bgt cr0,lab9 + addi r9,r9,1 + subfic r9,r9,64 + add r0,r0,r9 + subf r9,r9,r10 + mtctr r9 + cmpwi cr0,r9,32 + addi r7,r9,-32 + blt cr0,lab3 + srw r8,r3,r7 + li r7,0 + b lab4 +lab3: + srw r8,r4,r9 + subfic r7,r9,32 + slw r7,r3,r7 + or r8,r8,r7 + srw r7,r3,r9 +lab4: + cmpwi cr0,r0,32 + addic r9,r0,-32 + blt cr0,lab5 + slw r3,r4,r9 + li r4,0 + b lab6 +lab5: + slw r3,r3,r0 + subfic r9,r0,32 + srw r9,r4,r9 + or r3,r3,r9 + slw r4,r4,r0 +lab6: + li r10,-1 + addic r7,r7,0 +lab7: + adde r4,r4,r4 + adde r3,r3,r3 + adde r8,r8,r8 + adde r7,r7,r7 + subfc r0,r6,r8 + subfe. r9,r5,r7 + blt cr0,lab8 + mr r8,r0 + mr r7,r9 + addic r0,r10,1 +lab8: + bdnz lab7 + adde r4,r4,r4 + adde r3,r3,r3 + lwz r9,8(r1) + lwz r10,12(r1) + xor. r7,r9,r10 + beq cr0,no_adjust + cmpwi cr0,r9,0 + subfic r4,r4,0 + subfze r3,r3 + +no_adjust: + b func_end + +lab9: + li r4,0 + li r3,0 +func_end: + addi r1,r1,16 + blr +#endif // clang-format on +} + +/** + * @note Address: 0x800C1EFC + * @note Size: 0xE4 + */ +asm void __mod2u(void) { +#ifdef __MWERKS__ // clang-format off + nofralloc + cmpwi cr0,r3,0 + cntlzw r0,r3 + cntlzw r9,r4 + bne cr0,lab1 + addi r0,r9,32 +lab1: + cmpwi cr0,r5,0 + cntlzw r9,r5 + cntlzw r10,r6 + bne cr0,lab2 + addi r9,r10,32 +lab2: + cmpw cr0,r0,r9 + subfic r10,r0,64 + bgt cr0,lab9 + addi r9,r9,1 + subfic r9,r9,64 + add r0,r0,r9 + subf r9,r9,r10 + mtctr r9 + cmpwi cr0,r9,32 + addi r7,r9,-32 + blt cr0,lab3 + srw r8,r3,r7 + li r7,0 + b lab4 +lab3: + srw r8,r4,r9 + subfic r7,r9,32 + slw r7,r3,r7 + or r8,r8,r7 + srw r7,r3,r9 +lab4: + cmpwi cr0,r0,32 + addic r9,r0,-32 + blt cr0,lab5 + slw r3,r4,r9 + li r4,0 + b lab6 +lab5: + slw r3,r3,r0 + subfic r9,r0,32 + srw r9,r4,r9 + or r3,r3,r9 + slw r4,r4,r0 +lab6: + li r10,-1 + addic r7,r7,0 +lab7: + adde r4,r4,r4 + adde r3,r3,r3 + adde r8,r8,r8 + adde r7,r7,r7 + subfc r0,r6,r8 + subfe. r9,r5,r7 + blt cr0,lab8 + mr r8,r0 + mr r7,r9 + addic r0,r10,1 +lab8: + bdnz lab7 + mr r4,r8 + mr r3,r7 + blr +lab9: + blr +#endif // clang-format on +} + +/** + * @note Address: 0x800C1FE0 + * @note Size: 0x10C + */ +asm void __mod2i(void) { +#ifdef __MWERKS__ // clang-format off + nofralloc + + cmpwi cr7,r3,0 + bge cr7,positive1 + subfic r4,r4,0 + subfze r3,r3 +positive1: + cmpwi cr0,r5,0 + bge cr0,positive2 + subfic r6,r6,0 + subfze r5,r5 +positive2: + cmpwi cr0,r3,0 + cntlzw r0,r3 + cntlzw r9,r4 + bne cr0,lab1 + addi r0,r9,32 +lab1: + cmpwi cr0,r5,0 + cntlzw r9,r5 + cntlzw r10,r6 + bne cr0,lab2 + addi r9,r10,32 +lab2: + cmpw cr0,r0,r9 + subfic r10,r0,64 + bgt cr0,lab9 + addi r9,r9,1 + subfic r9,r9,64 + add r0,r0,r9 + subf r9,r9,r10 + mtctr r9 + cmpwi cr0,r9,32 + addi r7,r9,-32 + blt cr0,lab3 + srw r8,r3,r7 + li r7,0 + b lab4 +lab3: + srw r8,r4,r9 + subfic r7,r9,32 + slw r7,r3,r7 + or r8,r8,r7 + srw r7,r3,r9 +lab4: + cmpwi cr0,r0,32 + addic r9,r0,-32 + blt cr0,lab5 + slw r3,r4,r9 + li r4,0 + b lab6 +lab5: + slw r3,r3,r0 + subfic r9,r0,32 + srw r9,r4,r9 + or r3,r3,r9 + slw r4,r4,r0 +lab6: + li r10,-1 + addic r7,r7,0 +lab7: + adde r4,r4,r4 + adde r3,r3,r3 + adde r8,r8,r8 + adde r7,r7,r7 + subfc r0,r6,r8 + subfe. r9,r5,r7 + blt cr0,lab8 + mr r8,r0 + mr r7,r9 + addic r0,r10,1 +lab8: + bdnz lab7 + mr r4,r8 + mr r3,r7 +lab9: + bge cr7,no_adjust + subfic r4,r4,0 + subfze r3,r3 +no_adjust: + blr +#endif // clang-format on +} + +/** + * @note Address: 0x800C20EC + * @note Size: 0x24 + */ +asm void __shl2i(void) { +#ifdef __MWERKS__ // clang-format off + nofralloc + subfic r8,r5,32 + subic r9,r5,32 + slw r3,r3,r5 + srw r10,r4,r8 + or r3,r3,r10 + slw r10,r4,r9 + or r3,r3,r10 + slw r4,r4,r5 + blr +#endif // clang-format on +} + +/** + * @note Address: 0x800C2110 + * @note Size: 0x24 + */ +asm void __shr2u(void) { +#ifdef __MWERKS__ // clang-format off + nofralloc + subfic r8,r5,32 + subic r9,r5,32 + srw r4,r4,r5 + slw r10,r3,r8 + or r4,r4,r10 + srw r10,r3,r9 + or r4,r4,r10 + srw r3,r3,r5 + blr +#endif // clang-format on +} + +/** + * @note Address: 0x800C2134 + * @note Size: 0x28 + */ +asm void __shr2i(void) { +#ifdef __MWERKS__ // clang-format off + nofralloc + subfic r8, r5, 0x20 + addic. r9, r5, -0x20 + srw r4, r4, r5 + slw r10, r3, r8 + or r4, r4, r10 + sraw r10, r3, r9 + ble around + or r4, r4, r10 +around: + sraw r3, r3, r5 + blr +#endif // clang-format on +} + +/** + * @note Address: 0x800C21F8 + * @note Size: 0xCC + */ +asm void __cvt_dbl_usll(void) +{ +#ifdef __MWERKS__ // clang-format off + nofralloc + stwu r1,-16(r1) + stfd f1,8(r1) + lwz r3,8(r1) + lwz r4,12(r1) + rlwinm r5,r3,12,21,31 + cmpli cr0,0,r5,1023 + bge cr0,not_fraction + li r3,0 + li r4,0 + b func_end +not_fraction: + mr r6,r3 + rlwinm r3,r3,0,12,31 + oris r3,r3,0x0010 + addi r5,r5,-1075 + cmpwi cr0,r5,0 + bge cr0,left + neg r5,r5 + subfic r8,r5,32 + subic r9,r5,32 + srw r4,r4,r5 + slw r10,r3,r8 + or r4,r4,r10 + srw r10,r3,r9 + or r4,r4,r10 + srw r3,r3,r5 + b around +left: + cmpwi cr0,r5,10 + ble+ no_overflow + rlwinm. r6,r6,0,0,0 + beq cr0,max_positive + lis r3,0x8000 + li r4,0 + b func_end +max_positive: + lis r3,0x7FFF + ori r3,r3,0xFFFF + li r4,-1 + b func_end +no_overflow: + subfic r8,r5,32 + subic r9,r5,32 + slw r3,r3,r5 + srw r10,r4,r8 + or r3,r3,r10 + slw r10,r4,r9 + or r3,r3,r10 + slw r4,r4,r5 +around: + rlwinm. r6,r6,0,0,0 + beq cr0,positive + subfic r4,r4,0 + subfze r3,r3 +positive: +func_end: + addi r1,r1,16 + blr +#endif // clang-format on +} + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/src/Runtime.PPCEABI.H/NMWException.cp b/src/Runtime.PPCEABI.H/NMWException.cp deleted file mode 100644 index 58f0f7ad3..000000000 --- a/src/Runtime.PPCEABI.H/NMWException.cp +++ /dev/null @@ -1 +0,0 @@ -#include "Runtime.PPCEABI.H/NMWException.h" diff --git a/src/Runtime.PPCEABI.H/runtime.c b/src/Runtime.PPCEABI.H/runtime.c deleted file mode 100644 index be7f22376..000000000 --- a/src/Runtime.PPCEABI.H/runtime.c +++ /dev/null @@ -1 +0,0 @@ -#include "Runtime.PPCEABI.H/runtime.h" diff --git a/src/SSystem/SComponent/c_data_tbl.cpp b/src/SSystem/SComponent/c_data_tbl.cpp index 2f17a6ba6..959ce37d5 100644 --- a/src/SSystem/SComponent/c_data_tbl.cpp +++ b/src/SSystem/SComponent/c_data_tbl.cpp @@ -4,7 +4,7 @@ // #include "SSystem/SComponent/c_data_tbl.h" -#include "MSL_C/string.h" +#include "string.h" /* 80254974-80254990 .text __ct__12cDT_NamePTblFv */ cDT_NamePTbl::cDT_NamePTbl() { diff --git a/src/SSystem/SComponent/c_lib.cpp b/src/SSystem/SComponent/c_lib.cpp index 280a2e52c..56f48ba28 100644 --- a/src/SSystem/SComponent/c_lib.cpp +++ b/src/SSystem/SComponent/c_lib.cpp @@ -4,7 +4,7 @@ // #include "SSystem/SComponent/c_lib.h" -#include "MSL_C/string.h" +#include "string.h" #include "SSystem/SComponent/c_math.h" #include "dolphin/mtx/mtxvec.h" diff --git a/src/SSystem/SComponent/c_m2d_g_box.cpp b/src/SSystem/SComponent/c_m2d_g_box.cpp index 97aabcc9a..c20f794c4 100644 --- a/src/SSystem/SComponent/c_m2d_g_box.cpp +++ b/src/SSystem/SComponent/c_m2d_g_box.cpp @@ -4,7 +4,7 @@ // #include "SSystem/SComponent/c_m2d_g_box.h" -#include "MSL_C/math.h" +#include "math.h" #include "dolphin/types.h" /* 8024A0E0-8024A104 .text Set__8cM2dGBoxFR3cXyR3cXy */ diff --git a/src/SSystem/SComponent/c_m3d.cpp b/src/SSystem/SComponent/c_m3d.cpp index 2910076df..2d3897e9d 100644 --- a/src/SSystem/SComponent/c_m3d.cpp +++ b/src/SSystem/SComponent/c_m3d.cpp @@ -13,7 +13,7 @@ #include "SSystem/SComponent/c_m3d_g_sph.h" #include "SSystem/SComponent/c_m3d_g_tri.h" #include "SSystem/SComponent/c_math.h" -#include "MSL_C/float.h" +#include "float.h" // TODO: these should be in .sdata2 f32 G_CM3D_F_ABS_MIN = 3.814697e-06; diff --git a/src/SSystem/SComponent/c_m3d_g_cyl.cpp b/src/SSystem/SComponent/c_m3d_g_cyl.cpp index 8fe53520d..771213f33 100644 --- a/src/SSystem/SComponent/c_m3d_g_cyl.cpp +++ b/src/SSystem/SComponent/c_m3d_g_cyl.cpp @@ -6,7 +6,7 @@ #include "SSystem/SComponent/c_m3d_g_cyl.h" #include "SSystem/SComponent/c_m3d.h" #include "JSystem/JUtility/JUTAssert.h" -#include "MSL_C/float.h" +#include "float.h" #define CHECK_FLOAT_CLASS(line, x) JUT_ASSERT(line, !(((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) : __fpclassifyd((double)(x)) ) == 1)); #define CHECK_FLOAT_RANGE(line, x) JUT_ASSERT(line, -1.0e32f < x && x < 1.0e32f); diff --git a/src/SSystem/SComponent/c_m3d_g_sph.cpp b/src/SSystem/SComponent/c_m3d_g_sph.cpp index d6845ba71..354a83560 100644 --- a/src/SSystem/SComponent/c_m3d_g_sph.cpp +++ b/src/SSystem/SComponent/c_m3d_g_sph.cpp @@ -6,7 +6,7 @@ #include "SSystem/SComponent/c_m3d_g_sph.h" #include "SSystem/SComponent/c_m3d.h" #include "JSystem/JUtility/JUTAssert.h" -#include "MSL_C/float.h" +#include "float.h" #define CHECK_FLOAT_CLASS(line, x) JUT_ASSERT(line, !(((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) : __fpclassifyd((double)(x)) ) == 1)); #define CHECK_FLOAT_RANGE(line, x) JUT_ASSERT(line, -1.0e32f < x && x < 1.0e32f); diff --git a/src/SSystem/SComponent/c_math.cpp b/src/SSystem/SComponent/c_math.cpp index 7f9e190c0..f959e0fb7 100644 --- a/src/SSystem/SComponent/c_math.cpp +++ b/src/SSystem/SComponent/c_math.cpp @@ -5,7 +5,7 @@ #include "SSystem/SComponent/c_math.h" #include "SSystem/SComponent/c_m3d.h" -#include "MSL_C/math.h" +#include "math.h" #include "dolphin/types.h" /* 80246044-8024609C .text cM_rad2s__Ff */ diff --git a/src/SSystem/SComponent/c_xyz.cpp b/src/SSystem/SComponent/c_xyz.cpp index 9dfc954be..0fa538e63 100644 --- a/src/SSystem/SComponent/c_xyz.cpp +++ b/src/SSystem/SComponent/c_xyz.cpp @@ -5,7 +5,7 @@ #include "SSystem/SComponent/c_xyz.h" #include "JSystem/JUtility/JUTAssert.h" -#include "MSL_C/float.h" +#include "float.h" #include "SSystem/SComponent/c_math.h" const cXyz cXyz::Zero(0, 0, 0); diff --git a/src/c/c_dylink.cpp b/src/c/c_dylink.cpp index 7e621be7a..76243b866 100644 --- a/src/c/c_dylink.cpp +++ b/src/c/c_dylink.cpp @@ -15,7 +15,7 @@ #include "JSystem/JKernel/JKRSolidHeap.h" #include "DynamicLink.h" #include "dolphin/os/OS.h" -#include "MSL_C/string.h" +#include "string.h" DynamicModuleControlBase * DMC[PROC_COUNT_e]; bool DMC_initialized = false; diff --git a/src/d/actor/d_a_bg.cpp b/src/d/actor/d_a_bg.cpp index 094ab3c50..26bb12426 100644 --- a/src/d/actor/d_a_bg.cpp +++ b/src/d/actor/d_a_bg.cpp @@ -20,6 +20,7 @@ #include "JSystem/JKernel/JKRExpHeap.h" #include "JSystem/JKernel/JKRSolidHeap.h" #include "JSystem/JUtility/JUTAssert.h" +#include "printf.h" /* 800D8434-800D8478 .text setArcName__6daBg_cFv */ const char* daBg_c::setArcName() { diff --git a/src/d/d_com_inf_game.cpp b/src/d/d_com_inf_game.cpp index fe78a6487..8206aef87 100644 --- a/src/d/d_com_inf_game.cpp +++ b/src/d/d_com_inf_game.cpp @@ -5,7 +5,7 @@ #include "d/d_com_inf_game.h" #include "JSystem/JUtility/JUTAssert.h" -#include "MSL_C/string.h" +#include "string.h" #include "SSystem/SComponent/c_phase.h" #include "d/actor/d_a_player_main.h" #include "d/d_com_lib_game.h" diff --git a/src/d/d_kankyo.cpp b/src/d/d_kankyo.cpp index f65afde0e..2c0fa18b6 100644 --- a/src/d/d_kankyo.cpp +++ b/src/d/d_kankyo.cpp @@ -21,7 +21,7 @@ #include "m_Do/m_Do_lib.h" #include "m_Do/m_Do_mtx.h" #include "m_Do/m_Do_printf.h" -#include "MSL_C/math.h" +#include "math.h" class sub_kankyo__class : public kankyo_class { }; diff --git a/src/d/d_resorce.cpp b/src/d/d_resorce.cpp index ca09df9b5..dc2fd3c02 100644 --- a/src/d/d_resorce.cpp +++ b/src/d/d_resorce.cpp @@ -19,8 +19,8 @@ #include "JSystem/JKernel/JKRSolidHeap.h" #include "JSystem/JUtility/JUTConsole.h" #include "JSystem/JUtility/JUTTexture.h" -#include "MSL_C/stdio.h" -#include "MSL_C/string.h" +#include "stdio.h" +#include "string.h" #include "dolphin/os/OSCache.h" /* 8006D804-8006D824 .text __ct__11dRes_info_cFv */ diff --git a/src/d/d_s_logo.cpp b/src/d/d_s_logo.cpp index b879b4e7a..a28a7f806 100644 --- a/src/d/d_s_logo.cpp +++ b/src/d/d_s_logo.cpp @@ -24,7 +24,7 @@ #include "JSystem/JKernel/JKRAramHeap.h" #include "dolphin/vi/vi.h" #include "dolphin/os/OS.h" -#include "MSL_C/string.h" +#include "string.h" class dScnLogo_c : public scene_class { public: diff --git a/src/d/d_s_play.cpp b/src/d/d_s_play.cpp index a1f19eb11..ba9fdd714 100644 --- a/src/d/d_s_play.cpp +++ b/src/d/d_s_play.cpp @@ -8,7 +8,7 @@ #include "JSystem/JUtility/JUTAssert.h" #include "JSystem/JUtility/JUTConsole.h" #include "JSystem/JUtility/JUTReport.h" -#include "MSL_C/string.h" +#include "string.h" #include "SSystem/SComponent/c_counter.h" #include "d/actor/d_a_player_main.h" #include "d/actor/d_a_title.h" diff --git a/src/d/d_s_room.cpp b/src/d/d_s_room.cpp index c68b28f4a..78af9a8a5 100644 --- a/src/d/d_s_room.cpp +++ b/src/d/d_s_room.cpp @@ -19,7 +19,8 @@ #include "m_Do/m_Do_dvd_thread.h" #include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JKernel/JKRExpHeap.h" -#include "MSL_C/string.h" +#include "string.h" +#include "printf.h" class room_of_scene_class : public scene_class { public: diff --git a/src/d/d_save.cpp b/src/d/d_save.cpp index 4f6f280b5..40f538c3e 100644 --- a/src/d/d_save.cpp +++ b/src/d/d_save.cpp @@ -13,8 +13,8 @@ #include "JSystem/JUtility/JUTGamePad.h" #include "SSystem/SComponent/c_lib.h" #include "SSystem/SComponent/c_math.h" -#include "MSL_C/string.h" -#include "MSL_C/stdio.h" +#include "string.h" +#include "stdio.h" struct daNpc_Sarace_c { static int ship_race_rupee; diff --git a/src/d/d_stage.cpp b/src/d/d_stage.cpp index cc7ae5e82..fa6c5d4aa 100644 --- a/src/d/d_stage.cpp +++ b/src/d/d_stage.cpp @@ -6,7 +6,7 @@ #include "d/d_stage.h" #include "JSystem/JKernel/JKRExpHeap.h" #include "JSystem/JUtility/JUTAssert.h" -#include "MSL_C/string.h" +#include "string.h" #include "SSystem/SComponent/c_malloc.h" #include "d/actor/d_a_player_main.h" #include "d/actor/d_a_ship.h" diff --git a/src/m_Do/m_Do_MemCard.cpp b/src/m_Do/m_Do_MemCard.cpp index 06499eb81..0ef55ba00 100644 --- a/src/m_Do/m_Do_MemCard.cpp +++ b/src/m_Do/m_Do_MemCard.cpp @@ -9,7 +9,7 @@ #include "JSystem/JKernel/JKRThread.h" #include "dolphin/card.h" #include "global.h" -#include "MSL_C/string.h" +#include "string.h" u8 MemCardStack[0x1000] ALIGN_DECL(32); OSThread MemCardThread; diff --git a/src/m_Do/m_Do_hostIO.cpp b/src/m_Do/m_Do_hostIO.cpp index 97087fe58..99b02c9b5 100644 --- a/src/m_Do/m_Do_hostIO.cpp +++ b/src/m_Do/m_Do_hostIO.cpp @@ -4,7 +4,7 @@ // #include "m_Do/m_Do_hostIO.h" -#include "MSL_C/string.h" +#include "string.h" #include "m_Do/m_Do_printf.h" mDoHIO_root_c mDoHIO_root; diff --git a/src/m_Do/m_Do_main.cpp b/src/m_Do/m_Do_main.cpp index 5c7376afe..6a45c3821 100644 --- a/src/m_Do/m_Do_main.cpp +++ b/src/m_Do/m_Do_main.cpp @@ -12,7 +12,7 @@ #include "JSystem/JUtility/JUTConsole.h" #include "JSystem/JUtility/JUTGamePad.h" #include "JSystem/JUtility/JUTReport.h" -#include "MSL_C/string.h" +#include "string.h" #include "c/c_dylink.h" #include "d/d_com_inf_game.h" #include "f_ap/f_ap_game.h" diff --git a/src/m_Do/m_Do_printf.cpp b/src/m_Do/m_Do_printf.cpp index b89e09512..960ab075c 100644 --- a/src/m_Do/m_Do_printf.cpp +++ b/src/m_Do/m_Do_printf.cpp @@ -4,7 +4,7 @@ // #include "m_Do/m_Do_printf.h" -#include "MSL_C/stdio.h" +#include "stdio.h" #include "dolphin/base/PPCArch.h" #include "dolphin/os/OS.h" From 0289ced50845382e253f5ef104bc8560989bc57b Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Wed, 27 Dec 2023 21:15:49 -0800 Subject: [PATCH 2/4] fix build --- src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/string.h | 1 + src/PowerPC_EABI_Support/Runtime/Src/__mem.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/string.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/string.h index e8878af9f..7b69d4e16 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/string.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/string.h @@ -9,6 +9,7 @@ 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); diff --git a/src/PowerPC_EABI_Support/Runtime/Src/__mem.c b/src/PowerPC_EABI_Support/Runtime/Src/__mem.c index e4e282b3c..e6c45ed94 100644 --- a/src/PowerPC_EABI_Support/Runtime/Src/__mem.c +++ b/src/PowerPC_EABI_Support/Runtime/Src/__mem.c @@ -81,4 +81,4 @@ void* memset(void* dst, int val, size_t n) __fill_mem(dst, val, n); return (dst); -} +} \ No newline at end of file From d7898aaac9df542814779e47e59ac5c151f9450c Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Wed, 27 Dec 2023 21:24:26 -0800 Subject: [PATCH 3/4] fix PAL build --- src/d/d_s_logo.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/d/d_s_logo.cpp b/src/d/d_s_logo.cpp index a28a7f806..4aa0588f3 100644 --- a/src/d/d_s_logo.cpp +++ b/src/d/d_s_logo.cpp @@ -25,6 +25,7 @@ #include "dolphin/vi/vi.h" #include "dolphin/os/OS.h" #include "string.h" +#include "printf.h" class dScnLogo_c : public scene_class { public: From 938c6ed2914156ed556ecad72f70ad373cea7bcd Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Wed, 27 Dec 2023 21:27:30 -0800 Subject: [PATCH 4/4] actually fix PAL? --- src/d/d_place_name.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/d/d_place_name.cpp b/src/d/d_place_name.cpp index 25caeec49..5c63a2d7e 100644 --- a/src/d/d_place_name.cpp +++ b/src/d/d_place_name.cpp @@ -17,6 +17,7 @@ #include "JSystem/J2DGraph/J2DOrthoGraph.h" #include "JSystem/J2DGraph/J2DPane.h" #include "JSystem/J2DGraph/J2DScreen.h" +#include "printf.h" enum { dPn_stage_max_e = 19 };