Guest User

Untitled

a guest
May 25th, 2010
144
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Index: tools/checkwps/checkwps.c
  2. ===================================================================
  3. --- tools/checkwps/checkwps.c (revision 26245)
  4. +++ tools/checkwps/checkwps.c (working copy)
  5. @@ -229,6 +229,8 @@
  6. }
  7. #endif
  8.  
  9. +FILE* updatefile = NULL;
  10. +
  11. int main(int argc, char **argv)
  12. {
  13. int res;
  14. @@ -246,6 +248,7 @@
  15. {
  16. printf("Usage: checkwps [OPTIONS] filename.wps [filename2.wps]...\n");
  17. printf("\nOPTIONS:\n");
  18. + printf("\t-u FILENAME\t\tUpdate skin to new format, output to FILENAME\n");
  19. printf("\t-v\t\tverbose\n");
  20. printf("\t-vv\t\tmore verbose\n");
  21. printf("\t-vvv\t\tvery verbose\n");
  22. @@ -260,6 +263,16 @@
  23. i++;
  24. wps_verbose_level++;
  25. }
  26. + if (argv[1][i] == 'u')
  27. + {
  28. + updatefile = fopen(argv[2], "w");
  29. + if (!updatefile)
  30. + {
  31. + printf("Couldnt open '%s'\n", argv[2]);
  32. + return 1;
  33. + }
  34. + filearg++;
  35. + }
  36. }
  37.  
  38. skin_buffer_init();
  39. Index: apps/gui/skin_engine/skin_parser.c
  40. ===================================================================
  41. --- apps/gui/skin_engine/skin_parser.c (revision 26245)
  42. +++ apps/gui/skin_engine/skin_parser.c (working copy)
  43. @@ -39,9 +39,12 @@
  44. #define lang_is_rtl() (false)
  45. #define DEBUGF printf
  46. #endif /*WPSEDITOR*/
  47. +extern FILE* updatefile;
  48. +#define UPDATE_SKIN(...) fprintf(updatefile, __VA_ARGS__)
  49. #else
  50. #include "debug.h"
  51. #include "language.h"
  52. +#define UPDATE_SKIN(...)
  53. #endif /*__PCTOOL__*/
  54.  
  55. #include <ctype.h>
  56. @@ -147,6 +150,19 @@
  57. return 0;
  58. }
  59.  
  60. +static void dump_new_args(const char *start, const char *end, bool printend)
  61. +{
  62. + UPDATE_SKIN("(");
  63. + while (start != end)
  64. + {
  65. + UPDATE_SKIN("%c", (*start == '|')?',':*start);
  66. + start++;
  67. + }
  68. + if (printend)
  69. + UPDATE_SKIN(")");
  70. +}
  71. +
  72. +
  73. #ifdef HAVE_LCD_BITMAP
  74. static int parse_viewport_display(const char *wps_bufptr,
  75. struct wps_token *token, struct wps_data *wps_data);
  76. @@ -507,6 +523,7 @@
  77. immediately after the first eol, i.e. to the start of the next line */
  78. static int skip_end_of_line(const char *wps_bufptr)
  79. {
  80. + UPDATE_SKIN("\n");
  81. line_number++;
  82. int skip = 0;
  83. while(*(wps_bufptr + skip) != '\n')
  84. @@ -655,12 +672,13 @@
  85. {
  86. if (subimage >= img->num_subimages)
  87. return WPS_ERROR_INVALID_PARAM;
  88. -
  89. + UPDATE_SKIN("(%c%c)", label, wps_bufptr[1]);
  90. /* Store sub-image number to display in high bits */
  91. token->value.i = label | (subimage << 8);
  92. return 2; /* We have consumed 2 bytes */
  93. } else {
  94. token->value.i = label;
  95. + UPDATE_SKIN("(%c)", label);
  96. return 1; /* We have consumed 1 byte */
  97. }
  98. }
  99. @@ -689,7 +707,7 @@
  100.  
  101. if (!(ptr = parse_list("ssdd", NULL, '|', ptr, &id, &filename, &x, &y)))
  102. return WPS_ERROR_INVALID_PARAM;
  103. -
  104. + dump_new_args(wps_bufptr+1, ptr, (token->type == WPS_TOKEN_IMAGE_DISPLAY));
  105. /* Check there is a terminating | */
  106. if (*ptr != '|')
  107. return WPS_ERROR_INVALID_PARAM;
  108. @@ -729,6 +747,7 @@
  109.  
  110. if (img->num_subimages <= 0)
  111. return WPS_ERROR_INVALID_PARAM;
  112. + UPDATE_SKIN(",%d)", img->num_subimages);
  113. }
  114. struct skin_token_list *item = new_skin_token_list_item(NULL, img);
  115. if (!item)
  116. @@ -758,7 +777,7 @@
  117.  
  118. if (!(ptr = parse_list("ds", NULL, '|', ptr, &id, &filename)))
  119. return WPS_ERROR_INVALID_PARAM;
  120. -
  121. + dump_new_args(wps_bufptr+1, ptr, true);
  122. /* Check there is a terminating | */
  123. if (*ptr != '|')
  124. return WPS_ERROR_INVALID_PARAM;
  125. @@ -796,10 +815,12 @@
  126. return WPS_ERROR_INVALID_PARAM;
  127. }
  128. token->value.i = letter;
  129. + UPDATE_SKIN("(%c)", letter);
  130. return 1;
  131. }
  132.  
  133. #ifdef HAVE_LCD_BITMAP
  134. +/* FIXME for the skin updater */
  135. static int parse_playlistview_text(struct playlistviewer *viewer,
  136. enum info_line_type line, char* text)
  137. {
  138. @@ -910,10 +931,12 @@
  139. length = parse_playlistview_text(viewer, TRACK_HAS_INFO, ptr);
  140. if (length < 0)
  141. return WPS_ERROR_INVALID_PARAM;
  142. - length = parse_playlistview_text(viewer, TRACK_HAS_NO_INFO, ptr+length);
  143. + ptr+=length;
  144. + length = parse_playlistview_text(viewer, TRACK_HAS_NO_INFO, ptr);
  145. if (length < 0)
  146. return WPS_ERROR_INVALID_PARAM;
  147. -
  148. + ptr+=length;
  149. + dump_new_args(wps_bufptr+1, ptr, true);
  150. return skip_end_of_line(wps_bufptr);
  151. }
  152. #endif
  153. @@ -924,6 +947,7 @@
  154. {
  155. (void)token; /* Kill warnings */
  156. const char *ptr = wps_bufptr;
  157. + const char* params_start;
  158.  
  159. struct skin_viewport *skin_vp = skin_buffer_alloc(sizeof(struct skin_viewport));
  160.  
  161. @@ -944,6 +968,8 @@
  162.  
  163. if (*ptr == 'i')
  164. {
  165. + UPDATE_SKIN("i");
  166. + params_start = ptr+2;
  167. if (*(ptr+1) == '|')
  168. {
  169. char label = *(ptr+2);
  170. @@ -966,8 +992,10 @@
  171. }
  172. else if (*ptr == 'l')
  173. {
  174. + UPDATE_SKIN("l");
  175. if (*(ptr+1) == '|')
  176. {
  177. + params_start = ptr+2;
  178. char label = *(ptr+2);
  179. if (label >= 'a' && label <= 'z')
  180. {
  181. @@ -979,6 +1007,8 @@
  182. ptr += 3;
  183. }
  184. }
  185. + else
  186. + params_start = ptr+1;
  187. if (*ptr != '|')
  188. return WPS_ERROR_INVALID_PARAM;
  189.  
  190. @@ -987,7 +1017,7 @@
  191. /* format: %V|x|y|width|height|font|fg_pattern|bg_pattern| */
  192. if (!(ptr = viewport_parse_viewport(vp, curr_screen, ptr, '|')))
  193. return WPS_ERROR_INVALID_PARAM;
  194. -
  195. + dump_new_args(params_start, ptr, true);
  196. /* Check for trailing | */
  197. if (*ptr != '|')
  198. return WPS_ERROR_INVALID_PARAM;
  199. @@ -1031,11 +1061,15 @@
  200. /* format: %X|filename.bmp| or %Xd */
  201. if (*(wps_bufptr) == 'd')
  202. {
  203. + UPDATE_SKIN("(d)");
  204. wps_data->backdrop = NULL;
  205. return skip_end_of_line(wps_bufptr);
  206. }
  207. else if (!error)
  208. + {
  209. + dump_new_args(wps_bufptr+1, strchr(wps_bufptr+1, '|'), true);
  210. wps_data->backdrop = (char*)wps_bufptr + 1;
  211. + }
  212. }
  213. #endif
  214. if (error)
  215. @@ -1070,6 +1104,7 @@
  216. if (!end || (size_t)(end-ptr+1) > sizeof temp)
  217. return WPS_ERROR_INVALID_PARAM;
  218. strlcpy(temp, ptr,end-ptr+1);
  219. + dump_new_args(wps_bufptr+1, end, true);
  220.  
  221. if (token->type == WPS_TOKEN_TRANSLATEDSTRING)
  222. {
  223. @@ -1105,6 +1140,7 @@
  224. {
  225. char val[] = { *wps_bufptr, '\0' };
  226. token->value.i = atoi(val);
  227. + UPDATE_SKIN("(%d)", token->value.i);
  228. (void)wps_data; /* Kill warnings */
  229. return 1;
  230. }
  231. @@ -1158,6 +1194,8 @@
  232. break;
  233. }
  234. }
  235. + else
  236. + UPDATE_SKIN("(%d)", token->value.i);
  237. token->value.i = val;
  238.  
  239. return skip;
  240. @@ -1226,6 +1264,7 @@
  241. return 0;
  242. return WPS_ERROR_INVALID_PARAM;
  243. }
  244. + dump_new_args(wps_bufptr+1, ptr, true);
  245.  
  246. if (LIST_VALUE_PARSED(set, PB_FILENAME)) /* filename */
  247. pb->bm.data = (char*)filename;
  248. @@ -1326,6 +1365,10 @@
  249. /* format: %Cl|x|y|[[l|c|r]mwidth]|[[t|c|b]mheight]| */
  250.  
  251. newline = strchr(wps_bufptr, '\n');
  252. + const char* args_end = newline;
  253. + while (args_end > wps_bufptr+1 && *args_end!='|')
  254. + args_end--;
  255. + dump_new_args(wps_bufptr+1,args_end, true);
  256.  
  257. _pos = wps_bufptr;
  258.  
  259. @@ -1542,7 +1585,7 @@
  260.  
  261. if (!(ptr = parse_list("dddds", NULL, '|', ptr, &x, &y, &w, &h, &action)))
  262. return WPS_ERROR_INVALID_PARAM;
  263. -
  264. + dump_new_args(wps_bufptr+1, ptr, true);
  265. /* Check there is a terminating | */
  266. if (*ptr != '|')
  267. return WPS_ERROR_INVALID_PARAM;
  268. @@ -1621,6 +1664,7 @@
  269. case ';':
  270. case '#':
  271. /* escaped characters */
  272. + UPDATE_SKIN("%c", *wps_bufptr);
  273. token->type = WPS_TOKEN_CHARACTER;
  274. token->value.c = *wps_bufptr;
  275. taglen = 1;
  276. @@ -1629,6 +1673,7 @@
  277.  
  278. case '?':
  279. /* conditional tag */
  280. + UPDATE_SKIN("?");
  281. token->type = WPS_TOKEN_CONDITIONAL;
  282. level++;
  283. condindex[level] = wps_data->num_tokens;
  284. @@ -1648,6 +1693,7 @@
  285. taglen = (tag->type != WPS_TOKEN_UNKNOWN) ? strlen(tag->name) : 2;
  286. token->type = tag->type;
  287. curr_line->curr_subline->line_type |= tag->refresh_type;
  288. + UPDATE_SKIN("%s", tag->name);
  289.  
  290. /* if the tag has a special parsing function, we call it */
  291. if (tag->parse_func)
  292. @@ -1820,6 +1866,7 @@
  293.  
  294. /* Regular tag */
  295. case '%':
  296. + UPDATE_SKIN("%%");
  297. if ((ret = parse_token(wps_bufptr, data)) < 0)
  298. {
  299. fail = PARSE_FAIL_COND_INVALID_PARAM;
  300. @@ -1840,7 +1887,7 @@
  301. fail = PARSE_FAIL_UNCLOSED_COND;
  302. break;
  303. }
  304. -
  305. + UPDATE_SKIN(";");
  306. if (!skin_start_new_subline(curr_line, data->num_tokens))
  307. fail = PARSE_FAIL_LIMITS_EXCEEDED;
  308.  
  309. @@ -1853,6 +1900,7 @@
  310. fail = PARSE_FAIL_COND_SYNTAX_ERROR;
  311. break;
  312. }
  313. + UPDATE_SKIN("<");
  314. wps_bufptr += check_feature_tag(wps_bufptr,
  315. data->tokens[data->num_tokens-1].type);
  316. data->tokens[data->num_tokens].type = WPS_TOKEN_CONDITIONAL_START;
  317. @@ -1866,6 +1914,7 @@
  318. fail = PARSE_FAIL_INVALID_CHAR;
  319. break;
  320. }
  321. + UPDATE_SKIN(">");
  322.  
  323. data->tokens[data->num_tokens].type = WPS_TOKEN_CONDITIONAL_END;
  324. if (lastcond[level])
  325. @@ -1889,6 +1938,7 @@
  326. fail = PARSE_FAIL_INVALID_CHAR;
  327. break;
  328. }
  329. + UPDATE_SKIN("|");
  330.  
  331. data->tokens[data->num_tokens].type = WPS_TOKEN_CONDITIONAL_OPTION;
  332. if (lastcond[level])
  333. @@ -1911,8 +1961,17 @@
  334. fail = PARSE_FAIL_UNCLOSED_COND;
  335. break;
  336. }
  337. -
  338. - wps_bufptr += skip_end_of_line(wps_bufptr);
  339. + else
  340. + {
  341. + UPDATE_SKIN("#");
  342. + while(*wps_bufptr != '\n')
  343. + {
  344. + UPDATE_SKIN("%c", *wps_bufptr);
  345. + wps_bufptr++;
  346. + }
  347. + UPDATE_SKIN("\n");
  348. + wps_bufptr++;
  349. + }
  350. break;
  351.  
  352. /* End of this line */
  353. @@ -1926,6 +1985,7 @@
  354. data->tokens[data->num_tokens].type = WPS_TOKEN_CHARACTER;
  355. data->tokens[data->num_tokens].value.c = '\n';
  356. data->tokens[data->num_tokens].next = false;
  357. + UPDATE_SKIN("\n");
  358. data->num_tokens++;
  359.  
  360. if (!skin_start_new_line(curr_vp, data->num_tokens))
  361. @@ -1994,6 +2054,7 @@
  362. /* another occurrence of an existing string */
  363. data->tokens[data->num_tokens].value.data = list->token->value.data;
  364. }
  365. + UPDATE_SKIN("%s", (char*)data->tokens[data->num_tokens].value.data);
  366. data->tokens[data->num_tokens].type = WPS_TOKEN_STRING;
  367. data->num_tokens++;
  368. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×