Basic Steps

The basic steps for developing a custom reader are as follows.

To develop a custom reader

  1. Design the global context structure.
  2. Write the basic API functions:

    From within the xxxFillBuffer() function, it is necessary to call other functions that repeatedly read a chunk of a source file, parse the chunk, and generate a token stream until the entire source file is processed.

  3. Map all but the last function to the TPReaderInterface structure.
  4. Write the module definition file (*.def), exporting the reader interface and format detection functions.
  5. Modify the formats.ini file to identify the custom reader and its associated format detection function. See xxxsrAutoDet(). For example, the following lines would be added to the [Formats] section of the formats.ini file for the UTF-8 reader: