diff options
author | Nicolas Pennequin <nicolas.pennequin@free.fr> | 2007-04-10 13:37:08 +0000 |
---|---|---|
committer | Nicolas Pennequin <nicolas.pennequin@free.fr> | 2007-04-10 13:37:08 +0000 |
commit | 536c5d9e744afe894aa221bb5ce23e175a3f54e5 (patch) | |
tree | 76ae73120d14aca8fcf250ae27816a42c61091a9 | |
parent | af7780e0b3f27a574b007be6ac7a273d14f6b76a (diff) | |
download | rockbox-536c5d9e744afe894aa221bb5ce23e175a3f54e5.tar.gz rockbox-536c5d9e744afe894aa221bb5ce23e175a3f54e5.zip |
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
-rw-r--r-- | apps/gui/gwps-common.c | 55 | ||||
-rw-r--r-- | apps/gui/gwps.h | 1 | ||||
-rw-r--r-- | apps/gui/wps_debug.c | 40 | ||||
-rw-r--r-- | apps/gui/wps_parser.c | 76 | ||||
-rw-r--r-- | wps/boxes.220x176x16.wps | 2 |
5 files changed, 84 insertions, 90 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 52ef65c141..4605b3461b 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c | |||
@@ -762,6 +762,39 @@ static char *get_token_value(struct gui_wps *gwps, | |||
762 | if (!id3) | 762 | if (!id3) |
763 | return NULL; | 763 | return NULL; |
764 | 764 | ||
765 | #if CONFIG_RTC | ||
766 | struct tm* tm = NULL; | ||
767 | |||
768 | /* if the token is an RTC one, update the time and do the necessary checks */ | ||
769 | |||
770 | if (token->type >= WPS_TOKEN_RTC_DAY_OF_MONTH | ||
771 | && token->type <= WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN) | ||
772 | { | ||
773 | tm = get_time(); | ||
774 | |||
775 | if (tm->tm_mday > 31 || tm->tm_mday < 1) | ||
776 | return NULL; | ||
777 | |||
778 | if (tm->tm_hour > 23) | ||
779 | return NULL; | ||
780 | |||
781 | if (tm->tm_mon > 11 || tm->tm_mon < 0) | ||
782 | return NULL; | ||
783 | |||
784 | if (tm->tm_min > 59 || tm->tm_min < 0) | ||
785 | return NULL; | ||
786 | |||
787 | if (tm->tm_sec > 59 || tm->tm_sec < 0) | ||
788 | return NULL; | ||
789 | |||
790 | if (tm->tm_year > 199 || tm->tm_year < 100) | ||
791 | return NULL; | ||
792 | |||
793 | if (tm->tm_wday > 6 || tm->tm_wday < 0) | ||
794 | return NULL; | ||
795 | } | ||
796 | #endif | ||
797 | |||
765 | int limit = 1; | 798 | int limit = 1; |
766 | if (intval) | 799 | if (intval) |
767 | { | 800 | { |
@@ -769,10 +802,6 @@ static char *get_token_value(struct gui_wps *gwps, | |||
769 | *intval = -1; | 802 | *intval = -1; |
770 | } | 803 | } |
771 | 804 | ||
772 | #if CONFIG_RTC | ||
773 | static struct tm* tm; | ||
774 | #endif | ||
775 | |||
776 | switch (token->type) | 805 | switch (token->type) |
777 | { | 806 | { |
778 | case WPS_TOKEN_CHARACTER: | 807 | case WPS_TOKEN_CHARACTER: |
@@ -1039,63 +1068,50 @@ static char *get_token_value(struct gui_wps *gwps, | |||
1039 | return buf; | 1068 | return buf; |
1040 | 1069 | ||
1041 | #if CONFIG_RTC | 1070 | #if CONFIG_RTC |
1042 | case WPS_TOKEN_RTC: | ||
1043 | tm = get_time(); | ||
1044 | return NULL; | ||
1045 | |||
1046 | case WPS_TOKEN_RTC_DAY_OF_MONTH: | 1071 | case WPS_TOKEN_RTC_DAY_OF_MONTH: |
1047 | /* d: day of month (01..31) */ | 1072 | /* d: day of month (01..31) */ |
1048 | if (tm->tm_mday > 31 || tm->tm_mday < 1) return NULL; | ||
1049 | snprintf(buf, buf_size, "%02d", tm->tm_mday); | 1073 | snprintf(buf, buf_size, "%02d", tm->tm_mday); |
1050 | return buf; | 1074 | return buf; |
1051 | 1075 | ||
1052 | case WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED: | 1076 | case WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED: |
1053 | /* e: day of month, blank padded ( 1..31) */ | 1077 | /* e: day of month, blank padded ( 1..31) */ |
1054 | if (tm->tm_mday > 31 || tm->tm_mday < 1) return NULL; | ||
1055 | snprintf(buf, buf_size, "%2d", tm->tm_mday); | 1078 | snprintf(buf, buf_size, "%2d", tm->tm_mday); |
1056 | return buf; | 1079 | return buf; |
1057 | 1080 | ||
1058 | case WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED: | 1081 | case WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED: |
1059 | /* H: hour (00..23) */ | 1082 | /* H: hour (00..23) */ |
1060 | if (tm->tm_hour > 23) return NULL; | ||
1061 | snprintf(buf, buf_size, "%02d", tm->tm_hour); | 1083 | snprintf(buf, buf_size, "%02d", tm->tm_hour); |
1062 | return buf; | 1084 | return buf; |
1063 | 1085 | ||
1064 | case WPS_TOKEN_RTC_HOUR_24: | 1086 | case WPS_TOKEN_RTC_HOUR_24: |
1065 | /* k: hour ( 0..23) */ | 1087 | /* k: hour ( 0..23) */ |
1066 | if (tm->tm_hour > 23) return NULL; | ||
1067 | snprintf(buf, buf_size, "%2d", tm->tm_hour); | 1088 | snprintf(buf, buf_size, "%2d", tm->tm_hour); |
1068 | return buf; | 1089 | return buf; |
1069 | 1090 | ||
1070 | case WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED: | 1091 | case WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED: |
1071 | /* I: hour (01..12) */ | 1092 | /* I: hour (01..12) */ |
1072 | if (tm->tm_hour > 23) return NULL; | ||
1073 | snprintf(buf, buf_size, "%02d", | 1093 | snprintf(buf, buf_size, "%02d", |
1074 | (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12); | 1094 | (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12); |
1075 | return buf; | 1095 | return buf; |
1076 | 1096 | ||
1077 | case WPS_TOKEN_RTC_HOUR_12: | 1097 | case WPS_TOKEN_RTC_HOUR_12: |
1078 | /* l: hour ( 1..12) */ | 1098 | /* l: hour ( 1..12) */ |
1079 | if (tm->tm_hour > 23) return NULL; | ||
1080 | snprintf(buf, buf_size, "%2d", | 1099 | snprintf(buf, buf_size, "%2d", |
1081 | (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12); | 1100 | (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12); |
1082 | return buf; | 1101 | return buf; |
1083 | 1102 | ||
1084 | case WPS_TOKEN_RTC_MONTH: | 1103 | case WPS_TOKEN_RTC_MONTH: |
1085 | /* m: month (01..12) */ | 1104 | /* m: month (01..12) */ |
1086 | if (tm->tm_mon > 11 || tm->tm_mon < 0) return NULL; | ||
1087 | snprintf(buf, buf_size, "%02d", tm->tm_mon + 1); | 1105 | snprintf(buf, buf_size, "%02d", tm->tm_mon + 1); |
1088 | return buf; | 1106 | return buf; |
1089 | 1107 | ||
1090 | case WPS_TOKEN_RTC_MINUTE: | 1108 | case WPS_TOKEN_RTC_MINUTE: |
1091 | /* M: minute (00..59) */ | 1109 | /* M: minute (00..59) */ |
1092 | if (tm->tm_min > 59 || tm->tm_min < 0) return NULL; | ||
1093 | snprintf(buf, buf_size, "%02d", tm->tm_min); | 1110 | snprintf(buf, buf_size, "%02d", tm->tm_min); |
1094 | return buf; | 1111 | return buf; |
1095 | 1112 | ||
1096 | case WPS_TOKEN_RTC_SECOND: | 1113 | case WPS_TOKEN_RTC_SECOND: |
1097 | /* S: second (00..59) */ | 1114 | /* S: second (00..59) */ |
1098 | if (tm->tm_sec > 59 || tm->tm_sec < 0) return NULL; | ||
1099 | snprintf(buf, buf_size, "%02d", tm->tm_sec); | 1115 | snprintf(buf, buf_size, "%02d", tm->tm_sec); |
1100 | return buf; | 1116 | return buf; |
1101 | 1117 | ||
@@ -1106,7 +1122,6 @@ static char *get_token_value(struct gui_wps *gwps, | |||
1106 | 1122 | ||
1107 | case WPS_TOKEN_RTC_YEAR_4_DIGITS: | 1123 | case WPS_TOKEN_RTC_YEAR_4_DIGITS: |
1108 | /* Y: year (1970...) */ | 1124 | /* Y: year (1970...) */ |
1109 | if (tm->tm_year > 199 || tm->tm_year < 100) return NULL; | ||
1110 | snprintf(buf, buf_size, "%04d", tm->tm_year + 1900); | 1125 | snprintf(buf, buf_size, "%04d", tm->tm_year + 1900); |
1111 | return buf; | 1126 | return buf; |
1112 | 1127 | ||
@@ -1122,25 +1137,21 @@ static char *get_token_value(struct gui_wps *gwps, | |||
1122 | 1137 | ||
1123 | case WPS_TOKEN_RTC_WEEKDAY_NAME: | 1138 | case WPS_TOKEN_RTC_WEEKDAY_NAME: |
1124 | /* a: abbreviated weekday name (Sun..Sat) */ | 1139 | /* a: abbreviated weekday name (Sun..Sat) */ |
1125 | if (tm->tm_wday > 6 || tm->tm_wday < 0) return NULL; | ||
1126 | snprintf(buf, buf_size, "%s",str(dayname[tm->tm_wday])); | 1140 | snprintf(buf, buf_size, "%s",str(dayname[tm->tm_wday])); |
1127 | return buf; | 1141 | return buf; |
1128 | 1142 | ||
1129 | case WPS_TOKEN_RTC_MONTH_NAME: | 1143 | case WPS_TOKEN_RTC_MONTH_NAME: |
1130 | /* b: abbreviated month name (Jan..Dec) */ | 1144 | /* b: abbreviated month name (Jan..Dec) */ |
1131 | if (tm->tm_mon > 11 || tm->tm_mon < 0) return NULL; | ||
1132 | snprintf(buf, buf_size, "%s",str(monthname[tm->tm_mon])); | 1145 | snprintf(buf, buf_size, "%s",str(monthname[tm->tm_mon])); |
1133 | return buf; | 1146 | return buf; |
1134 | 1147 | ||
1135 | case WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON: | 1148 | case WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON: |
1136 | /* u: day of week (1..7); 1 is Monday */ | 1149 | /* u: day of week (1..7); 1 is Monday */ |
1137 | if (tm->tm_wday > 6 || tm->tm_wday < 0) return NULL; | ||
1138 | snprintf(buf, buf_size, "%1d", tm->tm_wday + 1); | 1150 | snprintf(buf, buf_size, "%1d", tm->tm_wday + 1); |
1139 | return buf; | 1151 | return buf; |
1140 | 1152 | ||
1141 | case WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN: | 1153 | case WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN: |
1142 | /* w: day of week (0..6); 0 is Sunday */ | 1154 | /* w: day of week (0..6); 0 is Sunday */ |
1143 | if (tm->tm_wday > 6 || tm->tm_wday < 0) return NULL; | ||
1144 | snprintf(buf, buf_size, "%1d", tm->tm_wday); | 1155 | snprintf(buf, buf_size, "%1d", tm->tm_wday); |
1145 | return buf; | 1156 | return buf; |
1146 | #endif | 1157 | #endif |
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h index f012b3b304..e897413037 100644 --- a/apps/gui/gwps.h +++ b/apps/gui/gwps.h | |||
@@ -129,7 +129,6 @@ enum wps_token_type { | |||
129 | 129 | ||
130 | #if CONFIG_RTC | 130 | #if CONFIG_RTC |
131 | /* Time */ | 131 | /* Time */ |
132 | WPS_TOKEN_RTC, | ||
133 | WPS_TOKEN_RTC_DAY_OF_MONTH, | 132 | WPS_TOKEN_RTC_DAY_OF_MONTH, |
134 | WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED, | 133 | WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED, |
135 | WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED, | 134 | WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED, |
diff --git a/apps/gui/wps_debug.c b/apps/gui/wps_debug.c index 0e2b151551..4a8153d591 100644 --- a/apps/gui/wps_debug.c +++ b/apps/gui/wps_debug.c | |||
@@ -135,30 +135,56 @@ void dump_wps_tokens(struct wps_data *data) | |||
135 | break; | 135 | break; |
136 | 136 | ||
137 | #if CONFIG_RTC | 137 | #if CONFIG_RTC |
138 | case WPS_TOKEN_RTC: | ||
139 | snprintf(buf, sizeof(buf), "real-time clock", | ||
140 | token->value.c); | ||
141 | break; | ||
142 | |||
143 | case WPS_TOKEN_RTC_DAY_OF_MONTH: | 138 | case WPS_TOKEN_RTC_DAY_OF_MONTH: |
139 | snprintf(buf, sizeof(buf), "rtc: day of month (01..31)"); | ||
140 | break; | ||
144 | case WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED: | 141 | case WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED: |
142 | snprintf(buf, sizeof(buf), "rtc: day of month, blank padded ( 1..31)"); | ||
143 | break; | ||
145 | case WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED: | 144 | case WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED: |
145 | snprintf(buf, sizeof(buf), "rtc: hour (00..23)"); | ||
146 | break; | ||
146 | case WPS_TOKEN_RTC_HOUR_24: | 147 | case WPS_TOKEN_RTC_HOUR_24: |
148 | snprintf(buf, sizeof(buf), "rtc: hour ( 0..23)"); | ||
149 | break; | ||
147 | case WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED: | 150 | case WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED: |
151 | snprintf(buf, sizeof(buf), "rtc: hour (01..12)"); | ||
152 | break; | ||
148 | case WPS_TOKEN_RTC_HOUR_12: | 153 | case WPS_TOKEN_RTC_HOUR_12: |
154 | snprintf(buf, sizeof(buf), "rtc: hour ( 1..12)"); | ||
155 | break; | ||
149 | case WPS_TOKEN_RTC_MONTH: | 156 | case WPS_TOKEN_RTC_MONTH: |
157 | snprintf(buf, sizeof(buf), "rtc: month (01..12)"); | ||
158 | break; | ||
150 | case WPS_TOKEN_RTC_MINUTE: | 159 | case WPS_TOKEN_RTC_MINUTE: |
160 | snprintf(buf, sizeof(buf), "rtc: minute (00..59)"); | ||
161 | break; | ||
151 | case WPS_TOKEN_RTC_SECOND: | 162 | case WPS_TOKEN_RTC_SECOND: |
163 | snprintf(buf, sizeof(buf), "rtc: second (00..59)"); | ||
164 | break; | ||
152 | case WPS_TOKEN_RTC_YEAR_2_DIGITS: | 165 | case WPS_TOKEN_RTC_YEAR_2_DIGITS: |
166 | snprintf(buf, sizeof(buf), "rtc: last two digits of year (00..99)"); | ||
167 | break; | ||
153 | case WPS_TOKEN_RTC_YEAR_4_DIGITS: | 168 | case WPS_TOKEN_RTC_YEAR_4_DIGITS: |
169 | snprintf(buf, sizeof(buf), "rtc: year (1970...)"); | ||
170 | break; | ||
154 | case WPS_TOKEN_RTC_AM_PM_UPPER: | 171 | case WPS_TOKEN_RTC_AM_PM_UPPER: |
172 | snprintf(buf, sizeof(buf), "rtc: upper case AM or PM indicator"); | ||
173 | break; | ||
155 | case WPS_TOKEN_RTC_AM_PM_LOWER: | 174 | case WPS_TOKEN_RTC_AM_PM_LOWER: |
175 | snprintf(buf, sizeof(buf), "rtc: lower case am or pm indicator"); | ||
176 | break; | ||
156 | case WPS_TOKEN_RTC_WEEKDAY_NAME: | 177 | case WPS_TOKEN_RTC_WEEKDAY_NAME: |
178 | snprintf(buf, sizeof(buf), "rtc: abbreviated weekday name (Sun..Sat)"); | ||
179 | break; | ||
157 | case WPS_TOKEN_RTC_MONTH_NAME: | 180 | case WPS_TOKEN_RTC_MONTH_NAME: |
181 | snprintf(buf, sizeof(buf), "rtc: abbreviated month name (Jan..Dec)"); | ||
182 | break; | ||
158 | case WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON: | 183 | case WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON: |
184 | snprintf(buf, sizeof(buf), "rtc: day of week (1..7); 1 is Monday"); | ||
185 | break; | ||
159 | case WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN: | 186 | case WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN: |
160 | snprintf(buf, sizeof(buf), "real-time clock tag: %c", | 187 | snprintf(buf, sizeof(buf), "rtc: day of week (0..6); 0 is Sunday"); |
161 | token->value.c); | ||
162 | break; | 188 | break; |
163 | #endif | 189 | #endif |
164 | 190 | ||
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, | |||
108 | static int parse_image_load(const char *wps_bufptr, | 108 | static 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 | ||
112 | static int parse_rtc_format(const char *wps_bufptr, | ||
113 | struct wps_token *token, struct wps_data *wps_data); | ||
114 | |||
115 | /* RTC tokens array */ | ||
116 | static 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 | ||
290 | static 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 | ||
322 | static int parse_statusbar_enable(const char *wps_bufptr, | 280 | static int parse_statusbar_enable(const char *wps_bufptr, |
diff --git a/wps/boxes.220x176x16.wps b/wps/boxes.220x176x16.wps index 4ab2d9e0ed..ee822c7ff0 100644 --- a/wps/boxes.220x176x16.wps +++ b/wps/boxes.220x176x16.wps | |||
@@ -43,7 +43,7 @@ | |||
43 | %xl|T|pwr-colour.bmp|210|10| | 43 | %xl|T|pwr-colour.bmp|210|10| |
44 | %xl|y|led-colour.bmp|192|12| | 44 | %xl|y|led-colour.bmp|192|12| |
45 | %wd | 45 | %wd |
46 | %ar%ca, b d H:Mc | 46 | %ar%ca, %cb %cd %cH:%cM |
47 | 47 | ||
48 | 48 | ||
49 | 49 | ||