OSDN Git Service

updated all sources.
authormaqiyuan <maqiyuan@users.sourceforge.jp>
Sun, 20 Jul 2014 05:42:18 +0000 (13:42 +0800)
committermaqiyuan <maqiyuan@users.sourceforge.jp>
Sun, 20 Jul 2014 05:42:18 +0000 (13:42 +0800)
32 files changed:
src/texsourc/Makefile.linux.clang
src/texsourc/Makefile.linux.gcc
src/texsourc/Makefile.linux.gcc.static [new file with mode: 0644]
src/texsourc/Makefile.win.clang
src/texsourc/Makefile.win.msvc
src/texsourc/coerce.h
src/texsourc/dpx.c [new file with mode: 0644]
src/texsourc/itex.c
src/texsourc/local.c
src/texsourc/macros.h [moved from src/texsourc/yandy_macros.h with 93% similarity]
src/texsourc/memory.h [moved from src/texsourc/texmfmem.h with 94% similarity]
src/texsourc/openinou.c
src/texsourc/pool.c [moved from src/texsourc/yandy_pool.c with 99% similarity]
src/texsourc/subroute.c
src/texsourc/tex-extend.pool [deleted file]
src/texsourc/tex0.c
src/texsourc/tex1.c
src/texsourc/tex2.c
src/texsourc/tex3.c
src/texsourc/tex4.c
src/texsourc/tex5.c
src/texsourc/tex6.c
src/texsourc/tex7.c
src/texsourc/tex8.c
src/texsourc/tex9.c
src/texsourc/texd.h
src/texsourc/texmf.h [deleted file]
src/texsourc/utils.c [moved from src/texsourc/yandy_inlines.c with 90% similarity]
src/texsourc/yandy_backend_dpx.c [deleted file]
src/texsourc/yandytex.c
src/texsourc/yandytex.h
src/texsourc/yandytex.rc

index 810a726..6824f93 100644 (file)
 #
 
 CC = clang
-CFLAGS = -O2 -DMSDOS -DTeX -DINITEX -DINI -Ilibmd5
+CFLAGS = -c -O2 -Ilibmd5
 LDFLAGS = -lkpathsea -lz
 
 objects = yandytex.o itex.o openinou.o subroute.o local.o \
        tex0.o tex1.o tex2.o tex3.o tex4.o \
        tex5.o tex6.o tex7.o tex8.o tex9.o \
-       yandy_pool.o md5.o yandy_inlines.o
+       pool.o md5.o utils.o
 
-headers = yandytex.h texd.h coerce.h texmf.h texmfmem.h
+headers = yandytex.h texd.h coerce.h macros.h memory.h
 
 yandytex: $(objects)
-       $(CC) -o yandytex $(objects) $(LDFLAGS)
+       $(CC) -s -o yandytex $(objects) $(LDFLAGS)
 
 yandytex.o: yandytex.c $(headers)
-       $(CC) -c $(CFLAGS) yandytex.c
+       $(CC) $(CFLAGS) yandytex.c
  
 itex.o: itex.c $(headers)
-       $(CC) -c $(CFLAGS) itex.c
+       $(CC) $(CFLAGS) itex.c
 
 openinou.o: openinou.c $(headers)
-       $(CC) -c $(CFLAGS) openinou.c
+       $(CC) $(CFLAGS) openinou.c
 
 subroute.o: subroute.c $(headers)
-       $(CC) -c $(CFLAGS) subroute.c
+       $(CC) $(CFLAGS) subroute.c
 
 local.o: local.c $(headers)
-       $(CC) -c $(CFLAGS) local.c
+       $(CC) $(CFLAGS) local.c
 
 tex0.o: tex0.c $(headers)
-       $(CC) -c $(CFLAGS) tex0.c
+       $(CC) $(CFLAGS) tex0.c
 
 tex1.o: tex1.c $(headers)
-       $(CC) -c $(CFLAGS) tex1.c
+       $(CC) $(CFLAGS) tex1.c
 
 tex2.o: tex2.c $(headers)
-       $(CC) -c $(CFLAGS) tex2.c
+       $(CC) $(CFLAGS) tex2.c
 
 tex3.o: tex3.c $(headers)
-       $(CC) -c $(CFLAGS) tex3.c
+       $(CC) $(CFLAGS) tex3.c
 
 tex4.o: tex4.c $(headers)
-       $(CC) -c $(CFLAGS) tex4.c
+       $(CC) $(CFLAGS) tex4.c
 
 tex5.o: tex5.c $(headers)
-       $(CC) -c $(CFLAGS) tex5.c
+       $(CC) $(CFLAGS) tex5.c
 
 tex6.o: tex6.c $(headers)
-       $(CC) -c $(CFLAGS) tex6.c
+       $(CC) $(CFLAGS) tex6.c
 
 tex7.o: tex7.c $(headers)
-       $(CC) -c $(CFLAGS) tex7.c
+       $(CC) $(CFLAGS) tex7.c
 
 tex8.o: tex8.c $(headers)
-       $(CC) -c $(CFLAGS) tex8.c
+       $(CC) $(CFLAGS) tex8.c
 
 tex9.o: tex9.c $(headers)
-       $(CC) -c $(CFLAGS) tex9.c
+       $(CC) $(CFLAGS) tex9.c
 
-yandy_pool.o: yandy_pool.c $(headers)
-       $(CC) -c $(CFLAGS) yandy_pool.c
+pool.o: pool.c $(headers)
+       $(CC) $(CFLAGS) pool.c
 
 md5.o: libmd5/md5.c $(headers)
-       $(CC) -c $(CFLAGS) libmd5/md5.c
+       $(CC) $(CFLAGS) libmd5/md5.c
 
-yandy_inlines.o: yandy_inlines.c $(headers)
-       $(CC) -c $(CFLAGS) yandy_inlines.c
+utils.o: utils.c $(headers)
+       $(CC) $(CFLAGS) utils.c
 
 .PHONY: clean
 
 clean:
-       rm *.o
+       rm yandytex *.o
index 62ec621..b2968ba 100644 (file)
 #
 
 CC = gcc
-CFLAGS = -O2 -DMSDOS -DTeX -DINITEX -DINI -Ilibmd5
+CFLAGS = -c -O2 -Wno-unused-result -Ilibmd5
 LDFLAGS = -lkpathsea -lz
 
 objects = yandytex.o itex.o openinou.o subroute.o local.o \
        tex0.o tex1.o tex2.o tex3.o tex4.o \
        tex5.o tex6.o tex7.o tex8.o tex9.o \
-       yandy_pool.o md5.o yandy_inlines.o
+       pool.o md5.o utils.o
 
-headers = yandytex.h texd.h coerce.h texmf.h texmfmem.h
+headers = yandytex.h texd.h coerce.h macros.h memory.h
 
 yandytex: $(objects)
-       $(CC) -o yandytex $(objects) $(LDFLAGS)
+       $(CC) -s -o yandytex $(objects) $(LDFLAGS)
 
 yandytex.o: yandytex.c $(headers)
-       $(CC) -c $(CFLAGS) yandytex.c
+       $(CC) $(CFLAGS) yandytex.c
  
 itex.o: itex.c $(headers)
-       $(CC) -c $(CFLAGS) itex.c
+       $(CC) $(CFLAGS) itex.c
 
 openinou.o: openinou.c $(headers)
-       $(CC) -c $(CFLAGS) openinou.c
+       $(CC) $(CFLAGS) openinou.c
 
 subroute.o: subroute.c $(headers)
-       $(CC) -c $(CFLAGS) subroute.c
+       $(CC) $(CFLAGS) subroute.c
 
 local.o: local.c $(headers)
-       $(CC) -c $(CFLAGS) local.c
+       $(CC) $(CFLAGS) local.c
 
 tex0.o: tex0.c $(headers)
-       $(CC) -c $(CFLAGS) tex0.c
+       $(CC) $(CFLAGS) tex0.c
 
 tex1.o: tex1.c $(headers)
-       $(CC) -c $(CFLAGS) tex1.c
+       $(CC) $(CFLAGS) tex1.c
 
 tex2.o: tex2.c $(headers)
-       $(CC) -c $(CFLAGS) tex2.c
+       $(CC) $(CFLAGS) tex2.c
 
 tex3.o: tex3.c $(headers)
-       $(CC) -c $(CFLAGS) tex3.c
+       $(CC) $(CFLAGS) tex3.c
 
 tex4.o: tex4.c $(headers)
-       $(CC) -c $(CFLAGS) tex4.c
+       $(CC) $(CFLAGS) tex4.c
 
 tex5.o: tex5.c $(headers)
-       $(CC) -c $(CFLAGS) tex5.c
+       $(CC) $(CFLAGS) tex5.c
 
 tex6.o: tex6.c $(headers)
-       $(CC) -c $(CFLAGS) tex6.c
+       $(CC) $(CFLAGS) tex6.c
 
 tex7.o: tex7.c $(headers)
-       $(CC) -c $(CFLAGS) tex7.c
+       $(CC) $(CFLAGS) tex7.c
 
 tex8.o: tex8.c $(headers)
-       $(CC) -c $(CFLAGS) tex8.c
+       $(CC) $(CFLAGS) tex8.c
 
 tex9.o: tex9.c $(headers)
-       $(CC) -c $(CFLAGS) tex9.c
+       $(CC) $(CFLAGS) tex9.c
 
-yandy_pool.o: yandy_pool.c $(headers)
-       $(CC) -c $(CFLAGS) yandy_pool.c
+pool.o: pool.c $(headers)
+       $(CC) $(CFLAGS) pool.c
 
 md5.o: libmd5/md5.c $(headers)
-       $(CC) -c $(CFLAGS) libmd5/md5.c
+       $(CC) $(CFLAGS) libmd5/md5.c
 
-yandy_inlines.o: yandy_inlines.c $(headers)
-       $(CC) -c $(CFLAGS) yandy_inlines.c
+utils.o: utils.c $(headers)
+       $(CC) $(CFLAGS) utils.c
 
 .PHONY: clean
 
diff --git a/src/texsourc/Makefile.linux.gcc.static b/src/texsourc/Makefile.linux.gcc.static
new file mode 100644 (file)
index 0000000..119095a
--- /dev/null
@@ -0,0 +1,81 @@
+#
+# Copyright (c) 2014 Clerk Ma
+#
+# You may freely use, modify and/or distribute this file.
+#
+# makefle for linux (tested in ubuntu 14.04: gcc 4.8).
+# linked libkpathsea.a and libz.a
+#
+
+CC = gcc
+CFLAGS = -c -O2 -Wno-unused-result -Ilibmd5
+LDFLAGS = /home/clerk/dev/android/lib/libkpathsea.a /home/clerk/dev/android/lib/libz.a
+
+objects = yandytex.o itex.o openinou.o subroute.o local.o \
+       tex0.o tex1.o tex2.o tex3.o tex4.o \
+       tex5.o tex6.o tex7.o tex8.o tex9.o \
+       pool.o md5.o utils.o
+
+headers = yandytex.h texd.h coerce.h macros.h memory.h
+
+yandytex: $(objects)
+       $(CC) -s -o yandytex $(objects) $(LDFLAGS)
+
+yandytex.o: yandytex.c $(headers)
+       $(CC) $(CFLAGS) yandytex.c
+itex.o: itex.c $(headers)
+       $(CC) $(CFLAGS) itex.c
+
+openinou.o: openinou.c $(headers)
+       $(CC) $(CFLAGS) openinou.c
+
+subroute.o: subroute.c $(headers)
+       $(CC) $(CFLAGS) subroute.c
+
+local.o: local.c $(headers)
+       $(CC) $(CFLAGS) local.c
+
+tex0.o: tex0.c $(headers)
+       $(CC) $(CFLAGS) tex0.c
+
+tex1.o: tex1.c $(headers)
+       $(CC) $(CFLAGS) tex1.c
+
+tex2.o: tex2.c $(headers)
+       $(CC) $(CFLAGS) tex2.c
+
+tex3.o: tex3.c $(headers)
+       $(CC) $(CFLAGS) tex3.c
+
+tex4.o: tex4.c $(headers)
+       $(CC) $(CFLAGS) tex4.c
+
+tex5.o: tex5.c $(headers)
+       $(CC) $(CFLAGS) tex5.c
+
+tex6.o: tex6.c $(headers)
+       $(CC) $(CFLAGS) tex6.c
+
+tex7.o: tex7.c $(headers)
+       $(CC) $(CFLAGS) tex7.c
+
+tex8.o: tex8.c $(headers)
+       $(CC) $(CFLAGS) tex8.c
+
+tex9.o: tex9.c $(headers)
+       $(CC) $(CFLAGS) tex9.c
+
+pool.o: pool.c $(headers)
+       $(CC) $(CFLAGS) pool.c
+
+md5.o: libmd5/md5.c $(headers)
+       $(CC) $(CFLAGS) libmd5/md5.c
+
+utils.o: utils.c $(headers)
+       $(CC) $(CFLAGS) utils.c
+
+.PHONY: clean
+
+clean:
+       rm yandytex *.o
index 9e97df4..7f5915f 100644 (file)
@@ -2,14 +2,14 @@
 # Copyright 2014 Clerk Ma.
 #
 # You may freely use, modify and/or distribute this file.
-
-# Makefile for Y&YTeX
+#
+# Makefile for Y&YTeX (tested on Clang/LLVM 3.4)
 
 CC = clang-cl
 LINK = link
 RC = rc
 
-CFLAGS=/nologo /c /MT /GF /Ox /W4 /DMSDOS /DTeX \
+CFLAGS=/nologo /c /MT /GF /Ox /W4 \
        /I"kpathsea" /I"zlib" /I"libmd5" /D_CRT_SECURE_NO_WARNINGS \
        -Wno-char-subscripts -Wno-dangling-else \
        -Wno-deprecated-declarations
@@ -19,12 +19,12 @@ LFLAGS=/NOLOGO /MAP
 objs = yandytex.obj itex.obj openinou.obj subroute.obj local.obj \
        tex0.obj tex1.obj tex2.obj tex3.obj tex4.obj \
        tex5.obj tex6.obj tex7.obj tex8.obj tex9.obj \
-       yandy_pool.obj yandytex.res md5.obj yandy_inlines.obj
+       pool.obj yandytex.res md5.obj utils.obj
 
 yandytex.exe: $(objs)
        $(LINK) $(LFLAGS) yandytex itex openinou subroute local \
        tex0 tex1 tex2 tex3 tex4 tex5 tex6 tex7 tex8 tex9 \
-       yandy_pool yandytex.res md5 yandy_inlines \
+       pool yandytex.res md5 utils \
        kpathsea\kpathsea.lib zlib\zlib.lib
        del ..\yandy\bin\yandytex.exe
        copy yandytex.exe ..\yandy\bin\yandytex.exe
@@ -33,63 +33,63 @@ md5.obj: libmd5\md5.c
        $(CC) -Ilibmd5 $(CFLAGS) libmd5\md5.c
 
 yandytex.res: yandytex.rc
-       rc /nologo yandytex.rc
+       $(RC) /nologo yandytex.rc
 
 yandytex.obj: yandytex.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
-       $(CC) /DINITEX $(CFLAGS) yandytex.c
+       texd.h yandytex.h memory.h coerce.h macros.h
+       $(CC) $(CFLAGS) yandytex.c
 
 itex.obj: itex.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
-       $(CC) /DINITEX $(CFLAGS) itex.c
+       texd.h yandytex.h memory.h coerce.h macros.h
+       $(CC) $(CFLAGS) itex.c
 
 openinou.obj: openinou.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
        $(CC) $(CFLAGS) openinou.c
 
 subroute.obj: subroute.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
        $(CC) $(CFLAGS) subroute.c
 
 local.obj: local.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
-       $(CC) /DINITEX $(CFLAGS) local.c
+       texd.h yandytex.h memory.h coerce.h macros.h
+       $(CC) $(CFLAGS) local.c
 
 tex0.obj: tex0.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
 
 tex1.obj: tex1.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
 
 tex2.obj: tex2.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
 
 tex3.obj: tex3.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
 
 tex4.obj: tex4.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
 
 tex5.obj: tex5.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
 
 tex6.obj: tex6.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
 
 tex7.obj: tex7.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
 
 tex8.obj: tex8.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
 
 tex9.obj: tex9.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
 
-yandy_pool.obj: yandy_pool.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+pool.obj: pool.c \
+       texd.h yandytex.h memory.h coerce.h macros.h
 
-yandy_inlines.obj: yandy_inlines.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+utils.obj: utils.c \
+       texd.h yandytex.h memory.h coerce.h macros.h
 
 .SUFFIXES:
 .SUFFIXES: .obj .c
index 3c7d2bf..bbd8a1c 100644 (file)
@@ -2,14 +2,14 @@
 # Copyright 2014 Clerk Ma.
 #
 # You may freely use, modify and/or distribute this file.
-
-# Makefile for Y&YTeX
+#
+# Makefile for Y&YTeX (MSVC, tested on VS 2012 and VS 2013)
 
 CC = cl
 LINK = link
 RC = rc
 
-CFLAGS=/nologo /c /MT /GF /Gy /Ox /W4 /DMSDOS /DTeX \
+CFLAGS=/nologo /c /MT /GF /Gy /W4 \
        /I"kpathsea" /I"zlib" /I"libmd5"
 
 LFLAGS=/NOLOGO /MAP
@@ -17,14 +17,13 @@ LFLAGS=/NOLOGO /MAP
 objs = yandytex.obj itex.obj openinou.obj subroute.obj local.obj \
        tex0.obj tex1.obj tex2.obj tex3.obj tex4.obj \
        tex5.obj tex6.obj tex7.obj tex8.obj tex9.obj \
-       yandy_pool.obj yandytex.res md5.obj yandy_inlines.obj
+       pool.obj yandytex.res md5.obj utils.obj
 
 yandytex.exe: $(objs)
        $(LINK) $(LFLAGS) yandytex itex openinou subroute local \
        tex0 tex1 tex2 tex3 tex4 tex5 tex6 tex7 tex8 tex9 \
-       yandy_pool yandytex.res md5 yandy_inlines \
-       kpathsea\kpathsea.lib zlib\zlib.lib \
-       dvipdfmx\libdvipdfmx.lib
+       pool yandytex.res md5 utils \
+       kpathsea\kpathsea.lib zlib\zlib.lib
        del ..\yandy\bin\yandytex.exe
        copy yandytex.exe ..\yandy\bin\yandytex.exe
 
@@ -32,63 +31,63 @@ md5.obj: libmd5\md5.c
        $(CC) -Ilibmd5 $(CFLAGS) libmd5\md5.c
 
 yandytex.res: yandytex.rc
-       rc /nologo yandytex.rc
+       $(RC) /nologo yandytex.rc
 
 yandytex.obj: yandytex.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
-       $(CC) /DINITEX $(CFLAGS) yandytex.c
+       texd.h yandytex.h memory.h coerce.h macros.h
+       $(CC) $(CFLAGS) yandytex.c
 
 itex.obj: itex.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
-       $(CC) /DINITEX $(CFLAGS) itex.c
+       texd.h yandytex.h memory.h coerce.h macros.h
+       $(CC) $(CFLAGS) itex.c
 
 openinou.obj: openinou.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
        $(CC) $(CFLAGS) openinou.c
 
 subroute.obj: subroute.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
        $(CC) $(CFLAGS) subroute.c
 
 local.obj: local.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
-       $(CC) /DINITEX $(CFLAGS) local.c
+       texd.h yandytex.h memory.h coerce.h macros.h
+       $(CC) $(CFLAGS) local.c
 
 tex0.obj: tex0.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
 
 tex1.obj: tex1.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
 
 tex2.obj: tex2.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
 
 tex3.obj: tex3.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
 
 tex4.obj: tex4.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
 
 tex5.obj: tex5.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
 
 tex6.obj: tex6.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
 
 tex7.obj: tex7.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
 
 tex8.obj: tex8.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
 
 tex9.obj: tex9.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h yandytex.h memory.h coerce.h macros.h
 
-yandy_pool.obj: yandy_pool.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+pool.obj: pool.c \
+       texd.h yandytex.h memory.h coerce.h macros.h
 
-yandy_inlines.obj: yandy_inlines.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+utils.obj: utils.c \
+       texd.h yandytex.h memory.h coerce.h macros.h
 
 .SUFFIXES:
 .SUFFIXES: .obj .c
index 9c01ef9..c0ad215 100644 (file)
@@ -28,16 +28,13 @@ void slow_print_(integer s);
 #define slow_print(s) slow_print_((integer) (s))
 void print_nl (const char * s);
 void print_esc (const char * s);
-void print_the_digs_(eight_bits k);
-#define print_the_digs(k) print_the_digs_((eight_bits) (k))
+void print_the_digs (eight_bits k);
 void print_int_(integer n);
 #define print_int(n) print_int_((integer) (n))
 void print_cs_(integer p);
 #define print_cs(p) print_cs_((integer) (p))
-void sprint_cs_(pointer p);
-#define sprint_cs(p) sprint_cs_((pointer) (p))
-void print_file_name_(integer n, integer a, integer e);
-#define print_file_name(n, a, e) print_file_name_((integer) (n), (integer) (a), (integer) (e))
+void sprint_cs (pointer p);
+void print_file_name (integer n, integer a, integer e);
 void print_size_(integer s);
 #define print_size(s) print_size_((integer) (s))
 void print_write_whatsit_(const char * s, pointer p);
@@ -54,7 +51,7 @@ boolean str_eq_buf_(str_number s, integer k);
 #define str_eq_buf(s, k) str_eq_buf_((str_number) (s), (integer) (k))
 boolean str_eq_str_(str_number s, str_number t);
 #define str_eq_str(s, t) str_eq_str_((str_number) (s), (str_number) (t))
-boolean get_strings_started(void);
+boolean get_strings_started (void);
 void print_two_(integer n);
 #define print_two(n) print_two_((integer) (n))
 void print_hex_(integer n);
@@ -81,8 +78,7 @@ scaled xn_over_d_(scaled x, integer n, integer d);
 #define xn_over_d(x, n, d) xn_over_d_((scaled) (x), (integer) (n), (integer) (d))
 halfword badness_(scaled t, scaled s);
 #define badness(t, s) badness_((scaled) (t), (scaled) (s))
-void print_word_(memory_word w);
-#define print_word(w) print_word_((w))
+void print_word (memory_word w);
 void show_token_list_(integer p, integer q, integer l);
 #define show_token_list(p, q, l) show_token_list_((integer) (p), (integer) (q), (integer) (l))
 void runaway (void);
@@ -127,7 +123,7 @@ void print_fam_and_char_(pointer p);
 void print_delimiter_(pointer p);
 #define print_delimiter(p) print_delimiter_((pointer) (p))
 void print_subsidiary_data_(pointer p, ASCII_code c);
-#define print_subsidiary_data(p, c) print_subsidiary_data_((halfword) (p), (ASCII_code) (c))
+#define print_subsidiary_data(p, c) print_subsidiary_data_((pointer) (p), (ASCII_code) (c))
 void print_style_(integer c);
 #define print_style(c) print_style_((integer) (c))
 void print_skip_param_(integer n);
@@ -222,15 +218,12 @@ void conv_toks (void);
 pointer scan_toks (boolean macro_def, boolean xpand);
 void read_toks (integer n, pointer r);
 void pass_text (void);
-void change_if_limit_(small_number l, pointer p);
-#define change_if_limit(l, p) change_if_limit_((small_number) (l), (pointer) (p))
+void change_if_limit (small_number l, pointer p);
 void conditional (void);
 void begin_name (void);
-boolean more_name_(ASCII_code c);
-#define more_name(c) more_name_((ASCII_code) (c))
+boolean more_name (ASCII_code c);
 void end_name (void);
-void pack_file_name_(str_number n, str_number a, str_number e);
-#define pack_file_name(n, a, e) pack_file_name_((str_number) (n), (str_number) (a), (str_number) (e))
+void pack_file_name (str_number n, str_number a, str_number e);
 void pack_buffered_name_(small_number n, integer a, integer b);
 #define pack_buffered_name(n, a, b) pack_buffered_name_((small_number) (n), (integer) (a), (integer) (b))
 str_number make_name_string (void);
@@ -250,7 +243,7 @@ void start_input (void);
 internal_font_number read_font_info (pointer u, str_number nom, str_number arie, scaled s);
 void char_warning_(internal_font_number f, eight_bits c);
 #define char_warning(f, c) char_warning_((internal_font_number) (f), (eight_bits) (c))
-halfword new_character_(internal_font_number f, eight_bits c);
+pointer new_character_(internal_font_number f, eight_bits c);
 #define new_character(f, c) new_character_((internal_font_number) (f), (eight_bits) (c))
 void dvi_swap (void);
 void dvi_four_(integer x);
@@ -259,49 +252,35 @@ void dvi_pop_(integer l);
 #define dvi_pop(l) dvi_pop_((integer) (l))
 void dvi_font_def_(internal_font_number f);
 #define dvi_font_def(f) dvi_font_def_((internal_font_number) (f))
-void zmovement(scaled w, eight_bits o);
-#define movement(w, o) zmovement((scaled) (w), (eight_bits) (o))
+void movement (scaled w, eight_bits o);
 void special_out (pointer p);
 void hlist_out (void);
 void vlist_out (void);
-void ship_out_(pointer p);
-#define ship_out(p) ship_out_((pointer) (p))
+void ship_out (pointer p);
 void prune_movements (integer l);
 void write_out (pointer p);
 void out_what (pointer p);
-void scan_spec_(group_code c, boolean three_codes);
-#define scan_spec(c, three_codes) scan_spec_((group_code) (c), (boolean) (three_codes))
+void scan_spec (group_code c, boolean three_codes);
 pointer hpack_(pointer p, scaled w, small_number m);
 #define hpack(p, w, m) hpack_((pointer) (p), (scaled) (w), (small_number) (m))
 pointer vpackage_(pointer p, scaled h, small_number m, scaled l);
 #define vpackage(p, h, m, l) vpackage_((pointer) (p), (scaled) (h), (small_number) (m), (scaled) (l))
 void append_to_vlist (pointer b);
 pointer new_noad (void);
-pointer new_style_(small_number s);
-#define new_style(s) new_style_((small_number) (s))
+pointer new_style (small_number s);
 pointer new_choice (void);
 void show_info (void);
-pointer fraction_rule_(scaled t);
-#define fraction_rule(t) fraction_rule_((scaled) (t))
-pointer overbar_(pointer b, scaled k, scaled t);
-#define overbar(b, k, t) overbar_((pointer) (b), (scaled) (k), (scaled) (t))
-pointer char_box_(internal_font_number f, quarterword c);
-#define char_box(f, c) char_box_((internal_font_number) (f), (quarterword) (c))
-void stack_into_box_(pointer b, internal_font_number f, quarterword c);
-#define stack_into_box(b, f, c) stack_into_box_((pointer) (b), (internal_font_number) (f), (quarterword) (c))
-scaled height_plus_depth_(internal_font_number f, quarterword c);
-#define height_plus_depth(f, c) height_plus_depth_((internal_font_number) (f), (quarterword) (c))
-pointer var_delimiter_(pointer d, small_number s, scaled v);
-#define var_delimiter(d, s, v) var_delimiter_((pointer) (d), (small_number) (s), (scaled) (v))
-pointer rebox_(pointer b, scaled w);
-#define rebox(b, w) rebox_((pointer) (b), (scaled) (w))
-pointer math_glue_(pointer g, scaled m);
-#define math_glue(g, m) math_glue_((pointer) (g), (scaled) (m))
-void math_kern_(pointer p, scaled m);
-#define math_kern(p, m) math_kern_((pointer) (p), (scaled) (m))
+pointer fraction_rule (scaled t);
+pointer overbar (pointer b, scaled k, scaled t);
+pointer char_box (internal_font_number f, quarterword c);
+void stack_into_box (pointer b, internal_font_number f, quarterword c);
+scaled height_plus_depth (internal_font_number f, quarterword c);
+pointer var_delimiter (pointer d, small_number s, scaled v);
+pointer rebox (pointer b, scaled w);
+pointer math_glue (pointer g, scaled m);
+void math_kern (pointer p, scaled m);
 void flush_math (void);
-pointer clean_box_(pointer p, small_number s);
-#define clean_box(p, s) clean_box_((pointer) (p), (small_number) (s))
+pointer clean_box (pointer p, small_number s);
 void fetch_(pointer a);
 #define fetch(a) fetch_((pointer) (a))
 void make_over (pointer q);
@@ -327,15 +306,12 @@ void fin_row (void);
 void fin_align (void);
 void align_peek (void);
 pointer finite_shrink (pointer p);
-void try_break_(integer pi, small_number breaktype);
-#define try_break(pi, breaktype) try_break_((integer) (pi), (small_number) (breaktype))
+void try_break (integer pi, small_number breaktype);
 void post_line_break (integer final_widow_penalty);
-small_number reconstitute_(small_number j, small_number n, halfword bchar, halfword hchar);
-#define reconstitute(j, n, bchar, hchar) reconstitute_((small_number) (j), (small_number) (n), (halfword) (bchar), (halfword) (hchar))
+small_number reconstitute (small_number j, small_number n, halfword bchar, halfword hchar);
 void hyphenate (void);
-trie_op_code new_trie_op_(small_number d, small_number n, trie_op_code v);
-#define new_trie_op(d, n, v) new_trie_op_((small_number) (d), (small_number) (n), (trie_op_code) (v))
-trie_pointer trie_node_(trie_pointer p);
+trie_op_code new_trie_op (small_number d, small_number n, trie_op_code v);
+trie_pointer trie_node (trie_pointer p);
 trie_pointer compress_trie (trie_pointer p);
 void first_fit (trie_pointer p);
 void trie_pack (trie_pointer p);
@@ -348,8 +324,7 @@ pointer prune_page_top (pointer p);
 pointer vert_break (pointer p, scaled h, scaled d);
 pointer vsplit (eight_bits n, scaled h);
 void print_totals (void);
-void freeze_page_specs_(small_number s);
-#define freeze_page_specs(s) freeze_page_specs_((small_number) (s))
+void freeze_page_specs (small_number s);
 void box_error (eight_bits n);
 void ensure_vbox_(eight_bits n);
 #define ensure_vbox(n) ensure_vbox_((eight_bits) (n))
@@ -391,12 +366,10 @@ void noalign_error (void);
 void omit_error (void);
 void do_endv (void);
 void cs_error (void);
-void push_math_(group_code c);
-#define push_math(c) push_math_((group_code) (c))
+void push_math (group_code c);
 void init_math (void);
 void start_eq_no (void);
-void scan_math_(pointer p);
-#define scan_math(p) scan_math_((pointer) (p))
+void scan_math (pointer p);
 void set_math_char_(integer c);
 #define set_math_char(c) set_math_char_((integer) (c))
 void math_limit_switch(void);
@@ -405,8 +378,7 @@ void scan_delimiter_(pointer p, boolean r);
 void math_radical (void);
 void math_ac (void);
 void append_choices (void);
-pointer fin_mlist_(pointer p);
-#define fin_mlist(p) fin_mlist_((pointer) (p))
+pointer fin_mlist (pointer p);
 void build_choices (void);
 void sub_sup (void);
 void math_fraction (void);
@@ -432,8 +404,7 @@ void show_whatever (void);
 void store_fmt_file (void);
 void new_whatsit_(small_number s, small_number w);
 #define new_whatsit(s, w) new_whatsit_((small_number) (s), (small_number) (w))
-void new_write_whatsit_(small_number w);
-#define new_write_whatsit(w) new_write_whatsit_((small_number) (w))
+void new_write_whatsit (small_number w);
 void do_extension (void);
 void fix_language (void);
 void handle_right_brace (void);
@@ -446,6 +417,7 @@ void final_cleanup (void);
 void init_prim (void);
 void debug_help (void);
 void fix_date_and_time (void);
+void print_banner (void);
 
 int main_program (void);
 int main_init (int ac, char ** av);
\ No newline at end of file
diff --git a/src/texsourc/dpx.c b/src/texsourc/dpx.c
new file mode 100644 (file)
index 0000000..8cc83fe
--- /dev/null
@@ -0,0 +1,153 @@
+/* Copyright 2014 Clerk Ma
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301 USA.  */
+
+/* Y&Y TeX's DVIPDFMX backend. */
+
+#define EXTERN extern
+
+#include "yandytex.h"
+
+void dpx_ship_out_(pointer p)
+{
+  integer page_loc;
+  char j, k;
+  pool_pointer s;
+  char old_setting;
+
+  if (tracing_output > 0)
+  {
+    print_nl("");
+    print_ln();
+    prints("Completed box being shipped out");
+  }
+
+  if (term_offset > max_print_line - 9)
+    print_ln();
+  else if ((term_offset > 0) || (file_offset > 0))
+    print_char(' ');
+
+  print_char('[');
+  j = 9;
+
+  while ((count(j) == 0) && (j > 0))
+    decr(j);
+
+  for (k = 0; k <= j; k++)
+  {
+    print_int(count(k));
+
+    if (k < j)
+      print_char('.');
+  }
+  
+  update_terminal();
+
+  if (tracing_output > 0)
+  {
+    print_char(']');
+    begin_diagnostic();
+    show_box(p);
+    end_diagnostic(true);
+  }
+
+  if ((height(p) > max_dimen) || (depth(p) > max_dimen) ||
+      (height(p) + depth(p) + v_offset > max_dimen) ||
+      (width(p) + h_offset > max_dimen))
+  {
+    print_err("Huge page cannot be shipped out");
+    help2("The page just created is more than 18 feet tall or",
+        "more than 18 feet wide, so I suspect something went wrong.");
+    error();
+
+    if (tracing_output <= 0)
+    {
+      begin_diagnostic();
+      print_nl("The following box has been deleted:");
+      show_box(p);
+      end_diagnostic(true);
+    }
+
+    goto done;
+  }
+
+  if (height(p) + depth(p) + v_offset > max_v)
+    max_v = height(p) + depth(p) + v_offset;
+
+  if (width(p) + h_offset > max_h)
+    max_h = width(p) + h_offset;
+
+  dvi_h = 0;
+  dvi_v = 0;
+  cur_h = h_offset;
+  dvi_f = null_font;
+  ensure_dvi_open();
+
+  if (total_pages == 0)
+  {
+    pdf_set_version(5);
+    pdf_doc_set_creator("Y&Y TeX 2.3.0");
+  }
+
+  page_loc = dvi_offset + dvi_ptr;
+  pdf_doc_begin_page(1000, 0, 0); // bop
+  cur_v = height(p) + v_offset;
+  pdf_doc_end_page(); // eop
+  incr(total_pages);
+  cur_s = -1;
+
+done:
+  if (tracing_output <= 0)
+    print_char(']');
+
+  dead_cycles = 0;
+  update_terminal();
+
+#ifdef STAT
+  if (tracing_stats > 1)
+  {
+    print_nl("Memory usage before: ");
+    print_int(var_used);
+    print_char('&');
+    print_int(dyn_used);
+    print_char(';');
+  }
+#endif
+
+  flush_node_list(p);
+
+#ifdef STAT
+  if (tracing_stats > 1)
+  {
+    prints(" after: ");
+    print_int(var_used);
+    print_char('&');
+    print_int(dyn_used);
+    prints("; still utouched: ");
+    print_int(hi_mem_min - lo_mem_max - 1);
+    print_ln();
+  }
+#endif
+}
+
+
+void dpx_hlist_out (void)
+{
+}
+
+void dpx_vlist_out (void)
+{
+}
index 5e863d8..843df60 100644 (file)
 
 #define EXTERN extern
 
-#include "texd.h"
+#include "yandytex.h"
 
 #define BEGINFMTCHECKSUM 367403084L
 #define ENDFMTCHECKSUM   69069L
 
-extern clock_t start_time, main_time, finish_time;
-
 #ifdef INITEX
   void do_initex (void);
 #endif
