OSDN Git Service

rearrange headers.
authormaqiyuan <maqiyuan@users.sourceforge.jp>
Sat, 7 Jun 2014 16:11:48 +0000 (00:11 +0800)
committermaqiyuan <maqiyuan@users.sourceforge.jp>
Sat, 7 Jun 2014 16:11:48 +0000 (00:11 +0800)
src/texsourc/Makefile.gcc
src/texsourc/itex.c
src/texsourc/local.c
src/texsourc/makefile
src/texsourc/tex1.c
src/texsourc/tex3.c
src/texsourc/texd.h
src/texsourc/texmf.h [deleted file]
src/texsourc/texmfmem.h [deleted file]
src/texsourc/yandy_macros.h
src/texsourc/yandytex.h

index 247e825..dc3e3f4 100644 (file)
@@ -20,7 +20,7 @@ objects = yandytex.o itex.o openinou.o subroute.o local.o \
        tex5.o tex6.o tex7.o tex8.o tex9.o \
        yandy_pool.o md5.o yandy_backend_pdf.o
 
-headers = yandytex.h texd.h coerce.h texmf.h texmfmem.h
+headers = yandytex.h texd.h coerce.h
 
 yandytex: $(objects)
        $(CC) -o yandytex $(objects) $(LDFLAGS)
index be411dd..dc7a32d 100644 (file)
@@ -1980,6 +1980,9 @@ boolean load_fmt_file (void)
     if (undumpthings(char_base[0], font_ptr + 1))
       return -1;
 
+    if (undumpthings(ctype_base[0], font_ptr + 1))
+      return -1;
+
     if (undumpthings(width_base[0], font_ptr + 1))
       return -1;
 
@@ -2888,6 +2891,7 @@ void do_initex (void)
   font_ec[null_font]          = 0;
   font_size[null_font]        = 0;
   font_dsize[null_font]       = 0;
+  ctype_base[null_font]       = 0;
   char_base[null_font]        = 0;
   width_base[null_font]       = 0;
   height_base[null_font]      = 0;
@@ -3837,6 +3841,9 @@ lab32:
     if (dumpthings(char_base[0], font_ptr + 1))
       return;
 
+    if (dumpthings(ctype_base[0], font_ptr + 1))
+      return;
+
     if (dumpthings(width_base[0], font_ptr + 1))
       return;
 
@@ -4308,6 +4315,8 @@ void init_prim (void)
   primitive("muskipdef", shorthand_def, 5);
   primitive("toksdef", shorthand_def, 6);
   primitive("catcode", def_code, cat_code_base);
+  primitive("kcatcode", def_code, kcat_code_base);
+  primitive("xspcode", def_code, auto_xsp_code_base);
   primitive("mathcode", def_code, math_code_base);
   primitive("lccode", def_code, lc_code_base);
   primitive("uccode", def_code, uc_code_base);
@@ -4330,10 +4339,11 @@ void init_prim (void)
   primitive("errmessage", message, 1);
   primitive("lowercase", case_shift, lc_code_base);
   primitive("uppercase", case_shift, uc_code_base);
-  primitive("show", xray, 0);
-  primitive("showbox", xray, 1);
-  primitive("showthe", xray, 2);
-  primitive("showlists", xray, 3);
+  primitive("show", xray, show_code);
+  primitive("showbox", xray, show_box_code);
+  primitive("showthe", xray, show_the_code);
+  primitive("showlists", xray, show_lists);
+  //primitive("showmode", xray, show_mode);
   primitive("openout", extension, 0);
   primitive("write", extension, 1);
   write_loc = cur_val;
index 3af4a76..2212dca 100644 (file)
@@ -970,6 +970,7 @@ memory_word * realloc_main (int lo_size, int hi_size)
           new_memory, (current_mem_size + 1) * sizeof(memory_word));
       show_line(log_line, 0);
     }
+
     memmove (new_memory + lo_size, new_memory,
       (current_mem_size + 1) * sizeof(memory_word));
 /*  could reduce words moved by (mem_max - mem_end) */
