[espeak-ng:master] new issue: Redesign the phonindex binary format. #github

espeak-ng@groups.io Integration <espeak-ng@...>

[espeak-ng:master] New Issue Created by rhdunn:
#207 Redesign the phonindex binary format.

The phonindex binary file contains the compiled phoneme instructions (ipa, ChangePhoneme, etc.). These instructions are stored in a format like how the opcodes of a CPU are stored in computer programs. The phonemes in the phontab binary file have a program value that points to the offset of the start of the instructions in the phonindex file. This works like a function in a CPU -- the instructions are executed until a return instruction is executed.

This model is good, but the way it is implemented in eSpeak is clunky. Data is packed into the opcodes, with the intention of making the compiled data as compact as possible. This makes it difficult to extend to support new functionality.

This issue is about restructuring the phonindex format to make it more extensible and maintainable. The opcodes should just identify the instruction type. Additional data/control codes should go in data following the opcode. Thus, the code should be able to interpret the instructions using a top-level switch (opcode).

Program Buffer

  • [ ] Create a program buffer of a specified size; release the program buffer.
  • [ ] Write 16-bit values to the program buffer.
  • [ ] Write a pair of 8-bit values to the program buffer.
  • [ ] Write a null-terminated string to the program buffer (padded to the 16-bit boundary of the program buffer).
  • [ ] Return an error code from these APIs if the buffer is full.
  • [ ] Make compiledata.c use the new program buffer API.