I'd like to convert some Tex-and-friends code to C, so that I can play with modifying it. As I understand it, the process is:
(1) The tangle utility converts foo.web to a foo.p (Pascal) file, and then
(2) I use web2c to convert foo.p to foo.c
I have managed to make step #1 work, but I'm stuck on step #2. I found the "convert" function and it's components in .../texk/web2c/web2c (in the Live Tex distribution). I was hoping that I could just switch to that directory and type "make" to compile/build the web2c utility. But this directory does not contain a typical Makefile. It has Makefile.am and Makefile.in, but these don't seem to do any compilation, as far as I can see (though I know very little about make files).
So, the questions are:
(1) Is there somewhere I can get a pre-built web2c conversion tool (for Windows), or
(2) Can someone give me good instructions for building it myself.
Edit: Even better ...
(3) Is there somewhere I can get C code for TeX and Metafont. This code is produced as part of the TeX build process, but apparently it must get thrown away after compilation, since I can't seem to find it anywhere.
Edit: Regarding approach #3, I looked at Y&Y TeX, LuaTex, and CXTeX. They have C code, but, as far as I can see, none of them include Metafont, which is the subsystem that most interests me.
Results from typing "Build":
configure: WARNING: Sorry, neither Carbon framework nor fontconfig library: disabling xetex
configure: error: terminating.
=== configuring in web2c failed
And in config.log, I found:
configure:18449: checking for installed fontconfig headers and library
configure:18482: gcc -o conftest.exe -g -O2 conftest.c -lfontconfig >&5
conftest.c:48:35: fatal error: fontconfig/fontconfig.h: No such file or directory
compilation terminated.
configure:18482: $? = 1
configure: failed program was:
| /* confdefs.h */
But, as Khaled pointed out, I could have avoided building these components, anyway, if I'd done a bit more research.
Avoiding the Above Error In case it helps any of my fellow neophytes and idiots ...
The error arises because fontconfig is missing. The "prerequisites" section of the build instructions tells you how to avoid this. You have to use
--disable-xetex
--disable-xdvipdfmx.
Build
script, the converted files should be underWork/texk/web2c/
; there you will findtex0.c
,mf0.c
etc. but I don’t think hacking the generated C files is such a good idea.README.config
for build options (e.g. passing something like--disable-all-pkgs --enable-tex --enable-mf --without-mf-x-toolkit --without-x
toconfigure
would do the trick. I put the two files heretex0.c
&mf0.c
. But if I were you, I’d learnWEB
and pascal, actually this exactly what I did to hack LuaTeX (before it was ported to C) and XeTeX.WEB
, you should start with webman (I can’t find a PDF file, but justtex
it).