index 3bd81ce..f88c766 100644 (file)
@@ -9,31 +9,11 @@ CC = cl
 LINK = link
 RC = rc
 
-# -Gf saves about 7k bytes in EXE file
-
-# For production (-Bd show compiler passes)
-# ASSUMING WE WORK WITH MS COMPILER AND LINKER ONLY use -Gy and -Gf
-# CFLAGS=-c -DDOS -DMSDOS -DPHARLAP -DTeX -DMYDEBUG -Ilib -Ox -Gy -Gf -W3
-# CFLAGS=-c -DDOS -DMSDOS -DPHARLAP -DTeX -DMYDEBUG -Ilib -YX -Ox -Ge -Gy -Gf -W4
-# Release version
-# CFLAGS=/c /Ge /Gy /Gf /Ox /W4 /DMSDOS /DTeX /DPHARLAP /DNDEBUG /Ilib /YX
 CFLAGS=/nologo /c /MT /GF /Gy /Ox /W4 /DMSDOS /DTeX /DPHARLAP /DNDEBUG \
        /I"kpathsea" /I"libharu/include" /I"libharu/win32/include" /I"zlib" \
-       /I"libmd5"
-# Debugging version
-# CFLAGS=/c /Ge /Gy /Gf /Od /Zi /W4 /DMSDOS /DTeX /DPHARLAP /Ilib /YX
+       /I"libmd5" /I"libtoua/ptexenc"
 
-# NOTE: -Ox => -Ogityb1 -Gs
-
-# Link with MS LINK
-# LFLAGS=@yandytex.nt /MAP lib\libdos.lib
-# Release version
-# LFLAGS=/MAP lib\libdos.lib
 LFLAGS=/NOLOGO /MAP
-# /MACHINE:X86
-# debugging version
-# LFLAGS=@yandytex.nt /MAP /DEBUG /PDB:yandytex.pdb lib\libdos.lib
-# LFLAGS=/MAP /DEBUG /PDB:yandytex.pdb
 
 objs = yandytex.obj itex.obj openinou.obj subroute.obj local.obj \
        tex0.obj tex1.obj tex2.obj tex3.obj tex4.obj \
@@ -49,6 +29,7 @@ yandytex.exe: $(objs)
        kpathsea\kpathsea.lib libharu\libhpdf.lib libpng\libpng.lib zlib\zlib.lib
        del ..\yandy\bin\yandytex.exe
        copy yandytex.exe ..\yandy\bin\yandytex.exe
+
 # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
 yandy_backend_pdf.obj: yandy_backend_pdf.c
        $(CC) $(CFLAGS) yandy_backend_pdf.c
@@ -60,59 +41,59 @@ yandytex.res: yandytex.rc
        rc yandytex.rc
 
 yandytex.obj: yandytex.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h coerce.h yandy_macros.h
        $(CC) /DINITEX /DINI $(CFLAGS) yandytex.c
 
 itex.obj: itex.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h coerce.h yandy_macros.h
        $(CC) /DINITEX $(CFLAGS) itex.c
 
 openinou.obj: openinou.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h coerce.h yandy_macros.h
        $(CC) $(CFLAGS) openinou.c
 
 subroute.obj: subroute.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h coerce.h yandy_macros.h
        $(CC) $(CFLAGS) subroute.c
 
 local.obj: local.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h coerce.h yandy_macros.h
        $(CC) /DINITEX $(CFLAGS) local.c
 
 # NOTE: cannot compile tex5.c and tex6.c with full optimizations ...
 
 tex0.obj: tex0.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h coerce.h yandy_macros.h
 
 tex1.obj: tex1.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h coerce.h yandy_macros.h
 
 tex2.obj: tex2.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h coerce.h yandy_macros.h
 
 tex3.obj: tex3.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h coerce.h yandy_macros.h
 
 tex4.obj: tex4.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h coerce.h yandy_macros.h
 
 tex5.obj: tex5.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h coerce.h yandy_macros.h
 
 tex6.obj: tex6.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h coerce.h yandy_macros.h
 
 tex7.obj: tex7.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h coerce.h yandy_macros.h
 
 tex8.obj: tex8.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h coerce.h yandy_macros.h
 
 tex9.obj: tex9.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h coerce.h yandy_macros.h
 
 yandy_pool.obj: yandy_pool.c \
