2007-04-04 14:41:40 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Nicolas Pennequin, Dan Everton, Matthias Mohr
|
|
|
|
*
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "gwps.h"
|
|
|
|
#include "debug.h"
|
|
|
|
|
2007-04-24 23:58:57 +00:00
|
|
|
#define PARSE_FAIL_UNCLOSED_COND 1
|
|
|
|
#define PARSE_FAIL_INVALID_CHAR 2
|
|
|
|
#define PARSE_FAIL_COND_SYNTAX_ERROR 3
|
|
|
|
|
|
|
|
#ifdef SIMULATOR
|
|
|
|
extern bool debug_wps;
|
|
|
|
#endif
|
|
|
|
|
2007-04-08 04:01:06 +00:00
|
|
|
static char *next_str(bool next) {
|
2007-04-24 23:58:57 +00:00
|
|
|
return next ? "next " : "";
|
2007-04-08 04:01:06 +00:00
|
|
|
}
|
|
|
|
|
2007-04-24 23:58:57 +00:00
|
|
|
static void dump_wps_tokens(struct wps_data *data)
|
2007-04-04 14:41:40 +00:00
|
|
|
{
|
2007-04-08 04:01:06 +00:00
|
|
|
struct wps_token *token;
|
2007-04-04 14:41:40 +00:00
|
|
|
int i, j;
|
|
|
|
int indent = 0;
|
|
|
|
char buf[64];
|
|
|
|
bool next;
|
2007-04-30 14:08:58 +00:00
|
|
|
int num_string_tokens = 0;
|
2007-04-04 14:41:40 +00:00
|
|
|
|
2007-04-08 04:01:06 +00:00
|
|
|
if (data->num_tokens > WPS_MAX_TOKENS) {
|
|
|
|
DEBUGF("Number of tokens is too high (%d)!!!\n", data->num_tokens);
|
|
|
|
return;
|
|
|
|
}
|
2007-04-04 14:41:40 +00:00
|
|
|
|
2007-04-08 04:01:06 +00:00
|
|
|
/* Dump parsed WPS */
|
|
|
|
for (i = 0, token = data->tokens; i < data->num_tokens; i++, token++) {
|
|
|
|
next = token->next;
|
2007-04-04 14:41:40 +00:00
|
|
|
|
2007-04-08 04:01:06 +00:00
|
|
|
switch(token->type) {
|
2007-04-04 14:41:40 +00:00
|
|
|
case WPS_TOKEN_UNKNOWN:
|
|
|
|
snprintf(buf, sizeof(buf), "Unknown token");
|
|
|
|
break;
|
|
|
|
case WPS_TOKEN_CHARACTER:
|
|
|
|
snprintf(buf, sizeof(buf), "Character '%c'",
|
2007-04-08 04:01:06 +00:00
|
|
|
token->value.c);
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_STRING:
|
|
|
|
snprintf(buf, sizeof(buf), "String '%s'",
|
2007-04-08 04:01:06 +00:00
|
|
|
data->strings[token->value.i]);
|
2007-04-30 14:08:58 +00:00
|
|
|
num_string_tokens++;
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
case WPS_TOKEN_ALIGN_LEFT:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "align left");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_ALIGN_CENTER:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "align center");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_ALIGN_RIGHT:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "align right");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2007-04-08 04:01:06 +00:00
|
|
|
case WPS_TOKEN_SUBLINE_TIMEOUT:
|
|
|
|
snprintf(buf, sizeof(buf), "subline timeout value: %d",
|
|
|
|
token->value.i);
|
|
|
|
break;
|
|
|
|
|
2007-04-04 14:41:40 +00:00
|
|
|
case WPS_TOKEN_CONDITIONAL:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "conditional, %d options",
|
|
|
|
token->value.i);
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_CONDITIONAL_START:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "conditional start, next cond: %d",
|
|
|
|
token->value.i);
|
2007-04-04 14:41:40 +00:00
|
|
|
indent++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_CONDITIONAL_OPTION:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "conditional option, next cond: %d",
|
|
|
|
token->value.i);
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_CONDITIONAL_END:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "conditional end");
|
2007-04-04 14:41:40 +00:00
|
|
|
indent--;
|
|
|
|
break;
|
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
case WPS_TOKEN_IMAGE_PRELOAD:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "preload image");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_IMAGE_PRELOAD_DISPLAY:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "display preloaded image %d",
|
|
|
|
token->value.i);
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_IMAGE_DISPLAY:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "display image");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAS_BUTTON_HOLD
|
|
|
|
case WPS_TOKEN_MAIN_HOLD:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "mode hold");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAS_REMOTE_BUTTON_HOLD
|
|
|
|
case WPS_TOKEN_REMOTE_HOLD:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "mode remote hold");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
case WPS_TOKEN_REPEAT_MODE:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "mode repeat");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_PLAYBACK_STATUS:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "mode playback");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
#if CONFIG_RTC
|
|
|
|
case WPS_TOKEN_RTC_DAY_OF_MONTH:
|
2007-04-10 13:37:08 +00:00
|
|
|
snprintf(buf, sizeof(buf), "rtc: day of month (01..31)");
|
|
|
|
break;
|
2007-04-04 14:41:40 +00:00
|
|
|
case WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED:
|
2007-04-10 13:37:08 +00:00
|
|
|
snprintf(buf, sizeof(buf), "rtc: day of month, blank padded ( 1..31)");
|
|
|
|
break;
|
2007-04-04 14:41:40 +00:00
|
|
|
case WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED:
|
2007-04-10 13:37:08 +00:00
|
|
|
snprintf(buf, sizeof(buf), "rtc: hour (00..23)");
|
|
|
|
break;
|
2007-04-04 14:41:40 +00:00
|
|
|
case WPS_TOKEN_RTC_HOUR_24:
|
2007-04-10 13:37:08 +00:00
|
|
|
snprintf(buf, sizeof(buf), "rtc: hour ( 0..23)");
|
|
|
|
break;
|
2007-04-04 14:41:40 +00:00
|
|
|
case WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED:
|
2007-04-10 13:37:08 +00:00
|
|
|
snprintf(buf, sizeof(buf), "rtc: hour (01..12)");
|
|
|
|
break;
|
2007-04-04 14:41:40 +00:00
|
|
|
case WPS_TOKEN_RTC_HOUR_12:
|
2007-04-10 13:37:08 +00:00
|
|
|
snprintf(buf, sizeof(buf), "rtc: hour ( 1..12)");
|
|
|
|
break;
|
2007-04-04 14:41:40 +00:00
|
|
|
case WPS_TOKEN_RTC_MONTH:
|
2007-04-10 13:37:08 +00:00
|
|
|
snprintf(buf, sizeof(buf), "rtc: month (01..12)");
|
|
|
|
break;
|
2007-04-04 14:41:40 +00:00
|
|
|
case WPS_TOKEN_RTC_MINUTE:
|
2007-04-10 13:37:08 +00:00
|
|
|
snprintf(buf, sizeof(buf), "rtc: minute (00..59)");
|
|
|
|
break;
|
2007-04-04 14:41:40 +00:00
|
|
|
case WPS_TOKEN_RTC_SECOND:
|
2007-04-10 13:37:08 +00:00
|
|
|
snprintf(buf, sizeof(buf), "rtc: second (00..59)");
|
|
|
|
break;
|
2007-04-04 14:41:40 +00:00
|
|
|
case WPS_TOKEN_RTC_YEAR_2_DIGITS:
|
2007-04-10 13:37:08 +00:00
|
|
|
snprintf(buf, sizeof(buf), "rtc: last two digits of year (00..99)");
|
|
|
|
break;
|
2007-04-04 14:41:40 +00:00
|
|
|
case WPS_TOKEN_RTC_YEAR_4_DIGITS:
|
2007-04-10 13:37:08 +00:00
|
|
|
snprintf(buf, sizeof(buf), "rtc: year (1970...)");
|
|
|
|
break;
|
2007-04-04 14:41:40 +00:00
|
|
|
case WPS_TOKEN_RTC_AM_PM_UPPER:
|
2007-04-10 13:37:08 +00:00
|
|
|
snprintf(buf, sizeof(buf), "rtc: upper case AM or PM indicator");
|
|
|
|
break;
|
2007-04-04 14:41:40 +00:00
|
|
|
case WPS_TOKEN_RTC_AM_PM_LOWER:
|
2007-04-10 13:37:08 +00:00
|
|
|
snprintf(buf, sizeof(buf), "rtc: lower case am or pm indicator");
|
|
|
|
break;
|
2007-04-04 14:41:40 +00:00
|
|
|
case WPS_TOKEN_RTC_WEEKDAY_NAME:
|
2007-04-10 13:37:08 +00:00
|
|
|
snprintf(buf, sizeof(buf), "rtc: abbreviated weekday name (Sun..Sat)");
|
|
|
|
break;
|
2007-04-04 14:41:40 +00:00
|
|
|
case WPS_TOKEN_RTC_MONTH_NAME:
|
2007-04-10 13:37:08 +00:00
|
|
|
snprintf(buf, sizeof(buf), "rtc: abbreviated month name (Jan..Dec)");
|
|
|
|
break;
|
2007-04-04 14:41:40 +00:00
|
|
|
case WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON:
|
2007-04-10 13:37:08 +00:00
|
|
|
snprintf(buf, sizeof(buf), "rtc: day of week (1..7); 1 is Monday");
|
|
|
|
break;
|
2007-04-04 14:41:40 +00:00
|
|
|
case WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN:
|
2007-04-10 13:37:08 +00:00
|
|
|
snprintf(buf, sizeof(buf), "rtc: day of week (0..6); 0 is Sunday");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
#endif
|
2007-04-12 16:15:34 +00:00
|
|
|
|
|
|
|
#if (CONFIG_CODEC == SWCODEC)
|
|
|
|
case WPS_TOKEN_CROSSFADE:
|
|
|
|
snprintf(buf, sizeof(buf), "crossfade");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_REPLAYGAIN:
|
|
|
|
snprintf(buf, sizeof(buf), "replaygain");
|
|
|
|
break;
|
|
|
|
#endif
|
2007-04-04 14:41:40 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
case WPS_TOKEN_IMAGE_BACKDROP:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "backdrop image");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_IMAGE_PROGRESS_BAR:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "progressbar bitmap");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_PEAKMETER:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "peakmeter");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
case WPS_TOKEN_PROGRESSBAR:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "progressbar");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
#ifdef HAVE_LCD_CHARCELLS
|
|
|
|
case WPS_TOKEN_PLAYER_PROGRESSBAR:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "full line progressbar");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
case WPS_TOKEN_TRACK_TIME_ELAPSED:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "time elapsed in track");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_PLAYLIST_ENTRIES:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "number of entries in playlist");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_PLAYLIST_NAME:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "playlist name");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_PLAYLIST_POSITION:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "position in playlist");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_TRACK_TIME_REMAINING:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "time remaining in track");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_PLAYLIST_SHUFFLE:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "playlist shuffle mode");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_TRACK_LENGTH:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "track length");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_VOLUME:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "volume");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_METADATA_ARTIST:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "%strack artist", next_str(next));
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_METADATA_COMPOSER:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "%strack composer", next_str(next));
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_METADATA_ALBUM:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "%strack album", next_str(next));
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_METADATA_GENRE:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "%strack genre", next_str(next));
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_METADATA_TRACK_NUMBER:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "%strack number", next_str(next));
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_METADATA_TRACK_TITLE:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "%strack title", next_str(next));
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_METADATA_VERSION:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "%strack ID3 version", next_str(next));
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_METADATA_YEAR:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "%strack year", next_str(next));
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_BATTERY_PERCENT:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "battery percentage");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_BATTERY_VOLTS:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "battery voltage");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_BATTERY_TIME:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "battery time left");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_BATTERY_CHARGER_CONNECTED:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "battery charger connected");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_BATTERY_CHARGING:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "battery charging");
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_FILE_BITRATE:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "%sfile bitrate", next_str(next));
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_FILE_CODEC:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "%sfile codec", next_str(next));
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_FILE_FREQUENCY:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "%sfile audio frequency", next_str(next));
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_FILE_NAME:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "%sfile name", next_str(next));
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_FILE_NAME_WITH_EXTENSION:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "%sfile name with extension", next_str(next));
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_FILE_PATH:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "%sfile path", next_str(next));
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_FILE_SIZE:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "%sfile size", next_str(next));
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_FILE_VBR:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "%sfile is vbr", next_str(next));
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WPS_TOKEN_FILE_DIRECTORY:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "%sfile directory, level: %d", next_str(next),
|
|
|
|
token->value.i);
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2007-04-08 04:01:06 +00:00
|
|
|
snprintf(buf, sizeof(buf), "FIXME (code: %d)",
|
|
|
|
token->type);
|
2007-04-04 14:41:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(j = 0; j < indent; j++) {
|
|
|
|
DEBUGF("\t");
|
|
|
|
}
|
|
|
|
|
2007-04-08 04:01:06 +00:00
|
|
|
DEBUGF("[%3d] = (%2d) %s\n", i, token->type, buf);
|
2007-04-04 14:41:40 +00:00
|
|
|
}
|
|
|
|
DEBUGF("\n");
|
2007-04-30 14:08:58 +00:00
|
|
|
|
|
|
|
DEBUGF("Number of string tokens: %d\n", num_string_tokens);
|
|
|
|
DEBUGF("\n");
|
2007-04-04 14:41:40 +00:00
|
|
|
}
|
|
|
|
|
2007-04-24 23:58:57 +00:00
|
|
|
static void print_line_info(struct wps_data *data)
|
2007-04-04 14:41:40 +00:00
|
|
|
{
|
2007-04-08 04:01:06 +00:00
|
|
|
int i, j;
|
|
|
|
struct wps_line *line;
|
|
|
|
struct wps_subline *subline;
|
2007-04-04 14:41:40 +00:00
|
|
|
|
2007-04-08 04:01:06 +00:00
|
|
|
DEBUGF("Number of lines : %d\n", data->num_lines);
|
|
|
|
DEBUGF("Number of sublines: %d\n", data->num_sublines);
|
|
|
|
DEBUGF("Number of tokens : %d\n", data->num_tokens);
|
|
|
|
DEBUGF("\n");
|
|
|
|
|
|
|
|
for (i = 0, line = data->lines; i < data->num_lines; i++,line++)
|
2007-04-04 14:41:40 +00:00
|
|
|
{
|
2007-04-08 04:01:06 +00:00
|
|
|
DEBUGF("Line %2d (num_sublines=%d, first_subline=%d)\n",
|
|
|
|
i, line->num_sublines, line->first_subline_idx);
|
|
|
|
|
|
|
|
for (j = 0, subline = data->sublines + line->first_subline_idx;
|
|
|
|
j < line->num_sublines; j++, subline++)
|
2007-04-04 14:41:40 +00:00
|
|
|
{
|
2007-04-08 04:01:06 +00:00
|
|
|
DEBUGF(" Subline %d: first_token=%3d, last_token=%3d",
|
|
|
|
j, subline->first_token_idx,
|
|
|
|
wps_last_token_index(data, i, j));
|
|
|
|
|
|
|
|
if (subline->line_type & WPS_REFRESH_SCROLL)
|
|
|
|
DEBUGF(", scrolled");
|
|
|
|
else if (subline->line_type & WPS_REFRESH_PLAYER_PROGRESS)
|
|
|
|
DEBUGF(", progressbar");
|
|
|
|
else if (subline->line_type & WPS_REFRESH_PEAK_METER)
|
|
|
|
DEBUGF(", peakmeter");
|
|
|
|
|
|
|
|
DEBUGF("\n");
|
2007-04-04 14:41:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DEBUGF("\n");
|
|
|
|
}
|
|
|
|
|
2007-04-24 23:58:57 +00:00
|
|
|
static void print_wps_strings(struct wps_data *data)
|
2007-04-04 14:41:40 +00:00
|
|
|
{
|
2007-04-15 22:11:53 +00:00
|
|
|
int i, len, total_len = 0, buf_used = 0;
|
|
|
|
|
2007-04-08 04:01:06 +00:00
|
|
|
DEBUGF("Strings:\n");
|
2007-04-15 02:59:34 +00:00
|
|
|
for (i = 0; i < data->num_strings; i++)
|
2007-04-04 14:41:40 +00:00
|
|
|
{
|
2007-04-15 22:11:53 +00:00
|
|
|
len = strlen(data->strings[i]);
|
|
|
|
total_len += len;
|
|
|
|
buf_used += len + 1;
|
|
|
|
DEBUGF("%2d: (%2d) '%s'\n", i, len, data->strings[i]);
|
2007-04-04 14:41:40 +00:00
|
|
|
}
|
2007-04-15 02:59:34 +00:00
|
|
|
DEBUGF("\n");
|
2007-04-30 14:08:58 +00:00
|
|
|
DEBUGF("Number of strings: %d out of an allowed %d\n", data->num_strings, WPS_MAX_STRINGS);
|
|
|
|
DEBUGF("Total string length: %d\n", total_len);
|
2007-04-15 02:59:34 +00:00
|
|
|
DEBUGF("String buffer used: %d out of %d bytes\n", buf_used, STRING_BUFFER_SIZE);
|
2007-04-04 14:41:40 +00:00
|
|
|
DEBUGF("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2007-04-24 23:58:57 +00:00
|
|
|
static void print_img_cond_indexes(struct wps_data *data)
|
2007-04-04 14:41:40 +00:00
|
|
|
{
|
2007-04-08 04:01:06 +00:00
|
|
|
DEBUGF("Image conditional indexes:\n");
|
2007-04-04 14:41:40 +00:00
|
|
|
int i;
|
2007-04-15 02:59:34 +00:00
|
|
|
for (i = 0; i < MAX_IMAGES; i++)
|
2007-04-04 14:41:40 +00:00
|
|
|
{
|
|
|
|
if (data->img[i].cond_index)
|
|
|
|
DEBUGF("%2d: %d\n", i, data->img[i].cond_index);
|
|
|
|
}
|
|
|
|
DEBUGF("\n");
|
|
|
|
}
|
|
|
|
#endif /*HAVE_LCD_BITMAP */
|
|
|
|
|
2007-04-24 23:58:57 +00:00
|
|
|
void print_debug_info(struct wps_data *data, int fail, int line)
|
|
|
|
{
|
|
|
|
#ifdef SIMULATOR
|
|
|
|
if (debug_wps)
|
|
|
|
{
|
|
|
|
dump_wps_tokens(data);
|
|
|
|
print_wps_strings(data);
|
2007-04-30 14:08:58 +00:00
|
|
|
print_line_info(data);
|
2007-04-24 23:58:57 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
print_img_cond_indexes(data);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif /* SIMULATOR */
|
|
|
|
|
|
|
|
if (fail)
|
|
|
|
{
|
|
|
|
DEBUGF("Failed parsing on line %d : ", line);
|
|
|
|
switch (fail)
|
|
|
|
{
|
|
|
|
case PARSE_FAIL_UNCLOSED_COND:
|
|
|
|
DEBUGF("Unclosed conditional");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PARSE_FAIL_INVALID_CHAR:
|
|
|
|
DEBUGF("Invalid conditional char (not in an open conditional)");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PARSE_FAIL_COND_SYNTAX_ERROR:
|
|
|
|
DEBUGF("Conditional syntax error");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
DEBUGF("\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-04 14:41:40 +00:00
|
|
|
#endif /* DEBUG */
|