@@ -33,7 +31,7 @@ extern clock_t start_time, main_time, finish_time;
 /* sec 0004 */
 void initialize (void)
 {
-  integer i; 
+  integer i;
   integer k;
   integer flag;
 
@@ -187,7 +185,7 @@ void initialize (void)
   cur_order = normal;
 
   for (k = 0; k <= 16; k++)
-    read_open[k] = 2;
+    read_open[k] = closed;
 
   cond_ptr = 0;
   if_limit = normal;
@@ -197,10 +195,10 @@ void initialize (void)
   for (k = 0; k <= font_max; k++)
     font_used[k] = false;
 
-  null_character.b0 = 0;
-  null_character.b1 = 0;
-  null_character.b2 = 0;
-  null_character.b3 = 0;
+  null_character.b0 = min_quarterword;
+  null_character.b1 = min_quarterword;
+  null_character.b2 = min_quarterword;
+  null_character.b3 = min_quarterword;
   total_pages = 0;
   max_v = 0;
   max_h = 0;
@@ -260,9 +258,7 @@ void initialize (void)
 
 #ifdef INITEX
   if (is_initex)
-  {
     do_initex();
-  }
 #endif
 }
 
@@ -281,7 +277,7 @@ void initialize_aux (void)
 
 /*  nest_ptr = 0; */
 /*  max_nest_stack = 0; */
-  mode = 1;
+  mode = vmode;
   head = contrib_head;
   tail = contrib_head;
   prev_depth = ignore_depth;
@@ -292,7 +288,7 @@ void initialize_aux (void)
   page_tail = page_head;
   link(page_head) = 0;
 }
