summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/buildzip.pl15
-rw-r--r--tools/codepages.c115
-rwxr-xr-xtools/configure12
3 files changed, 99 insertions, 43 deletions
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 {
178 } 178 }
179 179
180 mkdir ".rockbox/wps", 0777; 180 mkdir ".rockbox/wps", 0777;
181 mkdir ".rockbox/codepages", 0777;
182
183 if($bitmap) {
184 system("$ROOT/tools/codepages");
185 }
186 else {
187 system("$ROOT/tools/codepages -m");
188 }
189 $c = 'find . -name "*.cp" ! -empty -exec mv {} .rockbox/codepages/ \; >/dev/null 2>&1';
190 `$c`;
181 191
182 if($bitmap) { 192 if($bitmap) {
183 mkdir ".rockbox/codepages", 0777;
184 mkdir ".rockbox/codecs", 0777; 193 mkdir ".rockbox/codecs", 0777;
185 mkdir ".rockbox/themes", 0777; 194 mkdir ".rockbox/themes", 0777;
186 if($depth > 1) { 195 if($depth > 1) {
@@ -190,10 +199,6 @@ sub buildzip {
190 my $c = 'find apps -name "*.codec" ! -empty -exec cp {} .rockbox/codecs/ \; 2>/dev/null'; 199 my $c = 'find apps -name "*.codec" ! -empty -exec cp {} .rockbox/codecs/ \; 2>/dev/null';
191 `$c`; 200 `$c`;
192 201
193 system("$ROOT/tools/codepages");
194 $c = 'find . -name "*.cp" ! -empty -exec mv {} .rockbox/codepages/ \; >/dev/null 2>&1';
195 `$c`;
196
197 my @call = `find .rockbox/codecs -type f 2>/dev/null`; 202 my @call = `find .rockbox/codecs -type f 2>/dev/null`;
198 if(!$call[0]) { 203 if(!$call[0]) {
199 # no codec was copied, remove directory again 204 # 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 @@
23 23
24#define MAX_TABLE_SIZE 32768 24#define MAX_TABLE_SIZE 32768
25 25
26static const int mini_index[5] = {
27 0, 1, 3, 6, 7
28};
29
26static unsigned short iso_table[MAX_TABLE_SIZE]; 30static unsigned short iso_table[MAX_TABLE_SIZE];
27 31
28unsigned short iso_decode(unsigned char *latin1, int cp, int count) 32unsigned short iso_decode(unsigned char *latin1, int cp, int count)
@@ -147,53 +151,100 @@ int writeshort(FILE *f, unsigned short s)
147 return putc(s>>8, f) != EOF; 151 return putc(s>>8, f) != EOF;
148} 152}
149 153
150int main(void) 154void print_usage(void)
151{ 155{
156 printf("Usage: codepages [-m]\n"
157 "\t-m Create isomini.cp only\n");
158 printf("build date: " __DATE__ "\n\n");
159}
152 160
161int main(int argc, char **argv)
162{
163 int mini = 0;
153 int i, j; 164 int i, j;
154 unsigned char k; 165 unsigned char k;
155 unsigned short uni; 166 unsigned short uni;
156 FILE *of; 167 FILE *of;
157 168
169 for (i = 1;i < argc;i++)
170 {
171 if (argv[i][0] == '-')
172 {
173 switch (argv[i][1])
174 {
175 case 'm': /* create isomini.cp only */
176 mini = 1;
177 break;
178
179 case 'h': /* help */
180 case '?':
181 print_usage();
182 exit(1);
183 break;
184
185 default:
186 print_usage();
187 exit(1);
188 break;
189 }
190 }
191 }
192
158 for (i=0; i < MAX_TABLE_SIZE; i++) 193 for (i=0; i < MAX_TABLE_SIZE; i++)
159 iso_table[i] = 0; 194 iso_table[i] = 0;
160 195
161 of = fopen("iso.cp", "wb"); 196 if (mini) {
162 if (!of) return 1; 197 of = fopen("isomini.cp", "wb");
198 if (!of) return 1;
163 199
164 for (i=1; i<8; i++) { 200 for (i=1; i<5; i++) {
165 201
166 for (j=0; j<128; j++) { 202 for (j=0; j<128; j++) {
167 k = (unsigned char)j + 128; 203 k = (unsigned char)j + 128;
168 uni = iso_decode(&k, i, 1); 204 uni = iso_decode(&k, mini_index[i], 1);
169 writeshort(of, uni); 205 writeshort(of, uni);
206 }
170 } 207 }
208 fclose(of);
171 } 209 }
172 fclose(of); 210 else {
211 of = fopen("iso.cp", "wb");
212 if (!of) return 1;
173 213
174 of = fopen("932.cp", "wb"); 214 for (i=1; i<8; i++) {
175 if (!of) return 1; 215
176 for (i=0; i < MAX_TABLE_SIZE; i++) 216 for (j=0; j<128; j++) {
177 writeshort(of, cp932_table[i]); 217 k = (unsigned char)j + 128;
178 fclose(of); 218 uni = iso_decode(&k, i, 1);
179 219 writeshort(of, uni);
180 of = fopen("936.cp", "wb"); 220 }
181 if (!of) return 1; 221 }
182 for (i=0; i < MAX_TABLE_SIZE; i++) 222 fclose(of);
183 writeshort(of, cp936_table[i]); 223
184 fclose(of); 224 of = fopen("932.cp", "wb");
185 225 if (!of) return 1;
186 of = fopen("949.cp", "wb"); 226 for (i=0; i < MAX_TABLE_SIZE; i++)
187 if (!of) return 1; 227 writeshort(of, cp932_table[i]);
188 for (i=0; i < MAX_TABLE_SIZE; i++) 228 fclose(of);
189 writeshort(of, cp949_table[i]); 229
190 fclose(of); 230 of = fopen("936.cp", "wb");
191 231 if (!of) return 1;
192 of = fopen("950.cp", "wb"); 232 for (i=0; i < MAX_TABLE_SIZE; i++)
193 if (!of) return 1; 233 writeshort(of, cp936_table[i]);
194 for (i=0; i < MAX_TABLE_SIZE; i++) 234 fclose(of);
195 writeshort(of, cp950_table[i]); 235
196 fclose(of); 236 of = fopen("949.cp", "wb");
237 if (!of) return 1;
238 for (i=0; i < MAX_TABLE_SIZE; i++)
239 writeshort(of, cp949_table[i]);
240 fclose(of);
241
242 of = fopen("950.cp", "wb");
243 if (!of) return 1;
244 for (i=0; i < MAX_TABLE_SIZE; i++)
245 writeshort(of, cp950_table[i]);
246 fclose(of);
247 }
197 248
198 return 0; 249 return 0;
199} 250}
diff --git a/tools/configure b/tools/configure
index 1b469c855b..0341a29e85 100755
--- a/tools/configure
+++ b/tools/configure
@@ -598,16 +598,16 @@ EOF
598 buildfor=`input`; 598 buildfor=`input`;
599 599
600 # Set of tools built for all target platforms: 600 # Set of tools built for all target platforms:
601 toolset="rdf2binary convbdf" 601 toolset="rdf2binary convbdf codepages"
602 602
603 # Toolsets for some target families: 603 # Toolsets for some target families:
604 archosbitmaptools="$toolset scramble descramble sh2d uclpack bmp2rb codepages" 604 archosbitmaptools="$toolset scramble descramble sh2d uclpack bmp2rb"
605 iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb codepages" 605 iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb"
606 iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb codepages" 606 iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb"
607 ipodbitmaptools="$toolset scramble ipod_fw bmp2rb codepages" 607 ipodbitmaptools="$toolset scramble ipod_fw bmp2rb codepages"
608 gigabeatbitmaptools="$toolset scramble descramble bmp2rb codepages" 608 gigabeatbitmaptools="$toolset scramble descramble bmp2rb"
609 # generic is used by IFP, H10, Sansa-e200 609 # generic is used by IFP, H10, Sansa-e200
610 genericbitmaptools="$toolset bmp2rb codepages" 610 genericbitmaptools="$toolset bmp2rb"
611 611
612 612
613 # ---- For each target ---- 613 # ---- For each target ----