Rockbox.org home
releases
current build
extras FAQ
manual
wiki
docs index mailing lists
IRC
forums bugs
patches



Search | Go
TWiki > Main > WpsTokenizer

WPS tokenizer

Introduction

WARNING This article is Work-in-progress

This page aims to explain the principles of the WPS tokenizer and give all the information needed to maintain and extend it.

Code structure explanation

The parser

The main function for WPS loading and parsing is wps_data_load(). It does the following:

  • reset the WPS data structure
  • copy the WPS source to the plugin buffer
  • parses the source
  • load the bitmaps

call_graph_parser.png

The renderer

call_graph_display.png

How to add a WPS tag

  • Add a new token to enum wps_token_type in gwps.h.
  • Add your token and the corresponding WPS tag to the all_tags array in wps_parser.c. If necessary, add a special parsing function that will be called when the tag is encountered.
  • Add a case for the new token to the switch in get_tag() in gwps-common.c.
  • Add a case for the new token to the switch in dump_wps_tokens() in wps_debug.c (this isn't vital but helpful).

r1 - 05 Apr 2007 - 21:34:26 - NicolasPennequin
Edit | View raw | Attach | Ref-By | History: r1 | More | Refresh cache

Copyright © 1999-2008 by the contributing authors.