-#endif  // end of ifdef ALLOCATEMAIN
+#endif
 /* sec 0815 */
 void line_break (integer final_widow_penalty)
 {
@@ -405,7 +401,7 @@ void line_break (integer final_widow_penalty)
 
     second_pass = false;
     final_pass = false;
-    first_pass_count++; /* 96 Feb 9 */
+    first_pass_count++;
   }
   else
   {
@@ -561,7 +557,7 @@ done2:
                   goto done1; 
 
                 if (hyf_char > 255)
-                  goto done1; /* ? */
+                  goto done1;
 
                 ha = prev_s;
 
@@ -601,10 +597,10 @@ done2:
                     j = hn;
                     q = lig_ptr(s);
 
-                    if (q != 0) /* 94/Mar/23 BUG FIX */
+                    if (q != 0)
                       hyf_bchar = character(q);
 
-                    while (q != 0) /* 94/Mar/23 BUG FIX */
+                    while (q != 0)
                     {
                       c = character(q);
 
@@ -702,37 +698,38 @@ done1:;
             else
             {
               do
-              {
-                if (is_char_node(s))
-                {
-                  f = font(s);
-                  disc_width = disc_width + char_width(f, char_info(f, character(s)));
-                }
-                else switch (type(s))
                 {
-                  case ligature_node:
-                    {
-                      f = font(lig_char(s));
-                      disc_width = disc_width + char_width(f, char_info(f, character(lig_char(s))));
-                    }
-                    break;
-
-                  case hlist_node:
-                  case vlist_node:
-                  case rule_node:
-                  case kern_node:
-                    disc_width = disc_width + width(s);
-                    break;
+                  if (is_char_node(s))
+                  {
+                    f = font(s);
+                    disc_width = disc_width + char_width(f, char_info(f, character(s)));
+                  }
+                  else switch (type(s))
+                  {
+                    case ligature_node:
+                      {
+                        f = font(lig_char(s));
+                        disc_width = disc_width + char_width(f, char_info(f, character(lig_char(s))));
+                      }
+                      break;
+
+                    case hlist_node:
+                    case vlist_node:
+                    case rule_node:
+                    case kern_node:
+                      disc_width = disc_width + width(s);
+                      break;
+
+                    default:
+                      {
+                        confusion("disc3");
+                        return;
+                      }
+                      break;
+                  }
 
-                  default:
-                    {
-                      confusion("disc3");
-                      return;
-                    }
-                    break;
+                  s = link(s);
                 }
-                s = link(s);
-              }
               while (!(s == 0));
 
               act_width = act_width + disc_width;
@@ -839,7 +836,7 @@ done5:;
 
         if (looseness == 0)
         {
-          goto done; /* normal exit */
+          goto done;
         }
 
         {
@@ -848,7 +845,7 @@ done5:;
 
           do
             {
-              if (type(r) != 2)
+              if (type(r) != delta_node)
               {
                 line_diff = toint(line_number(r)) - toint(best_line);
 
@@ -1007,7 +1004,7 @@ void prefixed_command (void)
     prints("' or `");
     print_esc("outer");
     prints("' with `");
-    print_cmd_chr(cur_cmd, cur_chr); 
+    print_cmd_chr(cur_cmd, cur_chr);
     print_char('\'');
     help1("I'll pretend you didn't say \\long or \\outer here.");
     error();
@@ -1500,7 +1497,7 @@ boolean load_fmt_file (void)
   if (trace_flag)
     printf("Read from fmt file mem_top = %lld TeX words\n", x);
 
-  mem = allocate_main_memory(x); /* allocate main memory at this point */
+  mem = allocate_main_memory(x);
 
   if (mem == NULL)
     exit(EXIT_FAILURE);
@@ -1544,7 +1541,7 @@ boolean load_fmt_file (void)
       if (trace_flag)
         printf("undump string pool reallocation (%lld > %d)\n", x, current_pool_size);
 
-      str_pool = realloc_str_pool (x - current_pool_size + increment_pool_size);
+      str_pool = realloc_str_pool(x - current_pool_size + increment_pool_size);
     }
 
     if (x > current_pool_size)
@@ -1586,12 +1583,8 @@ boolean load_fmt_file (void)
       str_ptr = x;
   }
 
-  if (undumpthings(str_start[0], str_ptr + 1))
-    return -1;
-
-  if (undumpthings(str_pool[0], pool_ptr))
-    return -1;
-
+  undumpthings(str_start[0], str_ptr + 1);
+  undumpthings(str_pool[0], pool_ptr);
   init_str_ptr = str_ptr;
   init_pool_ptr = pool_ptr;
   undump(lo_mem_stat_max + 1000, hi_mem_stat_min - 1, lo_mem_max);
@@ -1616,7 +1609,7 @@ boolean load_fmt_file (void)
   if (undumpthings(mem[p], lo_mem_max + 1 - p))
     return -1;
 
-  if (mem_min < mem_bot - 2) /*  ? splice in block below */
+  if (mem_min < mem_bot - 2)
   {
 /*  or call add_variable_space(mem_bot - (mem_min + 1)) */
     if (trace_flag)
@@ -1722,94 +1715,32 @@ boolean load_fmt_file (void)
   }
 
   {
-    if (undumpthings(font_info[0], fmem_ptr))
-      return -1;
-
-    {
-      undump_int(x); /* font_max */
-
-      if (x < 0)
-        goto bad_fmt;
-
-      if (x > font_max)
-      {
-        puts("---! Must increase the font max"); 
-        goto bad_fmt;
-      }
-      else
-        font_ptr = x;
-    }
-
+    undumpthings(font_info[0], fmem_ptr);
+    undump_size(font_base, font_max, "font max", font_ptr);
     frozen_font_ptr = font_ptr;
-
-    if (undumpthings(font_check[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(font_size[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(font_dsize[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(font_params[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(hyphen_char[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(skew_char[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(font_name[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(font_area[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(font_bc[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(font_ec[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(char_base[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(width_base[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(height_base[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(depth_base[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(italic_base[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(lig_kern_base[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(kern_base[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(exten_base[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(param_base[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(font_glue[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(bchar_label[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(font_bchar[0], font_ptr + 1))
-      return -1;
-
-    if (undumpthings(font_false_bchar[0], font_ptr + 1))
-      return -1;
+    undumpthings(font_check[0], font_ptr + 1);
+    undumpthings(font_size[0], font_ptr + 1);
+    undumpthings(font_dsize[0], font_ptr + 1);
+    undumpthings(font_params[0], font_ptr + 1);
+    undumpthings(hyphen_char[0], font_ptr + 1);
+    undumpthings(skew_char[0], font_ptr + 1);
+    undumpthings(font_name[0], font_ptr + 1);
+    undumpthings(font_area[0], font_ptr + 1);
+    undumpthings(font_bc[0], font_ptr + 1);
+    undumpthings(font_ec[0], font_ptr + 1);
+    undumpthings(char_base[0], font_ptr + 1);
+    undumpthings(width_base[0], font_ptr + 1);
+    undumpthings(height_base[0], font_ptr + 1);
+    undumpthings(depth_base[0], font_ptr + 1);
+    undumpthings(italic_base[0], font_ptr + 1);
+    undumpthings(lig_kern_base[0], font_ptr + 1);
+    undumpthings(kern_base[0], font_ptr + 1);
+    undumpthings(exten_base[0], font_ptr + 1);
+    undumpthings(param_base[0], font_ptr + 1);
+    undumpthings(font_glue[0], font_ptr + 1);
+    undumpthings(bchar_label[0], font_ptr + 1);
+    undumpthings(font_bchar[0], font_ptr + 1);
+    undumpthings(font_false_bchar[0], font_ptr + 1);
   }
 
 /* log not opened yet, so can't show fonts frozen into format */
@@ -1876,7 +1807,6 @@ boolean load_fmt_file (void)
     if (!is_initex)
     {
       allocate_tries(x); /* allocate only as much as is needed */
-/* trie_size = x; */ /* ??? */
     }
 #endif
 
@@ -1894,43 +1824,19 @@ boolean load_fmt_file (void)
     trie_max = j;
 #endif
 
-  if (undumpthings(trie_trl[0], j + 1))
-    return -1;
-
-  if (undumpthings(trie_tro[0], j + 1))
-    return -1;
-
-  if (undumpthings(trie_trc[0], j + 1))
-    return -1;
-
-  {
-    undump_int(x);
-
-    if (x < 0)
-      goto bad_fmt;
-
-    if (x > trie_op_size)
-    {
-      puts("---! Must increase the trie op size\n");
-      goto bad_fmt;
-    }
-    else
-      j = x;
-  }
+  undumpthings(trie_trl[0], j + 1);
+  undumpthings(trie_tro[0], j + 1);
+  undumpthings(trie_trc[0], j + 1);
+  undump_size(0, trie_op_size, "trie op size", j);
 
 #ifdef INITEX
   if (is_initex)
     trie_op_ptr = j;
 #endif
   
-  if (undumpthings(hyf_distance[1], j))
-    return -1;
-
-  if (undumpthings(hyf_num[1], j))
-    return -1;
-
-  if (undumpthings(hyf_next[1], j))
-    return -1;
+  undumpthings(hyf_distance[1], j);
+  undumpthings(hyf_num[1], j);
+  undumpthings(hyf_next[1], j);
 
 #ifdef INITEX
   if (is_initex)
@@ -2013,7 +1919,7 @@ void final_cleanup (void)
     print_nl("(");
     print_esc("end occurred ");
     prints("when ");
-    print_cmd_chr('i', cur_if);
+    print_cmd_chr(if_test, cur_if);
 
     if (if_line != 0)
     {
@@ -2022,7 +1928,7 @@ void final_cleanup (void)
     }
 
     prints(" was incomplete)");
-    if_line = mem[cond_ptr + 1].cint;
+    if_line = if_line_field(cond_ptr);
     cur_if = subtype(cond_ptr);
     temp_ptr = cond_ptr;
     cond_ptr = link(cond_ptr);
@@ -2044,10 +1950,8 @@ void final_cleanup (void)
     if (is_initex)
     {
       for (c = 0; c <= 4; c++)
-      {
         if (cur_mark[c] != 0)
           delete_token_ref(cur_mark[c]);
-      }
 
       if (last_glue != max_halfword)
         delete_glue_ref(last_glue);
@@ -2063,10 +1967,9 @@ void final_cleanup (void)
 
 void show_frozen (void)
 {
-  int i, j, n;
+  int i;
 
-  fprintf(log_file, "\n");
-  fprintf(log_file, "(%lld fonts frozen in format file:\n", font_ptr);
+  fprintf(log_file, "\n(%lld fonts frozen in format file:\n", font_ptr);
 
   for (i = 1; i <= font_ptr; i++)
   {
@@ -2076,12 +1979,7 @@ void show_frozen (void)
     if ((i % 8) == 0)
       fprintf(log_file, "\n");
 
-    n = str_start[font_name[i] + 1] - str_start[font_name[i]];
-
-    for (j = 0; j < n; j++)
-    {
-      putc(str_pool[str_start[font_name[i]] + j], log_file);
-    }
+    fwrite(&str_pool[str_start[font_name[i]]], 1, length(font_name[i]), log_file);
   }
 
   fprintf(log_file, ") ");
@@ -2202,19 +2100,7 @@ start_of_TEX:
   term_offset = 0;
   file_offset = 0;
 
-  {
-    char dist_ver[256];
-#ifdef _WIN32
-  #ifdef _WIN64
-    sprintf(dist_ver, "%s (%s %s/Win64)", tex_version, application, yandyversion);
-  #else
-    sprintf(dist_ver, "%s (%s %s/Win32)", tex_version, application, yandyversion);
-  #endif
-#else
-    sprintf(dist_ver, "%s (%s %s/Linux)", tex_version, application, yandyversion);
-#endif
-    prints(dist_ver);
-  }
+  print_banner();
 
   if (format_ident == 0)
   {
@@ -2338,10 +2224,7 @@ final_end:
   {
     int code;
 
-#ifndef _WINDOWS
-    fflush(stdout);
-#endif
-
+    update_terminal();
     ready_already = 0;
 
     if ((history != spotless) && (history != warning_issued))
@@ -2396,7 +2279,7 @@ void reset_trie (void)
 {
   integer k;
 
-  for (k = -(integer)trie_op_size; k <= trie_op_size; k++)
+  for (k = -(integer) trie_op_size; k <= trie_op_size; k++)
     trie_op_hash[k] = 0;
 
   for (k = 0; k <= 255; k++)
@@ -2580,7 +2463,7 @@ void do_initex (void)
     puts("initex cs_count = 0 ");
 
   eq_type(frozen_dont_expand) = dont_expand;
-  text(frozen_dont_expand) = 499;  /* notexpanded */
+  text(frozen_dont_expand) = 499;  /* "notexpanded:" */
 
   font_ptr                    = null_font;
   fmem_ptr                    = 7;
@@ -2658,7 +2541,7 @@ boolean get_strings_started (void)
 
   if (g == 0)
   {
-    fprintf(stdout, "%s\n", "! You have to increase POOLSIZE." );
+    printf("%s\n", "! You have to increase POOLSIZE." );
     return false;
   }
 
@@ -2728,7 +2611,7 @@ void primitive_ (str_number s, quarterword c, halfword o)
   else
   {
     k = str_start[s];
-    l = str_start[s + 1] - k; /* small_number l */
+    l = str_start[s + 1] - k;
 
     for (j = 0; j <= l - 1; j++)
       buffer[j] = str_pool[k + j];
@@ -2746,7 +2629,7 @@ void primitive_ (str_number s, quarterword c, halfword o)
 
 #ifdef INITEX
 /* sec 0944 */
-trie_op_code new_trie_op_ (small_number d, small_number n, trie_op_code v)
+trie_op_code new_trie_op (small_number d, small_number n, trie_op_code v)
 {
   integer h;
   trie_op_code u;
@@ -2790,7 +2673,7 @@ trie_op_code new_trie_op_ (small_number d, small_number n, trie_op_code v)
       return u;
     }
 
-    if ((hyf_distance[l]== d) && (hyf_num[l]== n) && (hyf_next[l]== v) && (trie_op_lang[l]== cur_lang))
+    if ((hyf_distance[l] == d) && (hyf_num[l] == n) && (hyf_next[l] == v) && (trie_op_lang[l] == cur_lang))
     {
       return trie_op_val[l];
     }
@@ -2987,25 +2870,25 @@ void new_patterns (void)
   /* ASCII_code c; */
   int c;
 
-  if (!trie_not_ready) /* new stuff */
+  if (!trie_not_ready)
   {
     if (allow_patterns)
     {
       if (trace_flag)
         puts("Resetting patterns");
 
-      reset_trie();         /* RESET PATTERNS -  93/Nov/26 */
+      reset_trie();
 
       if (reset_exceptions)
       {
         if (trace_flag)
           puts("Resetting exceptions");
 
-        reset_hyphen();     /* RESET HYPHENEXCEPTIONS -  93/Nov/26 */
+        reset_hyphen();
       }
     }
   }
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
+
   if (trie_not_ready)
   {
     set_cur_lang();
@@ -3066,7 +2949,8 @@ void new_patterns (void)
               l = k;
               v = min_trie_op;
 
-              while (true) {
+              while (true)
+              {
                 if (hyf[l]!= 0)
                   v = new_trie_op(k - l, hyf[l], v);
 
@@ -3079,13 +2963,15 @@ done1:
               q = 0;
               hc[0] = cur_lang;
 
-              while (l <= k) {
+              while (l <= k)
+              {
                 c = hc[l];
                 incr(l);
                 p = trie_l[q];
                 first_child = true;
 
-                while ((p > 0) && (c > trie_c[p])) {
+                while ((p > 0) && (c > trie_c[p]))
+                {
                   q = p;
                   p = trie_r[q];
                   first_child = false;
@@ -3105,9 +2991,9 @@ done1:
                   trie_l[p] = 0;
 
                   if (first_child)
-                    trie_l[q]= p;
+                    trie_l[q] = p;
                   else
-                    trie_r[q]= p;
+                    trie_r[q] = p;
 
                   trie_c[p] = c;
                   trie_o[p] = min_trie_op;
@@ -3116,14 +3002,14 @@ done1:
                 q = p;
               }
 
-              if (trie_o[q]!= min_trie_op)
+              if (trie_o[q] != min_trie_op)
               {
                 print_err("Duplicate pattern");
                 help1("(See Appendix H.)");
                 error();
               }
 
-              trie_o[q]= v;
+              trie_o[q] = v;
             }
 
             if (cur_cmd == right_brace)
@@ -3168,14 +3054,10 @@ void init_trie (void)
   op_start[0] = - (integer) min_trie_op;
 
   for (j = 1; j <= 255; j++)
-  {
     op_start[j] = op_start[j - 1] + trie_used[j - 1];
-  }
 
   for (j = 1; j <= trie_op_ptr; j++)
-  {
     trie_op_hash[j] = op_start[trie_op_lang[j]] + trie_op_val[j];
-  }
 
   for (j = 1; j <= trie_op_ptr; j++)
   {
@@ -3197,21 +3079,15 @@ void init_trie (void)
   }
 
   for (p = 0; p <= trie_size; p++)
-  {
     trie_hash[p] = 0;
-  }
 
   trie_l[0] = compress_trie(trie_l[0]);
 
   for (p = 0; p <= trie_ptr; p++)
-  {
-    trie_hash[p]= 0;
-  }
+    trie_hash[p] = 0;
 
   for (p = 0; p <= 255; p++)
-  {
     trie_min[p] = p + 1;
-  }
 
   trie_trl[0] = 1;
   trie_max = 0;
@@ -3230,6 +3106,7 @@ void init_trie (void)
       trie_tro[r] = min_trie_op;
       trie_trc[r] = 0;
     }
+
     trie_max = 256;
   }
   else
@@ -3240,6 +3117,7 @@ void init_trie (void)
     do
       {
         s = trie_trl[r];
+
         {
           trie_trl[r] = 0;
           trie_tro[r] = min_trie_op;
@@ -3282,7 +3160,7 @@ void store_fmt_file (void)
   }
 
   selector = new_string;
-  prints(" (format=");
+  prints(" (preloaded format=");
   print(job_name);
   print_char(' ');
   print_int(year);
@@ -3292,7 +3170,7 @@ void store_fmt_file (void)
   print_int(day);
   print_char(')');
 
-  if (interaction == 0)
+  if (interaction == batch_mode)
     selector = log_only;
   else
     selector = term_and_log;
@@ -3302,9 +3180,7 @@ void store_fmt_file (void)
   pack_job_name(".fmt");
 
   while (!w_open_out(fmt_file))
-  {
     prompt_file_name("format file name", ".fmt");
-  }
 
   print_nl("Beginning to dump on file ");
   slow_print(w_make_name_string(fmt_file));
@@ -3320,13 +3196,8 @@ void store_fmt_file (void)
   dump_int(hyphen_prime);
   dump_int(pool_ptr);
   dump_int(str_ptr);
-
-  if (dumpthings(str_start[0], str_ptr + 1))
-    return;
-
-  if (dumpthings(str_pool[0], pool_ptr))
-    return;
-
+  dumpthings(str_start[0], str_ptr + 1);
+  dumpthings(str_pool[0], pool_ptr);
   print_ln();
   print_int(str_ptr);
   prints(" strings of total length ");
@@ -3412,6 +3283,7 @@ found1:
           (eq_type(j) != eq_type(j + 1)) ||
           (eq_level(j) != eq_level(j + 1)))
           goto done1;
+
         incr(j);
       }
 
@@ -3483,7 +3355,7 @@ done2:
       incr(cs_count);
 
       if (trace_flag)
-        puts("itex cs_count++ ");
+        puts("itex.c store_fmt_file() cs_count++ ");
     }
   }
 
@@ -3498,79 +3370,31 @@ done2:
   dump_int(fmem_ptr);
 
   {
-    if (dumpthings(font_info[0], fmem_ptr))
-      return;
-
+    dumpthings(font_info[0], fmem_ptr);
     dump_int(font_ptr);
-
-    if (dumpthings(font_check[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(font_size[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(font_dsize[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(font_params[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(hyphen_char[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(skew_char[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(font_name[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(font_area[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(font_bc[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(font_ec[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(char_base[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(width_base[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(height_base[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(depth_base[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(italic_base[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(lig_kern_base[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(kern_base[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(exten_base[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(param_base[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(font_glue[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(bchar_label[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(font_bchar[0], font_ptr + 1))
-      return;
-
-    if (dumpthings(font_false_bchar[0], font_ptr + 1))
-      return;
+    dumpthings(font_check[0], font_ptr + 1);
+    dumpthings(font_size[0], font_ptr + 1);
+    dumpthings(font_dsize[0], font_ptr + 1);
+    dumpthings(font_params[0], font_ptr + 1);
+    dumpthings(hyphen_char[0], font_ptr + 1);
+    dumpthings(skew_char[0], font_ptr + 1);
+    dumpthings(font_name[0], font_ptr + 1);
+    dumpthings(font_area[0], font_ptr + 1);
+    dumpthings(font_bc[0], font_ptr + 1);
+    dumpthings(font_ec[0], font_ptr + 1);
+    dumpthings(char_base[0], font_ptr + 1);
+    dumpthings(width_base[0], font_ptr + 1);
+    dumpthings(height_base[0], font_ptr + 1);
+    dumpthings(depth_base[0], font_ptr + 1);
+    dumpthings(italic_base[0], font_ptr + 1);
+    dumpthings(lig_kern_base[0], font_ptr + 1);
+    dumpthings(kern_base[0], font_ptr + 1);
+    dumpthings(exten_base[0], font_ptr + 1);
+    dumpthings(param_base[0], font_ptr + 1);
+    dumpthings(font_glue[0], font_ptr + 1);
+    dumpthings(bchar_label[0], font_ptr + 1);
+    dumpthings(font_bchar[0], font_ptr + 1);
+    dumpthings(font_false_bchar[0], font_ptr + 1);
 
     for (k = 0; k <= font_ptr; k++)
     {
@@ -3592,17 +3416,17 @@ done2:
   print_ln();
   print_int(fmem_ptr - 7);
   prints(" words of font info for ");
-  print_int(font_ptr - 0);
+  print_int(font_ptr - font_base);
   prints(" preloaded font");
 
-  if (font_ptr != 1)
+  if (font_ptr != font_base + 1)
     print_char('s');
 
   dump_int(hyph_count);
 
   for (k = 0; k <= hyphen_prime; k++)
   {
-    if (hyph_word[k]!= 0)
+    if (hyph_word[k] != 0)
     {
       dump_int(k);
       dump_int(hyph_word[k]);
@@ -3621,27 +3445,13 @@ done2:
     init_trie();
 
   dump_int(trie_max);
-
-  if (dumpthings(trie_trl[0], trie_max + 1))
-    return;
-
-  if (dumpthings(trie_tro[0], trie_max + 1))
-    return;
-
-  if (dumpthings(trie_trc[0], trie_max + 1))
-    return;
-
+  dumpthings(trie_trl[0], trie_max + 1);
+  dumpthings(trie_tro[0], trie_max + 1);
+  dumpthings(trie_trc[0], trie_max + 1);
   dump_int(trie_op_ptr);
-
-  if (dumpthings(hyf_distance[1], trie_op_ptr))
-    return;
-
-  if (dumpthings(hyf_num[1], trie_op_ptr))
-    return;
-
-  if (dumpthings(hyf_next[1], trie_op_ptr))
-    return;
-
+  dumpthings(hyf_distance[1], trie_op_ptr);
+  dumpthings(hyf_num[1], trie_op_ptr);
+  dumpthings(hyf_next[1], trie_op_ptr);
   print_nl("Hyphenation trie of length ");
   print_int(trie_max);
   prints(" has ");
@@ -3673,7 +3483,7 @@ done2:
   tracing_stats = 0;
 
 #ifdef COMPACTFORMAT
-  gzclose(gz_fmt_file);
+  gz_w_close(gz_fmt_file);
 #else
   w_close(fmt_file);
 #endif
@@ -3916,7 +3726,7 @@ void init_prim (void)
   primitive("pagefilllstretch", set_page_dimen, 5);
   primitive("pageshrink", set_page_dimen, 6);
   primitive("pagedepth", set_page_dimen, 7);
-  primitive("end", end_match, 0);
+  primitive("end", stop, 0);
   primitive("dump", stop, 1);
   primitive("hskip", hskip, skip_code);
   primitive("hfil", hskip, fil_code);
index becba21..d23494c 100644 (file)
@@ -18,7 +18,7 @@
 
 #define EXTERN extern
 
-#include "texd.h"
+#include "yandytex.h"
 
 #define USEOUREALLOC
 #define USEMEMSET
@@ -41,7 +41,22 @@ const char * compiletime  = __TIME__;
 const char * compiledate  = __DATE__;
 const char * yandyversion = "2.3.0";
 const char * application  = "Y&Y TeX";
-const char * tex_version  = "This is TeX, Version 3.14159265";
+const char * banner       = "This is TeX, Version 3.14159265";
+
+void print_banner (void)
+{
+  char dist_ver[256];
+#ifdef _WIN32
+#ifdef _WIN64
+  sprintf(dist_ver, "%s (%s %s/Win64)", banner, application, yandyversion);
+#else
+  sprintf(dist_ver, "%s (%s %s/Win32)", banner, application, yandyversion);
+#endif
+#else
+  sprintf(dist_ver, "%s (%s %s/Linux)", banner, application, yandyversion);
+#endif
+  prints(dist_ver);
+}
 
 clock_t start_time, main_time, finish_time;
 
@@ -51,15 +66,14 @@ char * aux_directory = "";
 char * fmt_directory = "";
 char * pdf_directory = "";
 
-char log_line[MAXLINE]; // used also in tex9.c
+char log_line[256];
 
-int mem_spec_flag     = 0;    /* non-zero if `-m=...' was used */ 
-int format_spec       = 0;    /* non-zero if a format specified on command line */
-int closed_already    = 0;    /* make sure we don't try this more than once */
-boolean reorder_arg_flag = true; /* put command line flags/arguments first */
+boolean mem_spec_flag     = false;
+boolean format_spec       = false;
+int closed_already        = 0;     /* make sure we don't try this more than once */
+boolean reorder_arg_flag  = true;  /* put command line flags/arguments first */
 
 /* Mapping from Windows ANSI to DOS code page 850 96/Jan/20 */
-/* Used in tex0.c with wintodos[c-128]                      */
 
 unsigned char wintodos[128] =
 {
@@ -84,52 +98,33 @@ unsigned char wintodos[128] =
 void show_usage (void)
 {
   printf("\n"
-      " Useage: yanytex [OPTION]... [+format_file] [tex_file]\n\n"
-      "    --help    -?\n"
-      "        show this usage summary\n"
-      "    --initex  -i\n"
-      "        start up as iniTeX (create format file)\n"
-      "    --verbose -v\n"
-      "        be verbose (show implementation version number)\n"
-      "    -n    do not allow `non ASCII' characters in input files (complain instead)\n"
-      "    --showhex -w\n"
-      "        do not show `non ASCII' characters in hexadecimal (show as is)\n"
-      "    -d    do not allow DOS style file names - i.e. do not convert \\ to /\n"
-      "    -r    do not allow Mac style termination - i.e. do not convert \\r to \\n\n"
-      "    --patterns    -p\n"
-      "        allow use of \\patterns after loading format (iniTeX only)\n"
-      "    --knuthify    -K\n"
-      "        disable all extensions to basic TeX\n"
-      "    --main-memory -m\n"
-      "        initial main memory size in kilo words (iniTeX only)\n"
-      "    --hyph-size   -e\n"
-      "        hyphenation exception dictionary size (iniTeX only)\n"
-      "    --trie-size   -h\n"
-      "        hyphenation pattern trie size (iniTeX only)\n"
-      "    --xchr-file   -x\n"
-      "        use `non ASCII' character mapping (xchr[]) defined in file\n"
-      "    --key-file    -k\n"
-      "        use `key replacement' defined in file\n"
-      "    --dvi-dir     -o\n"
-      "        write DVI file in specified directory (default current directory)\n"
-      "    --log-dir     -l\n"
-      "        write LOG file in specified directory (default current directory)\n"
-      "    --aux-dir     -a\n"
-      "        write AUX file in specified directory (default current directory)\n");
-
-#ifndef _WINDOWS
-  uexit(EXIT_FAILURE);     // has this been setup yet ???
-#endif
+      "Useage: yanytex [OPTION]... [+format_file] [tex_file]\n\n"
+      "--help       -?  show this usage summary\n"
+      "--initex     -i  start up as initex (create format file)\n"
+      "--verbose    -v  be verbose (show implementation version number)\n"
+      "--ascii      -n  do not allow `non ASCII' characters in input files\n"
+      "                    (complain instead)\n"
+      "--showhex    -w  do not show `non ASCII' characters in hexadecimal\n"
+      "                    (show as is)\n"
+      "--nodos      -d  do not allow DOS style file names - i.e. do not convert\n"
+      "                    \\ to /\n"
+      "--nomac      -r  do not allow Mac style termination - i.e. do not convert\n"
+      "                    \\r to \\n\n"
+      "--patterns   -p  allow use of \\patterns after loading format (initex only)\n"
+      "--knuthify   -K  disable all extensions to basic TeX\n"
+      "--main-mem   -m  initial main memory size in kilo words (initex only)\n"
+      "--hyph-size  -e  hyphenation exception dictionary size (initex only)\n"
+      "--trie-size  -h  hyphenation pattern trie size (initex only)\n"
+      "--xchr-file  -x  use `non ASCII' character mapping (xchr[]) defined in file\n"
+      "--key-file   -k  use `key replacement' defined in file\n"
+      "--dvi-dir    -o  write DVI file in specified directory (default '.')\n"
+      "--log-dir    -l  write LOG file in specified directory (default '.')\n"
+      "--aux-dir    -a  write AUX file in specified directory (default '.')\n");
+  uexit(EXIT_FAILURE);
 }
 
-/* -z    do not discard control-Z at end of input file (treat as character)\n\ */
-
-/* \t-d\tallow DOS style file names - i.e. convert \\ to / \n\ */
-/* \t\t(applies to file name and format file name, if present)\n\ */
-/* \t-r\tallow Mac style line termination - i.e. convert \\r to \\n \n\ */
-
 // Sep 27 1990 => 1990 Sep 27
-// 012456789      0123456789
+// 0123456789     0123456789
 void scivilize (char * date)
 {
   int k;
@@ -146,7 +141,7 @@ void scivilize (char * date)
   date[4] = ' ';
 
   if (date[9] == ' ')
-    date[9] = '0'; /* replace space by '0' */
+    date[9] = '0';
 }
 
 // Thu Sep 27 06:26:35 1990 => 1990 Sep 27 06:26:35
@@ -155,10 +150,10 @@ void lcivilize (char * date)
   int k;
   char pyear[6];
 
-  strcpy (pyear, date + 20);
+  strcpy(pyear, date + 20);
 
   for (k = 18; k >= 0; k--)
-    date[k+1] = date[k];
+    date[k + 1] = date[k];
 
   date[20] = '\0';
 
@@ -168,16 +163,14 @@ void lcivilize (char * date)
   date[4] = ' ';
 }
 
-// now writes result into given buffer
-void stamp_it (char *s)
+void stamp_it (char * s)
 {
   char date[11 + 1];
 
   strcpy(date, compiledate);
   scivilize(date);
-  sprintf(s, "%s %s ", application, yandyversion);
-  s += strlen(s);
-  sprintf(s, "(compiled time: %s %s %s)", date, compiletime, compiler);
+  sprintf(s, "%s %s (compiled time: %s %s with %s)",
+    application, yandyversion, date, compiletime, compiler);
   s += strlen(s);
 }
 
@@ -188,7 +181,7 @@ void read_xchr_sub (FILE * xchr_input)
 {
   char buffer[file_name_size];
   int k, from, to, count = 0;
-  char *s;
+  char * s;
 
   memset(xchr, NOTDEF, MAXCHRS);
   memset(xord, NOTDEF, MAXCHRS);
@@ -247,7 +240,7 @@ void read_xchr_sub (FILE * xchr_input)
   }
 }
 
-char *replacement[MAXCHRS];     /* pointers to replacement strings */
+char * replacement[MAXCHRS];     /* pointers to replacement strings */
 
 void read_repl_sub (FILE * repl_input)
 {
@@ -255,7 +248,7 @@ void read_repl_sub (FILE * repl_input)
   char buffer[file_name_size];
   char charname[128];
   int charnum[10];
-  char *s, *t;
+  char * s, * t;
   
   memset(replacement, 0, MAXCHRS * sizeof(replacement[0]));
 
@@ -400,14 +393,14 @@ int read_xchr_file (char *filename, int flag, char *argv[])
 
   if (xchr_input == NULL)
   {
-    strcpy (infile, argv[0]);     /* try TeX program path */
+    strcpy(infile, argv[0]);     /* try TeX program path */
 
     if ((s = strrchr (infile, '\\')) != NULL)
-      *(s+1) = '\0';
+      *(s + 1) = '\0';
     else if ((s = strrchr (infile, '/')) != NULL)
-      *(s+1) = '\0';
+      *(s + 1) = '\0';
     else if ((s = strrchr (infile, ':')) != NULL)
-      *(s+1) = '\0';
+      *(s + 1) = '\0';
 
     strcat(infile, "keyboard\\");
     strcat(infile, filename);
@@ -433,13 +426,14 @@ int read_xchr_file (char *filename, int flag, char *argv[])
       }
     }
   }
-/*  Note: can't look in TeX source file dir, since that is not known yet */
+
+  /* Note: can't look in TeX source file dir, since that is not known yet */
   if (xchr_input == NULL)
   {
     printf("ERROR: Sorry, cannot find %s file %s",
         flag ? " xchr[]" : "key mapping", filename);
     perrormod (filename);
-    return 0;         // failed
+    return 0;
   }
 
   if (flag == 0)
@@ -456,8 +450,6 @@ int read_xchr_file (char *filename, int flag, char *argv[])
 /* need to also allocate `buffercopy' here and free at end */
 /* need to call `readreplace' in appropriate place */
 
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-
 #define MAXSPLITS 3
 
 /* ad hoc default minimum growth in memory realloc is 62% */
@@ -478,7 +470,7 @@ void show_maximums (FILE * output)
 /* also tries _expand first, which can avoid address growth ... */
 
 #ifdef USEOUREALLOC 
-void *ourrealloc (void *old, size_t new_size)
+void * ourrealloc (void * old, size_t new_size)
 {
   void * mnew;
   size_t old_size, overlap;
@@ -566,9 +558,9 @@ void update_statistics (long address, int size, int old_size)
 
 void probe_memory (void)
 {
-  char *s = (char *) malloc(sizeof(void *)); /* get current top address */
+  char * s = (char *) malloc(sizeof(void *));
   free(s);
-  update_statistics ((long) s, 0, 0); /* show where we are */
+  update_statistics ((long) s, 0, 0);
 }
 
 void probe_show (void)
@@ -649,7 +641,6 @@ int realloc_hyphen (int hyphen_prime)
 /*  need not/cannot preserve old contents when hyphen prime is changed */
 /*  if (hyph_list != NULL) free(hyph_list); */
 /*  if (hyph_word != NULL) free(hyph_word); */
-/*  important + 1 since str_number hyph_word[hyphen_prime + 1]  in original etc. */
   nw = (hyphen_prime + 1) * sizeof(str_number);
   nl = (hyphen_prime + 1) * sizeof(halfword);
   n = nw + nl;
@@ -730,7 +721,7 @@ memory_word * allocate_main_memory (int size)
   mem_max = mem_top;
   mem_start = 0;     /* bottom of memory allocated by system */
   mem_min = 0;       /* bottom of area made available to TeX */
-  n = (mem_max - mem_start + 1) * sizeof (memory_word); /* 256k * 8 = 2000 k */
+  n = (mem_max - mem_start + 1) * sizeof (memory_word);
 
   if (trace_flag)
     trace_memory("main memory", n);
@@ -740,7 +731,6 @@ memory_word * allocate_main_memory (int size)
   if (main_memory == NULL)
   {
     memory_error("initial main memory", n);
-//    exit (1);
     return NULL;
   }
 
@@ -785,7 +775,7 @@ memory_word * realloc_main (int lo_size, int hi_size)
 
   if (is_initex)
   {
-    puts("ERROR: Cannot extent main memory in iniTeX");
+    puts("ERROR: Cannot extent main memory in initex");
 
     if (!knuth_flag)
       puts("Please use `-m=...' on command line");
@@ -897,9 +887,7 @@ memory_word * realloc_main (int lo_size, int hi_size)
   current_mem_size = new_size;
 
   if (current_mem_size != mem_max - mem_start)
-  {
     puts("ERROR: Impossible Memory Error");
-  }
 
   if (mem_start != 0)
     mem = main_memory - mem_start;
@@ -916,7 +904,6 @@ memory_word * realloc_main (int lo_size, int hi_size)
 #ifdef ALLOCATEFONT
 int current_font_mem_size = 0;
 
-/* fmemoryword can be either halfword or memory_word */
 memory_word * realloc_font_info (int size)
 {
   memory_word * new_font_info = NULL;
@@ -927,16 +914,16 @@ memory_word * realloc_font_info (int size)
   if (trace_flag)
     printf("Old Address %s == %p\n", "font_info", font_info);
 
-/*  during initial allocation, font_info == NULL - realloc acts like malloc */
-/*  during initial allocation current_font_mem_size == 0 */
+  /* during initial allocation, font_info == NULL - realloc acts like malloc */
+  /* during initial allocation current_font_mem_size == 0 */
   if (current_font_mem_size == font_mem_size)  /* if we REALLY run up to limit */
   {
-/*    memory_error("font", (font_mem_size + 1) * sizeof(memory_word)); */
+    /* memory_error("font", (font_mem_size + 1) * sizeof(memory_word)); */
     return font_info;    /* pass it back to TeX 99/Fabe/4 */
   }
-/*  try and prevent excessive frequent reallocations */
-/*  while avoiding over allocation by too much */
-/*  min_size = current_font_mem_size / 2; */
+  /* try and prevent excessive frequent reallocations */
+  /* while avoiding over allocation by too much */
+  /* min_size = current_font_mem_size / 2; */
   min_size = current_font_mem_size / 100 * percent_grow;
 
   if (size < min_size)
@@ -998,7 +985,7 @@ packed_ASCII_code * realloc_str_pool (int size)
   int k, min_size;
   int new_size = 0;
   int n = 0;
-  packed_ASCII_code *newstrpool = NULL;
+  packed_ASCII_code * new_str_pool = NULL;
 
   if (trace_flag)
     printf("Old Address %s == %p\n", "string pool", str_pool);
@@ -1030,9 +1017,9 @@ packed_ASCII_code * realloc_str_pool (int size)
     if (trace_flag)
       trace_memory("str_pool", n);
 
-    newstrpool = (packed_ASCII_code *) REALLOC (str_pool, n); /* 95/Sep/24 */
+    new_str_pool = (packed_ASCII_code *) REALLOC (str_pool, n); /* 95/Sep/24 */
 
-    if (newstrpool != NULL)
+    if (new_str_pool != NULL)
       break;    /* did we get it ? */
 
     if (current_pool_size == 0)
@@ -1041,13 +1028,13 @@ packed_ASCII_code * realloc_str_pool (int size)
     size = size / 2;          /* else can retry smaller */
   }
 
-  if (newstrpool == NULL)
+  if (new_str_pool == NULL)
   {
     memory_error("string pool", n);
     return str_pool;           /* try and continue !!! */
   }
 
-  str_pool = newstrpool;
+  str_pool = new_str_pool;
   update_statistics ((long) str_pool, n, current_pool_size);
   current_pool_size = new_size;
 
@@ -1064,7 +1051,7 @@ packed_ASCII_code * realloc_str_pool (int size)
 #ifdef ALLOCATESTRING
 int current_max_strings = 0;
 
-pool_pointer *realloc_str_start (int size)
+pool_pointer * realloc_str_start (int size)
 {
   int k, min_size;
   int n = 0;
@@ -1139,16 +1126,16 @@ int allocate_ini (int size)
 {
   int n, nl, no, nc, nr, nh, nt;
 
-  nh = nr = nl = (size + 1) *  sizeof(trie_pointer);
-  no = (size + 1) *  sizeof(trie_op_code);
-  nc = (size + 1) *  sizeof(packed_ASCII_code);
-/*    nt = (size + 1) *  sizeof(boolean); */
-  nt = (size + 1) *  sizeof(char);
+  nh = (size + 1) * sizeof(trie_pointer);
+  nr = (size + 1) * sizeof(trie_pointer);
+  nl = (size + 1) * sizeof(trie_pointer);
+  no = (size + 1) * sizeof(trie_op_code);
+  nc = (size + 1) * sizeof(packed_ASCII_code);
+  nt = (size + 1) * sizeof(char);
   n = nl + no + nc + nr + nh + nt;
-/*    n = (size + 1) * (sizeof(packed_ASCII_code) + sizeof(trie_op_code) +
-      3 *  sizeof(trie_pointer) + sizeof (char)); */
+
   if (trace_flag)
-    trace_memory ("iniTeX hyphen trie", n);
+    trace_memory ("initex hyphen trie", n);
 
   trie_l = (trie_pointer *) malloc (roundup(nl));
   trie_o = (trie_op_code *) malloc (roundup(no));
@@ -1160,15 +1147,14 @@ int allocate_ini (int size)
   if (trie_c == NULL || trie_o == NULL || trie_l == NULL || trie_r == NULL ||
       trie_hash == NULL || trie_taken == NULL)
   {
-    memory_error("iniTeX hyphen trie", n);
-//      exit (1);           /* serious error */
+    memory_error("initex hyphen trie", n);
     return -1;
   }
   
   if (trace_flag)
   {
-    printf("Addresses trie_l %p trie_o %p trie_c %p\n", trie_l, trie_o, trie_c);
-    printf("Addresses trie_r %p trie_hash %p trie_taken %p\n", trie_r, trie_hash, trie_taken);
+    printf("Addresses: trie_l %p trie_o %p trie_c %p\n", trie_l, trie_o, trie_c);
+    printf("Addresses: trie_r %p trie_hash %p trie_taken %p\n", trie_r, trie_hash, trie_taken);
   }
 
   update_statistics ((long) trie_l, nl, 0);
@@ -1177,7 +1163,7 @@ int allocate_ini (int size)
   update_statistics ((long) trie_r, nr, 0);
   update_statistics ((long) trie_hash, nh, 0);
   update_statistics ((long) trie_taken, nt, 0);
-/*    trie_size = size; */ /* ??? */
+
   if (trace_flag)
     probe_show();
 
@@ -1188,7 +1174,7 @@ int allocate_ini (int size)
 #ifdef ALLOCATESAVESTACK
 int current_save_size = 0;
 
-memory_word *realloc_save_stack (int size)
+memory_word * realloc_save_stack (int size)
 {
   int k, min_size;
   int n = 0, new_size = 0;
@@ -1197,11 +1183,9 @@ memory_word *realloc_save_stack (int size)
   if (trace_flag)
     printf("Old Address %s == %p\n", "save stack", save_stack);
 
-  if (current_save_size == save_size)  /* arbitrary limit */
+  if (current_save_size == save_size)
   {
-/*    memory_error ("save stack", (save_size + 1) * sizeof(memory_word)); */
-/*    exit (1); */
-    return save_stack;       /* let TeX handle the error */
+    return save_stack; /* let TeX handle the error */
   }
 
   min_size =  current_save_size / 100 * percent_grow;
@@ -1219,7 +1203,7 @@ memory_word *realloc_save_stack (int size)
     if (new_size > save_size)
       new_size = save_size;
 
-    n = (new_size + 1) * sizeof (memory_word); /* save_stack[save_size + 1] */
+    n = (new_size + 1) * sizeof (memory_word);
 
     if (trace_flag)
       trace_memory("save_stack", n);
@@ -1237,7 +1221,7 @@ memory_word *realloc_save_stack (int size)
 
   if (new_save_stack == NULL)
   {
-    memory_error("save stack", n);
+    memory_error("save_stack", n);
     return save_stack;           /* try and continue !!! */
   }
 
@@ -1261,7 +1245,7 @@ memory_word *realloc_save_stack (int size)
 #ifdef ALLOCATEINPUTSTACK
 int current_stack_size = 0;       /* input stack size */
 
-in_state_record *realloc_input_stack (int size)
+in_state_record * realloc_input_stack (int size)
 {
   int k, min_size;
   int n = 0, new_size = 0;
@@ -1270,10 +1254,8 @@ in_state_record *realloc_input_stack (int size)
   if (trace_flag)
     printf("Old Address %s == %p\n", "input stack", input_stack);
 
-  if (current_stack_size == stack_size)  /* arbitrary limit */
+  if (current_stack_size == stack_size)
   {
-/*    memory_error ("input stack", (stack_size + 1) * sizeof(in_state_record)); */
-/*    exit (1); */
     return input_stack;
   }
 
@@ -1292,7 +1274,7 @@ in_state_record *realloc_input_stack (int size)
     if (new_size > stack_size)
       new_size = stack_size;
 
-    n = (new_size + 1) * sizeof (in_state_record); /* input_stack[stack_size + 1] */
+    n = (new_size + 1) * sizeof(in_state_record);
 
     if (trace_flag)
       trace_memory("input_stack", n);
@@ -1334,7 +1316,7 @@ in_state_record *realloc_input_stack (int size)
 #ifdef ALLOCATENESTSTACK
 int current_nest_size = 0;        /* current nest size */
 
-list_state_record *realloc_nest_stack (int size)
+list_state_record * realloc_nest_stack (int size)
 {
   int k, min_size;
   int n = 0, new_size = 0;
@@ -1343,11 +1325,9 @@ list_state_record *realloc_nest_stack (int size)
   if (trace_flag)
     printf("Old Address %s == %p\n", "nest stack", nest);
 
-  if (current_nest_size == nest_size)  /* arbitrary limit */
+  if (current_nest_size == nest_size)
   {
-/*    memory_error ("nest stack", (nest_size + 1) * sizeof(list_state_record)); */
-/*    exit (1); */
-    return nest;        /* let TeX handle the error */
+    return nest;
   }
 
   min_size =  current_nest_size / 100 * percent_grow;
@@ -1365,7 +1345,7 @@ list_state_record *realloc_nest_stack (int size)
     if (new_size > nest_size)
       new_size = nest_size;
 
-    n = (new_size + 1) * sizeof (list_state_record); /* nest[nest_size + 1] */
+    n = (new_size + 1) * sizeof (list_state_record);
 
     if (trace_flag)
       trace_memory("nest stack", n);
@@ -1416,11 +1396,9 @@ halfword *realloc_param_stack (int size)
   if (trace_flag)
     printf("Old Address %s == %p\n", "param stack", param_stack);
 
-  if (current_param_size == param_size) /* arbitrary limit */
+  if (current_param_size == param_size)
   {
-/*    memory_error ("param stack", (param_size + 1) * sizeof(halfword)); */
-/*    exit (1); */
-    return param_stack;        /* let TeX handle the error */
+    return param_stack;
   }
 
   min_size =  current_param_size / 100 * percent_grow;
@@ -1491,9 +1469,7 @@ ASCII_code * realloc_buffer (int size)
 
   if (current_buf_size == buf_size)
   {
-/*    memory_error ("buffer", buf_size); */
-/*    exit (1); */
-    return buffer;    /* pass it back to TeX 99/Fabe/4 */
+    return buffer;
   }
 
   min_size =  current_buf_size / 100 * percent_grow;
@@ -1566,19 +1542,19 @@ int allocate_memory (void)
 #ifdef ALLOCATEINPUTSTACK
   input_stack = NULL;
   current_stack_size = 0;
-  input_stack = realloc_input_stack (initial_stack_size);  /* + 1 */
+  input_stack = realloc_input_stack(initial_stack_size);
 #endif
 
 #ifdef ALLOCATENESTSTACK
   nest = NULL;
   current_nest_size = 0;
-  nest = realloc_nest_stack (initial_nest_size);  /* + 1 */
+  nest = realloc_nest_stack(initial_nest_size);
 #endif
 
 #ifdef ALLOCATEPARAMSTACK
   param_stack = NULL;
   current_param_size = 0;
-  param_stack = realloc_param_stack (initial_param_size); /* + 1 */
+  param_stack = realloc_param_stack(initial_param_size);
 #endif
 
 #ifdef ALLOCATESAVESTACK
@@ -1603,9 +1579,9 @@ int allocate_memory (void)
   if (is_initex)
   {
     if (trace_flag)
-      puts("ini TeX pool and string allocation\n");
+      puts("ini TeX pool and string allocation");
 
-    str_pool = realloc_str_pool(initial_pool_size); 
+    str_pool = realloc_str_pool(initial_pool_size);
     str_start = realloc_str_start(initial_max_strings);
   }
 #endif
@@ -1614,10 +1590,10 @@ int allocate_memory (void)
 #ifdef ALLOCATEFONT
   font_info = NULL;
   current_font_mem_size = 0;
-/*  if not iniTeX, then do initial allocation on fmt file read in itex.c */
-/*  if ini-TeX we need to do it here - no format file read later */
+/* if not iniTeX, then do initial allocation on fmt file read in itex.c */
+/* if ini-TeX we need to do it here - no format file read later */
   if (is_initex)
-    font_info = realloc_font_info (initial_font_mem_size);
+    font_info = realloc_font_info(initial_font_mem_size);
 #endif
 
 #ifdef ALLOCATEMAIN
@@ -1626,16 +1602,15 @@ int allocate_memory (void)
   mem_min = mem_bot;        /* just to avoid complaints in texbody */
   mem_top = mem_initex;
   mem_max = mem_top;
-/*  allocate main memory here if this is iniTeX */
-/*  otherwise wait for format undumping in itex.c ... */  
+/* allocate main memory here if this is iniTeX */
+/* otherwise wait for format undumping in itex.c ... */
   if (is_initex)
   {
-/*    avoid this if format specified on command line ??? */
-/*    allocate_main_memory(mem_initex); */   /* made variable ! */
-    mem = allocate_main_memory(mem_initex);  /* made variable ! */
+    /* avoid this if format specified on command line ??? */
+    mem = allocate_main_memory(mem_initex); /* made variable ! */
+
     if (mem == NULL)
-//      exit (1);
-      return -1;            /* serious error */
+      return -1;
   }
 #endif
 
@@ -1643,9 +1618,9 @@ int allocate_memory (void)
 #ifdef ALLOCATEHYPHEN
   hyph_word = NULL;
   hyph_list = NULL;
-/*  this will be overridden later by what is in format file */
+/* this will be overridden later by what is in format file */
   hyphen_prime = default_hyphen_prime;
-/*  non ini-TeX use assumes format will be read and that specifies size */
+/* non ini-TeX use assumes format will be read and that specifies size */
   if (is_initex)
   {
     if (new_hyphen_prime)
@@ -1656,9 +1631,9 @@ int allocate_memory (void)
   }
 #endif
 
-/*  now for memory for the part of the hyphenation stuff that always needed */
-/*  if iniTeX, need to allocate pre-determined fixed amount - trie_size */
-/*  if iniTeX not selected, allocate only enough later - undump in itex.c ! */
+/* now for memory for the part of the hyphenation stuff that always needed */
+/* if iniTeX, need to allocate pre-determined fixed amount - trie_size */
+/* if iniTeX not selected, allocate only enough later - undump in itex.c ! */
 #ifdef ALLOCATETRIES
   if (is_initex)
   {
@@ -1667,7 +1642,7 @@ int allocate_memory (void)
   }
 #endif
 
-/*  now for memory for hyphenation stuff needed only when running iniTeX */
+/* now for memory for hyphenation stuff needed only when running iniTeX */
 #ifdef ALLOCATEINI
   if (is_initex)
   {
@@ -1676,9 +1651,12 @@ int allocate_memory (void)
   }
   else
   {
-    trie_l = trie_r = trie_o = trie_hash = NULL; /* (trie_size + 1) * integer */
-    trie_c = NULL;       /* (trie_size + 1) * char */
-    trie_taken = NULL;     /* (trie_size + 1) * boolean */
+    trie_l = NULL;
+    trie_r = NULL;
+    trie_o = NULL;
+    trie_hash = NULL;
+    trie_c = NULL;
+    trie_taken = NULL;
   }
 #endif
 
@@ -1707,7 +1685,7 @@ int free_memory (void)
     puts("Freeing memory again");
   }
 
-/*  only free memory if safe ... additional check */
+/* only free memory if safe ... additional check */
 #ifdef ALLOCATEINI
   if (is_initex)
   {
@@ -1730,7 +1708,9 @@ int free_memory (void)
       free(trie_l);
 
     trie_taken = NULL;
-    trie_hash = trie_l = trie_r = NULL;
+    trie_hash = NULL;
+    trie_l = NULL;
+    trie_r = NULL;
     trie_c = NULL;
     trie_o = NULL;
   }
@@ -1738,16 +1718,17 @@ int free_memory (void)
 
 #ifdef ALLOCATETRIES
   if (trie_trc != NULL)
-    free (trie_trc);
+    free(trie_trc);
 
   if (trie_tro != NULL)
-    free (trie_tro);
+    free(trie_tro);
 
   if (trie_trl != NULL)
-    free (trie_trl);
+    free(trie_trl);
 
   trie_trc = NULL;
-  trie_tro = trie_trl = NULL;
+  trie_tro = NULL;
+  trie_trl = NULL;
 #endif
 
 #ifdef ALLOCATEHYPHEN
@@ -1901,7 +1882,7 @@ void reorderargs (int ac, char **av)
   if (trace_flag)
   {
     show_line(takeargs, 0);
-    show_char('\n');
+    wterm_cr();
   }
   
   n = 1;
@@ -1962,7 +1943,7 @@ void reorderargs (int ac, char **av)
   }
 }
 
-int test_align (long address, int size, char *str)
+int test_align (long address, int size, const char *str)
 {
   int n;
 
@@ -1985,7 +1966,7 @@ void check_fixed_align (int flag)
 
   if (test_align ((long) &mem_top, 4, "FIXED ALIGNMENT"))
   {
-    puts("PLEASE RECOMPILE ME!\n");
+    puts("PLEASE RECOMPILE ME!");
   }
 
 #ifdef CHECKALIGNMENT
@@ -1997,8 +1978,8 @@ void check_fixed_align (int flag)
   test_align ((long) &mem_min, 4, "mem_min");
   test_align ((long) &bad, 4, "bad");
   test_align ((long) &trie_size, 4, "trie_size");
-  test_align ((long) &xord, sizeof(xord[0]), "xord"); /* no op */
-  test_align ((long) &xchr, sizeof(xchr[0]), "xchr"); /* no op */
+  test_align ((long) &xord, sizeof(xord[0]), "xord");
+  test_align ((long) &xchr, sizeof(xchr[0]), "xchr");
   test_align ((long) &name_length, 4, "name_length");
   test_align ((long) &first, 4, "first");
   test_align ((long) &last, 4, "last");
@@ -2034,11 +2015,10 @@ void check_fixed_align (int flag)
   test_align ((long) &depth_threshold, 4, "depth_threshold");
   test_align ((long) &breadth_max, 4, "breadth_max");
   test_align ((long) &nest, sizeof(nest[0]), "nest");
-/*  test_align ((long) &xeq_level, sizeof(xeq_level[0]), "xeq_level"); */
+  // test_align ((long) &xeq_level, sizeof(xeq_level[0]), "xeq_level");
   test_align ((long) &zzzad, sizeof(zzzad[0]), "zzzad");
-/*  test_align ((long) &hash, sizeof(hash[0]), "hash"); */
+  // test_align ((long) &hash, sizeof(hash[0]), "hash");
   test_align ((long) &zzzae, sizeof(zzzae[0]), "zzzae");
-
   test_align ((long) &save_stack, sizeof(save_stack[0]), "save_stack");
   test_align ((long) &input_stack, sizeof(input_stack[0]), "input_stack");
   test_align ((long) &input_file, sizeof(input_file[0]), "input_file");
@@ -2047,7 +2027,6 @@ void check_fixed_align (int flag)
   test_align ((long) &cur_mark, sizeof(cur_mark[0]), "cur_mark");
   test_align ((long) &pstack, sizeof(pstack[0]), "pstack");
   test_align ((long) &read_file, sizeof(read_file[0]), "read_file");
-
   test_align ((long) &font_check, sizeof(font_check[0]), "font_check");
   test_align ((long) &font_size, sizeof(font_size[0]), "font_size");
   test_align ((long) &font_dsize, sizeof(font_dsize[0]), "font_dsize");
@@ -2072,11 +2051,6 @@ void check_fixed_align (int flag)
   test_align ((long) &kern_base, sizeof(kern_base[0]), "kern_base");
   test_align ((long) &exten_base, sizeof(exten_base[0]), "exten_base");
   test_align ((long) &param_base, sizeof(param_base[0]), "param_base");
-
-#ifdef ALLOCATEDVIBUF
-  test_align ((long) &zdvibuf, sizeof(zdvibuf[0]), "zdvibuf"); /* no op */
-#endif
-
   test_align ((long) &total_stretch, sizeof(total_stretch[0]), "total_stretch");
   test_align ((long) &total_shrink, sizeof(total_shrink[0]), "total_shrink");
   test_align ((long) &active_width, sizeof(active_width[0]), "active_width");
@@ -2089,19 +2063,15 @@ void check_fixed_align (int flag)
   test_align ((long) &hc, sizeof(hc[0]), "hc");
   test_align ((long) &hu, sizeof(hu[0]), "hu");
   test_align ((long) &hyf, sizeof(hyf[0]), "hyf");
-/*  test_align ((long) &x, sizeof(x[0]), "x"); */
-
+  // test_align ((long) &x, sizeof(x[0]), "x");
   test_align ((long) &hyf_distance, sizeof(hyf_distance[0]), "hyf_distance");
   test_align ((long) &hyf_num, sizeof(hyf_num[0]), "hyf_num");
   test_align ((long) &hyf_next, sizeof(hyf_next[0]), "hyf_next");
   test_align ((long) &op_start, sizeof(op_start[0]), "op_start");
-
-/*  test_align ((long) &trie_op_hash, sizeof(trie_op_hash[0]), "trie_op_hash"); */
-  test_align ((long) &zzzaf, sizeof(zzzaf[0]), "zzzaf");
+  // test_align ((long) &trie_op_hash, sizeof(trie_op_hash[0]), "trie_op_hash");
   test_align ((long) &trie_used, sizeof(trie_used[0]), "trie_used");
 /*  test_align ((long) &trie_op_lang, sizeof(trie_op_lang[0]), "trie_op_lang");*/
   test_align ((long) &trie_op_val, sizeof(trie_op_val[0]), "trie_op_val");
-
   test_align ((long) &trie_min, sizeof(trie_min[0]), "trie_min");
   test_align ((long) &page_so_far, sizeof(page_so_far[0]), "page_so_far");
   test_align ((long) &write_file, sizeof(write_file[0]), "write_file");
@@ -2121,16 +2091,12 @@ void check_alloc_align (int flag)
     return;
 
 #ifndef ALLOCZEQTB
-  test_align ((long) zeqtb, sizeof(zeqtb[0]), "zeqtb"); 
-#endif
-
-#ifndef ALLOCATEDVIBUF
-  test_align ((long) &zdvibuf, sizeof(zdvibuf[0]), "zdvibuf");  /* no op */
+  test_align ((long) eqtb, sizeof(eqtb[0]), "eqtb"); 
 #endif
 
   test_align ((long) str_pool, sizeof(str_pool[0]), "str_pool"); /* no op */
   test_align ((long) str_start, sizeof(str_start[0]), "str_start");
-  test_align ((long) zmem, sizeof(zmem[0]), "main memory");
+  test_align ((long) mem, sizeof(mem[0]), "main memory");
   test_align ((long) font_info, sizeof(font_info[0]), "font memory");
   test_align ((long) trie_trl, sizeof(trie_trl[0]), "trie_trl");
   test_align ((long) trie_tro, sizeof(trie_tro[0]), "trie_tro");
@@ -2146,7 +2112,6 @@ void check_alloc_align (int flag)
 #endif
 }
 
-boolean backwardflag       = false; /* don't cripple all advanced features */
 boolean shorten_file_name  = false; /* don't shorten file names to 8+3 for DOS */
 
 /* cache to prevent allocating twice in a row */
@@ -2158,7 +2123,7 @@ char * lastvalue = NULL;
 /* is it safe to do that now ? 98/Jan/31 */
 char * grabenv (const char * varname)
 {
-  char *s;
+  char * s;
 
   if (varname == NULL)
     return NULL;
@@ -2194,7 +2159,7 @@ char * grabenv (const char * varname)
     return NULL;
 }
 
-void flush_trailing_slash(char * directory)
+void flush_trailing_slash (char * directory)
 {
   char * s;
 
@@ -2239,7 +2204,7 @@ void knuthify (void)
 char * xchr_file = NULL;
 char * repl_file = NULL;
 
-const char * short_options = "m:e:h:0:H:g:P:o:l:a:kwvpiKLZMdp2t?u";
+const char * short_options = "m:e:h:0:H:g:P:o:l:a:r:kwvpiKLZMd2t?u";
 
 static struct option long_options[] =
 {
@@ -2254,6 +2219,7 @@ static struct option long_options[] =
   {"log-dir",       required_argument, NULL, 'l'},
   {"aux-dir",       required_argument, NULL, 'a'},
   {"key-file",      required_argument, NULL, 'k'},
+  {"jobname",       required_argument, NULL, 'r'},
   {"showhex",       no_argument,       NULL, 'w'},
   {"verbose",       no_argument,       NULL, 'v'},
   {"patterns",      no_argument,       NULL, 'p'},
@@ -2263,7 +2229,6 @@ static struct option long_options[] =
   {"showtfm",       no_argument,       NULL, 'Z'},
   {"showmissing",   no_argument,       NULL, 'M'},
   {"deslash",       no_argument,       NULL, 'd'},
-  {"patterns",      no_argument,       NULL, 'p'},
   {"suppressflig",  no_argument,       NULL, '2'},
   {"trace",         no_argument,       NULL, 't'},
   {"help",          no_argument,       NULL, '?'},
@@ -2271,10 +2236,13 @@ static struct option long_options[] =
   {NULL,            0, 0, 0}
 };
 
-int analyze_flag (int c, char *optarg)
+int analyze_flag (int c, char * optarg)
 {
   switch (c)
   {
+    case 'r':
+      c_job_name = optarg;
+      break;
     case 'v':
       verbose_flag = true;
       break;
@@ -2294,8 +2262,7 @@ int analyze_flag (int c, char *optarg)
       interaction = error_stop_mode;
       break;
     case 'K':
-      backwardflag = true;
-      knuthify(); /* revert to `standard' Knuth TeX */
+      knuthify();
       break;
     case 'L':
       c_style_flag = true;
@@ -2307,34 +2274,31 @@ int analyze_flag (int c, char *optarg)
       show_missing = false;
       break;
     case 'd':
-      deslash = false; /* flipped 93/Nov/18 */
-      /* pseudo_tilde = 0; */ /* new 95/Sep/26 */
+      deslash = false;
       break;
     case 'p':
-      allow_patterns = true; /* 93/Nov/26 */
-      /* reset_exceptions = true; */ /* 93/Dec/23 */
+      allow_patterns = true;
       break;
-/*  case 'w':  show_in_hex = false; */ /* 94/Jan/26 */
     case 'w':
-      show_in_hex = true; /* flipped 00/Jun/18 */
+      show_in_hex = true;
       break;
     case 'j':
-      show_in_dos = true; /* 96/Jan/26 */
+      show_in_dos = true;
       break;
     case 'n':
       restrict_to_ascii = true; /* 0 - 127 1994/Jan/21 */
       break;
     case 'f':
-      show_fonts_used = false; /* 97/Dec/24 */
+      show_fonts_used = false;
       break;
     case '8':
-      shorten_file_name = true; /* 95/Feb/20 */
+      shorten_file_name = true;
       break;
     case '9':
-      show_cs_names = true; /* 98/Mar/31 */
+      show_cs_names = true;
       break;
     case '4':
-      ignore_frozen = true; /* 98/Oct/5 */
+      ignore_frozen = true;
       break;
     case 'J':
       show_line_break_stats = false; /* 96/Feb/8 */
@@ -2356,13 +2320,13 @@ int analyze_flag (int c, char *optarg)
       break;
 /* The following are really obscure and should not be advertized */
     case 's':
-      show_current = false; /* tex8 93/Dec/14 */
+      show_current = false;
       break;
     case 'N':
-      show_numeric = false; /* 93/Dec/21 */
+      show_numeric = false;
       break;
     case 'A':
-      civilize_flag = false; /* 93/Dec/16 */
+      civilize_flag = false;
       break; 
     case 'B':
       open_trace_flag = true;
@@ -2380,13 +2344,16 @@ int analyze_flag (int c, char *optarg)
       if (mem_initex == 0)
         complainarg(c, optarg);
 
-      mem_spec_flag = 1;
+      mem_spec_flag = true;
       break;
 
 #ifdef VARIABLETRIESIZE
     case 'h':
       if (optarg == 0)
+      {
+        //trie_size = atoi(kpse_var_value("trie_size"));
         trie_size = default_trie_size;
+      }
       else
         trie_size = atoi(optarg);
 
@@ -2488,24 +2455,6 @@ int analyze_flag (int c, char *optarg)
 
       break;
 
-    case '0':
-      {
-        char * format_spec = NULL;
-
-        if (optarg != 0)
-          format_spec = xstrdup(optarg);
-
-        if (!strcmp(format_spec, "pdf"))
-          shipout_flag = out_pdf_flag;
-        else if (!strcmp(format_spec, "dvi"))
-          shipout_flag = out_dvi_flag;
-        else if (!strcmp(format_spec, "xdv"))
-          shipout_flag = out_xdv_flag;
-        else
-          printf("ERROR: Do not understand shipout flag `%s'\n", format_spec);
-      }
-      break;
-
     case 'l':
       if (optarg == 0)
         log_directory = "";
@@ -2634,13 +2583,13 @@ int init_commands (int ac, char **av)
   deslash               = true;
   pseudo_tilde          = 254;   /* default '~' replace 95/Sep/26 filledbox DOS 850 */
   pseudo_space          = 255;   /* default ' ' replace 97/June/5 nbspace DOS 850 */
-  default_rule          = 26214; /* default rule variable 95/Oct/9 */
+  default_rule          = 26214;
   show_current          = true;
   civilize_flag         = true;
   show_numeric          = true;
   show_missing          = true;
-  c_style_flag          = false; /* use c-style error output */
-  show_fmt_flag         = true;  /* show format file in log */
+  c_style_flag          = false;
+  show_fmt_flag         = true;
   show_tfm_flag         = false; /* don't show metric file in log */
   shorten_file_name     = false; /* don't shorten file names to 8+3 */
   truncate_long_lines   = true;  /* truncate long lines */
@@ -2649,7 +2598,7 @@ int init_commands (int ac, char **av)
   show_fonts_used       = true;  /* show fonts used in LOG file 97/Dec/24 */
   allow_quoted_names    = true;  /* allow quoted names with spaces 98/Mar/15 */
   show_cs_names         = false;
-  knuth_flag            = false; /* allow extensions to TeX */
+  knuth_flag            = false;
   full_file_name_flag   = true;  /* new default 2000 June 18 */
   errout                = stdout; /* as opposed to stderr say --- used ??? */
   new_hyphen_prime      = 0;
@@ -2690,7 +2639,7 @@ void initial_memory (void)
  #if defined(ALLOCATEHIGH) || defined(ALLOCATELOW)
     if (mem_extra_high != 0 || mem_extra_low != 0)
     {
-      puts("ERROR: Cannot extend main memory in iniTeX");
+      puts("ERROR: Cannot extend main memory in initex");
       mem_extra_high = 0;
       mem_extra_low = 0;
     }
@@ -2700,13 +2649,13 @@ void initial_memory (void)
   {
     if (mem_initex != 0)
     {
-      puts("ERROR: Can only set initial main memory size in iniTeX");
+      puts("ERROR: Can only set initial main memory size in initex");
       mem_initex = 0;
     }
 
     if (trie_size != 0)
     {
-      puts("ERROR: Need only set hyphenation trie size in iniTeX");
+      puts("ERROR: Need only set hyphenation trie size in initex");
 /* trie_size = 0; */
     }
   }
@@ -2738,7 +2687,7 @@ void initial_memory (void)
   if (new_hyphen_prime > 0)
   {
     if (! is_initex)
-      puts("ERROR: Can only set hyphen prime in iniTeX");
+      puts("ERROR: Can only set hyphen prime in initex");
     else
     {
       if (new_hyphen_prime % 2 == 0)
@@ -2864,7 +2813,7 @@ void deslash_all (int ac, char **av)
       unixify(pdf_directory);
   }
 
-  format_spec = 0;
+  format_spec = false;
 
   if (optind < ac && optind > 0)
   {
@@ -2881,7 +2830,7 @@ void deslash_all (int ac, char **av)
 
     if (*av[optind] == '&' || *av[optind] == '+')
     {
-      format_spec = 1;
+      format_spec = true;
       format_name = xstrdup(av[optind] + 1);
 
       if (optind + 1 < ac)
@@ -2901,10 +2850,7 @@ void deslash_all (int ac, char **av)
   }
 }
 
-/* note: those optarg == 0 test don't really work ... */
-/* note: optarg starts at = in case of x=... */
-
-int main_init (int ac, char **av)
+int main_init (int ac, char ** av)
 {
   kpse_set_program_name(av[0], NULL);
   xputenv("engine", "yandytex");
@@ -2978,7 +2924,7 @@ int main_init (int ac, char **av)
   closed_already    = 0;
 
   if (trace_flag)
-    puts("Entering init (local.c)");
+    puts("Entering main_init() (local.c).");
 
   probe_memory();
   ini_max_address = max_address;
@@ -2988,10 +2934,9 @@ int main_init (int ac, char **av)
 
   initial_memory();
   deslash_all(ac, av);
-  no_interrupts = 0;
 
   if (format_spec && mem_spec_flag)
-    puts("WARNING: Cannot change initial main memory size when format specified");
+    puts("WARNING: Cannot change initial main_memory size when format specified");
 
   if (allocate_memory() != 0)
     return -1;
@@ -2999,7 +2944,7 @@ int main_init (int ac, char **av)
   check_alloc_align(trace_flag);
 
   if (trace_flag)
-    puts("Leaving init (local.c)");
+    puts("Leaving main_init() (local.c).");
 
   return 0;
 }
@@ -3043,12 +2988,9 @@ int endit(int flag)
     flag = 1;
 
   if (missing_characters)
-  {
-    sprintf(log_line, "! There %s %d missing character%s --- see log file\n",
+    printf("! There %s %d missing character%s --- see log file\n",
       (missing_characters == 1) ? "was" : "were", missing_characters,
       (missing_characters == 1) ? "" : "s");
-    show_line(log_line, 0);
-  }
 
   if (free_memory() != 0)
     flag++;
@@ -3073,7 +3015,7 @@ int endit(int flag)
   return flag;
 }
 // printf control sequences' name
-void print_cs_name (FILE *output, int h)
+void print_cs_name (FILE * output, int h)
 {
   int c, textof, n;
 
@@ -3150,7 +3092,7 @@ void print_cs_names (FILE *output, int pass)
     if (pass == 1 && csused[h])
       continue;
 
-    if (hash[h].rh != 0)
+    if (text(h) != 0)
     {
       if (pass == 0)
         csused[h] = 1;
@@ -3248,7 +3190,7 @@ int compare_strn (int k1, int l1, int k2, int l2)
   return 0;         /* strings match */
 }
 /* compare two font names and their at sizes in qsort */
-int compare_fnt (const void *fp1, const void *fp2)
+int compare_fnt (const void * fp1, const void * fp2)
 {
   int f1, f2, l1, l2, k1, k2, s;
 
@@ -3286,7 +3228,7 @@ int compare_fnt_name (int f1, int f2)
   return s;
 }
 /* decode checksum information */
-unsigned long checkdefault = 0x59265920; /* default signature */
+const unsigned long checkdefault = 0x59265920;
 int decode_fourty (unsigned long checksum, char *codingvector)
 {
   int c;
@@ -3324,6 +3266,7 @@ int decode_fourty (unsigned long checksum, char *codingvector)
       
       codingvector[5-k] = (char) c;
     }
+
     codingvector[6] = '\0';
   }
 
@@ -3340,7 +3283,7 @@ double sclpnt (long x)
   return (pt);
 }
 
-void dvi_font_show(internal_font_number f, int suppressname)
+void dvi_font_show (internal_font_number f, int suppressname)
 {
   int a, l, k, n;
   unsigned long checksum;
@@ -3419,7 +3362,7 @@ void show_font_info (void)
   {
     if (m > 0)
     {
-      if (compare_fnt_name(fnumtable[m-1], fnumtable[m]) == 0)
+      if (compare_fnt_name(fnumtable[m - 1], fnumtable[m]) == 0)
         repeatflag = 1;
       else
         repeatflag = 0;
@@ -3429,4 +3372,4 @@ void show_font_info (void)
   }
 
   free((void *)fnumtable);
-}
+}
\ No newline at end of file
similarity index 93%
rename from src/texsourc/yandy_macros.h
rename to src/texsourc/macros.h
index 7d52f8c..3823bc9 100644 (file)
@@ -14,6 +14,8 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301 USA.  */
+#ifndef _YANDYTEX_MACROS_H
+#define _YANDYTEX_MACROS_H
 
 #define font_base 0
 /* sec 0022 */
@@ -938,6 +940,30 @@ while (0)
 #define fi_code          2
 #define else_code        3
 #define or_code          4
+/* sec 0506 */
+#define get_x_token_or_active_char()                    \
+do                                                      \
+{                                                       \
+  get_x_token();                                        \
+                                                        \
+  if (cur_cmd == relax)                                 \
+    if (cur_chr == no_expand_flag)                      \
+    {                                                   \
+      cur_cmd = active_char;                            \
+      cur_chr = cur_tok - cs_token_flag - active_base;  \
+    }                                                   \
+}                                                       \
+while (0)
+/* sec 0519 */
+#define append_to_name(a)       \
+do                              \
+{                               \
+  c = a; incr(k);               \
+                                \
+  if (k < file_name_size)       \
+    name_of_file[k] = xchr[c];  \
+}                               \
+while (0)
 /* sec 0544 */
 #define no_tag   0
 #define lig_tag  1
@@ -989,51 +1015,89 @@ while (0)
 #define x_height(f)      param(x_height_code, f)
 #define quad(f)          param(quad_code, f)
 #define extra_space(f)   param(extra_space_code, f)
+/* sec 0561 */
+#define start_font_error_message()  \
+do                                  \
+{                                   \
+  print_err("Font ");               \
+  sprint_cs(u);                     \
+  print_char('=');                  \
+  print_file_name(nom, aire, 335);  \
+                                    \
+  if (s >= 0)                       \
+  {                                 \
+    prints(" at ");                 \
+    print_scaled(s);                \
+    prints("pt");                   \
+  }                                 \
+  else if (s != -1000)              \
+  {                                 \
+    prints(" scaled ");             \
+    print_int(-(integer)s);         \
+  }                                 \
+}                                   \
+while (0)
 /* sec 0564 */
-#define read_sixteen(a)         \
-do                              \
-  {                             \
-    a = tfm_temp;               \
-    if (a > 127)                \
-      goto bad_tfm;             \
-    tfm_temp = getc(tfm_file);  \
-    a = a * 256 + tfm_temp;     \
-  }                             \
+#define read_sixteen(a) \
+do                      \
+  {                     \
+    a = fbyte;          \
+                        \
+    if (a > 127)        \
+      goto bad_tfm;     \
+                        \
+    fget();             \
+    a = a * 256 + fbyte;\
+  }                     \
 while (0)
 #define store_four_quarters(val)  \
 do                                \
   {                               \
-    tfm_temp = getc(tfm_file);    \
-    a = tfm_temp;                 \
-    qw.b0 = a;                    \
-    tfm_temp = getc(tfm_file);    \
-    b = tfm_temp;                 \
-    qw.b1 = b;                    \
-    tfm_temp = getc(tfm_file);    \
-    c = tfm_temp;                 \
-    qw.b2 = c;                    \
-    tfm_temp = getc(tfm_file);    \
-    d = tfm_temp;                 \
-    qw.b3 = d;                    \
+    fget(); a = fbyte; qw.b0 = a; \
+    fget(); b = fbyte; qw.b1 = b; \
+    fget(); c = fbyte; qw.b2 = c; \
+    fget(); d = fbyte; qw.b3 = d; \
     val = qw;                     \
   }                               \
 while (0)
+/* sec 0570 */
+#define check_byte_range(a) \
+do                          \
+{                           \
+  if ((a < bc) || (a > ec)) \
+    goto bad_tfm;           \
+}                           \
+  while (0)
 /* sec 0571 */
+#define store_scaled(a)                                       \
+do                                                            \
+{                                                             \
+  fget(); a = fbyte; fget(); b = fbyte;                       \
+  fget(); c = fbyte; fget(); d = fbyte;                       \
+  sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;\
+                                                              \
+  if (a == 0)                                                 \
+    a = sw;                                                   \
+  else if (a == 255)                                          \
+    a = sw - alpha;                                           \
+  else                                                        \
+    goto bad_tfm;                                             \
+}                                                             \
+while (0)
 /* sec 0573 */
-#define check_existence(a)    \
-do                            \
-{                             \
-  {                           \
-    if ((a < bc) || (a > ec)) \
-      goto bad_tfm;           \
-  }                           \
-                              \
-  qw = char_info(f, a);       \
-                              \
-  if (!(qw.b0 > 0))           \
-    goto bad_tfm;             \
-}                             \
+#define check_existence(a)  \
+do                          \
+{                           \
+  check_byte_range(a);      \
+                            \
+  qw = char_info(f, a);     \
+                            \
+  if (!char_exists(qw))     \
+    goto bad_tfm;           \
+}                           \
 while (0)
+/* sec 0576 */
+#define adjust(a) a[f] = a[f]
 /* sec 0585 */
 #define set1      128 // c[1]
 #define set2      129 // c[2]
@@ -1583,4 +1647,6 @@ while (0)
 #define immediate_code    4
 #define set_language_code 5
 /* sec 1371 */
-#define end_write_token (cs_token_flag + end_write)
\ No newline at end of file
+#define end_write_token (cs_token_flag + end_write)
+
+#endif
\ No newline at end of file
similarity index 94%
rename from src/texsourc/texmfmem.h
rename to src/texsourc/memory.h
index 82baca6..ead6eff 100644 (file)
@@ -20,9 +20,9 @@
 /*
   meaning      structure                      TeX                 Y&Y TeX
                ----------------------------------------------------------------------
-  integer      |            int            || 4: long           | 8: long long      |   min_quarterword 0
+  integer      |            int            || 4: long           | 8: long long      | min_quarterword 0
                ---------------------------------------------------------------------- max_quarterword FFFF
-  scaled       |            sc             || 4: long           | 8: long long      |   min_halfword
+  scaled       |            sc             || 4: long           | 8: long long      | min_halfword
                ----------------------------------------------------------------------
   glue_ratio   |            gr             || 4: float          | 8: double         |
                ----------------------------------------------------------------------
@@ -33,6 +33,8 @@
   quarter      |  b0  |  b1  |  b2  |  b3  || 1: unsigned char  | 2: unsigned short |
                ----------------------------------------------------------------------
 */
+#ifndef _YANDYTEX_MEMORY_H
+#define _YANDYTEX_MEMORY_H
 
 typedef struct
 {
@@ -66,4 +68,6 @@ typedef union
   two_halves hh;
   integer cint;
   four_quarters qqqq;
-} memory_word;
\ No newline at end of file
+} memory_word;
+
+#endif
\ No newline at end of file
index d14d957..80db414 100644 (file)
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301 USA.  */
 
-/* openinout.c: open input and output files. */
-
 #define EXTERN extern
 
-#include "texd.h"
+#include "yandytex.h"
 #undef name
 
-extern char * dvi_directory;
-extern char * log_directory;
-extern char * aux_directory;
-extern char * fmt_directory;
-extern char * pdf_directory;
-
 #define PATH_SEP        '/'
 #define PATH_SEP_STRING "/"
 
@@ -41,7 +33,6 @@ extern int shorten_file_name;
   extern void funny_core_dump(void);
 #endif
 
-
 #ifdef BUILDNAMEDIRECT
 char * xconcat (char * buffer, char * s1, char * s2)
 {
@@ -84,18 +75,17 @@ char * xconcat3 (char *buffer, char *s1, char *s2, char *s3)
 }
 #endif
 
-// assumes path does not end in PATH_SEP
-void patch_in_path (unsigned char *buffer, unsigned char *name, unsigned char *path)
+void patch_in_path (ASCII_code * buffer, ASCII_code *name, ASCII_code * path)
 {
   if (*path == '\0')
     strcpy((char *) buffer, (char *) name);
   else
-    xconcat3((char *) buffer, (char *) path, PATH_SEP_STRING, (char *) name);
+    xconcat3((char *) buffer, (char *) path, "/", (char *) name);
 }
 
-int qualified (unsigned char * name)
+int qualified (ASCII_code * name)
 {
-  if (strchr((char *) name, PATH_SEP) != NULL ||
+  if (strchr((char *) name, '/') != NULL ||
       strchr((char *) name, '\\') != NULL ||
       strchr((char *) name, ':') != NULL)
     return 1;
@@ -107,7 +97,7 @@ int qualified (unsigned char * name)
     (ii)  name not qualified
     (iii) ext match
 */
-int prepend_path_if (unsigned char *buffer, unsigned char *name, char *ext, unsigned char *path)
+int prepend_path_if(ASCII_code * buffer, ASCII_code * name, const char * ext, char *path)
 {
   if (path == NULL)
     return 0;
@@ -121,7 +111,7 @@ int prepend_path_if (unsigned char *buffer, unsigned char *name, char *ext, unsi
   if (strstr((char *) name, ext) == NULL)
     return 0;
 
-  patch_in_path(buffer, name, path);
+  patch_in_path(buffer, name, (ASCII_code *)path);
 
   return 1;
 }
@@ -161,10 +151,7 @@ void check_short_name (unsigned char *s)
 }
 
 /* Following works on both null-terminated names */
-/* reconvert 254 to '~' in file name 95/Sep/26 */
-/* reconvert 255 to ' ' in file name 95/Sep/26 */
-/* we do this in tex3.c start_input() -> scan_file_name() now 95/Sep/26 */
-/* kpathsea/tilde.c */
+
 void retwiddle (unsigned char *s)
 {
   while (*s != '\0')
@@ -178,14 +165,13 @@ void retwiddle (unsigned char *s)
   }
 }
 
-/* in lib/openclose.c */
-boolean open_input (FILE **f, path_constant_type path_index, char *fopen_mode)
+boolean open_input (FILE ** f, kpse_file_format_type file_fmt, const char * fopen_mode)
 {
   boolean openable = false;
   char * file_name = NULL;
 
 #if defined (FUNNY_CORE_DUMP) && !defined (BibTeX)
-  if (path_index == TEXINPUTPATH &&
+  if (file_fmt == kpse_tex_format &&
     strncmp(name_of_file + 1, "HackyInputFileNameForCoreDump.tex", 33) == 0)
     funny_core_dump();
 #endif
@@ -198,8 +184,7 @@ boolean open_input (FILE **f, path_constant_type path_index, char *fopen_mode)
 
   name_of_file[name_length + 1] = '\0';
 
-  /* reinsert '~' and ' ' in file names -  95/June/5 */
-  /* done late to prevent problems with  null_terminate / space_terminate */  
+  /* reinsert '~' and ' ' in file names */  
   if (pseudo_tilde != 0 || pseudo_space != 0)
     retwiddle(name_of_file + 1);
 
@@ -209,20 +194,7 @@ boolean open_input (FILE **f, path_constant_type path_index, char *fopen_mode)
   if (open_trace_flag)
     printf(" Open `%s' for input ", name_of_file + 1);
 
-  switch (path_index)
-  {
-    case TEXINPUTPATH:
-      file_name = kpse_find_file((const_string) name_of_file + 1, kpse_tex_format, 0);
-      break;
-
-    case TEXFORMATPATH:
-      file_name = kpse_find_file((const_string) name_of_file + 1, kpse_fmt_format, 0);
-      break;
-
-    case TFMFILEPATH:
-      file_name = kpse_find_file((const_string) name_of_file + 1, kpse_tfm_format, 0);
-      break;
-  }
+  file_name = kpse_find_file((const_string) name_of_file + 1, file_fmt, false);
 
   if (file_name != NULL)
   {
@@ -249,17 +221,15 @@ boolean open_input (FILE **f, path_constant_type path_index, char *fopen_mode)
     else
       name_length = strlen((char *) name_of_file + 1);
       
-    if (path_index == TFMFILEPATH)
+    if (file_fmt == kpse_tfm_format)
     {
-      tfm_temp = getc(*f);
+      fbyte = getc(*f);
     } 
 
     if (strstr((char *) name_of_file + 1, ".fmt") != NULL)
     {
       if (format_file == NULL)
-      {
         format_file = xstrdup((char *) name_of_file + 1);
-      }
 
 #ifdef COMPACTFORMAT
       gz_fmt_file = gzdopen(fileno(*f), "rb9");
@@ -274,18 +244,16 @@ boolean open_input (FILE **f, path_constant_type path_index, char *fopen_mode)
 
         if (file_offset + n > max_print_line)
         {
-          putc('\n', log_file);
+          (void) putc('\n', log_file);
           file_offset = 0;
         }
         else
-          putc(' ', log_file);
+          (void) putc(' ', log_file);
 
         fprintf(log_file, "(%s)", name_of_file + 1);
         file_offset += n + 3;
       }
     }
-/*    code added 98/Sep/29 to catch first file input */
-/*    is there a problem if this file bombs ? */
     else if (source_direct == NULL)
     {
       char *s;
@@ -337,7 +305,22 @@ int check_fclose (FILE * f)
   return 0;
 }
 
-boolean open_output (FILE **f, char *fopen_mode)
+char * xstrdup_name (void)
+{
+  if (qualified(name_of_file + 1))
+    *log_line = '\0';
+  else
+  {
+    (void) getcwd(log_line, sizeof(log_line));
+    strcat(log_line, PATH_SEP_STRING);
+  }
+
+  strcat(log_line, (char *) name_of_file + 1);
+  unixify(log_line);
+  return xstrdup(log_line);
+}
+
+boolean open_output (FILE ** f, const char * fopen_mode)
 {
   unsigned temp_length;
 
@@ -350,11 +333,11 @@ boolean open_output (FILE **f, char *fopen_mode)
   if (shorten_file_name)
     check_short_name(name_of_file + 1);
 
-  if (prepend_path_if(name_of_file + 1, name_of_file + 1, ".dvi", (unsigned char *) dvi_directory) ||
-      prepend_path_if(name_of_file + 1, name_of_file + 1, ".log", (unsigned char *) log_directory) ||
-      prepend_path_if(name_of_file + 1, name_of_file + 1, ".aux", (unsigned char *) aux_directory) ||
-      prepend_path_if(name_of_file + 1, name_of_file + 1, ".fmt", (unsigned char *) fmt_directory) ||
-      prepend_path_if(name_of_file + 1, name_of_file + 1, ".pdf", (unsigned char *) pdf_directory))
+  if (prepend_path_if(name_of_file + 1, name_of_file + 1, ".dvi", dvi_directory) ||
+      prepend_path_if(name_of_file + 1, name_of_file + 1, ".log", log_directory) ||
+      prepend_path_if(name_of_file + 1, name_of_file + 1, ".aux", aux_directory) ||
+      prepend_path_if(name_of_file + 1, name_of_file + 1, ".fmt", fmt_directory) ||
+      prepend_path_if(name_of_file + 1, name_of_file + 1, ".pdf", pdf_directory))
   {
     if (open_trace_flag)
       printf("After prepend %s\n", name_of_file + 1);
@@ -365,7 +348,6 @@ boolean open_output (FILE **f, char *fopen_mode)
 
   *f = fopen((char *) name_of_file + 1, fopen_mode);
 
-  /* Can't open as given.  Try the envvar.  */
   if (*f == NULL)
   {
     string temp_dir = kpse_var_value("TEXMFOUTPUT");
@@ -376,17 +358,17 @@ boolean open_output (FILE **f, char *fopen_mode)
       unsigned char temp_name[file_name_size];
       xconcat3((char *) temp_name, temp_dir, PATH_SEP_STRING, (char *) name_of_file + 1);
 #else
-      string temp_name = concat3 (temp_dir, PATH_SEP_STRING, name_of_file + 1);
+      string temp_name = concat3(temp_dir, PATH_SEP_STRING, name_of_file + 1);
 #endif
 
       if (deslash)
         unixify((char *) temp_name);
       
       /* but we can assume this is opening here for *output* */
-      *f = fopen((char*) temp_name, fopen_mode);
-      /* If this succeeded, change name_of_file accordingly.  */
+      *f = fopen((char *) temp_name, fopen_mode);
+      /* If this succeeded, change name_of_file accordingly. */
       if (*f)
-        strcpy((char*) name_of_file + 1, (char *) temp_name);
+        strcpy((char *) name_of_file + 1, (char *) temp_name);
 
 #ifndef BUILDNAMEDIRECT
       free (temp_name);
@@ -400,50 +382,14 @@ boolean open_output (FILE **f, char *fopen_mode)
 #endif
 
   if (strstr((char *) name_of_file + 1, ".dvi") != NULL)
-  {
-    if (qualified(name_of_file + 1))
-      *log_line = '\0';
-    else
-    {
-      getcwd(log_line, sizeof(log_line));
-      strcat(log_line, PATH_SEP_STRING);
-    }
-
-    strcat(log_line, (char*) name_of_file + 1);
-    unixify(log_line);
-    dvi_file_name = xstrdup(log_line);
-  }
+    dvi_file_name = xstrdup_name();
   else if (strstr((char *) name_of_file + 1, ".pdf") != NULL)
-  {
-    if (qualified(name_of_file + 1))
-      *log_line = '\0';
-    else
-    {
-      getcwd(log_line, sizeof(log_line));
-      strcat(log_line, PATH_SEP_STRING);
-    }
-
-    strcat(log_line, (char*) name_of_file + 1);
-    unixify(log_line);
-    pdf_file_name = xstrdup(log_line);
-  }
-  else if (strstr((char *)name_of_file + 1, ".log") != NULL)
-  {
-    if (qualified(name_of_file + 1))
-      *log_line = '\0';
-    else
-    {
-      getcwd(log_line, sizeof(log_line));
-      strcat(log_line, PATH_SEP_STRING);
-    }
-
-    strcat(log_line, (char *) name_of_file + 1);
-    unixify(log_line);
-    log_file_name = xstrdup(log_line);
-  }
+    pdf_file_name = xstrdup_name();
+  else if (strstr((char *) name_of_file + 1, ".log") != NULL)
+    log_file_name = xstrdup_name();
 
-  temp_length = strlen ((char *)name_of_file + 1);
-  name_of_file[temp_length+1] = ' ';
+  temp_length = strlen((char *) name_of_file + 1);
+  name_of_file[temp_length + 1] = ' ';
 
   if (*f)
     name_length = temp_length;
similarity index 99%
rename from src/texsourc/yandy_pool.c
rename to src/texsourc/pool.c
index 3481925..980fb76 100644 (file)
@@ -17,7 +17,7 @@
 
 #define EXTERN extern
 
-#include "texd.h"
+#include "yandytex.h"
 
 static const char * pool_file_arr[] =
 {
@@ -29,7 +29,7 @@ static const char * pool_file_arr[] =
 /* 0261 */  "", //"End of file on the terminal!",
 /* 0262 */  "", //"! ",
 /* 0263 */  "", //"(That makes 100 errors; please try again.)",
-/* 0264 */  "" "? ",
+/* 0264 */  "", // "? ",
 /* 0265 */  "", //"Type <return> to proceed, S to scroll future error messages,",
 /* 0266 */  "", //"R to run without stopping, Q to run quietly,",
 /* 0267 */  "", //"I to insert something, ",
@@ -268,8 +268,8 @@ static const char * pool_file_arr[] =
 /* 0500 */  "", //"hash size",
 /* 0501 */  "", //"csname",
 /* 0502 */  "", //"endcsname",
-/* 0503 */  "IMPOSSIBLE.",
-/* 0504 */  "NONEXISTENT.",
+/* 0503 */  "", //"IMPOSSIBLE.",
+/* 0504 */  "", //"NONEXISTENT.",
 /* 0505 */  "", //"accent",
 /* 0506 */  "", //"advance",
 /* 0507 */  "", //"afterassignment",
@@ -599,7 +599,7 @@ static const char * pool_file_arr[] =
 /* 0831 */  "", //"No pages of output.",
 /* 0832 */  "", //"Output written on ",
 /* 0833 */  "", //" page",
-/* 0834 */  ", ",
+/* 0834 */  "", //", ",
 /* 0835 */  "", //" bytes).",
 /* 0836 */  "", //"to",
 /* 0837 */  "", //"spread",
@@ -1083,7 +1083,7 @@ str_number load_pool_strings (integer spare_size)
   return g;
 }
 
-str_number make_string_pool (const char *s)
+str_number make_string_pool (const char * s)
 {
   int slen = strlen(s);
 
@@ -1097,4 +1097,14 @@ str_number make_string_pool (const char *s)
     pool_ptr += slen;
     return (make_string());
   }
+}
+
+str_number get_job_name (str_number job)
+{
+  str_number ret = job;
+
+  if (c_job_name != NULL)
+    ret = make_string_pool(c_job_name);
+
+  return ret;
 }
\ No newline at end of file
index 4d32ff9..ece8fdd 100644 (file)
@@ -1,5 +1,6 @@
 /* Copyright 2007 TeX Users Group
    Copyright 2014 Clerk Ma
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
@@ -17,9 +18,7 @@
 
 #define EXTERN extern
 
-#include "texd.h"
-
-#define PATH_SEP '/'
+#include "yandytex.h"
 
 // texk/web2c/lib/uexit.c
 void uexit (int unix_code)
@@ -37,7 +36,7 @@ void uexit (int unix_code)
 
   if (jump_used)
   {
-    printf("Jump Buffer already used\n");
+    printf("Jump Buffer already used.\n");
     exit(1);
   }
 
@@ -74,7 +73,7 @@ char * unixify (char * t)
     while (*s != '\0')
     {
       if (*s == '\\')
-        *s = PATH_SEP;
+        *s = '/';
 
       s++;
     }
@@ -86,34 +85,20 @@ char * unixify (char * t)
   return t;
 }
 
-char * md5_file_name(const char * file_name)
+char * md5_file_name (const char * file_name)
 {
-  md5_state_t md5_ship;
-  md5_byte_t  md5_data[1024];
-  md5_byte_t  md5_digest[16];
   static char md5_hex[33];
-  int         md5_len;
   FILE * ship_file;
-  int i;
 
   ship_file = fopen(file_name, "rb");
-
-  md5_init(&md5_ship);
-
-  while ((md5_len = fread(md5_data, 1, 1024, ship_file)) != 0)
-    md5_append(&md5_ship, md5_data, md5_len);
-
-  md5_finish(&md5_ship, md5_digest);
-
+  memset(md5_hex, 0, 33);
+  memcpy(md5_hex, md5_file(ship_file), 32);
   fclose(ship_file);
 
-  for (i = 0; i < 16; ++i)
-    sprintf(md5_hex + i * 2, "%02X", md5_digest[i]);
-
   return md5_hex;
 }
 
-char * md5_file(FILE * in_file)
+char * md5_file (FILE * in_file)
 {
   md5_state_t md5_ship;
   md5_byte_t  md5_data[1024];
diff --git a/src/texsourc/tex-extend.pool b/src/texsourc/tex-extend.pool
deleted file mode 100644 (file)
index 7c68d9b..0000000
Binary files a/src/texsourc/tex-extend.pool and /dev/null differ
index 2c36686..09d448c 100644 (file)
@@ -16,7 +16,7 @@
    02110-1301 USA.  */
 
 #define EXTERN extern
-#include "texd.h"
+#include "yandytex.h"
 
 /* sec 0058 */
 void print_ln (void)
@@ -24,19 +24,19 @@ void print_ln (void)
   switch (selector)
   {
     case term_and_log:
-      show_char('\n');
+      wterm_cr();
       term_offset = 0;
-      putc('\n', log_file);
+      wlog_cr();
       file_offset = 0;
       break;
 
     case log_only:
-      putc('\n', log_file);
+      wlog_cr();
       file_offset = 0;
       break;
 
     case term_only:
-      show_char('\n');
+      wterm_cr();
       term_offset = 0;
       break;
 
@@ -64,27 +64,27 @@ void print_char_ (ASCII_code s)
   switch (selector)
   {
     case term_and_log:
-      show_char(xchr[s]);
+      wterm(xchr[s]);
       incr(term_offset);
-      putc(xchr[s], log_file);
+      wlog(xchr[s]);
       incr(file_offset);
 
       if (term_offset == max_print_line)
       {
-        show_char('\n');
+        wterm_cr();
         term_offset = 0;
       }
       
       if (file_offset == max_print_line)
       {
-        putc('\n', log_file);
+        wlog_cr();
         file_offset = 0;
       }
 
       break;
 
     case log_only:
-      putc(xchr[s], log_file);
+      wlog(xchr[s]);
       incr(file_offset);
 
       if (file_offset == max_print_line)
@@ -93,7 +93,7 @@ void print_char_ (ASCII_code s)
       break;
 
     case term_only:
-      show_char(xchr[s]);
+      wterm(xchr[s]);
       incr(term_offset);
 
       if (term_offset == max_print_line)
@@ -214,7 +214,7 @@ void print_ (integer s)
   }
 }
 /* string version print. */
-void prints_ (const char *s)
+void prints_ (const char * s)
 {
   while (*s)
     print_char(*s++);
@@ -260,7 +260,7 @@ void print_esc (const char * s)
   prints(s);
 }
 /* sec 0064 */
-void print_the_digs_ (eight_bits k)
+void print_the_digs (eight_bits k)
 {
   while (k > 0)
   {
@@ -347,7 +347,7 @@ void print_cs_ (integer p)
   }
 }
 /* sec 0263 */
-void sprint_cs_(pointer p)
+void sprint_cs (pointer p)
 { 
   if (p < hash_base)
     if (p < single_base)
@@ -368,7 +368,7 @@ void sprint_cs_(pointer p)
   }
 }
 /* sec 0518 */
-void print_file_name_(integer n, integer a, integer e)
+void print_file_name (integer n, integer a, integer e)
 {
   slow_print(a);
   slow_print(n);
@@ -393,7 +393,8 @@ void print_write_whatsit_(const char * s, pointer p)
     print_int(write_stream(p)); 
   else if (write_stream(p) == 16)
     print_char('*');
-  else print_char('-');
+  else
+    print_char('-');
 }
 /* sec 0081 */
 void jump_out (void) 
@@ -403,10 +404,7 @@ void jump_out (void)
   {
     int code;
 
-#ifndef _WINDOWS
     fflush(stdout); 
-#endif
-
     ready_already = 0;
 
     if (trace_flag)
@@ -421,8 +419,6 @@ void jump_out (void)
   }
 }
 /* sec 0082 */
-// deal with error by asking for user response 0-9, D, E, H, I, X, Q, R, S
-// NOTE: this may JUMPOUT either via X, or because of too many errors
 void error (void)
 {
   ASCII_code c;
@@ -568,7 +564,7 @@ continu:
         case 'S':
           {
             error_count = 0; 
-            interaction = 0 + c - 81; /* Q = 0, R = 1, S = 2, T = 3 */
+            interaction = 0 + c - 'Q';
             prints("OK, entering ");
 
             switch (c)
@@ -596,14 +592,14 @@ continu:
 
         case 'X':
           {
-            interaction = 2;
+            interaction = scroll_mode;
             jump_out();
           }
           break;
 
         default:
           break;
-      }           /* end of switch analysing response character */
+      }
 
       {
         prints("Type <return> to proceed, S to scroll future error messages,");
@@ -625,7 +621,7 @@ continu:
   if (error_count == 100)
   {
     print_nl("(That makes 100 errors; please try again.)");
-    history = 3;
+    history = fatal_error_stop;
     jump_out();
   }
 
@@ -651,7 +647,7 @@ continu:
   print_ln();
 }
 /* sec 0093 */
-void fatal_error(const char * s)
+void fatal_error (const char * s)
 {
   normalize_selector();
   print_err("Emergency stop");
@@ -673,15 +669,15 @@ void overflow_(const char * s, integer n)
   if (!knuth_flag)
   {
     if (!strcmp(s, "pattern memory") && (n == trie_size))
-      printf("\n  (Maybe use -h=... on command line in ini-TeX)\n");
+      printf("\n  (Maybe use -h=... on command line in initex)\n");
     else if (!strcmp(s, "exception dictionary") && (n == hyphen_prime))
-      printf("\n  (Maybe use -e=... on command line in ini-TeX)\n");
+      printf("\n  (Maybe use -e=... on command line in initex)\n");
   }
 
   succumb();
 }
 /* sec 0095 */
-void confusion(const char * s)
+void confusion (const char * s)
 {
   normalize_selector();
 
@@ -713,7 +709,7 @@ boolean init_terminal (void)
     loc = first;
 
     while ((loc < last) && (buffer[loc]== ' '))
-      incr(loc);    // step over initial white space
+      incr(loc);
 
     if (loc < last)
       return true;
@@ -728,7 +724,7 @@ boolean init_terminal (void)
 
     if (!flag)
     {
-      show_char('\n');
+      wterm_cr();
       puts("! End of file on the terminal... why?\n");
       return false;
     }
@@ -853,7 +849,7 @@ void print_roman_int_(integer n)
   pool_pointer j, k;
   nonnegative_integer u, v;
 
-  j = str_start[260]; /*  m2d5c2l5x2v5i */
+  j = str_start[260]; /* m2d5c2l5x2v5i */
   v = 1000;
 
   while (true)
@@ -903,7 +899,7 @@ void print_current_string (void)
 }
 
 /* sec 0071 */
-void term_input(void)
+void term_input (void)
 { 
   integer k;
   boolean flag;
@@ -1144,7 +1140,7 @@ halfword badness_(scaled t, scaled s)
 }
 /* sec 0114 */
 #ifdef DEBUG
-void print_word_(memory_word w)
+void print_word (memory_word w)
 { 
   print_int(w.cint); 
   print_char(' ');
@@ -1358,7 +1354,7 @@ void flush_list_(pointer p)
 { 
   pointer q, r;
 
-  if (p != 0)              /* null !!! */
+  if (p != 0)
   {
     r = p;
 
@@ -1370,7 +1366,7 @@ void flush_list_(pointer p)
         decr(dyn_used);
 #endif
       }
-    while (!(r == 0));     /* r != null */
+    while (!(r == 0));
 
     link(q) = avail;
     avail = p;
@@ -1485,7 +1481,7 @@ restart:
     return 0;
   }
 
-  add_variable_space (block_size);
+  add_variable_space(block_size);
   goto restart; /* go try get_node again */
 
 found:
@@ -1680,7 +1676,7 @@ pointer new_penalty(integer m)
 
 #ifdef DEBUG
 /* sec 0167 */
-void check_mem(boolean print_locs)
+void check_mem (boolean print_locs)
 {
   pointer p, q;
   boolean clobbered;
@@ -1869,7 +1865,7 @@ void search_mem_(pointer p)
       print_char(')');
     }
 }
-#endif /* DEBUG */
+#endif
 /* sec 0174 */
 void short_display_(integer p)
 {
@@ -2214,7 +2210,7 @@ void show_node_list_(integer p)
     return; 
   }
 
-  n = 0; 
+  n = 0;
 
   while (p != 0)
   {
@@ -2686,4 +2682,4 @@ void show_node_list_(integer p)
 
     p = link(p);
   }
-}
+}
\ No newline at end of file
index 6849142..89bf452 100644 (file)
@@ -17,7 +17,7 @@
 
 #define EXTERN extern
 
-#include "texd.h"
+#include "yandytex.h"
 
 /* sec 0198 */
 void show_box_(pointer p)
@@ -2033,7 +2033,7 @@ void print_cmd_chr_ (quarterword cmd, halfword chr_code)
 }
 #ifdef STAT
 /* sec 0252 */
-void show_eqtb(pointer n)
+void show_eqtb (pointer n)
 { 
   if (n < active_base)
     print_char('?');
@@ -2283,7 +2283,7 @@ pointer id_lookup_(integer j, integer l)
         if (trace_flag)
         {
           str_pool[pool_ptr] = '\0';
-          printf(" tex1.c cs_count++ '%s' ", &str_pool[pool_ptr - l - d]);
+          printf(" tex1.c incr(cs_count): '%s' ", &str_pool[pool_ptr - l - d]);
         }
 #endif
       }
@@ -2402,7 +2402,7 @@ void geq_define_(pointer p, quarterword t, halfword e)
 void geq_word_define_(pointer p, integer w)
 {
   eqtb[p].cint = w;
-  xeq_level[p]= 1;
+  xeq_level[p]= level_one;
 }
 /* sec 0280 */
 void save_for_after (halfword t)
@@ -2415,5 +2415,4 @@ void save_for_after (halfword t)
     save_index(save_ptr) = t;
     incr(save_ptr);
   }
-}
-/* restore_trace_, unsave followed in the old tex1.c */
\ No newline at end of file
+}
\ No newline at end of file
index dd327fb..3f2ff0d 100644 (file)
@@ -17,7 +17,7 @@
 
 #define EXTERN extern
 
-#include "texd.h"
+#include "yandytex.h"
 
 /* following bit used to be end of tex1.c */
 #ifdef STAT
@@ -117,7 +117,6 @@ done:
     return;
   }
 }
-/* This is where the old tex2.c used to start */
 /* sec 0288 */
 void prepare_mag (void) 
 {
@@ -572,7 +571,7 @@ void begin_file_reading (void)
   index = in_open;
   line_stack[index] = line;
   start = first;
-  state = 1;
+  state = mid_line;
   name = 0;
 }
 /* sec 0329 */
@@ -1115,6 +1114,7 @@ void expand (void)
       case cs_name:
         r = get_avail();
         p = r;
+
         do
           {
             get_x_token();
@@ -1342,7 +1342,7 @@ void scan_optional_equals (void)
     back_input();
 }
 /* sec 0407 */
-boolean scan_keyword(const char * s)
+boolean scan_keyword (const char * s)
 {
   pointer p;
   pointer q;
@@ -1487,7 +1487,7 @@ void scan_font_ident (void)
   cur_val = f;
 }
 /* sec 0578 */
-void find_font_dimen(boolean writing)
+void find_font_dimen (boolean writing)
 {
   internal_font_number f;
   integer n;
@@ -1871,7 +1871,7 @@ void get_next (void)
 {
   integer k;
   halfword t;
-/* char cat; */
+  /* char cat; */
   int cat;
   ASCII_code c, cc;
   char d;
@@ -1988,7 +1988,7 @@ start_cs:
                     {
                       c = buffer[k + 1];
 
-                      if (c < 128)             /* ? */
+                      if (c < 128)
                       {
                         d = 2;
 
@@ -2152,7 +2152,7 @@ found:
         case skip_blanks + right_brace:
         case new_line + right_brace:
           {
-            state = 1;
+            state = mid_line;
             decr(align_state);
           }
           break;
index 1f59881..6a8013c 100644 (file)
@@ -17,7 +17,7 @@
 
 #define EXTERN extern
 
-#include "texd.h"
+#include "yandytex.h"
 
 /* sec 0440 */
 void scan_int (void)
@@ -138,6 +138,7 @@ void scan_int (void)
       }
       else
         cur_val = cur_val * radix + d;
+
       get_x_token();
     }
 
@@ -170,7 +171,7 @@ void scan_dimen (boolean mu, boolean inf, boolean shortcut)
 
   f = 0;
   arith_error = false;
-  cur_order = 0;
+  cur_order = normal;
   negative = false;
 
   if (!shortcut)
@@ -262,6 +263,7 @@ void scan_dimen (boolean mu, boolean inf, boolean shortcut)
             incr(k);
           }
         }
+
 done1:
         for (kk = k; kk >= 1; kk--)
         {
@@ -303,6 +305,7 @@ done1:
         else
           incr(cur_order);
       }
+
       goto attach_fraction;
     }
   }
@@ -1036,6 +1039,7 @@ void read_toks (integer n, pointer r)
 
         store_new_token(cur_tok);
       }
+
 done:
       end_file_reading();
     }
@@ -1065,7 +1069,7 @@ void pass_text (void)
       if (l == 0)
         goto done;
 
-      if (cur_chr == 2)
+      if (cur_chr == fi_code)
         decr(l);
     }
     else if (cur_cmd == if_test)
@@ -1076,7 +1080,7 @@ done:
   scanner_status = save_scanner_status;
 }
 /* sec 0497 */
-void change_if_limit_(small_number l, pointer p)
+void change_if_limit (small_number l, pointer p)
 {
   pointer q;
 
@@ -1104,7 +1108,6 @@ void change_if_limit_(small_number l, pointer p)
     }
   }
 }
-/* called from tex2.c */
 /* sec 0498 */
 void conditional (void)
 {
@@ -1136,16 +1139,7 @@ void conditional (void)
     case if_char_code:
     case if_cat_code:
       {
-        {
-          get_x_token();
-
-          if (cur_cmd == relax)
-            if (cur_chr == no_expand_flag)
-            {
-              cur_cmd = active_char;
-              cur_chr = cur_tok - cs_token_flag - active_base;
-            }
-        }
+        get_x_token_or_active_char();
 
         if ((cur_cmd > active_char) || (cur_chr > 255))
         {
@@ -1157,16 +1151,8 @@ void conditional (void)
           m = cur_cmd;
           n = cur_chr;
         }
-        {
-          get_x_token();
 
-          if (cur_cmd == relax)
-            if (cur_chr == no_expand_flag)
-            {
-              cur_cmd = active_char;
-              cur_chr = cur_tok - cs_token_flag - active_base;
-            }
-        }
+        get_x_token_or_active_char();
 
         if ((cur_cmd > active_char) || (cur_chr > 255))
         {
@@ -1426,13 +1412,8 @@ void begin_name (void)
   area_delimiter = 0;
   ext_delimiter = 0;
 }
-/* This gathers up a file name and makes a string of it */
-/* Also tries to break it into `file area' `file name' and `file extension' */
-/* Used by scan_file_name and prompt_file_name */
-/* We assume tilde has been converted to pseudo_tilde and space to pseudo_space */
-/* returns false if it is given a space character - end of file name */
 /* sec 0516 */
-boolean more_name_(ASCII_code c)
+boolean more_name (ASCII_code c)
 {
   if (quoted_file_name == false && c == ' ')
     return false;
@@ -1479,8 +1460,8 @@ void end_name (void)
   }
 #endif
 
-  if (area_delimiter == 0)   // no area delimiter ':' '/' or '\' found
-    cur_area = 335;     // "" default area 
+  if (area_delimiter == 0) // no area delimiter ':' '/' or '\' found
+    cur_area = 335;        // "" default area 
   else
   {
     cur_area = str_ptr;
@@ -1501,11 +1482,8 @@ void end_name (void)
     cur_ext = make_string();
   }
 }
-
-/* n current name, a current area, e current extension */
-/* result in name_of_file[] */
 /* sec 0519 */
-void pack_file_name_(str_number n, str_number a, str_number e)
+void pack_file_name (str_number n, str_number a, str_number e)
 {
   integer k;
   ASCII_code c;
@@ -1514,45 +1492,26 @@ void pack_file_name_(str_number n, str_number a, str_number e)
   k = 0;
 
   for (j = str_start[a]; j <= str_start[a + 1] - 1; j++)
-  {
-    c = str_pool[j];
-    incr(k);
-
-    if (k <= file_name_size)
-      name_of_file[k] = xchr[c];
-  }
+    append_to_name(str_pool[j]);
 
   for (j = str_start[n]; j <= str_start[n + 1] - 1; j++)
-  {
-    c = str_pool[j];
-    incr(k);
-
-    if (k <= file_name_size)
-      name_of_file[k] = xchr[c];
-  }
+    append_to_name(str_pool[j]);
 
   for (j = str_start[e]; j <= str_start[e + 1] - 1; j++)
-  {
-    c = str_pool[j];
-    incr(k);
-
-    if (k <= file_name_size)
-      name_of_file[k] = xchr[c];
-  }
+    append_to_name(str_pool[j]);
 
   if (k < file_name_size)
     name_length = k;
   else
     name_length = file_name_size - 1;
 
-/*  pad it out with spaces ... what for ? in case we modify and forget  ? */
   for (k = name_length + 1; k <= file_name_size; k++)
     name_of_file[k] = ' ';
 
-  name_of_file[file_name_size] = '\0';    /* paranoia 94/Mar/24 */
+  name_of_file[file_name_size] = '\0'; /* paranoia */
 
   {
-    name_of_file [name_length+1] = '\0';
+    name_of_file [name_length + 1] = '\0';
 
     if (trace_flag)
       printf(" pack_file_name `%s' (%lld) ", name_of_file + 1, name_length);
@@ -1575,34 +1534,14 @@ void pack_buffered_name_(small_number n, integer a, integer b)
 
   k = 0;
 
-/*  This loop kicks in when we want the default format name */
   for (j = 1; j <= n; j++)
-  {
-    c = xord[TEX_format_default[j]];
-    incr(k);
+    append_to_name(xord[TEX_format_default[j]]);
 
-    if (k <= file_name_size)
-      name_of_file[k] = xchr[c];
-  }
-/*  This loop kicks in when we want a specififed format name */
   for (j = a; j <= b; j++)
-  {
-    c = buffer[j];
-    incr(k);
-
-    if (k <= file_name_size)
-      name_of_file[k] = xchr[c];
-  }
+    append_to_name(buffer[j]);
 
-/*  This adds the extension from the default format name */
   for (j = format_default_length - 3; j <= format_default_length; j++)
-  {
-    c = xord[TEX_format_default[j]];
-    incr(k);
-
-    if (k <= file_name_size)
-      name_of_file[k] = xchr[c];
-  }
+    append_to_name(xord[TEX_format_default[j]]);
 
   if (k < file_name_size)
     name_length = k;
@@ -1642,7 +1581,7 @@ str_number make_name_string (void)
   }
 }
 /* sec 0525 */
-//str_number a_make_name_string_(alpha_file * f)
+//str_number a_make_name_string (alpha_file * f)
 str_number a_make_name_string_(void)
 {
   return make_name_string();
@@ -1659,9 +1598,6 @@ str_number w_make_name_string_(void)
 {
   return make_name_string();
 }
-
-/* Used by start_input to scan file name on command line */
-/* Also in tex8.c new_font_, open_or_close_in, and do_extension */
 /* sec 0526 */
 void scan_file_name (void)
 {
@@ -1693,7 +1629,7 @@ void scan_file_name (void)
       goto done; 
     } 
 
-    if (!more_name(cur_chr))    /* up to next white space */
+    if (!more_name(cur_chr))
       goto done;
 
     get_x_token();
@@ -1703,7 +1639,7 @@ done:
   end_name();
   name_in_progress = false;
 }
-/* argument is string .fmt, .log, or .dvi */
+/* argument is string .fmt, .log, .pdf, or .dvi */
 /* sec 0529 */
 void pack_job_name_(str_number s)
 {
@@ -1713,7 +1649,6 @@ void pack_job_name_(str_number s)
   pack_file_name(cur_name, cur_area, cur_ext);
 }
 /* sec 0530 */
-/* s - what can't be found, e - default */
 void prompt_file_name_(const char * s, str_number e) 
 {
   integer k;
@@ -1735,22 +1670,17 @@ void prompt_file_name_(const char * s, str_number e)
   print_nl("Please type another ");
   prints(s); 
 
-  if (interaction < 2)
+  if (interaction < scroll_mode)
   {
     fatal_error("*** (job aborted, file error in nonstop mode)");
     return;
   }
 
   if (!knuth_flag)
-#ifdef _WINDOWS
-    show_line(" (or ^z to exit)", 0);
-#else
     show_line(" (or Ctrl-Z to exit)", 0);
-#endif
 
   prompt_input(": ");
 
-/*  should we deal with tilde and space in file name here ??? */
   {
     begin_name();
     k = first;
@@ -1773,14 +1703,15 @@ void prompt_file_name_(const char * s, str_number e)
     {
       if (k == last)
         goto done;
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-/*  convert tilde '~' to pseudo tilde */
+
+      /* convert tilde '~' to pseudo tilde */
       if (pseudo_tilde != 0 && buffer[k]== '~')
         buffer[k] = pseudo_tilde;
-/*  convert space ' ' to pseudo space */
+
+      /* convert space ' ' to pseudo space */
       if (pseudo_space != 0 && buffer[k]== ' ')
         buffer[k] = pseudo_space;
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
+
       if (!more_name(buffer[k]))
         goto done;
 
@@ -1791,7 +1722,7 @@ done:
     end_name();
   }
 
-  if (cur_ext == 335)    /* "" */
+  if (cur_ext == 335) /* "" */
     cur_ext = e;      /* use default extension */
 
   pack_file_name(cur_name, cur_area, cur_ext);
@@ -1807,7 +1738,8 @@ void open_log_file (void)
   old_setting = selector;
 
   if (job_name == 0)
-    job_name = 790;
+    job_name = get_job_name(790);
+    //job_name = 790;
 
   pack_job_name(".log");
 
@@ -1817,12 +1749,12 @@ void open_log_file (void)
     prompt_file_name("transcript file name", ".log");
   }
 
-  texmf_log_name = a_make_name_string(log_file);
+  log_name = a_make_name_string(log_file);
   selector = log_only;
   log_opened = true;
 
   {
-    fprintf(log_file, "%s (%s %s)", tex_version, application, yandyversion);
+    fprintf(log_file, "%s (%s %s)", banner, application, yandyversion);
 
     if (format_ident > 0)
       slow_print(format_ident);
@@ -1878,7 +1810,7 @@ void open_log_file (void)
   selector = old_setting + 2;
 }
 /* sec 0537 */
-void start_input(void)
+void start_input (void)
 {
   scan_file_name();
   pack_file_name(cur_name, cur_area, cur_ext); 
@@ -1887,7 +1819,7 @@ void start_input(void)
   {
     begin_file_reading();
     
-    if (a_open_in(cur_file, TEXINPUTPATH))
+    if (a_open_in(cur_file, kpse_tex_format))
       goto done;
 
     end_file_reading();
@@ -1899,7 +1831,8 @@ done:
 
   if (job_name == 0)
   {
-    job_name = cur_name;
+    job_name = get_job_name(cur_name);
+    //job_name = cur_name;
     open_log_file();
   }
 
@@ -1964,11 +1897,11 @@ internal_font_number read_font_info (pointer u, str_number nom, str_number aire,
 
   {
     read_sixteen(lf);
-    tfm_temp = getc(tfm_file);
+    fget();
     read_sixteen(lh);
-    tfm_temp = getc(tfm_file);
+    fget();
     read_sixteen(bc);
-    tfm_temp = getc(tfm_file);
+    fget();
     read_sixteen(ec);
 
     if ((bc > ec + 1) || (ec > 255))
@@ -1980,21 +1913,21 @@ internal_font_number read_font_info (pointer u, str_number nom, str_number aire,
       ec = 0;
     }
 
-    tfm_temp = getc(tfm_file);
+    fget();
     read_sixteen(nw);
-    tfm_temp = getc(tfm_file);
+    fget();
     read_sixteen(nh);
-    tfm_temp = getc(tfm_file);
+    fget();
     read_sixteen(nd);
-    tfm_temp = getc(tfm_file);
+    fget();
     read_sixteen(ni);
-    tfm_temp = getc(tfm_file);
+    fget();
     read_sixteen(nl);
-    tfm_temp = getc(tfm_file);
+    fget();
     read_sixteen(nk);
-    tfm_temp = getc(tfm_file);
+    fget();
     read_sixteen(ne);
-    tfm_temp = getc(tfm_file);
+    fget();
     read_sixteen(np);
 
     if (lf != 6 + lh + (ec - bc + 1) + nw + nh + nd + ni + nl + nk + ne + np)
@@ -2022,23 +1955,7 @@ internal_font_number read_font_info (pointer u, str_number nom, str_number aire,
       printf("font_ptr %lld font_max %d fmem_ptr %lld lf %d font_mem_size %ld\n",
           font_ptr, font_max, fmem_ptr, lf, font_mem_size);
 
-    print_err("Font ");
-    sprint_cs(u);
-    print_char('=');
-    print_file_name(nom, aire, 335); /* "" */
-
-    if (s >= 0)
-    {
-      prints(" at ");
-      print_scaled(s);
-      prints("pt");
-    }
-    else if (s != -1000)
-    {
-      prints(" scaled ");
-      print_int(- (integer) s);
-    }
-
+    start_font_error_message();
     prints(" not loaded: Not enough room left");
     help4("I'm afraid I won't be able to make use of this font,",
         "because my memory for character-size data is too small.",
@@ -2055,8 +1972,8 @@ internal_font_number read_font_info (pointer u, str_number nom, str_number aire,
   depth_base[f] = height_base[f] + nh;
   italic_base[f] = depth_base[f] + nd;
   lig_kern_base[f] = italic_base[f] + ni;
-  kern_base[f] = lig_kern_base[f] + nl - 256 * (128);
-  exten_base[f] = kern_base[f] + 256 * (128) + nk;
+  kern_base[f] = lig_kern_base[f] + nl - kern_base_offset;
+  exten_base[f] = kern_base[f] + kern_base_offset + nk;
   param_base[f] = exten_base[f] + ne;
 
   {
@@ -2064,22 +1981,22 @@ internal_font_number read_font_info (pointer u, str_number nom, str_number aire,
       goto bad_tfm;
     
     store_four_quarters(font_check[f]);
-    tfm_temp = getc(tfm_file);
+    fget();
     read_sixteen(z);
-    tfm_temp = getc(tfm_file);
-    z = z * 256 + tfm_temp;
-    tfm_temp = getc(tfm_file);
-    z =(z * 16) + (tfm_temp / 16);
+    fget();
+    z = z * 256 + fbyte;
+    fget();
+    z = (z * 16) + (fbyte / 16);
 
     if (z < unity)
       goto bad_tfm; 
 
     while (lh > 2)
     {
-      tfm_temp = getc(tfm_file);
-      tfm_temp = getc(tfm_file);
-      tfm_temp = getc(tfm_file);
-      tfm_temp = getc(tfm_file);
+      fget();
+      fget();
+      fget();
+      fget();
       decr(lh);
     }
 
@@ -2115,10 +2032,7 @@ internal_font_number read_font_info (pointer u, str_number nom, str_number aire,
 
       case list_tag:
         {
-          {
-            if ((d < bc) || (d > ec))
-              goto bad_tfm;
-          }
+          check_byte_range(d);
 
           while (d < k + bc - fmem_ptr)
           {
@@ -2132,7 +2046,7 @@ internal_font_number read_font_info (pointer u, str_number nom, str_number aire,
 
           if (d == k + bc - fmem_ptr)
             goto bad_tfm;
-not_found:; 
+not_found:;
         }
         break;
 
@@ -2156,24 +2070,7 @@ not_found:;
     }
 
     for (k = width_base[f]; k <= lig_kern_base[f] - 1; k++)
-    {
-      tfm_temp = getc(tfm_file);
-      a = tfm_temp;
-      tfm_temp = getc(tfm_file);
-      b = tfm_temp;
-      tfm_temp = getc(tfm_file);
-      c = tfm_temp;
-      tfm_temp = getc(tfm_file);
-      d = tfm_temp;
-      sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
-
-      if (a == 0)
-        font_info[k].cint = sw;
-      else if (a == 255)
-        font_info[k].cint = sw - alpha;
-      else
-        goto bad_tfm;
-    }
+      store_scaled(font_info[k].cint);
 
     if (font_info[width_base[f]].cint != 0)
       goto bad_tfm;
@@ -2193,7 +2090,7 @@ not_found:;
 
   if (nl > 0)
   {
-    for (k = lig_kern_base[f]; k <= kern_base[f] + 256 * (128) - 1; k++)
+    for (k = lig_kern_base[f]; k <= kern_base[f] + kern_base_offset - 1; k++)
     {
       store_four_quarters(font_info[k].qqqq);
 
@@ -2226,25 +2123,8 @@ not_found:;
       bch_label = 256 * c + d;
   }
 
-  for (k = kern_base[f] + 256 * (128); k <= exten_base[f] - 1; k++)
-  {
-    tfm_temp = getc(tfm_file);
-    a = tfm_temp;
-    tfm_temp = getc(tfm_file);
-    b = tfm_temp;
-    tfm_temp = getc(tfm_file);
-    c = tfm_temp;
-    tfm_temp = getc(tfm_file);
-    d = tfm_temp;
-    sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
-
-    if (a == 0)
-      font_info[k].cint = sw;
-    else if (a == 255)
-      font_info[k].cint = sw - alpha;
-    else
-      goto bad_tfm;
-  }
+  for (k = kern_base[f] + kern_base_offset; k <= exten_base[f] - 1; k++)
+    store_scaled(font_info[k].cint);
 
   for (k = exten_base[f]; k <= param_base[f] - 1; k++)
   {
@@ -2266,37 +2146,21 @@ not_found:;
     for (k = 1; k <= np; k++)
       if (k == 1)
       {
-        tfm_temp = getc(tfm_file);
-        sw = tfm_temp;
+        fget();
+        sw = fbyte;
 
         if (sw > 127)
           sw = sw - 256;
 
-        tfm_temp = getc(tfm_file);
-        sw = sw * 256 + tfm_temp;
-        tfm_temp = getc(tfm_file);
-        sw = sw * 256 + tfm_temp;
-        tfm_temp = getc(tfm_file);
-        font_info[param_base[f]].cint = (sw * 16) + (tfm_temp / 16);
+        fget();
+        sw = sw * 256 + fbyte;
+        fget();
+        sw = sw * 256 + fbyte;
+        fget();
+        font_info[param_base[f]].cint = (sw * 16) + (fbyte / 16);
       }
       else
-      {
-        tfm_temp = getc(tfm_file);
-        a = tfm_temp;
-        tfm_temp = getc(tfm_file);
-        b = tfm_temp;
-        tfm_temp = getc(tfm_file);
-        c = tfm_temp;
-        tfm_temp = getc(tfm_file);
-        d = tfm_temp;
-        sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
-
-        if (a == 0)
-          font_info[param_base[f] + k - 1].cint = sw;
-        else if (a == 255)
-          font_info[param_base[f] + k - 1].cint = sw - alpha;
-        else goto bad_tfm;
-      }
+        store_scaled(font_info[param_base[f] + k - 1].cint);
 
     if (feof(tfm_file))
       goto bad_tfm;
@@ -2335,11 +2199,11 @@ not_found:;
   font_bc[f] = bc;
   font_ec[f] = ec;
   font_glue[f] = 0;
-  char_base[f] = char_base[f];
-  width_base[f] = width_base[f];
-  lig_kern_base[f] = lig_kern_base[f];
-  kern_base[f] = kern_base[f];
-  exten_base[f] = exten_base[f];
+  adjust(char_base);
+  adjust(width_base);
+  adjust(lig_kern_base);
+  adjust(kern_base);
+  adjust(exten_base);
   decr(param_base[f]);
   fmem_ptr = fmem_ptr + lf;
   font_ptr = f;
@@ -2347,22 +2211,7 @@ not_found:;
   goto done;
 
 bad_tfm:
-  print_err("Font ");
-  sprint_cs(u); 
-  print_char('=');
-  print_file_name(nom, aire, 335);
-
-  if (s >= 0)
-  {
-    prints(" at ");
-    print_scaled(s);
-    prints("pt");
-  }
-  else if (s != -1000)
-  {
-    prints("scaled");
-    print_int(-(integer)s);
-  } 
+  start_font_error_message();
 
   if (file_opened)
     prints(" not loadable: Bad metric (TFM) file");
@@ -2381,4 +2230,4 @@ done:
     b_close(tfm_file);
 
   return g;
-}
+}
\ No newline at end of file
index 1c4420b..7f3ade6 100644 (file)
@@ -17,7 +17,7 @@
 
 #define EXTERN extern
 
-#include "texd.h"
+#include "yandytex.h"
 
 /* sec 0581 */
 void char_warning_(internal_font_number f, eight_bits c)
@@ -51,6 +51,7 @@ void char_warning_(internal_font_number f, eight_bits c)
       else
       {
         c = c - (c / 100) * 100;
+
         if (c / 10 > 0)
           print_char('0' + c / 10);
       }
@@ -65,8 +66,8 @@ void char_warning_(internal_font_number f, eight_bits c)
 
     if (show_missing)
     {
-      if (f != 0)
-        show_context();     /* not if its the nullfont */
+      if (f != null_font)
+        show_context();
     }
 
     if (show_missing == 0)
@@ -76,7 +77,7 @@ void char_warning_(internal_font_number f, eight_bits c)
   }
 }
 /* sec 0582 */
-halfword new_character_(internal_font_number f, eight_bits c)
+pointer new_character_(internal_font_number f, eight_bits c)
 {
   pointer p;
 
@@ -98,7 +99,7 @@ void dvi_swap (void)
 { 
   if (trace_flag)
   {
-    show_char('\n');
+    wterm_cr();
     printf("dvi_swap() %lld", dvi_gone);
   }
 
@@ -181,10 +182,10 @@ void dvi_font_def_(internal_font_number f)
     dvi_out(str_pool[k]);
 }
 /* sec 0607 */
-void zmovement(scaled w, eight_bits o)
+void movement (scaled w, eight_bits o)
 {
   small_number mstate;
-  halfword p, q;
+  pointer p, q;
   integer k;
 
   q = get_node(movement_node_size);
@@ -447,11 +448,11 @@ void special_out (pointer p)
 void write_out (pointer p)
 {
   char old_setting;
-/*  integer old_mode;  */
+  /* integer old_mode; */
   int old_mode;
-/*  small_number j;  */
+  /* small_number j; */
   int j;
-  halfword q, r;
+  pointer q, r;
 
   q = get_avail();
   info(q) = right_brace_token + '}';
@@ -506,7 +507,7 @@ void write_out (pointer p)
 /* sec 1373 */
 void out_what (pointer p)
 {
-/*  small_number j;  */
+  /* small_number j; */
   int j;
 
   switch (subtype(p))
@@ -534,7 +535,7 @@ void out_what (pointer p)
             cur_ext = open_ext(p); 
 
             if (cur_ext == 335) /* "" */
-              cur_ext = 785;    /* => ".tex" */
+              cur_ext = 785;    /* ".tex" */
 
             pack_file_name(cur_name, cur_area, cur_ext);
 
@@ -765,7 +766,7 @@ reswitch:
                   cur_h = cur_h + (lr / 2);
                 else
                 {
-                  lx =(2 * lr + lq + 1) / (2 * lq + 2);
+                  lx = (2 * lr + lq + 1) / (2 * lq + 2);
                   cur_h = cur_h + ((lr - (lq - 1)* lx) / 2);
                 }
               }
@@ -1091,7 +1092,7 @@ next_p:
   decr(cur_s);
 }
 /* sec 0638 */
-void dvi_ship_out_(halfword p)
+void dvi_ship_out_(pointer p)
 {
   integer page_loc;
   char j, k;
@@ -1247,7 +1248,7 @@ done:
   }
 #endif
 }
-void ship_out_(pointer p)
+void ship_out (pointer p)
 {
   switch (shipout_flag)
   {
@@ -1258,7 +1259,7 @@ void ship_out_(pointer p)
   }
 }
 /* sec 0645 */
-void scan_spec_(group_code c, boolean three_codes)
+void scan_spec (group_code c, boolean three_codes)
 {
   integer s;
   char spec_code;
@@ -1506,13 +1507,14 @@ reswitch:
           prints(" \\hbox (badness ");
           print_int(last_badness);
 
-          if (last_badness > 100) /* Y&Y TeX */
+          if (last_badness > 100)
             underfull_hbox++;
 
           goto common_ending;
         }
       }
-      goto exit;
+
+    goto exit;
   }
   else
   {
@@ -1574,7 +1576,8 @@ reswitch:
           goto common_ending;
         }
       }
-      goto exit;
+
+    goto exit;
   }
 
 common_ending:
@@ -1771,7 +1774,8 @@ pointer vpackage_(pointer p, scaled h, small_number m, scaled l)
           goto common_ending;
         }
       }
-      goto exit;
+
+    goto exit;
   }
   else
   {
@@ -1788,7 +1792,7 @@ pointer vpackage_(pointer p, scaled h, small_number m, scaled l)
     glue_sign(r) = shrinking;
 
     if (total_shrink[o] != 0)
-      glue_set(r) =(- (integer) x)/ ((double) total_shrink[o]);
+      glue_set(r) = (- (integer) x) / ((double) total_shrink[o]);
     else
     {
       glue_sign(r) = normal;
@@ -1824,6 +1828,7 @@ pointer vpackage_(pointer p, scaled h, small_number m, scaled l)
           goto common_ending;
         }
       }
+
     goto exit;
   }
 
@@ -1894,7 +1899,7 @@ pointer new_noad (void)
   return p;
 }
 /* sec 0688 */
-pointer new_style_(small_number s)
+pointer new_style (small_number s)
 {
   pointer p;
 
@@ -1927,7 +1932,7 @@ void show_info (void)
   show_node_list(info(temp_ptr));
 }
 /* sec 0704 */
-pointer fraction_rule_(scaled t)
+pointer fraction_rule (scaled t)
 {
   pointer p;
 
@@ -1938,7 +1943,7 @@ pointer fraction_rule_(scaled t)
   return p;
 }
 /* sec 0705 */
-pointer overbar_(pointer b, scaled k, scaled t)
+pointer overbar (pointer b, scaled k, scaled t)
 {
   pointer p, q;
 
@@ -1952,7 +1957,7 @@ pointer overbar_(pointer b, scaled k, scaled t)
   return vpackage(p, 0, 1, max_dimen);
 }
 /* sec 0709 */
-pointer char_box_(internal_font_number f, quarterword c)
+pointer char_box (internal_font_number f, quarterword c)
 {
   four_quarters q;
   eight_bits hd;
@@ -1972,7 +1977,7 @@ pointer char_box_(internal_font_number f, quarterword c)
   return b;
 }
 /* sec 0711 */
-void stack_into_box_(pointer b, internal_font_number f, quarterword c)
+void stack_into_box (pointer b, internal_font_number f, quarterword c)
 {
   pointer p;
 
@@ -1982,7 +1987,7 @@ void stack_into_box_(pointer b, internal_font_number f, quarterword c)
   height(b) = height(p);
 }
 /* sec 0712 */
-scaled height_plus_depth_(internal_font_number f, quarterword c)
+scaled height_plus_depth (internal_font_number f, quarterword c)
 {
   four_quarters q;
   eight_bits hd;
@@ -1993,7 +1998,7 @@ scaled height_plus_depth_(internal_font_number f, quarterword c)
   return char_height(f, hd) + char_depth(f, hd);
 }
 /* sec 0706 */
-pointer var_delimiter_(pointer d, small_number s, scaled v)
+pointer var_delimiter (pointer d, small_number s, scaled v)
 {
   pointer b;
   internal_font_number f, g;
@@ -2004,10 +2009,9 @@ pointer var_delimiter_(pointer d, small_number s, scaled v)
   four_quarters q;
   four_quarters r;
   eight_bits hd;
-/*  small_number z;  */
+  /* small_number z; */
   int z;
-/*  boolean large_attempt;  */
-  int large_attempt;
+  boolean large_attempt;
 
   f = null_font;
   w = 0;
@@ -2155,5 +2159,4 @@ found:
   shift_amount(b) = half(height(b) - depth(b)) - axis_height(s);
 
   return b;
-}
-/* rebox_ etc used to follow here in tex4.c */
\ No newline at end of file
+}
\ No newline at end of file
index b0b2443..992b520 100644 (file)
 
 #define EXTERN extern
 
-#include "texd.h"
+#include "yandytex.h"
 
 /* sec 0715 */
-pointer rebox_(pointer b, scaled w)
+pointer rebox (pointer b, scaled w)
 {
   pointer p;
   internal_font_number f;
@@ -58,9 +58,8 @@ pointer rebox_(pointer b, scaled w)
     return b;
   }
 }
-/* This is to be the start of tex5.c */
 /* sec 0716 */
-pointer math_glue_(pointer g, scaled m)
+pointer math_glue (pointer g, scaled m)
 {
   pointer p;
   integer n;
@@ -94,7 +93,7 @@ pointer math_glue_(pointer g, scaled m)
   return p;
 }
 /* sec 0717 */
-void math_kern_ (pointer p, scaled m)
+void math_kern (pointer p, scaled m)
 {
   integer n;
   scaled f;
@@ -124,7 +123,7 @@ void flush_math (void)
   incompleat_noad = 0;
 }
 /* sec 0720 */
-pointer clean_box_(pointer p, small_number s)
+pointer clean_box (pointer p, small_number s)
 {
   pointer q;
   small_number save_style;
@@ -486,7 +485,7 @@ void make_fraction (pointer q)
 
     delta = half(thickness(q));
     delta1 = clr - ((shift_up - depth(x)) - (axis_height(cur_size) + delta));
-    delta2 = clr -((axis_height(cur_size) - delta) - (height(z) - shift_down));
+    delta2 = clr - ((axis_height(cur_size) - delta) - (height(z) - shift_down));
 
     if (delta1 > 0)
       shift_up = shift_up + delta1;
@@ -1286,7 +1285,7 @@ void init_align (void)
   push_alignment();
   align_state = -1000000L;
 
-  if ((mode == mmode) && ((tail != cur_list.head_field) || (incompleat_noad != 0)))
+  if ((mode == mmode) && ((tail != head) || (incompleat_noad != 0)))
   {
     print_err("Improper ");
     print_esc("halign");
index 9e55def..9e9ff09 100644 (file)
@@ -17,7 +17,7 @@
 
 #define EXTERN extern
 
-#include "texd.h"
+#include "yandytex.h"
 
 /* sec 0785 */
 void align_peek (void)
@@ -37,13 +37,11 @@ restart:
 
     new_save_level(no_align_group);
 
-    if (mode == -1)
+    if (mode == -vmode)
       normal_paragraph();
   }
   else if (cur_cmd == right_brace)
-  {
     fin_align();
-  }
   else if ((cur_cmd == car_ret) && (cur_chr == cr_cr_code))
     goto restart;
   else
@@ -76,7 +74,7 @@ pointer finite_shrink (pointer p)
   return q;
 }
 /* sec 0829 */
-void try_break_ (integer pi, small_number break_type)
+void try_break (integer pi, small_number break_type)
 {
   pointer r;
   pointer prev_r;
@@ -234,7 +232,7 @@ continu:
                     break;
 
                   case penalty_node:
-                    ;
+                    do_nothing();
                     break;
 
                   case math_node:
@@ -350,7 +348,7 @@ done:;
         if (l > easy_line)
         {
           line_width = second_width;
-          old_l = max_halfword - 1; /*262142L*/ /* 2^18 - 2 ? */
+          old_l = max_halfword - 1;
         }
         else
         {
@@ -452,7 +450,7 @@ done1:;
           else
             d = d + final_hyphen_demerits;
 
-        if (abs(toint(fit_class)- toint(fitness(r))) > 1)
+        if (abs(toint(fit_class) - toint(fitness(r))) > 1)
           d = d + adj_demerits;
       }
 
@@ -532,6 +530,7 @@ done1:;
 
       if (node_r_stays_active)
         goto continu;
+
 deactivate:
       link(prev_r) = link(r);
       free_node(r, active_node_size);
@@ -586,7 +585,6 @@ exit:;
       }
 #endif
 }
-/* end of the old tex5.c here */
 /* sec 0877 */
 void post_line_break (integer final_widow_penalty)
 {
@@ -808,7 +806,7 @@ done1:
   prev_graf = best_line - 1;
 }
 /* sec 0906 */
-small_number reconstitute_(small_number j, small_number n, halfword bchar, halfword hchar)
+small_number reconstitute (small_number j, small_number n, halfword bchar, halfword hchar)
 {
   pointer p;
   pointer t;
@@ -1019,7 +1017,7 @@ continu:
           goto done;
         }
 
-    if (q.b0 >= stop_flag)
+    if (skip_byte(q) >= stop_flag)
       if (cur_rh == non_char)
         goto done;
       else
@@ -1056,16 +1054,16 @@ done:
 /* sec 0895 */
 void hyphenate (void)
 {
-/*  char i, j, l;  */
+  /* char i, j, l; */
   char i, j;
-  int l;              /* 95/Jan/7 */
+  int l;
   pointer q, r, s;
   halfword bchar;
   pointer major_tail, minor_tail;
-/*  ASCII_code c;  */
+  /* ASCII_code c; */
   int c;
   char c_loc;
-/*  integer r_count; */
+  /* integer r_count; */
   int r_count;
   pointer hyf_node;
   trie_pointer z;
@@ -1258,7 +1256,7 @@ common_ending:
       {
         link(s) = link(hold_head);
 
-        while (link(s) != 0) /* l.17903 */
+        while (link(s) != 0)
           s = link(s);
 
         if (odd(hyf[j - 1]))
@@ -1316,7 +1314,7 @@ common_ending:
               }
             }
 
-            if (hyf_node != 0) /* if hyf_node<>null then l.17956 */
+            if (hyf_node != 0)
             {
               hu[i] = c;
               l = i;
@@ -1327,7 +1325,7 @@ common_ending:
             post_break(r) = 0;
             c_loc = 0;
 
-            if (bchar_label[hf] != non_address) /* i.e. 0 --- 96/Jan/15 */
+            if (bchar_label[hf] != non_address)
             {
               decr(l);
               c = hu[l];
@@ -1349,14 +1347,14 @@ common_ending:
 
                   if (link(hold_head) != 0)     /* BUG FIX */
                   {
-                    if (minor_tail == 0) /* begin if minor_tail=null then */
+                    if (minor_tail == 0)
                       post_break(r) = link(hold_head);
                     else
                       link(minor_tail) = link(hold_head);
 
                     minor_tail = link(hold_head);
 
-                    while (link(minor_tail) != 0)    /* ??? */
+                    while (link(minor_tail) != 0)
                       minor_tail = link(minor_tail);
                   }
                 }
@@ -1512,6 +1510,7 @@ reswitch:
                   incr(v);
                 }
               while (!(u == str_start[k + 1]));
+
 found:
               q = hyph_list[h];
               hyph_list[h] = p;
@@ -1691,7 +1690,7 @@ pointer vert_break (pointer p, scaled h, scaled d)
     if (pi < inf_penalty)
     {
       if (cur_height < h)
-        if ((active_width[3] != 0) || (active_width[4] != 0) || (active_width[5]!= 0))
+        if ((active_width[3] != 0) || (active_width[4] != 0) || (active_width[5] != 0))
           b = 0;
         else
           b = badness(h - cur_height, active_width[2]);
@@ -1851,14 +1850,14 @@ void print_totals (void)
   print_plus(4, "fill");
   print_plus(5, "filll");
 
-  if (page_so_far[6] != 0)
+  if (page_shrink != 0)
   {
     prints(" minus ");
-    print_scaled(page_so_far[6]);
+    print_scaled(page_shrink);
   }
 }
 /* sec 0987 */
-void freeze_page_specs_(small_number s)
+void freeze_page_specs (small_number s)
 {
   page_contents = s;
   page_goal = vsize;
@@ -2072,6 +2071,7 @@ void fire_up (pointer c)
       bot_mark = mark_ptr(p);
       add_token_ref(bot_mark);
     }
+
     prev_p = p;
     p = link(prev_p);
   }
index 1a1d0eb..fb66760 100644 (file)
@@ -17,7 +17,7 @@
 
 #define EXTERN extern
 
-#include "texd.h"
+#include "yandytex.h"
 
 /* sec 0994 */
 void build_page (void)
@@ -26,7 +26,7 @@ void build_page (void)
   pointer q, r;
   integer b, c;
   integer pi;
-/*  unsigned char n; */
+  /* unsigned char n; */
   unsigned int n;
   scaled delta, h, w;
 
@@ -1433,7 +1433,7 @@ void do_endv (void)
   {
     end_graf();
 
-    if (fin_col ())
+    if (fin_col())
       fin_row();
   }
   else
@@ -1448,7 +1448,7 @@ void cs_error (void)
   error();
 }
 /* sec 1136 */
-void push_math_(group_code c)
+void push_math (group_code c)
 {
   push_nest();
   mode = -mmode;
@@ -1595,7 +1595,7 @@ done:;
       if (prev_graf + 2 >= n)
         p = par_shape_ptr + 2 * n;
       else
-        p = par_shape_ptr + 2 *(prev_graf + 2);
+        p = par_shape_ptr + 2 * (prev_graf + 2);
 
       s = mem[p - 1].cint;
       l = mem[p].cint;
@@ -1644,7 +1644,7 @@ void start_eq_no (void)
   }
 }
 /* sec 1151 */
-void scan_math_(pointer p)
+void scan_math (pointer p)
 {
   integer c;
 
@@ -1778,9 +1778,7 @@ void math_limit_switch (void)
 void scan_delimiter_(pointer p, boolean r)
 {
    if (r)
-   {
      scan_twenty_seven_bit_int();
-   }
    else
    {
      do
@@ -1876,7 +1874,7 @@ void append_choices (void)
   scan_left_brace();
 }
 /* sec 1184 */
-pointer fin_mlist_(pointer p)
+pointer fin_mlist (pointer p)
 {
   pointer q;
 
@@ -1950,7 +1948,7 @@ void build_choices (void)
 /* sec 1176 */
 void sub_sup (void)
 {
-/*  small_number t; */
+  /* small_number t; */
   int t;
   pointer p;
 
@@ -1981,6 +1979,7 @@ void sub_sup (void)
         print_err("Double subscript");
         help1("I treat `x_1_2' essentially like `x_1{}_2'.");
       }
+
       error();
     }
   }
index 6890b7b..0a9b49d 100644 (file)
@@ -17,7 +17,7 @@
 
 #define EXTERN extern
 
-#include "texd.h"
+#include "yandytex.h"
 
 /* sec 1181 */
 void math_fraction (void)
@@ -716,7 +716,7 @@ void alter_box_dimen (void)
     mem[box(b) + c].cint = cur_val;
 }
 /* sec 1257 */
-void new_font(small_number a)
+void new_font (small_number a)
 {
   pointer u;
   scaled s;
@@ -799,7 +799,7 @@ void new_font(small_number a)
     k2 = str_start[cur_name];
     l1 = length(cur_area);
     l2 = length(cur_name);
-    show_char('\n');
+    wterm_cr();
     puts("FONT ");
 
     for (i = 0; i < l1; i++)
@@ -835,6 +835,7 @@ void new_font(small_number a)
           {
             if (trace_flag)
               printf("SKIPPING %lld ", s);
+
             goto common_ending;
           }
         }
@@ -919,22 +920,22 @@ void open_or_close_in (void)
     scan_file_name();
     pack_file_name(cur_name, cur_area, cur_ext);
 
-    if ((cur_ext != 335) && a_open_in(read_file[n], TEXINPUTPATH))
+    if ((cur_ext != 335) && a_open_in(read_file[n], kpse_tex_format))
       read_open[n] = 1;
     else if ((cur_ext != 785) && (name_length + 5 < file_name_size))
     {
       strncpy((char *) name_of_file + name_length + 1, ".tex ", 5);
       name_length = name_length + 4;
 
-      if (a_open_in(read_file[n], TEXINPUTPATH))
+      if (a_open_in(read_file[n], kpse_tex_format))
         read_open[n] = just_open;
       else
       {
         name_length = name_length - 4;
         name_of_file[name_length + 1] = ' ';
 
-        if ((cur_ext == 335) && a_open_in(read_file[n], TEXINPUTPATH))
-          read_open[n] = 1;
+        if ((cur_ext == 335) && a_open_in(read_file[n], kpse_tex_format))
+          read_open[n] = just_open;
       }
     }
   }
@@ -1105,15 +1106,19 @@ common_ending:
     decr(error_count);
   }
   else if (tracing_online > 0)
+  {
     help3("This isn't an error message; I'm just \\showing something.",
       "Type `I\\show...' to show more (e.g., \\show\\cs,",
       "\\showthe\\count10, \\showbox255, \\showlists).");
+  }
   else
+  {
     help5("This isn't an error message; I'm just \\showing something.",
       "Type `I\\show...' to show more (e.g., \\show\\cs,",
       "\\showthe\\count10, \\showbox255, \\showlists).",
       "And type `I\\tracingonline=1\\show...' to show boxes and",
       "lists on your terminal as well as in the transcript file.");
+  }
 
   error();
 }
@@ -1129,14 +1134,12 @@ void new_whatsit_(small_number s, small_number w)
   tail = p;
 }
 /* sec 1350 */
-void new_write_whatsit_(small_number w)
+void new_write_whatsit (small_number w)
 {
   new_whatsit(cur_chr, w);
 
   if (w != write_node_size)
-  {
     scan_four_bit_int();
-  }
   else
   {
     scan_int();
@@ -1246,7 +1249,7 @@ void do_extension (void)
 /* sec 1376 */
 void fix_language (void)
 {
-/*  ASCII_code l;  */
+  /* ASCII_code l; */
   int l;
 
   if (language <= 0)
@@ -1499,7 +1502,7 @@ void handle_right_brace (void)
 void main_control (void) 
 {
   integer t;
-  integer bSuppress; /* 199/Jan/5 */
+  boolean bSuppress;
 
   if (every_job != 0)
     begin_token_list(every_job, every_job_text);
@@ -2145,15 +2148,15 @@ main_lig_loop_1:
   main_j = font_info[main_k].qqqq;
 
 main_lig_loop_2:
-  bSuppress = 0;
+  bSuppress = false;
 
   if (suppress_f_ligs && next_char(main_j) == cur_r && op_byte(main_j) == no_tag)
   {
     if (cur_l == 'f')
-      bSuppress = 1;
+      bSuppress = true;
   }
 
-  if (next_char(main_j) == cur_r && bSuppress == 0)
+  if (next_char(main_j) == cur_r && bSuppress == false)
     if (skip_byte(main_j) <= stop_flag)
     {
       if (op_byte(main_j) >= kern_flag)
index 12f3566..5e07d68 100644 (file)
@@ -17,9 +17,8 @@
 
 #define EXTERN extern
 
-#include "texd.h"
+#include "yandytex.h"
 
-/* end of the old tex8.c */
 /* sec 1284 */
 void give_err_help (void)
 {
@@ -47,24 +46,15 @@ boolean open_fmt_file (void)
       goto found;
   
     if (knuth_flag)
-    {
-      sprintf(log_line, "%s;%s\n", "Sorry, I can't find that format",
-        " will try the default.");
-      show_line(log_line, 1);
-    }
+      printf("%s;%s\n", "Sorry, I can't find that format", " will try the default.");
     else
     {
-      char *s = log_line;
-
       name_of_file[name_length + 1] = '\0';
-      sprintf(s, "%s (%s);%s\n", "Sorry, I can't find that format",
+      printf("%s (%s);%s\n", "Sorry, I can't find that format",
         name_of_file + 1, " will try the default."); 
       name_of_file[name_length + 1] = ' ';
-      s += strlen(s);
-      sprintf(s, "(Perhaps your %s environment variable is not set correctly)\n",
+      printf("(Perhaps your %s environment variable is not set correctly)\n",
         "TEXFORMATS");
-      s += strlen(s);
-      show_line(log_line, 1);
     }
 
     update_terminal();
@@ -75,21 +65,13 @@ boolean open_fmt_file (void)
   if (!w_open_in(fmt_file))
   {
     if (knuth_flag)
-    {
-      sprintf(log_line, "%s!\n", "I can't find the default format file");
-      show_line(log_line, 1);
-    }
+      printf("%s!\n", "I can't find the default format file");
     else
     {
-      char *s = log_line;
-
       name_of_file[name_length + 1] = '\0';
-      sprintf(s, "%s (%s)!\n", "I can't find the default format file", name_of_file + 1);
+      printf("%s (%s)!\n", "I can't find the default format file", name_of_file + 1);
       name_of_file[name_length + 1] = ' ';
-      s += strlen(s);
-      sprintf(s, "(Perhaps your %s environment variable is not set correctly)\n", "TEXFORMATS");
-      s += strlen(s);
-      show_line(log_line, 1);
+      printf("(Perhaps your %s environment variable is not set correctly)\n", "TEXFORMATS");
     }
 
     return false;
@@ -100,9 +82,6 @@ found:
 
   return true;
 }
-
-void show_font_info (void); // now in local.c
-extern int closed_already;  // make sure we don't try this more than once
 /* sec 1333 */
 void close_files_and_terminate (void)
 {
@@ -110,18 +89,16 @@ void close_files_and_terminate (void)
 
   if (closed_already++)
   {
-    puts("close_files_and_terminated already ");
-    return;     // sanity check
+    puts("close_files_and_terminated() already ");
+    return;
   }
 
   if (trace_flag)
-    puts("\nclose_files_and_terminate ");
+    puts("\nclose_files_and_terminate() ");
 
   for (k = 0; k <= 15; k++)
     if (write_open[k])
-    {
       a_close(write_file[k]);
-    }
 
 #ifdef STAT
   if (tracing_stats > 0 || verbose_flag != 0)
@@ -160,7 +137,7 @@ void close_files_and_terminate (void)
       fprintf(log_file, "%c%lld%s%lld%s", ' ', (fmem_ptr), " words of font info for ", (font_ptr - font_base), " font");
 
       if (font_ptr != 1)
-        putc('s', log_file);
+        wlog('s');
 
 #ifdef ALLOCATEFONT
       if (show_current)
@@ -169,10 +146,10 @@ void close_files_and_terminate (void)
 #endif
         fprintf(log_file, "%s%lu%s%d\n", ", out of ", font_mem_size, " for ", font_max - font_base);
 
-      fprintf(log_file, "%c%d%s", ' ', hyph_count, " hyphenation exception");
+      fprintf(log_file, "%c%lld%s", ' ', hyph_count, " hyphenation exception");
 
       if (hyph_count != 1)
-        putc('s', log_file);
+        wlog('s');
 
       fprintf(log_file, "%s%lld\n", " out of ", hyphen_prime);
       fprintf(log_file, " ");
@@ -250,9 +227,8 @@ void close_files_and_terminate (void)
           fprintf(log_file, "\n %d second pass (\\tolerance = %lld)", second_pass_count, tolerance);
 
         if (final_pass_count > 0 || emergency_stretch > 0)
-        {
-          fprintf(log_file, "\n %d third pass (\\emergencystretch = %lgpt)", final_pass_count, (double) emergency_stretch / 65536.0);
-        }
+          fprintf(log_file, "\n %d third pass (\\emergencystretch = %lgpt)",
+            final_pass_count, (double) emergency_stretch / 65536.0);
 
         if (paragraph_failed > 0)
           fprintf(log_file, "\n %d failed", paragraph_failed);
@@ -381,7 +357,7 @@ void close_files_and_terminate (void)
 
   if (log_opened)
   {
-    putc('\n', log_file);
+    wlog_cr();
     a_close(log_file);
     selector = selector - 2;
 
@@ -392,7 +368,7 @@ void close_files_and_terminate (void)
       if (full_file_name_flag && log_file_name != NULL)
         prints(log_file_name);
       else
-        slow_print(texmf_log_name);
+        slow_print(log_name);
 
       print_char('.');
     }
@@ -533,4 +509,4 @@ void debug_help (void)
     }
   }
 }
-#endif /* DEBUG */
+#endif
\ No newline at end of file
index a661e60..466bb8a 100644 (file)
-#ifndef _YANDYTEX_TEXD_H
-#define _YANDYTEX_TEXD_H
-
-#define ALLOCATEINI        /* allocate iniTeX (550 k) trie_c, trie_o, trie_l, trie_r, trie_hash, trie_taken */
-#define ALLOCATEMAIN       /* allocate main memory for TeX (2 Meg) zmem = zzzaa */
-#define ALLOCATEFONT       /* allocate font_info (800 k) (dynamically now) */
-#define ALLOCATETRIES      /* allocate hyphenation trie stuff (270 k) trie_trl, trie_tro, trie_trc */
-#define ALLOCATEHYPHEN     /* allocate hyphenation exception tables */
-#define VARIABLETRIESIZE   /* allow trie_size to be variable */
-#define ALLOCATESTRING     /* allocate strings and string pointers (184 k)str_pool & str_start */
-#define ALLOCATESAVESTACK  /* experiment to dynamically deal with save_stack 99/Jan/4 */
-#define ALLOCATEINPUTSTACK /* experiment to dynamically deal with input_stack 99/Jan/21 */
-#define ALLOCATENESTSTACK  /* experiment to dynamically deal with nest_stack 99/Jan/21 */
-#define ALLOCATEPARAMSTACK /* experiment to dynamically deal with param_stack 99/Jan/21 */
-#define ALLOCATEBUFFER     /* experiment to dynamically deal with input buffer 99/Jan/22 */
-#define INCREASEFIXED
-#define INCREASEFONTS
-#define INCREASETRIEOP
-#define COMPACTFORMAT
+/* Copyright 2014 Clerk Ma
 
-#define STAT
-#include "texmf.h"
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-#define file_name_size PATH_MAX
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-// #define max_halfword 65535L  /* for 32 bit memory word */
-#define min_halfword -2147483647L /* LONG_MIN, for 64 bit memory word (signed) */
-#define max_halfword  2147483647L /* LONG_MAX, for 64 bit memory word (signed) */
-
-#define block_size 1000 /* block_size for variable length node alloc */
-
-#define min_quarterword 0
-#ifdef INCREASEFONTS
-  #define max_quarterword 65535L
-#else
-  #define max_quarterword 255
-#endif
-
-#define default_mem_top 262140L  /* usual big TeX allocation 2 Meg bytes */
-/* #define default_mem_top 131070L */ /* usual big TeX allocation 1 Meg bytes */
-/* #define default_mem_top 65534L  */ /* usual small TeX allocation 0.5 Meg   */
-
-#define mem_bot 0
-
-#ifdef ALLOCATEMAIN
-  EXTERN integer mem_top;
-  #define max_mem_size (max_halfword / sizeof(memory_word) - 1)
-#else
-  #define mem_top 262140L
-#endif
-
-#ifdef ALLOCATEMAIN
-  EXTERN integer mem_max;
-#else
-  #define mem_max mem_top
-#endif
-
-#ifdef ALLOCATEMAIN
-  EXTERN integer mem_min;
-#else
-  #define mem_min 0
-#endif
-
-#ifdef ALLOCATEBUFFER
-  #define initial_buf_size   1000
-  #define increment_buf_size 2000
-  #define buf_size           2000000L
-  EXTERN ASCII_code *        buffer;
-#else
-  #define buf_size           20000
-  EXTERN ASCII_code          buffer[buf_size + 4];
-#endif
-
-EXTERN integer first; 
-EXTERN integer last; 
-EXTERN integer max_buf_stack; 
-
-#define error_line      79
-#define half_error_line 50
-#define max_print_line  79
-
-#ifdef INCREASEFIXED
-  #define max_in_open 127
-#else
-  #define max_in_open 15
-#endif
-
-#ifdef INCREASEFONTS
-  #define font_max 65535 //1023 (2^n - 1)
-#else
-  #define font_max 255
-#endif
-
-#ifdef ALLOCATEFONT
-  #define font_mem_size (max_halfword / sizeof(memory_word) - 1)
-#else
-  #define font_mem_size 100000L
-#endif
-
-#ifdef ALLOCATEFONT
-  #define initial_font_mem_size   20000
-  #define increment_font_mem_size 40000
-#endif
-
-#ifdef ALLOCATESTRING
-  #define max_strings (max_halfword / sizeof(pool_pointer) - 1)
-  #define pool_size (max_halfword - 1)
-#else
-  #define max_strings 16384
-  #define pool_size 124000L
-#endif
-
-#define string_vacancies 100000L
-
-#ifdef VARIABLETRIESIZE
-  EXTERN integer trie_size;
-  #define default_trie_size 60000
-#else
-  #define trie_size 30000
-#endif
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301 USA.  */
 
-#ifdef INCREASETRIEOP
-  #define trie_op_size      3001
-  #define neg_trie_op_size -3001
-  #define min_trie_op       0
-  #define max_trie_op       1000
-#else
-  #define trie_op_size      751
-  #define neg_trie_op_size -751
-  #define min_trie_op       0
-  #define max_trie_op       500
-#endif
-
-
-#define dvi_buf_size 16384
-
-#define hash_extra (255 - font_max)
-#define hash_prime 27197 // (prime ~ 85% * (hash_size + hash_extra))
-#define hash_size  97280 // 32768 9500 25000
-
-#if (hash_extra != 255 - font_max)
-  #error ERROR: hash_extra not equal to (255 - font_max)
-#endif
-
-/* sec 0113 */
-#ifdef INCREASEFONTS
-  typedef unsigned short quarterword;
-#else
-  typedef unsigned char quarterword;
-#endif
-/* possible alternative ? */
-/* min_halfword = 0 and double max_halfword ? */
-/* typedef unsigned long halfword; NO NO: since mem_min may be < 0 */
-/* sec 0113 */
-typedef int32_t halfword;
-typedef halfword pointer;
-typedef char two_choices;
-typedef char four_choices;
-/* sec 0113 */
-#include "texmfmem.h"
-#include "yandy_macros.h"
-/* sec 0150 */
-typedef char glue_ord; 
-/* sec 0212 */
-typedef struct
-{
-  int mode_field;
-  halfword head_field, tail_field;
-  integer pg_field, ml_field;
-  memory_word aux_field;
-} list_state_record;
-/* sec 0269 */
-typedef char group_code;
-/* sec 0300 */
-typedef struct
+#ifndef _YANDYTEX_TEXD_H
+#define _YANDYTEX_TEXD_H
+/* headers and pragmas */
+
+#ifdef _WIN32
+  #pragma warning(disable:4201) // nameless struct/union
+  #pragma warning(disable:4267)
+  #pragma warning(disable:4996) // a function that was marked with deprecated
+  #pragma warning(disable:4701) // potentially uninitialized local variable 'name' used
+  #pragma warning(disable:4135) // conversion between different integral types
+  #pragma warning(disable:4127) // conditional expression is constant
+#endif
+
+#include <stdarg.h>
+#include <setjmp.h>
+#include <time.h>
+#include <math.h>
+#include <signal.h>
+
+#include <kpathsea/c-auto.h>
+#include <kpathsea/c-std.h>
+#include <kpathsea/c-pathmx.h>
+#include <kpathsea/c-fopen.h>
+#include <kpathsea/c-ctype.h>
+#include <kpathsea/c-proto.h>
+#include <kpathsea/config.h>
+#include <kpathsea/getopt.h>
+#include <kpathsea/lib.h>
+#include <kpathsea/line.h>
+#include <kpathsea/readable.h>
+#include <kpathsea/types.h>
+#include <kpathsea/tex-file.h>
+#include <kpathsea/variable.h>
+#include <kpathsea/absolute.h>
+#ifdef _WIN32
+  #include <kpathsea/win32lib.h>
+#endif
+#include "zlib.h"
+#include "md5.h"
+
+typedef long long integer;
+typedef double    glue_ratio;
+typedef double    real;
+typedef FILE * alpha_file;
+typedef FILE * byte_file;
+typedef FILE * word_file;
+typedef unsigned char  ASCII_code;
+typedef unsigned short KANJI_code;
+typedef unsigned char  eight_bits;
+typedef unsigned short sixteen_bits;
+typedef integer pool_pointer;
+typedef integer str_number;
+typedef unsigned char packed_ASCII_code;
+typedef integer scaled;
+typedef integer nonnegative_integer;
+typedef unsigned char small_number;
+
+#ifdef link
+  #undef link
+#endif
+
+//#define abs(x)   ((integer)(x) >= 0 ? (integer)(x) : (integer)-(x))
+//#define fabs(x)  ((x) >= 0.0 ? (x) : -(x))
+#define chr(x)   (x)
+#define odd(x)   ((x) % 2)
+#define round(x) web2c_round((double) (x))
+#define decr(x)  --(x)
+#define incr(x)  ++(x)
+#define toint(x) ((integer) (x))
+
+EXTERN integer web2c_round (double r);
+EXTERN boolean open_input  (FILE ** f, kpse_file_format_type file_fmt, const char * fopen_mode);
+EXTERN boolean open_output (FILE ** f, const char * fopen_mode);
+EXTERN int check_fclose    (FILE * f);
+
+#define show_line(str, flag) (void) fputs(str, stdout)
+
+#define wterm(s)    (void) putc(s, stdout)
+#define wlog(s)     (void) putc(s, log_file)
+#define wterm_cr()  (void) putc('\n', stdout);
+#define wlog_cr()   (void) putc('\n', log_file);
+
+enum
 {
-  quarterword state_field, index_field; 
-  halfword start_field, loc_field, limit_field, name_field;
-} in_state_record; 
-/* sec 0548 */
-typedef integer internal_font_number;
-typedef integer font_index;
-/* sec 0594 */
-typedef integer dvi_index;
-/* sec 0920 */
-typedef integer trie_op_code;
-/* sec 0925 */
-typedef integer trie_pointer;
-typedef integer hyph_pointer;
-
-EXTERN integer bad;
-EXTERN ASCII_code xord[256];
-EXTERN ASCII_code xchr[256];
-EXTERN unsigned char name_of_file[file_name_size + 4];
-EXTERN integer name_length;
-
-#ifdef ALLOCATESTRING
-  #define initial_pool_size     40000
-  #define increment_pool_size   80000
-  EXTERN packed_ASCII_code *    str_pool;
-  #define initial_max_strings   5000
-  #define increment_max_strings 10000
-  EXTERN pool_pointer *         str_start;
-#else
-  EXTERN packed_ASCII_code      str_pool[pool_size + 1]; 
-  EXTERN pool_pointer           str_start[max_strings + 1]; 
-#endif
-
-EXTERN pool_pointer pool_ptr;
-EXTERN str_number   str_ptr;
-EXTERN pool_pointer init_pool_ptr;
-EXTERN str_number   init_str_ptr;
-
-#ifdef INITEX
-EXTERN alpha_file pool_file; 
-#endif
-
-EXTERN alpha_file log_file; 
-EXTERN int selector;
-EXTERN char dig[23 + 1];
-EXTERN integer tally;
-EXTERN integer term_offset;
-EXTERN integer file_offset;
-EXTERN ASCII_code trick_buf[error_line + 1];
-EXTERN integer trick_count;
-EXTERN integer first_count;
-EXTERN int interaction;
-EXTERN boolean deletions_allowed;
-EXTERN boolean set_box_allowed;
-EXTERN int history;
-EXTERN int error_count;
-EXTERN char * help_line[6];
-EXTERN int help_ptr;
-EXTERN boolean use_err_help;
-EXTERN volatile integer interrupt;
-EXTERN boolean OK_to_interrupt;
-EXTERN boolean arith_error;
-EXTERN scaled tex_remainder;
-EXTERN halfword temp_ptr;
-
-/* sec 0116 */
-#ifdef ALLOCATEMAIN
-  EXTERN memory_word * main_memory;
-  EXTERN memory_word * mem;
-#else
-  EXTERN memory_word zzzaa[mem_max - mem_bot + 1];
-  #define zmem (zzzaa - (int)(mem_bot))
-#endif
-
-EXTERN pointer lo_mem_max;
-EXTERN pointer hi_mem_min;
-EXTERN integer var_used, dyn_used;
-/* sec 0118 */
-EXTERN pointer avail;
-EXTERN pointer mem_end;
-EXTERN pointer mem_start;
-/* sec 0124 */
-EXTERN pointer rover;
-/* sec 0165 */
-/* NOTE: the following really also need to be dynamically allocated */
-#ifdef DEBUG
-  #ifdef ALLOCATEMAIN
-    EXTERN char * zzzab;
-  #else
-
-  EXTERN char
-/* #define freearr (zzzab - (int)(mem_min)) */
-/*  zzzab[mem_max - mem_min + 1];  */
-#define freearr (zzzab - (int)(mem_bot))
-  zzzab[mem_max - mem_bot + 1]; 
-#endif
-
-#ifdef ALLOCATEMAIN
-  EXTERN char *zzzac;
-#else
-/* EXTERN boolean */   /* save (4 - 1) * mem_max - mem_min */
-EXTERN char
-/* #define wasfree (zzzac - (int)(mem_min)) */
-#define wasfree (zzzac - (int)(mem_bot))
-/*  zzzac[mem_max - mem_min + 1];  */
-  zzzac[mem_max - mem_bot + 1]; 
-#endif
-
-EXTERN pointer was_mem_end, was_lo_max, was_hi_min;
-EXTERN boolean panicking;
-#endif /* DEBUG */
-
-EXTERN integer font_in_short_display;
-EXTERN integer depth_threshold;
-EXTERN integer breadth_max;
-EXTERN int shown_mode;
-EXTERN int old_setting;
-
-#ifdef INCREASEFONTS
-  #define eqtb_extra (font_max - 255 + hash_extra)
-#else
-  #define eqtb_extra 0
-#endif
-
-#if (eqtb_extra != 0)
-  #error ERROR: eqtb_extra is not zero (need hash_extra equal 255 - font_max)
-#endif
-
-#ifdef INCREASEFONTS
-  EXTERN memory_word eqtb[eqtb_size + 1 + eqtb_extra];
-#else
-  EXTERN memory_word eqtb[eqtb_size + 1];
-#endif
-
-#ifdef INCREASEFONTS
-  #define xeq_level (zzzad - (int_base + eqtb_extra))
-#else
-  #define xeq_level (zzzad - (int_base))
-#endif
-
-EXTERN quarterword zzzad[eqtb_size - int_base + 1];
-
-#ifdef ALLOCATEHASH
-  EXTERN two_halves *zzzae;
-  #define hash (zzzae - hash_base)
-#else
-  #ifdef INCREASEFONTS
-    EXTERN two_halves zzzae[undefined_control_sequence - hash_base + eqtb_extra];
-  #else
-    EXTERN two_halves zzzae[undefined_control_sequence - hash_base];
-  #endif
-
-  #define hash (zzzae - hash_base)
-#endif
-
-EXTERN pointer hash_used;
-EXTERN boolean no_new_control_sequence;
-EXTERN integer cs_count;
-
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-/* using allocated save stack slows it down 1% to 2%                       */
-/* despite reallocation, we still limit it to something finite             */
-/* to avoid soaking up all of machine memory in case of infinite loop      */
-#ifdef ALLOCATESAVESTACK
-  #define save_size           65536
-  #define initial_save_size   1000
-  #define increment_save_size 2000
-  EXTERN memory_word * save_stack;
-#else
-  #define save_size 8000
-  EXTERN memory_word save_stack[save_size + 1];
-#endif
-
-EXTERN integer save_ptr;
-EXTERN integer max_save_stack;
-EXTERN int cur_level;
-EXTERN int cur_group;
-EXTERN integer cur_boundary;
-EXTERN integer mag_set;
-EXTERN int cur_cmd;
-EXTERN halfword cur_chr;
-EXTERN pointer cur_cs;
-EXTERN halfword cur_tok;
-
-#ifdef ALLOCATENESTSTACK
-  #define nest_size           65536
-  #define initial_nest_size   100
-  #define increment_nest_size 200
-  EXTERN list_state_record * nest;
-#else
-  #define nest_size 200
-  EXTERN list_state_record nest[nest_size + 1];
-#endif
-
-EXTERN integer nest_ptr;
-EXTERN integer max_nest_stack;
-EXTERN list_state_record cur_list;
-
-#ifdef ALLOCATEPARAMSTACK
-  #define param_size           65536
-  #define initial_param_size   100
-  #define increment_param_size 200
-  EXTERN pointer * param_stack;
-#else
-  #define param_size 500
-  EXTERN pointer param_stack[param_size + 1];
-#endif
-
-EXTERN integer param_ptr;
-EXTERN integer max_param_stack;
-
-#ifdef ALLOCATEINPUTSTACK
-  #define stack_size           65536
-  #define initial_stack_size   100
-  #define increment_stack_size 200
-  EXTERN in_state_record * input_stack;
-#else
-  #define stack_size 800
-  EXTERN in_state_record input_stack[stack_size + 1];
-#endif
-
-EXTERN integer input_ptr;
-EXTERN integer max_in_stack;
-EXTERN integer high_in_open;
-EXTERN in_state_record cur_input;
-EXTERN int in_open;
-EXTERN integer open_parens;
-EXTERN integer max_open_parens;
-EXTERN alpha_file input_file[max_in_open + 1];
-EXTERN integer line;
-EXTERN integer line_stack[max_in_open + 1];
-EXTERN int scanner_status;
-EXTERN pointer warning_index;
-EXTERN pointer def_ref;
-EXTERN integer align_state;
-EXTERN integer base_ptr;
-EXTERN pointer par_loc;
-EXTERN halfword par_token;
-EXTERN boolean force_eof;
-EXTERN pointer cur_mark[6];
-EXTERN int long_state;
-EXTERN pointer pstack[10];
-EXTERN int cur_val;
-EXTERN int cur_val_level;
-EXTERN int radix;
-EXTERN int cur_order;
-EXTERN alpha_file read_file[16];
-EXTERN char read_open[20];
-EXTERN pointer cond_ptr;
-EXTERN int if_limit;
-EXTERN int cur_if;
-EXTERN integer if_line;
-EXTERN integer skip_line;
-EXTERN str_number cur_name;
-EXTERN str_number cur_area;
-EXTERN str_number cur_ext;
-EXTERN pool_pointer area_delimiter;
-EXTERN pool_pointer ext_delimiter;
-EXTERN integer format_default_length;
-EXTERN char * TEX_format_default;
-EXTERN boolean name_in_progress;
-EXTERN boolean log_opened;
-EXTERN boolean quoted_file_name;
-EXTERN str_number job_name;
-EXTERN str_number output_file_name;
-EXTERN str_number texmf_log_name;
-EXTERN byte_file dvi_file;
-EXTERN byte_file tfm_file;
-EXTERN byte_file pdf_file;
-EXTERN char * dvi_file_name;
-EXTERN char * pdf_file_name;
-EXTERN char * log_file_name;
-
-#ifdef ALLOCATEFONT
-  EXTERN memory_word * font_info;
-#else
-  EXTERN memory_word font_info[font_mem_size + 1];
-#endif
-
-EXTERN font_index fmem_ptr;
-EXTERN internal_font_number font_ptr;
-EXTERN internal_font_number frozen_font_ptr;
-EXTERN four_quarters font_check[font_max + 1];
-EXTERN scaled font_size[font_max + 1];
-EXTERN scaled font_dsize[font_max + 1];
-EXTERN font_index font_params[font_max + 1];
-EXTERN str_number font_name[font_max + 1];
-EXTERN str_number font_area[font_max + 1];
-EXTERN eight_bits font_bc[font_max + 1];
-EXTERN eight_bits font_ec[font_max + 1];
-EXTERN pointer font_glue[font_max + 1];
-EXTERN boolean font_used[font_max + 1];
-EXTERN integer hyphen_char[font_max + 1];
-EXTERN integer skew_char[font_max + 1];
-EXTERN font_index bchar_label[font_max + 1];
-EXTERN short font_bchar[font_max + 1];
-EXTERN short font_false_bchar[font_max + 1];
-EXTERN integer char_base[font_max + 1];
-EXTERN integer width_base[font_max + 1];
-EXTERN integer height_base[font_max + 1];
-EXTERN integer depth_base[font_max + 1];
-EXTERN integer italic_base[font_max + 1];
-EXTERN integer lig_kern_base[font_max + 1];
-EXTERN integer kern_base[font_max + 1];
-EXTERN integer exten_base[font_max + 1];
-EXTERN integer param_base[font_max + 1];
-EXTERN four_quarters null_character;
-EXTERN integer total_pages;
-EXTERN scaled max_v;
-EXTERN scaled max_h;
-EXTERN integer max_push;
-EXTERN integer last_bop;
-EXTERN integer dead_cycles;
-EXTERN boolean doing_leaders;
-EXTERN quarterword c, f;
-EXTERN scaled rule_ht, rule_dp, rule_wd;
-EXTERN pointer g;
-EXTERN integer lq, lr;
-EXTERN eight_bits dvi_buf[dvi_buf_size + 4];
-EXTERN dvi_index half_buf;
-EXTERN dvi_index dvi_limit;
-EXTERN dvi_index dvi_ptr;
-EXTERN integer dvi_offset;
-EXTERN integer pdf_offset;
-EXTERN integer dvi_gone;
-EXTERN pointer down_ptr, right_ptr;
-EXTERN scaled dvi_h, dvi_v;
-EXTERN scaled pdf_h, pdf_v;
-EXTERN scaled pdf_x, pdf_y;
-EXTERN scaled pdf_delta_h, pdf_delta_v;
-EXTERN scaled cur_h, cur_v;
-EXTERN internal_font_number dvi_f;
-EXTERN internal_font_number pdf_f;
-EXTERN integer cur_s;
-EXTERN scaled total_stretch[4], total_shrink[4];
-EXTERN integer last_badness;
-EXTERN pointer adjust_tail;
-EXTERN integer pack_begin_line;
-EXTERN two_halves empty_field;
-EXTERN four_quarters null_delimiter;
-EXTERN pointer cur_mlist;
-EXTERN int cur_style;
-EXTERN int cur_size;
-EXTERN scaled cur_mu;
-EXTERN boolean mlist_penalties;
-EXTERN internal_font_number cur_f;
-EXTERN quarterword cur_c;
-EXTERN four_quarters cur_i;
-EXTERN integer magic_offset;
-EXTERN pointer cur_align;
-EXTERN pointer cur_span;
-EXTERN pointer cur_loop;
-EXTERN pointer align_ptr;
-EXTERN pointer cur_head, cur_tail;
-EXTERN pointer just_box;
-EXTERN pointer passive;
-EXTERN pointer printed_node;
-EXTERN halfword pass_number;
-EXTERN scaled active_width[8];
-EXTERN scaled cur_active_width[8];
-EXTERN scaled background[8];
-EXTERN scaled break_width[8];
-EXTERN boolean no_shrink_error_yet;
-EXTERN pointer cur_p;
-EXTERN boolean second_pass;
-EXTERN boolean final_pass;
-EXTERN integer threshold;
-EXTERN integer minimal_demerits[4];
-EXTERN integer minimum_demerits;
-EXTERN pointer best_place[4];
-EXTERN halfword best_pl_line[4];
-EXTERN scaled disc_width;
-EXTERN halfword easy_line;
-EXTERN halfword last_special_line;
-EXTERN scaled first_width;
-EXTERN scaled second_width;
-EXTERN scaled first_indent;
-EXTERN scaled second_indent;
-EXTERN pointer best_bet;
-EXTERN integer fewest_demerits;
-EXTERN halfword best_line;
-EXTERN integer actual_looseness;
-EXTERN integer line_diff;
-EXTERN int hc[66];
-EXTERN int hn;
-EXTERN halfword ha, hb;
-EXTERN int hf;
-EXTERN int hu[66];
-EXTERN int hyf_char;
-EXTERN int cur_lang, init_cur_lang;
-EXTERN integer l_hyf, r_hyf;
-EXTERN integer init_l_hyf, init_r_hyf;
-EXTERN halfword hyf_bchar;
-EXTERN char hyf[68];
-EXTERN pointer init_list;
-EXTERN boolean init_lig;
-EXTERN boolean init_lft;
-EXTERN int hyphen_passed;
-EXTERN halfword cur_l, cur_r;
-EXTERN pointer cur_q;
-EXTERN pointer lig_stack;
-EXTERN boolean ligature_present;
-EXTERN boolean lft_hit, rt_hit;
-
-#ifdef ALLOCATETRIES
-  EXTERN halfword * trie_trl;
-  EXTERN halfword * trie_tro;
-  EXTERN quarterword * trie_trc;
-#else
-  EXTERN halfword trie_trl[trie_size + 1];
-  EXTERN halfword trie_tro[trie_size + 1];
-  EXTERN quarterword trie_trc[trie_size + 1];
-#endif
-
-EXTERN small_number hyf_distance[trie_op_size + 1];
-EXTERN small_number hyf_num[trie_op_size + 1];
-EXTERN trie_op_code hyf_next[trie_op_size + 1];
-EXTERN integer op_start[256];
-
-#ifdef ALLOCATEHYPHEN
-  #define default_hyphen_prime 1009
-  EXTERN str_number * hyph_word;
-  EXTERN halfword * hyph_list;
-  EXTERN integer hyphen_prime;
-#else
-  #define hyphen_prime 607
-  EXTERN str_number hyph_word[hyphen_prime + 1];
-  EXTERN halfword hyph_list[hyphen_prime + 1];
-#endif
-
-EXTERN int hyph_count;
-
-#ifdef INITEX
-  EXTERN integer trie_op_hash_C[trie_op_size - neg_trie_op_size + 1];
-  #define trie_op_hash (trie_op_hash_C - (int)(neg_trie_op_size)) 
-  EXTERN trie_op_code trie_used[256];
-  EXTERN ASCII_code trie_op_lang[trie_op_size + 1];
-  EXTERN trie_op_code trie_op_val[trie_op_size + 1];
-  EXTERN integer trie_op_ptr;
-#endif
-
-EXTERN trie_op_code max_op_used;
-
-#ifdef INITEX
-  #ifdef ALLOCATEINI
-    EXTERN packed_ASCII_code *trie_c; /* characters to match */
-    EXTERN trie_op_code *trie_o;      /* operations to perform */
-    EXTERN trie_pointer *trie_l;      /* left subtrie links */
-    EXTERN trie_pointer *trie_r;      /* right subtrie links */
-    EXTERN trie_pointer *trie_hash;   /* used to identify equivlent subtries */
-  #else
-    EXTERN packed_ASCII_code trie_c[trie_size + 1];
-    EXTERN trie_op_code trie_o[trie_size + 1];
-    EXTERN trie_pointer trie_l[trie_size + 1];
-    EXTERN trie_pointer trie_r[trie_size + 1];
-    EXTERN trie_pointer trie_hash[trie_size + 1];
-  #endif
-
-  EXTERN trie_pointer trie_ptr;
-#endif
-
-#ifdef INITEX
-  #ifdef ALLOCATEINI
-    EXTERN char * trie_taken;
-  #else
-    EXTERN boolean trie_taken[trie_size + 1];
-  #endif
-
-  EXTERN trie_pointer trie_min[256];
-  EXTERN trie_pointer trie_max;
-  EXTERN boolean trie_not_ready;
-#endif
-
-EXTERN scaled best_height_plus_depth;
-EXTERN pointer page_tail;
-EXTERN int page_contents;
-
-#if (half_error_line < 30) || (half_error_line > error_line - 15)
-  #error ERROR: (half_error_line < 30) || (half_error_line > error_line - 15) BAD 1
-#endif
-
-#if (max_print_line < 60)
-  #error ERROR: (max_print_line < 60) BAD 2
-#endif
-
-#if (hash_prime > hash_size)
-  #error ERROR: (hash_prime > hash_size) BAD 5
-#endif
-
-#if (max_in_open > 127)
-  #error ERROR: (max_in_open > 127) BAD 6
-#endif
-
-#if (min_quarterword > 0) || (max_quarterword < 127)
-  #error ERROR: (min_quarterword > 0) || (max_quarterword < 127) BAD 11
-#endif
-
-#if (min_halfword > 0) || (max_halfword < 32767)
-  #error ERROR:  (min_halfword > 0) || (max_halfword < 32767) BAD 12
-#endif
-
-#if (min_quarterword < min_halfword) || (max_quarterword > max_halfword)
-  #error ERROR: (min_quarterword < min_halfword) || (max_quarterword > max_halfword) BAD 13
-#endif
-
-#if (font_max > max_quarterword)
-  #error ERROR: (font_max > max_quarterword) BAD 15
-#endif
-
-#if (save_size > max_halfword)
-  #error ERROR: (save_size > max_halfword) BAD 17
-#endif
-
-#if (buf_size > max_halfword)
-  #error ERROR:  (buf_size > max_halfword) BAD 18
-#endif
-
-#if (max_quarterword - min_quarterword) < 255
-  #error (max_quarterword - min_quarterword) < 255 BAD 19
-#endif
-
-EXTERN scaled page_max_depth;
-EXTERN pointer best_page_break;
-EXTERN integer least_page_cost;
-EXTERN scaled best_size;
-EXTERN scaled page_so_far[8];
-EXTERN pointer last_glue;
-EXTERN integer last_penalty;
-EXTERN scaled last_kern;
-EXTERN integer insert_penalties;
-EXTERN boolean output_active;
-/* sec 1032 */
-EXTERN internal_font_number main_f;
-EXTERN four_quarters main_i;
-EXTERN four_quarters main_j;
-EXTERN font_index main_k;
-EXTERN pointer main_p;
-EXTERN integer main_s;
-EXTERN halfword bchar;
-EXTERN halfword false_bchar;
-EXTERN boolean cancel_boundary;
-EXTERN boolean ins_disc;
-/* sec 1074 */
-EXTERN pointer cur_box;
-EXTERN halfword after_token;
-EXTERN boolean long_help_seen;
-EXTERN str_number format_ident;
-EXTERN word_file fmt_file;
-EXTERN gzFile gz_fmt_file;
-/* sec 1331 */
-EXTERN integer ready_already;
-/* sec 1342 */
-EXTERN alpha_file write_file[16];
-EXTERN boolean write_open[18];
-/* sec 1345 */
-EXTERN pointer write_loc;
-EXTERN pool_pointer edit_name_start;
-EXTERN integer edit_name_length, edit_line;
-EXTERN int tfm_temp;
-/* new variables defined in local.c */
-EXTERN boolean is_initex;
-EXTERN boolean verbose_flag;
-EXTERN boolean trace_flag;
-EXTERN boolean open_trace_flag;
-EXTERN boolean knuth_flag;
-EXTERN boolean no_interrupts;
-EXTERN boolean c_style_flag;
-EXTERN boolean non_ascii;
-EXTERN boolean key_replace;
-EXTERN boolean deslash;
-EXTERN boolean trimeof;
-EXTERN boolean allow_patterns;
-EXTERN boolean show_fonts_used;
-EXTERN boolean reset_exceptions;
-EXTERN boolean show_current;
-EXTERN boolean return_flag;
-EXTERN boolean civilize_flag;
-EXTERN boolean show_numeric;
-EXTERN boolean restrict_to_ascii;
-EXTERN boolean show_missing;
-EXTERN boolean full_file_name_flag;
-EXTERN int mem_initex;
-EXTERN int mem_extra_high;
-EXTERN int mem_extra_low;
-EXTERN int new_hyphen_prime;
-EXTERN int missing_characters;
-EXTERN int show_in_hex;
-EXTERN int show_in_dos;
-EXTERN int show_fmt_flag;
-EXTERN int show_tfm_flag;
-EXTERN boolean truncate_long_lines;
-EXTERN boolean show_cs_names;
-EXTERN int tab_step;
-EXTERN int pseudo_tilde;
-EXTERN int pseudo_space;
-EXTERN boolean allow_quoted_names;
-EXTERN int default_rule;
-EXTERN char * format_file;
-EXTERN char * source_direct;
-EXTERN char * format_name;
-EXTERN boolean show_line_break_stats;
-EXTERN int first_pass_count;
-EXTERN int second_pass_count;
-EXTERN int final_pass_count;
-EXTERN int underfull_hbox;
-EXTERN int overfull_hbox;
-EXTERN int underfull_vbox;
-EXTERN int overfull_vbox;
-EXTERN int paragraph_failed;
-EXTERN int single_line;
-EXTERN FILE * errout;
-EXTERN int ignore_frozen;
-EXTERN boolean suppress_f_ligs;
-EXTERN int jump_used;
-EXTERN jmp_buf jumpbuffer;
-extern int current_pool_size;
-extern int current_max_strings;
-extern int current_mem_size;
-extern int current_font_mem_size;
-extern int current_save_size;
-extern int current_stack_size;
-extern int current_nest_size;
-extern int current_param_size;
-extern int current_buf_size;
-extern const char * tex_version;
-extern const char * application;
-extern const char * yandyversion;
-extern unsigned char wintodos[128];
-extern char log_line[MAXLINE];
-
-memory_word * allocate_main_memory(int size);
-memory_word * realloc_main(int lo_size, int hi_size);
-packed_ASCII_code * realloc_str_pool(int size);
-pool_pointer * realloc_str_start(int size);
-memory_word * realloc_save_stack(int size);
-list_state_record * realloc_nest_stack(int size);
-in_state_record * realloc_input_stack(int size);
-halfword * realloc_param_stack(int size);
-ASCII_code * realloc_buffer(int size);
-memory_word * realloc_font_info(int size);
-
-int realloc_hyphen(int hyphen_prime);
-int allocate_tries(int trie_max);
-void probe_memory(void);
-void print_cs_names (FILE * output, int pass);
-void perrormod(const char * s);
-char * grabenv(const char * varname);
-void flush_trailing_slash(char * directory);
-boolean prime(int x);
-int endit(int flag);
-
-void uexit (int unix_code);
-void t_open_in (void);
-
-
-void call_edit (ASCII_code *filename, pool_pointer fnstart,
-                integer fnlength, integer linenumber);
-
-void add_variable_space(int size);
-
-char *unixify (char * t);
-
-#include "coerce.h"
-
-/* sec 79 */
-extern void node_list_display(integer p);
-extern void do_nothing(void);
-extern void update_terminal(void);
-extern void check_full_save_stack(void);
-extern void push_input(void);
-extern void pop_input(void);
-extern void print_err (const char * s);
-extern void ensure_dvi_open(void);
-extern void write_dvi(size_t a, size_t b);
-extern void prompt_input(const char *s);
-extern void synch_h(void);
-extern void synch_v(void);
-extern void set_cur_lang(void);
-extern char * md5_file(FILE * in_file);
-extern void str_room(int val);
-extern void tail_append_(pointer val);
-#define tail_append(a) tail_append_((pointer) a)
-extern void tex_help(unsigned int n, ...);
-extern void append_char(ASCII_code c);
-extern void append_lc_hex(ASCII_code c);
-extern void succumb(void);
-extern void dvi_out_(ASCII_code op);
-#define dvi_out(op) dvi_out_((ASCII_code) (op))
-extern void free_avail_(halfword p);
-#define free_avail(p) free_avail_((halfword) (p))
-extern void flush_string (void);
-extern str_number load_pool_strings (integer spare_size);
-extern str_number make_string_pool (const char *s);
-extern void print_plus(int i, const char *s);
-#define help0()     tex_help(0)
-#define help1(...)  tex_help(1, __VA_ARGS__)
-#define help2(...)  tex_help(2, __VA_ARGS__)
-#define help3(...)  tex_help(3, __VA_ARGS__)
-#define help4(...)  tex_help(4, __VA_ARGS__)
-#define help5(...)  tex_help(5, __VA_ARGS__)
-#define help6(...)  tex_help(6, __VA_ARGS__)
-
-EXTERN boolean shipout_flag;
-#endif
+  out_dvi_flag = (1 << 0),
+  out_pdf_flag = (1 << 1),
+  out_xdv_flag = (1 << 2),
+  out_dpx_flag = (1 << 3),
+};
+
+EXTERN boolean input_line (FILE * f);
+#define input_ln(stream, flag) input_line(stream)
+/* sec 0027 */
+#define a_open_in(f, p) open_input  (&(f), p, FOPEN_R_MODE)
+#define a_open_out(f)   open_output (&(f), FOPEN_W_MODE)
+#define b_open_in(f)    open_input  (&(f), kpse_tfm_format, FOPEN_RBIN_MODE)
+#define b_open_out(f)   open_output (&(f), FOPEN_WBIN_MODE)
+#define w_open_in(f)    open_input  (&(f), kpse_fmt_format, FOPEN_RBIN_MODE)
+#define w_open_out(f)   open_output (&(f), FOPEN_WBIN_MODE)
+#define a_close(f)         (void) check_fclose(f)
+#define b_close         a_close
+#define w_close         a_close
+#define gz_w_close      gzclose
+
+/* If we're running under Unix, use system calls instead of standard I/O
+to read and write the output files; also, be able to make a core dump. */
+#ifndef unix
+  #define dumpcore() exit(1)
+#else /* unix */
+  #define dumpcore abort
+#endif
+
+#ifdef COMPACTFORMAT
+EXTERN int do_dump(char * p, int item_size, int nitems, gzFile out_file);
+EXTERN int do_undump(char * p, int item_size, int nitems, gzFile out_file);
+#define dump_file gz_fmt_file
+#else
+EXTERN int do_dump(char * p, int item_size, int nitems, FILE * out_file);
+EXTERN int do_undump(char * p, int item_size, int nitems, FILE * out_file);
+#define dump_file fmt_file
+#endif
+
+#define dumpthings(base, len)           \
+  do_dump   ((char *) &(base), sizeof (base), (int) (len), dump_file)
+
+#define undumpthings(base, len)         \
+  do_undump ((char *) &(base), sizeof (base), (int) (len), dump_file)
+
+/* Use the above for all the other dumping and undumping. */
+#define generic_dump(x)   dumpthings(x, 1)
+#define generic_undump(x) undumpthings(x, 1)
+
+#define dump_wd     generic_dump
+#define undump_wd   generic_undump
+#define dump_hh     generic_dump
+#define undump_hh   generic_undump
+#define dump_qqqq   generic_dump
+#define undump_qqqq generic_undump
+
+#define dump_int(x)       \
+do                        \
+  {                       \
+    integer x_val = (x);  \
+    generic_dump (x_val); \
+  }                       \
+while (0)
+
+#define undump_int  generic_undump
+
+#define undump_size(arg1, arg2, arg3, arg4)                     \
+do                                                              \
+{                                                               \
+  undump_int(x);                                                \
+                                                                \
+  if (x < arg1)                                                 \
+    goto bad_fmt;                                               \
+                                                                \
+  if (x > arg2)                                                 \
+  {                                                             \
+    fprintf(stdout, "%s%s\n", "---! Must increase the " , arg3);\
+    goto bad_fmt;                                               \
+  }                                                             \
+  else                                                          \
+    arg4 = x;                                                   \
+}                                                               \
+while (0)
+
+#endif
\ No newline at end of file
diff --git a/src/texsourc/texmf.h b/src/texsourc/texmf.h
deleted file mode 100644 (file)
index 484b0a1..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Main include file for TeX in C.  Originally by Tim Morgan,
-   December 23, 1987.  These routines are also used by Metafont (with
-   some name changes).
-
-   Copyright 1992 Karl Berry
-   Copyright 2007 TeX Users Group
-   Copyright 2014 Clerk Ma
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301 USA.  */
-
-#include "yandytex.h"
-
-enum
-{
-  out_dvi_flag = (1 << 0),
-  out_pdf_flag = (1 << 1),
-  out_xdv_flag = (1 << 2),
-  out_dpx_flag = (1 << 3),
-};
-
-/* Read a line of input as quickly as possible.  */
-extern boolean input_line (FILE * f);
-#define input_ln(stream, flag) input_line(stream)
-/* sec 0027 */
-#define a_open_in(f, p) open_input  (&(f), p, FOPEN_R_MODE)
-#define a_open_out(f)   open_output (&(f), FOPEN_W_MODE)
-#define b_open_in(f)    open_input  (&(f), TFMFILEPATH, FOPEN_RBIN_MODE)
-#define b_open_out(f)   open_output (&(f), FOPEN_WBIN_MODE)
-#define w_open_in(f)    open_input  (&(f), TEXFORMATPATH, FOPEN_RBIN_MODE)
-#define w_open_out      b_open_out
-#define a_close(f)         (void) check_fclose(f)
-#define b_close         a_close
-#define w_close         a_close
-#define gz_w_close      gzclose
-
-/* If we're running under Unix, use system calls instead of standard I/O
-   to read and write the output files; also, be able to make a core dump. */ 
-#ifndef unix
-  #define dumpcore() exit(1)
-#else /* unix */
-  #define dumpcore abort
-#endif
-
-#ifdef COMPACTFORMAT
-extern int do_dump   (char * p, int item_size, int nitems, gzFile out_file);
-extern int do_undump (char * p, int item_size, int nitems, gzFile out_file);
-#define dump_file gz_fmt_file
-#else
-extern int do_dump   (char * p, int item_size, int nitems, FILE * out_file);
-extern int do_undump (char * p, int item_size, int nitems, FILE * out_file);
-#define dump_file fmt_file
-#endif
-
-#define dumpthings(base, len)           \
-  do_dump   ((char *) &(base), sizeof (base), (int) (len), dump_file)
-
-#define undumpthings(base, len)         \
-  do_undump ((char *) &(base), sizeof (base), (int) (len), dump_file)
-
-/* Use the above for all the other dumping and undumping. */
-#define generic_dump(x)   dumpthings(x, 1)
-#define generic_undump(x) undumpthings(x, 1)
-
-#define dump_wd     generic_dump
-#define undump_wd   generic_undump
-#define dump_hh     generic_dump
-#define undump_hh   generic_undump
-#define dump_qqqq   generic_dump
-#define undump_qqqq generic_undump
-
-#define dump_int(x)         \
-  do                        \
-    {                       \
-      integer x_val = (x);  \
-      generic_dump (x_val); \
-    }                       \
-  while (0)
-
-#define undump_int  generic_undump
\ No newline at end of file
similarity index 90%
rename from src/texsourc/yandy_inlines.c
rename to src/texsourc/utils.c
index 98e3344..d849680 100644 (file)
 
 #define EXTERN extern
 
-#include "texd.h"
+#include "yandytex.h"
 
+/* sec 0016 */
 void do_nothing(void)
 {
   /* todo */
 }
-
+/* sec 0034 */
 void update_terminal(void)
 {
-#ifndef _WINDOWS
   fflush(stdout);
-#endif
-}
-
-void check_full_save_stack(void)
-{
-  if (save_ptr > max_save_stack)
-  {
-    max_save_stack = save_ptr;
-
-#ifdef ALLOCATESAVESTACK
-    if (max_save_stack > current_save_size - 6)
-      save_stack = realloc_save_stack(increment_save_size);
-    
-    if (max_save_stack > current_save_size - 6)
-    {
-      overflow("save size", current_save_size);
-      return;
-    }
-#else
-    if (max_save_stack > save_size - 6)
-    {
-      overflow("save size", save_size);
-      return;
-    }
-#endif
-  }
-}
-void write_dvi(size_t a, size_t b)
-{
-  if (fwrite((char *) &dvi_buf[a], sizeof(dvi_buf[a]),
-    ((b) - (a) + 1), dvi_file) != ((b) - (a) + 1))
-    FATAL_PERROR ("\n! dvi file");
-}
-void prompt_input(const char * s)
-{
-  prints(s);
-  term_input();
-}
-void set_cur_lang(void)
-{
-  if (language <= 0)
-    cur_lang = 0;
-  else if (language > 255)
-    cur_lang = 0;
-  else
-    cur_lang = language;
-}
-void free_avail_(halfword p)
-{
-  link(p) = avail;
-  avail = p;
-#ifdef STAT
-  decr(dyn_used);
-#endif
 }
 /* sec 0042 */
 void append_char (ASCII_code c)
@@ -117,6 +63,7 @@ void append_lc_hex (ASCII_code c)
   else
     append_char(c - 10 + 'a');
 }
+/* sec 0056 */
 /* sec 0073 */
 void print_err (const char * s)
 {
@@ -126,6 +73,12 @@ void print_err (const char * s)
   print_nl("! ");
   prints(s);
 }
+/* sec 0071 */
+void prompt_input(const char * s)
+{
+  prints(s);
+  term_input();
+}
 /* sec 0079 */
 void tex_help (unsigned int n, ...)
 {
@@ -150,9 +103,7 @@ void succumb (void)
     interaction = scroll_mode;
 
   if (log_opened)
-  {
     error();
-  }
 
 #ifdef DEBUG
   if (interaction > 0)
@@ -162,8 +113,17 @@ void succumb (void)
   history = error_stop_mode;
   jump_out();
 }
+/* sec 0121 */
+void free_avail_(halfword p)
+{
+  link(p) = avail;
+  avail = p;
+#ifdef STAT
+  decr(dyn_used);
+#endif
+}
 /* sec 0180 */
-void node_list_display(integer p)
+void node_list_display (integer p)
 {
   append_char('.');
   show_node_list(p);
@@ -175,6 +135,31 @@ void tail_append_ (pointer val)
   link(tail) = val;
   tail = link(tail);
 }
+/* sec 0273 */
+void check_full_save_stack(void)
+{
+  if (save_ptr > max_save_stack)
+  {
+    max_save_stack = save_ptr;
+
+#ifdef ALLOCATESAVESTACK
+    if (max_save_stack > current_save_size - 6)
+      save_stack = realloc_save_stack(increment_save_size);
+
+    if (max_save_stack > current_save_size - 6)
+    {
+      overflow("save size", current_save_size);
+      return;
+    }
+#else
+    if (max_save_stack > save_size - 6)
+    {
+      overflow("save size", save_size);
+      return;
+    }
+#endif
+  }
+}
 /* sec 0321 */
 void push_input(void)
 {
@@ -210,7 +195,7 @@ void pop_input(void)
   cur_input = input_stack[input_ptr];
 }
 /* sec 0532 */
-void ensure_dvi_open(void)
+void ensure_dvi_open (void)
 {
   if (output_file_name == 0)
   {
@@ -220,17 +205,24 @@ void ensure_dvi_open(void)
     pack_job_name(".dvi");
 
     while (!b_open_out(dvi_file))
-    {
       prompt_file_name("file name for output", ".dvi");
-    }
 
     output_file_name = b_make_name_string(dvi_file);
   }
 }
+/* sec 0564 */
+void fget (void)
+{
+  fbyte = getc(tfm_file);
+}
+/* sec 0597 */
+void write_dvi(size_t a, size_t b)
+{
+  if (fwrite((char *)&dvi_buf[a], sizeof(dvi_buf[a]),
+    (b - a + 1), dvi_file) != (b - a + 1))
+    FATAL_PERROR("\n! dvi file");
+}
 /* sec 0598 */
-md5_state_t dvi_md5_state;
-md5_byte_t  dvi_md5_digest[16];
-
 void dvi_out_(ASCII_code op)
 {
   dvi_buf[dvi_ptr] = op;
@@ -240,7 +232,7 @@ void dvi_out_(ASCII_code op)
     dvi_swap();
 }
 /* sec 0616 */
-void synch_h(void)
+void synch_h (void)
 {
   if (cur_h != dvi_h)
   {
@@ -249,7 +241,7 @@ void synch_h(void)
   }
 }
 /* sec 0616 */
-void synch_v(void)
+void synch_v (void)
 {
   if (cur_v != dvi_v)
   {
@@ -257,8 +249,18 @@ void synch_v(void)
     dvi_v = cur_v;
   }
 }
+/* sec 0934 */
+void set_cur_lang (void)
+{
+  if (language <= 0)
+    cur_lang = 0;
+  else if (language > 255)
+    cur_lang = 0;
+  else
+    cur_lang = language;
+}
 /* sec 0985 */
-void print_plus(int i, const char * s)
+void print_plus (int i, const char * s)
 {
   if (page_so_far[i] != 0)
   {
diff --git a/src/texsourc/yandy_backend_dpx.c b/src/texsourc/yandy_backend_dpx.c
deleted file mode 100644 (file)
index 13c7641..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright 2014 Clerk Ma
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301 USA.  */
-
-/* Y&Y TeX's DVIPDFMX backend. */
-
-#define EXTERN extern
-
-#include "texd.h"
-
-double dev_origin_x = 72.0;
-double dev_origin_y = 770.0;
-
-extern void pdf_init_fontmaps (void);
-
-void dpx_ship_out(pointer p)
-{
-//read_config_file(DPX_CONFIG_FILE);
-//pdf_font_set_dpi(font_dpi);
-//dpx_delete_old_cache(image_cache_life);
-//pdf_files_init();
-//pdf_doc_begin_page(1, dev_origin_x, dev_origin_y);
-//pdf_doc_end_page();
-}
-
-void dpx_hlist_out (void)
-{
-}
-
-void dpx_vlist_out (void)
-{
-}
index 0575e87..cf5f0d1 100644 (file)
 
 #define EXTERN
 
-#include "texd.h"
+#include "yandytex.h"
 
 #define dump_ext_length     4
 #define edit_value          tex_edit_value
 
 extern char * replacement[];
-int    gargc;   /* number of args - set to zero after initialization */
+int    gargc;
 char **gargv;
 
 int jump_used = 0;
@@ -76,17 +76,11 @@ void t_open_in (void)
 {
   int i;
 
-  buffer[first] = 0;  /* In case there are no arguments.  */
+  buffer[first] = 0;
 
-#ifdef MSDOS
   if (gargc > optind && optind > 0)
   {
     for (i = optind; i < gargc; i++)
-#else
-  if (gargc > 1)
-  {
-    for (i = 1; i < gargc; i++)
-#endif
     {
       if (allow_quoted_names && strchr(gargv[i], ' ') != NULL)
       {
@@ -105,10 +99,10 @@ void t_open_in (void)
 
   /* Find the end of the buffer.  */
   for (last = first; buffer[last]; ++last)
-    ;
+    do_nothing();
 
   for (--last; last >= first && ISBLANK (buffer[last]) && buffer[last] != '\r'; --last)
-    ;
+    do_nothing();
 
   last++;
 
@@ -121,7 +115,7 @@ void t_open_in (void)
   }
 }
 
-static void catch_interrupt(int err)
+static void catch_interrupt (int err)
 {
   (void) err;
   (void) signal(SIGINT, SIG_IGN);
@@ -172,27 +166,24 @@ void fix_date_and_time (void)
   }
 
   {
-#ifdef MSDOS
-    if (!no_interrupts)
+#ifdef _WIN32
+    if (signal(SIGINT, catch_interrupt) == SIG_ERR)
     {
-      if (signal(SIGINT, catch_interrupt) == SIG_ERR)
-      {
-        puts(" CTRL-C handler not installed\n");
-#ifndef _WINDOWS
-        uexit(EXIT_FAILURE);  /* do we care when run as DLL ? */
-#endif
-      }
+      puts(" CTRL-C handler not installed");
+      uexit(EXIT_FAILURE);
     }
 #else
     void (*old_handler)();
 
-    if ((old_handler = signal (SIGINT, catch_interrupt)) != SIG_DFL)
-      (void) signal (SIGINT, old_handler);
+    old_handler = signal(SIGINT, catch_interrupt);
+
+    if (old_handler != SIG_DFL)
+      (void) signal(SIGINT, old_handler);
 #endif
   }
 }
 
-/* I/O for TeX and Metafont.  */
+/* I/O for TeX and Metafont. */
 void complain_line (FILE * output)
 {
   show_line("\n", 0);
@@ -207,7 +198,7 @@ void complain_line (FILE * output)
   puts("  (File may have a line termination problem.)");
 }
 
-void show_bad_line (FILE *output, int first, int last)
+void show_bad_line (FILE * output, int first, int last)
 {
   int i, c, d, ch;
   char *s = log_line;
@@ -325,15 +316,12 @@ boolean input_line_finish (void)
    We set `last' to `first' and return `false' if we get to eof.
    Otherwise, we return `true' and set last = first +
    length(line except trailing whitespace).  */
-/* texmfmp.c */
 
 boolean input_line (FILE * f)
 {
-//  int ch, flag;         /* for restrict_to_ascii case 94/Jan/21 */
-  char *u;            /* 1994/July/3 for key_replace */
+  char * u;        /* 1994/July/3 for key_replace */
   int i = '\0';
 
-/*  and here is the long way of doing this */
   last = first;
 /*  following is new version with tab expansion and key replacement */
 /*  may want to expand out separately for speed 1994/July/3 */
@@ -398,6 +386,7 @@ boolean input_line (FILE * f)
 #endif
       {
         buffer[last++] = (ASCII_code) *u++;
+
 #ifdef ALLOCATEBUFFER
         if (last >= current_buf_size)
         {
@@ -478,16 +467,7 @@ boolean input_line (FILE * f)
 /* This string specifies what the `e' option does in response to an
    error message.  */
 
-static char *edit_value = "c:\\yandy\\WinEdt\\WinEdt.exe [Open('%s');SelLine(%d,7)]";
-
-/* This procedure is due to sjc@s1-c.  TeX (or Metafont) calls it when
-   the user types `e' in response to an error, invoking a text editor on
-   the erroneous source file.  FNSTART is how far into STRINGPOOL the
-   actual filename starts; FNLENGTH is how long the filename is.
-   
-   See ../site.h for how to set the default, and how to override it.  */
-
-/* called from close_files_and_terminate in  tex9.c */
+static char * edit_value = "c:\\yandy\\WinEdt\\WinEdt.exe [Open('%s');SelLine(%d,7)]";
 
 void call_edit (ASCII_code *stringpool, pool_pointer fnstart, integer fnlength, integer linenumber)
 {
@@ -503,8 +483,8 @@ void call_edit (ASCII_code *stringpool, pool_pointer fnstart, integer fnlength,
 
   if (log_opened)
   {
-    lgstart = str_start[texmf_log_name];
-    lglength = length(texmf_log_name);
+    lgstart = str_start[log_name];
+    lglength = length(log_name);
     log_file_name = stringpool + lgstart;
   }
   else
@@ -569,7 +549,7 @@ void call_edit (ASCII_code *stringpool, pool_pointer fnstart, integer fnlength,
         case 's':
           if (sdone)
           {
-#ifdef __WIN32
+#ifdef _WIN32
             sprintf(log_line, "! bad command syntax (%c).\n", 's'); 
             show_line(log_line, 1);
 #else
@@ -650,7 +630,7 @@ void call_edit (ASCII_code *stringpool, pool_pointer fnstart, integer fnlength,
     sprintf(log_line, "! Error in call: %s\n", command);
     show_line(log_line, 1);
 
-#ifdef __WIN32
+#ifdef _WIN32
     if (errno != 0)
       perrormod("! DOS says");
 #endif
@@ -733,9 +713,9 @@ static int swap_items (char *p, int nitems, int size)
 #endif /* not WORDS_BIGENDIAN and not NO_FMTBASE_SWAP */
 
 #ifdef COMPACTFORMAT
-int do_dump(char *p, int item_size, int nitems, gzFile out_file)
+int do_dump (char *p, int item_size, int nitems, gzFile out_file)
 #else
-int do_dump(char *p, int item_size, int nitems, FILE *out_file)
+int do_dump (char *p, int item_size, int nitems, FILE *out_file)
 #endif
 {
 #if !defined (WORDS_BIGENDIAN) && !defined (NO_FMTBASE_SWAP)
@@ -748,10 +728,8 @@ int do_dump(char *p, int item_size, int nitems, FILE *out_file)
   if ((int) fwrite(p, item_size, nitems, out_file) != nitems)
 #endif
   {
-    show_line("\n", 0);
-    sprintf(log_line, "! Could not write %d %d-byte item%s.\n",
+    printf("\n! Could not write %d %d-byte item%s.\n",
                nitems, item_size, (nitems > 1) ? "s" : "");
-    show_line(log_line, 1);
     uexit(EXIT_FAILURE);
   }
 
@@ -764,9 +742,9 @@ int do_dump(char *p, int item_size, int nitems, FILE *out_file)
 }
 
 #ifdef COMPACTFORMAT
-int do_undump(char *p, int item_size, int nitems, gzFile in_file)
+int do_undump (char *p, int item_size, int nitems, gzFile in_file)
 #else
-int do_undump(char *p, int item_size, int nitems, FILE *in_file)
+int do_undump (char *p, int item_size, int nitems, FILE *in_file)
 #endif
 {
 #ifdef COMPACTFORMAT
@@ -775,10 +753,8 @@ int do_undump(char *p, int item_size, int nitems, FILE *in_file)
   if ((int) fread((void *) p, item_size, nitems, in_file) != nitems)
 #endif
   {
-    show_line("\n", 0);
-    sprintf(log_line, "! Could not read %d %d-byte item%s.\n",
+    printf("\n! Could not read %d %d-byte item%s.\n",
                nitems, item_size, (nitems > 1) ? "s" : "");
-    show_line(log_line, 1);
     uexit(EXIT_FAILURE);
   }
 
@@ -819,4 +795,4 @@ void funny_core_dump (void)
       exit (1);
   }
 }
-#endif /* FUNNY_CORE_DUMP */
+#endif /* FUNNY_CORE_DUMP */
\ No newline at end of file
index c1efb97..1f25372 100644 (file)
-/* Copyright 2014 Clerk Ma
+#ifndef _YANDYTEX_H
+#define _YANDYTEX_H
 
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
+#define ALLOCATEINI        /* allocate iniTeX (550 k) trie_c, trie_o, trie_l, trie_r, trie_hash, trie_taken */
+#define ALLOCATEMAIN       /* allocate main memory for TeX (2 Meg) */
+#define ALLOCATEFONT       /* allocate font_info (800 k) (dynamically now) */
+#define ALLOCATETRIES      /* allocate hyphenation trie stuff (270 k) trie_trl, trie_tro, trie_trc */
+#define ALLOCATEHYPHEN     /* allocate hyphenation exception tables */
+#define VARIABLETRIESIZE   /* allow trie_size to be variable */
+#define ALLOCATESTRING     /* allocate strings and string pointers (184 k) str_pool & str_start */
+#define ALLOCATESAVESTACK  /* experiment to dynamically deal with save_stack   */
+#define ALLOCATEINPUTSTACK /* experiment to dynamically deal with input_stack  */
+#define ALLOCATENESTSTACK  /* experiment to dynamically deal with nest_stack   */
+#define ALLOCATEPARAMSTACK /* experiment to dynamically deal with param_stack  */
+#define ALLOCATEBUFFER     /* experiment to dynamically deal with input buffer */
+#define INCREASEFIXED      /* max_in_open */
+#define INCREASEFONTS      /* 65536 fonts */
+#define INCREASETRIEOP     /* tire_* */
+#define COMPACTFORMAT      /* .fmt file with zlib */
+#define STAT               /* TeX's statistics (tex82) */
+#define INITEX             /* invoke initex */
+#define WORDS_BIGENDIAN 0  /* about format file */
 
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
+#include "texd.h"
 
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301 USA.  */
+#define file_name_size PATH_MAX
 
-#ifndef _YANDYTEX_H
-#define _YANDYTEX_H
+#define min_halfword -2147483647L /* LONG_MIN, for 64 bit memory word (signed) */
+#define max_halfword  2147483647L /* LONG_MAX, for 64 bit memory word (signed) */
+
+#define block_size 1000 /* block_size for variable length node alloc */
+
+#define min_quarterword 0
+#ifdef INCREASEFONTS
+  #define max_quarterword 65535L
+#else
+  #define max_quarterword 255
+#endif
+
+#define default_mem_top 262140L  /* usual big TeX allocation 2 Meg bytes */
+/* #define default_mem_top 131070L */ /* usual big TeX allocation 1 Meg bytes */
+/* #define default_mem_top 65534L  */ /* usual small TeX allocation 0.5 Meg   */
+
+#define mem_bot 0
+
+#ifdef ALLOCATEMAIN
+  EXTERN integer mem_top;
+  EXTERN integer mem_max;
+  EXTERN integer mem_min;
+  #define max_mem_size (max_halfword / sizeof(memory_word) - 1)
+#else
+  #define mem_top 262140L
+  #define mem_max mem_top
+  #define mem_min 0
+#endif
+
+#ifdef ALLOCATEBUFFER
+  #define initial_buf_size   1000
+  #define increment_buf_size 2000
+  #define buf_size           2000000L
+  EXTERN ASCII_code *        buffer;
+#else
+  #define buf_size           20000
+  EXTERN ASCII_code          buffer[buf_size + 4];
+#endif
+
+EXTERN integer first; 
+EXTERN integer last; 
+EXTERN integer max_buf_stack; 
+
+#define error_line      79
+#define half_error_line 50
+#define max_print_line  79
+
+#ifdef INCREASEFIXED
+  #define max_in_open 127
+#else
+  #define max_in_open 15
+#endif
+
+#ifdef INCREASEFONTS
+  #define font_max 65535
+#else
+  #define font_max 255
+#endif
+
+#ifdef ALLOCATEFONT
+  #define font_mem_size (max_halfword / sizeof(memory_word) - 1)
+  #define initial_font_mem_size   20000
+  #define increment_font_mem_size 40000
+#else
+  #define font_mem_size 100000L
+#endif
+
+#ifdef ALLOCATESTRING
+  #define max_strings (max_halfword / sizeof(pool_pointer) - 1)
+  #define pool_size (max_halfword - 1)
+#else
+  #define max_strings 16384
+  #define pool_size 124000L
+#endif
+
+#define string_vacancies 100000L
+
+#ifdef VARIABLETRIESIZE
+  EXTERN integer trie_size;
+  #define default_trie_size 60000
+#else
+  #define trie_size 30000
+#endif
+
+#ifdef INCREASETRIEOP
+  #define trie_op_size      3001
+  #define neg_trie_op_size -3001
+  #define min_trie_op       0
+  #define max_trie_op       1000
+#else
+  #define trie_op_size      751
+  #define neg_trie_op_size -751
+  #define min_trie_op       0
+  #define max_trie_op       500
+#endif
+
+
+#define dvi_buf_size 16384
+
+#define hash_extra (255 - font_max)
+#define hash_prime 27197 // (prime ~ 85% * (hash_size + hash_extra))
+#define hash_size  97280 // 32768 9500 25000
+
+#if (hash_extra != 255 - font_max)
+  #error ERROR: hash_extra not equal to (255 - font_max)
+#endif
+
+/* sec 0113 */
+#ifdef INCREASEFONTS
+  typedef unsigned short quarterword;
+#else
+  typedef unsigned char quarterword;
+#endif
 
-#define WORDS_BIGENDIAN 0
-
-#ifdef _WIN32
-  #pragma warning(disable:4201) // nameless struct/union
-  #pragma warning(disable:4996) // a function that was marked with deprecated
-  #pragma warning(disable:4701) // potentially uninitialized local variable 'name' used
-  #pragma warning(disable:4135) // conversion between different integral types
-  #pragma warning(disable:4127) // conditional expression is constant
-#endif
-
-#include <stdarg.h>
-#include <setjmp.h>
-#include <time.h>
-#include <math.h>
-#include <signal.h>
-
-#include <kpathsea/c-auto.h>
-#include <kpathsea/c-std.h>
-#include <kpathsea/c-pathmx.h>
-#include <kpathsea/c-fopen.h>
-#include <kpathsea/c-ctype.h>
-#include <kpathsea/c-proto.h>
-#include <kpathsea/config.h>
-#include <kpathsea/getopt.h>
-#include <kpathsea/lib.h>
-#include <kpathsea/line.h>
-#include <kpathsea/readable.h>
-#include <kpathsea/types.h>
-#include <kpathsea/tex-file.h>
-#include <kpathsea/variable.h>
-#include <kpathsea/absolute.h>
-#ifdef _WIN32
-  #include <kpathsea/win32lib.h>
-#else
-  #include <unistd.h>
-#endif
-#include "zlib.h"
-#include "md5.h"
-
-typedef long long integer;
-typedef double    glue_ratio;
-typedef double    real;
-typedef FILE * alpha_file;
-typedef FILE * byte_file;
-typedef FILE * word_file;
-typedef unsigned char  ASCII_code;
-typedef unsigned short KANJI_code;
-typedef unsigned char  eight_bits;
-typedef unsigned short sixteen_bits;
-typedef integer pool_pointer;
-typedef integer str_number;
-typedef unsigned char packed_ASCII_code;
-typedef integer scaled;
-typedef integer nonnegative_integer;
-typedef unsigned char small_number;
-
-typedef enum
+/* typedef unsigned long halfword; NO NO: since mem_min may be < 0 */
+/* sec 0113 */
+typedef int32_t halfword;
+typedef halfword pointer;
+typedef char two_choices;
+typedef char four_choices;
+/* sec 0113 */
+#include "memory.h"
+#include "macros.h"
+/* sec 0150 */
+typedef char glue_ord; 
+/* sec 0212 */
+typedef struct
+{
+  int mode_field;
+  halfword head_field, tail_field;
+  integer pg_field, ml_field;
+  memory_word aux_field;
+} list_state_record;
+/* sec 0269 */
+typedef char group_code;
+/* sec 0300 */
+typedef struct
 {
-  TEXFORMATPATH,
-  TEXINPUTPATH,
-  TFMFILEPATH,
-} path_constant_type;
+  quarterword state_field, index_field; 
+  halfword start_field, loc_field, limit_field, name_field;
+} in_state_record; 
+/* sec 0548 */
+typedef integer internal_font_number;
+typedef integer font_index;
+/* sec 0594 */
+typedef integer dvi_index;
+/* sec 0920 */
+typedef integer trie_op_code;
+/* sec 0925 */
+typedef integer trie_pointer;
+typedef integer hyph_pointer;
+
+EXTERN integer bad;
+EXTERN ASCII_code xord[256];
+EXTERN ASCII_code xchr[256];
+EXTERN ASCII_code name_of_file[file_name_size + 4];
+EXTERN integer name_length;
+
+#ifdef ALLOCATESTRING
+  #define initial_pool_size     40000
+  #define increment_pool_size   80000
+  EXTERN packed_ASCII_code *    str_pool;
+  #define initial_max_strings   5000
+  #define increment_max_strings 10000
+  EXTERN pool_pointer *         str_start;
+#else
+  EXTERN packed_ASCII_code      str_pool[pool_size + 1]; 
+  EXTERN pool_pointer           str_start[max_strings + 1]; 
+#endif
+
+EXTERN pool_pointer pool_ptr;
+EXTERN str_number   str_ptr;
+EXTERN pool_pointer init_pool_ptr;
+EXTERN str_number   init_str_ptr;
+
+#ifdef INITEX
+  EXTERN alpha_file pool_file; 
+#endif
+
+EXTERN alpha_file log_file; 
+EXTERN int selector;
+EXTERN char dig[23 + 1];
+EXTERN integer tally;
+EXTERN integer term_offset;
+EXTERN integer file_offset;
+EXTERN ASCII_code trick_buf[error_line + 1];
+EXTERN integer trick_count;
+EXTERN integer first_count;
+EXTERN int interaction;
+EXTERN boolean deletions_allowed;
+EXTERN boolean set_box_allowed;
+EXTERN int history;
+EXTERN int error_count;
+EXTERN char * help_line[6];
+EXTERN int help_ptr;
+EXTERN boolean use_err_help;
+EXTERN volatile integer interrupt;
+EXTERN boolean OK_to_interrupt;
+EXTERN boolean arith_error;
+EXTERN scaled tex_remainder;
+EXTERN halfword temp_ptr;
+
+/* sec 0116 */
+#ifdef ALLOCATEMAIN
+  EXTERN memory_word * main_memory;
+  EXTERN memory_word * mem;
+#else
+  EXTERN memory_word zzzaa[mem_max - mem_bot + 1];
+  #define zmem (zzzaa - (int)(mem_bot))
+#endif
+
+EXTERN pointer lo_mem_max;
+EXTERN pointer hi_mem_min;
+EXTERN integer var_used, dyn_used;
+/* sec 0118 */
+EXTERN pointer avail;
+EXTERN pointer mem_end;
+EXTERN pointer mem_start;
+/* sec 0124 */
+EXTERN pointer rover;
+/* sec 0165 */
+/* NOTE: the following really also need to be dynamically allocated */
+#ifdef DEBUG
+  #ifdef ALLOCATEMAIN
+    EXTERN char * zzzab;
+  #else
+
+  EXTERN char
+#define freearr (zzzab - (int)(mem_bot))
+  zzzab[mem_max - mem_bot + 1]; 
+#endif
+
+#ifdef ALLOCATEMAIN
+  EXTERN char *zzzac;
+#else
+/* EXTERN boolean */   /* save (4 - 1) * mem_max - mem_min */
+EXTERN char
+/* #define wasfree (zzzac - (int)(mem_min)) */
+#define wasfree (zzzac - (int)(mem_bot))
+/*  zzzac[mem_max - mem_min + 1];  */
+  zzzac[mem_max - mem_bot + 1]; 
+#endif
+
+EXTERN pointer was_mem_end, was_lo_max, was_hi_min;
+EXTERN boolean panicking;
+#endif /* DEBUG */
+
+EXTERN integer font_in_short_display;
+EXTERN integer depth_threshold;
+EXTERN integer breadth_max;
+EXTERN int shown_mode;
+EXTERN int old_setting;
+
+#ifdef INCREASEFONTS
+  #define eqtb_extra (font_max - 255 + hash_extra)
+#else
+  #define eqtb_extra 0
+#endif
+
+#if (eqtb_extra != 0)
+  #error ERROR: eqtb_extra is not zero (need hash_extra equal 255 - font_max)
+#endif
+
+#ifdef INCREASEFONTS
+  EXTERN memory_word eqtb[eqtb_size + 1 + eqtb_extra];
+#else
+  EXTERN memory_word eqtb[eqtb_size + 1];
+#endif
+
+#ifdef INCREASEFONTS
+  #define xeq_level (zzzad - (int_base + eqtb_extra))
+#else
+  #define xeq_level (zzzad - (int_base))
+#endif
+
+EXTERN quarterword zzzad[eqtb_size - int_base + 1];
+
+#ifdef ALLOCATEHASH
+  EXTERN two_halves *zzzae;
+  #define hash (zzzae - hash_base)
+#else
+  #ifdef INCREASEFONTS
+    EXTERN two_halves zzzae[undefined_control_sequence - hash_base + eqtb_extra];
+  #else
+    EXTERN two_halves zzzae[undefined_control_sequence - hash_base];
+  #endif
+
+  #define hash (zzzae - hash_base)
+#endif
+
+EXTERN pointer hash_used;
+EXTERN boolean no_new_control_sequence;
+EXTERN integer cs_count;
+
+/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
+/* using allocated save stack slows it down 1% to 2%                       */
+/* despite reallocation, we still limit it to something finite             */
+/* to avoid soaking up all of machine memory in case of infinite loop      */
+#ifdef ALLOCATESAVESTACK
+  #define save_size           65536
+  #define initial_save_size   1000
+  #define increment_save_size 2000
+  EXTERN memory_word * save_stack;
+#else
+  #define save_size 8000
+  EXTERN memory_word save_stack[save_size + 1];
+#endif
+
+EXTERN integer save_ptr;
+EXTERN integer max_save_stack;
+EXTERN int cur_level;
+EXTERN int cur_group;
+EXTERN integer cur_boundary;
+EXTERN integer mag_set;
+EXTERN int cur_cmd;
+EXTERN halfword cur_chr;
+EXTERN pointer cur_cs;
+EXTERN halfword cur_tok;
+
+#ifdef ALLOCATENESTSTACK
+  #define nest_size           65536
+  #define initial_nest_size   100
+  #define increment_nest_size 200
+  EXTERN list_state_record * nest;
+#else
+  #define nest_size 200
+  EXTERN list_state_record nest[nest_size + 1];
+#endif
+
+EXTERN integer nest_ptr;
+EXTERN integer max_nest_stack;
+EXTERN list_state_record cur_list;
+
+#ifdef ALLOCATEPARAMSTACK
+  #define param_size           65536
+  #define initial_param_size   100
+  #define increment_param_size 200
+  EXTERN pointer * param_stack;
+#else
+  #define param_size 500
+  EXTERN pointer param_stack[param_size + 1];
+#endif
+
+EXTERN integer param_ptr;
+EXTERN integer max_param_stack;
+
+#ifdef ALLOCATEINPUTSTACK
+  #define stack_size           65536
+  #define initial_stack_size   100
+  #define increment_stack_size 200
+  EXTERN in_state_record * input_stack;
+#else
+  #define stack_size 800
+  EXTERN in_state_record input_stack[stack_size + 1];
+#endif
+
+EXTERN integer input_ptr;
+EXTERN integer max_in_stack;
+EXTERN integer high_in_open;
+EXTERN in_state_record cur_input;
+EXTERN int in_open;
+EXTERN integer open_parens;
+EXTERN integer max_open_parens;
+EXTERN alpha_file input_file[max_in_open + 1];
+EXTERN integer line;
+EXTERN integer line_stack[max_in_open + 1];
+EXTERN int scanner_status;
+EXTERN pointer warning_index;
+EXTERN pointer def_ref;
+EXTERN integer align_state;
+EXTERN integer base_ptr;
+EXTERN pointer par_loc;
+EXTERN halfword par_token;
+EXTERN boolean force_eof;
+EXTERN pointer cur_mark[6];
+EXTERN int long_state;
+EXTERN pointer pstack[10];
+EXTERN integer cur_val;
+EXTERN int cur_val_level;
+EXTERN int radix;
+EXTERN int cur_order;
+EXTERN alpha_file read_file[16];
+EXTERN char read_open[20];
+EXTERN pointer cond_ptr;
+EXTERN int if_limit;
+EXTERN int cur_if;
+EXTERN integer if_line;
+EXTERN integer skip_line;
+EXTERN str_number cur_name;
+EXTERN str_number cur_area;
+EXTERN str_number cur_ext;
+EXTERN pool_pointer area_delimiter;
+EXTERN pool_pointer ext_delimiter;
+EXTERN integer format_default_length;
+EXTERN char * TEX_format_default;
+EXTERN boolean name_in_progress;
+EXTERN boolean log_opened;
+EXTERN boolean quoted_file_name;
+EXTERN str_number job_name;
+EXTERN const char * c_job_name;
+EXTERN str_number output_file_name;
+EXTERN str_number log_name;
+EXTERN byte_file dvi_file;
+EXTERN byte_file tfm_file;
+EXTERN byte_file pdf_file;
+EXTERN char * dvi_file_name;
+EXTERN char * pdf_file_name;
+EXTERN char * log_file_name;
+
+#ifdef ALLOCATEFONT
+  EXTERN memory_word * font_info;
+#else
+  EXTERN memory_word font_info[font_mem_size + 1];
+#endif
+
+EXTERN font_index fmem_ptr;
+EXTERN internal_font_number font_ptr;
+EXTERN internal_font_number frozen_font_ptr;
+EXTERN four_quarters font_check[font_max + 1];
+EXTERN scaled font_size[font_max + 1];
+EXTERN scaled font_dsize[font_max + 1];
+EXTERN font_index font_params[font_max + 1];
+EXTERN str_number font_name[font_max + 1];
+EXTERN str_number font_area[font_max + 1];
+EXTERN eight_bits font_bc[font_max + 1];
+EXTERN eight_bits font_ec[font_max + 1];
+EXTERN pointer font_glue[font_max + 1];
+EXTERN boolean font_used[font_max + 1];
+EXTERN integer hyphen_char[font_max + 1];
+EXTERN integer skew_char[font_max + 1];
+EXTERN font_index bchar_label[font_max + 1];
+EXTERN short font_bchar[font_max + 1];
+EXTERN short font_false_bchar[font_max + 1];
+EXTERN integer char_base[font_max + 1];
+EXTERN integer width_base[font_max + 1];
+EXTERN integer height_base[font_max + 1];
+EXTERN integer depth_base[font_max + 1];
+EXTERN integer italic_base[font_max + 1];
+EXTERN integer lig_kern_base[font_max + 1];
+EXTERN integer kern_base[font_max + 1];
+EXTERN integer exten_base[font_max + 1];
+EXTERN integer param_base[font_max + 1];
+EXTERN four_quarters null_character;
+EXTERN integer total_pages;
+EXTERN scaled max_v;
+EXTERN scaled max_h;
+EXTERN integer max_push;
+EXTERN integer last_bop;
+EXTERN integer dead_cycles;
+EXTERN boolean doing_leaders;
+EXTERN quarterword c, f;
+EXTERN scaled rule_ht, rule_dp, rule_wd;
+EXTERN pointer g;
+EXTERN integer lq, lr;
+EXTERN eight_bits dvi_buf[dvi_buf_size + 4];
+EXTERN dvi_index half_buf;
+EXTERN dvi_index dvi_limit;
+EXTERN dvi_index dvi_ptr;
+EXTERN integer dvi_offset;
+EXTERN integer pdf_offset;
+EXTERN integer dvi_gone;
+EXTERN pointer down_ptr, right_ptr;
+EXTERN scaled dvi_h, dvi_v;
+EXTERN scaled pdf_h, pdf_v;
+EXTERN scaled pdf_x, pdf_y;
+EXTERN scaled pdf_delta_h, pdf_delta_v;
+EXTERN scaled cur_h, cur_v;
+EXTERN internal_font_number dvi_f;
+EXTERN internal_font_number pdf_f;
+EXTERN integer cur_s;
+EXTERN scaled total_stretch[4], total_shrink[4];
+EXTERN integer last_badness;
+EXTERN pointer adjust_tail;
+EXTERN integer pack_begin_line;
+EXTERN two_halves empty_field;
+EXTERN four_quarters null_delimiter;
+EXTERN pointer cur_mlist;
+EXTERN small_number cur_style;
+EXTERN small_number cur_size;
+EXTERN scaled cur_mu;
+EXTERN boolean mlist_penalties;
+EXTERN internal_font_number cur_f;
+EXTERN quarterword cur_c;
+EXTERN four_quarters cur_i;
+EXTERN integer magic_offset;
+EXTERN pointer cur_align;
+EXTERN pointer cur_span;
+EXTERN pointer cur_loop;
+EXTERN pointer align_ptr;
+EXTERN pointer cur_head, cur_tail;
+EXTERN pointer just_box;
+EXTERN pointer passive;
+EXTERN pointer printed_node;
+EXTERN halfword pass_number;
+EXTERN scaled active_width[8];
+EXTERN scaled cur_active_width[8];
+EXTERN scaled background[8];
+EXTERN scaled break_width[8];
+EXTERN boolean no_shrink_error_yet;
+EXTERN pointer cur_p;
+EXTERN boolean second_pass;
+EXTERN boolean final_pass;
+EXTERN integer threshold;
+EXTERN integer minimal_demerits[4];
+EXTERN integer minimum_demerits;
+EXTERN pointer best_place[4];
+EXTERN halfword best_pl_line[4];
+EXTERN scaled disc_width;
+EXTERN halfword easy_line;
+EXTERN halfword last_special_line;
+EXTERN scaled first_width;
+EXTERN scaled second_width;
+EXTERN scaled first_indent;
+EXTERN scaled second_indent;
+EXTERN pointer best_bet;
+EXTERN integer fewest_demerits;
+EXTERN halfword best_line;
+EXTERN integer actual_looseness;
+EXTERN integer line_diff;
+EXTERN int hc[66];
+EXTERN int hn;
+EXTERN halfword ha, hb;
+EXTERN int hf;
+EXTERN int hu[66];
+EXTERN int hyf_char;
+EXTERN int cur_lang, init_cur_lang;
+EXTERN integer l_hyf, r_hyf;
+EXTERN integer init_l_hyf, init_r_hyf;
+EXTERN halfword hyf_bchar;
+EXTERN char hyf[68];
+EXTERN pointer init_list;
+EXTERN boolean init_lig;
+EXTERN boolean init_lft;
+EXTERN int hyphen_passed;
+EXTERN halfword cur_l, cur_r;
+EXTERN pointer cur_q;
+EXTERN pointer lig_stack;
+EXTERN boolean ligature_present;
+EXTERN boolean lft_hit, rt_hit;
+
+#ifdef ALLOCATETRIES
+  EXTERN halfword * trie_trl;
+  EXTERN halfword * trie_tro;
+  EXTERN quarterword * trie_trc;
+#else
+  EXTERN halfword trie_trl[trie_size + 1];
+  EXTERN halfword trie_tro[trie_size + 1];
+  EXTERN quarterword trie_trc[trie_size + 1];
+#endif
+
+EXTERN small_number hyf_distance[trie_op_size + 1];
+EXTERN small_number hyf_num[trie_op_size + 1];
+EXTERN trie_op_code hyf_next[trie_op_size + 1];
+EXTERN integer op_start[256];
+
+#ifdef ALLOCATEHYPHEN
+  #define default_hyphen_prime 1009
+  EXTERN str_number * hyph_word;
+  EXTERN pointer * hyph_list;
+  EXTERN integer hyphen_prime;
+#else
+  #define hyphen_prime 607
+  EXTERN str_number hyph_word[hyphen_prime + 1];
+  EXTERN pointer hyph_list[hyphen_prime + 1];
+#endif
+
+EXTERN hyph_pointer hyph_count;
+
+#ifdef INITEX
+  EXTERN integer trie_op_hash_C[trie_op_size - neg_trie_op_size + 1];
+  #define trie_op_hash (trie_op_hash_C - (int)(neg_trie_op_size)) 
+  EXTERN trie_op_code trie_used[256];
+  EXTERN ASCII_code trie_op_lang[trie_op_size + 1];
+  EXTERN trie_op_code trie_op_val[trie_op_size + 1];
+  EXTERN integer trie_op_ptr;
+#endif
+
+EXTERN trie_op_code max_op_used;
+
+#ifdef INITEX
+  #ifdef ALLOCATEINI
+    EXTERN packed_ASCII_code * trie_c; /* characters to match */
+    EXTERN trie_op_code * trie_o;      /* operations to perform */
+    EXTERN trie_pointer * trie_l;      /* left subtrie links */
+    EXTERN trie_pointer * trie_r;      /* right subtrie links */
+    EXTERN trie_pointer * trie_hash;   /* used to identify equivlent subtries */
+  #else
+    EXTERN packed_ASCII_code trie_c[trie_size + 1];
+    EXTERN trie_op_code trie_o[trie_size + 1];
+    EXTERN trie_pointer trie_l[trie_size + 1];
+    EXTERN trie_pointer trie_r[trie_size + 1];
+    EXTERN trie_pointer trie_hash[trie_size + 1];
+  #endif
+
+  EXTERN trie_pointer trie_ptr;
+#endif
+
+#ifdef INITEX
+  #ifdef ALLOCATEINI
+    EXTERN char * trie_taken;
+  #else
+    EXTERN boolean trie_taken[trie_size + 1];
+  #endif
+
+  EXTERN trie_pointer trie_min[256];
+  EXTERN trie_pointer trie_max;
+  EXTERN boolean trie_not_ready;
+#endif
+
+EXTERN scaled best_height_plus_depth;
+EXTERN pointer page_tail;
+EXTERN int page_contents;
+
+#if (half_error_line < 30) || (half_error_line > error_line - 15)
+  #error ERROR: (half_error_line < 30) || (half_error_line > error_line - 15) BAD 1
+#endif
+
+#if (max_print_line < 60)
+  #error ERROR: (max_print_line < 60) BAD 2
+#endif
+
+#if (hash_prime > hash_size)
+  #error ERROR: (hash_prime > hash_size) BAD 5
+#endif
+
+#if (max_in_open > 127)
+  #error ERROR: (max_in_open > 127) BAD 6
+#endif
+
+#if (min_quarterword > 0) || (max_quarterword < 127)
+  #error ERROR: (min_quarterword > 0) || (max_quarterword < 127) BAD 11
+#endif
+
+#if (min_halfword > 0) || (max_halfword < 32767)
+  #error ERROR:  (min_halfword > 0) || (max_halfword < 32767) BAD 12
+#endif
+
+#if (min_quarterword < min_halfword) || (max_quarterword > max_halfword)
+  #error ERROR: (min_quarterword < min_halfword) || (max_quarterword > max_halfword) BAD 13
+#endif
+
+#if (font_max > max_quarterword)
+  #error ERROR: (font_max > max_quarterword) BAD 15
+#endif
+
+#if (save_size > max_halfword)
+  #error ERROR: (save_size > max_halfword) BAD 17
+#endif
+
+#if (buf_size > max_halfword)
+  #error ERROR:  (buf_size > max_halfword) BAD 18
+#endif
 
-#ifdef link
-  #undef link
+#if (max_quarterword - min_quarterword) < 255
+  #error (max_quarterword - min_quarterword) < 255 BAD 19
 #endif
 
-//#define abs(x)   ((integer)(x) >= 0 ? (integer)(x) : (integer)-(x))
-//#define fabs(x)  ((x) >= 0.0 ? (x) : -(x))
-#define chr(x)   (x)
-#define odd(x)   ((x) % 2)
-#define round(x) web2c_round((double) (x))
-#define decr(x)  --(x)
-#define incr(x)  ++(x)
-#define toint(x) ((integer) (x))
+EXTERN scaled page_max_depth;
+EXTERN pointer best_page_break;
+EXTERN integer least_page_cost;
+EXTERN scaled best_size;
+EXTERN scaled page_so_far[8];
+EXTERN pointer last_glue;
+EXTERN integer last_penalty;
+EXTERN scaled last_kern;
+EXTERN integer insert_penalties;
+EXTERN boolean output_active;
+/* sec 1032 */
+EXTERN internal_font_number main_f;
+EXTERN four_quarters main_i;
+EXTERN four_quarters main_j;
+EXTERN font_index main_k;
+EXTERN pointer main_p;
+EXTERN integer main_s;
+EXTERN halfword bchar;
+EXTERN halfword false_bchar;
+EXTERN boolean cancel_boundary;
+EXTERN boolean ins_disc;
+/* sec 1074 */
+EXTERN pointer cur_box;
+EXTERN halfword after_token;
+EXTERN boolean long_help_seen;
+EXTERN str_number format_ident;
+EXTERN word_file fmt_file;
+EXTERN gzFile gz_fmt_file;
+/* sec 1331 */
+EXTERN integer ready_already;
+/* sec 1342 */
+EXTERN alpha_file write_file[16];
+EXTERN boolean write_open[18];
+/* sec 1345 */
+EXTERN pointer write_loc;
+EXTERN pool_pointer edit_name_start;
+EXTERN integer edit_name_length, edit_line;
+EXTERN int fbyte;
+/* new variables defined in local.c */
+EXTERN boolean is_initex;
+EXTERN boolean verbose_flag;
+EXTERN boolean trace_flag;
+EXTERN boolean open_trace_flag;
+EXTERN boolean knuth_flag;
+EXTERN boolean c_style_flag;
+EXTERN boolean non_ascii;
+EXTERN boolean key_replace;
+EXTERN boolean deslash;
+EXTERN boolean trimeof;
+EXTERN boolean allow_patterns;
+EXTERN boolean show_fonts_used;
+EXTERN boolean reset_exceptions;
+EXTERN boolean show_current;
+EXTERN boolean return_flag;
+EXTERN boolean civilize_flag;
+EXTERN boolean show_numeric;
+EXTERN boolean restrict_to_ascii;
+EXTERN boolean show_missing;
+EXTERN boolean full_file_name_flag;
+EXTERN int mem_initex;
+EXTERN int mem_extra_high;
+EXTERN int mem_extra_low;
+EXTERN int new_hyphen_prime;
+EXTERN int missing_characters;
+EXTERN boolean show_in_hex;
+EXTERN boolean show_in_dos;
+EXTERN boolean show_fmt_flag;
+EXTERN boolean show_tfm_flag;
+EXTERN boolean truncate_long_lines;
+EXTERN boolean show_cs_names;
+EXTERN int tab_step;
+EXTERN int pseudo_tilde;
+EXTERN int pseudo_space;
+EXTERN boolean allow_quoted_names;
+EXTERN int default_rule;
+EXTERN char * format_file;
+EXTERN char * source_direct;
+EXTERN char * format_name;
+EXTERN boolean show_line_break_stats;
+EXTERN int first_pass_count;
+EXTERN int second_pass_count;
+EXTERN int final_pass_count;
+EXTERN int underfull_hbox;
+EXTERN int overfull_hbox;
+EXTERN int underfull_vbox;
+EXTERN int overfull_vbox;
+EXTERN int paragraph_failed;
+EXTERN int single_line;
+EXTERN FILE * errout;
+EXTERN int ignore_frozen;
+EXTERN boolean suppress_f_ligs;
+EXTERN int jump_used;
+EXTERN jmp_buf jumpbuffer;
+extern int current_pool_size;
+extern int current_max_strings;
+extern int current_mem_size;
+extern int current_font_mem_size;
+extern int current_save_size;
+extern int current_stack_size;
+extern int current_nest_size;
+extern int current_param_size;
+extern int current_buf_size;
+extern const char * banner;
+extern const char * application;
+extern const char * yandyversion;
+extern unsigned char wintodos[128];
+extern char log_line[256];
+extern char * dvi_directory;
+extern char * log_directory;
+extern char * aux_directory;
+extern char * fmt_directory;
+extern char * pdf_directory;
+extern clock_t start_time, main_time, finish_time;
+extern int closed_already;
 
-#define MAXLINE 256
+extern memory_word * allocate_main_memory (int size);
+extern memory_word * realloc_main (int lo_size, int hi_size);
+extern packed_ASCII_code * realloc_str_pool (int size);
+extern pool_pointer * realloc_str_start (int size);
+extern memory_word * realloc_save_stack (int size);
+extern list_state_record * realloc_nest_stack (int size);
+extern in_state_record * realloc_input_stack (int size);
+extern halfword * realloc_param_stack (int size);
+extern ASCII_code * realloc_buffer (int size);
+extern memory_word * realloc_font_info (int size);
+extern int realloc_hyphen (int hyphen_prime);
+extern int allocate_tries (int trie_max);
+extern void probe_memory (void);
+extern void print_cs_names (FILE * output, int pass);
+extern void perrormod (const char * s);
+extern char * grabenv (const char * varname);
+extern void flush_trailing_slash (char * directory);
+extern boolean prime (int x);
+extern int endit (int flag);
+extern void uexit (int unix_code);
+extern void t_open_in (void);
+extern void call_edit (ASCII_code * filename, pool_pointer fnstart,
+  integer fnlength, integer linenumber);
+extern void add_variable_space (int size);
+extern char * unixify (char * t);
 
-extern integer web2c_round (double r);
-extern boolean open_input  (FILE ** f, path_constant_type path_index, char * fopen_mode);
-extern boolean open_output (FILE ** f, char * fopen_mode);
-extern int check_fclose    (FILE * f);
+#include "coerce.h"
 
-#define show_line(str, flag) fputs(str, stdout)
-#define show_char(s)         putc(s, stdout)
-extern char log_line[];
+/* sec 79 */
+extern void node_list_display (integer p);
+extern void do_nothing (void);
+extern void update_terminal (void);
+extern void check_full_save_stack (void);
+extern void push_input (void);
+extern void pop_input (void);
+extern void print_err (const char * s);
+extern void ensure_dvi_open (void);
+extern void write_dvi (size_t a, size_t b);
+extern void prompt_input (const char * s);
+extern void synch_h (void);
+extern void synch_v (void);
+extern void set_cur_lang (void);
+extern char * md5_file (FILE * in_file);
+extern void str_room (int val);
+extern void tail_append_ (pointer val);
+#define tail_append(a) tail_append_((pointer) a)
+extern void tex_help (unsigned int n, ...);
+extern void append_char (ASCII_code c);
+extern void append_lc_hex (ASCII_code c);
+extern void succumb (void);
+extern void dvi_out_ (ASCII_code op);
+#define dvi_out(op) dvi_out_((ASCII_code) (op))
+extern void free_avail_ (halfword p);
+#define free_avail(p) free_avail_((halfword) (p))
+extern void flush_string (void);
+extern str_number load_pool_strings (integer spare_size);
+extern str_number make_string_pool (const char * s);
+extern void print_plus (int i, const char * s);
+#define help0()     tex_help(0)
+#define help1(...)  tex_help(1, __VA_ARGS__)
+#define help2(...)  tex_help(2, __VA_ARGS__)
+#define help3(...)  tex_help(3, __VA_ARGS__)
+#define help4(...)  tex_help(4, __VA_ARGS__)
+#define help5(...)  tex_help(5, __VA_ARGS__)
+#define help6(...)  tex_help(6, __VA_ARGS__)
+extern char * md5_file_name(const char * file_name);
+extern void fget (void);
+extern str_number get_job_name (str_number job);
+extern void show_font_info (void);
 
+EXTERN int shipout_flag;
 #endif
index f8b1204..b3db8e7 100644 (file)
@@ -28,7 +28,7 @@ VS_VERSION_INFO VERSIONINFO
     BLOCK "040904b0"
     {
       VALUE "CompanyName",        "Project Fandol.\0"
-      VALUE "FileDescription",    "Y&Y TeX 2.2.3 (WIN32)\0"
+      VALUE "FileDescription",    "Y&Y TeX 2.3.0 (WIN32)\0"
       VALUE "FileVersion",        "0.3.0.0\0"
       VALUE "LegalCopyright",     "(C) 2014 Clerk Ma.\0"
       VALUE "OriginalFilename",   "yandytex.exe\0"