Link mbstring.c

requires -inline deferred for whatever reason
This commit is contained in:
HeartPiece 2022-08-25 15:29:52 +10:00
parent 417b923ff5
commit dae21dc448
4 changed files with 76 additions and 56 deletions

View File

@ -160,6 +160,9 @@ $(BUILD_DIR)/src/Dolphin/db.o: CFLAGS += -str noreadonly
$(BUILD_DIR)/src/Dolphin/OS.o: CFLAGS += -str noreadonly
$(BUILD_DIR)/src/Dolphin/GBA.o: CFLAGS += -str noreadonly
# This is inline-deferred for some reason
$(BUILD_DIR)/src/Dolphin/mbstring.o: CFLAGS := -Cpp_exceptions off -enum int -inline deferred -proc gekko -RTTI off -fp hard -fp_contract on -rostr -O4,p -use_lmw_stmw on -common on -sdata 8 -sdata2 8 -nodefaults -DVERNUM=$(VERNUM) $(INCLUDES)
# Disable common BSS pool
$(DOLPHIN): CFLAGS += -common off

View File

@ -290,7 +290,7 @@ DOLPHIN:=\
$(BUILD_DIR)/asm/Dolphin/file_io.o\
$(BUILD_DIR)/asm/Dolphin/FILE_POS.o\
$(BUILD_DIR)/src/Dolphin/locale.o\
$(BUILD_DIR)/asm/Dolphin/mbstring.o\
$(BUILD_DIR)/src/Dolphin/mbstring.o\
$(BUILD_DIR)/src/Dolphin/mem.o\
$(BUILD_DIR)/asm/Dolphin/mem_funcs.o\
$(BUILD_DIR)/src/Dolphin/misc_io.o\

View File

@ -5,10 +5,10 @@
* Address: ........
* Size: 00011C
*/
void mblen(void)
{
// UNUSED FUNCTION
}
// void mblen(void)
// {
// // UNUSED FUNCTION
// }
/*
* --INFO--
@ -17,36 +17,51 @@ void mblen(void)
*/
static int is_utf8_complete(const char* s, size_t n)
{
int i, encoded;
if (n == 0) { // must have more than zero characters
return -1;
}
if (n <= 0) // must have more than zero characters
return (-1);
if (*s == 0x00)
return (0);
if ((*s & 0x80) == 0x00)
if (s[0] == 0x00) { // first char is 0
return 0;
}
if ((s[0] & 0x80) == 0x00)
{
return (1);
else if ((*s & 0xe0) == 0xc0)
encoded = 1;
else if ((*s & 0xf0) == 0xe0)
encoded = 2;
else if ((*s & 0xf8) == 0xf0)
encoded = 3;
else if ((*s & 0xfc) == 0xf8)
encoded = 4;
else if ((*s & 0xfe) == 0xfc)
encoded = 5;
else
}
else if ((s[0] & 0xe0) == 0xc0)
{
if (n >= 2)
{
if ((*(s + 1) & 0x80) == 0x80)
{
return 2;
}
return -1;
}
return -2;
}
else if ((s[0] & 0xf0) == 0xe0)
{
if (n >= 3)
{
if ((s[1] & 0x80) == 0x80)
{
if ((s[2] & 0x80) == 0x80)
{
return 3;
}
}
return -1;
}
else if ((n == 2 && ((s[1] & 0x80) == 0x80)) || n == 1)
{
return -2;
}
return -1;
} else {
return (-1);
for (i = 0; i < encoded; i++) {
if ((*(s + i + 1) & 0xc0) != 0x80)
return (-1);
}
if (n < i + 1)
return (-2);
return (encoded + 1);
}
}
/*
@ -54,10 +69,10 @@ static int is_utf8_complete(const char* s, size_t n)
* Address: ........
* Size: 000120
*/
void utf8_to_unicode(void)
{
// UNUSED FUNCTION
}
// void utf8_to_unicode(void)
// {
// // UNUSED FUNCTION
// }
/*
* --INFO--
@ -216,47 +231,47 @@ size_t wcstombs(char* s, const wchar_t* pwcs, size_t n)
* Address: ........
* Size: 000054
*/
void mbrlen(void)
{
// UNUSED FUNCTION
}
// void mbrlen(void)
// {
// // UNUSED FUNCTION
// }
/*
* --INFO--
* Address: ........
* Size: 000188
*/
void mbrtowc(void)
{
// UNUSED FUNCTION
}
// void mbrtowc(void)
// {
// // UNUSED FUNCTION
// }
/*
* --INFO--
* Address: ........
* Size: 0000B0
*/
void wcrtomb(void)
{
// UNUSED FUNCTION
}
// void wcrtomb(void)
// {
// // UNUSED FUNCTION
// }
/*
* --INFO--
* Address: ........
* Size: 0001E0
*/
void mbsrtowcs(void)
{
// UNUSED FUNCTION
}
// void mbsrtowcs(void)
// {
// // UNUSED FUNCTION
// }
/*
* --INFO--
* Address: ........
* Size: 000114
*/
void wcsrtombs(void)
{
// UNUSED FUNCTION
}
// void wcsrtombs(void)
// {
// // UNUSED FUNCTION
// }

View File

@ -23,3 +23,5 @@ You have 243 out of 10000 Pokos and 12 out of 201 treasures.",2022-08-21 22:00:2
You have 244 out of 10000 Pokos and 12 out of 201 treasures.",2022-08-22 22:18:33.289204
245,114428,0.024595731363405003,12,43045,0.06038386434286869,"
You have 245 out of 10000 Pokos and 12 out of 201 treasures.",2022-08-23 15:00:23.759969
247,115232,0.024768547177857564,12,43049,0.060389475574309535,"
You have 247 out of 10000 Pokos and 12 out of 201 treasures.",2022-08-25 15:28:51.499797

1 code_count_in_pokos code_completion_in_bytes code_completion_in_percentage data_count_in_treasures data_completion_in_bytes data_completion_in_percentage sentence created_at
23
24
25
26
27