summaryrefslogtreecommitdiff
path: root/apps/gui/wps_parser.c
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-04-10 13:37:08 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-04-10 13:37:08 +0000
commit536c5d9e744afe894aa221bb5ce23e175a3f54e5 (patch)
tree76ae73120d14aca8fcf250ae27816a42c61091a9 /apps/gui/wps_parser.c
parentaf7780e0b3f27a574b007be6ac7a273d14f6b76a (diff)
downloadrockbox-536c5d9e744afe894aa221bb5ce23e175a3f54e5.zip
rockbox-536c5d9e744afe894aa221bb5ce23e175a3f54e5.tar.gz
rockbox-536c5d9e744afe894aa221bb5ce23e175a3f54e5.tar.bz2
rockbox-536c5d9e744afe894aa221bb5ce23e175a3f54e5.tar.xz
RTC tags for the WPS: Accept FS#6998 and FS#7001 by Alexander Levin with changes by me. CUSTOM WPS FILES NEED TO BE UPDATED !
The RTC tags are now atomic, i.e. instead of using one tag with the format (e.g. %cd m yc), we use several separate tags, one for each value (e.g. %cd %cm %cy). Also, %cP produces an uppercase AM/PM indicator and %cp a lowercase one, which is the opposite from what they did before. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13093 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/wps_parser.c')
-rw-r--r--apps/gui/wps_parser.c76
1 files changed, 17 insertions, 59 deletions
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index 8d917cd..b25fe24 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -108,33 +108,6 @@ static int parse_image_display(const char *wps_bufptr,
static int parse_image_load(const char *wps_bufptr,
struct wps_token *token, struct wps_data *wps_data);
#endif /*HAVE_LCD_BITMAP */
-#if CONFIG_RTC
-static int parse_rtc_format(const char *wps_bufptr,
- struct wps_token *token, struct wps_data *wps_data);
-
-/* RTC tokens array */
-static const struct wps_tag rtc_tags[] = {
- { WPS_TOKEN_RTC_DAY_OF_MONTH, "d", 0, NULL },
- { WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED, "e", 0, NULL },
- { WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED, "H", 0, NULL },
- { WPS_TOKEN_RTC_HOUR_24, "k", 0, NULL },
- { WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED, "I", 0, NULL },
- { WPS_TOKEN_RTC_HOUR_12, "l", 0, NULL },
- { WPS_TOKEN_RTC_MONTH, "m", 0, NULL },
- { WPS_TOKEN_RTC_MINUTE, "M", 0, NULL },
- { WPS_TOKEN_RTC_SECOND, "S", 0, NULL },
- { WPS_TOKEN_RTC_YEAR_2_DIGITS, "y", 0, NULL },
- { WPS_TOKEN_RTC_YEAR_4_DIGITS, "Y", 0, NULL },
- { WPS_TOKEN_RTC_AM_PM_UPPER, "p", 0, NULL },
- { WPS_TOKEN_RTC_AM_PM_LOWER, "P", 0, NULL },
- { WPS_TOKEN_RTC_WEEKDAY_NAME, "a", 0, NULL },
- { WPS_TOKEN_RTC_MONTH_NAME, "b", 0, NULL },
- { WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON, "u", 0, NULL },
- { WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN, "w", 0, NULL },
- { WPS_TOKEN_CHARACTER, "", 0, NULL }
- /* the array MUST end with an empty string (first char is \0) */
-};
-#endif
/* array of available tags - those with more characters have to go first
(e.g. "xl" and "xd" before "x"). It needs to end with the unknown token. */
@@ -156,7 +129,23 @@ static const struct wps_tag all_tags[] = {
#endif
#if CONFIG_RTC
- { WPS_TOKEN_RTC, "c", WPS_REFRESH_DYNAMIC, parse_rtc_format },
+ { WPS_TOKEN_RTC_DAY_OF_MONTH, "cd", WPS_REFRESH_DYNAMIC, NULL },
+ { WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED, "ce", WPS_REFRESH_DYNAMIC, NULL },
+ { WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED, "cH", WPS_REFRESH_DYNAMIC, NULL },
+ { WPS_TOKEN_RTC_HOUR_24, "ck", WPS_REFRESH_DYNAMIC, NULL },
+ { WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED, "cI", WPS_REFRESH_DYNAMIC, NULL },
+ { WPS_TOKEN_RTC_HOUR_12, "cl", WPS_REFRESH_DYNAMIC, NULL },
+ { WPS_TOKEN_RTC_MONTH, "cm", WPS_REFRESH_DYNAMIC, NULL },
+ { WPS_TOKEN_RTC_MINUTE, "cM", WPS_REFRESH_DYNAMIC, NULL },
+ { WPS_TOKEN_RTC_SECOND, "cS", WPS_REFRESH_DYNAMIC, NULL },
+ { WPS_TOKEN_RTC_YEAR_2_DIGITS, "cy", WPS_REFRESH_DYNAMIC, NULL },
+ { WPS_TOKEN_RTC_YEAR_4_DIGITS, "cY", WPS_REFRESH_DYNAMIC, NULL },
+ { WPS_TOKEN_RTC_AM_PM_UPPER, "cP", WPS_REFRESH_DYNAMIC, NULL },
+ { WPS_TOKEN_RTC_AM_PM_LOWER, "cp", WPS_REFRESH_DYNAMIC, NULL },
+ { WPS_TOKEN_RTC_WEEKDAY_NAME, "ca", WPS_REFRESH_DYNAMIC, NULL },
+ { WPS_TOKEN_RTC_MONTH_NAME, "cb", WPS_REFRESH_DYNAMIC, NULL },
+ { WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON, "cu", WPS_REFRESH_DYNAMIC, NULL },
+ { WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN, "cw", WPS_REFRESH_DYNAMIC, NULL },
#endif
/* current file */
@@ -286,37 +275,6 @@ static void wps_start_new_subline(struct wps_data *data) {
data->lines[data->num_lines].num_sublines++;
}
-#if CONFIG_RTC
-static int parse_rtc_format(const char *wps_bufptr,
- struct wps_token *token,
- struct wps_data *wps_data)
-{
- int skip = 0, i;
- (void)token; /* kill the warning */
-
- /* RTC tag format ends with a c or a newline */
- while (wps_bufptr && *wps_bufptr != 'c' && *wps_bufptr != '\n')
- {
- /* find what format char we have */
- i = 0;
- while (*(rtc_tags[i].name) && *wps_bufptr != *(rtc_tags[i].name))
- i++;
-
- wps_data->num_tokens++;
- wps_data->tokens[wps_data->num_tokens].type = rtc_tags[i].type;
- wps_data->tokens[wps_data->num_tokens].value.c = *wps_bufptr;
- skip++;
- wps_bufptr++;
- }
-
- /* eat the unwanted c at the end of the format */
- if (*wps_bufptr == 'c')
- skip++;
-
- return skip;
-}
-#endif
-
#ifdef HAVE_LCD_BITMAP
static int parse_statusbar_enable(const char *wps_bufptr,