-       texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+       texd.h coerce.h yandy_macros.h
 
 .SUFFIXES:
 .SUFFIXES: .obj .c
index 7193b3e..9f51f99 100644 (file)
@@ -1907,6 +1907,10 @@ void print_cmd_chr_ (quarterword cmd, halfword chr_code)
     case def_code:
       if (chr_code == cat_code_base)
         print_esc("catcode");
+      else if (chr_code == kcat_code_base)
+        print_esc("kcatcode");
+      else if (chr_code == auto_xsp_code_base)
+        print_esc("xspcode");
       else if (chr_code == math_code_base)
         print_esc("mathcode");
       else if (chr_code == lc_code_base)
@@ -2006,6 +2010,10 @@ void print_cmd_chr_ (quarterword cmd, halfword chr_code)
           print_esc("showlists");
           break;
 
+        //case show_mode:
+        //  print_esc("showmode");
+        //  break;
+
         default:
           print_esc("show");
           break;
index 3bbb95d..2a6f5a6 100644 (file)
@@ -2062,6 +2062,9 @@ lab30:
 internal_font_number read_font_info_(halfword u, str_number nom, str_number aire, scaled s)
 {
   font_index k;
+  eight_bits jfm_flag;
+  halfword nt;
+  KANJI_code cx;
   boolean file_opened;
   halfword lf, lh, nw, nh, nd, ni, nl, nk, ne, np;
   int bc, ec;
@@ -2091,6 +2094,31 @@ internal_font_number read_font_info_(halfword u, str_number nom, str_number aire
     read_sixteen(lf);
     tfm_temp = getc(tfm_file);
     read_sixteen(lh);
+
+    if (lf == yoko_jfm_id)
+    {
+      jfm_flag = dir_yoko;
+      nt = lh;
+      tfm_temp = getc(tfm_file);
+      read_sixteen(lf);
+      tfm_temp = getc(tfm_file);
+      read_sixteen(lh);
+    }
+    else if (lf == tate_jfm_id)
+    {
+      jfm_flag = dir_tate;
+      nt = lh;
+      tfm_temp = getc(tfm_file);
+      read_sixteen(lf);
+      tfm_temp = getc(tfm_file);
+      read_sixteen(lh);
+    }
+    else
+    {
+      jfm_flag = dir_default;
+      nt = 0;
+    }
+
     tfm_temp = getc(tfm_file);
     read_sixteen(bc);
     tfm_temp = getc(tfm_file);
@@ -2122,14 +2150,25 @@ internal_font_number read_font_info_(halfword u, str_number nom, str_number aire
     tfm_temp = getc(tfm_file);
     read_sixteen(np);
 
-    if (lf != 6 + lh + (ec - bc + 1) + nw + nh + nd + ni + nl + nk + ne + np)
-      goto lab11;
+    if (jfm_flag != dir_default)
+    {
+      if (lf != 7 + lh + nt + (ec - bc + 1) + nw + nh + nd + ni + nl + nk + ne + np)
+        goto lab11;
+    }
+    else
+    {
+      if (lf != 6 + lh + (ec - bc + 1) + nw + nh + nd + ni + nl + nk + ne + np)
+        goto lab11;
+    }
 
     if ((nw == 0) || (nh == 0) || (nd == 0) || (ni == 0))
       goto lab11;
   }
 
-  lf = lf - 6 - lh;
+  if (jfm_flag != dir_default)
+    lf = lf - 7 - lh;
+  else
+    lf = lf - 6 - lh;
 
   if (np < 7)
     lf = lf + 7 - np;
@@ -2177,7 +2216,10 @@ internal_font_number read_font_info_(halfword u, str_number nom, str_number aire
   }
 
   f = font_ptr + 1;
-  char_base[f] = fmem_ptr - bc;
+  font_dir[f] = jfm_flag;
+  font_num_ext[f] = nt;
+  ctype_base[f] = fmem_ptr;
+  char_base[f] = ctype_base[f] + nt - bc;
   width_base[f] = char_base[f] + ec + 1;
   height_base[f] = width_base[f] + nw;
   depth_base[f] = height_base[f] + nh;
@@ -2200,7 +2242,7 @@ internal_font_number read_font_info_(halfword u, str_number nom, str_number aire
     z =(z * 16) + (tfm_temp / 16);
 
     if (z < 65536L)
-      goto lab11; 
+      goto lab11;
 
     while (lh > 2)
     {
@@ -2222,7 +2264,20 @@ internal_font_number read_font_info_(halfword u, str_number nom, str_number aire
     font_size[f] = z;
   }
 
-  for (k = fmem_ptr; k <= width_base[f] - 1; k++)
+  if (jfm_flag != dir_default)
+  {
+    for (k = ctype_base[f]; k <= ctype_base[f] + nt - 1; k++)
+    {
+      tfm_temp = getc(tfm_file);
+      read_sixteen(cx);
+      font_info[k].hh.rh = cx;
+      tfm_temp = getc(tfm_file);
+      read_sixteen(cx);
+      font_info[k].hh.lh = cx;
+    }
+  }
+
+  for (k = char_base[f] + bc; k <= width_base[f] - 1; k++)
   {
     store_four_quarters(font_info[k].qqqq);
 
@@ -2248,7 +2303,7 @@ internal_font_number read_font_info_(halfword u, str_number nom, str_number aire
               goto lab11;
           }
 
-          while (d < k + bc - fmem_ptr)
+          while (d < k - char_base[f])
           {
             qw = char_info(f, d);
  
@@ -2258,7 +2313,7 @@ internal_font_number read_font_info_(halfword u, str_number nom, str_number aire
             d = rem_byte(qw);
           }
 
-          if (d == k + bc - fmem_ptr)
+          if (d == k - char_base[f])
             goto lab11;
 lab45:; 
         }
@@ -2337,29 +2392,17 @@ lab45:;
       else
       {
         if (b != bchar)
-        {
-          {
-            if ((b < bc) || (b > ec))  /* check-existence(b) */
-              goto lab11;         /* error in TFM, abort */
-          }
-
-          qw = font_info[char_base[f] + b].qqqq;
-
-          if (!(qw.b0 > 0))
-            goto lab11;         /* error in TFM, abort */
-        }
+          check_existence(b);
 
         if (c < 128)
         {
+          if (jfm_flag != dir_default)
           {
-            if ((d < bc) || (d > ec))  /* check-existence(d) */
-              goto lab11;         /* error in TFM, abort */
+            if (d > ne)
+              goto lab11;
           }
-
-          qw = font_info[char_base[f] + d].qqqq;
-
-          if (!(qw.b0 > 0))
-            goto lab11;         /* error in TFM, abort */
+          else
+            check_existence(d);
         }
         else if (256 * (c - 128) + d >= nk)
           goto lab11;           /* error in TFM, abort */
@@ -2375,78 +2418,29 @@ lab45:;
   }
 
   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;
+    store_scaled(font_info[k].cint);
 
-    if (a == 0)
-      font_info[k].cint = sw;
-    else if (a == 255)
-      font_info[k].cint = sw - alpha;
-    else goto lab11;
+  if (jfm_flag != dir_default)
+  {
+    for (k = exten_base[f]; k < param_base[f] - 1; k++)
+      store_scaled(font_info[k].cint);
   }
-
-  /*  read extensible character recipes */
-  for (k = exten_base[f]; k <= param_base[f] - 1; k++)
+  else
   {
-    store_four_quarters(font_info[k].qqqq);
-
-    if (a != 0)
-    {
-      {
-        if ((a < bc) || (a > ec))
-          goto lab11;
-      }
-
-      qw = font_info[char_base[f] + a].qqqq;
-
-      if (!(qw.b0 > 0))
-        goto lab11;
-    }
-
-    if (b != 0)
-    {
-      {
-        if ((b < bc) || (b > ec))
-          goto lab11;
-      }
-
-      qw = font_info[char_base[f] + b].qqqq;
-
-      if (!(qw.b0 > 0))
-        goto lab11;
-    }
-
-    if (c != 0)
+    for (k = exten_base[f]; k <= param_base[f] - 1; k++)
     {
-      {
-        if ((c < bc) || (c > ec))
-          goto lab11;
-      }
-
-      qw = font_info[char_base[f] + c].qqqq;
-
-      if (!(qw.b0 > 0))
-        goto lab11;
-    }
+      store_four_quarters(font_info[k].qqqq);
+      
+      if (a != 0)
+        check_existence(a);
 
-    {
-      {
-        if ((d < bc) || (d > ec))
-          goto lab11;
-      }
+      if (b != 0)
+        check_existence(b);
 
-      qw = font_info[char_base[f] + d].qqqq;
+      if (c != 0)
+        check_existence(c);
 
-      if (!(qw.b0 > 0))
-        goto lab11;
+      check_existence(d);
     }
   }
 
@@ -2468,23 +2462,7 @@ lab45:;
         font_info[param_base[f]].cint = (sw * 16) + (tfm_temp / 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 lab11;
-      }
+        store_scaled(font_info[param_base[f] + k - 1].cint);
 
     if (feof(tfm_file))
       goto lab11;
@@ -2512,10 +2490,10 @@ lab45:;
   if (bchar <= ec)
     if (bchar >= bc)
     {
-      qw = font_info[char_base[f] + bchar].qqqq;
+      qw = char_info(f, bchar);
 
       if ((qw.b0 > 0))
-        font_false_bchar[f] = 256;
+        font_false_bchar[f] = non_char;
     }
 
   font_name[f] = nom;
@@ -2523,6 +2501,7 @@ lab45:;
   font_bc[f] = bc;
   font_ec[f] = ec;
   font_glue[f] = 0;
+  ctype_base[f] = ctype_base[f];
   char_base[f] = char_base[f];
   width_base[f] = width_base[f];
   lig_kern_base[f] = lig_kern_base[f];
index 61c2b77..62c1f7d 100644 (file)
 #define COMPACTFORMAT
 
 #define STAT
-#include "texmf.h"
+#include "yandytex.h"
+
+enum {
+  out_dvi_flag = (1 << 0),
+  out_pdf_flag = (1 << 1),
+  out_xdv_flag = (1 << 2),
+  out_dpx_flag = (1 << 3),
+};
+
+#define INLINE inline
+
+#define dump_file  fmt_file
+#define out_file   dvi_file
+
+/* Read a line of input as quickly as possible.  */
+extern boolean input_line (FILE *);
+#define input_ln(stream, flag) input_line(stream)
+
+/* `b_open_in' (and out) is used only for reading (and writing) .tfm
+   files; `w_open_in' (and out) only for dump files.  The filenames are
+   passed in as a global variable, `name_of_file'.  */
+   
+#define b_open_in(f)  open_input  (&(f), TFMFILEPATH, FOPEN_RBIN_MODE)
+#define w_open_in(f)  open_input  (&(f), TEXFORMATPATH, FOPEN_RBIN_MODE)
+#define b_open_out(f) open_output (&(f), FOPEN_WBIN_MODE)
+#define w_open_out    b_open_out
+#define b_close       a_close
+#define w_close       a_close
+#define gz_w_close    gzclose
+
+/* sec 0241 */
+#define fix_date_and_time() get_date_and_time (&(tex_time), &(day), &(month), &(year))
+
+/* 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
+
+#define write_dvi(a, b)                                           \
+  if ((size_t) fwrite ((char *) &dvi_buf[a], sizeof (dvi_buf[a]), \
+         (size_t) ((size_t)(b) - (size_t)(a) + 1), dvi_file)      \
+         != (size_t) ((size_t)(b) - (size_t)(a) + 1))             \
+     FATAL_PERROR ("\n! dvi file")
+
+extern int do_dump (char *, int, int, FILE *);
+extern int do_undump (char *, int, int, FILE *);
+
+/* Reading and writing the dump files.  `(un)dumpthings' is called from
+   the change file.*/
+#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
+
+/* `dump_int' is called with constant integers, so we put them into a
+   variable first.  */
+#define dump_int(x)         \
+  do                        \
+    {                       \
+      integer x_val = (x);  \
+      generic_dump (x_val); \
+    }                       \
+  while (0)
+
+/* web2c/regfix puts variables in the format file loading into
+   registers.  Some compilers aren't willing to take addresses of such
+   variables.  So we must kludge.  */
+#ifdef REGFIX
+#define undump_int(x)         \
+  do                          \
+    {                         \
+      integer x_val;          \
+      generic_undump (x_val); \
+      x = x_val;              \
+    }                         \
+  while (0)
+#else
+#define undump_int  generic_undump
+#endif
+
+
+/* If we're running on an ASCII system, there is no need to use the
+   `xchr' array to convert characters to the external encoding.  */
+
+#define Xchr(x) xchr[x]
+
+/* following added from new texmf.c file 1996/Jan/12 */
+/* these, of course are useless definitions since parameters not given */
+
+/* Declare routines in texmf.c.  */
+extern void t_open_in();
 #include "yandy_macros.h"
 
 // #define max_halfword 65535L  /* for 32 bit memory word */
@@ -163,7 +268,61 @@ typedef halfword pointer;
 typedef char two_choices;
 typedef char four_choices;
 /* sec 0113 */
-#include "texmfmem.h"
+/*
+  meaning      structure                      TeX                 Y&Y TeX
+               ----------------------------------------------------------------------
+  integer      |            int            || 4: long           | 8: long long      |   min_quarterword 0
+               ---------------------------------------------------------------------- max_quarterword FFFF
+  scaled       |            sc             || 4: long           | 8: long long      |   min_halfword
+               ----------------------------------------------------------------------
+  glue_ratio   |            gr             || 4: float          | 8: double         |
+               ----------------------------------------------------------------------
+  halfword     |     lh      |     rh      || 2: unsigned short | 4: unsigned long  |
+               ----------------------------------------------------------------------
+  half+quarter |  b0  |  b1  |     rh      ||                                       |
+               ----------------------------------------------------------------------
+  quarter      |  b0  |  b1  |  b2  |  b3  || 1: unsigned char  | 2: unsigned short |
+               ----------------------------------------------------------------------
+*/
+
+typedef struct
+{
+#ifdef WORDS_BIGENDIAN
+  halfword rh;
+
+  union
+  {
+    halfword lh;
+
+    struct
+    {
+      quarterword b0, b1;
+    };
+  };
+#endif
+} two_halves;
+
+typedef struct
+{
+#ifdef WORDS_BIGENDIAN
+  quarterword b0, b1, b2, b3;
+#else
+  quarterword b3, b2, b1, b0;
+#endif
+} four_quarters;
+
+typedef union
+{
+  glue_ratio gr;
+  two_halves hh;
+  integer cint;
+  four_quarters qqqq;
+} memory_word;
+
+#ifndef WORDS_BIGENDIAN
+  #define cint u.CINT
+  #define qqqq v.QQQQ
+#endif
 /* sec 0150 */
 typedef char glue_ord; 
 /* sec 0212 */
@@ -475,6 +634,8 @@ EXTERN char * log_file_name;
   EXTERN memory_word font_info[font_mem_size + 1];
 #endif
 
+EXTERN eight_bits font_dir[font_max + 1];
+EXTERN integer font_num_ext[font_max + 1];
 EXTERN font_index fmem_ptr;
 EXTERN internal_font_number font_ptr;
 EXTERN internal_font_number frozen_font_ptr;
@@ -494,6 +655,7 @@ 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 ctype_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];
diff --git a/src/texsourc/texmf.h b/src/texsourc/texmf.h
deleted file mode 100644 (file)
index ac71244..0000000
+++ /dev/null
@@ -1,129 +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),
-};
-
-#define INLINE inline
-
-#define dump_file  fmt_file
-#define out_file   dvi_file
-
-/* Read a line of input as quickly as possible.  */
-extern boolean input_line (FILE *);
-#define input_ln(stream, flag) input_line(stream)
-
-/* `b_open_in' (and out) is used only for reading (and writing) .tfm
-   files; `w_open_in' (and out) only for dump files.  The filenames are
-   passed in as a global variable, `name_of_file'.  */
-   
-#define b_open_in(f)  open_input  (&(f), TFMFILEPATH, FOPEN_RBIN_MODE)
-#define w_open_in(f)  open_input  (&(f), TEXFORMATPATH, FOPEN_RBIN_MODE)
-#define b_open_out(f) open_output (&(f), FOPEN_WBIN_MODE)
-#define w_open_out    b_open_out
-#define b_close       a_close
-#define w_close       a_close
-#define gz_w_close    gzclose
-
-/* sec 0241 */
-#define fix_date_and_time() get_date_and_time (&(tex_time), &(day), &(month), &(year))
-
-/* 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
-
-#define write_dvi(a, b)                                           \
-  if ((size_t) fwrite ((char *) &dvi_buf[a], sizeof (dvi_buf[a]), \
-         (size_t) ((size_t)(b) - (size_t)(a) + 1), dvi_file)      \
-         != (size_t) ((size_t)(b) - (size_t)(a) + 1))             \
-     FATAL_PERROR ("\n! dvi file")
-
-extern int do_dump (char *, int, int, FILE *);
-extern int do_undump (char *, int, int, FILE *);
-
-/* Reading and writing the dump files.  `(un)dumpthings' is called from
-   the change file.*/
-#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
-
-/* `dump_int' is called with constant integers, so we put them into a
-   variable first.  */
-#define dump_int(x)         \
-  do                        \
-    {                       \
-      integer x_val = (x);  \
-      generic_dump (x_val); \
-    }                       \
-  while (0)
-
-/* web2c/regfix puts variables in the format file loading into
-   registers.  Some compilers aren't willing to take addresses of such
-   variables.  So we must kludge.  */
-#ifdef REGFIX
-#define undump_int(x)         \
-  do                          \
-    {                         \
-      integer x_val;          \
-      generic_undump (x_val); \
-      x = x_val;              \
-    }                         \
-  while (0)
-#else
-#define undump_int  generic_undump
-#endif
-
-
-/* If we're running on an ASCII system, there is no need to use the
-   `xchr' array to convert characters to the external encoding.  */
-
-#define Xchr(x) xchr[x]
-
-/* following added from new texmf.c file 1996/Jan/12 */
-/* these, of course are useless definitions since parameters not given */
-
-/* Declare routines in texmf.c.  */
-extern void t_open_in();
\ No newline at end of file
diff --git a/src/texsourc/texmfmem.h b/src/texsourc/texmfmem.h
deleted file mode 100644 (file)
index 6761c42..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/* 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.  */
-
-/*
-  meaning      structure                      TeX                 Y&Y TeX
-               ----------------------------------------------------------------------
-  integer      |            int            || 4: long           | 8: long long      |   min_quarterword 0
-               ---------------------------------------------------------------------- max_quarterword FFFF
-  scaled       |            sc             || 4: long           | 8: long long      |   min_halfword
-               ----------------------------------------------------------------------
-  glue_ratio   |            gr             || 4: float          | 8: double         |
-               ----------------------------------------------------------------------
-  halfword     |     lh      |     rh      || 2: unsigned short | 4: unsigned long  |
-               ----------------------------------------------------------------------
-  half+quarter |  b0  |  b1  |     rh      ||                                       |
-               ----------------------------------------------------------------------
-  quarter      |  b0  |  b1  |  b2  |  b3  || 1: unsigned char  | 2: unsigned short |
-               ----------------------------------------------------------------------
-*/
-
-typedef struct
-{
-#ifdef WORDS_BIGENDIAN
-  halfword rh;
-
-  union
-  {
-    halfword lh;
-
-    struct
-    {
-      quarterword b0, b1;
-    };
-  };
-#endif
-} two_halves;
-
-typedef struct
-{
-#ifdef WORDS_BIGENDIAN
-  quarterword b0, b1, b2, b3;
-#else
-  quarterword b3, b2, b1, b0;
-#endif
-} four_quarters;
-
-typedef union
-{
-  glue_ratio gr;
-  two_halves hh;
-  integer cint;
-  four_quarters qqqq;
-} memory_word;
-
-#ifndef WORDS_BIGENDIAN
-#define cint u.CINT
-#define qqqq v.QQQQ
-#endif
\ No newline at end of file
index ec33ba9..52bc2b8 100644 (file)
@@ -911,6 +911,7 @@ enum
 /* sec 0544 */
 #define no_tag   0
 #define lig_tag  1
+#define gk_tag   1
 #define list_tag 2
 #define ext_tag  3
 /* sec 0545 */
@@ -938,6 +939,8 @@ enum
 #define non_address 0
 /* sec 0554 */
 #define char_info(a, b)   font_info[char_base[a] + b].qqqq
+#define kchar_code(a, b)  font_info[ctype_base[a] + b].hh.rh
+#define kchar_type(a, b)  font_info[ctype_base[a] + b].hh.lh
 #define char_width(a, b)  font_info[width_base[a] + b.b0].cint
 #define char_exists(a)    (a.b0 > min_quarterword)
 #define char_italic(a, b) font_info[italic_base[a] + (b.b2) / 4].cint
@@ -985,6 +988,40 @@ enum
     val = qw;                     \
   }
 /* sec 0571 */
+#define store_scaled(s)                                           \
+  do                                                              \
+    {                                                             \
+      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)                                                 \
+        s = sw;                                                   \
+      else if (a == 255)                                          \
+        s = sw - alpha;                                           \
+      else                                                        \
+        goto lab11;                                               \
+    }                                                             \
+  while (0)
+/* sec 0573 */
+#define check_existence(s)      \
+  do                            \
+    {                           \
+      if ((s < bc) || (s > ec)) \
+        goto lab11;             \
+                                \
+      qw = char_info(f, s);     \
+                                \
+      if (!(qw.b0 > 0))         \
+        goto lab11;             \
+    }                           \
+  while (0)
 /* sec 0585 */
 #define set1      128 // c[1]
 #define set2      129 // c[2]
