diff options
author | Antoine Cellerier <dionoea@videolan.org> | 2008-12-07 16:20:35 +0000 |
---|---|---|
committer | Antoine Cellerier <dionoea@videolan.org> | 2008-12-07 16:20:35 +0000 |
commit | 8289b966b810eb21732ecb905433debf4e872857 (patch) | |
tree | 4665d7ca2d8c2f5bfa41686f9e7ddba65fb4e18f /apps/gui/wps_parser.c | |
parent | 3ad535031a84f0fa9c65a24e140c81b0a60c3026 (diff) | |
download | rockbox-8289b966b810eb21732ecb905433debf4e872857.tar.gz rockbox-8289b966b810eb21732ecb905433debf4e872857.zip |
Apply FS#9368 : add generic settings tag to WPS.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19357 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/wps_parser.c')
-rw-r--r-- | apps/gui/wps_parser.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c index 88601fd9eb..22b161155e 100644 --- a/apps/gui/wps_parser.c +++ b/apps/gui/wps_parser.c | |||
@@ -56,6 +56,7 @@ | |||
56 | 56 | ||
57 | #include "gwps.h" | 57 | #include "gwps.h" |
58 | #include "settings.h" | 58 | #include "settings.h" |
59 | #include "settings_list.h" | ||
59 | 60 | ||
60 | #ifdef HAVE_LCD_BITMAP | 61 | #ifdef HAVE_LCD_BITMAP |
61 | #include "bmp.h" | 62 | #include "bmp.h" |
@@ -137,6 +138,8 @@ static int parse_progressbar(const char *wps_bufptr, | |||
137 | struct wps_token *token, struct wps_data *wps_data); | 138 | struct wps_token *token, struct wps_data *wps_data); |
138 | static int parse_dir_level(const char *wps_bufptr, | 139 | static int parse_dir_level(const char *wps_bufptr, |
139 | struct wps_token *token, struct wps_data *wps_data); | 140 | struct wps_token *token, struct wps_data *wps_data); |
141 | static int parse_setting(const char *wps_bufptr, | ||
142 | struct wps_token *token, struct wps_data *wps_data); | ||
140 | 143 | ||
141 | #ifdef HAVE_LCD_BITMAP | 144 | #ifdef HAVE_LCD_BITMAP |
142 | static int parse_viewport_display(const char *wps_bufptr, | 145 | static int parse_viewport_display(const char *wps_bufptr, |
@@ -342,6 +345,8 @@ static const struct wps_tag all_tags[] = { | |||
342 | #endif | 345 | #endif |
343 | #endif | 346 | #endif |
344 | 347 | ||
348 | { WPS_TOKEN_SETTING, "St", WPS_REFRESH_DYNAMIC, parse_setting }, | ||
349 | |||
345 | { WPS_TOKEN_UNKNOWN, "", 0, NULL } | 350 | { WPS_TOKEN_UNKNOWN, "", 0, NULL } |
346 | /* the array MUST end with an empty string (first char is \0) */ | 351 | /* the array MUST end with an empty string (first char is \0) */ |
347 | }; | 352 | }; |
@@ -726,6 +731,39 @@ static int parse_viewport(const char *wps_bufptr, | |||
726 | return skip_end_of_line(wps_bufptr); | 731 | return skip_end_of_line(wps_bufptr); |
727 | } | 732 | } |
728 | 733 | ||
734 | static int parse_setting(const char *wps_bufptr, | ||
735 | struct wps_token *token, | ||
736 | struct wps_data *wps_data) | ||
737 | { | ||
738 | (void)wps_data; | ||
739 | const char *ptr = wps_bufptr; | ||
740 | const char *end; | ||
741 | int i; | ||
742 | |||
743 | /* Find the setting's cfg_name */ | ||
744 | if (*ptr != '|') | ||
745 | return WPS_ERROR_INVALID_PARAM; | ||
746 | ptr++; | ||
747 | end = strchr(ptr,'|'); | ||
748 | if (!end) | ||
749 | return WPS_ERROR_INVALID_PARAM; | ||
750 | |||
751 | /* Find the setting */ | ||
752 | for (i=0; i<nb_settings; i++) | ||
753 | if (settings[i].cfg_name && | ||
754 | !strncmp(settings[i].cfg_name,ptr,end-ptr) && | ||
755 | /* prevent matches on cfg_name prefixes */ | ||
756 | strlen(settings[i].cfg_name)==end-ptr) break; | ||
757 | if (i == nb_settings) | ||
758 | return WPS_ERROR_INVALID_PARAM; | ||
759 | |||
760 | /* Store the setting number */ | ||
761 | token->value.i = i; | ||
762 | |||
763 | /* Skip the rest of the line */ | ||
764 | return end-ptr+2; | ||
765 | } | ||
766 | |||
729 | 767 | ||
730 | #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) | 768 | #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) |
731 | static int parse_image_special(const char *wps_bufptr, | 769 | static int parse_image_special(const char *wps_bufptr, |