This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

mcuelenaere

By: a guest on Aug 21st, 2009  |  syntax: None  |  size: 6.59 KB  |  views: 121  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Index: tools/checkwps/targets.txt
  2. ===================================================================
  3. --- tools/checkwps/targets.txt  (revision 22450)
  4. +++ tools/checkwps/targets.txt  (working copy)
  5.  -35,3 +35,5 @@
  6.  SANSA_M200 m200
  7.  SANSA_C100 c100
  8.  ELIO_TPJ1022 tpj1022
  9. +ONDA_VX747 ondavx747
  10. +ONDA_VX777 ondavx777
  11. Index: tools/checkwps/checkwps.c
  12. ===================================================================
  13. --- tools/checkwps/checkwps.c   (revision 22450)
  14. +++ tools/checkwps/checkwps.c   (working copy)
  15.  -21,11 +21,12 @@
  16.  
  17.  #include <stdio.h>
  18.  #include <stdlib.h>
  19. -#include <fcntl.h>
  20.  #include "config.h"
  21. -#include "gwps.h"
  22.  #include "checkwps.h"
  23.  #include "resize.h"
  24. +#include "wps.h"
  25. +#include "wps_internals.h"
  26. +#include "settings.h"
  27.  
  28.  bool debug_wps = true;
  29.  int wps_verbose_level = 0;
  30.  -137,9 +138,11 @@
  31.      return 0;
  32.  }
  33.  
  34. -int resize_on_load(struct bitmap *bm, bool dither, struct dim *src,
  35. -                   struct rowset *rset, unsigned char *buf, unsigned int len,
  36. -                   const struct custom_format *format,
  37. +int resize_on_load(struct bitmap *bm, bool dither,
  38. +                   struct dim *src, struct rowset *tmp_row,
  39. +                   unsigned char *buf, unsigned int len,
  40. +                   const struct custom_format *cformat,
  41. +                   IF_PIX_FMT(int format_index,)
  42.                     struct img_part* (*store_part)(void *args),
  43.                     void *args)
  44.  {
  45.  -176,6 +179,7 @@
  46.      *buffer_size = PLUGIN_BUFFER_SIZE;
  47.      return pluginbuf;
  48.  }
  49. +
  50.  struct user_settings global_settings = {
  51.      .statusbar = true,
  52.  #ifdef HAVE_LCD_COLOR
  53.  -238,10 +242,83 @@
  54.  #endif
  55.  
  56.  
  57. +void skin_data_init(struct wps_data *wps_data)
  58. +{
  59. +#ifdef HAVE_LCD_BITMAP
  60. +    wps_data->wps_sb_tag = false;
  61. +    wps_data->show_sb_on_wps = false;
  62. +    wps_data->peak_meter_enabled = false;
  63. +    wps_data->images = NULL;
  64. +    wps_data->progressbars = NULL;
  65. +    /* progress bars */
  66. +#else /* HAVE_LCD_CHARCELLS */
  67. +    int i;
  68. +    for (i = 0; i < 8; i++)
  69. +    {
  70. +        wps_data->wps_progress_pat[i] = 0;
  71. +    }
  72. +    wps_data->full_line_progressbar = false;
  73. +#endif
  74. +    wps_data->button_time_volume = 0;
  75. +    wps_data->wps_loaded = false;
  76. +}
  77. +
  78. +#ifdef HAVE_LCD_BITMAP
  79. +struct gui_img* find_image(char label, struct wps_data *data)
  80. +{
  81. +    struct skin_token_list *list = data->images;
  82. +    while (list)
  83. +    {
  84. +        struct gui_img *img = (struct gui_img *)list->token->value.data;
  85. +        if (img->label == label)
  86. +            return img;
  87. +        list = list->next;
  88. +    }
  89. +    return NULL;
  90. +}  
  91. +#endif
  92. +
  93. +struct skin_viewport* find_viewport(char label, struct wps_data *data)
  94. +{
  95. +    struct skin_token_list *list = data->viewports;
  96. +    while (list)
  97. +    {
  98. +        struct skin_viewport *vp = (struct skin_viewport *)list->token->value.data;
  99. +        if (vp->label == label)
  100. +            return vp;
  101. +        list = list->next;
  102. +    }
  103. +    return NULL;
  104. +}
  105. +
  106. +int skin_last_token_index(struct wps_data *data, int line, int subline)
  107. +{
  108. +    int first_subline_idx = data->lines[line].first_subline_idx;
  109. +    int idx = first_subline_idx + subline;
  110. +    if (idx < data->num_sublines - 1)
  111. +    {
  112. +        /* This subline ends where the next begins */
  113. +        return data->sublines[idx+1].first_token_idx - 1;
  114. +    }
  115. +    else
  116. +    {
  117. +        /* The last subline goes to the end */
  118. +        return data->num_tokens - 1;
  119. +    }
  120. +}
  121. +
  122. +const char* viewport_parse_viewport(struct viewport *vp,
  123. +                                    enum screen_type screen,
  124. +                                    const char *bufptr,
  125. +                                    const char separator)
  126. +{
  127. +    return NULL;
  128. +}
  129. +
  130.  int main(int argc, char **argv)
  131.  {
  132.      int res;
  133. -    int fd;
  134. +    FILE *fd;
  135.      int filearg = 1;
  136.  
  137.      struct wps_data wps;
  138.  -270,26 +347,28 @@
  139.          }
  140.      }
  141.  
  142. -    fd = open(argv[filearg], O_RDONLY);
  143. -    if (fd < 0) {
  144. -      printf("Failed to open %s\n",argv[1]);
  145. +    fd = fopen(argv[filearg], "rb");
  146. +    if (fd == NULL) {
  147. +      printf("Failed to open %s\n", argv[1]);
  148.        return 2;
  149.      }
  150. -    close(fd);
  151. +    fclose(fd);
  152.  
  153. +    skin_buffer_init();
  154. +
  155.      /* Go through every wps that was thrown at us, error out at the first
  156.       * flawed wps */
  157.      while (argv[filearg]) {
  158. -    printf("Checking %s...\n", argv[filearg]);
  159. -    res = wps_data_load(&wps, &screens[0], argv[filearg], true);
  160. +        printf("Checking %s...\n", argv[filearg]);
  161. +        res = skin_data_load(&wps, &screens[SCREEN_MAIN], argv[filearg], true);
  162.  
  163. -    if (!res) {
  164. -      printf("WPS parsing failure\n");
  165. -      return 3;
  166. -    }
  167. +        if (!res) {
  168. +            printf("WPS parsing failure\n");
  169. +            return 3;
  170. +        }
  171.  
  172. -    printf("WPS parsed OK\n\n");
  173. -    filearg++;
  174. +        printf("WPS parsed OK\n\n");
  175. +        filearg++;
  176.      }
  177.      return 0;
  178.  }
  179. Index: tools/checkwps/Makefile
  180. ===================================================================
  181. --- tools/checkwps/Makefile     (revision 22450)
  182. +++ tools/checkwps/Makefile     (working copy)
  183.  -19,12 +19,15 @@
  184.  endif
  185.  endif
  186.  
  187. -COMMON=$(ROOT)/apps/gui/wps_parser.c \
  188. -       $(ROOT)/apps/gui/wps_debug.c \
  189. +COMMON=$(ROOT)/apps/gui/skin_engine/wps_debug.c \
  190. +       $(ROOT)/apps/gui/skin_engine/skin_parser.c \
  191. +       $(ROOT)/apps/gui/skin_engine/skin_buffer.c \
  192.         $(ROOT)/apps/misc.c \
  193. -       $(ROOT)/apps/recorder/bmp.c
  194. +       $(ROOT)/apps/recorder/bmp.c \
  195. +       $(ROOT)/firmware/common/strlcpy.c
  196.  
  197.  INCLUDE=-I $(ROOT)/apps/gui \
  198. +        -I $(ROOT)/apps/gui/skin_engine \
  199.          -I $(ROOT)/firmware/export \
  200.          -I $(ROOT)/apps \
  201.          -I $(ROOT)/apps/recorder \
  202. Index: tools/checkwps/checkwps.h
  203. ===================================================================
  204. --- tools/checkwps/checkwps.h   (revision 22450)
  205. +++ tools/checkwps/checkwps.h   (working copy)
  206.  -24,21 +24,17 @@
  207.  #include <stdio.h>
  208.  #include <stdlib.h>
  209.  #include <stdbool.h>
  210. -#include <fcntl.h>
  211.  
  212. -/* subset of global_settings needed to build checkwps. */
  213. -struct user_settings {
  214. -    bool statusbar;
  215. -    int bg_color; /* background color native format */
  216. -    int fg_color; /* foreground color native format */
  217. -};
  218. -
  219. -extern struct user_settings global_settings;
  220. -
  221.  #define FONT_SYSFIXED 0
  222.  #define FONT_UI 1
  223.  #define SYSFONT_HEIGHT 8
  224.  
  225. -#define MIN(x,y) ((x) > (y) ? (y) : (x))
  226. +#ifndef MIN
  227. +#define MIN(a, b) (((a)<(b))?(a):(b))
  228. +#endif
  229.  
  230. +#ifndef BIT_N
  231. +#define BIT_N(n) (1U << (n))
  232.  #endif
  233. +
  234. +#endif
  235. Index: apps/gui/skin_engine/skin_parser.c
  236. ===================================================================
  237. --- apps/gui/skin_engine/skin_parser.c  (revision 22450)
  238. +++ apps/gui/skin_engine/skin_parser.c  (working copy)
  239.  -32,6 +32,7 @@
  240.  #include "proxy.h"
  241.  #include "sysfont.h"
  242.  #else
  243. +#include "action.h"
  244.  #include "checkwps.h"
  245.  #include "audio.h"
  246.  #define DEBUGF printf
clone this paste RAW Paste Data