From 738c37cdcf568103f4a87c2d81228b483a09d1b8 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sun, 1 Apr 2007 13:09:22 +0000 Subject: Player: Reduced the selectable codepages to those which can actually work, and made them work. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12990 a1c6a512-1295-4272-9138-f99709370657 --- tools/buildzip.pl | 15 ++++--- tools/codepages.c | 115 +++++++++++++++++++++++++++++++++++++++--------------- tools/configure | 12 +++--- 3 files changed, 99 insertions(+), 43 deletions(-) (limited to 'tools') diff --git a/tools/buildzip.pl b/tools/buildzip.pl index 0463132ec4..3ddb0163d3 100755 --- a/tools/buildzip.pl +++ b/tools/buildzip.pl @@ -178,9 +178,18 @@ sub buildzip { } mkdir ".rockbox/wps", 0777; + mkdir ".rockbox/codepages", 0777; + + if($bitmap) { + system("$ROOT/tools/codepages"); + } + else { + system("$ROOT/tools/codepages -m"); + } + $c = 'find . -name "*.cp" ! -empty -exec mv {} .rockbox/codepages/ \; >/dev/null 2>&1'; + `$c`; if($bitmap) { - mkdir ".rockbox/codepages", 0777; mkdir ".rockbox/codecs", 0777; mkdir ".rockbox/themes", 0777; if($depth > 1) { @@ -190,10 +199,6 @@ sub buildzip { my $c = 'find apps -name "*.codec" ! -empty -exec cp {} .rockbox/codecs/ \; 2>/dev/null'; `$c`; - system("$ROOT/tools/codepages"); - $c = 'find . -name "*.cp" ! -empty -exec mv {} .rockbox/codepages/ \; >/dev/null 2>&1'; - `$c`; - my @call = `find .rockbox/codecs -type f 2>/dev/null`; if(!$call[0]) { # no codec was copied, remove directory again diff --git a/tools/codepages.c b/tools/codepages.c index e19d39c85a..651a99c429 100644 --- a/tools/codepages.c +++ b/tools/codepages.c @@ -23,6 +23,10 @@ #define MAX_TABLE_SIZE 32768 +static const int mini_index[5] = { + 0, 1, 3, 6, 7 +}; + static unsigned short iso_table[MAX_TABLE_SIZE]; unsigned short iso_decode(unsigned char *latin1, int cp, int count) @@ -147,53 +151,100 @@ int writeshort(FILE *f, unsigned short s) return putc(s>>8, f) != EOF; } -int main(void) +void print_usage(void) { + printf("Usage: codepages [-m]\n" + "\t-m Create isomini.cp only\n"); + printf("build date: " __DATE__ "\n\n"); +} +int main(int argc, char **argv) +{ + int mini = 0; int i, j; unsigned char k; unsigned short uni; FILE *of; + for (i = 1;i < argc;i++) + { + if (argv[i][0] == '-') + { + switch (argv[i][1]) + { + case 'm': /* create isomini.cp only */ + mini = 1; + break; + + case 'h': /* help */ + case '?': + print_usage(); + exit(1); + break; + + default: + print_usage(); + exit(1); + break; + } + } + } + for (i=0; i < MAX_TABLE_SIZE; i++) iso_table[i] = 0; - of = fopen("iso.cp", "wb"); - if (!of) return 1; + if (mini) { + of = fopen("isomini.cp", "wb"); + if (!of) return 1; - for (i=1; i<8; i++) { + for (i=1; i<5; i++) { - for (j=0; j<128; j++) { - k = (unsigned char)j + 128; - uni = iso_decode(&k, i, 1); - writeshort(of, uni); + for (j=0; j<128; j++) { + k = (unsigned char)j + 128; + uni = iso_decode(&k, mini_index[i], 1); + writeshort(of, uni); + } } + fclose(of); } - fclose(of); + else { + of = fopen("iso.cp", "wb"); + if (!of) return 1; - of = fopen("932.cp", "wb"); - if (!of) return 1; - for (i=0; i < MAX_TABLE_SIZE; i++) - writeshort(of, cp932_table[i]); - fclose(of); - - of = fopen("936.cp", "wb"); - if (!of) return 1; - for (i=0; i < MAX_TABLE_SIZE; i++) - writeshort(of, cp936_table[i]); - fclose(of); - - of = fopen("949.cp", "wb"); - if (!of) return 1; - for (i=0; i < MAX_TABLE_SIZE; i++) - writeshort(of, cp949_table[i]); - fclose(of); - - of = fopen("950.cp", "wb"); - if (!of) return 1; - for (i=0; i < MAX_TABLE_SIZE; i++) - writeshort(of, cp950_table[i]); - fclose(of); + for (i=1; i<8; i++) { + + for (j=0; j<128; j++) { + k = (unsigned char)j + 128; + uni = iso_decode(&k, i, 1); + writeshort(of, uni); + } + } + fclose(of); + + of = fopen("932.cp", "wb"); + if (!of) return 1; + for (i=0; i < MAX_TABLE_SIZE; i++) + writeshort(of, cp932_table[i]); + fclose(of); + + of = fopen("936.cp", "wb"); + if (!of) return 1; + for (i=0; i < MAX_TABLE_SIZE; i++) + writeshort(of, cp936_table[i]); + fclose(of); + + of = fopen("949.cp", "wb"); + if (!of) return 1; + for (i=0; i < MAX_TABLE_SIZE; i++) + writeshort(of, cp949_table[i]); + fclose(of); + + of = fopen("950.cp", "wb"); + if (!of) return 1; + for (i=0; i < MAX_TABLE_SIZE; i++) + writeshort(of, cp950_table[i]); + fclose(of); + } return 0; } diff --git a/tools/configure b/tools/configure index 1b469c855b..0341a29e85 100755 --- a/tools/configure +++ b/tools/configure @@ -598,16 +598,16 @@ EOF buildfor=`input`; # Set of tools built for all target platforms: - toolset="rdf2binary convbdf" + toolset="rdf2binary convbdf codepages" # Toolsets for some target families: - archosbitmaptools="$toolset scramble descramble sh2d uclpack bmp2rb codepages" - iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb codepages" - iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb codepages" + archosbitmaptools="$toolset scramble descramble sh2d uclpack bmp2rb" + iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb" + iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb" ipodbitmaptools="$toolset scramble ipod_fw bmp2rb codepages" - gigabeatbitmaptools="$toolset scramble descramble bmp2rb codepages" + gigabeatbitmaptools="$toolset scramble descramble bmp2rb" # generic is used by IFP, H10, Sansa-e200 - genericbitmaptools="$toolset bmp2rb codepages" + genericbitmaptools="$toolset bmp2rb" # ---- For each target ---- -- cgit v1.2.3