# 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:

   - xxxAllocateContext()
   - xxxInitDoc()
   - xxxFillBuffer()
   - xxxFreeContext()
   - xxxCharSet()
   - xxxsrAutoDet()

   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:

       456.1.0.0=utf8
       [CustomFilters]
       1=utf8sr

© Copyright 2016-2019 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a mail client, and then send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm