-
Notifications
You must be signed in to change notification settings - Fork 4
FAQ: Why C⁺⁺?
A key tenent of this port, especially early on, was to perform minimal changes to the C code produced by the p2c converter. All transformations to the code, web → pascal → C → C⁺⁺, are done in an automated and repeatable way.
So instead of modifying the TeX implementation to support, say, search paths, all of the methods that open files were made into C⁺⁺ virtual
functions. Now rather than the library dictating a policy for search paths, any base class that wishes to modify how files are found and opened may do so with a simple override
.
Similarly, because the “useful out of the box” typesetter for plainTeX, tex::plain
, is merely derived from the raw TeX engine, tex::tex
, an application can choose to use a completely different set of TeX macros.
As the library sees more use, the list of virtual
functions may grow toward a more complete Template Method Pattern of the TeX typesetting process.
At a lower level, a driving requirement to call this library “embeddable” is to get all 374 global symbols out of the global namespace and produce a thread-safe implementation. Given the sheer amount of C code produced from tex.web, folding that code into a single C⁺⁺ base-class was far more achievable than most alternatives. Especially given the requirement to keep the process automated.