|
|
Rockbox mail archiveSubject: Re: What function loads a .lang file?From: TP Diffenbach (rockbox_at_diffenbach.org) Date: 2003-04-29
Quoting Daniel Stenberg <daniel_at_haxx.se>:
> On Sun, 27 Apr 2003 for_spam_at_gmx.de wrote:
(As a parenthetical answer to Daniel Stenberg :), I probably wrote this when I thought str() was a function, not a macro. I wanted to store the pointers precisely because I did not want to to copy them redundantly.
What I still want to avoid is code that copies the pointers to lang strings into local arrays:
char* some_lang_strings[] = { str( FOO ), str( BAR ), str( baz ) } ;
I'd prefer to pass the IDs where possible.
I also want to be able to index into the language_strings array to get a char** to a contiguous group of language_string[] elements. In other words, if I knew that all the LANG_FILE_PREFIX_OFFSET_x strings were in order, one after the other, and that the first one was LANG_FILE_PREFIX_OFFSET_AT, I'd be able to do the following to write out my setting: get the address of the lang string pointer with the address-of operator, giving me a char** I could index into:
fprintf( fd, "%s: %s\r\n", str( LANG_FILE_PREFIX_OFFSET ),
I think Linus is skeptical of this, or perhaps I failed to explain well what I wanted to do. Of course this fails badly if the lang strings aren't ordered in language_strings (or if I index past the array, of course!), but I thought the make file generates code that orders them according to the order in english.lang.
Of course, I may be accused of early optimization (again!), but I'm trying to reduce code space as much as I can, aso as to have more of the 200KB .ajz space.
End parenthetical answer.)
-- Archos FM needs a Rockbox!
Page was last modified "Jan 10 2012" The Rockbox Crew |