summaryrefslogtreecommitdiff
path: root/apps/gui/wps_parser.c
diff options
context:
space:
mode:
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 8d917cdd1d..b25fe24ba2 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,
108static int parse_image_load(const char *wps_bufptr, 108static int parse_image_load(const char *wps_bufptr,
109 struct wps_token *token, struct wps_data *wps_data); 109 struct wps_token *token, struct wps_data *wps_data);
110#endif /*HAVE_LCD_BITMAP */ 110#endif /*HAVE_LCD_BITMAP */
111#if CONFIG_RTC
112static int parse_rtc_format(const char *wps_bufptr,
113 struct wps_token *token, struct wps_data *wps_data);
114
115/* RTC tokens array */
116static const struct wps_tag rtc_tags[] = {
117 { WPS_TOKEN_RTC_DAY_OF_MONTH, "d", 0, NULL },
118 { WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED, "e", 0, NULL },
119 { WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED, "H", 0, NULL },
120 { WPS_TOKEN_RTC_HOUR_24, "k", 0, NULL },
121 { WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED, "I", 0, NULL },
122 { WPS_TOKEN_RTC_HOUR_12, "l", 0, NULL },
123 { WPS_TOKEN_RTC_MONTH, "m", 0, NULL },
124 { WPS_TOKEN_RTC_MINUTE, "M", 0, NULL },
125 { WPS_TOKEN_RTC_SECOND, "S", 0, NULL },
126 { WPS_TOKEN_RTC_YEAR_2_DIGITS, "y", 0, NULL },
127 { WPS_TOKEN_RTC_YEAR_4_DIGITS, "Y", 0, NULL },
128 { WPS_TOKEN_RTC_AM_PM_UPPER, "p", 0, NULL },
129 { WPS_TOKEN_RTC_AM_PM_LOWER, "P", 0, NULL },
130 { WPS_TOKEN_RTC_WEEKDAY_NAME, "a", 0, NULL },
131 { WPS_TOKEN_RTC_MONTH_NAME, "b", 0, NULL },
132 { WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON, "u", 0, NULL },
133 { WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN, "w", 0, NULL },
134 { WPS_TOKEN_CHARACTER, "", 0, NULL }
135 /* the array MUST end with an empty string (first char is \0) */
136};
137#endif
138 111
139/* array of available tags - those with more characters have to go first 112/* array of available tags - those with more characters have to go first
140 (e.g. "xl" and "xd" before "x"). It needs to end with the unknown token. */ 113 (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[] = {
156#endif 129#endif
157 130
158#if CONFIG_RTC 131#if CONFIG_RTC
159 { WPS_TOKEN_RTC, "c", WPS_REFRESH_DYNAMIC, parse_rtc_format }, 132 { WPS_TOKEN_RTC_DAY_OF_MONTH, "cd", WPS_REFRESH_DYNAMIC, NULL },
133 { WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED, "ce", WPS_REFRESH_DYNAMIC, NULL },
134 { WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED, "cH", WPS_REFRESH_DYNAMIC, NULL },
135 { WPS_TOKEN_RTC_HOUR_24, "ck", WPS_REFRESH_DYNAMIC, NULL },
136 { WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED, "cI", WPS_REFRESH_DYNAMIC, NULL },
137 { WPS_TOKEN_RTC_HOUR_12, "cl", WPS_REFRESH_DYNAMIC, NULL },
138 { WPS_TOKEN_RTC_MONTH, "cm", WPS_REFRESH_DYNAMIC, NULL },
139 { WPS_TOKEN_RTC_MINUTE, "cM", WPS_REFRESH_DYNAMIC, NULL },
140 { WPS_TOKEN_RTC_SECOND, "cS", WPS_REFRESH_DYNAMIC, NULL },
141 { WPS_TOKEN_RTC_YEAR_2_DIGITS, "cy", WPS_REFRESH_DYNAMIC, NULL },
142 { WPS_TOKEN_RTC_YEAR_4_DIGITS, "cY", WPS_REFRESH_DYNAMIC, NULL },
143 { WPS_TOKEN_RTC_AM_PM_UPPER, "cP", WPS_REFRESH_DYNAMIC, NULL },
144 { WPS_TOKEN_RTC_AM_PM_LOWER, "cp", WPS_REFRESH_DYNAMIC, NULL },
145 { WPS_TOKEN_RTC_WEEKDAY_NAME, "ca", WPS_REFRESH_DYNAMIC, NULL },
146 { WPS_TOKEN_RTC_MONTH_NAME, "cb", WPS_REFRESH_DYNAMIC, NULL },
147 { WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON, "cu", WPS_REFRESH_DYNAMIC, NULL },
148 { WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN, "cw", WPS_REFRESH_DYNAMIC, NULL },
160#endif 149#endif
161 150
162 /* current file */ 151 /* current file */
@@ -286,37 +275,6 @@ static void wps_start_new_subline(struct wps_data *data) {
286 data->lines[data->num_lines].num_sublines++; 275 data->lines[data->num_lines].num_sublines++;
287} 276}
288 277
289#if CONFIG_RTC
290static int parse_rtc_format(const char *wps_bufptr,
291 struct wps_token *token,
292 struct wps_data *wps_data)
293{
294 int skip = 0, i;
295 (void)token; /* kill the warning */
296
297 /* RTC tag format ends with a c or a newline */
298 while (wps_bufptr && *wps_bufptr != 'c' && *wps_bufptr != '\n')
299 {
300 /* find what format char we have */
301 i = 0;
302 while (*(rtc_tags[i].name) && *wps_bufptr != *(rtc_tags[i].name))
303 i++;
304
305 wps_data->num_tokens++;
306 wps_data->tokens[wps_data->num_tokens].type = rtc_tags[i].type;
307 wps_data->tokens[wps_data->num_tokens].value.c = *wps_bufptr;
308 skip++;
309 wps_bufptr++;
310 }
311
312 /* eat the unwanted c at the end of the format */
313 if (*wps_bufptr == 'c')
314 skip++;
315
316 return skip;
317}
318#endif
319
320#ifdef HAVE_LCD_BITMAP 278#ifdef HAVE_LCD_BITMAP
321 279
322static int parse_statusbar_enable(const char *wps_bufptr, 280static int parse_statusbar_enable(const char *wps_bufptr,