Compare commits

...

2 Commits

Author SHA1 Message Date
Devin AI
3872c10c76 msl: match printf.c and time.c fully, flip to Matching
- printf.c 16/16 fns 100% incl. double2hex marshal-copy + u8 emission
- time.c 10/10 fns 100%, all data sections byte-identical
- force_active for orig-kept but dead-stripped fns (fprintf, all 10 time fns, atol)
- wprintf __wpformatter remains 98-reg-name tie-break (ndiff 0, 593/593)

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-30 16:58:55 +00:00
Devin AI
f96fddcbf8 msl: flip 5 fully-matched units (ansi_fp, locale, file_io, scanf, strtold) to Matching
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-30 16:58:55 +00:00
5 changed files with 55 additions and 33 deletions

View File

@@ -11,12 +11,23 @@ splits: 'config/43U/splits.txt'
ldscript_template: 'config/ldscript_ipl2.lcf'
force_active:
- fprintf
- leap_days
- __msl_time2tm
- __tm2time
- clock
- mktime
- localtime
- emit
- __MSL_ISO8601NewYear
- __MSL_ISO8601Week
- strftime
- labs
- atol
- itoa
- strpbrk
- strspn
- strcspn
- atol
- padding__Q23ipl5scene
- lbl_81695063
- lbl_81695067

View File