@@ -1416,6 +1453,7 @@ enum
 #define show_box_code 1
 #define show_the_code 2
 #define show_lists    3
+#define show_mode     4
 /* sec 1342 */
 #define write_node_size 2
 #define open_node_size  3
@@ -1437,3 +1475,13 @@ enum
 #define set_language_code 5
 /* sec 1371 */
 #define end_write_token (cs_token_flag + end_write)
+
+/* Appendix: pTeX*/
+// direction
+#define dir_default 0 // {direction of the box, default Left to Right}
+#define dir_dtou    1 // {direction of the box, Bottom to Top}
+#define dir_tate    3 // {direction of the box, Top to Bottom}
+#define dir_yoko    4 // {direction of the box, equal default}
+// jfm
+#define yoko_jfm_id 11 // {for `yoko-kumi' fonts}
+#define tate_jfm_id 9  // {for `tate-kumi' fonts}
\ No newline at end of file
index ee4a955..ba03fa6 100644 (file)
@@ -20,7 +20,6 @@
 
 #define WORDS_BIGENDIAN 0
 
-//#pragma warning(disable:4032)
 #pragma warning(disable:4201)
 #pragma warning(disable:4996)
 #pragma warning(disable:4701)
@@ -46,6 +45,7 @@
 #include <kpathsea/tex-file.h>
 #include <kpathsea/variable.h>
 #include <kpathsea/absolute.h>
+#include <ptexenc/ptexenc.h>
 #include <stdarg.h>
 #include <setjmp.h>
 #include <time.h>
@@ -102,6 +102,9 @@ typedef enum
 #define a_open_out(f)   open_output (&(f), FOPEN_W_MODE)
 #define a_close(f)         check_fclose (f)
 
+#define Hi(x) (((x) >> 8) & 0xff)
+#define Lo(x) ((x) & 0xff)
+
 #define MAXLINE 256
 
 extern integer zround (double);