diff --git a/CMakeLists.txt b/CMakeLists.txt index aedafd1f..3cee005b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,9 +80,11 @@ set(PHYSFS_SRCS src/physfs_platform_posix.c src/physfs_platform_unix.c src/physfs_platform_windows.c + src/physfs_platform_ogc.c src/physfs_platform_os2.c src/physfs_platform_qnx.c src/physfs_platform_android.c + src/physfs_platform_playdate.c src/physfs_archiver_dir.c src/physfs_archiver_unpacked.c src/physfs_archiver_grp.c diff --git a/extras/casefolding.txt b/extras/casefolding.txt index 0197a6c4..69c5c64b 100644 --- a/extras/casefolding.txt +++ b/extras/casefolding.txt @@ -1,10 +1,11 @@ -# CaseFolding-8.0.0.txt -# Date: 2015-01-13, 18:16:36 GMT [MD] +# CaseFolding-15.1.0.txt +# Date: 2023-05-12, 21:53:10 GMT +# © 2023 Unicode®, Inc. +# Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries. +# For terms of use, see https://www.unicode.org/terms_of_use.html # # Unicode Character Database -# Copyright (c) 1991-2015 Unicode, Inc. -# For terms of use, see http://www.unicode.org/terms_of_use.html -# For documentation, see http://www.unicode.org/reports/tr44/ +# For documentation, see https://www.unicode.org/reports/tr44/ # # Case Folding Properties # @@ -23,7 +24,7 @@ # # NOTE: case folding does not preserve normalization formats! # -# For information on case folding, including how to have case folding +# For information on case folding, including how to have case folding # preserve normalization formats, see Section 3.13 Default Case Algorithms in # The Unicode Standard. # @@ -593,6 +594,61 @@ 13FB; C; 13F3; # CHEROKEE SMALL LETTER YU 13FC; C; 13F4; # CHEROKEE SMALL LETTER YV 13FD; C; 13F5; # CHEROKEE SMALL LETTER MV +1C80; C; 0432; # CYRILLIC SMALL LETTER ROUNDED VE +1C81; C; 0434; # CYRILLIC SMALL LETTER LONG-LEGGED DE +1C82; C; 043E; # CYRILLIC SMALL LETTER NARROW O +1C83; C; 0441; # CYRILLIC SMALL LETTER WIDE ES +1C84; C; 0442; # CYRILLIC SMALL LETTER TALL TE +1C85; C; 0442; # CYRILLIC SMALL LETTER THREE-LEGGED TE +1C86; C; 044A; # CYRILLIC SMALL LETTER TALL HARD SIGN +1C87; C; 0463; # CYRILLIC SMALL LETTER TALL YAT +1C88; C; A64B; # CYRILLIC SMALL LETTER UNBLENDED UK +1C90; C; 10D0; # GEORGIAN MTAVRULI CAPITAL LETTER AN +1C91; C; 10D1; # GEORGIAN MTAVRULI CAPITAL LETTER BAN +1C92; C; 10D2; # GEORGIAN MTAVRULI CAPITAL LETTER GAN +1C93; C; 10D3; # GEORGIAN MTAVRULI CAPITAL LETTER DON +1C94; C; 10D4; # GEORGIAN MTAVRULI CAPITAL LETTER EN +1C95; C; 10D5; # GEORGIAN MTAVRULI CAPITAL LETTER VIN +1C96; C; 10D6; # GEORGIAN MTAVRULI CAPITAL LETTER ZEN +1C97; C; 10D7; # GEORGIAN MTAVRULI CAPITAL LETTER TAN +1C98; C; 10D8; # GEORGIAN MTAVRULI CAPITAL LETTER IN +1C99; C; 10D9; # GEORGIAN MTAVRULI CAPITAL LETTER KAN +1C9A; C; 10DA; # GEORGIAN MTAVRULI CAPITAL LETTER LAS +1C9B; C; 10DB; # GEORGIAN MTAVRULI CAPITAL LETTER MAN +1C9C; C; 10DC; # GEORGIAN MTAVRULI CAPITAL LETTER NAR +1C9D; C; 10DD; # GEORGIAN MTAVRULI CAPITAL LETTER ON +1C9E; C; 10DE; # GEORGIAN MTAVRULI CAPITAL LETTER PAR +1C9F; C; 10DF; # GEORGIAN MTAVRULI CAPITAL LETTER ZHAR +1CA0; C; 10E0; # GEORGIAN MTAVRULI CAPITAL LETTER RAE +1CA1; C; 10E1; # GEORGIAN MTAVRULI CAPITAL LETTER SAN +1CA2; C; 10E2; # GEORGIAN MTAVRULI CAPITAL LETTER TAR +1CA3; C; 10E3; # GEORGIAN MTAVRULI CAPITAL LETTER UN +1CA4; C; 10E4; # GEORGIAN MTAVRULI CAPITAL LETTER PHAR +1CA5; C; 10E5; # GEORGIAN MTAVRULI CAPITAL LETTER KHAR +1CA6; C; 10E6; # GEORGIAN MTAVRULI CAPITAL LETTER GHAN +1CA7; C; 10E7; # GEORGIAN MTAVRULI CAPITAL LETTER QAR +1CA8; C; 10E8; # GEORGIAN MTAVRULI CAPITAL LETTER SHIN +1CA9; C; 10E9; # GEORGIAN MTAVRULI CAPITAL LETTER CHIN +1CAA; C; 10EA; # GEORGIAN MTAVRULI CAPITAL LETTER CAN +1CAB; C; 10EB; # GEORGIAN MTAVRULI CAPITAL LETTER JIL +1CAC; C; 10EC; # GEORGIAN MTAVRULI CAPITAL LETTER CIL +1CAD; C; 10ED; # GEORGIAN MTAVRULI CAPITAL LETTER CHAR +1CAE; C; 10EE; # GEORGIAN MTAVRULI CAPITAL LETTER XAN +1CAF; C; 10EF; # GEORGIAN MTAVRULI CAPITAL LETTER JHAN +1CB0; C; 10F0; # GEORGIAN MTAVRULI CAPITAL LETTER HAE +1CB1; C; 10F1; # GEORGIAN MTAVRULI CAPITAL LETTER HE +1CB2; C; 10F2; # GEORGIAN MTAVRULI CAPITAL LETTER HIE +1CB3; C; 10F3; # GEORGIAN MTAVRULI CAPITAL LETTER WE +1CB4; C; 10F4; # GEORGIAN MTAVRULI CAPITAL LETTER HAR +1CB5; C; 10F5; # GEORGIAN MTAVRULI CAPITAL LETTER HOE +1CB6; C; 10F6; # GEORGIAN MTAVRULI CAPITAL LETTER FI +1CB7; C; 10F7; # GEORGIAN MTAVRULI CAPITAL LETTER YN +1CB8; C; 10F8; # GEORGIAN MTAVRULI CAPITAL LETTER ELIFI +1CB9; C; 10F9; # GEORGIAN MTAVRULI CAPITAL LETTER TURNED GAN +1CBA; C; 10FA; # GEORGIAN MTAVRULI CAPITAL LETTER AIN +1CBD; C; 10FD; # GEORGIAN MTAVRULI CAPITAL LETTER AEN +1CBE; C; 10FE; # GEORGIAN MTAVRULI CAPITAL LETTER HARD SIGN +1CBF; C; 10FF; # GEORGIAN MTAVRULI CAPITAL LETTER LABIAL SIGN 1E00; C; 1E01; # LATIN CAPITAL LETTER A WITH RING BELOW 1E02; C; 1E03; # LATIN CAPITAL LETTER B WITH DOT ABOVE 1E04; C; 1E05; # LATIN CAPITAL LETTER B WITH DOT BELOW @@ -873,6 +929,7 @@ 1FCC; S; 1FC3; # GREEK CAPITAL LETTER ETA WITH PROSGEGRAMMENI 1FD2; F; 03B9 0308 0300; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND VARIA 1FD3; F; 03B9 0308 0301; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA +1FD3; S; 0390; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA 1FD6; F; 03B9 0342; # GREEK SMALL LETTER IOTA WITH PERISPOMENI 1FD7; F; 03B9 0308 0342; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND PERISPOMENI 1FD8; C; 1FD0; # GREEK CAPITAL LETTER IOTA WITH VRACHY @@ -881,6 +938,7 @@ 1FDB; C; 1F77; # GREEK CAPITAL LETTER IOTA WITH OXIA 1FE2; F; 03C5 0308 0300; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND VARIA 1FE3; F; 03C5 0308 0301; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA +1FE3; S; 03B0; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA 1FE4; F; 03C1 0313; # GREEK SMALL LETTER RHO WITH PSILI 1FE6; F; 03C5 0342; # GREEK SMALL LETTER UPSILON WITH PERISPOMENI 1FE7; F; 03C5 0308 0342; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND PERISPOMENI @@ -994,6 +1052,7 @@ 2C2C; C; 2C5C; # GLAGOLITIC CAPITAL LETTER SHTAPIC 2C2D; C; 2C5D; # GLAGOLITIC CAPITAL LETTER TROKUTASTI A 2C2E; C; 2C5E; # GLAGOLITIC CAPITAL LETTER LATINATE MYSLITE +2C2F; C; 2C5F; # GLAGOLITIC CAPITAL LETTER CAUDATE CHRIVI 2C60; C; 2C61; # LATIN CAPITAL LETTER L WITH DOUBLE BAR 2C62; C; 026B; # LATIN CAPITAL LETTER L WITH MIDDLE TILDE 2C63; C; 1D7D; # LATIN CAPITAL LETTER P WITH STROKE @@ -1163,12 +1222,28 @@ A7AA; C; 0266; # LATIN CAPITAL LETTER H WITH HOOK A7AB; C; 025C; # LATIN CAPITAL LETTER REVERSED OPEN E A7AC; C; 0261; # LATIN CAPITAL LETTER SCRIPT G A7AD; C; 026C; # LATIN CAPITAL LETTER L WITH BELT +A7AE; C; 026A; # LATIN CAPITAL LETTER SMALL CAPITAL I A7B0; C; 029E; # LATIN CAPITAL LETTER TURNED K A7B1; C; 0287; # LATIN CAPITAL LETTER TURNED T A7B2; C; 029D; # LATIN CAPITAL LETTER J WITH CROSSED-TAIL A7B3; C; AB53; # LATIN CAPITAL LETTER CHI A7B4; C; A7B5; # LATIN CAPITAL LETTER BETA A7B6; C; A7B7; # LATIN CAPITAL LETTER OMEGA +A7B8; C; A7B9; # LATIN CAPITAL LETTER U WITH STROKE +A7BA; C; A7BB; # LATIN CAPITAL LETTER GLOTTAL A +A7BC; C; A7BD; # LATIN CAPITAL LETTER GLOTTAL I +A7BE; C; A7BF; # LATIN CAPITAL LETTER GLOTTAL U +A7C0; C; A7C1; # LATIN CAPITAL LETTER OLD POLISH O +A7C2; C; A7C3; # LATIN CAPITAL LETTER ANGLICANA W +A7C4; C; A794; # LATIN CAPITAL LETTER C WITH PALATAL HOOK +A7C5; C; 0282; # LATIN CAPITAL LETTER S WITH HOOK +A7C6; C; 1D8E; # LATIN CAPITAL LETTER Z WITH PALATAL HOOK +A7C7; C; A7C8; # LATIN CAPITAL LETTER D WITH SHORT STROKE OVERLAY +A7C9; C; A7CA; # LATIN CAPITAL LETTER S WITH SHORT STROKE OVERLAY +A7D0; C; A7D1; # LATIN CAPITAL LETTER CLOSED INSULAR G +A7D6; C; A7D7; # LATIN CAPITAL LETTER MIDDLE SCOTS S +A7D8; C; A7D9; # LATIN CAPITAL LETTER SIGMOID S +A7F5; C; A7F6; # LATIN CAPITAL LETTER REVERSED HALF H AB70; C; 13A0; # CHEROKEE SMALL LETTER A AB71; C; 13A1; # CHEROKEE SMALL LETTER E AB72; C; 13A2; # CHEROKEE SMALL LETTER I @@ -1255,6 +1330,7 @@ FB02; F; 0066 006C; # LATIN SMALL LIGATURE FL FB03; F; 0066 0066 0069; # LATIN SMALL LIGATURE FFI FB04; F; 0066 0066 006C; # LATIN SMALL LIGATURE FFL FB05; F; 0073 0074; # LATIN SMALL LIGATURE LONG S T +FB05; S; FB06; # LATIN SMALL LIGATURE LONG S T FB06; F; 0073 0074; # LATIN SMALL LIGATURE ST FB13; F; 0574 0576; # ARMENIAN SMALL LIGATURE MEN NOW FB14; F; 0574 0565; # ARMENIAN SMALL LIGATURE MEN ECH @@ -1327,6 +1403,77 @@ FF3A; C; FF5A; # FULLWIDTH LATIN CAPITAL LETTER Z 10425; C; 1044D; # DESERET CAPITAL LETTER ENG 10426; C; 1044E; # DESERET CAPITAL LETTER OI 10427; C; 1044F; # DESERET CAPITAL LETTER EW +104B0; C; 104D8; # OSAGE CAPITAL LETTER A +104B1; C; 104D9; # OSAGE CAPITAL LETTER AI +104B2; C; 104DA; # OSAGE CAPITAL LETTER AIN +104B3; C; 104DB; # OSAGE CAPITAL LETTER AH +104B4; C; 104DC; # OSAGE CAPITAL LETTER BRA +104B5; C; 104DD; # OSAGE CAPITAL LETTER CHA +104B6; C; 104DE; # OSAGE CAPITAL LETTER EHCHA +104B7; C; 104DF; # OSAGE CAPITAL LETTER E +104B8; C; 104E0; # OSAGE CAPITAL LETTER EIN +104B9; C; 104E1; # OSAGE CAPITAL LETTER HA +104BA; C; 104E2; # OSAGE CAPITAL LETTER HYA +104BB; C; 104E3; # OSAGE CAPITAL LETTER I +104BC; C; 104E4; # OSAGE CAPITAL LETTER KA +104BD; C; 104E5; # OSAGE CAPITAL LETTER EHKA +104BE; C; 104E6; # OSAGE CAPITAL LETTER KYA +104BF; C; 104E7; # OSAGE CAPITAL LETTER LA +104C0; C; 104E8; # OSAGE CAPITAL LETTER MA +104C1; C; 104E9; # OSAGE CAPITAL LETTER NA +104C2; C; 104EA; # OSAGE CAPITAL LETTER O +104C3; C; 104EB; # OSAGE CAPITAL LETTER OIN +104C4; C; 104EC; # OSAGE CAPITAL LETTER PA +104C5; C; 104ED; # OSAGE CAPITAL LETTER EHPA +104C6; C; 104EE; # OSAGE CAPITAL LETTER SA +104C7; C; 104EF; # OSAGE CAPITAL LETTER SHA +104C8; C; 104F0; # OSAGE CAPITAL LETTER TA +104C9; C; 104F1; # OSAGE CAPITAL LETTER EHTA +104CA; C; 104F2; # OSAGE CAPITAL LETTER TSA +104CB; C; 104F3; # OSAGE CAPITAL LETTER EHTSA +104CC; C; 104F4; # OSAGE CAPITAL LETTER TSHA +104CD; C; 104F5; # OSAGE CAPITAL LETTER DHA +104CE; C; 104F6; # OSAGE CAPITAL LETTER U +104CF; C; 104F7; # OSAGE CAPITAL LETTER WA +104D0; C; 104F8; # OSAGE CAPITAL LETTER KHA +104D1; C; 104F9; # OSAGE CAPITAL LETTER GHA +104D2; C; 104FA; # OSAGE CAPITAL LETTER ZA +104D3; C; 104FB; # OSAGE CAPITAL LETTER ZHA +10570; C; 10597; # VITHKUQI CAPITAL LETTER A +10571; C; 10598; # VITHKUQI CAPITAL LETTER BBE +10572; C; 10599; # VITHKUQI CAPITAL LETTER BE +10573; C; 1059A; # VITHKUQI CAPITAL LETTER CE +10574; C; 1059B; # VITHKUQI CAPITAL LETTER CHE +10575; C; 1059C; # VITHKUQI CAPITAL LETTER DE +10576; C; 1059D; # VITHKUQI CAPITAL LETTER DHE +10577; C; 1059E; # VITHKUQI CAPITAL LETTER EI +10578; C; 1059F; # VITHKUQI CAPITAL LETTER E +10579; C; 105A0; # VITHKUQI CAPITAL LETTER FE +1057A; C; 105A1; # VITHKUQI CAPITAL LETTER GA +1057C; C; 105A3; # VITHKUQI CAPITAL LETTER HA +1057D; C; 105A4; # VITHKUQI CAPITAL LETTER HHA +1057E; C; 105A5; # VITHKUQI CAPITAL LETTER I +1057F; C; 105A6; # VITHKUQI CAPITAL LETTER IJE +10580; C; 105A7; # VITHKUQI CAPITAL LETTER JE +10581; C; 105A8; # VITHKUQI CAPITAL LETTER KA +10582; C; 105A9; # VITHKUQI CAPITAL LETTER LA +10583; C; 105AA; # VITHKUQI CAPITAL LETTER LLA +10584; C; 105AB; # VITHKUQI CAPITAL LETTER ME +10585; C; 105AC; # VITHKUQI CAPITAL LETTER NE +10586; C; 105AD; # VITHKUQI CAPITAL LETTER NJE +10587; C; 105AE; # VITHKUQI CAPITAL LETTER O +10588; C; 105AF; # VITHKUQI CAPITAL LETTER PE +10589; C; 105B0; # VITHKUQI CAPITAL LETTER QA +1058A; C; 105B1; # VITHKUQI CAPITAL LETTER RE +1058C; C; 105B3; # VITHKUQI CAPITAL LETTER SE +1058D; C; 105B4; # VITHKUQI CAPITAL LETTER SHE +1058E; C; 105B5; # VITHKUQI CAPITAL LETTER TE +1058F; C; 105B6; # VITHKUQI CAPITAL LETTER THE +10590; C; 105B7; # VITHKUQI CAPITAL LETTER U +10591; C; 105B8; # VITHKUQI CAPITAL LETTER VE +10592; C; 105B9; # VITHKUQI CAPITAL LETTER XE +10594; C; 105BB; # VITHKUQI CAPITAL LETTER Y +10595; C; 105BC; # VITHKUQI CAPITAL LETTER ZE 10C80; C; 10CC0; # OLD HUNGARIAN CAPITAL LETTER A 10C81; C; 10CC1; # OLD HUNGARIAN CAPITAL LETTER AA 10C82; C; 10CC2; # OLD HUNGARIAN CAPITAL LETTER EB @@ -1410,5 +1557,71 @@ FF3A; C; FF5A; # FULLWIDTH LATIN CAPITAL LETTER Z 118BD; C; 118DD; # WARANG CITI CAPITAL LETTER SSUU 118BE; C; 118DE; # WARANG CITI CAPITAL LETTER SII 118BF; C; 118DF; # WARANG CITI CAPITAL LETTER VIYO +16E40; C; 16E60; # MEDEFAIDRIN CAPITAL LETTER M +16E41; C; 16E61; # MEDEFAIDRIN CAPITAL LETTER S +16E42; C; 16E62; # MEDEFAIDRIN CAPITAL LETTER V +16E43; C; 16E63; # MEDEFAIDRIN CAPITAL LETTER W +16E44; C; 16E64; # MEDEFAIDRIN CAPITAL LETTER ATIU +16E45; C; 16E65; # MEDEFAIDRIN CAPITAL LETTER Z +16E46; C; 16E66; # MEDEFAIDRIN CAPITAL LETTER KP +16E47; C; 16E67; # MEDEFAIDRIN CAPITAL LETTER P +16E48; C; 16E68; # MEDEFAIDRIN CAPITAL LETTER T +16E49; C; 16E69; # MEDEFAIDRIN CAPITAL LETTER G +16E4A; C; 16E6A; # MEDEFAIDRIN CAPITAL LETTER F +16E4B; C; 16E6B; # MEDEFAIDRIN CAPITAL LETTER I +16E4C; C; 16E6C; # MEDEFAIDRIN CAPITAL LETTER K +16E4D; C; 16E6D; # MEDEFAIDRIN CAPITAL LETTER A +16E4E; C; 16E6E; # MEDEFAIDRIN CAPITAL LETTER J +16E4F; C; 16E6F; # MEDEFAIDRIN CAPITAL LETTER E +16E50; C; 16E70; # MEDEFAIDRIN CAPITAL LETTER B +16E51; C; 16E71; # MEDEFAIDRIN CAPITAL LETTER C +16E52; C; 16E72; # MEDEFAIDRIN CAPITAL LETTER U +16E53; C; 16E73; # MEDEFAIDRIN CAPITAL LETTER YU +16E54; C; 16E74; # MEDEFAIDRIN CAPITAL LETTER L +16E55; C; 16E75; # MEDEFAIDRIN CAPITAL LETTER Q +16E56; C; 16E76; # MEDEFAIDRIN CAPITAL LETTER HP +16E57; C; 16E77; # MEDEFAIDRIN CAPITAL LETTER NY +16E58; C; 16E78; # MEDEFAIDRIN CAPITAL LETTER X +16E59; C; 16E79; # MEDEFAIDRIN CAPITAL LETTER D +16E5A; C; 16E7A; # MEDEFAIDRIN CAPITAL LETTER OE +16E5B; C; 16E7B; # MEDEFAIDRIN CAPITAL LETTER N +16E5C; C; 16E7C; # MEDEFAIDRIN CAPITAL LETTER R +16E5D; C; 16E7D; # MEDEFAIDRIN CAPITAL LETTER O +16E5E; C; 16E7E; # MEDEFAIDRIN CAPITAL LETTER AI +16E5F; C; 16E7F; # MEDEFAIDRIN CAPITAL LETTER Y +1E900; C; 1E922; # ADLAM CAPITAL LETTER ALIF +1E901; C; 1E923; # ADLAM CAPITAL LETTER DAALI +1E902; C; 1E924; # ADLAM CAPITAL LETTER LAAM +1E903; C; 1E925; # ADLAM CAPITAL LETTER MIIM +1E904; C; 1E926; # ADLAM CAPITAL LETTER BA +1E905; C; 1E927; # ADLAM CAPITAL LETTER SINNYIIYHE +1E906; C; 1E928; # ADLAM CAPITAL LETTER PE +1E907; C; 1E929; # ADLAM CAPITAL LETTER BHE +1E908; C; 1E92A; # ADLAM CAPITAL LETTER RA +1E909; C; 1E92B; # ADLAM CAPITAL LETTER E +1E90A; C; 1E92C; # ADLAM CAPITAL LETTER FA +1E90B; C; 1E92D; # ADLAM CAPITAL LETTER I +1E90C; C; 1E92E; # ADLAM CAPITAL LETTER O +1E90D; C; 1E92F; # ADLAM CAPITAL LETTER DHA +1E90E; C; 1E930; # ADLAM CAPITAL LETTER YHE +1E90F; C; 1E931; # ADLAM CAPITAL LETTER WAW +1E910; C; 1E932; # ADLAM CAPITAL LETTER NUN +1E911; C; 1E933; # ADLAM CAPITAL LETTER KAF +1E912; C; 1E934; # ADLAM CAPITAL LETTER YA +1E913; C; 1E935; # ADLAM CAPITAL LETTER U +1E914; C; 1E936; # ADLAM CAPITAL LETTER JIIM +1E915; C; 1E937; # ADLAM CAPITAL LETTER CHI +1E916; C; 1E938; # ADLAM CAPITAL LETTER HA +1E917; C; 1E939; # ADLAM CAPITAL LETTER QAAF +1E918; C; 1E93A; # ADLAM CAPITAL LETTER GA +1E919; C; 1E93B; # ADLAM CAPITAL LETTER NYA +1E91A; C; 1E93C; # ADLAM CAPITAL LETTER TU +1E91B; C; 1E93D; # ADLAM CAPITAL LETTER NHA +1E91C; C; 1E93E; # ADLAM CAPITAL LETTER VA +1E91D; C; 1E93F; # ADLAM CAPITAL LETTER KHA +1E91E; C; 1E940; # ADLAM CAPITAL LETTER GBE +1E91F; C; 1E941; # ADLAM CAPITAL LETTER ZAL +1E920; C; 1E942; # ADLAM CAPITAL LETTER KPO +1E921; C; 1E943; # ADLAM CAPITAL LETTER SHA # # EOF diff --git a/extras/makecasefoldhashtable.pl b/extras/makecasefoldhashtable.pl index 4e0cd301..015681c6 100755 --- a/extras/makecasefoldhashtable.pl +++ b/extras/makecasefoldhashtable.pl @@ -8,6 +8,8 @@ my $HASHBUCKETS2_16 = 16; my $HASHBUCKETS3_16 = 4; +my $mem_used = 0; + print <<__EOF__; /* * This file is part of PhysicsFS (https://icculus.org/physfs/) @@ -143,18 +145,22 @@ my $hashed = (($hexxed ^ ($hexxed >> 8)) & ($HASHBUCKETS1_32-1)); #print("// hexxed '$hexxed' hashed1 '$hashed'\n"); $foldPairs1_32[$hashed] .= " { 0x$code, 0x$map1 },\n"; + $mem_used += 8; } elsif (not defined($map2)) { my $hashed = (($hexxed ^ ($hexxed >> 8)) & ($HASHBUCKETS1_16-1)); #print("// hexxed '$hexxed' hashed1 '$hashed'\n"); $foldPairs1_16[$hashed] .= " { 0x$code, 0x$map1 },\n"; + $mem_used += 4; } elsif (not defined($map3)) { my $hashed = (($hexxed ^ ($hexxed >> 8)) & ($HASHBUCKETS2_16-1)); #print("// hexxed '$hexxed' hashed2 '$hashed'\n"); $foldPairs2_16[$hashed] .= " { 0x$code, 0x$map1, 0x$map2 },\n"; + $mem_used += 6; } else { my $hashed = (($hexxed ^ ($hexxed >> 8)) & ($HASHBUCKETS3_16-1)); #print("// hexxed '$hexxed' hashed3 '$hashed'\n"); $foldPairs3_16[$hashed] .= " { 0x$code, 0x$map1, 0x$map2, 0x$map3 },\n"; + $mem_used += 8; } } } @@ -212,6 +218,7 @@ my $sym = "case_fold1_16_${num}"; print(" { $sym, __PHYSFS_ARRAYLEN($sym) },\n"); } + $mem_used += 12; } print("};\n\n"); @@ -228,6 +235,7 @@ my $sym = "case_fold1_32_${num}"; print(" { $sym, __PHYSFS_ARRAYLEN($sym) },\n"); } + $mem_used += 12; } print("};\n\n"); @@ -244,6 +252,7 @@ my $sym = "case_fold2_16_${num}"; print(" { $sym, __PHYSFS_ARRAYLEN($sym) },\n"); } + $mem_used += 12; } print("};\n\n"); @@ -259,6 +268,7 @@ my $sym = "case_fold3_16_${num}"; print(" { $sym, __PHYSFS_ARRAYLEN($sym) },\n"); } + $mem_used += 12; } print("};\n\n"); @@ -270,6 +280,8 @@ __EOF__ +print STDERR "Memory required for case-folding hashtable: $mem_used bytes\n"; + exit 0; # end of makecashfoldhashtable.pl ... diff --git a/extras/physfsrwops.c b/extras/physfsrwops.c index ad38f25c..895ab8f8 100644 --- a/extras/physfsrwops.c +++ b/extras/physfsrwops.c @@ -21,6 +21,8 @@ * This file was written by Ryan C. Gordon. (icculus@icculus.org). */ +/* This works with SDL1 and SDL2. For SDL3, use physfssdl3.c */ + #include /* used for SEEK_SET, SEEK_CUR, SEEK_END ... */ #include "physfsrwops.h" diff --git a/extras/physfsrwops.h b/extras/physfsrwops.h index 54b08a7e..36762715 100644 --- a/extras/physfsrwops.h +++ b/extras/physfsrwops.h @@ -21,6 +21,8 @@ * This file was written by Ryan C. Gordon. (icculus@icculus.org). */ +/* This works with SDL1 and SDL2. For SDL3, use physfssdl3.h */ + #ifndef _INCLUDE_PHYSFSRWOPS_H_ #define _INCLUDE_PHYSFSRWOPS_H_ diff --git a/extras/physfssdl3.c b/extras/physfssdl3.c new file mode 100644 index 00000000..67197641 --- /dev/null +++ b/extras/physfssdl3.c @@ -0,0 +1,298 @@ +/* + * This code provides a glue layer between PhysicsFS and Simple Directmedia + * Layer 3's (SDL3) SDL_IOStream and SDL_Storage i/o abstractions. + * + * License: this code is public domain. I make no warranty that it is useful, + * correct, harmless, or environmentally safe. + * + * This particular file may be used however you like, including copying it + * verbatim into a closed-source project, exploiting it commercially, and + * removing any trace of my name from the source (although I hope you won't + * do that). I welcome enhancements and corrections to this file, but I do + * not require you to send me patches if you make changes. This code has + * NO WARRANTY. + * + * Unless otherwise stated, the rest of PhysicsFS falls under the zlib license. + * Please see LICENSE.txt in the root of the source tree. + * + * SDL3 is zlib-licensed, like PhysicsFS. You can get SDL at + * https://www.libsdl.org/ + * + * This file was written by Ryan C. Gordon. (icculus@icculus.org). + */ + +/* This works with SDL3. For SDL1 and SDL2, use physfsrwops.h */ + +#include "physfssdl3.h" + +/* SDL_IOStream -> PhysicsFS bridge ... */ + +static Sint64 SDLCALL physfsiostream_size(void *userdata) +{ + return (Sint64) PHYSFS_fileLength((PHYSFS_File *) userdata); +} + +static Sint64 SDLCALL physfsiostream_seek(void *userdata, Sint64 offset, int whence) +{ + PHYSFS_File *handle = (PHYSFS_File *) userdata; + PHYSFS_sint64 pos = 0; + + if (whence == SDL_IO_SEEK_SET) { + pos = (PHYSFS_sint64) offset; + } else if (whence == SDL_IO_SEEK_CUR) { + const PHYSFS_sint64 current = PHYSFS_tell(handle); + if (current == -1) { + return SDL_SetError("Can't find position in file: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())); + } + + if (offset == 0) { /* this is a "tell" call. We're done. */ + return (Sint64) current; + } + + pos = current + ((PHYSFS_sint64) offset); + } else if (whence == SDL_IO_SEEK_END) { + const PHYSFS_sint64 len = PHYSFS_fileLength(handle); + if (len == -1) { + return SDL_SetError("Can't find end of file: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())); + } + + pos = len + ((PHYSFS_sint64) offset); + } else { + return SDL_SetError("Invalid 'whence' parameter."); + } + + if ( pos < 0 ) { + return SDL_SetError("Attempt to seek past start of file."); + } + + if (!PHYSFS_seek(handle, (PHYSFS_uint64) pos)) { + return SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())); + } + + return (Sint64) pos; +} + +static size_t SDLCALL physfsiostream_read(void *userdata, void *ptr, size_t size, SDL_IOStatus *status) +{ + PHYSFS_File *handle = (PHYSFS_File *) userdata; + const PHYSFS_uint64 readlen = (PHYSFS_uint64) size; + const PHYSFS_sint64 rc = PHYSFS_readBytes(handle, ptr, readlen); + if (rc != ((PHYSFS_sint64) readlen)) { + if (!PHYSFS_eof(handle)) { /* not EOF? Must be an error. */ + /* Setting an SDL error makes SDL take care of `status` for you. */ + SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())); + return 0; + } + } + return (size_t) rc; +} + +static size_t SDLCALL physfsiostream_write(void *userdata, const void *ptr, size_t size, SDL_IOStatus *status) +{ + PHYSFS_File *handle = (PHYSFS_File *) userdata; + const PHYSFS_uint64 writelen = (PHYSFS_uint64) size; + const PHYSFS_sint64 rc = PHYSFS_writeBytes(handle, ptr, writelen); + if (rc != ((PHYSFS_sint64) writelen)) { + /* Setting an SDL error makes SDL take care of `status` for you. */ + SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())); + } + return (size_t) rc; +} + +static int SDLCALL physfsiostream_close(void *userdata) +{ + if (!PHYSFS_close((PHYSFS_File *) userdata)) { + return SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())); + } + return 0; +} + +static SDL_IOStream *create_iostream(PHYSFS_File *handle) +{ + SDL_IOStream *retval = NULL; + if (handle == NULL) { + SDL_SetError("PhysicsFS error: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())); + } else { + SDL_IOStreamInterface iface; + iface.size = physfsiostream_size; + iface.seek = physfsiostream_seek; + iface.read = physfsiostream_read; + iface.write = physfsiostream_write; + iface.close = physfsiostream_close; + retval = SDL_OpenIO(&iface, handle); + } + + return retval; +} + +SDL_IOStream *PHYSFSSDL3_makeIOStream(PHYSFS_File *handle) +{ + SDL_IOStream *retval = NULL; + if (handle == NULL) { + SDL_SetError("NULL pointer passed to PHYSFSSDL3_makeRWops()."); + } else { + retval = create_iostream(handle); + } + return retval; +} + +SDL_IOStream *PHYSFSSDL3_openRead(const char *fname) +{ + return create_iostream(PHYSFS_openRead(fname)); +} + +SDL_IOStream *PHYSFSSDL3_openWrite(const char *fname) +{ + return create_iostream(PHYSFS_openWrite(fname)); +} + +SDL_IOStream *PHYSFSSDL3_openAppend(const char *fname) +{ + return create_iostream(PHYSFS_openAppend(fname)); +} + + +/* SDL_Storage -> PhysicsFS bridge ... */ + +static int SDLCALL physfssdl3storage_close(void *userdata) +{ + return 0; /* this doesn't do anything, we didn't allocate anything specific to this object. */ +} + +static SDL_bool SDLCALL physfssdl3storage_ready(void *userdata) +{ + return SDL_TRUE; +} + +/* this is a really obnoxious symbol name... */ +typedef struct physfssdl3storage_enumerate_callback_data +{ + SDL_EnumerateDirectoryCallback sdlcallback; + void *sdluserdata; +} physfssdl3storage_enumerate_callback_data; + +static PHYSFS_EnumerateCallbackResult physfssdl3storage_enumerate_callback(void *userdata, const char *origdir, const char *fname) +{ + const physfssdl3storage_enumerate_callback_data *data = (physfssdl3storage_enumerate_callback_data *) userdata; + const int rc = data->sdlcallback(data->sdluserdata, origdir, fname); + if (rc < 0) { + return PHYSFS_ENUM_ERROR; + } else if (rc == 0) { + return PHYSFS_ENUM_STOP; + } + return PHYSFS_ENUM_OK; +} + +static int SDLCALL physfssdl3storage_enumerate(void *userdata, const char *path, SDL_EnumerateDirectoryCallback callback, void *callback_userdata) +{ + physfssdl3storage_enumerate_callback_data data; + data.sdlcallback = callback; + data.sdluserdata = callback_userdata; + return PHYSFS_enumerate(path, physfssdl3storage_enumerate_callback, &data) ? 0 : -1; +} + +static int SDLCALL physfssdl3storage_info(void *userdata, const char *path, SDL_PathInfo *info) +{ + PHYSFS_Stat statbuf; + if (!PHYSFS_stat(path, &statbuf)) { + return SDL_SetError("%s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())); + } + + if (info) { + switch (statbuf.filetype) { + case PHYSFS_FILETYPE_REGULAR: info->type = SDL_PATHTYPE_FILE; break; + case PHYSFS_FILETYPE_DIRECTORY: info->type = SDL_PATHTYPE_DIRECTORY; break; + default: info->type = SDL_PATHTYPE_OTHER; break; + } + + info->size = (Uint64) statbuf.filesize; + info->create_time = (SDL_Time) ((statbuf.createtime < 0) ? 0 : SDL_SECONDS_TO_NS(statbuf.createtime)); + info->modify_time = (SDL_Time) ((statbuf.modtime < 0) ? 0 : SDL_SECONDS_TO_NS(statbuf.modtime)); + info->access_time = (SDL_Time) ((statbuf.accesstime < 0) ? 0 : SDL_SECONDS_TO_NS(statbuf.accesstime)); + } + + return 0; +} + +static int SDLCALL physfssdl3storage_read_file(void *userdata, const char *path, void *destination, Uint64 length) +{ + PHYSFS_file *f = PHYSFS_openRead(path); + PHYSFS_sint64 br; + + if (!f) { + return SDL_SetError("%s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())); + } + + br = PHYSFS_readBytes(f, destination, length); + PHYSFS_close(f); + + if (br != (Sint64) length) { + return SDL_SetError("%s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())); + } + return 0; +} + + +static int SDLCALL physfssdl3storage_write_file(void *userdata, const char *path, const void *source, Uint64 length) +{ + PHYSFS_file *f = PHYSFS_openWrite(path); + PHYSFS_sint64 bw; + + if (!f) { + return SDL_SetError("%s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())); + } + + bw = PHYSFS_writeBytes(f, source, length); + PHYSFS_close(f); + + if (bw != (Sint64) length) { + return SDL_SetError("%s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())); + } + return 0; +} + +static int SDLCALL physfssdl3storage_mkdir(void *userdata, const char *path) +{ + if (!PHYSFS_mkdir(path)) { + return SDL_SetError("%s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())); + } + return 0; + +} + +static int SDLCALL physfssdl3storage_remove(void *userdata, const char *path) +{ + if (!PHYSFS_delete(path)) { + return SDL_SetError("%s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())); + } + return 0; +} + +static int SDLCALL physfssdl3storage_rename(void *userdata, const char *oldpath, const char *newpath) +{ + return SDL_Unsupported(); /* no rename operation in PhysicsFS. */ +} + +static Uint64 SDLCALL physfssdl3storage_space_remaining(void *userdata) +{ + return SDL_MAX_UINT64; /* we don't track this in PhysicsFS. */ +} + +SDL_Storage *PHYSFSSDL3_makeStorage(void) +{ + SDL_StorageInterface iface; + iface.close = physfssdl3storage_close; + iface.ready = physfssdl3storage_ready; + iface.enumerate = physfssdl3storage_enumerate; + iface.info = physfssdl3storage_info; + iface.read_file = physfssdl3storage_read_file; + iface.write_file = physfssdl3storage_write_file; + iface.mkdir = physfssdl3storage_mkdir; + iface.remove = physfssdl3storage_remove; + iface.rename = physfssdl3storage_rename; + iface.space_remaining = physfssdl3storage_space_remaining; + return SDL_OpenStorage(&iface, NULL); +} + +/* end of physfssdl3.c ... */ + diff --git a/extras/physfssdl3.h b/extras/physfssdl3.h new file mode 100644 index 00000000..81ce0640 --- /dev/null +++ b/extras/physfssdl3.h @@ -0,0 +1,106 @@ +/* + * This code provides a glue layer between PhysicsFS and Simple Directmedia + * Layer 3's (SDL3) SDL_IOStream and SDL_Storage i/o abstractions. + * + * License: this code is public domain. I make no warranty that it is useful, + * correct, harmless, or environmentally safe. + * + * This particular file may be used however you like, including copying it + * verbatim into a closed-source project, exploiting it commercially, and + * removing any trace of my name from the source (although I hope you won't + * do that). I welcome enhancements and corrections to this file, but I do + * not require you to send me patches if you make changes. This code has + * NO WARRANTY. + * + * Unless otherwise stated, the rest of PhysicsFS falls under the zlib license. + * Please see LICENSE.txt in the root of the source tree. + * + * SDL3 is zlib-licensed, like PhysicsFS. You can get SDL at + * https://www.libsdl.org/ + * + * This file was written by Ryan C. Gordon. (icculus@icculus.org). + */ + +/* This works with SDL3. For SDL1 and SDL2, use physfsrwops.h */ + +#ifndef _INCLUDE_PHYSFSSDL3_H_ +#define _INCLUDE_PHYSFSSDL3_H_ + +#include "physfs.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* You can either just get SDL_IOStreams directly from a PhysicsFS path, + or make an SDL_Storage that bridges to the PhysicsFS VFS. */ + + +/** + * Open a platform-independent filename for reading, and make it accessible + * via an SDL_IOStream. The file will be closed in PhysicsFS when the + * RWops is closed. PhysicsFS should be configured to your liking before + * opening files through this method. + * + * @param filename File to open in platform-independent notation. + * @return A valid SDL_IOStream on success, NULL on error. Specifics + * of the error can be gleaned from SDL_GetError(). + */ +PHYSFS_DECL SDL_IOStream *PHYSFSSDL3_openRead(const char *fname); + +/** + * Open a platform-independent filename for writing, and make it accessible + * via an SDL_IOStream. The file will be closed in PhysicsFS when the + * RWops is closed. PhysicsFS should be configured to your liking before + * opening files through this method. + * + * @param filename File to open in platform-independent notation. + * @return A valid SDL_IOStream on success, NULL on error. Specifics + * of the error can be gleaned from SDL_GetError(). + */ +PHYSFS_DECL SDL_IOStream *PHYSFSSDL3_openWrite(const char *fname); + +/** + * Open a platform-independent filename for appending, and make it accessible + * via an SDL_IOStream. The file will be closed in PhysicsFS when the + * RWops is closed. PhysicsFS should be configured to your liking before + * opening files through this method. + * + * @param filename File to open in platform-independent notation. + * @return A valid SDL_IOStream on success, NULL on error. Specifics + * of the error can be gleaned from SDL_GetError(). + */ +PHYSFS_DECL SDL_IOStream *PHYSFSSDL3_openAppend(const char *fname); + +/** + * Make a SDL_IOStream from an existing PhysicsFS file handle. You should + * dispose of any references to the handle after successful creation of + * the RWops. The actual PhysicsFS handle will be destroyed when the + * RWops is closed. + * + * @param handle a valid PhysicsFS file handle. + * @return A valid SDL_IOStream on success, NULL on error. Specifics + * of the error can be gleaned from SDL_GetError(). + */ +PHYSFS_DECL SDL_IOStream *PHYSFSSDL3_makeIOStream(PHYSFS_File *handle); + +/** + * Expose the PhysicsFS VFS through an SDL_Storage interface. + * This just makes the global interpolated file tree available + * through SDL3's interface. You can still manipulate it outside + * of SDL_Storage by calling PhysicsFS APIs directly. + * + * @return A valid SDL_Storage on success, NULL on error. Specifics + * of the error can be gleaned from SDL_GetError(). + */ +PHYSFS_DECL SDL_Storage *PHYSFSSDL3_makeStorage(void); + +#ifdef __cplusplus +} +#endif + +#endif /* include-once blocker */ + +/* end of physfssdl3.h ... */ + diff --git a/src/physfs.c b/src/physfs.c index b68c838f..e413c40f 100644 --- a/src/physfs.c +++ b/src/physfs.c @@ -1222,7 +1222,7 @@ int PHYSFS_init(const char *argv0) if ((allocator.Init != NULL) && (!allocator.Init())) return 0; - if (!__PHYSFS_platformInit()) + if (!__PHYSFS_platformInit(argv0)) { if (allocator.Deinit != NULL) allocator.Deinit(); return 0; @@ -3251,6 +3251,7 @@ const PHYSFS_Allocator *PHYSFS_getAllocator(void) } /* PHYSFS_getAllocator */ +#ifndef PHYSFS_NO_CRUNTIME_MALLOC static void *mallocAllocatorMalloc(PHYSFS_uint64 s) { if (!__PHYSFS_ui64FitsAddressSpace(s)) @@ -3274,16 +3275,18 @@ static void mallocAllocatorFree(void *ptr) #undef free free(ptr); } /* mallocAllocatorFree */ - +#endif static void setDefaultAllocator(void) { assert(!externalAllocator); allocator.Init = NULL; allocator.Deinit = NULL; + #ifndef PHYSFS_NO_CRUNTIME_MALLOC allocator.Malloc = mallocAllocatorMalloc; allocator.Realloc = mallocAllocatorRealloc; allocator.Free = mallocAllocatorFree; + #endif } /* setDefaultAllocator */ diff --git a/src/physfs.h b/src/physfs.h index f90029cf..780d99d8 100644 --- a/src/physfs.h +++ b/src/physfs.h @@ -524,6 +524,11 @@ typedef struct PHYSFS_AndroidInit * succeed, but PHYSFS_getBaseDir() and PHYSFS_getPrefDir() will be * incorrect. * + * \warning On Playdate, argv0 should be a non-NULL pointer to a PlaydateAPI + * struct. PhysicsFS uses this object for system-level access and + * will hold it until PHYSFS_deinit is called. + * If you pass a NULL here, PhysicsFS will crash. + * * \param argv0 the argv[0] string passed to your program's mainline. * This may be NULL on most platforms (such as ones without a * standard main() function), but you should always try to pass diff --git a/src/physfs_casefolding.h b/src/physfs_casefolding.h index bb6ac189..8050edba 100644 --- a/src/physfs_casefolding.h +++ b/src/physfs_casefolding.h @@ -107,6 +107,7 @@ static const CaseFoldMapping1_16 case_fold1_16_003[] = { { 0x0407, 0x0457 }, { 0x0506, 0x0507 }, { 0x1F1C, 0x1F14 }, + { 0x2C2F, 0x2C5F }, { 0xA7A4, 0xA7A5 }, { 0xABA8, 0x13D8 } }; @@ -163,6 +164,7 @@ static const CaseFoldMapping1_16 case_fold1_16_009[] = { { 0x040D, 0x045D }, { 0x050C, 0x050D }, { 0x2C25, 0x2C55 }, + { 0xA7AE, 0x026A }, { 0xABA2, 0x13D2 } }; @@ -303,6 +305,7 @@ static const CaseFoldMapping1_16 case_fold1_16_025[] = { { 0x0118, 0x0119 }, { 0x041D, 0x043D }, { 0x051C, 0x051D }, + { 0xA7BE, 0xA7BF }, { 0xABB2, 0x13E2 } }; @@ -317,6 +320,7 @@ static const CaseFoldMapping1_16 case_fold1_16_027[] = { { 0x011A, 0x011B }, { 0x041F, 0x043F }, { 0x051E, 0x051F }, + { 0xA7BC, 0xA7BD }, { 0xABB0, 0x13E0 } }; @@ -331,6 +335,7 @@ static const CaseFoldMapping1_16 case_fold1_16_029[] = { { 0x011C, 0x011D }, { 0x0419, 0x0439 }, { 0x0518, 0x0519 }, + { 0xA7BA, 0xA7BB }, { 0xABB6, 0x13E6 } }; @@ -345,6 +350,7 @@ static const CaseFoldMapping1_16 case_fold1_16_031[] = { { 0x011E, 0x011F }, { 0x041B, 0x043B }, { 0x051A, 0x051B }, + { 0xA7B8, 0xA7B9 }, { 0xABB4, 0x13E4 } }; @@ -644,7 +650,6 @@ static const CaseFoldMapping1_16 case_fold1_16_064[] = { }; static const CaseFoldMapping1_16 case_fold1_16_065[] = { - { 0x0041, 0x0061 }, { 0x0243, 0x0180 }, { 0x0544, 0x0574 }, { 0x2160, 0x2170 }, @@ -652,7 +657,6 @@ static const CaseFoldMapping1_16 case_fold1_16_065[] = { }; static const CaseFoldMapping1_16 case_fold1_16_066[] = { - { 0x0042, 0x0062 }, { 0x0143, 0x0144 }, { 0x0547, 0x0577 }, { 0x1E5C, 0x1E5D }, @@ -662,7 +666,6 @@ static const CaseFoldMapping1_16 case_fold1_16_066[] = { }; static const CaseFoldMapping1_16 case_fold1_16_067[] = { - { 0x0043, 0x0063 }, { 0x0241, 0x0242 }, { 0x0546, 0x0576 }, { 0x2162, 0x2172 }, @@ -670,7 +673,6 @@ static const CaseFoldMapping1_16 case_fold1_16_067[] = { }; static const CaseFoldMapping1_16 case_fold1_16_068[] = { - { 0x0044, 0x0064 }, { 0x0145, 0x0146 }, { 0x0246, 0x0247 }, { 0x0541, 0x0571 }, @@ -680,14 +682,12 @@ static const CaseFoldMapping1_16 case_fold1_16_068[] = { }; static const CaseFoldMapping1_16 case_fold1_16_069[] = { - { 0x0045, 0x0065 }, { 0x0540, 0x0570 }, { 0x2164, 0x2174 }, { 0x2C69, 0x2C6A } }; static const CaseFoldMapping1_16 case_fold1_16_070[] = { - { 0x0046, 0x0066 }, { 0x0147, 0x0148 }, { 0x0244, 0x0289 }, { 0x0345, 0x03B9 }, @@ -698,7 +698,6 @@ static const CaseFoldMapping1_16 case_fold1_16_070[] = { }; static const CaseFoldMapping1_16 case_fold1_16_071[] = { - { 0x0047, 0x0067 }, { 0x0245, 0x028C }, { 0x0542, 0x0572 }, { 0x2166, 0x2176 }, @@ -706,7 +705,6 @@ static const CaseFoldMapping1_16 case_fold1_16_071[] = { }; static const CaseFoldMapping1_16 case_fold1_16_072[] = { - { 0x0048, 0x0068 }, { 0x024A, 0x024B }, { 0x054D, 0x057D }, { 0x1E56, 0x1E57 }, @@ -715,13 +713,11 @@ static const CaseFoldMapping1_16 case_fold1_16_072[] = { }; static const CaseFoldMapping1_16 case_fold1_16_073[] = { - { 0x0049, 0x0069 }, { 0x054C, 0x057C }, { 0x2168, 0x2178 } }; static const CaseFoldMapping1_16 case_fold1_16_074[] = { - { 0x004A, 0x006A }, { 0x0248, 0x0249 }, { 0x054F, 0x057F }, { 0x1E54, 0x1E55 }, @@ -729,7 +725,6 @@ static const CaseFoldMapping1_16 case_fold1_16_074[] = { }; static const CaseFoldMapping1_16 case_fold1_16_075[] = { - { 0x004B, 0x006B }, { 0x014A, 0x014B }, { 0x054E, 0x057E }, { 0x216A, 0x217A }, @@ -737,7 +732,6 @@ static const CaseFoldMapping1_16 case_fold1_16_075[] = { }; static const CaseFoldMapping1_16 case_fold1_16_076[] = { - { 0x004C, 0x006C }, { 0x024E, 0x024F }, { 0x0549, 0x0579 }, { 0x1E52, 0x1E53 }, @@ -746,14 +740,12 @@ static const CaseFoldMapping1_16 case_fold1_16_076[] = { }; static const CaseFoldMapping1_16 case_fold1_16_077[] = { - { 0x004D, 0x006D }, { 0x014C, 0x014D }, { 0x0548, 0x0578 }, { 0x216C, 0x217C } }; static const CaseFoldMapping1_16 case_fold1_16_078[] = { - { 0x004E, 0x006E }, { 0x024C, 0x024D }, { 0x054B, 0x057B }, { 0x1E50, 0x1E51 }, @@ -762,7 +754,6 @@ static const CaseFoldMapping1_16 case_fold1_16_078[] = { }; static const CaseFoldMapping1_16 case_fold1_16_079[] = { - { 0x004F, 0x006F }, { 0x014E, 0x014F }, { 0x054A, 0x057A }, { 0x216E, 0x217E }, @@ -770,26 +761,23 @@ static const CaseFoldMapping1_16 case_fold1_16_079[] = { }; static const CaseFoldMapping1_16 case_fold1_16_080[] = { - { 0x0050, 0x0070 }, { 0x0555, 0x0585 }, { 0x1E4E, 0x1E4F } }; static const CaseFoldMapping1_16 case_fold1_16_081[] = { - { 0x0051, 0x0071 }, { 0x0150, 0x0151 }, { 0x0554, 0x0584 } }; static const CaseFoldMapping1_16 case_fold1_16_082[] = { - { 0x0052, 0x0072 }, { 0x1E4C, 0x1E4D }, { 0x1F4D, 0x1F45 }, - { 0x2C7E, 0x023F } + { 0x2C7E, 0x023F }, + { 0xA7F5, 0xA7F6 } }; static const CaseFoldMapping1_16 case_fold1_16_083[] = { - { 0x0053, 0x0073 }, { 0x0152, 0x0153 }, { 0x0556, 0x0586 }, { 0x1F4C, 0x1F44 }, @@ -797,46 +785,39 @@ static const CaseFoldMapping1_16 case_fold1_16_083[] = { }; static const CaseFoldMapping1_16 case_fold1_16_084[] = { - { 0x0054, 0x0074 }, { 0x0551, 0x0581 }, { 0x1E4A, 0x1E4B }, { 0x1F4B, 0x1F43 } }; static const CaseFoldMapping1_16 case_fold1_16_085[] = { - { 0x0055, 0x0075 }, { 0x0154, 0x0155 }, { 0x0550, 0x0580 }, { 0x1F4A, 0x1F42 } }; static const CaseFoldMapping1_16 case_fold1_16_086[] = { - { 0x0056, 0x0076 }, { 0x0553, 0x0583 }, { 0x1E48, 0x1E49 }, { 0x1F49, 0x1F41 } }; static const CaseFoldMapping1_16 case_fold1_16_087[] = { - { 0x0057, 0x0077 }, { 0x0156, 0x0157 }, { 0x0552, 0x0582 }, { 0x1F48, 0x1F40 } }; static const CaseFoldMapping1_16 case_fold1_16_088[] = { - { 0x0058, 0x0078 }, { 0x1E46, 0x1E47 } }; static const CaseFoldMapping1_16 case_fold1_16_089[] = { - { 0x0059, 0x0079 }, { 0x0158, 0x0159 }, { 0x2C75, 0x2C76 } }; static const CaseFoldMapping1_16 case_fold1_16_090[] = { - { 0x005A, 0x007A }, { 0x1E44, 0x1E45 } }; @@ -864,20 +845,24 @@ static const CaseFoldMapping1_16 case_fold1_16_095[] = { static const CaseFoldMapping1_16 case_fold1_16_096[] = { { 0x0464, 0x0465 }, - { 0x1E7E, 0x1E7F } + { 0x1E7E, 0x1E7F }, + { 0xA7C7, 0xA7C8 } }; static const CaseFoldMapping1_16 case_fold1_16_097[] = { - { 0x0160, 0x0161 } + { 0x0160, 0x0161 }, + { 0xA7C6, 0x1D8E } }; static const CaseFoldMapping1_16 case_fold1_16_098[] = { { 0x0466, 0x0467 }, - { 0x1E7C, 0x1E7D } + { 0x1E7C, 0x1E7D }, + { 0xA7C5, 0x0282 } }; static const CaseFoldMapping1_16 case_fold1_16_099[] = { - { 0x0162, 0x0163 } + { 0x0162, 0x0163 }, + { 0xA7C4, 0xA794 } }; static const CaseFoldMapping1_16 case_fold1_16_100[] = { @@ -886,7 +871,8 @@ static const CaseFoldMapping1_16 case_fold1_16_100[] = { }; static const CaseFoldMapping1_16 case_fold1_16_101[] = { - { 0x0164, 0x0165 } + { 0x0164, 0x0165 }, + { 0xA7C2, 0xA7C3 } }; static const CaseFoldMapping1_16 case_fold1_16_102[] = { @@ -895,7 +881,8 @@ static const CaseFoldMapping1_16 case_fold1_16_102[] = { }; static const CaseFoldMapping1_16 case_fold1_16_103[] = { - { 0x0166, 0x0167 } + { 0x0166, 0x0167 }, + { 0xA7C0, 0xA7C1 } }; static const CaseFoldMapping1_16 case_fold1_16_104[] = { @@ -927,7 +914,8 @@ static const CaseFoldMapping1_16 case_fold1_16_109[] = { static const CaseFoldMapping1_16 case_fold1_16_110[] = { { 0x046A, 0x046B }, - { 0x1E70, 0x1E71 } + { 0x1E70, 0x1E71 }, + { 0xA7C9, 0xA7CA } }; static const CaseFoldMapping1_16 case_fold1_16_111[] = { @@ -943,7 +931,8 @@ static const CaseFoldMapping1_16 case_fold1_16_112[] = { static const CaseFoldMapping1_16 case_fold1_16_113[] = { { 0x0170, 0x0171 }, { 0x0372, 0x0373 }, - { 0x1F6E, 0x1F66 } + { 0x1F6E, 0x1F66 }, + { 0xA7D6, 0xA7D7 } }; static const CaseFoldMapping1_16 case_fold1_16_114[] = { @@ -978,7 +967,8 @@ static const CaseFoldMapping1_16 case_fold1_16_118[] = { static const CaseFoldMapping1_16 case_fold1_16_119[] = { { 0x0176, 0x0177 }, - { 0x1F68, 0x1F60 } + { 0x1F68, 0x1F60 }, + { 0xA7D0, 0xA7D1 } }; static const CaseFoldMapping1_16 case_fold1_16_120[] = { @@ -1010,53 +1000,67 @@ static const CaseFoldMapping1_16 case_fold1_16_126[] = { { 0x1E60, 0x1E61 } }; +static const CaseFoldMapping1_16 case_fold1_16_127[] = { + { 0xA7D8, 0xA7D9 } +}; + static const CaseFoldMapping1_16 case_fold1_16_128[] = { { 0x0181, 0x0253 }, + { 0x1C9C, 0x10DC }, { 0x2CAC, 0x2CAD } }; static const CaseFoldMapping1_16 case_fold1_16_129[] = { + { 0x1C9D, 0x10DD }, { 0xA726, 0xA727 } }; static const CaseFoldMapping1_16 case_fold1_16_130[] = { + { 0x1C9E, 0x10DE }, { 0x2CAE, 0x2CAF } }; static const CaseFoldMapping1_16 case_fold1_16_131[] = { { 0x0182, 0x0183 }, + { 0x1C9F, 0x10DF }, { 0xA724, 0xA725 } }; static const CaseFoldMapping1_16 case_fold1_16_132[] = { { 0x0480, 0x0481 }, + { 0x1C98, 0x10D8 }, { 0x2CA8, 0x2CA9 } }; static const CaseFoldMapping1_16 case_fold1_16_133[] = { { 0x0184, 0x0185 }, { 0x0386, 0x03AC }, + { 0x1C99, 0x10D9 }, { 0x1E9B, 0x1E61 }, { 0xA722, 0xA723 } }; static const CaseFoldMapping1_16 case_fold1_16_134[] = { { 0x0187, 0x0188 }, + { 0x1C9A, 0x10DA }, { 0x2CAA, 0x2CAB } }; static const CaseFoldMapping1_16 case_fold1_16_135[] = { - { 0x0186, 0x0254 } + { 0x0186, 0x0254 }, + { 0x1C9B, 0x10DB } }; static const CaseFoldMapping1_16 case_fold1_16_136[] = { { 0x0189, 0x0256 }, { 0x048C, 0x048D }, + { 0x1C94, 0x10D4 }, { 0x2CA4, 0x2CA5 } }; static const CaseFoldMapping1_16 case_fold1_16_137[] = { { 0x038A, 0x03AF }, + { 0x1C95, 0x10D5 }, { 0xA72E, 0xA72F } }; @@ -1064,6 +1068,7 @@ static const CaseFoldMapping1_16 case_fold1_16_138[] = { { 0x018B, 0x018C }, { 0x0389, 0x03AE }, { 0x048E, 0x048F }, + { 0x1C96, 0x10D6 }, { 0x1E94, 0x1E95 }, { 0x2CA6, 0x2CA7 } }; @@ -1071,23 +1076,27 @@ static const CaseFoldMapping1_16 case_fold1_16_138[] = { static const CaseFoldMapping1_16 case_fold1_16_139[] = { { 0x018A, 0x0257 }, { 0x0388, 0x03AD }, + { 0x1C97, 0x10D7 }, { 0xA72C, 0xA72D } }; static const CaseFoldMapping1_16 case_fold1_16_140[] = { { 0x038F, 0x03CE }, + { 0x1C90, 0x10D0 }, { 0x1E92, 0x1E93 }, { 0x2CA0, 0x2CA1 } }; static const CaseFoldMapping1_16 case_fold1_16_141[] = { { 0x038E, 0x03CD }, + { 0x1C91, 0x10D1 }, { 0xA72A, 0xA72B } }; static const CaseFoldMapping1_16 case_fold1_16_142[] = { { 0x018F, 0x0259 }, { 0x048A, 0x048B }, + { 0x1C92, 0x10D2 }, { 0x1E90, 0x1E91 }, { 0x2CA2, 0x2CA3 } }; @@ -1095,6 +1104,7 @@ static const CaseFoldMapping1_16 case_fold1_16_142[] = { static const CaseFoldMapping1_16 case_fold1_16_143[] = { { 0x018E, 0x01DD }, { 0x038C, 0x03CC }, + { 0x1C93, 0x10D3 }, { 0xA728, 0xA729 } }; @@ -1129,6 +1139,7 @@ static const CaseFoldMapping1_16 case_fold1_16_147[] = { static const CaseFoldMapping1_16 case_fold1_16_148[] = { { 0x0397, 0x03B7 }, { 0x0490, 0x0491 }, + { 0x1C88, 0xA64B }, { 0x1E8A, 0x1E8B }, { 0x2CB8, 0x2CB9 } }; @@ -1155,6 +1166,7 @@ static const CaseFoldMapping1_16 case_fold1_16_151[] = { static const CaseFoldMapping1_16 case_fold1_16_152[] = { { 0x039B, 0x03BB }, { 0x049C, 0x049D }, + { 0x1C84, 0x0442 }, { 0x1E86, 0x1E87 }, { 0x24BC, 0x24D6 }, { 0x2CB4, 0x2CB5 } @@ -1163,6 +1175,7 @@ static const CaseFoldMapping1_16 case_fold1_16_152[] = { static const CaseFoldMapping1_16 case_fold1_16_153[] = { { 0x0198, 0x0199 }, { 0x039A, 0x03BA }, + { 0x1C85, 0x0442 }, { 0x24BD, 0x24D7 }, { 0xA73E, 0xA73F } }; @@ -1170,6 +1183,7 @@ static const CaseFoldMapping1_16 case_fold1_16_153[] = { static const CaseFoldMapping1_16 case_fold1_16_154[] = { { 0x0399, 0x03B9 }, { 0x049E, 0x049F }, + { 0x1C86, 0x044A }, { 0x1E84, 0x1E85 }, { 0x24BE, 0x24D8 }, { 0x2CB6, 0x2CB7 } @@ -1177,6 +1191,7 @@ static const CaseFoldMapping1_16 case_fold1_16_154[] = { static const CaseFoldMapping1_16 case_fold1_16_155[] = { { 0x0398, 0x03B8 }, + { 0x1C87, 0x0463 }, { 0x24BF, 0x24D9 }, { 0xA73C, 0xA73D } }; @@ -1185,6 +1200,7 @@ static const CaseFoldMapping1_16 case_fold1_16_156[] = { { 0x019D, 0x0272 }, { 0x039F, 0x03BF }, { 0x0498, 0x0499 }, + { 0x1C80, 0x0432 }, { 0x1E82, 0x1E83 }, { 0x24B8, 0x24D2 }, { 0x2CB0, 0x2CB1 } @@ -1193,6 +1209,7 @@ static const CaseFoldMapping1_16 case_fold1_16_156[] = { static const CaseFoldMapping1_16 case_fold1_16_157[] = { { 0x019C, 0x026F }, { 0x039E, 0x03BE }, + { 0x1C81, 0x0434 }, { 0x24B9, 0x24D3 }, { 0xA73A, 0xA73B } }; @@ -1201,6 +1218,7 @@ static const CaseFoldMapping1_16 case_fold1_16_158[] = { { 0x019F, 0x0275 }, { 0x039D, 0x03BD }, { 0x049A, 0x049B }, + { 0x1C82, 0x043E }, { 0x1E80, 0x1E81 }, { 0x24BA, 0x24D4 }, { 0x2CB2, 0x2CB3 } @@ -1208,6 +1226,7 @@ static const CaseFoldMapping1_16 case_fold1_16_158[] = { static const CaseFoldMapping1_16 case_fold1_16_159[] = { { 0x039C, 0x03BC }, + { 0x1C83, 0x0441 }, { 0x24BB, 0x24D5 }, { 0xA738, 0xA739 } }; @@ -1223,6 +1242,7 @@ static const CaseFoldMapping1_16 case_fold1_16_160[] = { static const CaseFoldMapping1_16 case_fold1_16_161[] = { { 0x01A0, 0x01A1 }, { 0x10B1, 0x2D11 }, + { 0x1CBD, 0x10FD }, { 0x1FBE, 0x03B9 } }; @@ -1230,6 +1250,7 @@ static const CaseFoldMapping1_16 case_fold1_16_162[] = { { 0x03A1, 0x03C1 }, { 0x04A6, 0x04A7 }, { 0x10B2, 0x2D12 }, + { 0x1CBE, 0x10FE }, { 0x1EBC, 0x1EBD }, { 0x2183, 0x2184 }, { 0x2C8E, 0x2C8F } @@ -1238,13 +1259,15 @@ static const CaseFoldMapping1_16 case_fold1_16_162[] = { static const CaseFoldMapping1_16 case_fold1_16_163[] = { { 0x01A2, 0x01A3 }, { 0x03A0, 0x03C0 }, - { 0x10B3, 0x2D13 } + { 0x10B3, 0x2D13 }, + { 0x1CBF, 0x10FF } }; static const CaseFoldMapping1_16 case_fold1_16_164[] = { { 0x03A7, 0x03C7 }, { 0x04A0, 0x04A1 }, { 0x10B4, 0x2D14 }, + { 0x1CB8, 0x10F8 }, { 0x1EBA, 0x1EBB }, { 0x1FBB, 0x1F71 }, { 0x2C88, 0x2C89 } @@ -1254,6 +1277,7 @@ static const CaseFoldMapping1_16 case_fold1_16_165[] = { { 0x01A4, 0x01A5 }, { 0x03A6, 0x03C6 }, { 0x10B5, 0x2D15 }, + { 0x1CB9, 0x10F9 }, { 0x1FBA, 0x1F70 } }; @@ -1262,6 +1286,7 @@ static const CaseFoldMapping1_16 case_fold1_16_166[] = { { 0x03A5, 0x03C5 }, { 0x04A2, 0x04A3 }, { 0x10B6, 0x2D16 }, + { 0x1CBA, 0x10FA }, { 0x1EB8, 0x1EB9 }, { 0x1FB9, 0x1FB1 }, { 0x2C8A, 0x2C8B } @@ -1279,147 +1304,171 @@ static const CaseFoldMapping1_16 case_fold1_16_168[] = { { 0x03AB, 0x03CB }, { 0x04AC, 0x04AD }, { 0x10B8, 0x2D18 }, + { 0x1CB4, 0x10F4 }, { 0x1EB6, 0x1EB7 }, { 0x2C84, 0x2C85 } }; static const CaseFoldMapping1_16 case_fold1_16_169[] = { { 0x03AA, 0x03CA }, - { 0x10B9, 0x2D19 } + { 0x10B9, 0x2D19 }, + { 0x1CB5, 0x10F5 } }; static const CaseFoldMapping1_16 case_fold1_16_170[] = { { 0x03A9, 0x03C9 }, { 0x04AE, 0x04AF }, { 0x10BA, 0x2D1A }, + { 0x1CB6, 0x10F6 }, { 0x1EB4, 0x1EB5 }, { 0x2C86, 0x2C87 } }; static const CaseFoldMapping1_16 case_fold1_16_171[] = { { 0x03A8, 0x03C8 }, - { 0x10BB, 0x2D1B } + { 0x10BB, 0x2D1B }, + { 0x1CB7, 0x10F7 } }; static const CaseFoldMapping1_16 case_fold1_16_172[] = { { 0x04A8, 0x04A9 }, { 0x10BC, 0x2D1C }, + { 0x1CB0, 0x10F0 }, { 0x1EB2, 0x1EB3 }, { 0x2C80, 0x2C81 } }; static const CaseFoldMapping1_16 case_fold1_16_173[] = { { 0x01AC, 0x01AD }, - { 0x10BD, 0x2D1D } + { 0x10BD, 0x2D1D }, + { 0x1CB1, 0x10F1 } }; static const CaseFoldMapping1_16 case_fold1_16_174[] = { { 0x01AF, 0x01B0 }, { 0x04AA, 0x04AB }, { 0x10BE, 0x2D1E }, + { 0x1CB2, 0x10F2 }, { 0x1EB0, 0x1EB1 }, { 0x2C82, 0x2C83 } }; static const CaseFoldMapping1_16 case_fold1_16_175[] = { { 0x01AE, 0x0288 }, - { 0x10BF, 0x2D1F } + { 0x10BF, 0x2D1F }, + { 0x1CB3, 0x10F3 } }; static const CaseFoldMapping1_16 case_fold1_16_176[] = { { 0x01B1, 0x028A }, { 0x04B4, 0x04B5 }, { 0x10A0, 0x2D00 }, + { 0x1CAC, 0x10EC }, { 0x1EAE, 0x1EAF }, { 0x2C9C, 0x2C9D } }; static const CaseFoldMapping1_16 case_fold1_16_177[] = { - { 0x10A1, 0x2D01 } + { 0x10A1, 0x2D01 }, + { 0x1CAD, 0x10ED } }; static const CaseFoldMapping1_16 case_fold1_16_178[] = { { 0x01B3, 0x01B4 }, { 0x04B6, 0x04B7 }, { 0x10A2, 0x2D02 }, + { 0x1CAE, 0x10EE }, { 0x1EAC, 0x1EAD }, { 0x2C9E, 0x2C9F } }; static const CaseFoldMapping1_16 case_fold1_16_179[] = { { 0x01B2, 0x028B }, - { 0x10A3, 0x2D03 } + { 0x10A3, 0x2D03 }, + { 0x1CAF, 0x10EF } }; static const CaseFoldMapping1_16 case_fold1_16_180[] = { { 0x01B5, 0x01B6 }, { 0x04B0, 0x04B1 }, { 0x10A4, 0x2D04 }, + { 0x1CA8, 0x10E8 }, { 0x1EAA, 0x1EAB }, { 0x2C98, 0x2C99 } }; static const CaseFoldMapping1_16 case_fold1_16_181[] = { { 0x00B5, 0x03BC }, - { 0x10A5, 0x2D05 } + { 0x10A5, 0x2D05 }, + { 0x1CA9, 0x10E9 } }; static const CaseFoldMapping1_16 case_fold1_16_182[] = { { 0x01B7, 0x0292 }, { 0x04B2, 0x04B3 }, { 0x10A6, 0x2D06 }, + { 0x1CAA, 0x10EA }, { 0x1EA8, 0x1EA9 }, { 0x2C9A, 0x2C9B } }; static const CaseFoldMapping1_16 case_fold1_16_183[] = { - { 0x10A7, 0x2D07 } + { 0x10A7, 0x2D07 }, + { 0x1CAB, 0x10EB } }; static const CaseFoldMapping1_16 case_fold1_16_184[] = { { 0x04BC, 0x04BD }, { 0x10A8, 0x2D08 }, + { 0x1CA4, 0x10E4 }, { 0x1EA6, 0x1EA7 }, { 0x2C94, 0x2C95 } }; static const CaseFoldMapping1_16 case_fold1_16_185[] = { { 0x01B8, 0x01B9 }, - { 0x10A9, 0x2D09 } + { 0x10A9, 0x2D09 }, + { 0x1CA5, 0x10E5 } }; static const CaseFoldMapping1_16 case_fold1_16_186[] = { { 0x04BE, 0x04BF }, { 0x10AA, 0x2D0A }, + { 0x1CA6, 0x10E6 }, { 0x1EA4, 0x1EA5 }, { 0x2C96, 0x2C97 } }; static const CaseFoldMapping1_16 case_fold1_16_187[] = { - { 0x10AB, 0x2D0B } + { 0x10AB, 0x2D0B }, + { 0x1CA7, 0x10E7 } }; static const CaseFoldMapping1_16 case_fold1_16_188[] = { { 0x04B8, 0x04B9 }, { 0x10AC, 0x2D0C }, + { 0x1CA0, 0x10E0 }, { 0x1EA2, 0x1EA3 }, { 0x2C90, 0x2C91 } }; static const CaseFoldMapping1_16 case_fold1_16_189[] = { { 0x01BC, 0x01BD }, - { 0x10AD, 0x2D0D } + { 0x10AD, 0x2D0D }, + { 0x1CA1, 0x10E1 } }; static const CaseFoldMapping1_16 case_fold1_16_190[] = { { 0x04BA, 0x04BB }, { 0x10AE, 0x2D0E }, + { 0x1CA2, 0x10E2 }, { 0x1EA0, 0x1EA1 }, { 0x2C92, 0x2C93 } }; static const CaseFoldMapping1_16 case_fold1_16_191[] = { - { 0x10AF, 0x2D0F } + { 0x10AF, 0x2D0F }, + { 0x1CA3, 0x10E3 } }; static const CaseFoldMapping1_16 case_fold1_16_192[] = { @@ -1933,171 +1982,308 @@ static const CaseFoldMapping1_32 case_fold1_32_000[] = { { 0x10404, 0x1042C }, { 0x10414, 0x1043C }, { 0x10424, 0x1044C }, + { 0x104B4, 0x104DC }, + { 0x104C4, 0x104EC }, + { 0x10575, 0x1059C }, + { 0x10585, 0x105AC }, + { 0x10595, 0x105BC }, { 0x10C8C, 0x10CCC }, { 0x10C9C, 0x10CDC }, { 0x10CAC, 0x10CEC }, { 0x118A8, 0x118C8 }, - { 0x118B8, 0x118D8 } + { 0x118B8, 0x118D8 }, + { 0x16E4E, 0x16E6E }, + { 0x16E5E, 0x16E7E }, + { 0x1E909, 0x1E92B }, + { 0x1E919, 0x1E93B } }; static const CaseFoldMapping1_32 case_fold1_32_001[] = { { 0x10405, 0x1042D }, { 0x10415, 0x1043D }, { 0x10425, 0x1044D }, + { 0x104B5, 0x104DD }, + { 0x104C5, 0x104ED }, + { 0x10574, 0x1059B }, + { 0x10584, 0x105AB }, + { 0x10594, 0x105BB }, { 0x10C8D, 0x10CCD }, { 0x10C9D, 0x10CDD }, { 0x10CAD, 0x10CED }, { 0x118A9, 0x118C9 }, - { 0x118B9, 0x118D9 } + { 0x118B9, 0x118D9 }, + { 0x16E4F, 0x16E6F }, + { 0x16E5F, 0x16E7F }, + { 0x1E908, 0x1E92A }, + { 0x1E918, 0x1E93A } }; static const CaseFoldMapping1_32 case_fold1_32_002[] = { { 0x10406, 0x1042E }, { 0x10416, 0x1043E }, { 0x10426, 0x1044E }, + { 0x104B6, 0x104DE }, + { 0x104C6, 0x104EE }, + { 0x10577, 0x1059E }, + { 0x10587, 0x105AE }, { 0x10C8E, 0x10CCE }, { 0x10C9E, 0x10CDE }, { 0x10CAE, 0x10CEE }, { 0x118AA, 0x118CA }, - { 0x118BA, 0x118DA } + { 0x118BA, 0x118DA }, + { 0x16E4C, 0x16E6C }, + { 0x16E5C, 0x16E7C }, + { 0x1E90B, 0x1E92D }, + { 0x1E91B, 0x1E93D } }; static const CaseFoldMapping1_32 case_fold1_32_003[] = { { 0x10407, 0x1042F }, { 0x10417, 0x1043F }, { 0x10427, 0x1044F }, + { 0x104B7, 0x104DF }, + { 0x104C7, 0x104EF }, + { 0x10576, 0x1059D }, + { 0x10586, 0x105AD }, { 0x10C8F, 0x10CCF }, { 0x10C9F, 0x10CDF }, { 0x10CAF, 0x10CEF }, { 0x118AB, 0x118CB }, - { 0x118BB, 0x118DB } + { 0x118BB, 0x118DB }, + { 0x16E4D, 0x16E6D }, + { 0x16E5D, 0x16E7D }, + { 0x1E90A, 0x1E92C }, + { 0x1E91A, 0x1E93C } }; static const CaseFoldMapping1_32 case_fold1_32_004[] = { { 0x10400, 0x10428 }, { 0x10410, 0x10438 }, { 0x10420, 0x10448 }, + { 0x104B0, 0x104D8 }, + { 0x104C0, 0x104E8 }, + { 0x104D0, 0x104F8 }, + { 0x10571, 0x10598 }, + { 0x10581, 0x105A8 }, + { 0x10591, 0x105B8 }, { 0x10C88, 0x10CC8 }, { 0x10C98, 0x10CD8 }, { 0x10CA8, 0x10CE8 }, { 0x118AC, 0x118CC }, - { 0x118BC, 0x118DC } + { 0x118BC, 0x118DC }, + { 0x16E4A, 0x16E6A }, + { 0x16E5A, 0x16E7A }, + { 0x1E90D, 0x1E92F }, + { 0x1E91D, 0x1E93F } }; static const CaseFoldMapping1_32 case_fold1_32_005[] = { { 0x10401, 0x10429 }, { 0x10411, 0x10439 }, { 0x10421, 0x10449 }, + { 0x104B1, 0x104D9 }, + { 0x104C1, 0x104E9 }, + { 0x104D1, 0x104F9 }, + { 0x10570, 0x10597 }, + { 0x10580, 0x105A7 }, + { 0x10590, 0x105B7 }, { 0x10C89, 0x10CC9 }, { 0x10C99, 0x10CD9 }, { 0x10CA9, 0x10CE9 }, { 0x118AD, 0x118CD }, - { 0x118BD, 0x118DD } + { 0x118BD, 0x118DD }, + { 0x16E4B, 0x16E6B }, + { 0x16E5B, 0x16E7B }, + { 0x1E90C, 0x1E92E }, + { 0x1E91C, 0x1E93E } }; static const CaseFoldMapping1_32 case_fold1_32_006[] = { { 0x10402, 0x1042A }, { 0x10412, 0x1043A }, { 0x10422, 0x1044A }, + { 0x104B2, 0x104DA }, + { 0x104C2, 0x104EA }, + { 0x104D2, 0x104FA }, + { 0x10573, 0x1059A }, + { 0x10583, 0x105AA }, { 0x10C8A, 0x10CCA }, { 0x10C9A, 0x10CDA }, { 0x10CAA, 0x10CEA }, { 0x118AE, 0x118CE }, - { 0x118BE, 0x118DE } + { 0x118BE, 0x118DE }, + { 0x16E48, 0x16E68 }, + { 0x16E58, 0x16E78 }, + { 0x1E90F, 0x1E931 }, + { 0x1E91F, 0x1E941 } }; static const CaseFoldMapping1_32 case_fold1_32_007[] = { { 0x10403, 0x1042B }, { 0x10413, 0x1043B }, { 0x10423, 0x1044B }, + { 0x104B3, 0x104DB }, + { 0x104C3, 0x104EB }, + { 0x104D3, 0x104FB }, + { 0x10572, 0x10599 }, + { 0x10582, 0x105A9 }, + { 0x10592, 0x105B9 }, { 0x10C8B, 0x10CCB }, { 0x10C9B, 0x10CDB }, { 0x10CAB, 0x10CEB }, { 0x118AF, 0x118CF }, - { 0x118BF, 0x118DF } + { 0x118BF, 0x118DF }, + { 0x16E49, 0x16E69 }, + { 0x16E59, 0x16E79 }, + { 0x1E90E, 0x1E930 }, + { 0x1E91E, 0x1E940 } }; static const CaseFoldMapping1_32 case_fold1_32_008[] = { { 0x1040C, 0x10434 }, { 0x1041C, 0x10444 }, + { 0x104BC, 0x104E4 }, + { 0x104CC, 0x104F4 }, + { 0x1057D, 0x105A4 }, + { 0x1058D, 0x105B4 }, { 0x10C84, 0x10CC4 }, { 0x10C94, 0x10CD4 }, { 0x10CA4, 0x10CE4 }, { 0x118A0, 0x118C0 }, - { 0x118B0, 0x118D0 } + { 0x118B0, 0x118D0 }, + { 0x16E46, 0x16E66 }, + { 0x16E56, 0x16E76 }, + { 0x1E901, 0x1E923 }, + { 0x1E911, 0x1E933 }, + { 0x1E921, 0x1E943 } }; static const CaseFoldMapping1_32 case_fold1_32_009[] = { { 0x1040D, 0x10435 }, { 0x1041D, 0x10445 }, + { 0x104BD, 0x104E5 }, + { 0x104CD, 0x104F5 }, + { 0x1057C, 0x105A3 }, + { 0x1058C, 0x105B3 }, { 0x10C85, 0x10CC5 }, { 0x10C95, 0x10CD5 }, { 0x10CA5, 0x10CE5 }, { 0x118A1, 0x118C1 }, - { 0x118B1, 0x118D1 } + { 0x118B1, 0x118D1 }, + { 0x16E47, 0x16E67 }, + { 0x16E57, 0x16E77 }, + { 0x1E900, 0x1E922 }, + { 0x1E910, 0x1E932 }, + { 0x1E920, 0x1E942 } }; static const CaseFoldMapping1_32 case_fold1_32_010[] = { { 0x1040E, 0x10436 }, { 0x1041E, 0x10446 }, + { 0x104BE, 0x104E6 }, + { 0x104CE, 0x104F6 }, + { 0x1057F, 0x105A6 }, + { 0x1058F, 0x105B6 }, { 0x10C86, 0x10CC6 }, { 0x10C96, 0x10CD6 }, { 0x10CA6, 0x10CE6 }, { 0x118A2, 0x118C2 }, - { 0x118B2, 0x118D2 } + { 0x118B2, 0x118D2 }, + { 0x16E44, 0x16E64 }, + { 0x16E54, 0x16E74 }, + { 0x1E903, 0x1E925 }, + { 0x1E913, 0x1E935 } }; static const CaseFoldMapping1_32 case_fold1_32_011[] = { { 0x1040F, 0x10437 }, { 0x1041F, 0x10447 }, + { 0x104BF, 0x104E7 }, + { 0x104CF, 0x104F7 }, + { 0x1057E, 0x105A5 }, + { 0x1058E, 0x105B5 }, { 0x10C87, 0x10CC7 }, { 0x10C97, 0x10CD7 }, { 0x10CA7, 0x10CE7 }, { 0x118A3, 0x118C3 }, - { 0x118B3, 0x118D3 } + { 0x118B3, 0x118D3 }, + { 0x16E45, 0x16E65 }, + { 0x16E55, 0x16E75 }, + { 0x1E902, 0x1E924 }, + { 0x1E912, 0x1E934 } }; static const CaseFoldMapping1_32 case_fold1_32_012[] = { { 0x10408, 0x10430 }, { 0x10418, 0x10440 }, + { 0x104B8, 0x104E0 }, + { 0x104C8, 0x104F0 }, + { 0x10579, 0x105A0 }, + { 0x10589, 0x105B0 }, { 0x10C80, 0x10CC0 }, { 0x10C90, 0x10CD0 }, { 0x10CA0, 0x10CE0 }, { 0x10CB0, 0x10CF0 }, { 0x118A4, 0x118C4 }, - { 0x118B4, 0x118D4 } + { 0x118B4, 0x118D4 }, + { 0x16E42, 0x16E62 }, + { 0x16E52, 0x16E72 }, + { 0x1E905, 0x1E927 }, + { 0x1E915, 0x1E937 } }; static const CaseFoldMapping1_32 case_fold1_32_013[] = { { 0x10409, 0x10431 }, { 0x10419, 0x10441 }, + { 0x104B9, 0x104E1 }, + { 0x104C9, 0x104F1 }, + { 0x10578, 0x1059F }, + { 0x10588, 0x105AF }, { 0x10C81, 0x10CC1 }, { 0x10C91, 0x10CD1 }, { 0x10CA1, 0x10CE1 }, { 0x10CB1, 0x10CF1 }, { 0x118A5, 0x118C5 }, - { 0x118B5, 0x118D5 } + { 0x118B5, 0x118D5 }, + { 0x16E43, 0x16E63 }, + { 0x16E53, 0x16E73 }, + { 0x1E904, 0x1E926 }, + { 0x1E914, 0x1E936 } }; static const CaseFoldMapping1_32 case_fold1_32_014[] = { { 0x1040A, 0x10432 }, { 0x1041A, 0x10442 }, + { 0x104BA, 0x104E2 }, + { 0x104CA, 0x104F2 }, { 0x10C82, 0x10CC2 }, { 0x10C92, 0x10CD2 }, { 0x10CA2, 0x10CE2 }, { 0x10CB2, 0x10CF2 }, { 0x118A6, 0x118C6 }, - { 0x118B6, 0x118D6 } + { 0x118B6, 0x118D6 }, + { 0x16E40, 0x16E60 }, + { 0x16E50, 0x16E70 }, + { 0x1E907, 0x1E929 }, + { 0x1E917, 0x1E939 } }; static const CaseFoldMapping1_32 case_fold1_32_015[] = { { 0x1040B, 0x10433 }, { 0x1041B, 0x10443 }, + { 0x104BB, 0x104E3 }, + { 0x104CB, 0x104F3 }, + { 0x1057A, 0x105A1 }, + { 0x1058A, 0x105B1 }, { 0x10C83, 0x10CC3 }, { 0x10C93, 0x10CD3 }, { 0x10CA3, 0x10CE3 }, { 0x118A7, 0x118C7 }, - { 0x118B7, 0x118D7 } + { 0x118B7, 0x118D7 }, + { 0x16E41, 0x16E61 }, + { 0x16E51, 0x16E71 }, + { 0x1E906, 0x1E928 }, + { 0x1E916, 0x1E938 } }; static const CaseFoldMapping2_16 case_fold2_16_000[] = { @@ -2389,7 +2575,7 @@ static const CaseFoldHashBucket1_16 case_fold_hash1_16[] = { { case_fold1_16_124, __PHYSFS_ARRAYLEN(case_fold1_16_124) }, { NULL, 0 }, { case_fold1_16_126, __PHYSFS_ARRAYLEN(case_fold1_16_126) }, - { NULL, 0 }, + { case_fold1_16_127, __PHYSFS_ARRAYLEN(case_fold1_16_127) }, { case_fold1_16_128, __PHYSFS_ARRAYLEN(case_fold1_16_128) }, { case_fold1_16_129, __PHYSFS_ARRAYLEN(case_fold1_16_129) }, { case_fold1_16_130, __PHYSFS_ARRAYLEN(case_fold1_16_130) }, diff --git a/src/physfs_internal.h b/src/physfs_internal.h index beff35d2..580a7bac 100644 --- a/src/physfs_internal.h +++ b/src/physfs_internal.h @@ -38,7 +38,7 @@ #include #endif -#if defined(PHYSFS_PLATFORM_SOLARIS) || defined(PHYSFS_PLATFORM_LINUX) +#if defined(PHYSFS_PLATFORM_SOLARIS) || defined(PHYSFS_PLATFORM_LINUX) || defined(PHYSFS_PLATFORM_OGC) #include #endif @@ -112,7 +112,9 @@ const void *__PHYSFS_winrtCalcPrefDir(void); /* atomic operations. */ /* increment/decrement operations return the final incremented/decremented value. */ -#if defined(_MSC_VER) && (_MSC_VER >= 1500) +#ifdef PHYSFS_PLATFORM_PLAYDATE +#define PHYSFS_NEED_ATOMIC_OP_FALLBACK 1 +#elif defined(_MSC_VER) && (_MSC_VER >= 1500) #include __PHYSFS_COMPILE_TIME_ASSERT(LongEqualsInt, sizeof (int) == sizeof (long)); #define __PHYSFS_ATOMIC_INCR(ptrval) _InterlockedIncrement((long*)(ptrval)) @@ -131,6 +133,9 @@ extern __inline int _xadd_watcom(volatile int *a, int v); #define __PHYSFS_ATOMIC_DECR(ptrval) (_xadd_watcom(ptrval, -1)-1) #else #define PHYSFS_NEED_ATOMIC_OP_FALLBACK 1 +#endif + +#ifdef PHYSFS_NEED_ATOMIC_OP_FALLBACK int __PHYSFS_ATOMIC_INCR(int *ptrval); int __PHYSFS_ATOMIC_DECR(int *ptrval); #endif @@ -470,12 +475,14 @@ void __PHYSFS_DirTreeDeinit(__PHYSFS_DirTree *dt); /* * Initialize the platform. This is called when PHYSFS_init() is called from - * the application. + * the application. argv[0] (or whatever the app is passing) is + * supplied here, since some platforms need it immediately, but this same + * pointer is also passed to __PHYSFS_platformCalcBaseDir a little later. * * Return zero if there was a catastrophic failure (which prevents you from * functioning at all), and non-zero otherwise. */ -int __PHYSFS_platformInit(void); +int __PHYSFS_platformInit(const char *argv0); /* diff --git a/src/physfs_platform_android.c b/src/physfs_platform_android.c index f892feda..79c524c5 100644 --- a/src/physfs_platform_android.c +++ b/src/physfs_platform_android.c @@ -18,7 +18,7 @@ static char *prefpath = NULL; -int __PHYSFS_platformInit(void) +int __PHYSFS_platformInit(const char *argv0) { return 1; /* always succeed. */ } /* __PHYSFS_platformInit */ diff --git a/src/physfs_platform_apple.m b/src/physfs_platform_apple.m index f98f10d7..777c1a22 100644 --- a/src/physfs_platform_apple.m +++ b/src/physfs_platform_apple.m @@ -16,7 +16,7 @@ #include "physfs_internal.h" -int __PHYSFS_platformInit(void) +int __PHYSFS_platformInit(const char *argv0) { return 1; /* success. */ } /* __PHYSFS_platformInit */ diff --git a/src/physfs_platform_haiku.cpp b/src/physfs_platform_haiku.cpp index fcf8ebde..4a4f6c75 100644 --- a/src/physfs_platform_haiku.cpp +++ b/src/physfs_platform_haiku.cpp @@ -26,7 +26,7 @@ #include "physfs_internal.h" -int __PHYSFS_platformInit(void) +int __PHYSFS_platformInit(const char *argv0) { return 1; /* always succeed. */ } /* __PHYSFS_platformInit */ diff --git a/src/physfs_platform_ogc.c b/src/physfs_platform_ogc.c new file mode 100644 index 00000000..6395e0f3 --- /dev/null +++ b/src/physfs_platform_ogc.c @@ -0,0 +1,437 @@ +/* + * Wii/GameCube support routines for PhysicsFS. + * + * Please see the file LICENSE.txt in the source's root directory. + * + * This file written by Ryan C. Gordon. + */ + +#define __PHYSICSFS_INTERNAL__ +#include "physfs_platforms.h" + +#ifdef PHYSFS_PLATFORM_OGC + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include + +#include "physfs_internal.h" + + +static PHYSFS_ErrorCode errcodeFromErrnoError(const int err) +{ + switch (err) + { + case 0: return PHYSFS_ERR_OK; + case EACCES: return PHYSFS_ERR_PERMISSION; + case EPERM: return PHYSFS_ERR_PERMISSION; + case EDQUOT: return PHYSFS_ERR_NO_SPACE; + case EIO: return PHYSFS_ERR_IO; + case ELOOP: return PHYSFS_ERR_SYMLINK_LOOP; + case EMLINK: return PHYSFS_ERR_NO_SPACE; + case ENAMETOOLONG: return PHYSFS_ERR_BAD_FILENAME; + case ENOENT: return PHYSFS_ERR_NOT_FOUND; + case ENOSPC: return PHYSFS_ERR_NO_SPACE; + case ENOTDIR: return PHYSFS_ERR_NOT_FOUND; + case EISDIR: return PHYSFS_ERR_NOT_A_FILE; + case EROFS: return PHYSFS_ERR_READ_ONLY; + case ETXTBSY: return PHYSFS_ERR_BUSY; + case EBUSY: return PHYSFS_ERR_BUSY; + case ENOMEM: return PHYSFS_ERR_OUT_OF_MEMORY; + case ENOTEMPTY: return PHYSFS_ERR_DIR_NOT_EMPTY; + default: return PHYSFS_ERR_OS_ERROR; + } /* switch */ +} /* errcodeFromErrnoError */ + + +static inline PHYSFS_ErrorCode errcodeFromErrno(void) +{ + return errcodeFromErrnoError(errno); +} /* errcodeFromErrno */ + + +static inline char *buildSubdirPath(const char *subdir, size_t subdir_length) +{ + const char *baseDir; + char *retval; + size_t length; + + baseDir = PHYSFS_getBaseDir(); + length = strlen(baseDir); + + retval = allocator.Malloc(length + subdir_length); + BAIL_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL); + strcpy(retval, baseDir); + strcpy(retval + length, subdir); + + return retval; +} + +char *__PHYSFS_platformCalcUserDir(void) +{ + static const char subdir[] = "userdata/"; + + /* We don't have users on the Wii/GameCube. Just create a userdata folder + * in the application's directory. */ + return buildSubdirPath(subdir, sizeof(subdir)); +} /* __PHYSFS_platformCalcUserDir */ + + +PHYSFS_EnumerateCallbackResult __PHYSFS_platformEnumerate(const char *dirname, + PHYSFS_EnumerateCallback callback, + const char *origdir, void *callbackdata) +{ + DIR *dir; + struct dirent *ent; + PHYSFS_EnumerateCallbackResult retval = PHYSFS_ENUM_OK; + + dir = opendir(dirname); + BAIL_IF(dir == NULL, errcodeFromErrno(), PHYSFS_ENUM_ERROR); + + while ((retval == PHYSFS_ENUM_OK) && ((ent = readdir(dir)) != NULL)) + { + const char *name = ent->d_name; + if (name[0] == '.') /* ignore "." and ".." */ + { + if ((name[1] == '\0') || ((name[1] == '.') && (name[2] == '\0'))) + continue; + } /* if */ + + retval = callback(callbackdata, origdir, name); + if (retval == PHYSFS_ENUM_ERROR) + PHYSFS_setErrorCode(PHYSFS_ERR_APP_CALLBACK); + } /* while */ + + closedir(dir); + + return retval; +} /* __PHYSFS_platformEnumerate */ + + +int __PHYSFS_platformMkDir(const char *path) +{ + const int rc = mkdir(path, S_IRWXU); + BAIL_IF(rc == -1, errcodeFromErrno(), 0); + return 1; +} /* __PHYSFS_platformMkDir */ + + +#if !defined(O_CLOEXEC) && defined(FD_CLOEXEC) +static inline void set_CLOEXEC(int fildes) +{ + int flags = fcntl(fildes, F_GETFD); + if (flags != -1) { + fcntl(fildes, F_SETFD, flags | FD_CLOEXEC); + } +} +#endif + +static void *doOpen(const char *filename, int mode) +{ + const int appending = (mode & O_APPEND); + int fd; + int *retval; + + errno = 0; + + /* O_APPEND doesn't actually behave as we'd like. */ + mode &= ~O_APPEND; + +#ifdef O_CLOEXEC + /* Add O_CLOEXEC if defined */ + mode |= O_CLOEXEC; +#endif + + do { + fd = open(filename, mode, S_IRUSR | S_IWUSR); + } while ((fd < 0) && (errno == EINTR)); + BAIL_IF(fd < 0, errcodeFromErrno(), NULL); + +#if !defined(O_CLOEXEC) && defined(FD_CLOEXEC) + set_CLOEXEC(fd); +#endif + + if (appending) + { + if (lseek(fd, 0, SEEK_END) < 0) + { + const int err = errno; + close(fd); + BAIL(errcodeFromErrnoError(err), NULL); + } /* if */ + } /* if */ + + retval = (int *) allocator.Malloc(sizeof (int)); + if (!retval) + { + close(fd); + BAIL(PHYSFS_ERR_OUT_OF_MEMORY, NULL); + } /* if */ + + *retval = fd; + return ((void *) retval); +} /* doOpen */ + + +void *__PHYSFS_platformOpenRead(const char *filename) +{ + return doOpen(filename, O_RDONLY); +} /* __PHYSFS_platformOpenRead */ + + +void *__PHYSFS_platformOpenWrite(const char *filename) +{ + return doOpen(filename, O_WRONLY | O_CREAT | O_TRUNC); +} /* __PHYSFS_platformOpenWrite */ + + +void *__PHYSFS_platformOpenAppend(const char *filename) +{ + return doOpen(filename, O_WRONLY | O_CREAT | O_APPEND); +} /* __PHYSFS_platformOpenAppend */ + + +PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buffer, + PHYSFS_uint64 len) +{ + const int fd = *((int *) opaque); + ssize_t rc = 0; + + if (!__PHYSFS_ui64FitsAddressSpace(len)) + BAIL(PHYSFS_ERR_INVALID_ARGUMENT, -1); + + do { + rc = read(fd, buffer, (size_t) len); + } while ((rc == -1) && (errno == EINTR)); + BAIL_IF(rc == -1, errcodeFromErrno(), -1); + assert(rc >= 0); + assert(rc <= len); + return (PHYSFS_sint64) rc; +} /* __PHYSFS_platformRead */ + + +PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buffer, + PHYSFS_uint64 len) +{ + const int fd = *((int *) opaque); + ssize_t rc = 0; + + if (!__PHYSFS_ui64FitsAddressSpace(len)) + BAIL(PHYSFS_ERR_INVALID_ARGUMENT, -1); + + do { + rc = write(fd, (void *) buffer, (size_t) len); + } while ((rc == -1) && (errno == EINTR)); + BAIL_IF(rc == -1, errcodeFromErrno(), rc); + assert(rc >= 0); + assert(rc <= len); + return (PHYSFS_sint64) rc; +} /* __PHYSFS_platformWrite */ + + +int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos) +{ + const int fd = *((int *) opaque); + const off_t rc = lseek(fd, (off_t) pos, SEEK_SET); + BAIL_IF(rc == -1, errcodeFromErrno(), 0); + return 1; +} /* __PHYSFS_platformSeek */ + + +PHYSFS_sint64 __PHYSFS_platformTell(void *opaque) +{ + const int fd = *((int *) opaque); + PHYSFS_sint64 retval; + retval = (PHYSFS_sint64) lseek(fd, 0, SEEK_CUR); + BAIL_IF(retval == -1, errcodeFromErrno(), -1); + return retval; +} /* __PHYSFS_platformTell */ + + +PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque) +{ + const int fd = *((int *) opaque); + struct stat statbuf; + BAIL_IF(fstat(fd, &statbuf) == -1, errcodeFromErrno(), -1); + return ((PHYSFS_sint64) statbuf.st_size); +} /* __PHYSFS_platformFileLength */ + + +int __PHYSFS_platformFlush(void *opaque) +{ + const int fd = *((int *) opaque); + int rc = -1; + if ((fcntl(fd, F_GETFL) & O_ACCMODE) != O_RDONLY) { + do { + rc = fsync(fd); + } while ((rc == -1) && (errno == EINTR)); + BAIL_IF(rc == -1, errcodeFromErrno(), 0); + } + return 1; +} /* __PHYSFS_platformFlush */ + + +void __PHYSFS_platformClose(void *opaque) +{ + const int fd = *((int *) opaque); + int rc = -1; + do { + rc = close(fd); /* we don't check this. You should have used flush! */ + } while ((rc == -1) && (errno == EINTR)); + allocator.Free(opaque); +} /* __PHYSFS_platformClose */ + + +int __PHYSFS_platformDelete(const char *path) +{ + BAIL_IF(remove(path) == -1, errcodeFromErrno(), 0); + return 1; +} /* __PHYSFS_platformDelete */ + + +int __PHYSFS_platformStat(const char *fname, PHYSFS_Stat *st, const int follow) +{ + struct stat statbuf; + const int rc = follow ? stat(fname, &statbuf) : lstat(fname, &statbuf); + BAIL_IF(rc == -1, errcodeFromErrno(), 0); + + if (S_ISREG(statbuf.st_mode)) + { + st->filetype = PHYSFS_FILETYPE_REGULAR; + st->filesize = statbuf.st_size; + } /* if */ + + else if(S_ISDIR(statbuf.st_mode)) + { + st->filetype = PHYSFS_FILETYPE_DIRECTORY; + st->filesize = 0; + } /* else if */ + + else if(S_ISLNK(statbuf.st_mode)) + { + st->filetype = PHYSFS_FILETYPE_SYMLINK; + st->filesize = 0; + } /* else if */ + + else + { + st->filetype = PHYSFS_FILETYPE_OTHER; + st->filesize = statbuf.st_size; + } /* else */ + + st->modtime = statbuf.st_mtime; + st->createtime = statbuf.st_ctime; + st->accesstime = statbuf.st_atime; + + st->readonly = (access(fname, W_OK) == -1); + return 1; +} /* __PHYSFS_platformStat */ + + +void *__PHYSFS_platformGetThreadID(void) +{ + return (void *) LWP_GetSelf(); +} /* __PHYSFS_platformGetThreadID */ + + +void *__PHYSFS_platformCreateMutex(void) +{ + mutex_t m; + LWP_MutexInit(&m, true); + return (void *) m; +} /* __PHYSFS_platformCreateMutex */ + + +void __PHYSFS_platformDestroyMutex(void *mutex) +{ + mutex_t m = (mutex_t) mutex; + + LWP_MutexDestroy(m); +} /* __PHYSFS_platformDestroyMutex */ + + +int __PHYSFS_platformGrabMutex(void *mutex) +{ + mutex_t m = (mutex_t) mutex; + return LWP_MutexLock(m) == 0 ? 1 : 0; +} /* __PHYSFS_platformGrabMutex */ + + +void __PHYSFS_platformReleaseMutex(void *mutex) +{ + mutex_t m = (mutex_t) mutex; + LWP_MutexUnlock(m); +} /* __PHYSFS_platformReleaseMutex */ + + + +int __PHYSFS_platformInit(const char *argv0) +{ + return 1; /* always succeed. */ +} /* __PHYSFS_platformInit */ + + +void __PHYSFS_platformDeinit(void) +{ + /* no-op */ +} /* __PHYSFS_platformDeinit */ + + +void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data) +{ +} /* __PHYSFS_platformDetectAvailableCDs */ + + +char *__PHYSFS_platformCalcBaseDir(const char *argv0) +{ + char *retval; + const size_t bufsize = 128; + + retval = allocator.Malloc(bufsize); + BAIL_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL); + + if (getcwd(retval, bufsize - 1)) + { + /* Make sure the path is slash-terminated */ + size_t length = strlen(retval); + if (length > 0 && retval[length - 1] != '/') + { + retval[length++] = '/'; + retval[length] = '\0'; + } + } + else + { + strcpy(retval, "/"); + } + + return retval; +} /* __PHYSFS_platformCalcBaseDir */ + + +char *__PHYSFS_platformCalcPrefDir(const char *org, const char *app) +{ + static const char subdir[] = "data/"; + + return buildSubdirPath(subdir, sizeof(subdir)); +} /* __PHYSFS_platformCalcPrefDir */ + +/* end of physfs_platform_unix.c ... */ + +#endif /* PHYSFS_PLATFORM_OGC */ + +/* end of physfs_platform_ogc.c ... */ + diff --git a/src/physfs_platform_os2.c b/src/physfs_platform_os2.c index bf47a9dc..73c387d0 100644 --- a/src/physfs_platform_os2.c +++ b/src/physfs_platform_os2.c @@ -292,7 +292,7 @@ static void prepUnicodeSupport(void) } /* prepUnicodeSupport */ -int __PHYSFS_platformInit(void) +int __PHYSFS_platformInit(const char *argv0) { prepUnicodeSupport(); return 1; /* ready to go! */ @@ -703,7 +703,7 @@ int __PHYSFS_platformDelete(const char *path) /* Convert to a format PhysicsFS can grok... */ -PHYSFS_sint64 os2TimeToUnixTime(const FDATE *date, const FTIME *time) +static PHYSFS_sint64 os2TimeToUnixTime(const FDATE *date, const FTIME *time) { struct tm tm; diff --git a/src/physfs_platform_playdate.c b/src/physfs_platform_playdate.c new file mode 100644 index 00000000..67ef4fdd --- /dev/null +++ b/src/physfs_platform_playdate.c @@ -0,0 +1,287 @@ +/* + * Playdate support routines for PhysicsFS. + * + * Please see the file LICENSE.txt in the source's root directory. + * + * This file written by Ryan C. Gordon. + */ + +#define __PHYSICSFS_INTERNAL__ +#include "physfs_platforms.h" + +#ifdef PHYSFS_PLATFORM_PLAYDATE + +#include "pd_api.h" + +#include "physfs_internal.h" + +static PlaydateAPI *playdate = NULL; + +/* Playdate interpolates a separate write dir on top of a read-only + base dir, so put the "user" dir somewhere deeper in the tree + so they don't overlap, so PhysicsFS can manage this like apps + expect. */ +#define WRITABLE_DIRNAME ".$PHYSFSWRITE$" + + +static void *playdateAllocatorMalloc(PHYSFS_uint64 s); +static void *playdateAllocatorRealloc(void *ptr, PHYSFS_uint64 s); +static void playdateAllocatorFree(void *ptr); + +int __PHYSFS_platformInit(const char *argv0) +{ + /* as a cheat, we expect argv0 to be a PlaydateAPI* on Playdate. */ + playdate = (PlaydateAPI *) argv0; + + allocator.Init = NULL; + allocator.Deinit = NULL; + allocator.Malloc = playdateAllocatorMalloc; + allocator.Realloc = playdateAllocatorRealloc; + allocator.Free = playdateAllocatorFree; + + return 1; /* ready to go! */ +} + +void __PHYSFS_platformDeinit(void) +{ + playdate = NULL; +} + +void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data) +{ + /* obviously no CD-ROM drives on Playdate */ +} + +char *__PHYSFS_platformCalcBaseDir(const char *argv0) +{ + return __PHYSFS_strdup("/"); +} + +char *__PHYSFS_platformCalcUserDir(void) +{ + return __PHYSFS_strdup("/" WRITABLE_DIRNAME "/"); +} + +char *__PHYSFS_platformCalcPrefDir(const char *org, const char *app) +{ + const size_t slen = strlen(org) + strlen(app) + strlen(WRITABLE_DIRNAME) + 5; + char *retval = (char *) allocator.Malloc(slen); + BAIL_IF(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL); + snprintf(retval, slen, "/" WRITABLE_DIRNAME "/%s/%s/", org, app); + return retval; +} + +typedef struct listfiles_callback_data +{ + PHYSFS_EnumerateCallback callback; + const char *origdir; + void *callbackdata; + PHYSFS_EnumerateCallbackResult retval; +} listfiles_callback_data; + +static void listfiles_callback(const char *path, void *userdata) +{ + listfiles_callback_data *data = (listfiles_callback_data *) userdata; + if (data->retval == PHYSFS_ENUM_OK) { + const char *od = data->origdir; + if (path[0] == '.') { /* ignore "." and ".." */ + if ((path[1] == '\0') || ((path[1] == '.') && (path[2] == '\0'))) { + return; + } + } + if ((*od == '\0') || ((od[0] == '/') && (od[1] == '\0'))) { + /* don't list our separated write dir when enumerating. */ + if (strcmp(path, WRITABLE_DIRNAME) == 0) { + return; + } + } + + data->retval = data->callback(data->callbackdata, data->origdir, path); + } +} + +PHYSFS_EnumerateCallbackResult __PHYSFS_platformEnumerate(const char *dirname, + PHYSFS_EnumerateCallback callback, + const char *origdir, void *callbackdata) +{ + listfiles_callback_data data; + data.callback = callback; + data.origdir = origdir; + data.callbackdata = callbackdata; + data.retval = PHYSFS_ENUM_OK; + if (playdate->file->listfiles(dirname, listfiles_callback, &data, 1) == -1) { + data.retval = PHYSFS_ENUM_ERROR; + PHYSFS_setErrorCode(PHYSFS_ERR_OS_ERROR); + } else if (data.retval == PHYSFS_ENUM_ERROR) { + PHYSFS_setErrorCode(PHYSFS_ERR_APP_CALLBACK); + } + + return data.retval; +} + +int __PHYSFS_platformMkDir(const char *filename) +{ + BAIL_IF(playdate->file->mkdir(filename) == -1, PHYSFS_ERR_OS_ERROR, 0); + return 1; +} + +void *__PHYSFS_platformOpenRead(const char *filename) +{ + SDFile *sdf = playdate->file->open(filename, kFileRead|kFileReadData); + BAIL_IF(!sdf, PHYSFS_ERR_OS_ERROR, NULL); + return sdf; +} + +void *__PHYSFS_platformOpenWrite(const char *filename) +{ + SDFile *sdf = playdate->file->open(filename, kFileWrite); + BAIL_IF(!sdf, PHYSFS_ERR_OS_ERROR, NULL); + return sdf; +} + +void *__PHYSFS_platformOpenAppend(const char *filename) +{ + SDFile *sdf = playdate->file->open(filename, kFileAppend); + BAIL_IF(!sdf, PHYSFS_ERR_OS_ERROR, NULL); + return sdf; +} + +PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buf, PHYSFS_uint64 len) +{ + int rc; + BAIL_IF(!__PHYSFS_ui64FitsAddressSpace(len),PHYSFS_ERR_INVALID_ARGUMENT,-1); + rc = playdate->file->read((SDFile *) opaque, buf, (unsigned int) len); + BAIL_IF(rc == -1, PHYSFS_ERR_OS_ERROR, -1); + return (PHYSFS_sint64) rc; +} + +PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buf, + PHYSFS_uint64 len) +{ + int rc; + BAIL_IF(!__PHYSFS_ui64FitsAddressSpace(len),PHYSFS_ERR_INVALID_ARGUMENT,-1); + rc = playdate->file->write((SDFile *) opaque, buf, (unsigned int) len); + BAIL_IF(rc == -1, PHYSFS_ERR_OS_ERROR, -1); + return (PHYSFS_sint64) rc; +} + +int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos) +{ + const int ipos = (int) pos; + int rc; + + /* hooray for 32-bit filesystem limits! :) */ + BAIL_IF(((PHYSFS_uint64) ipos) != pos, PHYSFS_ERR_INVALID_ARGUMENT, 0); + + rc = playdate->file->seek((SDFile *) opaque, ipos, SEEK_SET); + BAIL_IF(rc == -1, PHYSFS_ERR_OS_ERROR, 0); + return 1; +} + +PHYSFS_sint64 __PHYSFS_platformTell(void *opaque) +{ + const int pos = playdate->file->tell((SDFile *) opaque); + BAIL_IF(pos == -1, PHYSFS_ERR_OS_ERROR, -1); + return (PHYSFS_sint64) pos; +} + +PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque) +{ + SDFile *sdf = (SDFile *) opaque; + const int pos = playdate->file->tell(sdf); + int retval; + + BAIL_IF(pos == -1, PHYSFS_ERR_OS_ERROR, -1); + BAIL_IF(playdate->file->seek(sdf, 0, SEEK_END) == -1, PHYSFS_ERR_OS_ERROR, -1); + retval = playdate->file->tell(sdf); + BAIL_IF(playdate->file->seek(sdf, pos, SEEK_CUR) == -1, PHYSFS_ERR_OS_ERROR, -1); + BAIL_IF(retval == -1, PHYSFS_ERR_OS_ERROR, -1); + return (PHYSFS_sint64) retval; +} + +int __PHYSFS_platformFlush(void *opaque) +{ + BAIL_IF(playdate->file->flush((SDFile *) opaque) == -1, PHYSFS_ERR_OS_ERROR, 0); + return 1; +} + +void __PHYSFS_platformClose(void *opaque) +{ + playdate->file->close((SDFile *) opaque); /* ignore errors. You should have flushed! */ +} + +int __PHYSFS_platformDelete(const char *path) +{ + BAIL_IF(playdate->file->unlink(path, 0) == -1, PHYSFS_ERR_OS_ERROR, 0); + return 1; +} + + +/* Convert to a format PhysicsFS can grok... */ +static PHYSFS_sint64 playdateTimeToUnixTime(FileStat *statbuf) +{ + return 10; /* !!! FIXME: calculate the time in seconds, adjust for leap years and the Unix epoch. */ +} + +int __PHYSFS_platformStat(const char *filename, PHYSFS_Stat *st, const int follow) +{ + FileStat statbuf; + const int rc = playdate->file->stat(filename, &statbuf); + BAIL_IF(rc == -1, PHYSFS_ERR_OS_ERROR, 0); + + st->filesize = (PHYSFS_sint64) statbuf.size; + st->modtime = st->createtime = playdateTimeToUnixTime(&statbuf); + st->accesstime = -1; + st->filetype = statbuf.isdir ? PHYSFS_FILETYPE_DIRECTORY : PHYSFS_FILETYPE_REGULAR; + st->readonly = (strncmp(filename, "/" WRITABLE_DIRNAME, strlen("/" WRITABLE_DIRNAME)) == 0) ? 1 : 0; + + return 1; +} + +void *__PHYSFS_platformGetThreadID(void) +{ + return (void *) (size_t) 0x1; /* !!! FIXME: does Playdate have threads? */ +} + +void *__PHYSFS_platformCreateMutex(void) +{ + return (void *) (size_t) 0x1; /* !!! FIXME: does Playdate have threads? */ +} + +void __PHYSFS_platformDestroyMutex(void *mutex) +{ +} + +int __PHYSFS_platformGrabMutex(void *mutex) +{ + return 1; +} + +void __PHYSFS_platformReleaseMutex(void *mutex) +{ +} + + +#undef realloc + +static void *playdateAllocatorMalloc(PHYSFS_uint64 s) +{ + BAIL_IF(!__PHYSFS_ui64FitsAddressSpace(s), PHYSFS_ERR_OUT_OF_MEMORY, NULL); + return playdate->system->realloc(NULL, (size_t) s); +} + +static void *playdateAllocatorRealloc(void *ptr, PHYSFS_uint64 s) +{ + BAIL_IF(!__PHYSFS_ui64FitsAddressSpace(s), PHYSFS_ERR_OUT_OF_MEMORY, NULL); + return playdate->system->realloc(ptr, (size_t) s); +} + +static void playdateAllocatorFree(void *ptr) +{ + playdate->system->realloc(ptr, 0); +} + + +#endif /* PHYSFS_PLATFORM_PLAYDATE */ + +/* end of physfs_platform_playdate.c ... */ diff --git a/src/physfs_platform_qnx.c b/src/physfs_platform_qnx.c index 46f9aa70..2b279ac5 100644 --- a/src/physfs_platform_qnx.c +++ b/src/physfs_platform_qnx.c @@ -20,7 +20,7 @@ #include "physfs_internal.h" -int __PHYSFS_platformInit(void) +int __PHYSFS_platformInit(const char *argv0) { return 1; /* always succeed. */ } /* __PHYSFS_platformInit */ diff --git a/src/physfs_platform_unix.c b/src/physfs_platform_unix.c index b945e03f..f580fda6 100644 --- a/src/physfs_platform_unix.c +++ b/src/physfs_platform_unix.c @@ -60,7 +60,7 @@ #include "physfs_internal.h" -int __PHYSFS_platformInit(void) +int __PHYSFS_platformInit(const char *argv0) { return 1; /* always succeed. */ } /* __PHYSFS_platformInit */ diff --git a/src/physfs_platform_windows.c b/src/physfs_platform_windows.c index 652300c9..16d5abc3 100644 --- a/src/physfs_platform_windows.c +++ b/src/physfs_platform_windows.c @@ -123,7 +123,7 @@ static inline HANDLE winCreateFileW(const WCHAR *wfname, const DWORD mode, const DWORD creation) { const DWORD share = FILE_SHARE_READ | FILE_SHARE_WRITE; - #if defined(PHYSFS_PLATFORM_WINRT) || (_WIN32_WINNT >= 0x0602) // Windows 8+ + #if defined(PHYSFS_PLATFORM_WINRT) // also available if targeting Windows 8+ || (_WIN32_WINNT >= 0x0602) - but do not include this for now, due to common toolchain defaults return CreateFile2(wfname, mode, share, creation, NULL); #else return CreateFileW(wfname, mode, share, NULL, creation, @@ -613,7 +613,7 @@ char *__PHYSFS_platformCalcUserDir(void) } /* __PHYSFS_platformCalcUserDir */ -int __PHYSFS_platformInit(void) +int __PHYSFS_platformInit(const char *argv0) { return 1; /* It's all good */ } /* __PHYSFS_platformInit */ diff --git a/src/physfs_platforms.h b/src/physfs_platforms.h index 1ac17d9c..1cecc0ff 100644 --- a/src/physfs_platforms.h +++ b/src/physfs_platforms.h @@ -12,7 +12,10 @@ * PHYSFS_PLATFORM_UNIX on that system. */ -#if (defined __HAIKU__) +#if defined(TARGET_EXTENSION) && (defined(TARGET_PLAYDATE) || defined(TARGET_SIMULATOR)) +# define PHYSFS_PLATFORM_PLAYDATE 1 +# define PHYSFS_NO_CRUNTIME_MALLOC 1 +#elif (defined __HAIKU__) # define PHYSFS_PLATFORM_HAIKU 1 # define PHYSFS_PLATFORM_POSIX 1 #elif ((defined __BEOS__) || (defined __beos__)) @@ -72,6 +75,9 @@ #elif defined(unix) || defined(__unix__) # define PHYSFS_PLATFORM_UNIX 1 # define PHYSFS_PLATFORM_POSIX 1 +#elif defined(__wii__) || defined(__gamecube__) +# define PHYSFS_PLATFORM_OGC 1 +# define PHYSFS_NO_CDROM_SUPPORT 1 // TODO #else # error Unknown platform. #endif diff --git a/src/physfs_unicode.c b/src/physfs_unicode.c index bab4f8bb..8c615cf6 100644 --- a/src/physfs_unicode.c +++ b/src/physfs_unicode.c @@ -442,10 +442,10 @@ int PHYSFS_caseFold(const PHYSFS_uint32 from, PHYSFS_uint32 *to) if (from < 128) /* low-ASCII, easy! */ { if ((from >= 'A') && (from <= 'Z')) + { *to = from - ('A' - 'a'); - else - *to = from; - return 1; + return 1; + } /* if */ } /* if */ else if (from <= 0xFFFF)