@@ -1944,30 +1944,30 @@ config.libs = [
Object(Matching, "MSL_Common/alloc.c"),
Object(Matching, "MSL_Common/errno.c"),
Object(Matching, "MSL_Common/ansi_files.c"),
Object(NonMatching, "MSL_Common_Embedded/ansi_fp.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common_Embedded/ansi_fp.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/ctype.c"),
Object(NonMatching, "MSL_Common/locale.c"),
Object(Matching, "MSL_Common/locale.c"),
Object(Matching, "MSL_Common/arith.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/bsearch.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/buffer_io.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/direct_io.c", extra_cflags=["-Cpp_exceptions on"]),
Object(NonMatching, "MSL_Common/file_io.c"),
Object(Matching, "MSL_Common/file_io.c"),
Object(Matching, "MSL_Common/FILE_POS.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/mbstring.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/mem.c"),
Object(Matching, "MSL_Common/mem_funcs.c"),
Object(Matching, "MSL_Common/math_api.c"),
Object(Matching, "MSL_Common/misc_io.c"),
Object(NonMatching, "MSL_Common/printf.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/printf.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/qsort.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/rand.c"),
Object(NonMatching, "MSL_Common/scanf.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/scanf.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/signal.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/string.c"),
Object(Matching, "MSL_Common/float.c"),
Object(NonMatching, "MSL_Common/strtold.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/strtold.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/strtoul.c", extra_cflags=["-Cpp_exceptions on"]),
Object(NonMatching, "MSL_Common/time.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/time.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/wctype.c"),
Object(Matching, "MSL_Common/wmem.c"),
Object(NonMatching, "MSL_Common/wprintf.c", extra_cflags=["-Cpp_exceptions on"]),

View File

@@ -528,6 +528,7 @@ static char* double2hex(long double num, char* buff, print_format format) {
unsigned snum;
long exp;
print_format exp_format;
print_format* exp_fmt_ptr = &exp_format;
int hex_precision;
int mantissa_bit;
decform form;
@@ -602,7 +603,7 @@ static char* double2hex(long double num, char* buff, print_format format) {
exp = snum - 0x3FF;
p = long2str(exp, buff, exp_format);
p = long2str(exp, buff, *exp_fmt_ptr);
if (format.conversion_char == 'a')
*--p = 'p';
else
@@ -624,7 +625,7 @@ static char* double2hex(long double num, char* buff, print_format format) {
working_byte = (*(q + mantissa_byte)) >> (7 - (mantissa_bit & 7));
if ((mantissa_bit & ~7) != ((mantissa_bit - 4) & ~7)) {
working_byte |= (unsigned char)(((*(q + (mantissa_byte - 1))) << 8) >> (7 - ((mantissa_bit) & 7)));
working_byte |= (((*(q + (mantissa_byte - 1))) << 8) >> (7 - ((mantissa_bit) & 7)));
}
if (!TARGET_FLOAT_IMPLICIT_J_BIT) {
@@ -635,14 +636,14 @@ static char* double2hex(long double num, char* buff, print_format format) {
}
if ((working_byte &= 0xF) < 10) {
working_byte = (unsigned char)(working_byte + '0');
working_byte += '0';
}
else
if (format.conversion_char == 'a') {
working_byte = (unsigned char)(working_byte + 'a' - 10);
working_byte += 'a' - 10;
}
else {
working_byte = (unsigned char)(working_byte + 'A' - 10);
working_byte += 'A' - 10;
}
}
else {
@@ -967,6 +968,7 @@ int __pformatter(void* (*WriteProc)(void*, const char*, size_t), void* WriteProc
const char* format_ptr;
const char* curr_format;
print_format format;
print_format* fmt_ptr = &format;
signed long long_num;
signed long long long_long_num;
long double long_double_num;
@@ -1033,11 +1035,11 @@ int __pformatter(void* (*WriteProc)(void*, const char*, size_t), void* WriteProc
|| format.argument_options == intmax_argument
)
{
if (!(buff_ptr = longlong2str(long_long_num, buff + 512, format))) {
if (!(buff_ptr = longlong2str(long_long_num, buff + 512, *fmt_ptr))) {
goto conversion_error;
}
} else {
if (!(buff_ptr = long2str(long_num, buff + 512, format))) {
if (!(buff_ptr = long2str(long_num, buff + 512, *fmt_ptr))) {
goto conversion_error;
}
}
@@ -1079,11 +1081,11 @@ int __pformatter(void* (*WriteProc)(void*, const char*, size_t), void* WriteProc
|| format.argument_options == intmax_argument
)
{
if (!(buff_ptr = longlong2str(long_long_num, buff + 512, format))) {
if (!(buff_ptr = longlong2str(long_long_num, buff + 512, *fmt_ptr))) {
goto conversion_error;
}
} else {
if (!(buff_ptr = long2str(long_num, buff + 512, format))) {
if (!(buff_ptr = long2str(long_num, buff + 512, *fmt_ptr))) {
goto conversion_error;
}
}
@@ -1103,7 +1105,7 @@ int __pformatter(void* (*WriteProc)(void*, const char*, size_t), void* WriteProc
long_double_num = va_arg(arg, double);
}
if (!(buff_ptr = float2str(long_double_num, buff + 512, format))) {
if (!(buff_ptr = float2str(long_double_num, buff + 512, *fmt_ptr))) {
goto conversion_error;
}
@@ -1118,7 +1120,7 @@ int __pformatter(void* (*WriteProc)(void*, const char*, size_t), void* WriteProc
long_double_num = va_arg(arg, double);
}
if (!(buff_ptr = double2hex(long_double_num, buff + 512, format))) {
if (!(buff_ptr = double2hex(long_double_num, buff + 512, *fmt_ptr))) {
goto conversion_error;
}

View File

@@ -248,6 +248,8 @@ static char* find_name(const char* names, int index) {
return extracted_name;
}
#pragma exceptions off
char* asctime(const struct tm* timeptr) {
static char asctime_result[26];
char* result = asctime_result;
@@ -283,6 +285,8 @@ char* ctime(const time_t* timer) {
return result;
}
#pragma exceptions on
static time_t time(time_t* timer) {
time_t result = __get_time();
@@ -312,6 +316,8 @@ static struct tm* gmtime(const time_t* timer) {
return &gmtime_tm;
}
#pragma exceptions on
struct tm* localtime(const time_t* timer) {
static struct tm localtime_tm;

View File

@@ -521,6 +521,7 @@ static wchar_t* double2hex(long double num, wchar_t* buff, print_format format)
unsigned snum;
long exp;
print_format exp_format;
print_format* exp_fmt_ptr = &exp_format;
int hex_precision;
int mantissa_bit;
decform form;
@@ -595,7 +596,7 @@ static wchar_t* double2hex(long double num, wchar_t* buff, print_format format)
exp = snum - 0x3FF;
p = long2str(exp, buff, exp_format);
p = long2str(exp, buff, *exp_fmt_ptr);
if (format.conversion_char == 'a')
*--p = 'p';
else
@@ -617,7 +618,7 @@ static wchar_t* double2hex(long double num, wchar_t* buff, print_format format)
working_byte = (*(q + mantissa_byte)) >> (7 - (mantissa_bit & 7));
if ((mantissa_bit & ~7) != ((mantissa_bit - 4) & ~7)) {
working_byte |= (unsigned char)(((*(q + (mantissa_byte - 1))) << 8) >> (7 - ((mantissa_bit) & 7)));
working_byte |= (((*(q + (mantissa_byte - 1))) << 8) >> (7 - ((mantissa_bit) & 7)));
}
if (!TARGET_FLOAT_IMPLICIT_J_BIT) {
@@ -628,14 +629,14 @@ static wchar_t* double2hex(long double num, wchar_t* buff, print_format format)
}
if ((working_byte &= 0xF) < 10) {
working_byte = (unsigned char)(working_byte + '0');
working_byte += '0';
}
else
if (format.conversion_char == 'a') {
working_byte = (unsigned char)(working_byte + 'a' - 10);
working_byte += 'a' - 10;
}
else {
working_byte = (unsigned char)(working_byte + 'A' - 10);
working_byte += 'A' - 10;
}
}
else {
@@ -970,6 +971,7 @@ static int __wpformatter(void* (*write_proc)(void*, const wchar_t*, size_t),
const wchar_t* format_ptr;
const wchar_t* curr_format;
print_format format;
print_format* fmt_ptr = &format;
signed long long_num;
signed long long long_long_num;
long double long_double_num;
@@ -1027,11 +1029,11 @@ static int __wpformatter(void* (*write_proc)(void*, const wchar_t*, size_t),
if (format.argument_options == long_long_argument ||
format.argument_options == intmax_argument)
{
if (!(buff_ptr = longlong2str(long_long_num, buff + 512, format))) {
if (!(buff_ptr = longlong2str(long_long_num, buff + 512, *fmt_ptr))) {
goto conversion_error;
}
} else {
if (!(buff_ptr = long2str(long_num, buff + 512, format))) {
if (!(buff_ptr = long2str(long_num, buff + 512, *fmt_ptr))) {
goto conversion_error;
}
}
@@ -1069,11 +1071,11 @@ static int __wpformatter(void* (*write_proc)(void*, const wchar_t*, size_t),
|| format.argument_options == intmax_argument
)
{
if (!(buff_ptr = longlong2str(long_long_num, buff + 512, format))) {
if (!(buff_ptr = longlong2str(long_long_num, buff + 512, *fmt_ptr))) {
goto conversion_error;
}
} else {
if (!(buff_ptr = long2str(long_num, buff + 512, format))) {
if (!(buff_ptr = long2str(long_num, buff + 512, *fmt_ptr))) {
goto conversion_error;
}
}
@@ -1093,7 +1095,7 @@ static int __wpformatter(void* (*write_proc)(void*, const wchar_t*, size_t),
long_double_num = va_arg(args, double);
}
if (!(buff_ptr = float2str(long_double_num, buff + 512, format))) {
if (!(buff_ptr = float2str(long_double_num, buff + 512, *fmt_ptr))) {
goto conversion_error;
}
@@ -1108,7 +1110,7 @@ static int __wpformatter(void* (*write_proc)(void*, const wchar_t*, size_t),
long_double_num = va_arg(args, double);
}
if (!(buff_ptr = double2hex(long_double_num, buff + 512, format))) {
if (!(buff_ptr = double2hex(long_double_num, buff + 512, *fmt_ptr))) {
goto conversion_error;
}
@@ -1124,7 +1126,8 @@ static int __wpformatter(void* (*write_proc)(void*, const wchar_t*, size_t),
}
if (format.alternate_form) {
num_chars = (unsigned char)*wcs_ptr++;
wchar_t first = *wcs_ptr++;
num_chars = (unsigned char)first;
if (format.precision_specified && num_chars > format.precision) {
num_chars = format.precision;
@@ -1150,7 +1153,7 @@ static int __wpformatter(void* (*write_proc)(void*, const wchar_t*, size_t),
}
if (format.alternate_form) {
num_chars = (unsigned char)*wcs_ptr++;
num_chars = (unsigned char)*(const wchar_t*)wcs_ptr;
if (format.precision_specified && num_chars > format.precision) {
num_chars = format.precision;
@@ -1222,7 +1225,7 @@ static int __wpformatter(void* (*write_proc)(void*, const wchar_t*, size_t),
num_chars = 1;
break;
case 0xFF:
case 0xFFFF:
default:
conversion_error:
num_chars = wcslen(curr_format);