diff options
| author | Jens Arnold <amiconn@rockbox.org> | 2005-01-19 21:43:15 +0000 |
|---|---|---|
| committer | Jens Arnold <amiconn@rockbox.org> | 2005-01-19 21:43:15 +0000 |
| commit | 0f0402929397bc020fa6e8f3fd9b78185cf76318 (patch) | |
| tree | b51cdd3cd365f0b587e88246c8cf5ef6de459bf4 /tools | |
| parent | 3c2fefdb99b24a000a5d896097cba479ad0e62a7 (diff) | |
| download | rockbox-0f0402929397bc020fa6e8f3fd9b78185cf76318.zip rockbox-0f0402929397bc020fa6e8f3fd9b78185cf76318.tar.gz rockbox-0f0402929397bc020fa6e8f3fd9b78185cf76318.tar.bz2 rockbox-0f0402929397bc020fa6e8f3fd9b78185cf76318.tar.xz | |
New way of handling the builtin language strings. Now the string pointers are no longer stored as initialised data, but calculated by walking one long string containing all language strings separated by \0. While this doesn't need more RAM, it fixes the problem that loading incomplete .lng files after complete ones did not reset the missing strings to the default, and it also decreases the binary size by >1700 bytes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5608 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/genlang | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/tools/genlang b/tools/genlang index e13cd3f..2677735 100755 --- a/tools/genlang +++ b/tools/genlang @@ -30,8 +30,11 @@ print HFILE <<MOO */ #define str(x) language_strings[x] -/* this is the array with all the strings */ +/* this is the array for holding the string pointers. + It will be initialized at runtime. */ extern unsigned char *language_strings[]; +/* this contains the concatenation of all strings, separated by \0 chars */ +extern const unsigned char language_builtin[]; /* The enum below contains all available strings */ enum { @@ -41,8 +44,11 @@ MOO print CFILE <<MOO /* This file was automaticly generated using genlang, the strings come from "$input" */ + +#include "$prefix.h" -unsigned char *language_strings[]={ +unsigned char *language_strings[LANG_LAST_INDEX_IN_ARRAY]; +const unsigned char language_builtin[] = MOO ; @@ -85,7 +91,8 @@ while(<LANG>) { } else { push @hfile, $set{'id'}; - print CFILE " $value,\n"; + $value =~ s/\"$/\\0\"/; + print CFILE " $value\n"; } undef %set; @@ -118,7 +125,7 @@ MOO ; print CFILE <<MOO -}; +; /* end of generated string list */ MOO ; |