Downloading tex.web.

$curl http://tug.org/texlive/devsrc/Build/source/texk/web2c/tex.web > tex.web
Producing Pascal file from tex.web.

$tangle -underline tex.web
Downloading p2c.

$curl http://schneider.ncifcrf.gov/p2c/p2c-1.21alpha2.tar.Z > p2c.tar.z
Fixing p2c compile errors.

Both ‘logf’ and ‘getline’ were colliding with standard functions.
Adding a minimal “Τεχ distribution”.
Changing the tex.pool file.

Modified the search paths for .tex and .tfm files.
Changing p2c’s produced code; functions’ forward declarations have been removed.
Placing the generated C source into a C++ class.

Some modifications to the code are made by the shell script, such as

- replacing #define constants with constexpr statics
- replacing Knuth’s ‘case: others:’ with C’s ‘default:’
Using C++ iostreams, rather than C FILE*’s.

Work arounds for a few bugs in p2c’s code generation (when StructFiles=0) were put in-place.
DVI output redirected to a std::ostream.
TeX file input may be passed in as a std::istream.
Removing pre-processor macros.

- I/O macros have been replaced with templated functions.
- A std::bitset has been substituted for the byte array + bit manipulation macros.