diff options
Diffstat (limited to 'apps/gui/skin_engine/skin_parser.c')
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 5f5128533f..7d37e1972c 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c | |||
@@ -134,7 +134,7 @@ static int parse_dir_level(const char *wps_bufptr, | |||
134 | struct wps_token *token, struct wps_data *wps_data); | 134 | struct wps_token *token, struct wps_data *wps_data); |
135 | static int parse_setting(const char *wps_bufptr, | 135 | static int parse_setting(const char *wps_bufptr, |
136 | struct wps_token *token, struct wps_data *wps_data); | 136 | struct wps_token *token, struct wps_data *wps_data); |
137 | 137 | ||
138 | #ifdef HAVE_LCD_BITMAP | 138 | #ifdef HAVE_LCD_BITMAP |
139 | static int parse_viewport_display(const char *wps_bufptr, | 139 | static int parse_viewport_display(const char *wps_bufptr, |
140 | struct wps_token *token, struct wps_data *wps_data); | 140 | struct wps_token *token, struct wps_data *wps_data); |
@@ -170,7 +170,7 @@ static int fulline_tag_not_supported(const char *wps_bufptr, | |||
170 | return skip_end_of_line(wps_bufptr); | 170 | return skip_end_of_line(wps_bufptr); |
171 | } | 171 | } |
172 | #define parse_touchregion fulline_tag_not_supported | 172 | #define parse_touchregion fulline_tag_not_supported |
173 | #endif | 173 | #endif |
174 | #ifdef CONFIG_RTC | 174 | #ifdef CONFIG_RTC |
175 | #define WPS_RTC_REFRESH WPS_REFRESH_DYNAMIC | 175 | #define WPS_RTC_REFRESH WPS_REFRESH_DYNAMIC |
176 | #else | 176 | #else |
@@ -287,7 +287,7 @@ static const struct wps_tag all_tags[] = { | |||
287 | 287 | ||
288 | { WPS_TOKEN_REPEAT_MODE, "mm", WPS_REFRESH_DYNAMIC, NULL }, | 288 | { WPS_TOKEN_REPEAT_MODE, "mm", WPS_REFRESH_DYNAMIC, NULL }, |
289 | { WPS_TOKEN_PLAYBACK_STATUS, "mp", WPS_REFRESH_DYNAMIC, NULL }, | 289 | { WPS_TOKEN_PLAYBACK_STATUS, "mp", WPS_REFRESH_DYNAMIC, NULL }, |
290 | { WPS_TOKEN_BUTTON_VOLUME, "mv", WPS_REFRESH_DYNAMIC, | 290 | { WPS_TOKEN_BUTTON_VOLUME, "mv", WPS_REFRESH_DYNAMIC, |
291 | parse_timeout }, | 291 | parse_timeout }, |
292 | 292 | ||
293 | #ifdef HAVE_LCD_BITMAP | 293 | #ifdef HAVE_LCD_BITMAP |
@@ -340,7 +340,7 @@ static const struct wps_tag all_tags[] = { | |||
340 | { WPS_TOKEN_ALBUMART_DISPLAY, "C", WPS_REFRESH_STATIC, parse_albumart_display }, | 340 | { WPS_TOKEN_ALBUMART_DISPLAY, "C", WPS_REFRESH_STATIC, parse_albumart_display }, |
341 | #endif | 341 | #endif |
342 | 342 | ||
343 | { WPS_VIEWPORT_ENABLE, "Vd", WPS_REFRESH_DYNAMIC, | 343 | { WPS_VIEWPORT_ENABLE, "Vd", WPS_REFRESH_DYNAMIC, |
344 | parse_viewport_display }, | 344 | parse_viewport_display }, |
345 | { WPS_NO_TOKEN, "V", 0, parse_viewport }, | 345 | { WPS_NO_TOKEN, "V", 0, parse_viewport }, |
346 | 346 | ||
@@ -350,16 +350,16 @@ static const struct wps_tag all_tags[] = { | |||
350 | #endif | 350 | #endif |
351 | 351 | ||
352 | { WPS_TOKEN_SETTING, "St", WPS_REFRESH_DYNAMIC, parse_setting }, | 352 | { WPS_TOKEN_SETTING, "St", WPS_REFRESH_DYNAMIC, parse_setting }, |
353 | 353 | ||
354 | { WPS_TOKEN_LASTTOUCH, "Tl", WPS_REFRESH_DYNAMIC, parse_timeout }, | 354 | { WPS_TOKEN_LASTTOUCH, "Tl", WPS_REFRESH_DYNAMIC, parse_timeout }, |
355 | { WPS_NO_TOKEN, "T", 0, parse_touchregion }, | 355 | { WPS_NO_TOKEN, "T", 0, parse_touchregion }, |
356 | 356 | ||
357 | { WPS_TOKEN_UNKNOWN, "", 0, NULL } | 357 | { WPS_TOKEN_UNKNOWN, "", 0, NULL } |
358 | /* the array MUST end with an empty string (first char is \0) */ | 358 | /* the array MUST end with an empty string (first char is \0) */ |
359 | }; | 359 | }; |
360 | 360 | ||
361 | 361 | ||
362 | /* add a skin_token_list item to the list chain. ALWAYS appended because some of the | 362 | /* add a skin_token_list item to the list chain. ALWAYS appended because some of the |
363 | * chains require the order to be kept. | 363 | * chains require the order to be kept. |
364 | */ | 364 | */ |
365 | static void add_to_ll_chain(struct skin_token_list **list, struct skin_token_list *item) | 365 | static void add_to_ll_chain(struct skin_token_list **list, struct skin_token_list *item) |
@@ -371,9 +371,9 @@ static void add_to_ll_chain(struct skin_token_list **list, struct skin_token_lis | |||
371 | struct skin_token_list *t = *list; | 371 | struct skin_token_list *t = *list; |
372 | while (t->next) | 372 | while (t->next) |
373 | t = t->next; | 373 | t = t->next; |
374 | t->next = item; | 374 | t->next = item; |
375 | } | 375 | } |
376 | } | 376 | } |
377 | /* create and init a new wpsll item. | 377 | /* create and init a new wpsll item. |
378 | * passing NULL to token will alloc a new one. | 378 | * passing NULL to token will alloc a new one. |
379 | * You should only pass NULL for the token when the token type (table above) | 379 | * You should only pass NULL for the token when the token type (table above) |
@@ -392,7 +392,7 @@ static struct skin_token_list *new_skin_token_list_item(struct wps_token *token, | |||
392 | if (token_data) | 392 | if (token_data) |
393 | llitem->token->value.data = token_data; | 393 | llitem->token->value.data = token_data; |
394 | return llitem; | 394 | return llitem; |
395 | } | 395 | } |
396 | 396 | ||
397 | /* Returns the number of chars that should be skipped to jump | 397 | /* Returns the number of chars that should be skipped to jump |
398 | immediately after the first eol, i.e. to the start of the next line */ | 398 | immediately after the first eol, i.e. to the start of the next line */ |
@@ -414,10 +414,10 @@ static bool skin_start_new_subline(struct skin_line *line, int curr_token) | |||
414 | 414 | ||
415 | subline->first_token_idx = curr_token; | 415 | subline->first_token_idx = curr_token; |
416 | subline->next = NULL; | 416 | subline->next = NULL; |
417 | 417 | ||
418 | subline->line_type = 0; | 418 | subline->line_type = 0; |
419 | subline->time_mult = 0; | 419 | subline->time_mult = 0; |
420 | 420 | ||
421 | line->curr_subline->last_token_idx = curr_token-1; | 421 | line->curr_subline->last_token_idx = curr_token-1; |
422 | line->curr_subline->next = subline; | 422 | line->curr_subline->next = subline; |
423 | line->curr_subline = subline; | 423 | line->curr_subline = subline; |
@@ -430,19 +430,19 @@ static bool skin_start_new_line(struct skin_viewport *vp, int curr_token) | |||
430 | struct skin_subline *subline = NULL; | 430 | struct skin_subline *subline = NULL; |
431 | if (!line) | 431 | if (!line) |
432 | return false; | 432 | return false; |
433 | 433 | ||
434 | /* init the subline */ | 434 | /* init the subline */ |
435 | subline = &line->sublines; | 435 | subline = &line->sublines; |
436 | subline->first_token_idx = curr_token; | 436 | subline->first_token_idx = curr_token; |
437 | subline->next = NULL; | 437 | subline->next = NULL; |
438 | subline->line_type = 0; | 438 | subline->line_type = 0; |
439 | subline->time_mult = 0; | 439 | subline->time_mult = 0; |
440 | 440 | ||
441 | /* init the new line */ | 441 | /* init the new line */ |
442 | line->curr_subline = &line->sublines; | 442 | line->curr_subline = &line->sublines; |
443 | line->next = NULL; | 443 | line->next = NULL; |
444 | line->subline_expire_time = 0; | 444 | line->subline_expire_time = 0; |
445 | 445 | ||
446 | /* connect to curr_line and vp pointers. | 446 | /* connect to curr_line and vp pointers. |
447 | * 1) close the previous lines subline | 447 | * 1) close the previous lines subline |
448 | * 2) connect to vp pointer | 448 | * 2) connect to vp pointer |
@@ -567,9 +567,9 @@ static int parse_image_load(const char *wps_bufptr, | |||
567 | const char *newline; | 567 | const char *newline; |
568 | int x,y; | 568 | int x,y; |
569 | struct gui_img *img; | 569 | struct gui_img *img; |
570 | 570 | ||
571 | /* format: %x|n|filename.bmp|x|y| | 571 | /* format: %x|n|filename.bmp|x|y| |
572 | or %xl|n|filename.bmp|x|y| | 572 | or %xl|n|filename.bmp|x|y| |
573 | or %xl|n|filename.bmp|x|y|num_subimages| | 573 | or %xl|n|filename.bmp|x|y|num_subimages| |
574 | */ | 574 | */ |
575 | 575 | ||
@@ -653,14 +653,14 @@ static int parse_viewport(const char *wps_bufptr, | |||
653 | (void)token; /* Kill warnings */ | 653 | (void)token; /* Kill warnings */ |
654 | const char *ptr = wps_bufptr; | 654 | const char *ptr = wps_bufptr; |
655 | 655 | ||
656 | const int screen = | 656 | const int screen = |
657 | #ifdef HAVE_REMOTE_LCD | 657 | #ifdef HAVE_REMOTE_LCD |
658 | wps_data->remote_wps ? SCREEN_REMOTE : | 658 | wps_data->remote_wps ? SCREEN_REMOTE : |
659 | #endif | 659 | #endif |
660 | SCREEN_MAIN; | 660 | SCREEN_MAIN; |
661 | 661 | ||
662 | struct skin_viewport *skin_vp = skin_buffer_alloc(sizeof(struct skin_viewport)); | 662 | struct skin_viewport *skin_vp = skin_buffer_alloc(sizeof(struct skin_viewport)); |
663 | 663 | ||
664 | /* check for the optional letter to signify its a hideable viewport */ | 664 | /* check for the optional letter to signify its a hideable viewport */ |
665 | /* %Vl|<label>|<rest of tags>| */ | 665 | /* %Vl|<label>|<rest of tags>| */ |
666 | skin_vp->hidden_flags = 0; | 666 | skin_vp->hidden_flags = 0; |
@@ -694,7 +694,7 @@ static int parse_viewport(const char *wps_bufptr, | |||
694 | } | 694 | } |
695 | if (*ptr != '|') | 695 | if (*ptr != '|') |
696 | return WPS_ERROR_INVALID_PARAM; | 696 | return WPS_ERROR_INVALID_PARAM; |
697 | 697 | ||
698 | ptr++; | 698 | ptr++; |
699 | struct viewport *vp = &skin_vp->vp; | 699 | struct viewport *vp = &skin_vp->vp; |
700 | /* format: %V|x|y|width|height|font|fg_pattern|bg_pattern| */ | 700 | /* format: %V|x|y|width|height|font|fg_pattern|bg_pattern| */ |
@@ -711,7 +711,7 @@ static int parse_viewport(const char *wps_bufptr, | |||
711 | if (!list) | 711 | if (!list) |
712 | return WPS_ERROR_INVALID_PARAM; | 712 | return WPS_ERROR_INVALID_PARAM; |
713 | add_to_ll_chain(&wps_data->viewports, list); | 713 | add_to_ll_chain(&wps_data->viewports, list); |
714 | curr_vp = skin_vp; | 714 | curr_vp = skin_vp; |
715 | /* Skip the rest of the line */ | 715 | /* Skip the rest of the line */ |
716 | return skip_end_of_line(wps_bufptr); | 716 | return skip_end_of_line(wps_bufptr); |
717 | } | 717 | } |
@@ -863,14 +863,14 @@ static int parse_progressbar(const char *wps_bufptr, | |||
863 | const char *ptr = wps_bufptr; | 863 | const char *ptr = wps_bufptr; |
864 | struct progressbar *pb = skin_buffer_alloc(sizeof(struct progressbar)); | 864 | struct progressbar *pb = skin_buffer_alloc(sizeof(struct progressbar)); |
865 | struct skin_token_list *item = new_skin_token_list_item(token, pb); | 865 | struct skin_token_list *item = new_skin_token_list_item(token, pb); |
866 | 866 | ||
867 | if (!pb || !item) | 867 | if (!pb || !item) |
868 | return WPS_ERROR_INVALID_PARAM; | 868 | return WPS_ERROR_INVALID_PARAM; |
869 | 869 | ||
870 | struct viewport *vp = &curr_vp->vp; | 870 | struct viewport *vp = &curr_vp->vp; |
871 | #ifndef __PCTOOL__ | 871 | #ifndef __PCTOOL__ |
872 | int font_height = font_get(vp->font)->height; | 872 | int font_height = font_get(vp->font)->height; |
873 | #else | 873 | #else |
874 | int font_height = 8; | 874 | int font_height = 8; |
875 | #endif | 875 | #endif |
876 | /* we need to know what line number (viewport relative) this pb is, | 876 | /* we need to know what line number (viewport relative) this pb is, |
@@ -884,7 +884,7 @@ static int parse_progressbar(const char *wps_bufptr, | |||
884 | } | 884 | } |
885 | pb->have_bitmap_pb = false; | 885 | pb->have_bitmap_pb = false; |
886 | pb->bm.data = NULL; /* no bitmap specified */ | 886 | pb->bm.data = NULL; /* no bitmap specified */ |
887 | 887 | ||
888 | if (*wps_bufptr != '|') /* regular old style */ | 888 | if (*wps_bufptr != '|') /* regular old style */ |
889 | { | 889 | { |
890 | pb->x = 0; | 890 | pb->x = 0; |
@@ -897,7 +897,7 @@ static int parse_progressbar(const char *wps_bufptr, | |||
897 | return 0; | 897 | return 0; |
898 | } | 898 | } |
899 | ptr = wps_bufptr + 1; | 899 | ptr = wps_bufptr + 1; |
900 | 900 | ||
901 | if (!(ptr = parse_list("sdddd", &set, '|', ptr, &filename, | 901 | if (!(ptr = parse_list("sdddd", &set, '|', ptr, &filename, |
902 | &x, &y, &width, &height))) | 902 | &x, &y, &width, &height))) |
903 | return WPS_ERROR_INVALID_PARAM; | 903 | return WPS_ERROR_INVALID_PARAM; |
@@ -1136,7 +1136,7 @@ static int parse_albumart_display(const char *wps_bufptr, | |||
1136 | #endif /* HAVE_ALBUMART */ | 1136 | #endif /* HAVE_ALBUMART */ |
1137 | 1137 | ||
1138 | #ifdef HAVE_TOUCHSCREEN | 1138 | #ifdef HAVE_TOUCHSCREEN |
1139 | 1139 | ||
1140 | struct touchaction {char* s; int action;}; | 1140 | struct touchaction {char* s; int action;}; |
1141 | static struct touchaction touchactions[] = { | 1141 | static struct touchaction touchactions[] = { |
1142 | {"play", ACTION_WPS_PLAY }, {"stop", ACTION_WPS_STOP }, | 1142 | {"play", ACTION_WPS_PLAY }, {"stop", ACTION_WPS_STOP }, |
@@ -1158,7 +1158,7 @@ static int parse_touchregion(const char *wps_bufptr, | |||
1158 | const char pb_string[] = "progressbar"; | 1158 | const char pb_string[] = "progressbar"; |
1159 | const char vol_string[] = "volume"; | 1159 | const char vol_string[] = "volume"; |
1160 | int x,y,w,h; | 1160 | int x,y,w,h; |
1161 | 1161 | ||
1162 | /* format: %T|x|y|width|height|action| | 1162 | /* format: %T|x|y|width|height|action| |
1163 | * if action starts with & the area must be held to happen | 1163 | * if action starts with & the area must be held to happen |
1164 | * action is one of: | 1164 | * action is one of: |
@@ -1189,11 +1189,11 @@ static int parse_touchregion(const char *wps_bufptr, | |||
1189 | /* Check there is a terminating | */ | 1189 | /* Check there is a terminating | */ |
1190 | if (*ptr != '|') | 1190 | if (*ptr != '|') |
1191 | return WPS_ERROR_INVALID_PARAM; | 1191 | return WPS_ERROR_INVALID_PARAM; |
1192 | 1192 | ||
1193 | region = skin_buffer_alloc(sizeof(struct touchregion)); | 1193 | region = skin_buffer_alloc(sizeof(struct touchregion)); |
1194 | if (!region) | 1194 | if (!region) |
1195 | return WPS_ERROR_INVALID_PARAM; | 1195 | return WPS_ERROR_INVALID_PARAM; |
1196 | 1196 | ||
1197 | /* should probably do some bounds checking here with the viewport... but later */ | 1197 | /* should probably do some bounds checking here with the viewport... but later */ |
1198 | region->action = ACTION_NONE; | 1198 | region->action = ACTION_NONE; |
1199 | region->x = x; | 1199 | region->x = x; |
@@ -1201,7 +1201,7 @@ static int parse_touchregion(const char *wps_bufptr, | |||
1201 | region->width = w; | 1201 | region->width = w; |
1202 | region->height = h; | 1202 | region->height = h; |
1203 | region->wvp = curr_vp; | 1203 | region->wvp = curr_vp; |
1204 | 1204 | ||
1205 | if(!strncmp(pb_string, action, sizeof(pb_string)-1) | 1205 | if(!strncmp(pb_string, action, sizeof(pb_string)-1) |
1206 | && *(action + sizeof(pb_string)-1) == '|') | 1206 | && *(action + sizeof(pb_string)-1) == '|') |
1207 | region->type = WPS_TOUCHREGION_SCROLLBAR; | 1207 | region->type = WPS_TOUCHREGION_SCROLLBAR; |
@@ -1222,7 +1222,7 @@ static int parse_touchregion(const char *wps_bufptr, | |||
1222 | 1222 | ||
1223 | i = 0; | 1223 | i = 0; |
1224 | imax = ARRAYLEN(touchactions); | 1224 | imax = ARRAYLEN(touchactions); |
1225 | while ((region->action == ACTION_NONE) && | 1225 | while ((region->action == ACTION_NONE) && |
1226 | (i < imax)) | 1226 | (i < imax)) |
1227 | { | 1227 | { |
1228 | /* try to match with one of our touchregion screens */ | 1228 | /* try to match with one of our touchregion screens */ |
@@ -1239,9 +1239,9 @@ static int parse_touchregion(const char *wps_bufptr, | |||
1239 | if (!item) | 1239 | if (!item) |
1240 | return WPS_ERROR_INVALID_PARAM; | 1240 | return WPS_ERROR_INVALID_PARAM; |
1241 | add_to_ll_chain(&wps_data->touchregions, item); | 1241 | add_to_ll_chain(&wps_data->touchregions, item); |
1242 | return skip_end_of_line(wps_bufptr); | 1242 | return skip_end_of_line(wps_bufptr); |
1243 | } | 1243 | } |
1244 | #endif | 1244 | #endif |
1245 | 1245 | ||
1246 | /* Parse a generic token from the given string. Return the length read */ | 1246 | /* Parse a generic token from the given string. Return the length read */ |
1247 | static int parse_token(const char *wps_bufptr, struct wps_data *wps_data) | 1247 | static int parse_token(const char *wps_bufptr, struct wps_data *wps_data) |
@@ -1318,7 +1318,7 @@ static int parse_token(const char *wps_bufptr, struct wps_data *wps_data) | |||
1318 | data is the pointer to the structure where the parsed WPS should be stored. | 1318 | data is the pointer to the structure where the parsed WPS should be stored. |
1319 | It is initialised. | 1319 | It is initialised. |
1320 | wps_bufptr points to the string containing the WPS tags */ | 1320 | wps_bufptr points to the string containing the WPS tags */ |
1321 | #define TOKEN_BLOCK_SIZE 128 | 1321 | #define TOKEN_BLOCK_SIZE 128 |
1322 | static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug) | 1322 | static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug) |
1323 | { | 1323 | { |
1324 | if (!data || !wps_bufptr || !*wps_bufptr) | 1324 | if (!data || !wps_bufptr || !*wps_bufptr) |
@@ -1329,8 +1329,8 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug) | |||
1329 | size_t buf_free = 0; | 1329 | size_t buf_free = 0; |
1330 | line_number = 1; | 1330 | line_number = 1; |
1331 | level = -1; | 1331 | level = -1; |
1332 | 1332 | ||
1333 | /* allocate enough RAM for a reasonable skin, grow as needed. | 1333 | /* allocate enough RAM for a reasonable skin, grow as needed. |
1334 | * Free any used RAM before loading the images to be 100% RAM efficient */ | 1334 | * Free any used RAM before loading the images to be 100% RAM efficient */ |
1335 | data->tokens = (struct wps_token *)skin_buffer_grab(&buf_free); | 1335 | data->tokens = (struct wps_token *)skin_buffer_grab(&buf_free); |
1336 | if (sizeof(struct wps_token)*max_tokens >= buf_free) | 1336 | if (sizeof(struct wps_token)*max_tokens >= buf_free) |
@@ -1354,7 +1354,7 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug) | |||
1354 | skin_buffer_increment(needed, false); | 1354 | skin_buffer_increment(needed, false); |
1355 | max_tokens += extra_tokens; | 1355 | max_tokens += extra_tokens; |
1356 | } | 1356 | } |
1357 | 1357 | ||
1358 | switch(*wps_bufptr++) | 1358 | switch(*wps_bufptr++) |
1359 | { | 1359 | { |
1360 | 1360 | ||
@@ -1468,7 +1468,7 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug) | |||
1468 | data->num_tokens++; | 1468 | data->num_tokens++; |
1469 | 1469 | ||
1470 | if (!skin_start_new_line(curr_vp, data->num_tokens)) | 1470 | if (!skin_start_new_line(curr_vp, data->num_tokens)) |
1471 | { | 1471 | { |
1472 | fail = PARSE_FAIL_LIMITS_EXCEEDED; | 1472 | fail = PARSE_FAIL_LIMITS_EXCEEDED; |
1473 | break; | 1473 | break; |
1474 | } | 1474 | } |
@@ -1500,7 +1500,7 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug) | |||
1500 | str = (char*)list->token->value.data; | 1500 | str = (char*)list->token->value.data; |
1501 | found = (strlen(str) == len && | 1501 | found = (strlen(str) == len && |
1502 | strncmp(string_start, str, len) == 0); | 1502 | strncmp(string_start, str, len) == 0); |
1503 | if (found) | 1503 | if (found) |
1504 | break; /* break here because the list item is | 1504 | break; /* break here because the list item is |
1505 | used if its found */ | 1505 | used if its found */ |
1506 | list = list->next; | 1506 | list = list->next; |
@@ -1518,7 +1518,7 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug) | |||
1518 | break; | 1518 | break; |
1519 | } | 1519 | } |
1520 | strlcpy(str, string_start, len+1); | 1520 | strlcpy(str, string_start, len+1); |
1521 | struct skin_token_list *item = | 1521 | struct skin_token_list *item = |
1522 | new_skin_token_list_item(&data->tokens[data->num_tokens], str); | 1522 | new_skin_token_list_item(&data->tokens[data->num_tokens], str); |
1523 | if(!item) | 1523 | if(!item) |
1524 | { | 1524 | { |
@@ -1541,7 +1541,7 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug) | |||
1541 | 1541 | ||
1542 | if (!fail && level >= 0) /* there are unclosed conditionals */ | 1542 | if (!fail && level >= 0) /* there are unclosed conditionals */ |
1543 | fail = PARSE_FAIL_UNCLOSED_COND; | 1543 | fail = PARSE_FAIL_UNCLOSED_COND; |
1544 | 1544 | ||
1545 | if (*wps_bufptr && !fail) | 1545 | if (*wps_bufptr && !fail) |
1546 | /* one of the limits of the while loop was exceeded */ | 1546 | /* one of the limits of the while loop was exceeded */ |
1547 | fail = PARSE_FAIL_LIMITS_EXCEEDED; | 1547 | fail = PARSE_FAIL_LIMITS_EXCEEDED; |
@@ -1550,9 +1550,9 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug) | |||
1550 | curr_line->curr_subline->last_token_idx = data->num_tokens; | 1550 | curr_line->curr_subline->last_token_idx = data->num_tokens; |
1551 | data->tokens[data->num_tokens++].type = WPS_NO_TOKEN; | 1551 | data->tokens[data->num_tokens++].type = WPS_NO_TOKEN; |
1552 | /* freeup unused tokens */ | 1552 | /* freeup unused tokens */ |
1553 | skin_buffer_free_from_front(sizeof(struct wps_token) | 1553 | skin_buffer_free_from_front(sizeof(struct wps_token) |
1554 | * (max_tokens - data->num_tokens)); | 1554 | * (max_tokens - data->num_tokens)); |
1555 | 1555 | ||
1556 | #if defined(DEBUG) || defined(SIMULATOR) | 1556 | #if defined(DEBUG) || defined(SIMULATOR) |
1557 | if (debug) | 1557 | if (debug) |
1558 | print_debug_info(data, fail, line_number); | 1558 | print_debug_info(data, fail, line_number); |
@@ -1583,7 +1583,7 @@ static bool load_skin_bmp(struct wps_data *wps_data, struct bitmap *bitmap, char | |||
1583 | char img_path[MAX_PATH]; | 1583 | char img_path[MAX_PATH]; |
1584 | get_image_filename(bitmap->data, bmpdir, | 1584 | get_image_filename(bitmap->data, bmpdir, |
1585 | img_path, sizeof(img_path)); | 1585 | img_path, sizeof(img_path)); |
1586 | 1586 | ||
1587 | /* load the image */ | 1587 | /* load the image */ |
1588 | int format; | 1588 | int format; |
1589 | #ifdef HAVE_REMOTE_LCD | 1589 | #ifdef HAVE_REMOTE_LCD |
@@ -1592,7 +1592,7 @@ static bool load_skin_bmp(struct wps_data *wps_data, struct bitmap *bitmap, char | |||
1592 | else | 1592 | else |
1593 | #endif | 1593 | #endif |
1594 | format = FORMAT_ANY|FORMAT_TRANSPARENT; | 1594 | format = FORMAT_ANY|FORMAT_TRANSPARENT; |
1595 | 1595 | ||
1596 | size_t max_buf; | 1596 | size_t max_buf; |
1597 | char* imgbuf = (char*)skin_buffer_grab(&max_buf); | 1597 | char* imgbuf = (char*)skin_buffer_grab(&max_buf); |
1598 | bitmap->data = imgbuf; | 1598 | bitmap->data = imgbuf; |
@@ -1625,7 +1625,7 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir) | |||
1625 | pb->have_bitmap_pb = load_skin_bmp(wps_data, &pb->bm, bmpdir); | 1625 | pb->have_bitmap_pb = load_skin_bmp(wps_data, &pb->bm, bmpdir); |
1626 | } | 1626 | } |
1627 | list = list->next; | 1627 | list = list->next; |
1628 | } | 1628 | } |
1629 | /* regular images */ | 1629 | /* regular images */ |
1630 | list = wps_data->images; | 1630 | list = wps_data->images; |
1631 | while (list) | 1631 | while (list) |
@@ -1669,7 +1669,7 @@ bool skin_data_load(struct wps_data *wps_data, | |||
1669 | const char *buf, | 1669 | const char *buf, |
1670 | bool isfile) | 1670 | bool isfile) |
1671 | { | 1671 | { |
1672 | 1672 | ||
1673 | if (!wps_data || !buf) | 1673 | if (!wps_data || !buf) |
1674 | return false; | 1674 | return false; |
1675 | #ifdef HAVE_ALBUMART | 1675 | #ifdef HAVE_ALBUMART |
@@ -1686,7 +1686,7 @@ bool skin_data_load(struct wps_data *wps_data, | |||
1686 | #endif | 1686 | #endif |
1687 | 1687 | ||
1688 | wps_reset(wps_data); | 1688 | wps_reset(wps_data); |
1689 | 1689 | ||
1690 | curr_vp = skin_buffer_alloc(sizeof(struct skin_viewport)); | 1690 | curr_vp = skin_buffer_alloc(sizeof(struct skin_viewport)); |
1691 | if (!curr_vp) | 1691 | if (!curr_vp) |
1692 | return false; | 1692 | return false; |
@@ -1694,7 +1694,7 @@ bool skin_data_load(struct wps_data *wps_data, | |||
1694 | if (!list) | 1694 | if (!list) |
1695 | return false; | 1695 | return false; |
1696 | add_to_ll_chain(&wps_data->viewports, list); | 1696 | add_to_ll_chain(&wps_data->viewports, list); |
1697 | 1697 | ||
1698 | 1698 | ||
1699 | /* Initialise the first (default) viewport */ | 1699 | /* Initialise the first (default) viewport */ |
1700 | curr_vp->label = VP_DEFAULT_LABEL; | 1700 | curr_vp->label = VP_DEFAULT_LABEL; |
@@ -1704,17 +1704,17 @@ bool skin_data_load(struct wps_data *wps_data, | |||
1704 | curr_vp->pb = NULL; | 1704 | curr_vp->pb = NULL; |
1705 | curr_vp->hidden_flags = 0; | 1705 | curr_vp->hidden_flags = 0; |
1706 | curr_vp->lines = NULL; | 1706 | curr_vp->lines = NULL; |
1707 | 1707 | ||
1708 | curr_line = NULL; | 1708 | curr_line = NULL; |
1709 | if (!skin_start_new_line(curr_vp, 0)) | 1709 | if (!skin_start_new_line(curr_vp, 0)) |
1710 | return false; | 1710 | return false; |
1711 | 1711 | ||
1712 | switch (statusbar_position(display->screen_type)) | 1712 | switch (statusbar_position(display->screen_type)) |
1713 | { | 1713 | { |
1714 | case STATUSBAR_OFF: | 1714 | case STATUSBAR_OFF: |
1715 | curr_vp->vp.y = 0; | 1715 | curr_vp->vp.y = 0; |
1716 | break; | 1716 | break; |
1717 | case STATUSBAR_TOP: | 1717 | case STATUSBAR_TOP: |
1718 | curr_vp->vp.y = STATUSBAR_HEIGHT; | 1718 | curr_vp->vp.y = STATUSBAR_HEIGHT; |
1719 | curr_vp->vp.height -= STATUSBAR_HEIGHT; | 1719 | curr_vp->vp.height -= STATUSBAR_HEIGHT; |
1720 | break; | 1720 | break; |