const language packs (can't be const in simu (linker can't find it))

This commit is contained in:
Damjan Adamic
2014-09-02 10:18:17 +02:00
parent 13a1c5ca39
commit e506a001bf
4 changed files with 89 additions and 82 deletions
+12 -12
View File
@@ -41,19 +41,19 @@ const pm_uchar sticks[] PROGMEM = {
}; };
#if defined(CPUARM) #if defined(CPUARM)
extern LanguagePack czLanguagePack; extern LP_CONST LanguagePack czLanguagePack;
extern LanguagePack enLanguagePack; extern LP_CONST LanguagePack enLanguagePack;
extern LanguagePack esLanguagePack; extern LP_CONST LanguagePack esLanguagePack;
extern LanguagePack frLanguagePack; extern LP_CONST LanguagePack frLanguagePack;
extern LanguagePack deLanguagePack; extern LP_CONST LanguagePack deLanguagePack;
extern LanguagePack itLanguagePack; extern LP_CONST LanguagePack itLanguagePack;
extern LanguagePack plLanguagePack; extern LP_CONST LanguagePack plLanguagePack;
extern LanguagePack ptLanguagePack; extern LP_CONST LanguagePack ptLanguagePack;
extern LanguagePack skLanguagePack; extern LP_CONST LanguagePack skLanguagePack;
extern LanguagePack seLanguagePack; extern LP_CONST LanguagePack seLanguagePack;
extern LanguagePack huLanguagePack; extern LP_CONST LanguagePack huLanguagePack;
LanguagePack * languagePacks[] = { const LanguagePack * LP_CONST languagePacks[] = {
// alphabetical order // alphabetical order
&czLanguagePack, &czLanguagePack,
&deLanguagePack, &deLanguagePack,
+1 -1
View File
@@ -40,7 +40,7 @@
#define NO_HI_LEN 25 #define NO_HI_LEN 25
void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr); void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
inline void displayColumnHeader(const char **headers, uint8_t index) inline void displayColumnHeader(const char * const *headers, uint8_t index)
{ {
lcd_putsAtt(17*FW, 0, headers[index], 0); lcd_putsAtt(17*FW, 0, headers[index], 0);
} }
+3 -3
View File
@@ -492,9 +492,9 @@ const pm_char STR_BLCOLOR[] PROGMEM = TR_BLCOLOR;
#endif #endif
#if LCD_W >= 212 #if LCD_W >= 212
const char * STR_PHASES_HEADERS[] = TR_PHASES_HEADERS; const char * const STR_PHASES_HEADERS[] = TR_PHASES_HEADERS;
const char * STR_LIMITS_HEADERS[] = TR_LIMITS_HEADERS; const char * const STR_LIMITS_HEADERS[] = TR_LIMITS_HEADERS;
const char * STR_CSW_HEADERS[] = TR_CSW_HEADERS; const char * const STR_CSW_HEADERS[] = TR_CSW_HEADERS;
#endif #endif
#if defined(CPUARM) #if defined(CPUARM)
+14 -7
View File
@@ -640,17 +640,24 @@ extern const pm_char STR_TOO_MANY_LUA_SCRIPTS[];
extern const pm_char STR_BLCOLOR[]; extern const pm_char STR_BLCOLOR[];
#if defined(VOICE) && defined(CPUARM) #if defined(VOICE) && defined(CPUARM)
#if defined(SIMU)
#define LP_CONST
#else
#define LP_CONST const
#endif
struct LanguagePack { struct LanguagePack {
const char *id; const char *id;
const char *name; const char *name;
void (*playNumber)(getvalue_t number, uint8_t unit, uint8_t flags, uint8_t id); void (*playNumber)(getvalue_t number, uint8_t unit, uint8_t flags, uint8_t id);
void (*playDuration)(int seconds, uint8_t flags, uint8_t id); void (*playDuration)(int seconds, uint8_t flags, uint8_t id);
}; };
extern LanguagePack * languagePacks[]; extern const LanguagePack * LP_CONST languagePacks[];
extern LanguagePack * currentLanguagePack; extern const LanguagePack * currentLanguagePack;
extern uint8_t currentLanguagePackIdx; extern uint8_t currentLanguagePackIdx;
#define LANGUAGE_PACK_DECLARE(lng, name) LanguagePack lng ## LanguagePack = { #lng, name, lng ## _ ## playNumber, lng ## _ ## playDuration } #define LANGUAGE_PACK_DECLARE(lng, name) LP_CONST LanguagePack lng ## LanguagePack = { #lng, name, lng ## _ ## playNumber, lng ## _ ## playDuration }
#define LANGUAGE_PACK_DECLARE_DEFAULT(lng, name) LANGUAGE_PACK_DECLARE(lng, name); LanguagePack * currentLanguagePack = & lng ## LanguagePack; uint8_t currentLanguagePackIdx #define LANGUAGE_PACK_DECLARE_DEFAULT(lng, name) LANGUAGE_PACK_DECLARE(lng, name); const LanguagePack * currentLanguagePack = & lng ## LanguagePack; uint8_t currentLanguagePackIdx
inline PLAY_FUNCTION(playNumber, getvalue_t number, uint8_t unit, uint8_t flags) { currentLanguagePack->playNumber(number, unit, flags, id); } inline PLAY_FUNCTION(playNumber, getvalue_t number, uint8_t unit, uint8_t flags) { currentLanguagePack->playNumber(number, unit, flags, id); }
inline PLAY_FUNCTION(playDuration, int seconds, uint8_t flags) { currentLanguagePack->playDuration(seconds, flags, id); } inline PLAY_FUNCTION(playDuration, int seconds, uint8_t flags) { currentLanguagePack->playDuration(seconds, flags, id); }
#elif defined(VOICE) #elif defined(VOICE)
@@ -677,9 +684,9 @@ extern const pm_char STR_BLCOLOR[];
#endif #endif
#if LCD_W >= 212 #if LCD_W >= 212
extern const char * STR_PHASES_HEADERS[]; extern const char * const STR_PHASES_HEADERS[];
extern const char * STR_LIMITS_HEADERS[]; extern const char * const STR_LIMITS_HEADERS[];
extern const char * STR_CSW_HEADERS[]; extern const char * const STR_CSW_HEADERS[];
#endif #endif
#if defined(CPUARM) #if defined(CPUARM)