mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
4a5af7fd26
Previously, each mapping between a codepage byte and a Unicode character was stored as a struct table_entry, which listed both the byte and the character. This representation may be optimal for sparse mappings, but codepages map almost every possible byte to a character, so it is more efficient to just have an array that lists the Unicode character corresponding to each byte from 0x80 to 0xFF. The bytes are not stored but rather implied by the array index. The tcvn5712 and viscii codepages have a total of four mappings that do not fit in the arrays, so we still use struct table_entry for those. This change also makes cp2u() operate in O(1) time and may speed up other functions as well. The "sed | while read" concoction in Unicode/gen-cp looks rather unhealthy. It would probably be faster and more readable if rewritten in Perl, but IMO that goes for the previous version as well, so I suppose whoever wrote it had a reason not to use Perl here. Before: text data bss dec hex filename 38948 28528 3311 70787 11483 src/intl/charsets.o 500096 85568 82112 667776 a3080 src/elinks After: text data bss dec hex filename 31558 28528 3311 63397 f7a5 src/intl/charsets.o 492878 85568 82112 660558 a144e src/elinks So the text section shrank by 7390 bytes. Measured on i686-pc-linux-gnu with: --disable-xbel --disable-nls --disable-cookies --disable-formhist --disable-globhist --disable-mailcap --disable-mimetypes --disable-smb --disable-mouse --disable-sysmouse --disable-leds --disable-marks --disable-css --enable-small --enable-utf-8 --without-gpm --without-bzlib --without-idn --without-spidermonkey --without-lua --without-gnutls --without-openssl CFLAGS="-Os -ggdb -Wall" |
||
---|---|---|
.. | ||
7bit.cp | ||
7bitrepl.lnx | ||
8859_1.cp | ||
8859_2.cp | ||
8859_3.cp | ||
8859_4.cp | ||
8859_5.cp | ||
8859_6.cp | ||
8859_7.cp | ||
8859_8.cp | ||
8859_9.cp | ||
8859_10.cp | ||
8859_13.cp | ||
8859_14.cp | ||
8859_15.cp | ||
8859_16.cp | ||
cp437.cp | ||
cp737.cp | ||
cp850.cp | ||
cp852.cp | ||
cp866.cp | ||
cp1125.cp | ||
cp1250.cp | ||
cp1251.cp | ||
cp1252.cp | ||
cp1256.cp | ||
cp1257.cp | ||
entities.txt | ||
gen | ||
gen-7b | ||
gen-case | ||
gen-cp | ||
gen-ent | ||
index.txt | ||
kamen.cp | ||
koi8_r.cp | ||
koi8_ru.cp | ||
koi8_u.cp | ||
mac_lat2.cp | ||
macroman.cp | ||
README | ||
tcvn5712.cp | ||
tr7bit.awk | ||
utf8.cp | ||
viscii.cp |
This contains charset definitions and convert tables. If you'll change anything, run ./gen - it will regenerate the header files and place them inside src/intl/.