OSDN Git Service

removed web2c version of PUTeX.
authormaqiyuan <clerkma@users.sourceforge.jp>
Sat, 16 Aug 2014 14:51:25 +0000 (22:51 +0800)
committermaqiyuan <clerkma@users.sourceforge.jp>
Sat, 16 Aug 2014 14:51:25 +0000 (22:51 +0800)
15 files changed:
src/web2c/ac/web2c.ac.add [deleted file]
src/web2c/lib/texmfmp.c [deleted file]
src/web2c/putexdir/am/putex.am [deleted file]
src/web2c/putexdir/putex.defines [deleted file]
src/web2c/putexdir/putex.txt [deleted file]
src/web2c/putexdir/putex400.ch [deleted file]
src/web2c/putexdir/putex_version.h [deleted file]
src/web2c/putexdir/putexextra.c [deleted file]
src/web2c/putexdir/putexextra.h [deleted file]
src/web2c/synctexdir/am/synctex.am.add [deleted file]
src/web2c/synctexdir/synctex-putex.h [deleted file]
src/web2c/texmfmp-help.h [deleted file]
src/web2c/texmfmp.h [deleted file]
src/web2c/web2c/convert [deleted file]
src/web2c/web2c/splitup.c [deleted file]

diff --git a/src/web2c/ac/web2c.ac.add b/src/web2c/ac/web2c.ac.add
deleted file mode 100644 (file)
index 137eb4e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-[[putex],  [yes], [no],  [PUTeX],   []],
diff --git a/src/web2c/lib/texmfmp.c b/src/web2c/lib/texmfmp.c
deleted file mode 100644 (file)
index 0132856..0000000
+++ /dev/null
@@ -1,3368 +0,0 @@
-/* texmfmp.c: Hand-coded routines for TeX or Metafont in C.  Originally
-   written by Tim Morgan, drawing from other Unix ports of TeX.  This is
-   a collection of miscellany, everything that's easier (or only
-   possible) to do in C.
-   
-   This file is public domain.  */
-
-/* This file is included from, e.g., texextra,c after
-      #define EXTERN
-      #include <texd.h>
-   to instantiate data from texd.h here.  The ?d.h file is what
-   #defines TeX or MF, which avoids the need for a special
-   Makefile rule.  */
-
-#include <kpathsea/config.h>
-#include <kpathsea/c-ctype.h>
-#include <kpathsea/line.h>
-#include <kpathsea/readable.h>
-#include <kpathsea/variable.h>
-#include <kpathsea/absolute.h>
-#ifdef WIN32
-#include <kpathsea/concatn.h>
-#endif
-
-#if defined (HAVE_SYS_TIME_H)
-#include <sys/time.h>
-#elif defined (HAVE_SYS_TIMEB_H)
-#include <sys/timeb.h>
-#endif
-#include <time.h> /* For `struct tm'.  Moved here for Visual Studio 2005.  */
-
-#if defined(__STDC__)
-#include <locale.h>
-#endif
-
-#include <signal.h> /* Catch interrupts.  */
-
-#include <texmfmp-help.h>
-
-/* {tex,mf}d.h defines TeX, MF, INI, and other such symbols.
-   Unfortunately there's no way to get the banner into this code, so
-   just repeat the text.  */
-/* We also define predicates, e.g., IS_eTeX for all e-TeX like engines, so
-   the rest of this file can remain unchanged when adding a new engine.  */
-#ifdef TeX
-#if defined(XeTeX)
-#define IS_eTeX 1
-#include <xetexdir/xetexextra.h>
-#elif defined (eTeX)
-#define IS_eTeX 1
-#include <etexdir/etexextra.h>
-#elif defined (pdfTeX)
-#define IS_eTeX 1
-#include <pdftexdir/pdftexextra.h>
-#include <pdftexdir/ptexlib.h>
-#elif defined (Aleph)
-#define IS_eTeX 1
-#include <alephdir/alephextra.h>
-#elif defined (pTeX)
-#define IS_pTeX 1
-#include <ptexdir/ptexextra.h>
-#elif defined (epTeX)
-#define IS_eTeX 1
-#define IS_pTeX 1
-#include <eptexdir/eptexextra.h>
-#elif defined (upTeX)
-#define IS_pTeX 1
-#define IS_upTeX 1
-#include <uptexdir/uptexextra.h>
-#elif defined (eupTeX)
-#define IS_eTeX 1
-#define IS_pTeX 1
-#define IS_upTeX 1
-#include <euptexdir/euptexextra.h>
-#elif defined (PUTeX)
-#include <putexdir/putexextra.h>
-#else
-#define BANNER "This is TeX, Version 3.1415926"
-#define COPYRIGHT_HOLDER "D.E. Knuth"
-#define AUTHOR NULL
-#define PROGRAM_HELP TEXHELP
-#define BUG_ADDRESS "tex-k@tug.org"
-#define DUMP_VAR TEXformatdefault
-#define DUMP_LENGTH_VAR formatdefaultlength
-#define DUMP_OPTION "fmt"
-#define DUMP_EXT ".fmt"
-#define INPUT_FORMAT kpse_tex_format
-#define INI_PROGRAM "initex"
-#define VIR_PROGRAM "virtex"
-#endif
-#define edit_var "TEXEDIT"
-#endif /* TeX */
-#ifdef MF
-#define BANNER "This is Metafont, Version 2.718281"
-#define COPYRIGHT_HOLDER "D.E. Knuth"
-#define AUTHOR NULL
-#define PROGRAM_HELP MFHELP
-#define BUG_ADDRESS "tex-k@tug.org"
-#define DUMP_VAR MFbasedefault
-#define DUMP_LENGTH_VAR basedefaultlength
-#define DUMP_OPTION "base"
-#ifdef DOS
-#define DUMP_EXT ".bas"
-#else
-#define DUMP_EXT ".base"
-#endif
-#define INPUT_FORMAT kpse_mf_format
-#define INI_PROGRAM "inimf"
-#define VIR_PROGRAM "virmf"
-#define edit_var "MFEDIT"
-#endif /* MF */
-
-#if !defined(IS_eTeX)
-# define IS_eTeX 0
-#endif
-#if !defined(IS_pTeX)
-# define IS_pTeX 0
-#endif
-#if !defined(IS_upTeX)
-# define IS_upTeX 0
-#endif
-\f
-#if defined(__SyncTeX__)
-/* 
-   SyncTeX file name should be full path in the case where
-   --output-directory option is given.
-   Borrowed from LuaTeX.
-*/
-char *generic_synctex_get_current_name (void)
-{
-  char *pwdbuf, *ret;
-  if (!fullnameoffile) {
-    ret = xstrdup("");
-    return ret;
-  }
-  if (kpse_absolute_p(fullnameoffile, false)) {
-     return xstrdup(fullnameoffile);
-  }
-  pwdbuf = xgetcwd();
-  ret = concat3(pwdbuf, DIR_SEP_STRING, fullnameoffile);
-  free(pwdbuf) ;
-  return ret;
-}
-#endif
-
-#ifdef WIN32
-#if !IS_pTeX
-FILE *Poptr;
-#endif
-#endif
-
-#if defined(TeX) || (defined(MF) && defined(WIN32))
-static int
-Isspace (char c)
-{
-  return (c == ' ' || c == '\t');
-}
-#endif /* TeX || (MF && WIN32) */
-
-#ifdef TeX
-
-/* Shell escape.
-
-   If shellenabledp == 0, all shell escapes are forbidden.
-   If (shellenabledp == 1 && restrictedshell == 0), any command
-     is allowed for a shell escape.
-   If (shellenabledp == 1 && restrictedshell == 1), only commands
-     given in the configuration file as
-   shell_escape_commands = kpsewhich,ebb,extractbb,mpost,metafun,...
-     (no spaces between commands) in texmf.cnf are allowed for a shell
-     escape in a restricted form: command name and arguments should be
-     separated by a white space. The first word should be a command
-     name. The quotation character for an argument with spaces,
-     including a pathname, should be ".  ' should not be used.
-
-     Internally, all arguments are quoted by ' (Unix) or " (Windows)
-     before calling the system() function in order to forbid execution
-     of any embedded command.  In addition, on Windows, special
-     characters of cmd.exe are escaped by using (^).
-
-   If the --shell-escape option is given, we set
-     shellenabledp = 1 and restrictedshell = 0, i.e., any command is allowed.
-   If the --shell-restricted option is given, we set
-     shellenabledp = 1 and restrictedshell = 1, i.e., only given cmds allowed.
-   If the --no-shell-escape option is given, we set
-     shellenabledp = -1 (and restrictedshell is irrelevant).
-   If none of these option are given, there are three cases:
-   (1) In the case where
-       shell_escape = y or
-       shell_escape = t or
-       shell_escape = 1
-       it becomes shellenabledp = 1 and restrictedshell = 0,
-       that is, any command is allowed.
-   (2) In the case where
-       shell_escape = p
-       it becomes shellenabledp = 1 and restrictedshell = 1,
-       that is, restricted shell escape is allowed.
-   (3) In all other cases, shellenabledp = 0, that is, shell
-       escape is forbidden. The value of restrictedshell is
-       irrelevant if shellenabledp == 0.
-*/
-
-/* cmdlist is a list of allowed commands which are given like this:
-   shell_escape_commands = kpsewhich,ebb,extractbb,mpost,metafun
-   in texmf.cnf. */
-
-static char **cmdlist = NULL;
-
-static void 
-mk_shellcmdlist (char *v)
-{
-  char **p;
-  char *q, *r;
-  size_t n;
-
-  q = v;
-  n = 1;
-
-/* analyze the variable shell_escape_commands = foo,bar,...
-   spaces before and after (,) are not allowed. */
-
-  while ((r = strchr (q, ',')) != 0) {
-    n++;
-    q = r + 1;
-  }
-  if (*q)
-    n++;
-  cmdlist = xmalloc (n * sizeof (char *));
-  p = cmdlist;
-  q = v;
-  while ((r = strchr (q, ',')) != 0) {
-    *r = '\0';
-    *p++ = xstrdup (q);
-    q = r + 1;
-  }
-  if (*q)
-    *p++ = xstrdup (q);
-  *p = NULL;
-}
-
-static void
-init_shell_escape (void)
-{
-  if (shellenabledp < 0) {  /* --no-shell-escape on cmd line */
-    shellenabledp = 0;
-
-  } else {
-    if (shellenabledp == 0) {  /* no shell options on cmd line, check cnf */
-      char *v1 = kpse_var_value ("shell_escape");
-      if (v1) {
-        if (*v1 == 't' || *v1 == 'y' || *v1 == '1') {
-          shellenabledp = 1;
-        } else if (*v1 == 'p') {
-          shellenabledp = 1;
-          restrictedshell = 1;
-        }
-        free (v1);
-      }
-    }
-
-    /* If shell escapes are restricted, get allowed cmds from cnf.  */   
-    if (shellenabledp && restrictedshell == 1) {
-      char *v2 = kpse_var_value ("shell_escape_commands");
-      if (v2) {
-        mk_shellcmdlist (v2);
-        free (v2);
-      }
-    }
-  }
-}
-
-#ifdef WIN32
-#define QUOTE '"'
-#else
-#define QUOTE '\''
-#endif
-
-#ifdef WIN32
-static int
-char_needs_quote (int c)
-{
-/* special characters of cmd.exe */
-
-  return (c == '&' || c == '|' || c == '%' || c == '<' ||
-          c == '>' || c == ';' || c == ',' || c == '(' ||
-          c == ')');
-}
-#endif
-
-/* return values:
-  -1 : invalid quotation of an argument
-   0 : command is not allowed
-   2 : restricted shell escape, CMD is allowed.
-   
-   We set *SAFECMD to a safely-quoted version of *CMD; this is what
-   should get executed.  And we set CMDNAME to its first word; this is
-   what is checked against the shell_escape_commands list.  */
-
-static int
-shell_cmd_is_allowed (const char *cmd, char **safecmd, char **cmdname)
-{
-  char **p;
-  char *buf;
-  char *c, *d;
-  const char *s;
-  int  pre, spaces;
-  int  allow = 0;
-
-  /* pre == 1 means that the previous character is a white space
-     pre == 0 means that the previous character is not a white space */
-  buf = xmalloc (strlen (cmd) + 1);
-  strcpy (buf, cmd);
-  c = buf;
-  while (Isspace (*c))
-    c++;
-  d = c;
-  while (!Isspace(*d) && *d)
-    d++;
-  *d = '\0';
-
-  /* *cmdname is the first word of the command line.  For example,
-     *cmdname == "kpsewhich" for
-     \write18{kpsewhich --progname=dvipdfm --format="other text files" config}
-  */
-  *cmdname = xstrdup (c);
-  free (buf);
-
-  /* Is *cmdname listed in a texmf.cnf vriable as
-     shell_escape_commands = foo,bar,... ? */
-  p = cmdlist;
-  if (p) {
-    while (*p) {
-      if (strcmp (*p, *cmdname) == 0) {
-      /* *cmdname is found in the list, so restricted shell escape
-          is allowed */
-        allow = 2;
-        break;
-      }
-      p++;
-    }
-  }
-  if (allow == 2) {
-    spaces = 0;
-    for (s = cmd; *s; s++) {
-      if (Isspace (*s))
-        spaces++;
-    }
-
-    /* allocate enough memory (too much?) */
-#ifdef WIN32
-    *safecmd = xmalloc (2 * strlen (cmd) + 3 + 2 * spaces);
-#else
-    *safecmd = xmalloc (strlen (cmd) + 3 + 2 * spaces);
-#endif
-
-    /* make a safe command line *safecmd */
-    s = cmd;
-    while (Isspace (*s))
-      s++;
-    d = *safecmd;
-    while (!Isspace (*s) && *s)
-      *d++ = *s++;
-
-    pre = 1;
-    while (*s) {
-      /* Quotation given by a user.  " should always be used; we
-         transform it below.  If ' is used, simply immediately
-         return a quotation error.  */
-      if (*s == '\'') {
-        return -1;
-      }
-         
-      if (*s == '"') {
-        /* All arguments are quoted as 'foo' (Unix) or "foo" (Windows)
-           before calling system(). Therefore closing QUOTE is necessary
-           if the previous character is not a white space.
-           example:
-           --format="other text files" becomes
-           '--format=''other text files' (Unix)
-           "--format=""other text files" (Windows) */
-
-        if (pre == 0)
-          *d++ = QUOTE;
-
-        pre = 0;
-        /* output the quotation mark for the quoted argument */
-        *d++ = QUOTE;
-        s++;
-
-        while (*s != '"') {
-          /* Illegal use of ', or closing quotation mark is missing */
-          if (*s == '\'' || *s == '\0')
-            return -1;
-#ifdef WIN32
-          if (char_needs_quote (*s))
-            *d++ = '^';
-#endif
-          *d++ = *s++;
-        }
-
-        /* Closing quotation mark will be output afterwards, so
-           we do nothing here */
-        s++;
-
-        /* The character after the closing quotation mark
-           should be a white space or NULL */
-        if (!Isspace (*s) && *s)
-          return -1;
-
-      /* Beginning of a usual argument */
-      } else if (pre == 1 && !Isspace (*s)) {
-        pre = 0;
-        *d++ = QUOTE;
-#ifdef WIN32
-        if (char_needs_quote (*s))
-          *d++ = '^';
-#endif
-        *d++ = *s++;
-        /* Ending of a usual argument */
-
-      } else if (pre == 0 && Isspace (*s)) {
-        pre = 1;
-        /* Closing quotation mark */
-        *d++ = QUOTE;
-        *d++ = *s++;
-      } else {
-        /* Copy a character from cmd to *safecmd. */
-#ifdef WIN32
-        if (char_needs_quote (*s))
-          *d++ = '^';
-#endif
-        *d++ = *s++;
-      }
-    }
-    /* End of the command line */
-    if (pre == 0) {
-      *d++ = QUOTE;
-    }
-    *d = '\0';
-#ifdef WIN32
-    {
-      char *p, *q, *r;
-      p = *safecmd;
-      if (strlen (p) > 2 && p[1] == ':' && !IS_DIR_SEP (p[2])) {
-          q = xmalloc (strlen (p) + 2);
-          q[0] = p[0];
-          q[1] = p[1];
-          q[2] = '/';
-          q[3] = '\0';
-          strcat (q, (p + 2));
-          free (*safecmd);
-          *safecmd = q;
-      } else if (!IS_DIR_SEP (p[0]) && !(p[1] == ':' && IS_DIR_SEP (p[2]))) { 
-        p = kpse_var_value ("SELFAUTOLOC");
-        if (p) {
-          r = *safecmd;
-          while (*r && !Isspace(*r))
-            r++;
-          if (*r == '\0')
-            q = concatn ("\"", p, "/", *safecmd, "\"", NULL);
-          else {
-            *r = '\0';
-            r++;
-            while (*r && Isspace(*r))
-              r++;
-            if (*r)
-              q = concatn ("\"", p, "/", *safecmd, "\" ", r, NULL);
-            else
-              q = concatn ("\"", p, "/", *safecmd, "\"", NULL);
-          }
-          free (p);
-          free (*safecmd);
-          *safecmd = q;
-        }
-      }
-    }
-#endif
-  }
-
-  return allow;
-}
-
-/* We should only be called with shellenabledp == 1.
-   Return value:
-   -1 if a quotation syntax error.
-   0 if CMD is not allowed; given shellenabledp==1, this is because
-      shell escapes are restricted and CMD is not allowed.
-   1 if shell escapes are not restricted, hence any command is allowed.
-   2 if shell escapes are restricted and CMD is allowed (possibly after
-      quoting).  */
-   
-int
-runsystem (const char *cmd)
-{
-  int allow = 0;
-  char *safecmd = NULL;
-  char *cmdname = NULL;
-
-  if (shellenabledp <= 0) {
-    return 0;
-  }
-  
-  /* If restrictedshell == 0, any command is allowed. */
-  if (restrictedshell == 0)
-    allow = 1;
-  else
-    allow = shell_cmd_is_allowed (cmd, &safecmd, &cmdname);
-
-  if (allow == 1)
-    (void) system (cmd);
-  else if (allow == 2)
-    (void) system (safecmd);
-
-  if (safecmd)
-    free (safecmd);
-  if (cmdname)
-    free (cmdname);
-
-  return allow;
-}
-#endif /* TeX */
-
-#if ENABLE_PIPES
-/* Like runsystem(), the runpopen() function is called only when
-   shellenabledp == 1.   Unlike runsystem(), here we write errors to
-   stderr, since we have nowhere better to use; and of course we return
-   a file handle (or NULL) instead of a status indicator.  */
-
-static FILE *
-runpopen (char *cmd, const char *mode)
-{
-  FILE *f = NULL;
-  char *safecmd = NULL;
-  char *cmdname = NULL;
-  int allow;
-
-#ifdef WIN32
-  char *pp;
-
-  for (pp = cmd; *pp; pp++) {
-    if (*pp == '\'') *pp = '"';
-  }
-#endif
-
-  /* If restrictedshell == 0, any command is allowed. */
-  if (restrictedshell == 0)
-    allow = 1;
-  else
-    allow = shell_cmd_is_allowed (cmd, &safecmd, &cmdname);
-
-  if (allow == 1)
-    f = popen (cmd, mode);
-  else if (allow == 2)
-    f = popen (safecmd, mode);
-  else if (allow == -1)
-    fprintf (stderr, "\nrunpopen quotation error in command line: %s\n",
-             cmd);
-  else
-    fprintf (stderr, "\nrunpopen command not allowed: %s\n", cmdname);
-
-  if (safecmd)
-    free (safecmd);
-  if (cmdname)
-    free (cmdname);
-  return f;
-}
-#endif /* ENABLE_PIPES */
-\f
-/* The main program, etc.  */
-
-#ifdef XeTeX
-#include "xetexdir/XeTeX_ext.h"
-#endif
-
-/* What we were invoked as and with.  */
-char **argv;
-int argc;
-
-/* If the user overrides argv[0] with -progname.  */
-static const_string user_progname;
-
-/* The C version of what might wind up in DUMP_VAR.  */
-static const_string dump_name;
-
-/* The C version of the jobname, if given. */
-static const_string c_job_name;
-
-/* The filename for dynamic character translation, or NULL.  */
-string translate_filename;
-string default_translate_filename;
-
-#if defined(TeX)
-/* Needed for --src-specials option. */
-static char *last_source_name;
-static int last_lineno;
-static boolean srcspecialsoption = false;
-static void parse_src_specials_option (const_string);
-#endif
-
-/* Parsing a first %&-line in the input file. */
-static void parse_first_line (const_string);
-
-/* Parse option flags. */
-static void parse_options (int, string *);
-
-/* Try to figure out if we have been given a filename. */
-static string get_input_file_name (void);
-
-/* Get a true/false value for a variable from texmf.cnf and the environment. */
-static boolean
-texmf_yesno(const_string var)
-{
-  string value = kpse_var_value (var);
-  return value && (*value == 't' || *value == 'y' || *value == '1');
-}
-
-#ifdef pdfTeX
-const char *ptexbanner = BANNER;
-#endif
-
-#ifdef WIN32
-static string
-normalize_quotes (const_string name, const_string mesg);
-#endif
-
-/* The entry point: set up for reading the command line, which will
-   happen in `topenin', then call the main body.  */
-
-void
-maininit (int ac, string *av)
-{
-  string main_input_file;
-
-  /* Save to pass along to topenin.  */
-  argc = ac;
-  argv = av;
-
-  /* Must be initialized before options are parsed.  */
-  interactionoption = 4;
-
-  /* Have things to record as we go along.  */
-  kpse_record_input = recorder_record_input;
-  kpse_record_output = recorder_record_output;
-
-#if defined(__SyncTeX__)
-  /* 0 means "disable Synchronize TeXnology".
-     synctexoption is a *.web variable.
-     We initialize it to a weird value to catch the -synctex command line flag.
-     At runtime, if synctexoption is not INT_MAX, then it contains the
-     command line option provided; otherwise, no such option was given
-     by the user.  */
-# define SYNCTEX_NO_OPTION INT_MAX
-  synctexoption = SYNCTEX_NO_OPTION;
-#endif
-
-#if IS_pTeX
-  kpse_set_program_name (argv[0], NULL);
-  initkanji ();
-#endif
-
-  /* If the user says --help or --version, we need to notice early.  And
-     since we want the --ini option, have to do it before getting into
-     the web (which would read the base file, etc.).  */
-  parse_options (ac, av);
-
-#if IS_pTeX
-  /* In pTeX and friends, texmf.cnf is not recorded in the case of --recorder,
-     because parse_options() is executed after the start of kpathsea due to
-     special initializations. Therefore we record texmf.cnf here. */
-  if (recorder_enabled) {
-    string p = kpse_find_file ("texmf.cnf", kpse_cnf_format, 0);
-    if (p)
-      recorder_record_input (p);
-  }
-#endif
-
-  /* If -progname was not specified, default to the dump name.  */
-  if (!user_progname)
-    user_progname = dump_name;
-  
-  /* Do this early so we can inspect kpse_invocation_name and
-     kpse_program_name below, and because we have to do this before
-     any path searching.  */
-#if IS_pTeX
-  if (user_progname)
-    kpse_reset_program_name (user_progname);
-#else
-  kpse_set_program_name (argv[0], user_progname);
-#endif
-
-  /* If the program name is "mf-nowin", then reset the name as "mf". */
-  if (strncasecmp (kpse_invocation_name, "mf-nowin", 8) == 0)
-    kpse_reset_program_name ("mf");
-
-  /* FIXME: gather engine names in a single spot. */
-  xputenv ("engine", TEXMFENGINENAME);
-  
-  /* Were we given a simple filename? */
-  main_input_file = get_input_file_name();
-
-#ifdef WIN32
-  if (main_input_file == NULL) {
-    string name;
-    boolean quoted;
-
-    name = argv[argc-1];
-    if (name && name[0] != '-' && name[0] != '&' && name[0] != '\\') {
-      if (strlen (name) > 2 && isalpha (name[0]) && name[1] == ':' &&
-          name[2] == '\\') {
-        string pp;
-        for (pp = name; *pp; pp++) {
-          if (IS_KANJI (pp))
-            pp++;
-          else if (*pp == '\\')
-            *pp = '/';
-        }
-      }
-#ifdef XeTeX
-      name = normalize_quotes(argv[argc-1], "argument");
-      main_input_file = kpse_find_file(argv[argc-1], INPUT_FORMAT, false);
-      argv[argc-1] = name;
-#else
-      name = normalize_quotes(argv[argc-1], "argument");
-      quoted = (name[0] == '"');
-      if (quoted) {
-        /* Overwrite last quote and skip first quote. */
-        name[strlen(name)-1] = '\0';
-        name++;
-      }
-      main_input_file = kpse_find_file(name, INPUT_FORMAT, false);
-      if (quoted) {
-        /* Undo modifications */
-        name[strlen(name)] = '"';
-        name--;
-      }
-      argv[argc-1] = name;
-#endif
-    }
-  }
-#endif
-
-  /* Second chance to activate file:line:error style messages, this
-     time from texmf.cnf. */
-  if (filelineerrorstylep < 0) {
-    filelineerrorstylep = 0;
-  } else if (!filelineerrorstylep) {
-    filelineerrorstylep = texmf_yesno ("file_line_error_style");
-  }
-
-  /* If no dump default yet, and we're not doing anything special on
-     this run, we may want to look at the first line of the main input
-     file for a %&<dumpname> specifier.  */
-  if (parsefirstlinep < 0) {
-    parsefirstlinep = 0;
-  } else if (!parsefirstlinep) {
-    parsefirstlinep = texmf_yesno ("parse_first_line");
-  }
-  if (parsefirstlinep && (!dump_name || !translate_filename)) {
-    parse_first_line (main_input_file);
-  }
-  /* Check whether there still is no translate_filename known.  If so,
-     use the default_translate_filename. */
-  /* FIXME: deprecated. */
-  if (!translate_filename) {
-    translate_filename = default_translate_filename;
-  }
-  /* If we're preloaded, I guess everything is set up.  I don't really
-     know any more, it's been so long since anyone preloaded.  */
-  if (readyalready != 314159) {
-    /* The `ini_version' variable is declared/used in the change files.  */
-    boolean virversion = false;
-    if (FILESTRCASEEQ (kpse_program_name, INI_PROGRAM)) {
-      iniversion = true;
-    } else if (FILESTRCASEEQ (kpse_program_name, VIR_PROGRAM)) {
-      virversion = true;
-#ifdef TeX
-    } else if (FILESTRCASEEQ (kpse_program_name, "initex")) {
-      iniversion = true;
-    } else if (FILESTRCASEEQ (kpse_program_name, "virtex")) {
-      virversion = true;
-#ifndef Aleph
-    } else if (FILESTRCASEEQ (kpse_program_name, "mltex")) {
-      mltexp = true;
-#endif /* !Aleph */
-#endif /* TeX */
-    }
-
-    if (!dump_name) {
-      /* If called as *vir{mf,tex,mpost} use `plain'.  Otherwise, use the
-         name we were invoked under.  */
-      dump_name = (virversion ? "plain" : kpse_program_name);
-    }
-  }
-  
-#ifdef TeX
-  /* Sanity check: -mltex, -enc, -etex only work in combination with -ini. */
-  if (!iniversion) {
-#if !defined(Aleph)
-    if (mltexp) {
-      fprintf(stderr, "-mltex only works with -ini\n");
-    }
-#if !defined(XeTeX) && !IS_pTeX
-    if (enctexp) {
-      fprintf(stderr, "-enc only works with -ini\n");
-    }
-#endif
-#endif
-#if IS_eTeX
-    if (etexp) {
-      fprintf(stderr, "-etex only works with -ini\n");
-    }
-#endif
-  }
-#endif
-  
-  /* If we've set up the fmt/base default in any of the various ways
-     above, also set its length.  */
-  if (dump_name) {
-    const_string with_ext = NULL;
-    unsigned name_len = strlen (dump_name);
-    unsigned ext_len = strlen (DUMP_EXT);
-    
-    /* Provide extension if not there already.  */
-    if (name_len > ext_len
-        && FILESTRCASEEQ (dump_name + name_len - ext_len, DUMP_EXT)) {
-      with_ext = dump_name;
-    } else {
-      with_ext = concat (dump_name, DUMP_EXT);
-    }
-    DUMP_VAR = concat (" ", with_ext); /* adjust array for Pascal */
-    DUMP_LENGTH_VAR = strlen (DUMP_VAR + 1);
-  } else {
-    /* For dump_name to be NULL is a bug.  */
-    abort();
-  }
-
-  /* Additional initializations.  No particular reason for doing them
-     here instead of first thing in the change file; less symbols to
-     propagate through Webc, that's all.  */
-#ifdef MF
-  kpse_set_program_enabled (kpse_mf_format, MAKE_TEX_MF_BY_DEFAULT,
-                            kpse_src_compile);
-  kpse_set_program_enabled (kpse_base_format, MAKE_TEX_FMT_BY_DEFAULT,
-                            kpse_src_compile);
-#endif /* MF */
-#ifdef TeX
-#if defined (Aleph)
-  kpse_set_program_enabled (kpse_ocp_format, MAKE_OMEGA_OCP_BY_DEFAULT,
-                            kpse_src_compile);
-  kpse_set_program_enabled (kpse_ofm_format, MAKE_OMEGA_OFM_BY_DEFAULT,
-                            kpse_src_compile);
-  kpse_set_program_enabled (kpse_tfm_format, false, kpse_src_compile);
-#else /* !Aleph */
-  kpse_set_program_enabled (kpse_tfm_format, MAKE_TEX_TFM_BY_DEFAULT,
-                            kpse_src_compile);
-#endif /* !Aleph */
-  kpse_set_program_enabled (kpse_tex_format, MAKE_TEX_TEX_BY_DEFAULT,
-                            kpse_src_compile);
-  kpse_set_program_enabled (kpse_fmt_format, MAKE_TEX_FMT_BY_DEFAULT,
-                            kpse_src_compile);
-
-  init_shell_escape ();
-
-  if (!outputcomment) {
-    outputcomment = kpse_var_value ("output_comment");
-  }
-#endif /* TeX */
-}
-
-/* The entry point: set up for reading the command line, which will
-   happen in `topenin', then call the main body.  */
-
-int
-#if defined(WIN32) && !defined(__MINGW32__) && defined(DLLPROC)
-DLLPROC (int ac, string *av)
-#else
-main (int ac, string *av)
-#endif
-{
-#ifdef __EMX__
-  _wildcard (&ac, &av);
-  _response (&ac, &av);
-#endif
-
-#ifdef WIN32
-  _setmaxstdio(2048);
-  setmode(fileno(stdin), _O_BINARY);
-#endif
-
-  maininit (ac, av);
-
-  /* Call the real main program.  */
-  mainbody ();
-
-  return EXIT_SUCCESS;
-}
-\f
-/* This is supposed to ``open the terminal for input'', but what we
-   really do is copy command line arguments into TeX's or Metafont's
-   buffer, so they can handle them.  If nothing is available, or we've
-   been called already (and hence, argc==0), we return with
-   `last=first'.  */
-
-void
-topenin (void)
-{
-  int i;
-
-#ifdef XeTeX
-  static UFILE termin_file;
-  if (termin == 0) {
-    termin = &termin_file;
-    termin->f = stdin;
-    termin->savedChar = -1;
-    termin->skipNextLF = 0;
-    termin->encodingMode = UTF8;
-    termin->conversionData = 0;
-    inputfile[0] = termin;
-  }
-#endif
-
-  buffer[first] = 0; /* In case there are no arguments.  */
-
-  if (optind < argc) { /* We have command line arguments.  */
-    int k = first;
-    for (i = optind; i < argc; i++) {
-#ifdef XeTeX
-      unsigned char *ptr = (unsigned char *)&(argv[i][0]);
-      /* need to interpret UTF8 from the command line */
-      UInt32 rval;
-      while ((rval = *(ptr++)) != 0) {
-        UInt16 extraBytes = bytesFromUTF8[rval];
-        switch (extraBytes) { /* note: code falls through cases! */
-          case 5: rval <<= 6; if (*ptr) rval += *(ptr++);
-          case 4: rval <<= 6; if (*ptr) rval += *(ptr++);
-          case 3: rval <<= 6; if (*ptr) rval += *(ptr++);
-          case 2: rval <<= 6; if (*ptr) rval += *(ptr++);
-          case 1: rval <<= 6; if (*ptr) rval += *(ptr++);
-          case 0: ;
-        };
-        rval -= offsetsFromUTF8[extraBytes];
-        buffer[k++] = rval;
-      }
-#else
-      char *ptr = &(argv[i][0]);
-      /* Don't use strcat, since in Aleph the buffer elements aren't
-         single bytes.  */
-      while (*ptr) {
-        buffer[k++] = *(ptr++);
-      }
-#endif
-      buffer[k++] = ' ';
-    }
-    argc = 0;  /* Don't do this again.  */
-    buffer[k] = 0;
-  }
-
-  /* Find the end of the buffer.  */
-  for (last = first; buffer[last]; ++last)
-    ;
-
-  /* Make `last' be one past the last non-blank character in `buffer'.  */
-  /* ??? The test for '\r' should not be necessary.  */
-  for (--last; last >= first
-       && ISBLANK (buffer[last]) && buffer[last] != '\r'; --last) 
-    ;
-  last++;
-
-  /* One more time, this time converting to TeX's internal character
-     representation.  */
-#if !defined(Aleph) && !defined(XeTeX)
-  for (i = first; i < last; i++)
-    buffer[i] = xord[buffer[i]];
-#endif
-}
-\f
-/* IPC for TeX.  By Tom Rokicki for the NeXT; it makes TeX ship out the
-   DVI file in a pipe to TeXView so that the output can be displayed
-   incrementally.  Shamim Mohamed adapted it for Web2c.  */
-#if defined (TeX) && defined (IPC)
-
-#ifdef WIN32
-#undef _WINSOCKAPI_
-#include <winsock2.h>
-#else
-#include <sys/socket.h>
-#include <fcntl.h>
-#ifndef O_NONBLOCK /* POSIX */
-#ifdef O_NDELAY    /* BSD */
-#define O_NONBLOCK O_NDELAY
-#elif defined(O_FNDELAY)     /* NeXT */
-#define O_NONBLOCK O_FNDELAY
-#else
-what the fcntl? cannot implement IPC without equivalent for O_NONBLOCK.
-#endif
-#endif /* no O_NONBLOCK */
-#endif /* !WIN32 */
-
-#ifdef WIN32
-# define IPC_AF AF_INET
-# ifndef IPC_LOCAL_HOST
-#  define IPC_LOCAL_HOST "127.0.0.1"
-#  define FIXED_PORT     (unsigned short)4242
-# endif
-#else
-# define IPC_AF AF_UNIX
-# ifndef IPC_PIPE_NAME /* $HOME is prepended to this.  */
-#  define IPC_PIPE_NAME "/.TeXview_Pipe"
-# endif
-#endif
-#ifndef IPC_SERVER_CMD /* Command to run to start the server.  */
-# ifdef WIN32
-#  define IPC_SERVER_CMD "texview.exe"
-# else
-#  define IPC_SERVER_CMD "open `which TeXview`"
-# endif
-#endif
-
-struct msg
-{
-  int   namelength; /* length of auxiliary data */
-  int   eof;        /* new eof for dvi file */
-#if 0  /* see usage of struct msg below */
-  char more_data[0]; /* where the rest of the stuff goes */ 
-#endif
-};
-
-static struct sockaddr *ipc_addr;
-static int ipc_addr_len;
-
-static int
-ipc_make_name (void)
-{
-  if (ipc_addr_len == 0) {
-#ifdef WIN32
-    unsigned long remote_addr = inet_addr(IPC_LOCAL_HOST);
-    if (remote_addr != INADDR_NONE) {
-      struct sockaddr_in *ipc_sin_addr = xmalloc (sizeof (struct sockaddr_in));
-      ipc_sin_addr->sin_family = AF_INET;
-      ipc_sin_addr->sin_addr.s_addr = remote_addr;
-      ipc_sin_addr->sin_port = htons (FIXED_PORT);
-      ipc_addr = ((struct sockaddr *) ipc_sin_addr);
-      ipc_addr_len = sizeof(struct sockaddr_in);
-    }
-#else
-    string s = getenv ("HOME");
-    if (s) {
-      char *ipc_name;
-      ipc_addr = xmalloc (strlen (s) + 40);
-      ipc_addr->sa_family = 0;
-      ipc_name = ipc_addr->sa_data;
-      strcpy (ipc_name, s);
-      strcat (ipc_name, IPC_PIPE_NAME);
-      ipc_addr_len = strlen (ipc_name) + 3;
-    }
-#endif
-  }
-  return ipc_addr_len;
-}
-
-#ifndef INVALID_SOCKET
-# define INVALID_SOCKET (-1)
-#endif
-static int sock = INVALID_SOCKET;
-
-#ifdef WIN32
-# define CLOSE_SOCKET(s) closesocket (s); WSACleanup ()
-#else
-# define CLOSE_SOCKET(s) close (s)
-#endif
-
-static int
-ipc_is_open (void)
-{
-   return sock != INVALID_SOCKET;
-}
-
-static void
-ipc_open_out (void) {
-#ifdef WIN32
-  struct WSAData wsaData;
-  int nCode;
-  unsigned long mode = 1;
-#endif
-#ifdef IPC_DEBUG
-  fputs ("tex: Opening socket for IPC output ...\n", stderr);
-#endif
-  if (sock != INVALID_SOCKET) {
-    return;
-  }
-
-#ifdef WIN32
-  if ((nCode = WSAStartup(MAKEWORD(1, 1), &wsaData)) != 0) {
-    fprintf(stderr,"WSAStartup() returned error code %d.\n", nCode);
-    return;
-  }
-#endif
-
-  if (ipc_make_name () <= 0)
-    return;
-
-  sock = socket (IPC_AF, SOCK_STREAM, 0);
-#ifdef IPC_DEBUG
-  if(sock != INVALID_SOCKET)
-    fprintf(stderr, "tex: Socket handle is %d\n", sock);
-  else
-    fprintf(stderr, "tex: Socket is invalid.\n");
-#endif
-
-  if (sock != INVALID_SOCKET) {
-    if (connect (sock, ipc_addr, ipc_addr_len) != 0 ||
-#ifdef WIN32
-        ioctlsocket (sock, FIONBIO, &mode) < 0
-#else
-        fcntl (sock, F_SETFL, O_NONBLOCK) < 0
-#endif
-        ) {
-      CLOSE_SOCKET (sock);
-      sock = INVALID_SOCKET;
-#ifdef IPC_DEBUG
-      fputs ("tex: IPC socket cannot be connected.\n", stderr);
-      fputs ("tex: Socket is closed.\n", stderr);
-#endif
-      return;
-    }
-#ifdef IPC_DEBUG
-    fputs ("tex: Successfully opened IPC socket.\n", stderr);
-#endif
-  }
-}
-
-static void
-ipc_close_out (void)
-{
-#ifdef IPC_DEBUG
-  fputs ("tex: Closing output socket ...\n", stderr);
-#endif
-  if (ipc_is_open ()) {
-    CLOSE_SOCKET (sock);
-    sock = INVALID_SOCKET;
-  }
-}
-
-static void
-ipc_snd (int n, int is_eof, char *data)
-{
-  struct
-  {
-    struct msg msg;
-    char more_data[1024];
-  } ourmsg;
-
-  if (!ipc_is_open ()) {
-    return;
-  }
-
-#ifdef IPC_DEBUG
-  fprintf(stderr, "%d\t%d\n", ourmsg.msg.namelength, ourmsg.msg.eof);
-  fputs ("tex: Sending message to socket ...\n", stderr);
-#endif
-  ourmsg.msg.namelength = n;
-  ourmsg.msg.eof = is_eof;
-  if (n) {
-    strcpy (ourmsg.more_data, data);
-  }
-  n += sizeof (struct msg);
-#ifdef IPC_DEBUG
-  fprintf(stderr, "%d\t%d\n", ourmsg.msg.namelength, ourmsg.msg.eof);
-  fputs ("tex: Writing to socket...\n", stderr);
-#endif
-#if defined(WIN32)
-  if (send (sock, (char *)&ourmsg, n, 0) != n) {
-#else
-  if (write (sock, &ourmsg, n) != n) {
-#endif
-    ipc_close_out ();
-  }
-#ifdef IPC_DEBUG
-  fputs ("tex: IPC message sent.\n", stderr);
-#endif
-}
-
-/* This routine notifies the server if there is an eof, or the filename
-   if a new DVI file is starting.  This is the routine called by TeX.
-   Aleph defines str_start(#) as str_start_ar[# - too_big_char], with
-   too_big_char = biggest_char + 1 = 65536 (omstr.ch).  */
-
-void
-ipcpage (int is_eof)
-{
-  static boolean begun = false;
-  unsigned len = 0;
-  string p = NULL;
-
-  if (!begun) {
-    string name; /* Just the filename.  */
-    string cwd = xgetcwd ();
-    
-    ipc_open_out ();
-#if !defined(Aleph)
-    len = strstart[outputfilename + 1] - strstart[outputfilename];
-#else
-    len = strstartar[outputfilename + 1 - 65536L] -
-            strstartar[outputfilename - 65536L];
-#endif
-    name = xmalloc (len + 1);
-#if !defined(Aleph)
-    strncpy (name, (string)&strpool[strstart[outputfilename]], len);
-#else
-    {
-    unsigned i;
-    for (i=0; i<len; i++)
-      name[i] =  strpool[i+strstartar[outputfilename - 65536L]];
-    }
-#endif
-    name[len] = 0;
-
-    /* Have to pass whole filename to the other end, since it may have
-       been started up and running as a daemon, e.g., as with the NeXT
-       preview program.  */
-    p = concat3 (cwd, DIR_SEP_STRING, name);
-    free (cwd);
-    free (name);
-
-#if defined (WIN32)
-    { char *q;
-      for (q = p; *q; q++) {
-        if (*q == '\\')
-          *q = '/';
-        else if (IS_KANJI(q))
-          q++;
-      }
-    }
-#endif
-    len = strlen(p);
-    begun = true;
-  }
-  ipc_snd (len, is_eof, p);
-  
-  if (p)
-    free (p);
-}
-#endif /* TeX && IPC */
-\f
-#if defined (TeX) || defined (MF)
-  /* TCX and Aleph&Co get along like sparks and gunpowder. */
-#if !defined(Aleph) && !defined(XeTeX)
-
-/* Return the next number following START, setting POST to the following
-   character, as in strtol.  Issue a warning and return -1 if no number
-   can be parsed.  */
-
-static int
-tcx_get_num (int upb,
-             unsigned line_count,
-             string start,
-             string *post)
-{
-  int num = strtol (start, post, 0);
-  assert (post && *post);
-  if (*post == start) {
-    /* Could not get a number. If blank line, fine. Else complain.  */
-    string p = start;
-    while (*p && ISSPACE (*p))
-      p++;
-    if (*p != 0)
-      fprintf (stderr, "%s:%d: Expected numeric constant, not `%s'.\n",
-               translate_filename, line_count, start);
-    num = -1;
-  } else if (num < 0 || num > upb) {
-    fprintf (stderr, "%s:%d: Destination charcode %d <0 or >%d.\n",
-             translate_filename, line_count, num, upb);
-    num = -1;
-  }  
-
-  return num;
-}
-
-/* Update the xchr, xord, and xprn arrays for TeX, allowing a
-   translation table specified at runtime via an external file.
-   Look for the character translation file FNAME along the same path as
-   tex.pool.  If no suffix in FNAME, use .tcx (don't bother trying to
-   support extension-less names for these files).  */
-
-/* FIXME: A new format ought to be introduced for these files. */
-
-void
-readtcxfile (void)
-{
-  string orig_filename;
-  if (!find_suffix (translate_filename)) {
-    translate_filename = concat (translate_filename, ".tcx");
-  }
-  orig_filename = translate_filename;
-  translate_filename
-    = kpse_find_file (translate_filename, kpse_web2c_format, true);
-  if (translate_filename) {
-    string line;
-    unsigned line_count = 0;
-    FILE *translate_file = xfopen (translate_filename, FOPEN_R_MODE);
-    while ((line = read_line (translate_file))) {
-      int first;
-      string start2;
-      string comment_loc = strchr (line, '%');
-      if (comment_loc)
-        *comment_loc = 0;
-
-      line_count++;
-
-      first = tcx_get_num (255, line_count, line, &start2);
-      if (first >= 0) {
-        string start3;
-        int second;
-        int printable;
-        
-        second = tcx_get_num (255, line_count, start2, &start3);
-        if (second >= 0) {
-            /* I suppose we could check for nonempty junk following the
-               "printable" code, but let's not bother.  */
-          string extra;
-            
-          /* If they mention a second code, make that the internal number.  */
-          xord[first] = second;
-          xchr[second] = first;
-
-          printable = tcx_get_num (1, line_count, start3, &extra);
-          /* Not-a-number, may be a comment. */
-          if (printable == -1)
-            printable = 1;
-          /* Don't allow the 7bit ASCII set to become unprintable. */
-          if (32 <= second && second <= 126)
-            printable = 1;
-        } else {
-          second = first; /* else make internal the same as external */
-          /* If they mention a charcode, call it printable.  */
-          printable = 1;
-        }
-
-        xprn[second] = printable;
-      }
-      free (line);
-    }
-    xfclose(translate_file, translate_filename);
-  } else {
-    WARNING1 ("Could not open char translation file `%s'", orig_filename);
-  }
-}
-#endif /* !Aleph && !XeTeX */
-#endif /* TeX || MF [character translation] */
-\f
-#ifdef XeTeX /* XeTeX handles this differently, and allows odd quotes within names */
-static string
-normalize_quotes (const_string name, const_string mesg)
-{
-    int quote_char = 0;
-    boolean must_quote = false;
-    int len = strlen(name);
-    /* Leave room for quotes and NUL. */
-    string ret;
-    string p;
-    const_string q;
-    for (q = name; *q; q++) {
-        if (*q == ' ') {
-            if (!must_quote) {
-                len += 2;
-                must_quote = true;
-            }
-        }
-        else if (*q == '\"' || *q == '\'') {
-            must_quote = true;
-            if (quote_char == 0)
-                quote_char = '\"' + '\'' - *q;
-            len += 2; /* this could sometimes add length we don't need */
-        }
-    }
-    ret = xmalloc(len + 1);
-    p = ret;
-    if (must_quote) {
-        if (quote_char == 0)
-            quote_char = '\"';
-        *p++ = quote_char;
-    }
-    for (q = name; *q; q++) {
-        if (*q == quote_char) {
-            *p++ = quote_char;
-            quote_char = '\"' + '\'' - quote_char;
-            *p++ = quote_char;
-        }
-        *p++ = *q;
-    }
-    if (quote_char != 0)
-        *p++ = quote_char;
-    *p = '\0';
-    return ret;
-}
-#else
-/* Normalize quoting of filename -- that is, only quote if there is a space,
-   and always use the quote-name-quote style. */
-static string
-normalize_quotes (const_string name, const_string mesg)
-{
-    boolean quoted = false;
-    boolean must_quote = (strchr(name, ' ') != NULL);
-    /* Leave room for quotes and NUL. */
-    string ret = xmalloc(strlen(name)+3);
-    string p;
-    const_string q;
-    p = ret;
-    if (must_quote)
-        *p++ = '"';
-    for (q = name; *q; q++) {
-        if (*q == '"')
-            quoted = !quoted;
-        else
-            *p++ = *q;
-    }
-    if (must_quote)
-        *p++ = '"';
-    *p = '\0';
-    if (quoted) {
-        fprintf(stderr, "! Unbalanced quotes in %s %s\n", mesg, name);
-        uexit(1);
-    }
-    return ret;
-}
-#endif
-
-/* Getting the input filename. */
-string
-get_input_file_name (void)
-{
-  string input_file_name = NULL;
-
-  if (argv[optind] && argv[optind][0] != '&' && argv[optind][0] != '\\') {
-    /* Not &format, not \input, so assume simple filename. */    
-    string name;
-#ifndef XeTeX
-    boolean quoted;
-#endif
-
-#ifdef WIN32
-    if (strlen (argv[optind]) > 2 && isalpha (argv[optind][0]) &&
-        argv[optind][1] == ':' && argv[optind][2] == '\\') {
-      char *pp;
-      for (pp = argv[optind]; *pp; pp++) {
-        if (*pp == '\\')
-          *pp = '/';
-        else if (IS_KANJI(pp))
-          pp++;
-      }
-    }
-#endif
-
-    name = normalize_quotes(argv[optind], "argument");
-#ifdef XeTeX
-    input_file_name = kpse_find_file(argv[optind], INPUT_FORMAT, false);
-#else
-    quoted = (name[0] == '"');
-    if (quoted) {
-        /* Overwrite last quote and skip first quote. */
-        name[strlen(name)-1] = '\0';
-        name++;
-    }
-    input_file_name = kpse_find_file(name, INPUT_FORMAT, false);
-    if (quoted) {
-        /* Undo modifications */
-        name[strlen(name)] = '"';
-        name--;
-    }
-#endif
-    argv[optind] = name;
-  }
-  return input_file_name;
-}
-\f
-/* Reading the options.  */
-
-/* Test whether getopt found an option ``A''.
-   Assumes the option index is in the variable `option_index', and the
-   option table in a variable `long_options'.  */
-#define ARGUMENT_IS(a) STREQ (long_options[option_index].name, a)
-
-/* SunOS cc can't initialize automatic structs, so make this static.  */
-static struct option long_options[]
-  = { { DUMP_OPTION,                 1, 0, 0 },
-#ifdef TeX
-      /* FIXME: Obsolete -- for backward compatibility only. */
-      { "efmt",                      1, 0, 0 },
-#endif
-      { "help",                      0, 0, 0 },
-      { "ini",                       0, &iniversion, 1 },
-      { "interaction",               1, 0, 0 },
-      { "halt-on-error",             0, &haltonerrorp, 1 },
-      { "kpathsea-debug",            1, 0, 0 },
-      { "progname",                  1, 0, 0 },
-      { "version",                   0, 0, 0 },
-      { "recorder",                  0, &recorder_enabled, 1 },
-#ifdef TeX
-#ifdef IPC
-      { "ipc",                       0, &ipcon, 1 },
-      { "ipc-start",                 0, &ipcon, 2 },
-#endif /* IPC */
-#if !defined(Aleph)
-      { "mltex",                     0, &mltexp, 1 },
-#if !defined(XeTeX) && !IS_pTeX
-      { "enc",                       0, &enctexp, 1 },
-#endif
-#endif /* !Aleph */
-#if IS_eTeX
-      { "etex",                      0, &etexp, 1 },
-#endif
-      { "output-comment",            1, 0, 0 },
-#if defined(pdfTeX)
-      { "draftmode",                 0, 0, 0 },
-      { "output-format",             1, 0, 0 },
-#endif /* pdfTeX */
-      { "shell-escape",              0, &shellenabledp, 1 },
-      { "no-shell-escape",           0, &shellenabledp, -1 },
-      { "enable-write18",            0, &shellenabledp, 1 },
-      { "disable-write18",           0, &shellenabledp, -1 },
-      { "shell-restricted",          0, 0, 0 },
-      { "debug-format",              0, &debugformatfile, 1 },
-      { "src-specials",              2, 0, 0 },
-#if defined(__SyncTeX__)
-      /* Synchronization: just like "interaction" above */
-      { "synctex",                   1, 0, 0 },
-#endif
-#endif /* TeX */
-#if defined (TeX) || defined (MF)
-      { "file-line-error-style",     0, &filelineerrorstylep, 1 },
-      { "no-file-line-error-style",  0, &filelineerrorstylep, -1 },
-      /* Shorter option names for the above. */
-      { "file-line-error",           0, &filelineerrorstylep, 1 },
-      { "no-file-line-error",        0, &filelineerrorstylep, -1 },
-      { "jobname",                   1, 0, 0 },
-      { "output-directory",          1, 0, 0 },
-      { "parse-first-line",          0, &parsefirstlinep, 1 },
-      { "no-parse-first-line",       0, &parsefirstlinep, -1 },
-#if !defined(Aleph)
-      { "translate-file",            1, 0, 0 },
-      { "default-translate-file",    1, 0, 0 },
-      { "8bit",                      0, &eightbitp, 1 },
-#endif /* !Aleph */
-#if defined(XeTeX)
-      { "no-pdf",                    0, &nopdfoutput, 1 },
-      { "output-driver",             1, 0, 0 },
-      { "papersize",                 1, 0, 0 },
-#endif /* XeTeX */
-      { "mktex",                     1, 0, 0 },
-      { "no-mktex",                  1, 0, 0 },
-#endif /* TeX or MF */
-#if IS_pTeX
-#ifdef WIN32
-      { "sjis-terminal",             0, &sjisterminal, 1 },
-      { "guess-input-enc",           0, &infile_enc_auto, 1 },
-      { "no-guess-input-enc",        0, &infile_enc_auto, 0 },
-#endif
-      { "kanji",                     1, 0, 0 },
-      { "kanji-internal",            1, 0, 0 },
-#endif /* IS_pTeX */
-      { 0, 0, 0, 0 } };
-
-static void
-parse_options (int argc, string *argv)
-{
-  int g;   /* `getopt' return code.  */
-  int option_index;
-
-  for (;;) {
-    g = getopt_long_only (argc, argv, "+", long_options, &option_index);
-
-    if (g == -1) /* End of arguments, exit the loop.  */
-      break;
-
-    if (g == '?') { /* Unknown option.  */
-      /* FIXME: usage (argv[0]); replaced by continue. */
-      continue;
-    }
-
-    assert (g == 0); /* We have no short option names.  */
-
-    if (ARGUMENT_IS ("kpathsea-debug")) {
-      kpathsea_debug |= atoi (optarg);
-
-#ifdef XeTeX
-    } else if (ARGUMENT_IS ("papersize")) {
-      papersize = optarg;
-    } else if (ARGUMENT_IS ("output-driver")) {
-      outputdriver = optarg;
-#endif
-
-    } else if (ARGUMENT_IS ("progname")) {
-      user_progname = optarg;
-
-    } else if (ARGUMENT_IS ("jobname")) {
-#ifdef XeTeX
-      c_job_name = optarg;
-#else
-      c_job_name = normalize_quotes (optarg, "jobname");
-#endif
-
-    } else if (ARGUMENT_IS (DUMP_OPTION)) {
-      dump_name = optarg;
-      dumpoption = true;
-
-#ifdef TeX
-    /* FIXME: Obsolete -- for backward compatibility only. */
-    } else if (ARGUMENT_IS ("efmt")) {
-      dump_name = optarg;
-      dumpoption = true;
-#endif
-
-    } else if (ARGUMENT_IS ("output-directory")) {
-      output_directory = optarg;
-      
-#ifdef TeX
-    } else if (ARGUMENT_IS ("output-comment")) {
-      unsigned len = strlen (optarg);
-      if (len < 256) {
-        outputcomment = optarg;
-      } else {
-        WARNING2 ("Comment truncated to 255 characters from %d. (%s)",
-                  len, optarg);
-        outputcomment = xmalloc (256);
-        strncpy (outputcomment, optarg, 255);
-        outputcomment[255] = 0;
-      }
-
-#ifdef IPC
-    } else if (ARGUMENT_IS ("ipc-start")) {
-      ipc_open_out ();
-      /* Try to start up the other end if it's not already.  */
-      if (!ipc_is_open ()) {
-#ifdef WIN32
-        if (spawnlp (_P_NOWAIT, IPC_SERVER_CMD, IPC_SERVER_CMD, NULL) != -1) {
-#else
-        if (system (IPC_SERVER_CMD) == 0) {
-#endif
-          unsigned i;
-          for (i = 0; i < 20 && !ipc_is_open (); i++) {
-#ifdef WIN32
-            Sleep (100); /* 2000ms is too long for a simple w32 example */
-#else
-            sleep (2);
-#endif
-            ipc_open_out ();
-          }
-        }
-      }
-#endif /* IPC */
-
-    } else if (ARGUMENT_IS ("shell-restricted")) {
-      shellenabledp = 1;
-      restrictedshell = 1;
-      
-    } else if (ARGUMENT_IS ("src-specials")) {
-       last_source_name = xstrdup("");
-       /* Option `--src" without any value means `auto' mode. */
-       if (optarg == NULL) {
-         insertsrcspecialeverypar = true;
-         insertsrcspecialauto = true;
-         srcspecialsoption = true;
-         srcspecialsp = true;
-       } else {
-          parse_src_specials_option(optarg);
-       }
-#endif /* TeX */
-#if defined(pdfTeX)
-    } else if (ARGUMENT_IS ("output-format")) {
-       pdfoutputoption = 1;
-       if (strcmp(optarg, "dvi") == 0) {
-         pdfoutputvalue = 0;
-       } else if (strcmp(optarg, "pdf") == 0) {
-         pdfoutputvalue = 2;
-       } else {
-         WARNING1 ("Ignoring unknown value `%s' for --output-format", optarg);
-         pdfoutputoption = 0;
-       }
-    } else if (ARGUMENT_IS ("draftmode")) {
-      pdfdraftmodeoption = 1;
-      pdfdraftmodevalue = 1;
-#endif /* pdfTeX */
-#if defined (TeX) || defined (MF)
-#if !defined(Aleph)
-    } else if (ARGUMENT_IS ("translate-file")) {
-      translate_filename = optarg;
-    } else if (ARGUMENT_IS ("default-translate-file")) {
-      default_translate_filename = optarg;
-#endif /* !Aleph */
-    } else if (ARGUMENT_IS ("mktex")) {
-      kpse_maketex_option (optarg, true);
-    } else if (ARGUMENT_IS ("no-mktex")) {
-      kpse_maketex_option (optarg, false);
-#endif /* TeX or MF */
-    } else if (ARGUMENT_IS ("interaction")) {
-        /* These numbers match @d's in *.ch */
-      if (STREQ (optarg, "batchmode")) {
-        interactionoption = 0;
-      } else if (STREQ (optarg, "nonstopmode")) {
-        interactionoption = 1;
-      } else if (STREQ (optarg, "scrollmode")) {
-        interactionoption = 2;
-      } else if (STREQ (optarg, "errorstopmode")) {
-        interactionoption = 3;
-      } else {
-        WARNING1 ("Ignoring unknown argument `%s' to --interaction", optarg);
-      }
-#if IS_pTeX
-    } else if (ARGUMENT_IS ("kanji")) {
-      if (!set_enc_string (optarg, NULL)) {
-        WARNING1 ("Ignoring unknown argument `%s' to --kanji", optarg);
-      }
-    } else if (ARGUMENT_IS ("kanji-internal")) {
-      if (!set_enc_string (NULL, optarg)) {
-        WARNING1 ("Ignoring unknown argument `%s' to --kanji-internal", optarg);
-      }
-#endif
-
-    } else if (ARGUMENT_IS ("help")) {
-        usagehelp (PROGRAM_HELP, BUG_ADDRESS);
-
-#if defined(__SyncTeX__)
-    } else if (ARGUMENT_IS ("synctex")) {
-               /* Synchronize TeXnology: catching the command line option as a long  */
-               synctexoption = (int) strtol(optarg, NULL, 0);
-#endif
-
-    } else if (ARGUMENT_IS ("version")) {
-        char *versions;
-#if defined (pdfTeX) || defined(XeTeX)
-        initversionstring(&versions); 
-#else
-        versions = NULL;
-#endif
-        printversionandexit (BANNER, COPYRIGHT_HOLDER, AUTHOR, versions);
-
-    } /* Else it was a flag; getopt has already done the assignment.  */
-  }
-}
-
-#if defined(TeX)
-void 
-parse_src_specials_option (const_string opt_list)
-{
-  char * toklist = xstrdup(opt_list);
-  char * tok;
-  insertsrcspecialauto = false;
-  tok = strtok (toklist, ", ");
-  while (tok) {
-    if (strcmp (tok, "everypar") == 0
-        || strcmp (tok, "par") == 0
-        || strcmp (tok, "auto") == 0) {
-      insertsrcspecialauto = true;
-      insertsrcspecialeverypar = true;
-    } else if (strcmp (tok, "everyparend") == 0
-               || strcmp (tok, "parend") == 0)
-      insertsrcspecialeveryparend = true;
-    else if (strcmp (tok, "everycr") == 0
-             || strcmp (tok, "cr") == 0)
-      insertsrcspecialeverycr = true;
-    else if (strcmp (tok, "everymath") == 0
-             || strcmp (tok, "math") == 0)
-      insertsrcspecialeverymath = true;
-    else if (strcmp (tok, "everyhbox") == 0
-             || strcmp (tok, "hbox") == 0)
-      insertsrcspecialeveryhbox = true;
-    else if (strcmp (tok, "everyvbox") == 0
-             || strcmp (tok, "vbox") == 0)
-      insertsrcspecialeveryvbox = true;
-    else if (strcmp (tok, "everydisplay") == 0
-             || strcmp (tok, "display") == 0)
-      insertsrcspecialeverydisplay = true;
-    else if (strcmp (tok, "none") == 0) {
-      /* This one allows to reset an option that could appear in texmf.cnf */
-      insertsrcspecialauto = insertsrcspecialeverypar = 
-        insertsrcspecialeveryparend = insertsrcspecialeverycr = 
-        insertsrcspecialeverymath =  insertsrcspecialeveryhbox =
-        insertsrcspecialeveryvbox = insertsrcspecialeverydisplay = false;
-    } else {
-      WARNING1 ("Ignoring unknown argument `%s' to --src-specials", tok);
-    }
-    tok = strtok(0, ", ");
-  }
-  free(toklist);
-  srcspecialsp=insertsrcspecialauto | insertsrcspecialeverypar |
-    insertsrcspecialeveryparend | insertsrcspecialeverycr |
-    insertsrcspecialeverymath |  insertsrcspecialeveryhbox |
-    insertsrcspecialeveryvbox | insertsrcspecialeverydisplay;
-  srcspecialsoption = true;
-}
-#endif
-
-/* If the first thing on the command line (we use the globals `argv' and
-   `optind') is a normal filename (i.e., does not start with `&' or
-   `\'), and if we can open it, and if its first line is %&FORMAT, and
-   FORMAT is a readable dump file, then set DUMP_VAR to FORMAT.
-   Also call kpse_reset_program_name to ensure the correct paths for the
-   format are used.  */
-static void
-parse_first_line (const_string filename)
-{
-  FILE *f = filename ? fopen (filename, FOPEN_R_MODE) : NULL;
-  if (f) {
-    string first_line = read_line (f);
-    xfclose (f, filename);
-
-    /* We deal with the general format "%&fmt --translate-file=tcx" */
-    /* The idea of using this format came from Wlodzimierz Bzyl
-       <matwb@monika.univ.gda.pl> */
-    if (first_line && first_line[0] == '%' && first_line[1] == '&') {
-      /* Parse the first line into at most three space-separated parts. */
-      char *s;
-      char *part[4];
-      int npart;
-      char **parse;
-
-      for (s = first_line+2; ISBLANK(*s); ++s)
-        ;
-      npart = 0;
-      while (*s && npart != 3) {
-        part[npart++] = s;
-        while (*s && *s != ' ') s++;
-        while (*s == ' ') *s++ = '\0';
-      }
-      part[npart] = NULL;
-      parse = part;
-      /* Look at what we've got.  Very crude! */
-      if (*parse && **parse != '-') {
-        /* A format name */
-        if (dump_name) {
-          /* format already determined, do nothing. */
-        } else {
-          string f_name = concat (part[0], DUMP_EXT);
-          string d_name = kpse_find_file (f_name, DUMP_FORMAT, false);
-          if (d_name && kpse_readable_file (d_name)) {
-            dump_name = xstrdup (part[0]);
-            kpse_reset_program_name (dump_name);
-            /* Tell TeX/MF/MP we have a %&name line... */
-            dumpline = true;
-          }
-          free (f_name);
-        }
-        parse++;
-      }
-      /* The tcx stuff, if any.  Should we support the -translate-file
-         form as well as --translate-file?  */
-      if (*parse) {
-        s = NULL;
-        if (translate_filename) {
-          /* TCX file already set, do nothing. */
-        } else if (STREQ (*parse, "--translate-file")) {
-          s = *(parse+1);
-        } else if (STREQ (*parse, "-translate-file")) {
-          s = *(parse+1);
-        } else if (STRNEQ (*parse, "--translate-file=", 17)) {
-          s = *parse+17;
-        } else if (STRNEQ (*parse, "-translate-file=", 16)) {
-          s = *parse+16;
-        }
-        /* Just set the name, no sanity checks here. */
-        /* FIXME: remove trailing spaces. */
-        if (s && *s) {
-          translate_filename = xstrdup(s);
-        }
-      }
-    }
-    if (first_line)
-      free (first_line);
-  }
-}
-\f
-/* 
-  piped I/O
- */
-
-/* The code that implements popen() needs an array for tracking 
-   possible pipe file pointers, because these need to be
-   closed using pclose().
-*/
-
-#if ENABLE_PIPES
-
-#define NUM_PIPES 16
-
-static FILE *pipes [NUM_PIPES];
-
-boolean
-open_in_or_pipe (FILE **f_ptr, int filefmt, const_string fopen_mode)
-{
-    string fname = NULL;
-    int i; /* iterator */
-
-    /* opening a read pipe is straightforward, only have to
-       skip past the pipe symbol in the file name. filename
-       quoting is assumed to happen elsewhere (it does :-)) */
-
-    if (shellenabledp && *(nameoffile+1) == '|') {
-      /* the user requested a pipe */
-      *f_ptr = NULL;
-      fname = xmalloc(strlen((const_string)(nameoffile+1))+1);
-      strcpy(fname,(const_string)(nameoffile+1));
-      recorder_record_input (fname + 1);
-      *f_ptr = runpopen(fname+1,"r");
-      free(fname);
-      for (i=0; i<NUM_PIPES; i++) {
-        if (pipes[i]==NULL) {
-          pipes[i] = *f_ptr;
-          break;
-        }
-      }
-      if (*f_ptr)
-        setvbuf (*f_ptr,NULL,_IONBF,0);
-#ifdef WIN32
-      Poptr = *f_ptr;
-#endif
-
-      return *f_ptr != NULL;
-    }
-
-    return open_input(f_ptr,filefmt,fopen_mode) ;
-}
-
-#ifdef XeTeX
-boolean
-u_open_in_or_pipe(unicodefile* f, integer filefmt, const_string fopen_mode, integer mode, integer encodingData)
-{
-    string fname = NULL;
-    int i; /* iterator */
-
-    /* opening a read pipe is straightforward, only have to
-       skip past the pipe symbol in the file name. filename
-       quoting is assumed to happen elsewhere (it does :-)) */
-
-    if (shellenabledp && *(nameoffile+1) == '|') {
-      /* the user requested a pipe */
-      *f = malloc(sizeof(UFILE));
-      (*f)->encodingMode = (mode == AUTO) ? UTF8 : mode;
-      (*f)->conversionData = 0;
-      (*f)->savedChar = -1;
-      (*f)->skipNextLF = 0;
-      (*f)->f = NULL;
-      fname = xmalloc(strlen((const_string)(nameoffile+1))+1);
-      strcpy(fname,(const_string)(nameoffile+1));
-      recorder_record_input (fname + 1);
-      (*f)->f = runpopen(fname+1,"r");
-      free(fname);
-      for (i=0; i<NUM_PIPES; i++) {
-        if (pipes[i]==NULL) {
-          pipes[i] = (*f)->f;
-          break;
-        }
-      }
-      if ((*f)->f)
-        setvbuf ((*f)->f,NULL,_IONBF,0);
-#ifdef WIN32
-      Poptr = (*f)->f;
-#endif
-
-      return (*f)->f != NULL;
-    }
-
-    return u_open_in(f, filefmt, fopen_mode, mode, encodingData);
-}
-#endif
-
-boolean
-open_out_or_pipe (FILE **f_ptr, const_string fopen_mode)
-{
-    string fname;
-    int i; /* iterator */
-
-    /* opening a write pipe takes a little bit more work, because TeX
-       will perhaps have appended ".tex".  To avoid user confusion as
-       much as possible, this extension is stripped only when the command
-       is a bare word.  Some small string trickery is needed to make
-       sure the correct number of bytes is free()-d afterwards */
-       
-    if (shellenabledp && *(nameoffile+1) == '|') {
-      /* the user requested a pipe */
-      fname = xmalloc(strlen((const_string)(nameoffile+1))+1);
-      strcpy(fname,(const_string)(nameoffile+1));
-      if (strchr (fname,' ')==NULL && strchr(fname,'>')==NULL) {
-        /* mp and mf currently do not use this code, but it 
-           is better to be prepared */
-        if (STREQ((fname+strlen(fname)-4),".tex"))
-          *(fname+strlen(fname)-4) = 0;
-        *f_ptr = runpopen(fname+1,"w");
-        *(fname+strlen(fname)) = '.';
-      } else {
-        *f_ptr = runpopen(fname+1,"w");
-      }
-      recorder_record_output (fname + 1);
-      free(fname);
-
-      for (i=0; i<NUM_PIPES; i++) {
-        if (pipes[i]==NULL) {
-          pipes[i] = *f_ptr;
-          break;
-        }
-      }
-
-      if (*f_ptr)
-        setvbuf(*f_ptr,NULL,_IONBF,0);
-
-      return *f_ptr != NULL;
-    }
-
-    return open_output(f_ptr,fopen_mode);
-}
-
-
-void
-close_file_or_pipe (FILE *f)
-{
-  int i; /* iterator */
-
-  if (shellenabledp) {
-    /* if this file was a pipe, pclose() it and return */    
-    for (i=0; i<NUM_PIPES; i++) {
-      if (pipes[i] == f) {
-        if (f) {
-          pclose (f);
-#ifdef WIN32
-          Poptr = NULL;
-#endif
-        }
-        pipes[i] = NULL;
-        return;
-      }
-    }
-  }
-  close_file(f);
-}
-#endif /* ENABLE_PIPES */
-\f
-/* All our interrupt handler has to do is set TeX's or Metafont's global
-   variable `interrupt'; then they will do everything needed.  */
-#ifdef WIN32
-/* Win32 doesn't set SIGINT ... */
-static BOOL WINAPI
-catch_interrupt (DWORD arg)
-{
-  switch (arg) {
-  case CTRL_C_EVENT:
-  case CTRL_BREAK_EVENT:
-    interrupt = 1;
-    return TRUE;
-  default:
-    /* No need to set interrupt as we are exiting anyway */
-    return FALSE;
-  }
-}
-#else /* not WIN32 */
-static RETSIGTYPE
-catch_interrupt (int arg)
-{
-  interrupt = 1;
-#ifdef OS2
-  (void) signal (SIGINT, SIG_ACK);
-#else
-  (void) signal (SIGINT, catch_interrupt);
-#endif /* not OS2 */
-}
-#endif /* not WIN32 */
-
-/* Besides getting the date and time here, we also set up the interrupt
-   handler, for no particularly good reason.  It's just that since the
-   `fix_date_and_time' routine is called early on (section 1337 in TeX,
-   ``Get the first line of input and prepare to start''), this is as
-   good a place as any.  */
-
-void
-get_date_and_time (integer *minutes,  integer *day,
-                   integer *month,  integer *year)
-{
-  time_t myclock = time ((time_t *) 0);
-  struct tm *tmptr = localtime (&myclock);
-
-  *minutes = tmptr->tm_hour * 60 + tmptr->tm_min;
-  *day = tmptr->tm_mday;
-  *month = tmptr->tm_mon + 1;
-  *year = tmptr->tm_year + 1900;
-
-  {
-#ifdef SA_INTERRUPT
-    /* Under SunOS 4.1.x, the default action after return from the
-       signal handler is to restart the I/O if nothing has been
-       transferred.  The effect on TeX is that interrupts are ignored if
-       we are waiting for input.  The following tells the system to
-       return EINTR from read() in this case.  From ken@cs.toronto.edu.  */
-
-    struct sigaction a, oa;
-
-    a.sa_handler = catch_interrupt;
-    sigemptyset (&a.sa_mask);
-    sigaddset (&a.sa_mask, SIGINT);
-    a.sa_flags = SA_INTERRUPT;
-    sigaction (SIGINT, &a, &oa);
-    if (oa.sa_handler != SIG_DFL)
-      sigaction (SIGINT, &oa, (struct sigaction *) 0);
-#else /* no SA_INTERRUPT */
-#ifdef WIN32
-    SetConsoleCtrlHandler(catch_interrupt, TRUE);
-#else /* not WIN32 */
-    RETSIGTYPE (*old_handler)(int);
-    
-    old_handler = signal (SIGINT, catch_interrupt);
-    if (old_handler != SIG_DFL)
-      signal (SIGINT, old_handler);
-#endif /* not WIN32 */
-#endif /* no SA_INTERRUPT */
-  }
-}
-\f
-#if defined(pdfTeX)
-/*
- Getting a high resolution time.
- */
-void
-get_seconds_and_micros (integer *seconds,  integer *micros)
-{
-#if defined (HAVE_GETTIMEOFDAY)
-  struct timeval tv;
-  gettimeofday(&tv, NULL);
-  *seconds = tv.tv_sec;
-  *micros  = tv.tv_usec;
-#elif defined (HAVE_FTIME)
-  struct timeb tb;
-  ftime(&tb);
-  *seconds = tb.time;
-  *micros  = tb.millitm*1000;
-#else
-  time_t myclock = time((time_t*)NULL);
-  *seconds = myclock;
-  *micros  = 0;
-#endif
-}
-#endif
-\f
-/* Read a line of input as efficiently as possible while still looking
-   like Pascal.  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).  */
-
-#ifndef XeTeX /* for XeTeX, we have a replacement function in XeTeX_ext.c */
-boolean
-input_line (FILE *f)
-{
-  int i = EOF;
-
-  /* Recognize either LF or CR as a line terminator.  */
-#if IS_pTeX
-  last = input_line2(f, (unsigned char *)buffer, first, bufsize, &i);
-#else
-#ifdef WIN32
-  if (f != Poptr && fileno (f) != fileno (stdin)) {
-    long position = ftell (f);
-
-    if (position == 0L) {  /* Detect and skip Byte order marks.  */
-      int k1 = getc (f);
-
-      if (k1 != 0xff && k1 != 0xfe && k1 != 0xef)
-        rewind (f);
-      else {
-        int k2 = getc (f);
-
-        if (k2 != 0xff && k2 != 0xfe && k2 != 0xbb)
-          rewind (f);
-        else if ((k1 == 0xff && k2 == 0xfe) || /* UTF-16(LE) */
-                 (k1 == 0xfe && k2 == 0xff))   /* UTF-16(BE) */
-          ;
-        else {
-          int k3 = getc (f);
-
-          if (k1 == 0xef && k2 == 0xbb && k3 == 0xbf) /* UTF-8 */
-            ;
-          else
-            rewind (f);
-        }
-      }
-    }
-  }
-#endif
-  last = first;
-  while (last < bufsize && (i = getc (f)) != EOF && i != '\n' && i != '\r')
-    buffer[last++] = i;
-#endif
-
-  if (i == EOF && errno != EINTR && last == first)
-    return false;
-
-  /* We didn't get the whole line because our buffer was too small.  */
-  if (i != EOF && i != '\n' && i != '\r') {
-    fprintf (stderr, "! Unable to read an entire line---bufsize=%u.\n",
-                     (unsigned) bufsize);
-    fputs ("Please increase buf_size in texmf.cnf.\n", stderr);
-    uexit (1);
-  }
-
-  buffer[last] = ' ';
-  if (last >= maxbufstack)
-    maxbufstack = last;
-
-  /* If next char is LF of a CRLF, read it.  */
-  if (i == '\r') {
-    while ((i = getc (f)) == EOF && errno == EINTR)
-      ;
-    if (i != '\n')
-      ungetc (i, f);
-  }
-  
-  /* Trim trailing whitespace.  */
-  while (last > first && ISBLANK (buffer[last - 1]))
-    --last;
-
-  /* Don't bother using xord if we don't need to.  */
-#if !defined(Aleph)
-  for (i = first; i <= last; i++)
-     buffer[i] = xord[buffer[i]];
-#endif
-
-#if IS_pTeX
-  for (i = last+1; (i < last + 5 && i < bufsize) ; i++)
-    buffer[i] = '\0';
-#endif
-
-  return true;
-}
-#endif /* !XeTeX */
-\f
-/* This string specifies what the `e' option does in response to an
-   error message.  */ 
-static const_string edit_value = EDITOR;
-
-/* This procedure originally due to sjc@s1-c.  TeX & Metafont call 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 FILENAME the
-   actual filename starts; FNLENGTH is how long the filename is.  */
-   
-void
-calledit (packedASCIIcode *filename,
-          poolpointer fnstart,
-          integer fnlength,
-          integer linenumber)
-{
-  char *temp, *command, *fullcmd;
-  char c;
-  int sdone, ddone, i;
-
-#ifdef WIN32
-  char *fp, *ffp, *env, editorname[256], buffer[256];
-  int cnt = 0;
-  int dontchange = 0;
-#endif
-
-  sdone = ddone = 0;
-  filename += fnstart;
-
-  /* Close any open input files, since we're going to kill the job.  */
-  for (i = 1; i <= inopen; i++)
-#ifdef XeTeX
-    xfclose (inputfile[i]->f, "inputfile");
-#else
-    xfclose (inputfile[i], "inputfile");
-#endif
-
-  /* Replace the default with the value of the appropriate environment
-     variable or config file value, if it's set.  */
-  temp = kpse_var_value (edit_var);
-  if (temp != NULL)
-    edit_value = temp;
-
-  /* Construct the command string.  The `11' is the maximum length an
-     integer might be.  */
-  command = xmalloc (strlen (edit_value) + fnlength + 11);
-
-  /* So we can construct it as we go.  */
-  temp = command;
-
-#ifdef WIN32
-  fp = editorname;
-  if ((isalpha(*edit_value) && *(edit_value + 1) == ':'
-        && IS_DIR_SEP (*(edit_value + 2)))
-      || (*edit_value == '"' && isalpha(*(edit_value + 1))
-        && *(edit_value + 2) == ':'
-        && IS_DIR_SEP (*(edit_value + 3)))
-     )
-    dontchange = 1;
-#endif
-
-  while ((c = *edit_value++) != 0)
-    {
-      if (c == '%')
-        {
-          switch (c = *edit_value++)
-            {
-           case 'd':
-             if (ddone)
-                FATAL ("call_edit: `%%d' appears twice in editor command");
-              sprintf (temp, "%ld", (long int)linenumber);
-              while (*temp != '\0')
-                temp++;
-              ddone = 1;
-              break;
-
-           case 's':
-              if (sdone)
-                FATAL ("call_edit: `%%s' appears twice in editor command");
-              for (i =0; i < fnlength; i++)
-               *temp++ = Xchr (filename[i]);
-              sdone = 1;
-              break;
-
-           case '\0':
-              *temp++ = '%';
-              /* Back up to the null to force termination.  */
-             edit_value--;
-             break;
-
-           default:
-             *temp++ = '%';
-             *temp++ = c;
-             break;
-           }
-       }
-      else {
-#ifdef WIN32
-        if (dontchange)
-          *temp++ = c;
-        else { if(Isspace(c) && cnt == 0) {
-            cnt++;
-            temp = command;
-            *temp++ = c;
-            *fp = '\0';
-         } else if(!Isspace(c) && cnt == 0) {
-            *fp++ = c;
-         } else {
-            *temp++ = c;
-         }
-        }
-#else
-        *temp++ = c;
-#endif
-      }
-    }
-
-  *temp = 0;
-
-#ifdef WIN32
-  if (dontchange == 0) {
-    if(editorname[0] == '.' ||
-       editorname[0] == '/' ||
-       editorname[0] == '\\') {
-      fprintf(stderr, "%s is not allowed to execute.\n", editorname);
-      uexit(1);
-    }
-    env = (char *)getenv("PATH");
-    if(SearchPath(env, editorname, ".exe", 256, buffer, &ffp)==0) {
-      if(SearchPath(env, editorname, ".bat", 256, buffer, &ffp)==0) {
-        fprintf(stderr, "I cannot find %s in the PATH.\n", editorname);
-        uexit(1);
-      }
-    }
-    fullcmd = (char *)xmalloc(strlen(buffer)+strlen(command)+5);
-    strcpy(fullcmd, "\"");
-    strcat(fullcmd, buffer);
-    strcat(fullcmd, "\"");
-    strcat(fullcmd, command);
-  } else
-#endif
-  fullcmd = command;
-
-  /* Execute the command.  */
-  if (system (fullcmd) != 0)
-    fprintf (stderr, "! Trouble executing `%s'.\n", command);
-
-  /* Quit, since we found an error.  */
-  uexit (1);
-}
-\f
-/* Read and write dump files.  As distributed, these files are
-   architecture dependent; specifically, BigEndian and LittleEndian
-   architectures produce different files.  These routines always output
-   BigEndian files.  This still does not guarantee them to be
-   architecture-independent, because it is possible to make a format
-   that dumps a glue ratio, i.e., a floating-point number.  Fortunately,
-   none of the standard formats do that.  */
-
-#if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE) /* this fn */
-
-/* This macro is always invoked as a statement.  It assumes a variable
-   `temp'.  */
-   
-#define SWAP(x, y) temp = (x); (x) = (y); (y) = temp
-
-
-/* Make the NITEMS items pointed at by P, each of size SIZE, be the
-   opposite-endianness of whatever they are now.  */
-
-static void
-swap_items (char *p, int nitems, int size)
-{
-  char temp;
-
-  /* Since `size' does not change, we can write a while loop for each
-     case, and avoid testing `size' for each time.  */
-  switch (size)
-    {
-    /* 16-byte items happen on the DEC Alpha machine when we are not
-       doing sharable memory dumps.  */
-    case 16:
-      while (nitems--)
-        {
-          SWAP (p[0], p[15]);
-          SWAP (p[1], p[14]);
-          SWAP (p[2], p[13]);
-          SWAP (p[3], p[12]);
-          SWAP (p[4], p[11]);
-          SWAP (p[5], p[10]);
-          SWAP (p[6], p[9]);
-          SWAP (p[7], p[8]);
-          p += size;
-        }
-      break;
-
-    case 8:
-      while (nitems--)
-        {
-          SWAP (p[0], p[7]);
-          SWAP (p[1], p[6]);
-          SWAP (p[2], p[5]);
-          SWAP (p[3], p[4]);
-          p += size;
-        }
-      break;
-
-    case 4:
-      while (nitems--)
-        {
-          SWAP (p[0], p[3]);
-          SWAP (p[1], p[2]);
-          p += size;
-        }
-      break;
-
-    case 2:
-      while (nitems--)
-        {
-          SWAP (p[0], p[1]);
-          p += size;
-        }
-      break;
-
-    case 1:
-      /* Nothing to do.  */
-      break;
-
-    default:
-      FATAL1 ("Can't swap a %d-byte item for (un)dumping", size);
-  }
-}
-#endif /* not WORDS_BIGENDIAN and not NO_DUMP_SHARE */
-
-
-/* Here we write NITEMS items, each item being ITEM_SIZE bytes long.
-   The pointer to the stuff to write is P, and we write to the file
-   OUT_FILE.  */
-
-void
-#ifdef XeTeX
-do_dump (char *p, int item_size, int nitems,  gzFile out_file)
-#else
-do_dump (char *p, int item_size, int nitems,  FILE *out_file)
-#endif
-{
-#if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE)
-  swap_items (p, nitems, item_size);
-#endif
-
-#ifdef XeTeX
-  if (gzwrite (out_file, p, item_size * nitems) != item_size * nitems)
-#else
-  if (fwrite (p, item_size, nitems, out_file) != nitems)
-#endif
-    {
-      fprintf (stderr, "! Could not write %d %d-byte item(s) to %s.\n",
-               nitems, item_size, nameoffile+1);
-      uexit (1);
-    }
-
-  /* Have to restore the old contents of memory, since some of it might
-     get used again.  */
-#if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE)
-  swap_items (p, nitems, item_size);
-#endif
-}
-
-
-/* Here is the dual of the writing routine.  */
-
-void
-#ifdef XeTeX
-do_undump (char *p, int item_size, int nitems, gzFile in_file)
-#else
-do_undump (char *p, int item_size, int nitems, FILE *in_file)
-#endif
-{
-#ifdef XeTeX
-  if (gzread (in_file, p, item_size * nitems) != item_size * nitems)
-#else
-  if (fread (p, item_size, nitems, in_file) != (size_t) nitems)
-#endif
-    FATAL3 ("Could not undump %d %d-byte item(s) from %s",
-            nitems, item_size, nameoffile+1);
-
-#if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE)
-  swap_items (p, nitems, item_size);
-#endif
-}
-\f
-/* FIXME -- some (most?) of this can/should be moved to the Pascal/WEB side. */
-#if defined(TeX) || defined(MF)
-#if !defined(pdfTeX)
-static void
-checkpoolpointer (poolpointer poolptr, size_t len)
-{
-  if (poolptr + len >= poolsize) {
-    fprintf (stderr, "\nstring pool overflow [%i bytes]\n", 
-            (int)poolsize); /* fixme */
-    exit(1);
-  }
-}
-
-#ifndef XeTeX  /* XeTeX uses this from XeTeX_ext.c */
-static
-#endif
-int
-maketexstring(const_string s)
-{
-  size_t len;
-#ifdef XeTeX
-  UInt32 rval;
-  const unsigned char *cp = (const unsigned char *)s;
-#endif
-  assert (s != 0);
-  len = strlen(s);
-  checkpoolpointer (poolptr, len); /* in the XeTeX case, this may be more than enough */
-#ifdef XeTeX
-  while ((rval = *(cp++)) != 0) {
-    UInt16 extraBytes = bytesFromUTF8[rval];
-    switch (extraBytes) { /* note: code falls through cases! */
-      case 5: rval <<= 6; if (*cp) rval += *(cp++);
-      case 4: rval <<= 6; if (*cp) rval += *(cp++);
-      case 3: rval <<= 6; if (*cp) rval += *(cp++);
-      case 2: rval <<= 6; if (*cp) rval += *(cp++);
-      case 1: rval <<= 6; if (*cp) rval += *(cp++);
-      case 0: ;
-    };
-    rval -= offsetsFromUTF8[extraBytes];
-    if (rval > 0xffff) {
-      rval -= 0x10000;
-      strpool[poolptr++] = 0xd800 + rval / 0x0400;
-      strpool[poolptr++] = 0xdc00 + rval % 0x0400;
-    }
-    else
-      strpool[poolptr++] = rval;
-  }
-#else /* ! XeTeX */
-  while (len-- > 0)
-    strpool[poolptr++] = *s++;
-#endif /* ! XeTeX */
-
-  return makestring();
-}
-#endif /* !pdfTeX */
-
-strnumber
-makefullnamestring(void)
-{
-  return maketexstring(fullnameoffile);
-}
-
-/* Get the job name to be used, which may have been set from the
-   command line. */
-strnumber
-getjobname(strnumber name)
-{
-    strnumber ret = name;
-    if (c_job_name != NULL)
-      ret = maketexstring(c_job_name);
-    return ret;
-}
-#endif
-
-#if defined(TeX)
-static int
-compare_paths (const_string p1, const_string p2)
-{
-  int ret;
-  while (
-#ifdef MONOCASE_FILENAMES
-                (((ret = (toupper(*p1) - toupper(*p2))) == 0) && (*p2 != 0))
-#else
-         (((ret = (*p1 - *p2)) == 0) && (*p2 != 0))
-#endif
-                || (IS_DIR_SEP(*p1) && IS_DIR_SEP(*p2))) {
-       p1++, p2++;
-  }
-  ret = (ret < 0 ? -1 : (ret > 0 ? 1 : 0));
-  return ret;
-}
-
-#ifdef XeTeX /* the string pool is UTF-16 but we want a UTF-8 string */
-
-string
-gettexstring (strnumber s)
-{
-  unsigned bytesToWrite = 0;
-  poolpointer len, i, j;
-  string name;
-  len = strstart[s + 1 - 65536L] - strstart[s - 65536L];
-  name = xmalloc(len * 3 + 1); /* max UTF16->UTF8 expansion
-                                  (code units, not bytes) */
-  for (i = 0, j = 0; i < len; i++) {
-    unsigned c = strpool[i + strstart[s - 65536L]];
-    if (c >= 0xD800 && c <= 0xDBFF) {
-      unsigned lo = strpool[++i + strstart[s - 65536L]];
-      if (lo >= 0xDC00 && lo <= 0xDFFF)
-        c = (c - 0xD800) * 0x0400 + lo - 0xDC00;
-      else
-        c = 0xFFFD;
-    }
-    if (c < 0x80)
-      bytesToWrite = 1;
-    else if (c < 0x800)
-      bytesToWrite = 2;
-    else if (c < 0x10000)
-      bytesToWrite = 3;
-    else if (c < 0x110000)
-      bytesToWrite = 4;
-    else {
-      bytesToWrite = 3;
-      c = 0xFFFD;
-    }
-
-    j += bytesToWrite;
-    switch (bytesToWrite) { /* note: everything falls through. */
-      case 4: name[--j] = ((c | 0x80) & 0xBF); c >>= 6;
-      case 3: name[--j] = ((c | 0x80) & 0xBF); c >>= 6;
-      case 2: name[--j] = ((c | 0x80) & 0xBF); c >>= 6;
-      case 1: name[--j] =  (c | firstByteMark[bytesToWrite]);
-    }
-    j += bytesToWrite;
-  }
-  name[j] = 0;
-  return name;
-}
-
-#else
-
-string
-gettexstring (strnumber s)
-{
-  poolpointer len;
-  string name;
-#if !defined(Aleph)
-  len = strstart[s + 1] - strstart[s];
-#else
-  len = strstartar[s + 1 - 65536L] - strstartar[s - 65536L];
-#endif
-  name = (string)xmalloc (len + 1);
-#if !defined(Aleph)
-  strncpy (name, (string)&strpool[strstart[s]], len);
-#else
-  {
-  poolpointer i;
-  /* Don't use strncpy.  The strpool is not made up of chars. */
-  for (i=0; i<len; i++) name[i] =  strpool[i+strstartar[s - 65536L]];
-  }
-#endif
-  name[len] = 0;
-  return name;
-}
-
-#endif /* not XeTeX */
-
-boolean
-isnewsource (strnumber srcfilename, int lineno)
-{
-  char *name = gettexstring(srcfilename);
-  return (compare_paths(name, last_source_name) != 0 || lineno != last_lineno);
-}
-
-void
-remembersourceinfo (strnumber srcfilename, int lineno)
-{
-  if (last_source_name)
-       free(last_source_name);
-  last_source_name = gettexstring(srcfilename);
-  last_lineno = lineno;
-}
-
-poolpointer
-makesrcspecial (strnumber srcfilename, int lineno)
-{
-  poolpointer oldpoolptr = poolptr;
-  char *filename = gettexstring(srcfilename);
-  /* FIXME: Magic number. */
-  char buf[40];
-  char *s = buf;
-
-  /* Always put a space after the number, which makes things easier
-   * to parse.
-   */
-  sprintf (buf, "src:%d ", lineno);
-
-  if (poolptr + strlen(buf) + strlen(filename) >= (size_t)poolsize) {
-       fprintf (stderr, "\nstring pool overflow\n"); /* fixme */
-       exit (1);
-  }
-  s = buf;
-  while (*s)
-    strpool[poolptr++] = *s++;
-
-  s = filename;
-  while (*s)
-    strpool[poolptr++] = *s++;
-
-  return (oldpoolptr);
-}
-\f
-/* pdfTeX routines also used for e-pTeX and e-upTeX */
-#if defined (pdfTeX) || defined (epTeX) || defined (eupTeX)
-
-#include <kpathsea/c-stat.h>
-
-#define check_nprintf(size_get, size_want) \
-    if ((unsigned)(size_get) >= (unsigned)(size_want)) \
-        pdftex_fail ("snprintf failed: file %s, line %d", __FILE__, __LINE__);
-#  define check_buf(size, buf_size)                         \
-    if ((unsigned)(size) > (unsigned)(buf_size))            \
-        pdftex_fail("buffer overflow at file %s, line %d", __FILE__,  __LINE__ )
-#  define xfree(p)            do { if (p != NULL) free(p); p = NULL; } while (0)
-#  define MAX_CSTRING_LEN     1024 * 1024
-
-#if !defined (pdfTeX)
-#  define PRINTF_BUF_SIZE     1024
-static char print_buf[PRINTF_BUF_SIZE];
-
-/* Helper for pdftex_fail. */
-static void safe_print(const char *str)
-{
-    const char *c;
-    for (c = str; *c; ++c)
-        print(*c);
-}
-/* pdftex_fail may be called when a buffer overflow has happened/is
-   happening, therefore may not call mktexstring.  However, with the
-   current implementation it appears that error messages are misleading,
-   possibly because pool overflows are detected too late.
-
-   The output format of this fuction must be the same as pdf_error in
-   pdftex.web! */
-__attribute__ ((noreturn, format(printf, 1, 2)))
-void pdftex_fail(const char *fmt, ...)
-{
-    va_list args;
-    va_start(args, fmt);
-    println();
-    safe_print("!error: ");
-    vsnprintf(print_buf, PRINTF_BUF_SIZE, fmt, args);
-    safe_print(print_buf);
-    va_end(args);
-    println();
-    safe_print(" ==> Fatal error occurred, output file will be damaged!");
-    println();
-    if (kpathsea_debug) {
-        safe_print("kpathsea_debug enabled, calling abort()...");
-        println();
-        abort();
-    } else {
-        exit(EXIT_FAILURE);
-    }
-}
-#endif /* not pdfTeX */
-
-static time_t start_time = 0;
-#define TIME_STR_SIZE 30
-char start_time_str[TIME_STR_SIZE];
-static char time_str[TIME_STR_SIZE];
-    /* minimum size for time_str is 24: "D:YYYYmmddHHMMSS+HH'MM'" */
-
-static void makepdftime(time_t t, char *time_str)
-{
-
-    struct tm lt, gmt;
-    size_t size;
-    int i, off, off_hours, off_mins;
-
-    /* get the time */
-    lt = *localtime(&t);
-    size = strftime(time_str, TIME_STR_SIZE, "D:%Y%m%d%H%M%S", &lt);
-    /* expected format: "YYYYmmddHHMMSS" */
-    if (size == 0) {
-        /* unexpected, contents of time_str is undefined */
-        time_str[0] = '\0';
-        return;
-    }
-
-    /* correction for seconds: %S can be in range 00..61,
-       the PDF reference expects 00..59,
-       therefore we map "60" and "61" to "59" */
-    if (time_str[14] == '6') {
-        time_str[14] = '5';
-        time_str[15] = '9';
-        time_str[16] = '\0';    /* for safety */
-    }
-
-    /* get the time zone offset */
-    gmt = *gmtime(&t);
-
-    /* this calculation method was found in exim's tod.c */
-    off = 60 * (lt.tm_hour - gmt.tm_hour) + lt.tm_min - gmt.tm_min;
-    if (lt.tm_year != gmt.tm_year) {
-        off += (lt.tm_year > gmt.tm_year) ? 1440 : -1440;
-    } else if (lt.tm_yday != gmt.tm_yday) {
-        off += (lt.tm_yday > gmt.tm_yday) ? 1440 : -1440;
-    }
-
-    if (off == 0) {
-        time_str[size++] = 'Z';
-        time_str[size] = 0;
-    } else {
-        off_hours = off / 60;
-        off_mins = abs(off - off_hours * 60);
-        i = snprintf(&time_str[size], 9, "%+03d'%02d'", off_hours, off_mins);
-        check_nprintf(i, 9);
-    }
-}
-
-void initstarttime(void)
-{
-    if (start_time == 0) {
-        start_time = time((time_t *) NULL);
-        makepdftime(start_time, start_time_str);
-    }
-}
-
-char *makecstring(integer s)
-{
-    static char *cstrbuf = NULL;
-    char *p;
-    static int allocsize;
-    int allocgrow, i, l = strstart[s + 1] - strstart[s];
-    check_buf(l + 1, MAX_CSTRING_LEN);
-    if (cstrbuf == NULL) {
-        allocsize = l + 1;
-        cstrbuf = xmallocarray(char, allocsize);
-    } else if (l + 1 > allocsize) {
-        allocgrow = allocsize * 0.2;
-        if (l + 1 - allocgrow > allocsize)
-            allocsize = l + 1;
-        else if (allocsize < MAX_CSTRING_LEN - allocgrow)
-            allocsize += allocgrow;
-        else
-            allocsize = MAX_CSTRING_LEN;
-        cstrbuf = xreallocarray(cstrbuf, char, allocsize);
-    }
-    p = cstrbuf;
-    for (i = 0; i < l; i++)
-        *p++ = strpool[i + strstart[s]];
-    *p = 0;
-    return cstrbuf;
-}
-
-/* makecfilename
-  input/ouput same as makecstring:
-    input: string number
-    output: C string with quotes removed.
-    That means, file names that are legal on some operation systems
-    cannot any more be used since pdfTeX version 1.30.4.
-*/
-char *makecfilename(integer s)
-{
-    char *name = makecstring(s);
-    char *p = name;
-    char *q = name;
-
-    while (*p) {
-        if (*p != '"')
-            *q++ = *p;
-        p++;
-    }
-    *q = '\0';
-    return name;
-}
-
-void getcreationdate(void)
-{
-    size_t len;
-    initstarttime();
-    /* put creation date on top of string pool and update poolptr */
-    len = strlen(start_time_str);
-
-    /* In e-pTeX, "init len => call initstarttime()" (as pdftexdir/utils.c)
-       yields  unintentional output. */
-
-    if ((unsigned) (poolptr + len) >= (unsigned) (poolsize)) {
-        poolptr = poolsize;
-        /* error by str_toks that calls str_room(1) */
-        return;
-    }
-
-    memcpy(&strpool[poolptr], start_time_str, len);
-    poolptr += len;
-}
-
-void getfilemoddate(integer s)
-{
-    struct stat file_data;
-
-    char *file_name = kpse_find_tex(makecfilename(s));
-    if (file_name == NULL) {
-        return;                 /* empty string */
-    }
-
-    recorder_record_input(file_name);
-    /* get file status */
-    if (stat(file_name, &file_data) == 0) {
-        size_t len;
-
-        makepdftime(file_data.st_mtime, time_str);
-        len = strlen(time_str);
-        if ((unsigned) (poolptr + len) >= (unsigned) (poolsize)) {
-            poolptr = poolsize;
-            /* error by str_toks that calls str_room(1) */
-        } else {
-            memcpy(&strpool[poolptr], time_str, len);
-            poolptr += len;
-        }
-    }
-    /* else { errno contains error code } */
-
-    xfree(file_name);
-}
-
-void getfilesize(integer s)
-{
-    struct stat file_data;
-    int i;
-
-    char *file_name = kpse_find_tex(makecfilename(s));
-    if (file_name == NULL) {
-        return;                 /* empty string */
-    }
-
-    recorder_record_input(file_name);
-    /* get file status */
-    if (stat(file_name, &file_data) == 0) {
-        size_t len;
-        char buf[20];
-
-        /* st_size has type off_t */
-        i = snprintf(buf, sizeof(buf),
-                     "%lu", (long unsigned int) file_data.st_size);
-        check_nprintf(i, sizeof(buf));
-        len = strlen(buf);
-        if ((unsigned) (poolptr + len) >= (unsigned) (poolsize)) {
-            poolptr = poolsize;
-            /* error by str_toks that calls str_room(1) */
-        } else {
-            memcpy(&strpool[poolptr], buf, len);
-            poolptr += len;
-        }
-    }
-    /* else { errno contains error code } */
-
-    xfree(file_name);
-}
-#endif /* e-pTeX or e-upTeX */
-#endif /* TeX */
-\f
-/* Metafont/MetaPost fraction routines. Replaced either by assembler or C.
-   The assembler syntax doesn't work on Solaris/x86.  */
-#ifndef TeX
-#if defined (__sun__) || defined (__cplusplus)
-#define NO_MF_ASM
-#endif
-/* The assembler code is not PIC safe on i?86 so use C code.  */
-#if defined (__PIC__) && defined (__i386__)
-#define NO_MF_ASM
-#endif
-#if defined(WIN32) && !defined(NO_MF_ASM) && !defined(__MINGW32__)
-#include "lib/mfmpw32.c"
-#elif defined (__i386__) && defined (__GNUC__) && !defined (NO_MF_ASM)
-#include "lib/mfmpi386.asm"
-#else
-/* Replace fixed-point fraction routines from mf.web and mp.web with
-   Hobby's floating-point C code.  */
-
-/****************************************************************
-Copyright 1990 - 1995 by AT&T Bell Laboratories.
-
-Permission to use, copy, modify, and distribute this software
-and its documentation for any purpose and without fee is hereby
-granted, provided that the above copyright notice appear in all
-copies and that both that the copyright notice and this
-permission notice and warranty disclaimer appear in supporting
-documentation, and that the names of AT&T Bell Laboratories or
-any of its entities not be used in advertising or publicity
-pertaining to distribution of the software without specific,
-written prior permission.
-
-AT&T disclaims all warranties with regard to this software,
-including all implied warranties of merchantability and fitness.
-In no event shall AT&T be liable for any special, indirect or
-consequential damages or any damages whatsoever resulting from
-loss of use, data or profits, whether in an action of contract,
-negligence or other tortious action, arising out of or in
-connection with the use or performance of this software.
-****************************************************************/
-
-/**********************************************************
- The following is by John Hobby
- **********************************************************/
-
-#ifndef FIXPT
-
-/* These replacements for takefraction, makefraction, takescaled, makescaled
-   run about 3 to 11 times faster than the standard versions on modern machines
-   that have fast hardware for double-precision floating point.  They should
-   produce approximately correct results on all machines and agree exactly
-   with the standard versions on machines that satisfy the following conditions:
-   1. Doubles must have at least 46 mantissa bits; i.e., numbers expressible
-      as n*2^k with abs(n)<2^46 should be representable.
-   2. The following should hold for addition, subtraction, and multiplcation but
-      not necessarily for division:
-      A. If the true answer is between two representable numbers, the computed
-         answer must be one of them.
-      B. When the true answer is representable, this must be the computed result.
-   3. Dividing one double by another should always produce a relative error of
-      at most one part in 2^46.  (This is why the mantissa requirement is
-      46 bits instead of 45 bits.)
-   3. In the absence of overflow, double-to-integer conversion should truncate
-      toward zero and do this in an exact fashion.
-   4. Integer-to-double convesion should produce exact results.
-   5. Dividing one power of two by another should yield an exact result.
-   6. ASCII to double conversion should be exact for integer values.
-   7. Integer arithmetic must be done in the two's-complement system.
-*/
-#define ELGORDO  0x7fffffff
-#define TWEXP31  2147483648.0
-#define TWEXP28  268435456.0
-#define TWEXP16 65536.0
-#define TWEXP_16 (1.0/65536.0)
-#define TWEXP_28 (1.0/268435456.0)
-
-integer
-ztakefraction (integer p, integer q)     /* Approximate p*q/2^28 */
-{      register double d;
-       register integer i;
-       d = (double)p * (double)q * TWEXP_28;
-       if ((p^q) >= 0) {
-               d += 0.5;
-               if (d>=TWEXP31) {
-                       if (d!=TWEXP31 || (((p&077777)*(q&077777))&040000)==0)
-                               aritherror = true;
-                       return ELGORDO;
-               }
-               i = (integer) d;
-               if (d==i && (((p&077777)*(q&077777))&040000)!=0) --i;
-       } else {
-               d -= 0.5;
-               if (d<= -TWEXP31) {
-                       if (d!= -TWEXP31 || ((-(p&077777)*(q&077777))&040000)==0)
-                               aritherror = true;
-                       return -ELGORDO;
-               }
-               i = (integer) d;
-               if (d==i && ((-(p&077777)*(q&077777))&040000)!=0) ++i;
-       }
-       return i;
-}
-
-integer
-ztakescaled (integer p, integer q)             /* Approximate p*q/2^16 */
-{      register double d;
-       register integer i;
-       d = (double)p * (double)q * TWEXP_16;
-       if ((p^q) >= 0) {
-               d += 0.5;
-               if (d>=TWEXP31) {
-                       if (d!=TWEXP31 || (((p&077777)*(q&077777))&040000)==0)
-                               aritherror = true;
-                       return ELGORDO;
-               }
-               i = (integer) d;
-               if (d==i && (((p&077777)*(q&077777))&040000)!=0) --i;
-       } else {
-               d -= 0.5;
-               if (d<= -TWEXP31) {
-                       if (d!= -TWEXP31 || ((-(p&077777)*(q&077777))&040000)==0)
-                               aritherror = true;
-                       return -ELGORDO;
-               }
-               i = (integer) d;
-               if (d==i && ((-(p&077777)*(q&077777))&040000)!=0) ++i;
-       }
-       return i;
-}
-
-/* Note that d cannot exactly equal TWEXP31 when the overflow test is made
-   because the exact value of p/q cannot be strictly between (2^31-1)/2^28
-   and 8/1.  No pair of integers less than 2^31 has such a ratio.
-*/
-integer
-zmakefraction (integer p, integer q)   /* Approximate 2^28*p/q */
-{      register double d;
-       register integer i;
-#ifdef DEBUG
-       if (q==0) confusion(47); 
-#endif /* DEBUG */
-       d = TWEXP28 * (double)p /(double)q;
-       if ((p^q) >= 0) {
-               d += 0.5;
-               if (d>=TWEXP31) {aritherror=true; return ELGORDO;}
-               i = (integer) d;
-               if (d==i && ( ((q>0 ? -q : q)&077777)
-                               * (((i&037777)<<1)-1) & 04000)!=0) --i;
-       } else {
-               d -= 0.5;
-               if (d<= -TWEXP31) {aritherror=true; return -ELGORDO;}
-               i = (integer) d;
-               if (d==i && ( ((q>0 ? q : -q)&077777)
-                               * (((i&037777)<<1)+1) & 04000)!=0) ++i;
-       }
-       return i;
-}
-
-/* Note that d cannot exactly equal TWEXP31 when the overflow test is made
-   because the exact value of p/q cannot be strictly between (2^31-1)/2^16
-   and 2^15/1.  No pair of integers less than 2^31 has such a ratio.
-*/
-integer
-zmakescaled (integer p, integer q)             /* Approximate 2^16*p/q */
-{      register double d;
-       register integer i;
-#ifdef DEBUG
-       if (q==0) confusion(47); 
-#endif /* DEBUG */
-       d = TWEXP16 * (double)p /(double)q;
-       if ((p^q) >= 0) {
-               d += 0.5;
-               if (d>=TWEXP31) {aritherror=true; return ELGORDO;}
-               i = (integer) d;
-               if (d==i && ( ((q>0 ? -q : q)&077777)
-                               * (((i&037777)<<1)-1) & 04000)!=0) --i;
-       } else {
-               d -= 0.5;
-               if (d<= -TWEXP31) {aritherror=true; return -ELGORDO;}
-               i = (integer) d;
-               if (d==i && ( ((q>0 ? q : -q)&077777)
-                               * (((i&037777)<<1)+1) & 04000)!=0) ++i;
-       }
-       return i;
-}
-
-#endif /* not FIXPT */
-#endif /* not assembler */
-#endif /* not TeX, i.e., MF */
-\f
-#ifdef MF
-/* On-line display routines for Metafont.  Here we use a dispatch table
-   indexed by the MFTERM or TERM environment variable to select the
-   graphics routines appropriate to the user's terminal.  stdout must be
-   connected to a terminal for us to do any graphics.  */
-
-#ifdef MFNOWIN
-#undef AMIGAWIN
-#undef EPSFWIN
-#undef HP2627WIN
-#undef MFTALKWIN
-#undef NEXTWIN
-#undef REGISWIN
-#undef SUNWIN
-#undef TEKTRONIXWIN
-#undef UNITERMWIN
-#undef WIN32WIN
-#undef X11WIN
-#endif
-
-/* Prototypes for Metafont display routines: mf_XXX_initscreen,
-   mf_XXX_updatescreen, mf_XXX_blankrectangle, and mf_XXX_paintrow.  */
-#include <window/mfdisplay.h>
-
-/* This variable, `mfwsw', contains the dispatch tables for each
-   terminal.  We map the Pascal calls to the routines `init_screen',
-   `update_screen', `blank_rectangle', and `paint_row' into the
-   appropriate entry point for the specific terminal that MF is being
-   run on.  */
-
-struct mfwin_sw
-{
-  const char *mfwsw_type;      /* Name of terminal a la TERMCAP.  */
-  int (*mfwsw_initscreen) (void);
-  void (*mfwsw_updatescrn) (void);
-  void (*mfwsw_blankrect) (screencol, screencol, screenrow, screenrow);
-  void (*mfwsw_paintrow) (screenrow, pixelcolor, transspec, screencol);
-} mfwsw[] =
-{
-#ifdef AMIGAWIN
-  { "amiterm", mf_amiga_initscreen, mf_amiga_updatescreen,
-    mf_amiga_blankrectangle, mf_amiga_paintrow },
-#endif
-#ifdef EPSFWIN
-  { "epsf", mf_epsf_initscreen, mf_epsf_updatescreen, 
-    mf_epsf_blankrectangle, mf_epsf_paintrow },
-#endif
-#ifdef HP2627WIN
-  { "hp2627", mf_hp2627_initscreen, mf_hp2627_updatescreen,
-    mf_hp2627_blankrectangle, mf_hp2627_paintrow },
-#endif
-#ifdef MFTALKWIN
-  { "mftalk", mf_mftalk_initscreen, mf_mftalk_updatescreen, 
-     mf_mftalk_blankrectangle, mf_mftalk_paintrow },
-#endif
-#ifdef NEXTWIN
-  { "next", mf_next_initscreen, mf_next_updatescreen,
-    mf_next_blankrectangle, mf_next_paintrow },
-#endif
-#ifdef REGISWIN
-  { "regis", mf_regis_initscreen, mf_regis_updatescreen,
-    mf_regis_blankrectangle, mf_regis_paintrow },
-#endif
-#ifdef SUNWIN
-  { "sun", mf_sun_initscreen, mf_sun_updatescreen,
-    mf_sun_blankrectangle, mf_sun_paintrow },
-#endif
-#ifdef TEKTRONIXWIN
-  { "tek", mf_tektronix_initscreen, mf_tektronix_updatescreen,
-    mf_tektronix_blankrectangle, mf_tektronix_paintrow },
-#endif
-#ifdef UNITERMWIN
-   { "uniterm", mf_uniterm_initscreen, mf_uniterm_updatescreen,
-     mf_uniterm_blankrectangle, mf_uniterm_paintrow },
-#endif
-#ifdef WIN32WIN
-  { "win32term", mf_win32_initscreen, mf_win32_updatescreen, 
-    mf_win32_blankrectangle, mf_win32_paintrow },
-#endif
-#ifdef X11WIN
-  { "xterm", mf_x11_initscreen, mf_x11_updatescreen, 
-    mf_x11_blankrectangle, mf_x11_paintrow },
-#endif
-  
-  /* Always support this.  */
-  { "trap", mf_trap_initscreen, mf_trap_updatescreen,
-    mf_trap_blankrectangle, mf_trap_paintrow },
-
-/* Finally, we must have an entry with a terminal type of NULL.  */
-  { NULL, NULL, NULL, NULL, NULL }
-
-}; /* End of the array initialization.  */
-
-
-/* This is a pointer to the mfwsw[] entry that we find.  */
-static struct mfwin_sw *mfwp;
-
-
-/* The following are routines that just jump to the correct
-   terminal-specific graphics code. If none of the routines in the
-   dispatch table exist, or they fail, we produce trap-compatible
-   output, i.e., the same words and punctuation that the unchanged
-   mf.web would produce.  */
-
-
-/* This returns true if we can do window operations, else false.  */
-
-boolean
-initscreen (void)
-{
-  int retval;
-  /* If MFTERM is set, use it.  */
-  const_string tty_type = kpse_var_value ("MFTERM");
-  
-  if (tty_type == NULL)
-    { 
-#if defined (AMIGA)
-      tty_type = "amiterm";
-#elif defined (WIN32)
-      tty_type = "win32term";
-#elif defined (OS2) || defined (__DJGPP__) /* not AMIGA nor WIN32 */
-      tty_type = "mftalk";
-#else /* not (OS2 or WIN32 or __DJGPP__ or AMIGA) */
-      /* If DISPLAY is set, we are X11; otherwise, who knows.  */
-      boolean have_display = getenv ("DISPLAY") != NULL;
-      tty_type = have_display ? "xterm" : getenv ("TERM");
-
-      /* If we don't know what kind of terminal this is, or if Metafont
-         isn't being run interactively, don't do any online output.  */
-      if (tty_type == NULL
-          || (!STREQ (tty_type, "trap") && !isatty (fileno (stdout))))
-        return 0;
-#endif /* not (OS2 or WIN32 or __DJGPP__ or AMIGA) */
-  }
-
-  /* Test each of the terminals given in `mfwsw' against the terminal
-     type, and take the first one that matches, or if the user is running
-     under Emacs, the first one.  */
-  for (mfwp = mfwsw; mfwp->mfwsw_type != NULL; mfwp++) {
-    if (!strncmp (mfwp->mfwsw_type, tty_type, strlen (mfwp->mfwsw_type))
-       || STREQ (tty_type, "emacs")) {
-      if (mfwp->mfwsw_initscreen) {
-       retval = (*mfwp->mfwsw_initscreen) ();
-#ifdef WIN32
-       Sleep(1000); /* Wait for opening a window */
-#endif
-       return retval;
-      }
-      else {
-        fprintf (stderr, "mf: Couldn't initialize online display for `%s'.\n",
-                 tty_type);
-        break;
-      }
-    }
-  }
-  
-  /* The current terminal type wasn't found in any of the entries, or
-     initalization failed, so silently give up, assuming that the user
-     isn't on a terminal that supports graphic output.  */
-  return 0;
-}
-
-
-/* Make sure everything is visible.  */
-
-void
-updatescreen (void)
-{
-  if (mfwp->mfwsw_updatescrn)
-    (*mfwp->mfwsw_updatescrn) ();
-}
-
-
-/* This sets the rectangle bounded by ([left,right], [top,bottom]) to
-   the background color.  */
-
-void
-blankrectangle (screencol left, screencol right,
-                screenrow top, screenrow bottom)
-{
-  if (mfwp->mfwsw_blankrect)
-    (*mfwp->mfwsw_blankrect) (left, right, top, bottom);
-}
-
-
-/* This paints ROW, starting with the color INIT_COLOR. 
-   TRANSITION_VECTOR then specifies the length of the run; then we
-   switch colors.  This goes on for VECTOR_SIZE transitions.  */
-
-void
-paintrow (screenrow row, pixelcolor init_color,
-          transspec transition_vector, screencol vector_size)
-{
-  if (mfwp->mfwsw_paintrow)
-    (*mfwp->mfwsw_paintrow) (row, init_color, transition_vector, vector_size);
-}
-#endif /* MF */
diff --git a/src/web2c/putexdir/am/putex.am b/src/web2c/putexdir/am/putex.am
deleted file mode 100644 (file)
index 3867cc2..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-## texk/web2c/putexdir/am/putex.am: Makefile fragment for PUTeX.
-##
-## Copyright (C) 2013 Clerk Ma <clerkma@gmail.com>
-## You may freely use, modify and/or distribute this file.
-
-## PUTeX
-if PUTEX
-bin_PROGRAMS += putex
-endif PUTEX
-EXTRA_PROGRAMS += putex
-
-putex_CPPFLAGS = $(AM_CPPFLAGS)
-
-# With --enable-ipc, PUTeX may need to link with -lsocket.
-putex_LDADD = $(LDADD) $(ipc_socketlibs)
-
-# PUTeX C sources
-putex_c_h = putexini.c putex0.c putexcoerce.h putexd.h
-nodist_putex_SOURCES = $(putex_c_h) putex-pool.c
-dist_putex_SOURCES = putexdir/putexextra.c putexdir/putexextra.h putexdir/putex_version.h
-
-# We must create putexd.h and putexdir/putex_version.h before building the putex_OBJECTS.
-putex_prereq = putexd.h putexdir/putex_version.h
-$(putex_OBJECTS): $(putex_prereq)
-
-$(putex_c_h): putex-web2c
-       @$(web2c) putex
-putex-web2c: putex.p $(web2c_texmf) putexdir/putex.defines
-       @$(web2c) putex
-
-putex-pool.c: putex.pool putexd.h $(makecpool_stamp)
-       $(makecpool) putex >$@ || rm -f $@
-
-# Tangling PUTeX
-putex.p putex.pool: putex-tangle
-       @$(texmf_tangle) putex putex
-putex-tangle: tangle$(EXEEXT) putex.web putex.ch tangle-sh
-       @$(texmf_tangle) putex putex
-
-# Extract putex version
-$(srcdir)/putexdir/putex_version.h: @MAINTAINER_MODE_TRUE@ putexdir/putex400.ch
-       $(AM_V_GEN)grep '^@d PUTeX_version_string==' $(srcdir)/putexdir/putex400.ch \
-         | sed "s/^.*'-/#define PUTEX_VERSION \"/;s/'.*$$/\"/" >$@
-
-# Generate putex.web
-putex.web: tie$(EXEEXT) $(putex_web_srcs)
-       $(tie) -m putex.web $(putex_web_srcs)
-putex_web_srcs = \
-       tex.web \
-       tex.ch
-
-# Generate putex.ch
-putex.ch: tie$(EXEEXT) putex.web $(putex_ch_srcs)
-       $(tie) -c putex.ch putex.web $(putex_ch_srcs)
-putex_ch_srcs = \
-       putexdir/putex400.ch \
-       $(putex_ch_synctex) \
-       tex-binpool.ch
-
-EXTRA_DIST += $(putex_web_srcs) $(putex_ch_srcs) putexdir/putex.defines
-
-DISTCLEANFILES += $(nodist_putex_SOURCES) putex.web putex.ch putex-web2c \
-       putex.p putex.pool putex-tangle
diff --git a/src/web2c/putexdir/putex.defines b/src/web2c/putexdir/putex.defines
deleted file mode 100644 (file)
index 921acf4..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-{
-putex.defines: Web declarations of PUTeX
-
-This file is part of PUTeX,
-which is based on the web2c distribution of TeX,
-
-Copyright (C) 2013, Clerk Ma, Jie Su
-}
-
-@define procedure dvi_cfont_def ();
-@define procedure scan_wchar_num;
-@define procedure print_chinese_int ();
-@define procedure print_small_chinese_int ();
-@define procedure print_medium_chinese_int ();
-@define procedure split_number ();
-@define procedure print_cjk_int ();
-@define procedure print_fixword ();
-@define procedure reset_cface_cspace ();
-@define procedure reset_cface_cespace ();
-@define procedure new_cface ();
-@define procedure set_cglue_spec ();
-@define procedure set_ceglue_spec ();
-@define procedure make_cfont_id ();
-@define procedure match_ec_face ();
-@define procedure match_ec_font ();
-
-@define function get_cat_code ();
-@define function scan_name;
-@define function fw_times_sd ();
-@define function find_cface_num ();
-@define function check_cfont ();
-@define function make_cfont ();
-@define function find_ec_num ();
-@define function fetch_efont_face ();
-@define function lookup_cface ();
-
-{ end of putex.defines}
diff --git a/src/web2c/putexdir/putex.txt b/src/web2c/putexdir/putex.txt
deleted file mode 100644 (file)
index 8eeae80..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-procedure dvi_cfont_def ();
-procedure scan_wchar_num;
-procedure print_chinese_int ();
-procedure print_small_chinese_int ();
-procedure print_medium_chinese_int ();
-procedure split_number ();
-procedure print_cjk_int ();
-procedure print_fixword ();
-procedure reset_cface_cspace ();
-procedure reset_cface_cespace ();
-procedure new_cface ();
-procedure set_cglue_spec ();
-procedure set_ceglue_spec ();
-procedure make_cfont_id ();
-procedure match_ec_face ();
-procedure match_ec_font ();
-
-function get_cat_code ();
-function scan_name;
-function fw_times_sd ();
-function find_cface_num ();
-function check_cfont ();
-function make_cfont ();
-function find_ec_num ();
-function fetch_efont_face ();
-function lookup_cface ();
diff --git a/src/web2c/putexdir/putex400.ch b/src/web2c/putexdir/putex400.ch
deleted file mode 100644 (file)
index bed194c..0000000
+++ /dev/null
@@ -1,4393 +0,0 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%
-%%%  WEB Change File for PUTeX (CJK version)
-%%%  Modified and patched version for TeX Live
-%%%
-%%%  Copyright (C) 1997-2004 Chey-Woei Tsay <cwtsay@pu.edu.tw>
-%%%  Copyright (C) 2013-2014 Clerk Ma      <clerkma@gmail.com>
-%%%
-%%%  This is the change file of PUTeX.
-%%%
-%%%  PUTeX is a 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 3, or (at
-%%%  your option) any later version.
-%%%
-%%%  PUTeX 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 TeX Live; if not, write to the Free Software
-%%%  Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-%%%  USA.
-%%%
-%%%
-%%%  Version 4.0
-%%%     add \PUXcatcode command to set catcodes of dbcs characters.
-%%%     remove print_dbchar (58, 59, 70, 318, print_chinese_int)
-%%% 
-%%%  Version 4.0-web2c
-%%%     removed the MikTeX part.
-%%%  
-%%%
-%%%  TO DO:
-%%%  new_character(582), make_accent(1123), char_box, rebox
-%%%  mathmode: be awear of print_ASCII
-%%%  check '(cat_code(buffer[loc])<>escape)' in section 1337
-%%%
-%%%  \PUXsetcfacehook -- set cface hook macro that is called when switched to the cface
-%%%  \PUXsetcfonthook -- set cfont hook macro that is called when switched to the cfont
-%%%
-%%%  see section 224 for cspace skip and cespace skip
-%%%
-%%%  New Indices:
-%%%     @^Input Encoding Dependencies@>
-%%%     @^Modified for handling DBCS characters@>
-%%%     @^CJK Fonts Extension@>
-
-@x
-\def\gglob{20, 26} % this should be the next two sections of "<Global...>"
-@y
-\def\gglob{20, 26} % this should be the next two sections of "<Global...>"
-\def\PUTeX{PU\TeX}
-\def\putexadd{\hskip -0.5in putex -- add -- }
-\def\putexmod{\hskip -0.5in putex -- mod -- }
-\def\putexend{\hskip -0.5in putex -- end -- }
-@z
-
-@x
-@d banner==TeX_banner
-@d banner_k==TeX_banner_k
-@y
-@d PUTeX_version_string=='-5.0' {current \PUTeX\ version}
-@#
-@d PUTeX_banner=='This is PUTeX, Version 3.1415926',PUTeX_version_string
-@d PUTeX_banner_k==PUTeX_banner
-  {printed when \PUTeX\ starts}
-@#
-@d banner==PUTeX_banner
-@d banner_k==PUTeX_banner_k
-@z
-
-@x
-@t\4@>@<Error handling procedures@>@/
-@y
-@t\4@>@<Error handling procedures@>@/
-@t\4@>@<PUTeX routines that will be used by TeX routines@>@/
-@#
-{ end -- putex}
-@z
-
-@x
-xchr[@'40]:=' ';
-@y
-@#@t\putexadd@>@#
-for k := 0 to 255 do xchr[k] := k;
-@#@t\putexend@>@#
-xchr[@'40]:=' ';
-@z
-
-@x
-The |append_char| macro, defined here, does not check to see if the
-value of |pool_ptr| has gotten too high; this test is supposed to be
-made before |append_char| is used. There is also a |flush_char|
-@y
-The |append_char| and |append_wchar| macros, defined here, do not check to see if the
-value of |pool_ptr| has gotten too high; this test is supposed to be
-made before |append_char| (or |append_wchar|) is used. There is also a |flush_char|
-@z
-
-@x
-@d append_char(#) == {put |ASCII_code| \# at the end of |str_pool|}
-begin str_pool[pool_ptr]:=si(#); incr(pool_ptr);
-end
-@y
-@d append_char(#) == {put |ASCII_code| \# at the end of |str_pool|}
-begin str_pool[pool_ptr]:=si(#); incr(pool_ptr);
-end
-@#@t\putexadd@>
-@d append_wchar(#) == {TCW: put a double-byte char \# at the end of |str_pool|}
-begin str_pool[pool_ptr]:=# div 256; str_pool[pool_ptr+1]:=# mod 256;
-pool_ptr:=pool_ptr+2;
-end
-@#@t\putexend@>
-@z
-
-@x
-using the |xchr| array to map it into an external character compatible with
-|input_ln|. All printing comes through |print_ln| or |print_char|.
-@y
-using the |xchr| array to map it into an external character compatible with
-|input_ln|. All printing comes through |print_ln|, |print_char|, or |print_wchar|.
-
-TCW: The |print_wchar| macro is used to print one DBCS character. 
-
-@d print_wchar(#)==begin print_char((#) div 256); print_char((#) mod 256) end {TCW}
-@z
-
-@x
-@d character == subtype {the character code in a |char_node|}
-@y
-@d character == subtype {the character code in a |char_node|}
-@d is_wchar_node(#) == (character(#)>255)
-@d is_wchar(#) == ((#)>255)
-@z
-
-%% parallel kanji font, when typesetting kanjis, we need a match table.
-@x
-@!font_in_short_display:integer; {an internal font number}
-@y
-@!font_in_short_display:integer; {an internal font number}
-@!cfont_in_short_display:integer; {TCW: an internal CJK font number}
-@z
-
-@x
-sort of ``complicated'' are indicated only by printing `\.{[]}'.
-@y
-sort of ``complicated'' are indicated only by printing `\.{[]}'.@^CJK Fonts Extension@>
-@z
-
-@x
-      begin if font(p)<>font_in_short_display then
-        begin if (font(p)>font_max) then
-          print_char("*")
-@.*\relax@>
-        else @<Print the font identifier for |font(p)|@>;
-        print_char(" "); font_in_short_display:=font(p);
-        end;
-      print_ASCII(qo(character(p)));
-      end;
-@y
-      begin if font(p)<>font_in_short_display and font(p)<>cfont_in_short_display then
-        begin if (font(p)>cfont_max) then
-          print_char("*")
-@.*\relax@>
-        else @<Print the font identifier for |font(p)|@>;
-        print_char(" ");
-        if font(p) <= font_max then
-          font_in_short_display:=font(p)
-        else
-          cfont_in_short_display:=font(p);
-        end;
-      if is_wchar_node(p) then
-        print_wchar(character(p))
-      else
-        print_ASCII(qo(character(p)));
-      end;
-@z
-
-@x
-its reference count, and one to print a rule dimension.
-@y
-its reference count, and one to print a rule dimension.@^CJK Fonts Extension@>
-@z
-
-@x
-else  begin if (font(p)>font_max) then print_char("*")
-@y
-else  begin if (font(p)>cfont_max) then print_char("*")
-@z
-
-@x
-  print_char(" "); print_ASCII(qo(character(p)));
-@y
-  print_char(" ");
-  if is_wchar_node(p) then
-    print_wchar(character(p))
-  else
-    print_ASCII(qo(character(p)));
-@z
-
-%% for kinsoku
-@x
-@d max_char_code=15 {largest catcode for individual characters}
-@y
-@d max_char_code=15 {largest catcode for individual characters}
-@d boundary_normal=0 {CJK characters can be in any positions of lines}
-@d tail_forbidden=1 {CJK characters can't be put in the head of lines}
-@d head_forbidden=2 {CJK characters can't be put in the tail of lines}
-@d max_type_code=2 {largest boundary code for CJK characters}
-@d set_type_code_end(#) == # end
-@d set_type_code(#) == begin
-    type_code(#) := set_type_code_end
-@z
-
-@x
-@ The next codes are special; they all relate to mode-independent
-assignment of values to \TeX's internal registers or tables.
-Codes that are |max_internal| or less represent internal quantities
-that might be expanded by `\.{\\the}'.
-@y
-@ The next codes are special; they all relate to mode-independent
-assignment of values to \TeX's internal registers or tables.
-Codes that are |max_internal| or less represent internal quantities
-that might be expanded by `\.{\\the}'.
-
-TCW: Add 3 internal commands: |set_cfont|, |puxg_assign_flag|, and |puxg_assign_int|.
-Add 12 user commands: |pux_cface_def|, |pux_face_match|, |pux_font_match|,
-|pux_set_cface|, |pux_set_cface_attrib|,|pux_set_cfont_attrib|,
-|pux_char_num|, |pux_char_given|, |pux_space|, |pux_range_catcode|,
-|pux_range_type_code|, and |pux_dump_font_info|.@^CJK Fonts Extension@>
-@z
-
-@x
-@d def_font=88 {define a font file ( \.{\\font} )}
-@d register=89 {internal register ( \.{\\count}, \.{\\dimen}, etc.~)}
-@d max_internal=89 {the largest code that can follow \.{\\the}}
-@d advance=90 {advance a register or parameter ( \.{\\advance} )}
-@d multiply=91 {multiply a register or parameter ( \.{\\multiply} )}
-@d divide=92 {divide a register or parameter ( \.{\\divide} )}
-@d prefix=93 {qualify a definition ( \.{\\global}, \.{\\long}, \.{\\outer} )}
-@d let=94 {assign a command code ( \.{\\let}, \.{\\futurelet} )}
-@d shorthand_def=95 {code definition ( \.{\\chardef}, \.{\\countdef}, etc.~)}
-  {or \.{\\charsubdef}}
-@d read_to_cs=96 {read into a control sequence ( \.{\\read} )}
-@d def=97 {macro definition ( \.{\\def}, \.{\\gdef}, \.{\\xdef}, \.{\\edef} )}
-@d set_box=98 {set a box ( \.{\\setbox} )}
-@d hyph_data=99 {hyphenation data ( \.{\\hyphenation}, \.{\\patterns} )}
-@d set_interaction=100 {define level of interaction ( \.{\\batchmode}, etc.~)}
-@d max_command=100 {the largest command code seen at |big_switch|}
-@y
-@d set_cfont=88 {TCW: set current chinese font ( font identifiers )}
-@d def_font=89 {define a font file ( \.{\\font} )}
-@d register=90 {internal register ( \.{\\count}, \.{\\dimen}, etc.~)}
-@d puxg_assign_flag=91 {TCW: set a PU\TeX\ global flag (\.{\\puxgCdiOut}, \.{\\puxgRotateCtext})}
-@d puxg_assign_int=92 {TCW: set a PU\TeX\ global integer (\.{\\puxgCspace}, \.{\\puxgCEspace})}
-@d pux_get_int=93 {TCW: get internal integer values ( \.{\\PUXnumdigits}, \.{\\PUXsign}, \.{\\PUXdigit} )}
-@d max_internal=93 {the largest code that can follow \.{\\the}}
-@d advance=94 {advance a register or parameter ( \.{\\advance} )}
-@d multiply=95 {multiply a register or parameter ( \.{\\multiply} )}
-@d divide=96 {divide a register or parameter ( \.{\\divide} )}
-@d prefix=97 {qualify a definition ( \.{\\global}, \.{\\long}, \.{\\outer} )}
-@d let=98 {assign a command code ( \.{\\let}, \.{\\futurelet} )}
-@d shorthand_def=99 {code definition ( \.{\\chardef}, \.{\\countdef}, etc.~)}
-  {or \.{\\charsubdef}}
-@d read_to_cs=100 {read into a control sequence ( \.{\\read} )}
-@d def=101 {macro definition ( \.{\\def}, \.{\\gdef}, \.{\\xdef}, \.{\\edef} )}
-@d set_box=102 {set a box ( \.{\\setbox} )}
-@d hyph_data=103 {hyphenation data ( \.{\\hyphenation}, \.{\\patterns} )}
-@d set_interaction=104 {define level of interaction ( \.{\\batchmode}, etc.~)}
-@d pux_cface_def=105 {TCW: define a chinese font face ( \.{\\PUXcfacedef} )}
-@d pux_face_match=106 {TCW: English and Chinese face matching pair ( \.{\\PUXfacematch} )}
-@d pux_font_match=107 {TCW: English and CJK font matching pair ( \.{\\PUXfontmatch} )}
-@d pux_set_cface=108 {TCW: Set Chinese face}
-@d pux_set_cface_attrib=109 {TCW: Set attributes of a Chinese face ( \.{\\PUXsetcfacecspace, etc.} )}
-@d pux_set_cfont_attrib=110 {TCW: Set attributes of a CJK font ( \.{\\PUXsetcfontcspace, etc.} )}
-@d pux_char_num=111 {TCW: Chinese character number ( \.{\\PUXchar} )}
-@d pux_char_given=112 {TCW: define a Chinese character ( \.{\\PUXchardef} )}
-@d pux_space=113 {Append space glue between Chinese and Tex characters ( \.{\\PUXcespace} )}
-@d pux_range_catcode=114 {TCW: set catcodes for a range of characters( \.{\\PUXrangecatcode} )}
-@d pux_range_type_code=115 {TCW: set catcodes for a range of characters( \.{\\PUXrangecatcode} )}
-@d pux_split_number=116 {TCW: split a number to digits ( \.{\\PUXsplitnumber} )}
-@d puxg_assign_space=117 {TCW: set a PU\TeX\ global integer (\.{\\puxgCspace}, \.{\\puxgCEspace})}
-@d pux_set_default_cface=118 {TCW: set default CJK font face ( \.{\\PUXsetdefaultcface} )}
-@d pux_dump_font_info=119 {TCW: dump font information ( \.{\\PUXdumpfontinfo} )}
-@d max_command=119 {the largest command code seen at |big_switch|}
-@z
-
-@x
-In the first region we have 256 equivalents for ``active characters'' that
-act as control sequences, followed by 256 equivalents for single-character
-control sequences.
-@y
-In the first region we have 65536 equivalents for ``active characters'' that
-act as control sequences, followed by 65536 equivalents for single-character
-control sequences.
-@z
-
-@x
-@d single_base=active_base+256 {equivalents of one-character control sequences}
-@d null_cs=single_base+256 {equivalent of \.{\\csname\\endcsname}}
-@y
-@d single_base=active_base+65536 {equivalents of one-character control sequences}
-@d null_cs=single_base+65536 {equivalent of \.{\\csname\\endcsname}}
-@z
-
-%% parallel font
-@x
-@d font_id_base=frozen_null_font-font_base
-  {begins table of 257 permanent font identifiers}
-@d undefined_control_sequence=frozen_null_font+max_font_max+1 {dummy location}
-@y
-@d font_id_base=frozen_null_font-font_base
-  {begins table of 257 permanent English font identifiers}
-@d font_max_limit=5000
-@d cfont_id_base=font_id_base+font_max_limit+1
-  {TCW: begins table of 'font\_max\_limit' permanent CJK font identifiers}
-@d cfont_max_limit=font_max_limit
-@d cface_id_base=cfont_id_base+cfont_max_limit+1
-  {TCW: begins table of 257 permanent Chinese face identifiers}
-@d undefined_control_sequence=cface_id_base+257 {dummy location}
-@z
-
-@x
-token parameters, as well as the tables of \.{\\toks} and \.{\\box}
-registers.
-@y
-token parameters, as well as the tables of \.{\\toks} and \.{\\box}
-registers.
-
-TCW: Define |cur_cfont_loc| for two-byte char and the macro |cur_cfont|.
-@z
-
-@x
-@d math_font_base=cur_font_loc+1 {table of 48 math font numbers}
-@y
-@d cur_cface_loc=cur_font_loc+1 {TCW: internal chinese font number outside math mode}
-@d cur_cfont_loc=cur_cface_loc+1 {TCW: internal chinese font number outside math mode}
-@d ectbl_cface_num_base=cur_cfont_loc+1 {TCW: table of 257 CJK face numbers matched with TeX face}
-@d max_cface=256 {maximal CJK font faces number}
-@d font_matching_table_base=ectbl_cface_num_base+max_cface+1 {table of font matches}
-@d math_font_base=font_matching_table_base+font_max_limit+1 {table of 48 math font numbers}
-@z
-
-@x
-  {table of 256 command codes (the ``catcodes'')}
-@d lc_code_base=cat_code_base+256 {table of 256 lowercase mappings}
-@y
-  {TCW: table of 65536 command codes (the ``catcodes'')}
-@d pux_cat_code_base=cat_code_base+256
-@d pux_type_code_base=cat_code_base+65536 {TCW: table of 65536 type codes}
-@d lc_code_base=pux_type_code_base+65536 {table of 256 lowercase mappings}
-@z
-
-@x
-@d math_code_base=sf_code_base+256 {table of 256 math mode mappings}
-@y
-@d pux_local_names_base=sf_code_base+256 {TCW: table of 256 CJK name mappings.}
-@d math_code_base=pux_local_names_base+256 {table of 256 math mode mappings}
-@z
-
-@x
-@d cur_font==equiv(cur_font_loc)
-@y
-@d cur_font==equiv(cur_font_loc)
-@d cur_cface==equiv(cur_cface_loc) {TCW}
-@d cur_cfont==equiv(cur_cfont_loc) {TCW}
-@d ectbl_cface_num(#)==equiv(ectbl_cface_num_base+(#)) {TCW}
-@d font_matching_table(#)==equiv(font_matching_table_base+((#)-font_base)) {TCW}
-@z
-
-@x
-@d cat_code(#)==equiv(cat_code_base+#)
-@y
-@d cat_code(#)==equiv(cat_code_base+#)
-@d type_code(#)==equiv(pux_type_code_base+#)
-@d local_names(#)==equiv(pux_local_names_base+#)
-@z
-
-@x
-packages, not in \TeX\ itself, so that global interchange of formats is
-possible.
-@y
-packages, not in \TeX\ itself, so that global interchange of formats is
-possible.
-
-TCW: Add |null_cfont| and initialization for |cur_font|.
-@z
-
-@x
-@d null_font==font_base
-@y
-@d null_font==font_base
-@d null_cfont==cfont_base
-@d default_cfont==null_cfont+1
-@z
-
-@x
-begin if n=cur_font_loc then print("current font")
-else if n<math_font_base+16 then
-@y
-begin if n=cur_font_loc then print("current font")
-else if n=cur_cface_loc then print("current cface")
-else if n=cur_cfont_loc then print("current cfont")
-else if n<math_font_base+16 then
-@z
-
-@x
-  begin if n<lc_code_base then
-    begin print_esc("catcode"); print_int(n-cat_code_base);
-    end
-@y
-  begin if n<pux_type_code_base then
-    begin
-      if n<pux_cat_code_base then print_esc("catcode")
-      else print_esc("PUXcatcode");
-      print_int(n-cat_code_base);
-    end
-  else if n<lc_code_base then
-      begin print_esc("PUXtypecode"); print_int(n-pux_type_code_base);
-      end
-@z
-
-@x
-  else  begin print_esc("sfcode"); print_int(n-sf_code_base);
-    end;
-@y
-  else  if n<pux_local_names_base then
-    begin print_esc("sfcode"); print_int(n-sf_code_base);
-    end
-  else  begin print_esc("PUXlocalnames"); print_int(n-pux_local_names_base);
-    end;
-@z
-
-@x
-  print_char("="); print_int(equiv(n));
-@y
-  print_char("=");
-  if n>=pux_local_names_base then
-    if n < 256 then print_char(equiv(n))
-    else print_wchar(equiv(n))
-  else print_int(equiv(n));
-@z
-
-@x
-@d error_context_lines_code=54 {maximum intermediate line pairs shown}
-@d tex_int_pars=55 {total number of \TeX's integer parameters}
-@y
-@d error_context_lines_code=54 {maximum intermediate line pairs shown}
-@d puxg_rotate_ctext_code=55
-@d puxg_cface_depth_code=56
-@d pux_xspace_code=57
-@d pux_wcharother_code=58
-@d pux_CJKinput_code=59
-@d pux_charset_code=60
-@d pux_default_cface_code=61
-@d pux_digit_num_code=62 {number of digits of the splitted number} 
-@d pux_sign_code=63 {sign of the splitted number} 
-@d pux_digit_base=64 {10 digits of splitted number} 
-@d tex_int_pars=74 {total number of \TeX's integer parameters}
-@z
-
-@x
-@d error_context_lines==int_par(error_context_lines_code)
-@y
-@d error_context_lines==int_par(error_context_lines_code)
-@d puxg_rotate_ctext==int_par(puxg_rotate_ctext_code)
-@d puxg_cface_depth==int_par(puxg_cface_depth_code)
-@d pux_xspace==int_par(pux_xspace_code)
-@d pux_wcharother==int_par(pux_wcharother_code)
-@d pux_CJKinput==int_par(pux_CJKinput_code)
-@d pux_charset==int_par(pux_charset_code)
-@d pux_default_cface==int_par(pux_default_cface_code)
-@d pux_digit_num==int_par(pux_digit_num_code)
-@d pux_num_sign==int_par(pux_sign_code)
-@d pux_nth_digit(#)==int_par(pux_digit_base+#)
-@d default_csp=50
-@d default_cesp=150
-@d default_depth=200
-@z
-
-@x
-othercases print("[unknown integer parameter!]")
-@y
-pux_xspace_code:print_esc("puxXspace");
-pux_wcharother_code:print_esc("puxCJKcharOther");
-pux_CJKinput_code:print_esc("puxCJKinput");
-pux_charset_code:print_esc("puxCharSet");
-puxg_rotate_ctext_code:print_esc("puxgRotateCtext");
-puxg_cface_depth_code:print_esc("puxgCfaceDepth");
-othercases print("[unknown integer parameter!]")
-@z
-
-@x
-del_code("."):=0; {this null delimiter is used in error recovery}
-@y
-del_code("."):=0; {this null delimiter is used in error recovery}
-puxg_cface_depth:=default_depth;
-pux_CJKinput:=1;
-@z
-
-@x
-      if cat_code(p-single_base)=letter then print_char(" ");
-@y
-      if get_cat_code(p-single_base)=letter then print_char(" ");
-@z
-
-@x
-def_font: print_esc("font");
-@y
-def_font: print_esc("font");
-pux_font_match: print_esc("PUXfontmatch"); {TCW}
-pux_set_cface: print_esc("cface"); {TCW}
-pux_range_catcode: print_esc("PUXrangecatcode"); {TCW}
-pux_range_type_code: print_esc("PUXrangetypecode"); {TCW}
-pux_split_number: print_esc("PUXsplitnumber"); {TCW}
-@z
-
-@x
-A \TeX\ token is either a character or a control sequence, and it is
-@^token@>
-represented internally in one of two ways: (1)~A character whose ASCII
-code number is |c| and whose command code is |m| is represented as the
-number $2^8m+c$; the command code is in the range |1<=m<=14|. (2)~A control
-sequence whose |eqtb| address is |p| is represented as the number
-|cs_token_flag+p|. Here |cs_token_flag=@t$2^{12}-1$@>| is larger than
-$2^8m+c$, yet it is small enough that |cs_token_flag+p< max_halfword|;
-thus, a token fits comfortably in a halfword.
-
-A token |t| represents a |left_brace| command if and only if
-|t<left_brace_limit|; it represents a |right_brace| command if and only if
-we have |left_brace_limit<=t<right_brace_limit|; and it represents a |match| or
-|end_match| command if and only if |match_token<=t<=end_match_token|.
-The following definitions take care of these token-oriented constants
-and a few others.
-
-@d cs_token_flag==@'7777 {amount added to the |eqtb| location in a
-  token that stands for a control sequence; is a multiple of~256, less~1}
-@d left_brace_token=@'0400 {$2^8\cdot|left_brace|$}
-@d left_brace_limit=@'1000 {$2^8\cdot(|left_brace|+1)$}
-@d right_brace_token=@'1000 {$2^8\cdot|right_brace|$}
-@d right_brace_limit=@'1400 {$2^8\cdot(|right_brace|+1)$}
-@d math_shift_token=@'1400 {$2^8\cdot|math_shift|$}
-@d tab_token=@'2000 {$2^8\cdot|tab_mark|$}
-@d out_param_token=@'2400 {$2^8\cdot|out_param|$}
-@d space_token=@'5040 {$2^8\cdot|spacer|+|" "|$}
-@d letter_token=@'5400 {$2^8\cdot|letter|$}
-@d other_token=@'6000 {$2^8\cdot|other_char|$}
-@d match_token=@'6400 {$2^8\cdot|match|$}
-@d end_match_token=@'7000 {$2^8\cdot|end_match|$}
-@y
-A \TeX\ token is either a character or a control sequence, and it is
-@^token@>
-represented internally in one of two ways: (1)~A character whose ASCII
-code number is |c| and whose command code is |m| is represented as the
-number $2^{16}m+c$; the command code is in the range |1<=m<=14|. (2)~A control
-sequence whose |eqtb| address is |p| is represented as the number
-|cs_token_flag+p|. Here |cs_token_flag=@t$2^{20}-1$@>| is larger than
-$2^{16}m+c$, yet it is small enough that |cs_token_flag+p< max_halfword|;
-thus, a token fits comfortably in a halfword.
-
-A token |t| represents a |left_brace| command if and only if
-|t<left_brace_limit|; it represents a |right_brace| command if and only if
-we have |left_brace_limit<=t<right_brace_limit|; and it represents a |match| or
-|end_match| command if and only if |match_token<=t<=end_match_token|.
-The following definitions take care of these token-oriented constants
-and a few others.
-
-@d cs_token_flag==@"FFFFF {amount added to the |eqtb| location in a
-  token that stands for a control sequence; is a multiple of~65536, less~1}
-@d left_brace_token==@"10000 {$2^{16}\cdot|left_brace|$}
-@d left_brace_limit==@"20000 {$2^{16}\cdot(|left_brace|+1)$}
-@d right_brace_token==@"20000 {$2^{16}\cdot|right_brace|$}
-@d right_brace_limit==@"30000 {$2^{16}\cdot(|right_brace|+1)$}
-@d math_shift_token==@"30000 {$2^{16}\cdot|math_shift|$}
-@d tab_token==@"40000 {$2^{16}\cdot|tab_mark|$}
-@d out_param_token==@"50000 {$2^{16}\cdot|out_param|$}
-@d space_token==@"A0020 {$2^{16}\cdot|spacer|+|" "|$}
-@d letter_token==@"B0000 {$2^{16}\cdot|letter|$}
-@d other_token==@"C0000 {$2^{16}\cdot|other_char|$}
-@d match_token==@"D0000 {$2^{16}\cdot|match|$}
-@d end_match_token==@"E0000 {$2^{16}\cdot|end_match|$}
-@z
-
-@x
-else  begin m:=info(p) div @'400; c:=info(p) mod @'400;
-@y
-else  begin m:=info(p) div @"10000; c:=info(p) mod @"10000;
-@z
-
-@x
-left_brace,right_brace,math_shift,tab_mark,sup_mark,sub_mark,spacer,
-  letter,other_char: print(c);
-@y
-letter,other_char: if is_wchar(c) then print_wchar(c) else print(c);
-left_brace,right_brace,math_shift,tab_mark,sup_mark,sub_mark,spacer: print(c);
-@z
-
-@x
-@d chr_cmd(#)==begin print(#); print_ASCII(chr_code);
-  end
-@y
-@d chr_cmd(#)==begin print(#); print_ASCII(chr_code);
-  end
-@d wchr_cmd(#)==begin print(#);
-  if is_wchar(chr_code) then
-    print_wchar(chr_code)
-  else print_ASCII(chr_code);
-  end
-@z
-
-@x
-letter: chr_cmd("the letter ");
-other_char: chr_cmd("the character ");
-@y
-letter: wchr_cmd("the letter ");
-other_char: wchr_cmd("the character ");
-@z
-
-@x
-@!d:2..3; {number of excess characters in an expanded code}
-@y
-@!d:2..3; {number of excess characters in an expanded code}
-@!first_control_char:integer; {the first character code of control sequence}
-@z
-
-@x
-@ @<Input from external file, |goto restart| if no input found@>=
-@^inner loop@>
-begin switch: if loc<=limit then {current line not yet finished}
-  begin cur_chr:=buffer[loc]; incr(loc);
-@y
-@ The |get_wchar| macro tries to read a double-byte character from |buffer|
-at the position specified by the parameter. The code value is stored in the
-global variable |cur_chr|.
-@^inner loop@>
-@^Modified for handling DBCS characters@>
-
-@d get_wchar(#)==begin cur_chr:=buffer[#]; incr(#);
-     if cur_chr > 127 and pux_CJKinput = 1 then begin
-        cur_chr := cur_chr * 256 + buffer[#]; incr(#)
-     end
-   end
-
-@<Input from external file, |goto restart| if no input found@>=
-begin switch: if loc<=limit then {current line not yet finished}
-  begin get_wchar(loc);
-@z
-
-@x
-  reswitch: cur_cmd:=cat_code(cur_chr);
-@y
-  reswitch: cur_cmd:=get_cat_code(cur_chr);
-@z
-
-@x
-buffer and the process is repeated, slowly but surely.
-
-@<Scan a control...@>=
-begin if loc>limit then cur_cs:=null_cs {|state| is irrelevant in this case}
-else  begin start_cs: k:=loc; cur_chr:=buffer[k]; cat:=cat_code(cur_chr);
-  incr(k);
-@y
-buffer and the process is repeated, slowly but surely.
-
-\medskip
-
-TCW: When the flag |expand_char| is true, we stop using |get_wchar| but
-merely get a one-byte character so that reading DBCS characters
-will not be confused. Besides, we neet to handle alphabetic numbers of the form
-\.{'\\c}, where \.{c} is a DBCS characters.@^Modified for handling DBCS characters@>
-
-@<Scan a control...@>=
-begin if loc>limit then cur_cs:=null_cs {|state| is irrelevant in this case}
-else  begin first_control_char := -1;@/
-start_cs: k:=loc;
-      if expand_char then begin
-         cur_chr:=buffer[k];
-         incr(k);
-         expand_char:=false;
-      end
-      else get_wchar(k);
-      cat:=get_cat_code(cur_chr);
-      if first_control_char = -1 then first_control_char := cur_chr;
-@z
-
-@x
-  cur_cs:=single_base+buffer[loc]; incr(loc);
-  end;
-@y
-  @#{the control sequence is a control symbol, i.e., its name consisits of  only one letter. }
-  if is_wchar(first_control_char) then begin
-    cur_cs:=single_base+first_control_char; loc:=loc+2;
-    end
-  else begin
-    cur_cs:=single_base+buffer[loc]; incr(loc);
-    end;
-  end;
-@z
-
-@x
-the buffer left two or three places.
-@y
-the buffer left two or three places.
-
-TCW: If it is indeed an expanded code, set the flag |expand_char|.
-@^Modified for handling DBCS characters@>
-@z
-
-@x
-  begin c:=buffer[k+1]; @+if c<@'200 then {yes, one is indeed present}
-    begin d:=2;
-@y
-  begin c:=buffer[k+1]; @+if c<@'200 then {yes, one is indeed present}
-    begin d:=2; expand_char:=true;
-@z
-
-@x
-@ @<Scan ahead in the buffer...@>=
-begin repeat cur_chr:=buffer[k]; cat:=cat_code(cur_chr); incr(k);
-@y
-@ @<Scan ahead in the buffer...@>=
-@^Modified for handling DBCS characters@>
-begin repeat get_wchar(k); cat:=get_cat_code(cur_chr);
-@z
-
-@x
-if cat<>letter then decr(k);
-  {now |k| points to first nonletter}
-if k>loc+1 then {multiletter control sequence has been scanned}
-@y
-if cat<>letter then if cur_chr > 256 then k:=k-2 { go back 2 steps for a non-letter DBCS code }
-else decr(k);
-  {now |k| points to first nonletter}
-if k>loc+1 and not (k = loc+2 and first_control_char > 255) then {multiletter control sequence has been scanned}
-@z
-
-@x
-  else  begin cur_cmd:=t div @'400; cur_chr:=t mod @'400;
-@y
-  else  begin cur_cmd:=t div @"10000; cur_chr:=t mod @"10000;
-@z
-
-@x
-if cur_cs=0 then cur_tok:=(cur_cmd*@'400)+cur_chr
-@y
-if cur_cs=0 then cur_tok:=(cur_cmd*@"10000)+cur_chr
-@z
-
-@x
-  buffer[j]:=info(p) mod @'400; incr(j); p:=link(p);
-@y
-@^Modified for handling DBCS characters@>
-  db_char:=info(p) mod @"10000;
-  if is_wchar(db_char) then {a double-byte char}
-     begin buffer[j]:=db_char div 256;
-     buffer[j+1]:=db_char mod 256;
-     j:=j + 2;
-     end
-  else begin
-     buffer[j]:=db_char;
-     incr(j);
-     end;
-  p:=link(p); {fix this for 2-byte code}
-@z
-
-@x
-done: if cur_cs=0 then cur_tok:=(cur_cmd*@'400)+cur_chr
-@y
-done: if cur_cs=0 then cur_tok:=(cur_cmd*@"10000)+cur_chr
-@z
-
-@x
-if cur_cs=0 then cur_tok:=(cur_cmd*@'400)+cur_chr
-@y
-if cur_cs=0 then cur_tok:=(cur_cmd*@"10000)+cur_chr
-@z
-
-@x
-toks_register,assign_toks,def_family,set_font,def_font: @<Fetch a token list or
-  font identifier, provided that |level=tok_val|@>;
-@y
-toks_register,assign_toks,def_family,set_font,def_font,set_cfont:
-   @<Fetch a token list or font identifier, provided that |level=tok_val|@>;
-@z
-
-@x
-assign_int: scanned_result(eqtb[m].int)(int_val);
-@y
-assign_int,puxg_assign_flag,puxg_assign_int: scanned_result(eqtb[m].int)(int_val);
-pux_get_int:@<scan \PUTeX\ internal values@>;
-@z
-
-@x
-char_given,math_given: scanned_result(cur_chr)(int_val);
-@y
-char_given,math_given,pux_char_given: scanned_result(cur_chr)(int_val);
-@z
-
-@x
-@ @<Fetch a character code from some table@>=
-begin scan_char_num;
-@y
-@ @<Fetch a character code from some table@>=
-begin
-  if (m = pux_cat_code_base) or (m = pux_type_code_base) then
-    scan_wchar_num
-  else if m = pux_local_names_base then begin
-    char_val_flag:=true;
-    scan_eight_bit_int;
-    end
-  else
-    scan_char_num;
-@z
-
-@x
-begin scan_font_ident;
-if m=0 then scanned_result(hyphen_char[cur_val])(int_val)
-else scanned_result(skew_char[cur_val])(int_val);
-end
-@y
-begin scan_font_ident;
-if cur_val <= font_max then
-  if m=0 then scanned_result(hyphen_char[cur_val])(int_val)
-  else scanned_result(skew_char[cur_val])(int_val);
-end
-@z
-
-@x
-@d octal_token=other_token+"'" {apostrophe, indicates an octal constant}
-@d hex_token=other_token+"""" {double quote, indicates a hex constant}
-@d alpha_token=other_token+"`" {reverse apostrophe, precedes alpha constants}
-@d point_token=other_token+"." {decimal point}
-@d continental_point_token=other_token+"," {decimal point, Eurostyle}
-@y
-@d octal_token==(other_token+"'") {apostrophe, indicates an octal constant}
-@d hex_token==(other_token+"""") {double quote, indicates a hex constant}
-@d alpha_token==(other_token+"`") {reverse apostrophe, precedes alpha constants}
-@d point_token==(other_token+".") {decimal point}
-@d continental_point_token==(other_token+",") {decimal point, Eurostyle}
-@z
-
-@x
-if cur_val>255 then
-@y
-if cur_val>65535 then
-@z
-
-@x
-@d zero_token=other_token+"0" {zero, the smallest digit}
-@d A_token=letter_token+"A" {the smallest special hex digit}
-@d other_A_token=other_token+"A" {special hex digit of type |other_char|}
-@y
-@d zero_token==(other_token+"0") {zero, the smallest digit}
-@d A_token==(letter_token+"A") {the smallest special hex digit}
-@d other_A_token==(other_token+"A") {special hex digit of type |other_char|}
-@z
-
-@x
-`\.{height}' or `\.{width}' or `\.{depth}' specifications are
-found (in any order).
-@y
-`\.{height}' or `\.{width}' or `\.{depth}' specifications are
-found (in any order).
-
-TCW: not intend to modify the function here;
-     just append declarations of scanning routines for PUTeX.
-@z
-
-@x
-if scan_keyword("depth") then
-@.depth@>
-  begin scan_normal_dimen; depth(q):=cur_val; goto reswitch;
-  end;
-scan_rule_spec:=q;
-end;
-@y
-if scan_keyword("depth") then
-@.depth@>
-  begin scan_normal_dimen; depth(q):=cur_val; goto reswitch;
-  end;
-scan_rule_spec:=q;
-end;
-
-@<PUTeX basic scanning routines@>@;
-@z
-
-@x
-var p:pointer; {tail of the token list}
-@!q:pointer; {new node being added to the token list via |store_new_token|}
-@!t:halfword; {token being appended}
-@!k:pool_pointer; {index into |str_pool|}
-begin str_room(1);
-p:=temp_head; link(p):=null; k:=b;
-while k<pool_ptr do
-  begin t:=so(str_pool[k]);
-  if t=" " then t:=space_token
-  else t:=other_token+t;
-  fast_store_new_token(t);
-  incr(k);
-  end;
-pool_ptr:=b; str_toks:=p;
-end;
-@y
-var p:pointer; {tail of the token list}
-@!q:pointer; {new node being added to the token list via |store_new_token|}
-@!t:halfword; {token being appended}
-@!k:pool_pointer; {index into |str_pool|}
-begin str_room(1);
-p:=temp_head; link(p):=null; k:=b;
-while k<pool_ptr do
-  begin t:=so(str_pool[k]);
-  if t > 128 then begin
-    t:=t*256+so(str_pool[k+1]);
-    incr(k);
-    end;
-  if t=" " then t:=space_token
-  else t:=other_token+t;
-  fast_store_new_token(t);
-  incr(k);
-  end;
-pool_ptr:=b; str_toks:=p;
-end;
-@z
-
-@x
-containing something like `\.{-3.0pt minus 0.5fill}'.
-@y
-containing something like `\.{-3.0pt minus 0.5fill}'.
-
-TCW: make the function able to print CJK characters stored in local names table.
-
-@z
-
-@x
-begin get_x_token; scan_something_internal(tok_val,false);
-@y
-begin get_x_token; char_val_flag:=false; scan_something_internal(tok_val,false);
-@z
-
-@x
-  int_val:print_int(cur_val);
-@y
-  int_val:if char_val_flag then
-            if cur_val > 255 then print_wchar(cur_val)
-            else {an empty slot}
-            begin print_char("?"); print_char("?"); end
-          else print_int(cur_val);
-@z
-
-@x
-@d font_name_code=4 {command code for \.{\\fontname}}
-@d job_name_code=5 {command code for \.{\\jobname}}
-@y
-@d font_name_code=4 {command code for \.{\\fontname}}
-@d cnumber_code=5 {command code for \.{\\PUXcnumber}}
-@d scnumber_code=6 {command code for \.{\\PUXscnumber}}
-@d ucnumber_code=7 {command code for \.{\\PUXucnumber}}
-@d fcnumber_code=8 {command code for \.{\\PUXfcnumber}}
-@d acnumber_code=9 {command code for \.{\\PUXacnumber}}
-@d cjknumber_code=10 {command code for \.{\\PUXcjknumber}}
-@d nameseq_code=11 {command code for \.{\\PUXnameseq}}
-@d job_name_code=12 {command code for \.{\\jobname}}
-@d lower_cdigit_base=10    {lowercase style Chinese number}
-@d upper_cdigit_base=25    {uppercase style Chinese number}
-@z
-
-@x
-primitive("jobname",convert,job_name_code);@/
-@!@:job_name_}{\.{\\jobname} primitive@>
-@y
-primitive("jobname",convert,job_name_code);@/
-@!@:job_name_}{\.{\\jobname} primitive@>
-primitive("PUXcnumber",convert,cnumber_code);@/
-@!@:cnumber_}{\.{\\PUXcnumber} primitive@>
-primitive("PUXscnumber",convert,scnumber_code);@/
-@!@:scnumber_}{\.{\\PUXscnumber} primitive@>
-primitive("PUXucnumber",convert,ucnumber_code);@/
-@!@:ucnumber_}{\.{\\PUXucnumber} primitive@>
-primitive("PUXfcnumber",convert,fcnumber_code);@/
-@!@:fcnumber_}{\.{\\PUXfcnumber} primitive@>
-primitive("PUXacnumber",convert,acnumber_code);@/
-@!@:acnumber_}{\.{\\PUXacnumber} primitive@>
-primitive("PUXcjknumber",convert,cjknumber_code);@/
-@!@:cjknumber_}{\.{\\PUXcjknumber} primitive@>
-primitive("PUXnameseq",convert,nameseq_code);@/
-@!@:cjknameseq_}{\.{\\PUXnameseq} primitive@>
-@z
-
-@x
-  meaning_code: print_esc("meaning");
-  font_name_code: print_esc("fontname");
-@y
-  meaning_code: print_esc("meaning");
-  font_name_code: print_esc("fontname");
-  cnumber_code: print_esc("PUXcnumber");
-  scnumber_code: print_esc("PUXscnumber");
-  ucnumber_code: print_esc("PUXucnumber");
-  fcnumber_code: print_esc("PUXfcnumber");
-  acnumber_code: print_esc("PUXfanumber");
-  cjknumber_code: print_esc("PUXcjknumber");
-  nameseq_code: print_esc("PUXnameseq");
-@z
-
-@x
-@!save_scanner_status:small_number; {|scanner_status| upon entry}
-@!b:pool_pointer; {base of temporary string}
-begin c:=cur_chr; @<Scan the argument for command |c|@>;
-@y
-@!save_scanner_status:small_number; {|scanner_status| upon entry}
-@!b:pool_pointer; {base of temporary string}
-@!dsize:integer;
-@!saved_val,digit_base,sign:integer;
-@!min_val,max_val,offset:integer;
-begin c:=cur_chr; @<Scan the argument for command |c|@>;
-@z
-
-@x
-case c of
-number_code,roman_numeral_code: scan_int;
-@y
-case c of
-number_code,roman_numeral_code,cnumber_code,scnumber_code,ucnumber_code,
-fcnumber_code : scan_int;
-acnumber_code: @<scan and split the number@>;
-cjknumber_code:@<scan a CJK number with a possible selector and then  split it@>;
-nameseq_code:@<scan a CJK name sequence number@>;
-@z
-
-@x
-roman_numeral_code: print_roman_int(cur_val);
-string_code:if cur_cs<>0 then sprint_cs(cur_cs)
-  else print_char(cur_chr);
-@y
-roman_numeral_code: print_roman_int(cur_val);
-cnumber_code: print_chinese_int(cur_val,lower_cdigit_base,false,false);
-scnumber_code: print_chinese_int(cur_val,lower_cdigit_base,true,false);
-ucnumber_code: print_chinese_int(cur_val,upper_cdigit_base,false,false);
-fcnumber_code: print_chinese_int(cur_val,upper_cdigit_base,false,true);
-acnumber_code: @<using full-width arabic characters to print a CJK number@>;
-cjknumber_code: @<print a CJK number with specified format@>;
-nameseq_code: @<print a CJK name sequence member@>;
-string_code:if cur_cs<>0 then sprint_cs(cur_cs)
-  else
-    if is_wchar(cur_chr) then print_wchar(cur_chr)
-    else print_char(cur_chr);
-@z
-
-@x
-font_name_code: begin print(font_name[cur_val]);
-  if font_size[cur_val]<>font_dsize[cur_val] then
-    begin print(" at "); print_scaled(font_size[cur_val]);
-    print("pt");
-    end;
-  end;
-@y
-font_name_code: begin
-  if cur_val <=font_max then begin
-    print(font_name[cur_val]);
-    if font_size[cur_val]<>font_dsize[cur_val] then
-      begin print(" at "); print_scaled(font_size[cur_val]);
-      print("pt");
-      end;
-    end
-  else begin
-    print("CFONT");
-    print(cface[cfont_face[cur_val]]);
-    dsize:=cfont_dsize[cur_val] div @"10000;
-    print_int(dsize);
-    if cfont_size[cur_val]<>cfont_dsize[cur_val] then
-      begin print(" at "); print_scaled(cfont_size[cur_val]);
-      print("pt");
-      end;
-    end;
-  end;
-@z
-
-@x
-if (cur_cmd>active_char)or(cur_chr>255) then {not a character}
-  begin m:=relax; n:=256;
-@y
-if (cur_cmd>active_char)or(cur_chr>65535) then {not a character}
-  begin m:=relax; n:=256; {values other than 256 will break latex.fmt}
-@z
-
-@x
-if (cur_cmd>active_char)or(cur_chr>255) then
-  begin cur_cmd:=relax; cur_chr:=256;
-  end;
-@y
-if (cur_cmd>active_char)or(cur_chr>65535) then
-  begin cur_cmd:=relax; cur_chr:=256; {values other than 256 will break latex.fmt}
-  end;
-@z
-
-@x
-  pack_job_name(".dvi");
-  while not b_open_out(dvi_file) do
-    prompt_file_name("file name for output",".dvi");
-@y
-  pack_job_name(".cdi");
-  while not b_open_out(dvi_file) do
-    prompt_file_name("file name for output",".cdi");
-@z
-
-@x
-@ Before we forget about the format of these tables, let's deal with two
-of \TeX's basic scanning routines related to font information.
-
-@<Declare procedures that scan font-related stuff@>=
-procedure scan_font_ident;
-var f:internal_font_number;
-@!m:halfword;
-begin @<Get the next non-blank non-call...@>;
-if cur_cmd=def_font then f:=cur_font
-else if cur_cmd=set_font then f:=cur_chr
-@y
-@ Before we forget about the format of these tables, let's deal with two
-of \TeX's basic scanning routines related to font information.
-
-TCW: handle the commands |def_cfont| and |set_cfont|.
-
-@<Declare procedures that scan font-related stuff@>=
-procedure scan_font_ident;
-var f:integer;
-@!m:halfword;
-begin @<Get the next non-blank non-call...@>;
-if cur_cmd=def_font then f:=cur_font
-else if cur_cmd=set_font or cur_cmd=set_cfont then f:=cur_chr
-@z
-
-@x
-bytes long, so it is in the range |0<=c<65536|. \TeX82 never uses this
-command, but it should come in handy for extensions of \TeX\ that deal
-with oriental languages.
-@y
-bytes long, so it is in the range |0<=c<65536|. \PUTeX\ uses this to typeset
-a CJK two-byte character.
-@z
-
-@x
-\yskip\hang|pre| 247 |i[1]| |num[4]| |den[4]| |mag[4]| |k[1]| |x[k]|.
-Beginning of the preamble; this must come at the very beginning of the
-file. Parameters |i|, |num|, |den|, |mag|, |k|, and |x| are explained below.
-@y
-\yskip\hang|pre| 247 |i[1]| |c[1]| |num[4]| |den[4]| |mag[4]| |k[1]| |x[k]|.
-Beginning of the preamble; this must come at the very beginning of the
-file. Parameters |i|, |c|, |num|, |den|, |mag|, |k|, and |x| are explained below.
-@z
-
-@x
-\yskip\hang|post_post| 249. Ending of the postamble, see below.
-
-\yskip\noindent Commands 250--255 are undefined at the present time.
-@y
-\yskip\hang|post_post| 249. Ending of the postamble, see below.
-
-\yskip\hang|cfnt| 250 |k[2]|. Set |cf:=k|. \PUTeX\ uses this command for CJK font
-numbers in the range |0<=k<65535|.
-
-\yskip\hang|cfnt_def| 251 |k[2]| |l[1]| |n[l]| |c[1]| |s[4]| |ds[4]| |wt[2]| |y[1]|
-  |w[4]| |h[4]| |d[4]| |fw[4]| |fh[4]| |fd[4]|. Define CJK font |k|, where |0<=k<65536|, see below.
-
-\yskip\noindent Commands 252--255 are undefined at the present time.
-@z
-
-@x
-@d set1=128 {typeset a character and move right}
-@y
-@d set1=128 {typeset a character and move right}
-@d set2=129 {typeset a two-byte CJK character and move right}
-@d set4=131 {typeset a four-byte CJK character and move right}
-@z
-
-@x
-@d post_post=249 {postamble ending}
-@y
-@d post_post=249 {postamble ending}
-@d cfnt=250 {set current chinese font}
-@d cfnt_def=251 {define the meaning of a chinese font}
-@z
-
-@x
-$$\hbox{|@!i[1]| |@!num[4]| |@!den[4]| |@!mag[4]| |@!k[1]| |@!x[k]|.}$$
-The |i| byte identifies \.{DVI} format; currently this byte is always set
-to~2. (The value |i=3| is currently used for an extended format that
-allows a mixture of right-to-left and left-to-right typesetting.
-Some day we will set |i=4|, when \.{DVI} format makes another
-incompatible change---perhaps in the year 2048.)
-@y
-$$\hbox{|@!i[1]| |@!c[1]| |@!num[4]| |@!den[4]| |@!mag[4]| |@!k[1]| |@!x[k]|.}$$
-The |i| byte identifies \.{CDI} format; currently this byte is always set
-to~100. (Some day we will set |i=101|, when \.{CDI} format makes another
-incompatible change---perhaps in the year 2048.)
-
-The |c| byte identifies the default character code set of document. Currently, the following
-code value is defined:
-
-  0: USC2 (Unicode, not supported yet)
-
-  1: Big5 (Traditional Chinese used in Taiwan and Hong Kong)
-  
-  2: GBK (Simplified Chinese used in PRC and Singapore)
-@z
-
-@x
-@d id_byte=2 {identifies the kind of \.{DVI} files described here}
-@y
-@d id_byte=100 {identifies the kind of \.{DVI} files described here}
-@z
-
-@x
-@ Here's a procedure that outputs a font definition. Since \TeX82 uses at
-most 256 different fonts per job, |fnt_def1| is always used as the command code.
-@y
-@ Here's a procedure that outputs a font definition. Since \TeX82 uses at
-most 256 different fonts per job, |fnt_def1| is always used as the command code.
-
-TCW: the procedure |dvi_cfont_def| outputs a chinese font definition.
-@z
-
-@x
-@<Output the font name whose internal number is |f|@>;
-end;
-@y
-@<Output the font name whose internal number is |f|@>;
-end;
-
-procedure dvi_cfont_def (f:internal_cfont_number);
-var k:pool_pointer;
-    j:integer;
-begin
-j:=cfont_face[f];
-dvi_out(cfnt_def);
-dvi_out((f-cfont_base-1) div 256); dvi_out((f-cfont_base-1) mod 256);
-{Output the CJK font face name}
-dvi_out(length(cface_name[j]));
-for k:= str_start[cface_name[j]] to str_start[cface_name[j]+1] - 1 do dvi_out(str_pool[k]);
-dvi_out(cface_charset[j]);
-dvi_four(cfont_size[f]);
-dvi_four(cfont_dsize[f]);
-dvi_out(cface_weight[j] div 256); dvi_out(cface_weight[j] mod 256);
-dvi_out(cface_style[j]);
-dvi_four(cfont_width[f]);
-dvi_four(cfont_height[f]);
-dvi_four(cfont_depth[f]);
-dvi_four(cface_fw_width[j]);
-dvi_four(cface_fw_height[j]);
-dvi_four(cface_fw_depth[j]);
-end;
-@z
-
-@x
-dvi_h:=0; dvi_v:=0; cur_h:=h_offset; dvi_f:=null_font;
-@y
-dvi_h:=0; dvi_v:=0; cur_h:=h_offset; dvi_f:=null_font; dvi_cf:=null_cfont;
-@z
-
-@x
-  begin dvi_out(pre); dvi_out(id_byte); {output the preamble}
-@y
-  begin dvi_out(pre); dvi_out(id_byte);
-  doc_charset:=pux_charset; dvi_out(doc_charset); {output the preamble}
-@z
-
-@x
-  print(" TeX output "); print_int(year); print_char(".");
-@y
-  print(" PUTeX output "); print_int(year); print_char(".");
-@z
-
-%% MMM
-@x
-@<Output node |p| for |hlist_out|...@>=
-reswitch: if is_char_node(p) then
-  begin synch_h; synch_v;
-  repeat f:=font(p); c:=character(p);
-  if f<>dvi_f then @<Change font |dvi_f| to |f|@>;
-  if font_ec[f]>=qo(c) then if font_bc[f]<=qo(c) then
-    if char_exists(orig_char_info(f)(c)) then  {N.B.: not |char_info|}
-      begin if c>=qi(128) then dvi_out(set1);
-      dvi_out(qo(c));@/
-      cur_h:=cur_h+char_width(f)(orig_char_info(f)(c));
-      goto continue;
-      end;
-  if mltex_enabled_p then
-    @<Output a substitution, |goto continue| if not possible@>;
-continue:
-  p:=link(p);
-  until not is_char_node(p);
-  dvi_h:=cur_h;
-  end
-else @<Output the non-|char_node| |p| for |hlist_out|
-    and move to the next node@>
-@y
-@<Output node |p| for |hlist_out|...@>=
-reswitch: if is_char_node(p) then
-  begin synch_h; synch_v;
-  repeat f:=font(p); c:=character(p);
-  if (is_wchar(c)) then begin
-    if f<>dvi_cf then @<Change font |dvi_cf| to |f|@>;
-    dvi_out(set2); dvi_out(c div 256); dvi_out(c mod 256);
-    cur_h:=cur_h+cfont_width[f];
-    end
-  else begin
-    if f<>dvi_f then @<Change font |dvi_f| to |f|@>;
-    if font_ec[f]>=qo(c) then if font_bc[f]<=qo(c) then
-      if char_exists(orig_char_info(f)(c)) then  {N.B.: not |char_info|}
-      if c>=qi(128) then dvi_out(set1);
-      dvi_out(qo(c));@/
-      cur_h:=cur_h+char_width(f)(orig_char_info(f)(c));
-      goto continue;
-      end;
- if mltex_enabled_p then
-    @<Output a substitution, |goto continue| if not possible@>;
-continue:
-  p:=link(p);
-  until not is_char_node(p);
-  dvi_h:=cur_h;
-  end
-else @<Output the non-|char_node| |p| for |hlist_out|
-    and move to the next node@>
-@z
-
-@x
-  dvi_out(post_post); dvi_four(last_bop); dvi_out(id_byte);@/
-@y
-  @<Output the CJK font definitions for all fonts that were used@>;
-  dvi_out(post_post); dvi_four(last_bop); dvi_out(doc_charset); dvi_out(id_byte);@/
-@z
-
-@x
-@<Incorporate character dimensions into the dimensions of the hbox...@>=
-begin f:=font(p); i:=char_info(f)(character(p)); hd:=height_depth(i);
-x:=x+char_width(f)(i);@/
-s:=char_height(f)(hd);@+if s>h then h:=s;
-s:=char_depth(f)(hd);@+if s>d then d:=s;
-p:=link(p);
-end
-@y
-@<Incorporate character dimensions into the dimensions of the hbox...@>=
-begin f:=font(p); c:=character(p);
-if (is_wchar(c)) then begin
-  x:=x+cfont_width[f];@/
-  s:=cfont_height[f];@+if s>h then h:=s;
-  s:=cfont_depth[f];@+if s>d then d:=s;
-  end
-else begin
-  i:=char_info(f)(c); hd:=height_depth(i);
-  x:=x+char_width(f)(i);@/
-  s:=char_height(f)(hd);@+if s>h then h:=s;
-  s:=char_depth(f)(hd);@+if s>d then d:=s;
-  end;
-p:=link(p);
-end
-@z
-
-@x
-font_in_short_display:=null_font; short_display(list_ptr(r)); print_ln;@/
-@y
-font_in_short_display:=null_font; cfont_in_short_display:=null_cfont;@/
-short_display(list_ptr(r)); print_ln;@/
-@z
-
-@x
-  if (is_char_node(p))and(link(p)=null) then
-    begin f:=font(p); v:=char_width(f)(char_info(f)(character(p)));
-    if v<>width(b) then link(p):=new_kern(width(b)-v);
-    end;
-@y
-  if (is_char_node(p))and(link(p)=null) then
-    begin
-    f:=font(p);
-    if is_wchar_node(p) then
-      v:=cfont_width[f]
-    else
-      v:=char_width(f)(char_info(f)(character(p)));
-    if v<>width(b) then link(p):=new_kern(width(b)-v);
-    end;
-@z
-
-@x
-if is_char_node(v) then
-  begin f:=font(v);
-  break_width[1]:=break_width[1]-char_width(f)(char_info(f)(character(v)));
-  end
-@y
-if is_char_node(v) then
-  begin f:=font(v);
-  if is_wchar_node(v) then
-    break_width[1]:=break_width[1]-cfont_width[f]
-  else
-    break_width[1]:=break_width[1]-char_width(f)(char_info(f)(character(v)));
-  end
-@z
-
-@x
-  ligature_node: begin f:=font(lig_char(v));@/
-    break_width[1]:=@|break_width[1]-
-      char_width(f)(char_info(f)(character(lig_char(v))));
-    end;
-@y
-  ligature_node: begin f:=font(lig_char(v));@/
-    if is_wchar(character(lig_char(v))) then
-    break_width[1]:=@|break_width[1]-cfont_width[f]
-    else
-    break_width[1]:=@|break_width[1]-
-      char_width(f)(char_info(f)(character(lig_char(v))));
-    end;
-@z
-
-@x
-if is_char_node(s) then
-  begin f:=font(s);
-  break_width[1]:=@|break_width[1]+char_width(f)(char_info(f)(character(s)));
-  end
-@y
-if is_char_node(s) then
-  begin f:=font(s);
-  if is_wchar_node(s) then
-    break_width[1]:=break_width[1]+cfont_width[f]
-  else
-    break_width[1]:=@|break_width[1]+char_width(f)(char_info(f)(character(s)));
-  end
-@z
-
-@x
-  ligature_node: begin f:=font(lig_char(s));
-    break_width[1]:=break_width[1]+
-      char_width(f)(char_info(f)(character(lig_char(s))));
-    end;
-@y
-  ligature_node: begin f:=font(lig_char(s));@/
-    if is_wchar(character(lig_char(s))) then
-    break_width[1]:=break_width[1]+cfont_width[f]
-    else
-    break_width[1]:=break_width[1]+
-      char_width(f)(char_info(f)(character(lig_char(s))));
-    end;
-@z
-
-@x
-font_in_short_display:=null_font
-@y
-cfont_in_short_display:=null_cfont; font_in_short_display:=null_font
-@z
-
-@x
-ligature_node: begin f:=font(lig_char(cur_p));
-  act_width:=act_width+char_width(f)(char_info(f)(character(lig_char(cur_p))));
-  end;
-@y
-ligature_node: begin f:=font(lig_char(cur_p));
-  if is_wchar(character(lig_char(cur_p))) then
-    act_width:=act_width+cfont_width[f]
-  else
-    act_width:=act_width+char_width(f)(char_info(f)(character(lig_char(cur_p))));
-  end;
-@z
-
-@x
-repeat f:=font(cur_p);
-act_width:=act_width+char_width(f)(char_info(f)(character(cur_p)));
-cur_p:=link(cur_p);
-until not is_char_node(cur_p);
-end
-@y
-repeat f:=font(cur_p);
-if is_wchar_node(cur_p) then
-  act_width:=act_width+cfont_width[f]
-else
-  act_width:=act_width+char_width(f)(char_info(f)(character(cur_p)));
-cur_p:=link(cur_p);
-until not is_char_node(cur_p);
-end
-@z
-
-@x
-if is_char_node(s) then
-  begin f:=font(s);
-  disc_width:=disc_width+char_width(f)(char_info(f)(character(s)));
-  end
-@y
-if is_char_node(s) then
-  begin f:=font(s);
-  if is_wchar_node(s) then
-    disc_width:=disc_width+cfont_width[f]
-  else
-    disc_width:=disc_width+char_width(f)(char_info(f)(character(s)));
-  end
-@z
-
-@x
-  ligature_node: begin f:=font(lig_char(s));
-    disc_width:=disc_width+
-      char_width(f)(char_info(f)(character(lig_char(s))));
-    end;
-@y
-  ligature_node: begin f:=font(lig_char(s));
-    if is_wchar(character(lig_char(s))) then
-      disc_width:=disc_width+cfont_width[f]
-    else
-      disc_width:=disc_width+
-        char_width(f)(char_info(f)(character(lig_char(s))));
-    end;
-@z
-
-@x
-if is_char_node(s) then
-  begin f:=font(s);
-  act_width:=act_width+char_width(f)(char_info(f)(character(s)));
-  end
-@y
-if is_char_node(s) then
-  begin f:=font(s);
-  if is_wchar_node(s) then
-    act_width:=act_width+cfont_width[f]
-  else
-    act_width:=act_width+char_width(f)(char_info(f)(character(s)));
-  end
-@z
-
-@x
-  ligature_node: begin f:=font(lig_char(s));
-    act_width:=act_width+
-      char_width(f)(char_info(f)(character(lig_char(s))));
-    end;
-@y
-  ligature_node: begin f:=font(lig_char(s));
-    if is_wchar(character(lig_char(s))) then
-      act_width:=act_width+cfont_width[f]
-    else
-      act_width:=act_width+
-        char_width(f)(char_info(f)(character(lig_char(s))));
-    end;
-@z
-
-@x
-  char_num: begin scan_char_num; cur_chr:=cur_val; cur_cmd:=char_given;
-    goto reswitch;
-    end;
-  spacer,right_brace: begin if n>1 then @<Enter a hyphenation exception@>;
-@y
-  char_num: begin scan_char_num; cur_chr:=cur_val; cur_cmd:=char_given;
-    goto reswitch;
-    end;
-  pux_char_given:@<Give improper hyphenation error for Chinese characters inside@>;
-  pux_char_num: begin scan_wchar_num; cur_chr:=cur_val; cur_cmd:=pux_char_given;
-    goto reswitch;
-    end;
-  spacer,right_brace: begin if n>1 then @<Enter a hyphenation exception@>;
-@z
-
-@x
-if cur_chr="-" then @<Append the value |n| to list |p|@>
-else  begin if lc_code(cur_chr)=0 then
-    begin print_err("Not a letter");
-@.Not a letter@>
-    help2("Letters in \hyphenation words must have \lccode>0.")@/
-      ("Proceed; I'll ignore the character I just read.");
-    error;
-    end
-  else if n<63 then
-    begin incr(n); hc[n]:=lc_code(cur_chr);
-    end;
-  end
-@y
-if cur_chr="-" then @<Append the value |n| to list |p|@>
-else  begin if is_wchar(cur_chr) then
-    begin print_err("Chinese character can't appear here");
-@.Not a letter@>
-    help2("Letters in \hyphenation words can't be Chinese characters.")@/
-      ("Proceed; I'll ignore the character I just read.");
-    error;
-    end
-  else if lc_code(cur_chr)=0 then
-    begin print_err("Not a letter");
-@.Not a letter@>
-    help2("Letters in \hyphenation words must have \lccode>0.")@/
-      ("Proceed; I'll ignore the character I just read.");
-    error;
-    end
-  else if n<63 then
-    begin incr(n); hc[n]:=lc_code(cur_chr);
-    end;
-  end
-@z
-
-@x
-@d main_loop=70 {go here to typeset a string of consecutive characters}
-@y
-@d main_loop=70 {go here to typeset a string of consecutive characters}
-@d main_loop_wchar=130 {go here to typeset a string of consecutive double-byte characters}
-@d save_cur_wchar=132 {go here to typeset a double-byte characters}
-@d next_is_a_char=133 {go here if next token is a single-byte character}
-@d fetch_next_tok=134 {go here to fetch next token}
-@z
-
-@x
-@t\4@>@<Declare the procedure called |handle_right_brace|@>@;
-procedure main_control; {governs \TeX's activities}
-@y
-@t\4@>@<Declare the procedure called |handle_right_brace|@>@;
-procedure main_control; {governs \TeX's activities}
-@z
-
-@x
-label big_switch,reswitch,main_loop,main_loop_wrapup,
-@y
-label big_switch,reswitch,main_loop_wchar,main_loop_wchar+1,save_cur_wchar,
-      next_is_a_char,fetch_next_tok,main_loop,main_loop+1,
-      main_loop_wrapup,main_loop_lookahead+2,
-@z
-
-@x
-var@!t:integer; {general-purpose temporary variable}
-begin if every_job<>null then begin_token_list(every_job,every_job_text);
-big_switch: get_x_token;@/
-@y
-var@!t:integer; {general-purpose temporary variable}
-begin if every_job<>null then begin_token_list(every_job,every_job_text);
-@<Initialization of global variables done in the |main_control| procedure@>@;
-big_switch: get_x_token;@/
-@z
-
-@x
-hmode+letter,hmode+other_char,hmode+char_given: goto main_loop;
-@y
-hmode+letter,hmode+other_char,hmode+char_given:
-  if is_wchar(cur_chr) then goto main_loop_wchar
-  else goto main_loop;
-hmode+pux_char_given: goto main_loop_wchar;
-@z
-
-@x
-hmode+char_num: begin scan_char_num; cur_chr:=cur_val; goto main_loop;@+end;
-hmode+no_boundary: begin get_x_token;
-  if (cur_cmd=letter)or(cur_cmd=other_char)or(cur_cmd=char_given)or
-   (cur_cmd=char_num) then cancel_boundary:=true;
-  goto reswitch;
-  end;
-@y
-hmode+char_num: begin scan_char_num; cur_chr:=cur_val; goto main_loop;@+end;
-hmode+pux_char_num: begin scan_wchar_num; cur_chr:=cur_val; goto main_loop_wchar;@+end;
-hmode+no_boundary: begin get_x_token;
-  if (cur_cmd=letter)or(cur_cmd=other_char)or(cur_cmd=char_given)or
-   (cur_cmd=char_num)or(cur_cmd=pux_char_num)or(cur_cmd=pux_char_given) then cancel_boundary:=true;
-  goto reswitch;
-  end;
-@z
-
-@x
-hmode+spacer: if space_factor=1000 then goto append_normal_space
-  else app_space;
-hmode+ex_space,mmode+ex_space: goto append_normal_space;
-@y
-@t\4@>@<Cases of |main_control| that handle spacer@>@;
-@z
-
-@x
-main_loop:@<Append character |cur_chr| and the following characters (if~any)
-@y
-main_loop_wchar:@<Append double-byte character |cur_chr| and the following double-byte characters
-  (if~any) to the current hlist in the current font; |goto main_loop| when a single-byte character
-  has been fetched; |goto reswitch| when a non-character has been fetched@>;
-main_loop:@<Append character |cur_chr| and the following characters (if~any)
-@z
-
-@x
-@d adjust_space_factor==@t@>@;@/
-  main_s:=sf_code(cur_chr);
-@y
-@d adjust_space_factor==@t@>@;@/
-  if (cur_chr < 256) then main_s:=sf_code(cur_chr)
-  else main_s:=1000;
-@z
-
-@x
-adjust_space_factor;@/
-main_f:=cur_font;
-@y
-main_cf:=cur_cfont; {in case the first letter is not a Chinese character}
-@<If the preceding node is wchar node, then append a cespace@>;
-main_loop+1:adjust_space_factor; main_f:=cur_font;
-@z
-
-@x
-get_next; {set only |cur_cmd| and |cur_chr|, for speed}
-if cur_cmd=letter then goto main_loop_lookahead+1;
-if cur_cmd=other_char then goto main_loop_lookahead+1;
-if cur_cmd=char_given then goto main_loop_lookahead+1;
-x_token; {now expand and set |cur_cmd|, |cur_chr|, |cur_tok|}
-if cur_cmd=letter then goto main_loop_lookahead+1;
-if cur_cmd=other_char then goto main_loop_lookahead+1;
-if cur_cmd=char_given then goto main_loop_lookahead+1;
-if cur_cmd=char_num then
-  begin scan_char_num; cur_chr:=cur_val; goto main_loop_lookahead+1;
-  end;
-if cur_cmd=no_boundary then bchar:=non_char;
-cur_r:=bchar; lig_stack:=null; goto main_lig_loop;
-main_loop_lookahead+1: adjust_space_factor;
-fast_get_avail(lig_stack); font(lig_stack):=main_f;
-cur_r:=qi(cur_chr); character(lig_stack):=cur_r;
-if cur_r=false_bchar then cur_r:=non_char {this prevents spurious ligatures}
-@y
-@<Look ahead for next character. If it is a wide character then append
-  a cespace, or leave |lig_stack| empty if there's no character there@>
-@z
-
-@x
-else temp_ptr:=new_param_glue(space_skip_code);
-link(tail):=temp_ptr; tail:=temp_ptr;
-goto big_switch
-@y
-else temp_ptr:=new_param_glue(space_skip_code);
-link(tail):=temp_ptr; tail:=temp_ptr;
-if pux_xspace=0 then goto reswitch else goto big_switch
-@z
-
-@x
-hbox_group: package(0);
-adjusted_hbox_group: begin adjust_tail:=adjust_head; package(0);
-  end;
-@y
-hbox_group: @<Setup |hbox_tail| and package@>;
-adjusted_hbox_group: begin adjust_tail:=adjust_head;
-  @<Setup |hbox_tail| and package@>;
-  end;
-@z
-
-@x
-vmode+start_par: new_graf(cur_chr>0);
-vmode+letter,vmode+other_char,vmode+char_num,vmode+char_given,
-   vmode+math_shift,vmode+un_hbox,vmode+vrule,
-@y
-vmode+start_par: new_graf(cur_chr>0);
-vmode+letter,vmode+other_char,vmode+char_num,vmode+char_given,
-   vmode+pux_char_num,vmode+pux_char_given,
-   vmode+math_shift,vmode+un_hbox,vmode+vrule,
-@z
-
-@x
-begin if tail<>head then
-  begin if is_char_node(tail) then p:=tail
-@y
-begin if tail<>head then
-  begin if is_char_node(tail) and not is_wchar_node(tail) then p:=tail
-@z
-
-@x
-reswitch: if is_char_node(p) then
-  begin f:=font(p); d:=char_width(f)(char_info(f)(character(p)));
-  goto found;
-  end;
-@y
-reswitch: if is_char_node(p) then
-  begin f:=font(p);
-  if is_wchar_node(p) then
-    d:=cfont_width[f]
-  else
-    d:=char_width(f)(char_info(f)(character(p)));
-  goto found;
-  end;
-@z
-
-@x
-letter,other_char,char_given: begin c:=ho(math_code(cur_chr));
-    if c=@'100000 then
-      begin @<Treat |cur_chr| as an active character@>;
-      goto restart;
-      end;
-    end;
-@y
-letter,other_char,char_given: begin
-  if is_wchar(cur_chr) then begin
-    print_err("Chinese character is ignored in math mode");
-    help1("Did you forget putting it into an \hbox?");
-    error;
-    goto restart;
-    end
-  else begin
-    c:=ho(math_code(cur_chr));
-    if c=@'100000 then
-      begin @<Treat |cur_chr| as an active character@>;
-      goto restart;
-      end;
-    end;
-  end;
-@z
-
-@x
-char_num: begin scan_char_num; cur_chr:=cur_val; cur_cmd:=char_given;
-  goto reswitch;
-  end;
-@y
-char_num: begin scan_char_num; cur_chr:=cur_val; cur_cmd:=char_given;
-  goto reswitch;
-  end;
-pux_char_num: begin scan_wchar_num; cur_chr:=cur_val; cur_cmd:=pux_char_given;
-  goto reswitch;
-  end;
-pux_char_given:begin print_err("Chinese character is ignored in math mode");
-  help1("Did you forget putting it into an \hbox?");
-  error;
-  goto restart;
-  end;
-@z
-
-@x
-mmode+letter,mmode+other_char,mmode+char_given:
-  set_math_char(ho(math_code(cur_chr)));
-@y
-mmode+letter,mmode+other_char,mmode+char_given:
-  if is_wchar(cur_chr) then begin
-    print_err("Chinese character is ignored in math mode");
-    help1("Did you forget putting it into an \hbox?");
-    error;
-    end
-  else
-    set_math_char(ho(math_code(cur_chr)));
-@z
-
-@x
-  letter,other_char: cur_val:=del_code(cur_chr);
-@y
-  letter,other_char:
-    if is_wchar(cur_chr) then
-      cur_val:=-1
-    else
-      cur_val:=del_code(cur_chr);
-@z
-
-@x
-mmode+math_shift: if cur_group=math_shift_group then after_math
-  else off_save;
-@y
-mmode+math_shift: if cur_group=math_shift_group then begin
-    after_math;
-    if math_mode_save<0 then begin
-      get_x_token;
-      @<If the token is a wide character, then append a cspace@>;
-      goto reswitch;
-      end;
-    end
-  else off_save;
-@z
-
-@x
-tail_append(new_math(math_surround,after));
-space_factor:=1000; unsave;
-end
-@y
-math_mode_save:=m;
-tail_append(new_math(math_surround,after));
-space_factor:=1000; unsave;
-end
-@z
-
-@x
-any_mode(set_font),
-any_mode(def_font),
-@y
-any_mode(set_font),
-any_mode(def_font),
-any_mode(set_cfont),
-any_mode(pux_cface_def),
-any_mode(pux_face_match),
-any_mode(pux_font_match),
-any_mode(pux_set_cface),
-any_mode(puxg_assign_flag),
-any_mode(puxg_assign_int),
-any_mode(pux_get_int),
-any_mode(pux_set_cface_attrib),
-any_mode(pux_set_cfont_attrib),
-any_mode(pux_range_catcode),
-any_mode(pux_range_type_code),
-any_mode(pux_split_number),
-any_mode(puxg_assign_space),
-any_mode(pux_set_default_cface),
-any_mode(pux_dump_font_info),
-@z
-
-@x
-@t\4@>@<Declare subprocedures for |prefixed_command|@>@t@>@;@/
-procedure prefixed_command;
-@y
-@t\4@>@<Declare PUTeX subprocedures for |prefixed_command|@>@t@>@;@/
-@t\4@>@<Declare subprocedures for |prefixed_command|@>@t@>@;@/
-procedure prefixed_command;
-@z
-
-@x
-@!n:integer; {ditto}
-@!e:boolean; {should a definition be expanded? or was \.{\\let} not done?}
-@y
-@!n:integer; {ditto}
-@!e:boolean; {should a definition be expanded? or was \.{\\let} not done?}
-@<Other variables used by the procedure |prefixed_command|@>@;
-@z
-
-@x
-set_font: define(cur_font_loc,data,cur_chr);
-@y
-set_font: begin define(cur_font_loc,data,cur_chr);@/
-  @<Set the matching CJK font@>;
-  end;
-@z
-
-@x
-@d toks_def_code=6 {|shorthand_def| for \.{\\toksdef}}
-@y
-@d toks_def_code=6 {|shorthand_def| for \.{\\toksdef}}
-@d pux_char_def_code=7 {|shorthand_def| for \.{\\PUXchardef}}
-@z
-
-@x
-primitive("toksdef",shorthand_def,toks_def_code);@/
-@!@:toks_def_}{\.{\\toksdef} primitive@>
-@y
-primitive("toksdef",shorthand_def,toks_def_code);@/
-@!@:toks_def_}{\.{\\toksdef} primitive@>
-primitive("PUXchardef",shorthand_def,pux_char_def_code);@/
-@!@:pux_char_def_}{\.{\\toksdef} primitive@>
-@z
-
-@x
-  mu_skip_def_code: print_esc("muskipdef");
-  char_sub_def_code: print_esc("charsubdef");
-  othercases print_esc("toksdef")
-@y
-  mu_skip_def_code: print_esc("muskipdef");
-  char_sub_def_code: print_esc("charsubdef");
-  toks_def_code: print_esc("toksdef");
-  othercases print_esc("PUXchardef")
-@z
-
-@x
-  case n of
-  char_def_code: begin scan_char_num; define(p,char_given,cur_val);
-    end;
-  math_char_def_code: begin scan_fifteen_bit_int; define(p,math_given,cur_val);
-    end;
-  othercases begin scan_eight_bit_int;
-@y
-  case n of
-  char_def_code: begin scan_char_num; define(p,char_given,cur_val);
-    end;
-  math_char_def_code: begin scan_fifteen_bit_int; define(p,math_given,cur_val);
-    end;
-  pux_char_def_code: begin scan_wchar_num; define(p,pux_char_given,cur_val);
-    end;
-  othercases begin scan_eight_bit_int;
-@z
-
-@x
-primitive("catcode",def_code,cat_code_base);
-@!@:cat_code_}{\.{\\catcode} primitive@>
-@y
-primitive("catcode",def_code,cat_code_base);
-@!@:cat_code_}{\.{\\catcode} primitive@>
-primitive("PUXcatcode",def_code,pux_cat_code_base);
-@!@:pux_cat_code_}{\.{\\PUXcatcode} primitive@>
-primitive("PUXtypecode",def_code,pux_type_code_base);
-@!@:pux_type_code_base_}{\.{\\PUXtypecode} primitive@>
-primitive("PUXlocalnames",def_code,pux_local_names_base);
-@!@:pux_local_names_base_}{\.{\\PUXlocalnames} primitive@>
-@z
-
-@x
-  else if chr_code=math_code_base then print_esc("mathcode")
-@y
-  else if chr_code=pux_cat_code_base then print_esc("PUXcatcode")
-  else if chr_code=pux_type_code_base then print_esc("PUXtypecode")
-  else if chr_code=pux_local_names_base then print_esc("PUXlocalnames")
-  else if chr_code=math_code_base then print_esc("mathcode")
-@z
-
-@x
-  p:=cur_chr; scan_char_num; p:=p+cur_val; scan_optional_equals;
-  scan_int;
-@y
-  p:=cur_chr;
-  if p = pux_cat_code_base then
-       begin scan_wchar_num; p := cat_code_base;
-       end
-  else if p = pux_type_code_base then scan_wchar_num
-  else if p = pux_local_names_base then scan_eight_bit_int
-  else
-       scan_char_num;
-  p:=p+cur_val; scan_optional_equals;
-  if p=pux_local_names_base then scan_wchar_num
-  else scan_int;
-@z
-
-@x
-else if cur_chr=math_code_base then n:=@'100000
-@y
-else if cur_chr=pux_cat_code_base then n:=max_char_code
-else if cur_chr=pux_type_code_base then n:=max_type_code
-else if cur_chr=pux_local_names_base then n:=65535
-else if cur_chr=math_code_base then n:=@'100000
-@z
-
-@x
-set_box: begin scan_eight_bit_int;
-  if global then n:=256+cur_val@+else n:=cur_val;
-  scan_optional_equals;
-  if set_box_allowed then scan_box(box_flag+n)
-  else begin print_err("Improper "); print_esc("setbox");
-@y
-set_box: begin scan_eight_bit_int;
-  if global then n:=256+cur_val@+else n:=cur_val;
-  scan_optional_equals;
-  if set_box_allowed then begin
-    in_set_box:=true;
-    scan_box(box_flag+n);
-    in_set_box:=false;
-    end
-  else begin print_err("Improper "); print_esc("setbox");
-@z
-
-@x
-procedure new_font(@!a:small_number);
-label common_ending;
-var u:pointer; {user's font identifier}
-@!s:scaled; {stated ``at'' size, or negative of scaled magnification}
-@!f:internal_font_number; {runs through existing fonts}
-@!t:str_number; {name for the frozen font identifier}
-@!old_setting:0..max_selector; {holds |selector| setting}
-begin if job_name=0 then open_log_file;
-  {avoid confusing \.{texput} with the font name}
-@.texput@>
-get_r_token; u:=cur_cs;
-if u>=hash_base then t:=text(u)
-else if u>=single_base then
-  if u=null_cs then t:="FONT"@+else t:=u-single_base
-else  begin old_setting:=selector; selector:=new_string;
-  print("FONT"); print(u-active_base); selector:=old_setting;
-@.FONTx@>
-  str_room(1); t:=make_string;
-  end;
-define(u,set_font,null_font); scan_optional_equals; scan_file_name;
-@<Scan the font size specification@>;
-@<If this font has already been loaded, set |f| to the internal
-  font number and |goto common_ending|@>;
-f:=read_font_info(u,cur_name,cur_area,s);
-common_ending: equiv(u):=f; eqtb[font_id_base+f]:=eqtb[u]; font_id_text(f):=t;
-end;
-@y
-@<Declare the function called |fw_times_sd|@>@;
-@<Declare the function called |find_cface_num|@>@;
-@<Declare the procedure called |check_cfont|@>@;
-@<Declare the procedure called |make_cfont|@>@;
-procedure new_font(@!a:small_number);
-label common_ending;
-var u:pointer; {user's font identifier}
-@!j,k:pool_pointer;
-@!s:scaled; {stated ``at'' size, or negative of scaled magnification}
-@!f:internal_font_number; {runs through existing fonts}
-@!t:str_number; {name for the frozen font identifier}
-@!old_setting:0..max_selector; {holds |selector| setting}
-@!flushable_string:str_number; {string not yet referenced}
-@<Other local variables used by procedure |new_font|@>@;
-begin if job_name=0 then open_log_file;
-  {avoid confusing \.{texput} with the font name}
-@.texput@>
-get_r_token; u:=cur_cs;
-if u>=hash_base then t:=text(u)
-else if u>=single_base then
-  if u=null_cs then t:="FONT"@+else t:=u-single_base
-else  begin old_setting:=selector; selector:=new_string;
-  print("FONT"); print(u-active_base); selector:=old_setting;
-@.FONTx@>
-  str_room(1); t:=make_string;
-  end;
-scan_optional_equals; scan_file_name;@/
-@<Scan the font size specification@>;
-if (length(cur_name) > 5) then
-  begin
-  j:=str_start[cur_name];
-  if (str_pool[j]='C' and str_pool[j+1]='F' and str_pool[j+2]='O'
-      and str_pool[j+3]='N' and str_pool[j+4]='T') then
-    @<Define a CJK font and then goto |common_ending|@>;
-  end;
-define(u,set_font,null_font);
-@<If this font has already been loaded, set |f| to the internal
-  font number and |goto common_ending|@>;
-f:=read_font_info(u,cur_name,cur_area,s);
-common_ending: equiv(u):=f; eqtb[font_id_base+f]:=eqtb[u]; font_id_text(f):=t;
-end;
-@z
-
-@x
-@!t:halfword; {token}
-@!c:eight_bits; {character code}
-begin b:=cur_chr; p:=scan_toks(false,false); p:=link(def_ref);
-@y
-@!t:halfword; {token}
-@!c:quarterword; {character code}
-begin b:=cur_chr; p:=scan_toks(false,false); p:=link(def_ref);
-@z
-
-@x
-@<Change the case of the token in |p|, if a change is appropriate@>=
-t:=info(p);
-if t<cs_token_flag+single_base then
-  begin c:=t mod 256;
-  if equiv(b+c)<>0 then info(p):=t-c+equiv(b+c);
-  end
-@y
-@<Change the case of the token in |p|, if a change is appropriate@>=
-t:=info(p);
-if t<cs_token_flag+single_base then
-  begin c:=t mod 65536;
-  if c < 256 then {only convert the single-byte char}
-    if equiv(b+c)<>0 then info(p):=t-c+equiv(b+c);
-  end
-@z
-
-@x
-@<Dump the font information@>;
-@y
-@<Dump the font information@>;
-@<Dump the CJK font face information@>;
-@<Dump the face matching table@>;
-@<Dump the CJK font information@>;
-@z
-
-@x
-@<Undump the font information@>;
-@y
-@<Undump the font information@>;
-@<Undump the CJK font face information@>;
-@<Unump the face matching table@>;
-@<Undump the CJK font information@>;
-@z
-
-@x
-15: begin font_in_short_display:=null_font; short_display(n);
-@y
-15: begin font_in_short_display:=null_font; cfont_in_short_display:=null_cfont; short_display(n);
-@z
-
-@x
-@* \[55] Index.
-@y
-@* \[55] Introduction to \PUTeX.
-\PUTeX is an extension of \TeX to handle CJK character sets.
-
-@ @<Glob...@>=
-@!hi_byte, @!lo_byte : ASCII_code;
-{temp var for storing high byte and low byte of a double-byte character}
-@!db_char : quarterword; {temp var for storing a double-byte character}
-@!expand_char : boolean;
-@!doc_charset : eight_bits;
-@!char_val_flag : boolean;
-
-@ @<Set initial...@>=
-expand_char:=false;
-
-@ The default catcode for CJK characters is `letter'.
-
-@<Initialize table entries...@>=
-for k:= 256 to 65535 do
-  begin cat_code(k) := letter;
-  end;
-
-@ Initially, \PUTeX\ just set type codes for OT1 encoding.
-
-@d set_tail_forbidden(#) == set_type_code(#)(tail_forbidden)
-@d set_head_forbidden(#) == set_type_code(#)(head_forbidden)
-
-@<Initialize table entries...@>=
-set_tail_forbidden("(");
-set_tail_forbidden("[");
-set_tail_forbidden("{");@/
-set_head_forbidden("!");
-set_head_forbidden(")");
-set_head_forbidden(",");@/
-set_head_forbidden(".");
-set_head_forbidden(":");
-set_head_forbidden(";");@/
-set_head_forbidden("?");
-set_head_forbidden("]");
-set_head_forbidden("}");
-
-@ @<PUTeX routines...@>=
-function get_cat_code (ch:halfword) : halfword;
-var cat: halfword; {catcode}
-begin
-  if pux_wcharother <> 0 then
-    if ch > 255 then cat := other_char
-    else cat := cat_code(ch)
-  else cat := cat_code(ch);
-  get_cat_code := cat;
-end;
-
-@ @<Put each of \TeX's primitives into the hash table@>=
-primitive("PUXrangecatcode",pux_range_catcode,0);
-primitive("PUXrangetypecode",pux_range_type_code,0);
-
-@ @<Other variables used by the procedure |prefixed_command|@>=
-@!bc, ec: halfword; {the begin char and end char of code range}
-
-@ @<Assignments@>=
-pux_range_catcode, pux_range_type_code: begin
-    p:=cur_chr;
-    if cur_cmd = pux_range_catcode then begin
-      n:=max_char_code;
-      p:=cat_code_base;
-    end
-    else begin
-      n:=max_type_code;
-      p:=pux_type_code_base;
-    end;
-    scan_wchar_num; bc := cur_val;@/
-    scan_keyword("to");@/
-    scan_wchar_num; ec := cur_val;@/
-    scan_optional_equals;@/
-    scan_int;@/
-    
-    if (bc = 0) or (ec = 0) or (ec < bc) then begin
-      if ec < bc then begin
-        print_err("Invalid range setting, ec < bc");
-      end;
-      help1("I'm going to ignore this command.");@/
-      error;
-      goto exit; @.Invalid range@>
-    end;
-    
-    if (cur_val < 0) or (cur_val > n) then begin
-      print_err("Invalid catcode ("); print_int(cur_val);
-      print("), should be in the range 0..15");@/
-      help1("I'm going to ignore this command.");@/
-      error;
-      goto exit; @.Invalid code@>
-    end;
-
-    for k := bc to ec do define(p+k,data,cur_val);
-  end;
-
-@ @<Initialize table entries...@>=
-for k:=0 to 255 do local_names(k) := "?";
-
-@ @<PUTeX basic scanning routines@>=
-function scan_name: str_number;
-  begin
-  @<Get the next non-blank non-call token@>;
-  while cur_cmd=letter do
-    begin
-    if (is_wchar(cur_chr)) then append_wchar(cur_chr) else append_char(cur_chr);
-    get_x_token;
-    end;
-  if pool_ptr <> str_start[str_ptr] then
-    scan_name:=make_string
-  else
-    scan_name:=0;
-  end;
-
-@ @<Declare procedures that scan restricted classes of integers@>=
-procedure scan_wchar_num;
-begin scan_int;
-if (cur_val<257)or(cur_val>65535) then
-  begin print_err("Bad wide character code");
-@.Bad wide character code@>
-  help2("A wide character number must be between 256 and 65536.")@/
-    ("I changed this one to zero."); int_error(cur_val); cur_val:=0;
-  end;
-end;
-
-@* \[56] CJK Numbers.
-
-@<Global variables@>=
-@!cnum_one_flag:boolean;
-
-@
-@d ten_wchar_offset=10
-@d hundred_wchar_offset=11
-@d thousand_wchar_offset=12
-@d ten_thousand_wchar_offset=13
-@d hundred_million_wchar_offset=14
-@d arabic_wchar_offset=40
-@d negative_wchar_offset=50
-@d negative_wsym_offset=51
-@d twenty_wchar_offset=52
-@d thirty_wchar_offset=53
-@d CJK_digit_offset=0
-@d C_simple_digit_offset=10
-@d C_formal_digit_offset=25
-@d C_arabic_digit_offset=40
-
-@ 
-@<Basic print...@>=
-procedure print_chinese_int (@!n,@!digit_base:integer;@!simple,@!formal:boolean);
-var @!m:integer;
-begin
-  cnum_one_flag:=false;
-  if n < 0 then begin
-    {|print_dbchar| is replaced by the following 2 |print_char| calls. }
-    print_wchar(local_names(negative_wchar_offset));
-    negate(n);
-    end;
-  if n<100 then print_small_chinese_int(n,digit_base,simple,formal)
-  else begin
-    if n>99999999 then begin
-      print_small_chinese_int(n div 100000000,digit_base,simple,formal);
-      print_wchar(local_names(digit_base+hundred_million_wchar_offset));
-      cnum_one_flag:=true;
-      n:=n mod 100000000;
-      if n>0 and n<10000000 then
-        print_wchar(local_names(digit_base)); {zero character in Chinese}
-      end;
-    if n>9999 then begin
-      print_medium_chinese_int(n div 10000,digit_base,simple,formal);
-      print_wchar(local_names(digit_base+ten_thousand_wchar_offset));
-      cnum_one_flag:=true;
-      n:=n mod 10000;
-      if n>0 and n<1000 then
-        print_wchar(local_names(digit_base)); {zero character in Chinese}
-      end;
-    print_medium_chinese_int(n,digit_base,simple,formal);
-  end;
-end;
-
-@ The following procedure prints a number n, $0\le n \le 99$.
-@<Basic print...@>=
-procedure print_small_chinese_int (n,@!digit_base:integer;@!simple,@!formal:boolean);
-label done1;
-begin@/
-  if n<10 then print_wchar(local_names(n+digit_base))
-  else begin
-    if n<20 then begin
-      if formal or cnum_one_flag then
-        print_wchar(local_names(digit_base+1));
-      print_wchar(local_names(digit_base+10));@/
-      goto done1;
-      end;
-    if n<30 and simple then begin
-      print_wchar(local_names(twenty_wchar_offset));@/
-      goto done1;
-      end;
-    if n<40 and simple then begin
-      print_wchar(local_names(thirty_wchar_offset));@/
-      goto done1;
-      end;
-    print_wchar(local_names(digit_base + n div 10));
-    print_wchar(local_names(digit_base+10));
-done1: n:=n mod 10;
-    if n>0 then print_wchar(local_names(n+digit_base));
-    end
-end;
-
-@ Print a chinese number of medium size.
-@<Basic print...@>=
-procedure print_medium_chinese_int (n,@!digit_base:integer;@!simple,@!formal:boolean);
-begin
-  if n>999 then begin
-    print_wchar(local_names(digit_base+n div 1000));
-    print_wchar(local_names(digit_base+thousand_wchar_offset));
-    n:=n mod 1000;
-    if n>0 and n<99 then
-        print_wchar(local_names(digit_base)); {zero character in Chinese}
-    end;
-  if n>99 then begin
-    print_wchar(local_names(digit_base+n div 100));
-    print_wchar(local_names(digit_base+hundred_wchar_offset));
-    n:=n mod 100;
-    if n>0 and n<9 then
-        print_wchar(local_names(digit_base)); {zero character in Chinese}
-    end;
-  cnum_one_flag:=true;
-  if n>0 then print_small_chinese_int(n,digit_base,simple,formal);
-end;
-
-@ @<Put each of \TeX's primitives into the hash table@>=
-primitive("puxnumdigits",pux_get_int,int_base+pux_digit_num_code);
-primitive("puxsign",pux_get_int,int_base+pux_sign_code);
-primitive("puxdigit",pux_get_int,int_base+pux_digit_base);
-
-@ @<Cases of |print_cmd_chr|...@>=
-pux_get_int:
-  if chr_code=pux_digit_num_code+int_base then
-    print_esc("puxnumdigits")
-  else if chr_code=pux_sign_code+int_base then
-    print_esc("puxsign")
-  else if chr_code=pux_digit_base+int_base then
-    print_esc("puxdigit");
-
-@ @<Assignments@>=
-pux_get_int: begin
-  print_err("You can't assign values to internal read-only parameters.");
-  error;
-end;
-
-@ @<scan \PUTeX\ internal values@>=
-begin
-  if m=pux_digit_base+int_base then begin
-    scan_int;
-    if cur_val < 0 or cur_val > 9 then begin
-      print_err("Improper digit place specified (");
-      print_int(cur_val); print("), replaced by 0");
-      cur_val:=0;
-    end;
-    m:=m+cur_val;
-  end;
-  scanned_result(eqtb[m].int)(int_val);
-end
-
-@ @<Put each of \TeX's primitives into the hash table@>=
-primitive("PUXsplitnumber",pux_split_number,0);
-
-@ @<Assignments@>=
-pux_split_number: begin
-  scan_int;
-  split_number(cur_val);
-end;
-
-@ The following procedure splits the integer parameter |n| to digit list and stores the number of digits into
-|pux_digit_num|, the sign (1: positive or -1: negative) into |pux_num_sign|, and the digits into
-the array |pux_nth_digit|. Since the largest |n| is $2^{31}$, n contains at most 10 digits.
-
-@<PUTeX routines...@>=
-procedure split_number (n:integer);
-var k: 0..10;
-begin
-if n<0 then begin
-  pux_num_sign := -1;
-  negate(n)
-  end
-else
-  pux_num_sign := 1;
-k:=0;
-repeat pux_nth_digit(k):=n mod 10; n:=n div 10; incr(k);
-until n=0;
-pux_digit_num:=k;
-while k < 10 do begin
-  pux_nth_digit(k) := 0;
-  incr(k);
-  end;
-end;
-
-@
-@<scan and split the number@>=
-begin
-  scan_int;
-  split_number(cur_val);
-end
-
-@ @<scan a CJK number with a possible selector and then  split it@>=
-begin
-  scan_int; saved_val:=cur_val;
-  split_number(cur_val);
-  if scan_keyword("offset") then begin
-    scan_eight_bit_int;
-    digit_base:=cur_val;
-    if scan_keyword("sign") then begin
-      scan_eight_bit_int;
-      sign:=cur_val;
-      end
-    else
-      sign:=negative_wchar_offset;
-  end
-  else digit_base:=0;
-end
-
-@ Using full-width arabic characters to show chinese numbers.
-@<Basic print...@>=
-procedure print_cjk_int(@!n:integer;digit_base,sign:integer);
-var k:0..9; {index to current digit}
-begin
-  if pux_num_sign = -1 then print_wchar(local_names(sign));
-  for k:=pux_digit_num-1 downto 0 do
-    print_wchar(local_names(digit_base+pux_nth_digit(k)));
-end;
-
-@ @<using full-width arabic characters to print a CJK number@>=
-print_cjk_int(cur_val,C_arabic_digit_offset,negative_wsym_offset)
-
-@ @<print a CJK number with specified format@>=
-print_cjk_int(saved_val,digit_base,sign)
-
-@ @<scan a CJK name sequence number@>=
-begin
-  scan_eight_bit_int; saved_val:=cur_val;
-  if scan_keyword("min") then begin
-    scan_optional_equals; scan_eight_bit_int;
-    min_val:=cur_val;
-  end
-  else begin
-    print_err("Missing 'min' part ("); print("min 0 inserted)");
-    error;
-  end;
-  if scan_keyword("max") then begin
-    scan_optional_equals; scan_eight_bit_int;
-    max_val:=cur_val;
-  end
-  else begin
-    print_err("Missing 'max' part ("); print("max 255 inserted)");
-    error;
-  end;
-  if scan_keyword("offset") then begin
-    scan_optional_equals; scan_eight_bit_int;
-    offset:=cur_val;
-  end
-  else begin
-    print_err("Missing 'offset' part ("); print("offset 0 inserted)");
-    error;
-  end;
-  if min_val <= saved_val and saved_val <= max_val then
-    cur_val:=offset+saved_val-min_val
-  else begin
-    print_err("Number is out of the range ("); print("replaced with the min value)");
-    cur_val:=offset;
-    error;
-  end;
-end
-
-@ @<print a CJK name sequence member@>=
-print_wchar(local_names(cur_val))
-
-@ A fix\_word is a {\sl scaled integers\/} that are multiples
-of $2^{-20}$. In other words, a binary point is assumed to be twenty bit
-positions from the right end of a binary computer word.
-@d fw_unity == @"100000 {$2^{20}$, represents 1.00000}
-@d fw_two == @"200000 {$2^{21}$, represents 2.00000}
-@d fw_one_fifth==@"33333 {0.2}
-@d convfix(#)== (#)*fw_unity div 1000
-
-@<Types...@>=
-@!fixword = integer; {this type is used for fixword (12.20) integers}
-
-
-@ @<Declare the function called |print_fixword|@>=
-procedure print_fixword(@!s:fixword); {prints fixword real, rounded to five
-  digits}
-var delta:fixword; {amount of allowable inaccuracy}
-begin if s<0 then
-  begin print_char("-"); negate(s); {print the sign, if negative}
-  end;
-print_int(s div fw_unity); {print the integer part}
-print_char(".");
-s:=10*(s mod fw_unity)+5; delta:=10;
-repeat if delta>fw_unity then s:=s+@'200000000-50000; {round the last digit}
-print_char("0"+(s div fw_unity)); s:=10*(s mod fw_unity); delta:=delta*10;
-until s<=delta;
-end;
-
-
-@ The function |fw_times_sd| do the multiplication of a fixword and a scaled number.
-The value of fixword is assumed between 16 and $-16$.
-The function returns the result as a scaled number. (See also Sec. 571, 572 and 600.)
-
-@<Declare the function called |fw_times_sd|@>=
-function fw_times_sd (@!x:fixword; @!z:scaled) : scaled;
-  {compute |f| times |s|}
-var @!sw:scaled;
-@!a,@!b,@!c,@!d:eight_bits; {byte variables}
-@!alpha:integer;@!beta:1..16;
-begin @<Replace |z|...@>;
-if x>=0 then a:=x div @'100000000
-else  begin x:=x+@'10000000000;
-  x:=x+@'10000000000;
-  a:=(x div @'100000000) + 128;
-  end;
-x:=x mod @'100000000; b:=x div @'200000;
-x:=x mod @'200000; c:=x div @'400;
-d:=x mod @'400;
-sw:=(((((d*z)div@'400)+(c*z))div@'400)+(b*z))div beta;
-if a=0 then fw_times_sd:=sw
-else if a=255 then fw_times_sd:=sw-alpha
-else fw_times_sd:=unity;
-end;
-
-@ @<Put each of \TeX's primitives into the hash table@>=
-primitive("PUXchar",pux_char_num,0);
-
-@ @<Cases of |print_cmd_chr|...@>=
-pux_char_num: print_esc("PUXchar");
-
-@ @<Give improper hyphenation error for Chinese characters inside@>=
-begin print_err("Improper "); print_esc("hyphenation");
-@.Improper \\hyphenation...@>
-  print(" will be flushed");
-help2("Hyphenation exceptions can't contain Chinese characters")@/
-  ("But continue; I'll forgive and forget.");
-error;
-end
-
-
-@ @<Cases of |main_control| that build...@>=
-mmode+pux_char_num: begin scan_wchar_num; cur_chr:=cur_val;
-  print_err("Chinese character is ignored in math mode");
-  help1("Did you forget putting it into an \hbox?");
-  error;
-  end;
-mmode+pux_char_given: begin
-  print_err("Chinese character is ignored in math mode");
-  help1("Did you forget putting it into an \hbox?");
-  error;
-  end;
-
-@ @<Cases of |print_cmd_chr|...@>=
-pux_char_given: begin print_esc("PUXchar"); print_hex(chr_code);
-  end;
-
-@* \[58] All about spaces.
-@d is_tail_forbidden(#) == type_code(#) = tail_forbidden
-@d is_head_forbidden(#) == type_code(#) = head_forbidden
-@d is_head_forbidden_wchar(#) == ((# > 255) and (type_code(#) = head_forbidden))
-@d is_punc_wchar(#) == ((# > 255) and (type_code(#) <> 0))
-
-@
-@<Global variables@>=
-@!main_cf:internal_cfont_number; {the current chinese font}
-@!math_mode_save:-mmode..mmode;
-@!prev_main_cf:internal_cfont_number; {the current chinese font}
-@!pre_undet_glue_ptr:pointer; {point to the node just before a undetermined glue}
-@!undet_glue_ptr:pointer; {point to the undetermined glue}
-@!cglue_ptr:pointer;
-@!cglue_spec:pointer;
-@!pre_glue_char_ptr:pointer;
-@!outer_tail:pointer;
-@!hbox_tail:pointer;
-@!in_set_box:boolean;
-
-@ @<Initialization of global variables done in the |main_control| procedure@>=
-pre_undet_glue_ptr:=null;
-pre_glue_char_ptr:=null;
-
-@
-@d tail_append_glue(#)==
-begin cglue_ptr:=get_node(small_node_size); cglue_spec:=#;
-type(cglue_ptr):=glue_node; subtype(cglue_ptr):=normal;
-leader_ptr(cglue_ptr):=null; glue_ptr(cglue_ptr):=cglue_spec;
-incr(glue_ref_count(cglue_spec));
-tail_append(cglue_ptr);
-end
-
-@ Here is the check done before switching to regular character string.
-@<If the preceding node is wchar node, then append a cespace@>=
-if tail=head then begin
-  if mode=-hmode then begin {beginning of a restricted hlist}
-    outer_tail:=nest[nest_ptr-1].tail_field;
-    if pre_undet_glue_ptr<>null then begin
-      if outer_tail=link(pre_undet_glue_ptr) and pre_glue_char_ptr<>null
-             and is_wchar_node(pre_glue_char_ptr) then begin
-        decr(glue_ref_count(glue_ptr(outer_tail)));
-        glue_ptr(outer_tail):=cfont_ceglue_spec[prev_main_cf];
-        incr(glue_ref_count(cfont_ceglue_spec[prev_main_cf]));
-        end;
-      pre_undet_glue_ptr:=null;
-      end;
-    end;
-  end
-else if is_char_node(tail) and is_wchar_node(tail) then begin
-  if is_head_forbidden(cur_chr) then tail_append(new_penalty(inf_penalty));
-  tail_append_glue(cfont_ceglue_spec[main_cf]);
-  end
-else if pre_undet_glue_ptr<>null and link(pre_undet_glue_ptr)=tail and
-     pre_glue_char_ptr<>null and is_wchar_node(pre_glue_char_ptr) then begin
-  decr(glue_ref_count(glue_ptr(tail)));
-  glue_ptr(tail):=cfont_ceglue_spec[prev_main_cf];
-  incr(glue_ref_count(cfont_ceglue_spec[prev_main_cf]));
-  end;
-pre_undet_glue_ptr:=null;
-pre_glue_char_ptr:=null;
-
-
-@ If the next token come after the math shift \$ is a wide character, then
-a cespace is appended first.
-@<If the token is a wide character, then append a cspace@>=
-if cur_cmd=pux_char_num then
-  begin scan_wchar_num; cur_chr:=cur_val; cur_cmd:=pux_char_given;
-  end;
-if cur_cmd=letter or cur_cmd=other_char or cur_cmd=pux_char_given then
-  if is_wchar(cur_chr) then
-    if is_punc_wchar(cur_chr) then begin
-      if is_head_forbidden(cur_chr) then tail_append(new_penalty(inf_penalty));
-      tail_append_glue(zero_glue);
-      end
-    else
-      tail_append_glue(cfont_ceglue_spec[main_cf])
-
-
-@
-@<Append double-byte character |cur_chr|...@>=
-main_cf:=cur_cfont;
-@<If the current wchar is at the beginning of a restricted hlist that
-  is after a undetermined spacer, then we have to determine that space.
-  When it is done |goto save_cur_wchar|@>;
-@<If the previous node is an undetermined glue, then make it certain and
-  |goto save_cur_wchar|@>;
-if not is_char_node(tail) then goto save_cur_wchar;
-main_loop_wchar+1:@<the previous node is a character node, so we have to append
-a glue first@>;
-save_cur_wchar:
-fast_get_avail(lig_stack);
-font(lig_stack):=main_cf;
-character(lig_stack):=cur_chr;
-tail_append(lig_stack);@/
-@<Prepare a nonbreak space if the current wide character is not allowed to
-  appear at the end of line@>;
-fetch_next_tok:get_next; {set only |cur_cmd| and |cur_chr|, for speed}
-@<Check the lookahead character@>;
-x_token; {now expand and set |cur_cmd|, |cur_chr|, |cur_tok|}
-@<Check the lookahead character@>;
-if cur_cmd=char_num then
-  begin scan_char_num; cur_chr:=cur_val; cur_cmd:=char_given; goto next_is_a_char;
-  end;
-if cur_cmd=pux_char_num then
-  begin scan_wchar_num; cur_chr:=cur_val;
-  if is_punc_wchar(cur_chr) then
-    if is_head_forbidden(cur_chr) then tail_append(new_penalty(inf_penalty));
-  tail_append_glue(cfont_glue_spec[main_cf]);
-  goto save_cur_wchar;
-  end;
-{next token is not a character token}
-if cur_cmd=math_shift then
-  if is_punc_wchar(character(lig_stack)) then
-    tail_append_glue(zero_glue)
-  else
-    tail_append_glue(cfont_ceglue_spec[main_cf]);
-goto reswitch;
-next_is_a_char: begin@/
-  if cur_chr<256 then
-    if is_head_forbidden(cur_chr) then tail_append(new_penalty(inf_penalty));
-  if is_punc_wchar(character(lig_stack)) then
-    tail_append_glue(zero_glue)
-  else
-    tail_append_glue(cfont_ceglue_spec[main_cf]);
-  goto main_loop+1;
-  end
-
-
-@ @<If the current wchar is at the beginning...@>=
-if tail=head then begin {beginning of a restricted hlist}
-  if mode=-hmode then begin
-    outer_tail:=nest[nest_ptr-1].tail_field;
-    if pre_undet_glue_ptr<>null then begin
-      if outer_tail=link(pre_undet_glue_ptr) then begin
-        undet_glue_ptr:=outer_tail;
-        @<Modify the undetermined glue according the type of pre-glue character@>;
-        end;
-      pre_undet_glue_ptr:=null;
-      end;
-    end;
-  goto save_cur_wchar;
-  end
-
-
-@ @<Modify the undetermined glue...@>=
-decr(glue_ref_count(glue_ptr(undet_glue_ptr)));
-if pre_glue_char_ptr<>null and is_wchar_node(pre_glue_char_ptr) then begin
-  glue_ptr(undet_glue_ptr):=cfont_glue_spec[prev_main_cf];
-  incr(glue_ref_count(cfont_glue_spec[prev_main_cf]));
-  pre_glue_char_ptr:=null;
-  end
-else begin
-  glue_ptr(undet_glue_ptr):=cfont_ceglue_spec[prev_main_cf];
-  incr(glue_ref_count(cfont_ceglue_spec[prev_main_cf]));
-  end
-
-@ @<If the previous node is an undetermined glue...@>=
-if pre_undet_glue_ptr<>null then begin
-  if link(pre_undet_glue_ptr)=tail then begin
-    undet_glue_ptr:=tail;
-    @<Modify the undetermined glue according the type of pre-glue character@>;
-    pre_undet_glue_ptr:=null;
-    goto save_cur_wchar;
-    end;
-  pre_undet_glue_ptr:=null;
-  end
-
-
-@ @<the previous node is a character node...@>=
-if is_wchar_node(tail) then begin
-  if is_head_forbidden_wchar(cur_chr) then
-    tail_append(new_penalty(inf_penalty));
-  tail_append(new_glue(cfont_glue_spec[main_cf]));
-  end
-else begin {previous node is a single byte character}
-  if is_punc_wchar(cur_chr) then begin
-    if is_head_forbidden(cur_chr) then tail_append(new_penalty(inf_penalty));
-    tail_append_glue(zero_glue);
-    end
-  else begin
-    if is_head_forbidden(character(tail)) then tail_append(new_penalty(inf_penalty));
-    tail_append_glue(cfont_ceglue_spec[main_cf]);
-    end;
-  end
-
-
-
-@ For those Chinese puncuations that shoudn't appear in the line end,
-we append a penalty node to prevent line boken after it.
-@<Prepare a nonbreak space if the current wide...@>=
-if is_punc_wchar(cur_chr) then
-  if is_tail_forbidden(cur_chr) then tail_append(new_penalty(inf_penalty))
-
-@ @<Check the lookahead character@>=
-if cur_cmd=letter or cur_cmd=other_char or cur_cmd=pux_char_given or
-   cur_cmd=char_given then
-  if is_wchar(cur_chr) then begin
-    if is_punc_wchar(cur_chr) then
-      if is_head_forbidden(cur_chr) then tail_append(new_penalty(inf_penalty));
-    tail_append_glue(cfont_glue_spec[main_cf]);
-    goto save_cur_wchar;
-    end
-  else goto next_is_a_char
-
-
-@ @<Look ahead for next character. If it is a wide...@>=
-get_next; {set only |cur_cmd| and |cur_chr|, for speed}
-if cur_cmd=letter or cur_cmd=other_char then
-  if is_wchar(cur_chr) then goto main_loop_lookahead+2
-  else goto main_loop_lookahead+1;
-if cur_cmd=char_given then goto main_loop_lookahead+1;
-if cur_cmd=pux_char_given then goto main_loop_lookahead+2;
-x_token; {now expand and set |cur_cmd|, |cur_chr|, |cur_tok|}
-if cur_cmd=letter or cur_cmd=other_char then
-  if is_wchar(cur_chr) then goto main_loop_lookahead+2
-  else goto main_loop_lookahead+1;
-if cur_cmd=char_given then goto main_loop_lookahead+1;
-if cur_cmd=char_num then
-  begin scan_char_num; cur_chr:=cur_val; goto main_loop_lookahead+1;
-  end;
-if cur_cmd=pux_char_num then
-  begin scan_wchar_num; cur_chr:=cur_val; goto main_loop_lookahead+2;
-  end;
-if cur_cmd=no_boundary then bchar:=non_char;
-main_loop_lookahead+2: cur_r:=bchar; lig_stack:=null; goto main_lig_loop;
-main_loop_lookahead+1: adjust_space_factor;
-fast_get_avail(lig_stack); font(lig_stack):=main_f;
-cur_r:=qi(cur_chr); character(lig_stack):=cur_r;
-if cur_r=false_bchar then cur_r:=non_char {this prevents spurious ligatures}
-
-
-@ @<Cases of |main_control| that handle spacer@>=
-hmode+spacer: @<Lookahead and determine the type of spacer to append@>;
-hmode+ex_space: @<Lookahead and determine the type of |ex_spacer| to append@>;
-mmode+ex_space: begin if pux_xspace=0 then get_x_token; {lookahead}
-                goto append_normal_space;
-                end;
-hmode+pux_space:@<Handle \PUTeX space command@>;
-mmode+pux_space:begin
-  print_err("This space command is ignored in math mode");
-  help1("Did you forget putting it into an \hbox?");
-  error;
-  end;
-
-@ @<Setup |hbox_tail| and package@>=
-if in_set_box then package(0)
-else begin
-  if tail<>head and is_char_node(tail) then
-    hbox_tail:=tail
-  else
-    hbox_tail:=null;
-  package(0);
-  get_x_token;
-  if cur_cmd<>spacer then hbox_tail:=null;
-  back_input;
-  end
-
-@ @<Lookahead and determine the type of spacer to append@>=
-begin
-if pux_xspace=0 then begin
-  if tail<>head and is_char_node(tail) then
-    pre_glue_char_ptr:=tail
-  else
-    pre_glue_char_ptr:=null;
-  get_x_token; {lookahead}
-  if cur_cmd=char_num then
-    begin scan_char_num; cur_chr:=cur_val; cur_cmd:=char_given;
-    end
-  else if cur_cmd=pux_char_num then
-    begin scan_wchar_num; cur_chr:=cur_val; cur_cmd:=pux_char_given;
-    end;
-  if cur_cmd=letter or cur_cmd=other_char or cur_cmd=char_given or
-     cur_cmd=pux_char_given then
-    if is_wchar(cur_chr) then begin
-      main_cf:=cur_cfont;
-      if pre_glue_char_ptr<>null then goto main_loop_wchar+1;
-      if hbox_tail<>null and is_wchar_node(hbox_tail) then begin
-        tail_append_glue(cfont_glue_spec[main_cf]);
-        hbox_tail:=null;
-        end
-      else begin
-        tail_append_glue(cfont_ceglue_spec[main_cf]);
-        if is_punc_wchar(cur_chr) then
-          if is_head_forbidden(cur_chr) then tail_append(new_penalty(inf_penalty));
-        if hbox_tail<>null then hbox_tail:= null;
-        end;
-      goto save_cur_wchar;
-      end
-    else if (pre_glue_char_ptr<>null and is_wchar_node(tail))
-         or (hbox_tail<>null and is_wchar_node(hbox_tail)) then begin
-        tail_append_glue(cfont_ceglue_spec[cur_cfont]);
-        hbox_tail:=null;
-        goto main_loop;
-        end;
-  prev_main_cf:=cur_cfont;
-  pre_undet_glue_ptr:=tail;
-  if pre_glue_char_ptr<>null and is_wchar_node(pre_glue_char_ptr) then begin
-    tail_append_glue(cfont_ceglue_spec[cur_cfont]);
-    goto reswitch;
-    end;
-  end;
-if space_factor=1000 then goto append_normal_space
-else begin app_space;
-  if pux_xspace=0 then goto reswitch else goto big_switch;
-  end;
-end
-
-@ @<Lookahead and determine the type of |ex_spacer| to append@>=
-begin
-if pux_xspace=0 then begin
-  get_x_token; {lookahead}
-  if cur_cmd=char_num then
-    begin scan_char_num; cur_chr:=cur_val; cur_cmd:=char_given;
-    end;
-  if cur_cmd=pux_char_num then
-    begin scan_wchar_num; cur_chr:=cur_val; cur_cmd:=pux_char_given;
-    end;
-  if cur_cmd=letter or cur_cmd=other_char or cur_cmd=char_given or cur_cmd=pux_char_given then
-    if is_wchar(cur_chr) then begin
-      main_cf:=cur_cfont;
-      if tail<>head and is_char_node(tail) then
-        if is_wchar_node(tail) then
-          goto append_normal_space
-        else
-          goto main_loop_wchar+1;
-      tail_append_glue(cfont_glue_spec[main_cf]);
-      goto save_cur_wchar;
-      end
-    else if tail<>head and is_char_node(tail) then
-      if is_wchar_node(tail) then begin
-        tail_append_glue(cfont_ceglue_spec[cur_cfont]);
-        goto main_loop;
-        end;
-  if tail<>head and is_char_node(tail) then
-    if is_wchar_node(tail) then begin
-      tail_append_glue(cfont_glue_spec[cur_cfont]);
-      goto reswitch;
-      end;
-  prev_main_cf:=cur_cfont;
-  pre_undet_glue_ptr:=tail;
-  end;
-goto append_normal_space;
-end
-
-@
-@d pux_space_code=0
-@d pux_exspace_code=1
-@d pux_cspace_code=2
-@d pux_cespace_code=3
-@<Put each of \TeX's primitives into the hash table@>=
-primitive("PUXspace",pux_space,pux_space_code);
-primitive("PUXexspace",pux_space,pux_exspace_code);
-primitive("PUXcspace",pux_space,pux_cspace_code);
-primitive("PUXcespace",pux_space,pux_cespace_code);
-
-@ @<Cases of |print_cmd_chr|...@>=
-pux_space: case chr_code of
-  pux_space_code: print_esc("PUXspace");
-  pux_exspace_code: print_esc("PUXexspace");
-  pux_cspace_code: print_esc("PUXcspace");
-  othercases print_esc("PUXcespace")
-  endcases;
-
-@ @<Handle \PUTeX space command@>=
-case cur_chr of
-  pux_space_code: begin get_x_token;
-    if space_factor=1000 then goto append_normal_space;
-    app_space;
-    if pux_xspace=0 then goto reswitch else goto big_switch;
-    end;
-  pux_exspace_code: begin get_x_token; goto append_normal_space;
-    end;
-  pux_cspace_code: tail_append(new_glue(cfont_glue_spec[cur_cfont]));
-  othercases tail_append(new_glue(cfont_ceglue_spec[cur_cfont]))
-  endcases
-
-@* \[59] CJK font face definition table.
-
-@ @<Put each of \TeX's primitives into the hash table@>=
-primitive("PUXcfacedef",pux_cface_def,0);
-
-@ @<Cases of |print_cmd_chr|...@>=
-pux_cface_def: print_esc("PUXcfacedef"); {TCW}
-
-@ @<Assignments@>=
-pux_cface_def: new_cface(a);
-
-
-@ @<Constants...@>=
-@!cface_base=0; {CJK font face base}
-@!null_cface=0; {null CJK font faces}
-
-@
-@<Types...@>=
-@!internal_cface_number=cface_base..max_cface;
-
-@ The CJK font face definition table is implemented by parallel arrays as follows.
-@d regular=0
-@d italic=@"40 {bit 6: italic flag}
-@d underline=@"20 {bit 5: underline flag}
-@d strikeout=@"10 {bit 4: strikeout flag}
-@d inverse=@"08 {bit 3: inverse flag}
-@d rotated=@"01 {bit 0: rotation flag}
-@d default_cface_weight==400
-@d default_cface_style=regular
-@d default_cface_fw_width==fw_unity
-@d default_cface_fw_height==fw_unity
-@d cface_id_text(#)==text(cface_id_base+#)
-
-@<Global variables@>=
-@!cface_ptr:internal_cface_number;
-  {index of the first unused entry}
-@!cface:array[internal_cface_number] of str_number;
-  {CJK font face identifier}
-@!cface_name:array[internal_cface_number] of str_number;
-  {CJK font face name}
-@!cface_charset:array[internal_cface_number] of eight_bits;
-  {CJK font charset}
-@!cface_weight:array[internal_cface_number] of 1..1000;
-  {CJK font weight}
-@!cface_style:array[internal_cface_number] of eight_bits;
-  {CJK font style}
-@!cface_fw_width:array[internal_cface_number] of fixword;
-  {CJK font width ratio}
-@!cface_fw_height:array[internal_cface_number] of fixword;
-  {CJK font heigh ratio}
-@!cface_fw_depth:array[internal_cface_number] of fixword; 
-  {CJK font depth ratio}
-@!cface_csp_width:array[internal_cface_number] of integer;
-  {CJK font c-space width}
-@!cface_csp_shrink:array[internal_cface_number] of integer;
-  {CJK font c-space shrink}
-@!cface_csp_stretch:array[internal_cface_number] of integer;
-  {CJK font c-space stretch}
-@!cface_cesp_width:array[internal_cface_number] of integer;
-  {CJK font ce-space width}
-@!cface_cesp_shrink:array[internal_cface_number] of integer;
-  {CJK font ce-space shrink}
-@!cface_cesp_stretch:array[internal_cface_number] of integer;
-  {CJK font ce-space stretch}
-@!cface_fw_default_depth:fixword;
-
-
-@ @<Put each of \TeX's primitives into the hash table@>=
-primitive("PUXsetdefaultcface",pux_set_default_cface,int_base+pux_default_cface_code);
-
-@ @<Cases of |print_cmd_chr|...@>=
-pux_set_default_cface: print_esc("PUXsetdefaultcface"); {TCW}
-
-@ @<Assignments@>=
-pux_set_default_cface: begin p:=cur_chr;
-  @<Get the next non-blank non-call token@>;
-  if cur_cmd = pux_set_cface then
-    word_define(p,cur_chr)
-  else begin
-    print_err("Here should put a CJK font face command. ");
-    print("The dafault CJK font face remains unchanged");
-    error;
-  end;
-  end;
-
-
-@ @<PUTeX routines that will be used by TeX routines@>=
-procedure reset_cface_cspace (face_num:integer);
-begin
-  cface_csp_width[face_num]:=g_cspace_width;@/
-  cface_csp_shrink[face_num]:=g_cspace_shrink;@/
-  cface_csp_stretch[face_num]:=g_cspace_stretch;@/
-end;
-
-@ @<PUTeX routines that will be used by TeX routines@>=
-procedure reset_cface_cespace (face_num:integer);
-begin
-  cface_cesp_width[face_num]:=g_cespace_width;@/
-  cface_cesp_shrink[face_num]:=g_cespace_shrink;@/
-  cface_cesp_stretch[face_num]:=g_cespace_stretch;@/
-end;
-
-@ Setup default and null CJK font faces.
-@<Initialize table...@>=
-cur_cface:=null_cface; eq_type(cur_cface_loc):=data;
-eq_level(cur_cface_loc):=level_one;@/
-cface_fw_default_depth:=convfix(puxg_cface_depth);
-cface_ptr:=cface_base+1;
-
-cface[null_cface]:="nullcface";@/
-cface_name[null_cface]:="nullcjkface";@/
-cface_charset[null_cface]:=0;@/
-cface_weight[null_cface]:=400; {normal weight}@/
-cface_style[null_cface]:=0;@/
-cface_fw_width[null_cface]:=0;@/
-cface_fw_height[null_cface]:=0;@/
-cface_fw_depth[null_cface]:=0;@/
-reset_cface_cspace(null_cface);@/
-reset_cface_cespace(null_cface);@/
-
-@ The function |find_cface_num| searches the CJK font face definition table
-for the entry with the same identifier as |id|. The entry index is return if found;
-otherwise, the current value of |cface_ptr| is return.
-
-@d cface_found(#)==((#)<cface_ptr)
-
-@<Declare the function called |find_cface_num|@>=
-function find_cface_num(id:str_number):internal_cface_number;
-  label done;
-  var f:internal_cface_number; {runs through existing faces}
-  begin
-  f:=cface_base;
-  while (f < cface_ptr) do
-    begin
-    if str_eq_str(id, cface[f]) then goto done;
-    incr(f);
-    end;
- done:find_cface_num:=f;
-  end;
-
-@ @<Declare subprocedures for |prefixed_command|@>=
-@<Declare the function called |print_fixword|@>@;
-procedure new_cface(@!a:small_number);
-label done, done1, common_ending;
-var u:pointer; {user's chinese face identifier}
-@!t:str_number; {name for the frozen font identifier}
-@!id:str_number; {CJK font face identifier}
-@!face_name:str_number; {CJK font face name}
-@!charset:integer; {CJK font charset}
-@!weight:integer; {CJK font weight}
-@!style:integer; {CJK font style}
-@!w:integer; {CJK font width ratio}
-@!h:integer; {CJK font height ratio}
-@!d:integer; {CJK font depth ratio}
-@!fix_w:fixword; {CJK font width ratio}
-@!fix_h:fixword; {CJK font height ratio}
-@!fix_d:fixword; {CJK font depth ratio}
-@!f:internal_cface_number; {runs through existing faces}
-@!k:integer;@/
-@<Other variables used by |new_cface|@>@;
-begin if job_name=0 then open_log_file;
-  {avoid confusing \.{texput} with the font name}
-get_r_token; u:=cur_cs;
-if u>=hash_base then t:=text(u)
-else if u>=single_base then
-  if u=null_cs then t:="CFACE"@+else t:=u-single_base
-else  begin old_setting:=selector; selector:=new_string;
-  print("CFACE"); print(u-active_base); selector:=old_setting;
-  str_room(1); t:=make_string;
-  end;
-define(u,pux_set_cface,null_cface);
-scan_optional_equals;
-@<Setup variables before scanning CJK font face parameters@>;
-@<Scan CJK font face identifier@>;
-@<Scan CJK font face name@>;
-@<Scan optional CJK font face definition parameters@>;
-@<If the face name is missing, then ignore this face deinition@>;
-@<If this Chinese face has already been loaded, then |goto common_ending|@>;
-@<Setup this new Chinese face@>;
-common_ending: equiv(u):=f; eqtb[cface_id_base+f]:=eqtb[u]; cface_id_text(f):=t;
-end;
-
-@ @<Setup variables before scanning CJK font face parameters@>=
-charset:=pux_charset; {set to the base charset of document}
-w:=1000; h:=1000; d:=puxg_cface_depth; @/
-weight:=400; {normal weight}@/
-style:=0; {regular style}
-if puxg_rotate_ctext<>0 then style:=style+rotated;
-f:=null_cface
-
-
-@ @<Scan CJK font face identifier@>=
-id:=scan_name;
-if id > 0 then
-  begin
-  f:=find_cface_num(id);
-  if (f < cface_ptr) then
-    begin
-    flush_string; id:=cface[f]; {for saving string pool sapce}
-    f:=null_cface;
-    print_err("The Chinese face id ("); print(id);
-    print(") is already used"); error;
-    end;
-  end
-else
-  begin
-  print_err("Missing CJK font face identifier"); error;
-  end
-
-@ @<Scan CJK font face name@>=
-begin
-face_name:=scan_name;
-if face_name > 0 then
-  begin
-  k:=cface_base;
-  while (k < cface_ptr) do
-    begin
-    if str_eq_str(face_name, cface_name[k]) then
-      begin
-      flush_string;
-      face_name:=cface_name[k]; f:=k;
-      goto done1;
-      end;
-    incr(k);
-    end;
-  end
-else
-  begin
-  print_err("Missing CJK font face name"); error;
-  face_name:=cface_name[null_cface];
-  f:=null_cface;
-  end;
-done1: end
-
-@ @<Other variables used by |new_cface|@>=
-@!i_flag:boolean; {italic flag}
-@!u_flag:boolean; {underline flag}
-@!s_flag:boolean; {strikeout flag}
-@!r_flag:boolean; {rotation flag}
-@!v_flag:boolean; {inverse flag}
-@!more_param:boolean; {have more parameters to come}
-
-@ @<Scan optional CJK font face definition parameters@>=
-i_flag:=false; u_flag:=false; s_flag:=false;@/
-r_flag:=false; v_flag:=false;@/
-more_param:=true;
-while more_param do
-  begin
-  @<Get the next non-blank non-call token@>;
-  if cur_cmd=letter then
-    case cur_chr of
-      'c','C': @<Scan the CJK font charset@>;
-      'w','W': @<Scan the CJK font width@>;
-      'h','H': @<Scan the CJK font height@>;
-      'd','D': @<Scan the CJK font depth@>;
-      't','T': @<Scan the CJK font weight@>;
-      's','S': @<Scan the CJK font style@>;
-      othercases more_param:=false;
-    endcases
-  else more_param:=false;
-  end;
-back_input
-
-
-@
-@<Scan the CJK font charset@>=
-begin scan_optional_equals;@/
-scan_int; 
-if (cur_val<0)or(cur_val>255) then
-  begin print_err("Improper `charset' value (");
-  print_int(charset); print("), replaced by default charset");
-  help2("I can only handle nonnegative charset value up to 255,")@/
-  ("so I've changed what you said to default charset.");
-  error;
-  end
-else
-  charset:=cur_val;
-end
-
-@
-@<Scan the CJK font width@>=
-begin scan_optional_equals;@/
-scan_int; w:=cur_val;
-if (w<=0)or(w>1000) then
-  begin print_err("Improper `width' value (");
-  print_int(w); print("), replaced by 1000");
-  help2("I can only handle fonts at positive width ratio that are less")@/
-  ("than or equal to 1000, so I've changed what you said to 1000.");
-  error; w:=1000;
-  end;
-end
-
-@ @<Scan the CJK font height@>=
-begin scan_optional_equals;@/
-scan_int; h:=cur_val;
-if (h<=0)or(h>1000) then
-  begin print_err("Improper `height value (");
-  print_int(h); print("), replaced by 1000");
-  help2("I can only handle fonts at positive height ratio that are less")@/
-  ("than or equal to 1000, so I've changed what you said to 1000.");
-  error; h:=1000;
-  end;
-end
-
-@ @<Scan the CJK font depth@>=
-begin scan_optional_equals;@/
-scan_int; d:=cur_val;
-if (d<0)or(d>1000) then
-  begin print_err("Improper `depth' value (");
-  print_int(d); print("), replaced by 0.2");
-  help3("I can only handle fonts at nonegative depth ratio that are less")@/
-  ("than or equal to 1000, so I've changed what you said to")@/
-  ("the current \puxgCfaceDepth value.");
-  error; d:=puxg_cface_depth;
-  end;
-end
-
-@ @<Scan the CJK font weight@>=
-begin scan_optional_equals;@/
-scan_int; weight:=cur_val;
-if (weight < 0) or (weight > 1000) then
-  begin print_err("Illegal CJK font weight has been changed to 400");@/
-  help1("The font weight must be between 1 and 1000.");
-  int_error(cur_val); weight:=400; {normal weight}
-  end;
-end
-
-@
-@<Scan the CJK font style@>=
-begin scan_optional_equals;@/
-@<Get the next non-blank non-call token@>;
-if cur_cmd=letter then
-  case cur_chr of
-  "i", "I": if not i_flag then begin style:=style+italic; i_flag:=true; end;
-  "u", "U": if not u_flag then begin style:=style+underline; u_flag:=true; end;
-  "s", "S": if not s_flag then begin style:=style+strikeout; s_flag:=true; end;
-  "r", "R": if not r_flag then @<Set CJK font rotation style@>;
-  "v", "V": if not v_flag then begin style:=style+inverse; v_flag:=true; end;
-  othercases@/
-    begin print_err("Illegal CJK font style setting has been ignored");@/
-    print(" ("); print(cur_chr); print(")"); back_error;
-      {fix the case when cur\_chr is a double-byte char}
-    help2("The CJK font style setting should use characters:")@/
-    ("i:italic, u:underline, s:strikeout, r:rotated, v:reversed");
-    end;
-  endcases;@/
-end
-
-@ @<Set CJK font rotation style@>=
-begin
-if puxg_rotate_ctext<>0 then
-  style:=style-rotated
-else
-  style:=style+rotated;
-r_flag:=true;
-end
-
-@ @<If the face name is missing, then ignore this face deinition@>=
-if f=null_cface then
-  goto common_ending
-
-
-@ @<If this Chinese face has...@>=
-fix_w:=convfix(w);
-fix_h:=convfix(h);
-fix_d:=convfix(d);
-if f <> null_cface then
-  if weight=cface_weight[f] and style=cface_style[f] then
-    if fix_w=cface_fw_width[f] and fix_h=cface_fw_height[f] and fix_d=cface_fw_depth[f] then@/
-      goto common_ending
-
-@
-@<Setup this new Chinese face@>=
-if cface_ptr <= max_cface then
-  begin
-  f:=cface_ptr;
-  cface[f]:=id;
-  cface_name[f]:=face_name;@/
-  cface_charset[f]:=charset;@/
-  cface_weight[f]:=weight;@/
-  cface_style[f]:=style;@/
-  if style mod 2 = 1 then begin
-    cface_fw_width[f]:=fix_w; cface_fw_height[f]:=fix_h;
-    end
-  else begin
-    cface_fw_width[f]:=fix_h; cface_fw_height[f]:=fix_w;
-    end;
-  cface_fw_depth[f]:=fix_d;@/
-  reset_cface_cspace(f);@/
-  reset_cface_cespace(f);@/
-  incr(cface_ptr);
-  end
-else begin
-  f:=null_cface;
-  print_err("CJK font Face definition table overflow"); error;
-  end
-  
-@* \[59] CJK font definition table.
-
-@ @<Constants...@>=
-@!cfont_base=font_max_limit+1; {CJK font base}
-@!cfont_max=font_max_limit+1+cfont_max_limit; {maximum internal chinese font number}
-
-@
-@<Types...@>=
-@!internal_cfont_number=cfont_base..cfont_max;
-
-@ @<Initialize table entries...@>=
-cur_cfont:=default_cfont; eq_type(cur_cfont_loc):=data;
-eq_level(cur_cfont_loc):=level_one;@/
-
-@ @<Global variables@>=
-@!cfont_ptr:internal_cfont_number;
-@!cfont_face:array[internal_cfont_number] of internal_cface_number;
-  {CJK font face name}
-@!cfont_dsize:array[internal_cfont_number] of scaled;
-  {CJK font design size}
-@!cfont_size:array[internal_cfont_number] of scaled;
-  {CJK font size}
-@!cfont_width:array[internal_cfont_number] of scaled;
-  {CJK font width}
-@!cfont_height:array[internal_cfont_number] of scaled;
-  {CJK font heigh}
-@!cfont_depth:array[internal_cfont_number] of scaled;
-  {CJK font depth}
-@!cfont_glue_spec:array[internal_cfont_number] of pointer;
-  {CJK font inter-character space}
-@!cfont_ceglue_spec:array[internal_cfont_number] of pointer;
-  {CJK font inter-character space}
-@!cfont_used:array[internal_cfont_number] of boolean;
-  {has a character from this chinese font actually appeared in the output?}
-
-
-@ @<Set init...@>=
-for k:=cfont_base to cfont_max do cfont_used[k]:=false;
-cfont_face[null_cfont]:=null_cface;
-cfont_dsize[null_cfont]:=0;
-cfont_size[null_cfont]:=0;
-cfont_width[null_cfont]:=0;
-cfont_height[null_cfont]:=0;
-cfont_depth[null_cfont]:=0;
-
-@ @<Initialize table entries...@>=
-cfont_ptr:=default_cfont;
-
-@ @<Declare PUTeX subprocedures for |prefixed_command|@>=
-procedure set_cglue_spec(n:integer);
-var cface_num:integer;
-begin
-  cface_num:=cfont_face[n];
-  width(cfont_glue_spec[n]):=xn_over_d(cfont_size[n], cface_csp_width[cface_num], 1000);
-  shrink(cfont_glue_spec[n]):=xn_over_d(cfont_size[n], cface_csp_shrink[cface_num], 1000);
-  stretch(cfont_glue_spec[n]):=xn_over_d(cfont_size[n], cface_csp_stretch[cface_num], 1000);
-end;
-
-@ @<Declare PUTeX subprocedures for |prefixed_command|@>=
-procedure set_ceglue_spec(n:integer);
-var cface_num:integer;
-begin
-  cface_num:=cfont_face[n];
-  width(cfont_ceglue_spec[n]):=xn_over_d(cfont_size[n], cface_cesp_width[cface_num], 1000);
-  shrink(cfont_ceglue_spec[n]):=xn_over_d(cfont_size[n], cface_cesp_shrink[cface_num], 1000);
-  stretch(cfont_ceglue_spec[n]):=xn_over_d(cfont_size[n], cface_cesp_stretch[cface_num], 1000);
-end;
-
-
-@ @<Initialization of global variables done in the |main_control| procedure@>=
-cfont_glue_spec[null_cfont]:=new_spec(zero_glue);
-cfont_ceglue_spec[null_cfont]:=new_spec(zero_glue);
-
-@ @<Other local variables used by procedure |new_font|@>=
-@!face_id:str_number; {Chinese face name fetched from |\\font| command}
-@!jj:internal_cface_number;
-@!cface_num:internal_cface_number;
-@!ds:integer;
-@!dsize:scaled;
-@!size:scaled;
-
-@
-@<Define a CJK font and then goto |common_ending|@>=
-begin
-define(u, set_cfont, null_cfont);
-cface_num:=pux_default_cface;@/
-@<Fetch the Chinese face name@>;
-@<Fetch the font design size and compute font 'at' size@>;
-@<If this CJK font has already been loaded, set |f| to the internal
-  CJK font number and |goto| common\_ending@>;
-f:=make_cfont(cface_num,dsize,size);@/
-goto common_ending;
-end;
-
-@
-@d is_letter(#)==((#>='A' and #<='Z') or (#>='a' and #<='z'))
-@<Fetch the Chinese face name@>=
-jj:=j;
-j:=j+5; {skip the prefix 'CFONT'}
-while is_letter(str_pool[j]) do {fixme for wchar}
-  begin
-  append_char(str_pool[j]);
-  incr(j);
-  end;
-if pool_ptr <> str_start[str_ptr] then
-  begin
-  face_id:=make_string;@/
-  cface_num:=find_cface_num(face_id);
-  flush_string;
-  end
-else
-  begin
-  print_err("Missing Chinese face identifier"); error;
-  end;
-
-@
-@d is_digit(#)==(# >= '0' and # <= '9')
-@<Fetch the font design size and compute font 'at' size@>=
-ds:=0;
-while is_digit(str_pool[j]) do
-  begin
-  ds:= ds*10+(str_pool[j]-'0');
-  incr(j);
-  end;
-if ds=0 then
-  begin
-  print_err("Missing CJK font size specification, replaced by 10pt");
-  ds:=10; {set to default size: 10pt}
-  error;
-  end;
-dsize:=mult_integers(ds,unity);
-if s=-1000 then
-  size:=dsize
-else
-  if s>=0 then size:=s
-  else size:=xn_over_d(dsize, -s, 1000);
-
-@
-@d defined_cfont(#)==(#)<cfont_ptr
-@d undefined_cfont(#)==(#)=cfont_ptr
-
-@<Declare the procedure called |check_cfont|@>=
-function check_cfont(@!cface_num:internal_cface_number;@!size:scaled):internal_cfont_number;
-label done;
-var f:internal_cfont_number;
-begin
-f:=cfont_base+1;
-while (f<cfont_ptr) do
-  begin
-  if cface_num=cfont_face[f] and size=cfont_size[f] then goto done;
-  incr(f);
-  end;
-done:check_cfont:=f;
-end;
-
-@ @<If this CJK font has already been...@>=
-f:=check_cfont(cface_num,size);
-if defined_cfont(f) then goto common_ending;
-
-
-@
-@<Declare the procedure called |make_cfont|@>=
-function make_cfont(cfn:internal_cface_number; dsize, size:scaled):internal_cfont_number;
-begin
-if cfont_ptr <= cfont_max then
-  begin
-  cfont_face[cfont_ptr]:=cfn;@/
-  cfont_dsize[cfont_ptr]:=dsize;@/
-  cfont_size[cfont_ptr]:=size;@/
-  cfont_width[cfont_ptr]:=fw_times_sd(cface_fw_width[cfn], size);@/
-  cfont_height[cfont_ptr]:=fw_times_sd(cface_fw_height[cfn], size);@/
-  cfont_depth[cfont_ptr]:=fw_times_sd(cface_fw_depth[cfn], size);@/
-  cfont_glue_spec[cfont_ptr]:=new_spec(zero_glue);
-  set_cglue_spec(cfont_ptr);
-  cfont_ceglue_spec[cfont_ptr]:=new_spec(zero_glue);
-  set_ceglue_spec(cfont_ptr);
-  make_cfont:=cfont_ptr;@/
-  incr(cfont_ptr);
-  end
-else
-  begin
-  print_err("CJK font table overflow"); error;
-  end
-end;
-
-
-@ @<Cases of |print_cmd_chr|...@>=
-set_cfont:begin print("select CJK font "); slow_print(cface[cfont_face[chr_code]]);
-  print(" at ("); print_scaled(cfont_size[chr_code]); print("pt"); print(")");
-  end;
-
-@* \[57] Matching faces.
-@d min_ectbl=0
-@d max_ectbl=255
-
-@ @<Types...@>=
-@!internal_ectbl_number=min_ectbl..max_ectbl;
-
-
-@ @<Global variables@>=
-@!ectbl_eface_name:array[internal_ectbl_number] of str_number;
-  {the table of English face names }
-@!ectbl_ptr:internal_ectbl_number;
-  {index to the first unused entry}
-
-@ |ectbl_cface_num| table entries are already initialized in section 232.
-
-@<Initialize table entries...@>=
-ectbl_ptr:=min_ectbl;
-equiv(ectbl_cface_num_base):=null_cface;
-eq_type(ectbl_cface_num_base):=data;
-eq_level(ectbl_cface_num_base):=level_one;
-for k:=ectbl_cface_num_base+1 to font_matching_table_base-1 do
-  eqtb[k]:=eqtb[ectbl_cface_num_base];
-
-
-@ @<Put each of \TeX's primitives into the hash table@>=
-primitive("PUXfacematch",pux_face_match,0);
-
-@ @<Cases of |print_cmd_chr|...@>=
-pux_face_match: print_esc("PUXfacematch");
-
-@ @<Assignments@>=
-pux_face_match: match_ec_face(a);
-
-
-@ The function |find_ec_num| lookup the |ectbl_eface_name| table
-for the name |eface_name|. It returns the index to the name if the name
-exits; otherwose, it returns the current value of |ectbl_ptr|.
-
-@d ectbl_found(#)==((#)<ectbl_ptr)
-
-@<Declare the function called |find_ec_num|@>=
-function find_ec_num(eface_name:str_number):internal_ectbl_number;
-  label done;
-  var k:integer;@/
-  begin
-  k:=min_ectbl;
-  while k < ectbl_ptr do
-    begin
-    if str_eq_str(eface_name,ectbl_eface_name[k]) then goto done;
-    incr(k);
-    end;
-done: find_ec_num:=k;
-  end;
-
-@
-@<Declare subprocedures for |prefixed_command|@>=
-procedure make_cfont_id (f:internal_cfont_number; a:small_number);
-var
-@!i:0..23;
-@!m:integer;
-@!u: pointer;
-@!t:str_number;
-@!n:integer;
-begin
-buffer[buf_size+1]:='C';
-buffer[buf_size+2]:='F';
-buffer[buf_size+3]:='O';
-buffer[buf_size+4]:='N';
-buffer[buf_size+5]:='T';
-m:=buf_size+6;
-n:=f; i:=0;
-repeat dig[i]:=n mod 10; n:=n div 10; incr(i);
-until n=0;
-while i>0 do {append design size}
-  begin decr(i);
-  buffer[m]:="0"+dig[i];
-  incr(m);
-  end;
-no_new_control_sequence:=false;
-u:=id_lookup(buf_size+1,m-buf_size-1);
-no_new_control_sequence:=true;
-t:=text(u);
-define(u,set_cfont,f); eqtb[font_id_base+f]:=eqtb[u]; font_id_text(f):=t;
-end;
-
-@ @<Declare PUTeX subprocedures for |prefixed_command|@>=
-function fetch_efont_face (@!efont_name:str_number):str_number;
-var k:integer;@/
-@!p:pool_pointer;
-@!s: str_number;
-begin
-  p:=str_start[efont_name+1]-1; {last char position of efont\_name}@/
-  while is_digit(str_pool[p]) do decr(p); {assumed that the TeX font name has letters}
-  k:=str_start[efont_name];
-  while k <= p do
-    begin
-    append_char(str_pool[k]);
-    incr(k);
-    end;
-  s:=make_string;
-  fetch_efont_face:=s;
-end;
-
-
-@
-@<Declare subprocedures for |prefixed_command|@>=
-@<Declare the function called |find_ec_num|@>@;
-procedure match_ec_face(@!a:small_number);
-label done1, done2, exit;
-var k, f:integer;
-@!eface_name, @!efname, @!efont_name, @!cface_id:str_number;
-@!cfont_num:internal_cfont_number;
-@!cface_num:internal_cface_number;
-@!err:boolean;
-  begin
-  err:=false; f:=ectbl_ptr;@/
-  eface_name:=scan_name;
-  if cur_cmd=pux_set_cface then
-    eface_name:=fetch_efont_face(font_name[cur_font]) {should be flushed later}
-  else if eface_name=0 then begin
-      print_err("Missing a TeX face name");
-      error; goto exit;
-      end;
-  f:=find_ec_num(eface_name);
-  if ectbl_found(f) then begin {it is already in the |ectbl_eface_name| table}
-    flush_string;
-    eface_name:=ectbl_eface_name[f]
-    end;
-  if cur_cmd=pux_set_cface then begin {the second form: match face of current efont}
-      cface_num:=cur_chr;
-      @<Define the |cur_cfont| according to |cur_font| and |cface_num|@>;
-      end
-  else
-    @<Fetch a Chinese face id@>;
-  @<Add this face matching@>;
-exit: end;
-
-@ @<Define the |cur_cfont| according to |cur_font| and |cface_num|@>=
-cfont_num:=check_cfont(cface_num, font_size[cur_font]);
-if undefined_cfont(cfont_num) then begin
-  cfont_num:=make_cfont(cface_num,font_dsize[cur_font],font_size[cur_font]);
-  make_cfont_id(cfont_num,a);
-  end;
-define(cur_cfont_loc,data,cfont_num)
-
-
-
-@ @<Fetch a Chinese face id@>=
-begin
-@<Get the next non-blank non-call token@>;
-if cur_cmd=pux_set_cface then
-  cface_num:=cur_chr
-else begin
-  print_err("Missing a CJK font face identifier");
-  err:=true; error;
-  cface_num:=pux_default_cface;
-  end
-end
-
-@ @<Add this face matching@>=
-if f > max_ectbl then begin
-  print_err("Font face matching table overflow");
-  err:=true;
-  error;
-  end;
-if not err then begin
-  define(ectbl_cface_num_base+f,data,cface_num);
-  if f = ectbl_ptr then begin {add this new eface name the the |eface_name table|}
-    ectbl_eface_name[f]:=eface_name;
-    incr(ectbl_ptr);
-    end;
-  end
-
-@ @<Declare subprocedures for |prefixed_command|@>=
-function lookup_cface (@!efont_name: str_number) : internal_cface_number;
-var k:integer;@/
-@!cface_num:internal_cface_number;@/
-@!eface_name:str_number;@/
-begin
-  eface_name:=fetch_efont_face(efont_name);
-  k:=find_ec_num(eface_name);
-  flush_string;
-  if ectbl_found(k) then
-    cface_num:=ectbl_cface_num(k)
-  else cface_num:=pux_default_cface;
-  lookup_cface:=cface_num;
-end;
-
-
-@* \[60] Font matching.
-
-@ @<Initialize table entries...@>=
-equiv(font_matching_table_base):=null_cfont;
-eq_type(font_matching_table_base):=data;
-eq_level(font_matching_table_base):=level_one;
-for k:=font_matching_table_base+1 to math_font_base-1 do
-  eqtb[k]:=eqtb[font_matching_table_base];
-
-@ @<Put each of \TeX's primitives into the hash table@>=
-primitive("PUXfontmatch",pux_font_match,0);
-
-
-@ @<Assignments@>=
-pux_font_match: match_ec_font(a);
-
-@ @<Declare subprocedures for |prefixed_command|@>=
-procedure match_ec_font(@!a:small_number);
-label done;
-var efont_num:internal_font_number;
-@!cfont_num:internal_cfont_number;
-@!cface_num:internal_cface_number;
-begin
-  @<Get the next non-blank non-call token@>;
-  if cur_cmd = pux_set_cface then {the first form}
-    begin
-    efont_num:=cur_font;
-    cface_num:=cur_chr;
-    @<Define the |cur_cfont| according to |cur_font| and |cface_num|@>;
-    goto done;
-    end;
-  if cur_cmd = set_font then {the second form}
-    efont_num:=cur_chr
-  else begin
-    print_err("Missing Tex font identifier");
-    help2("I was looking for a control sequence whose")@/
-    ("current meaning has been defined by \font.");
-    back_error; efont_num:=null_font;
-    end;
-  @<Get the next non-blank non-call token@>;
-  if cur_cmd = set_cfont then cfont_num:=cur_chr
-  else begin
-    print_err("Missing CJK font identifier");
-    help2("I was looking for a control sequence whose")@/
-    ("current meaning has been defined by \cfont.");
-    back_error; cfont_num:=null_cfont;
-    end;
-done:
-  if efont_num<>null_font and cfont_num<>null_cfont then
-    define(font_matching_table_base+efont_num-font_base,data,cfont_num);
-end;
-
-@ @<Other variables used by the procedure |prefixed_command|@>=
-@!cface_num:internal_cface_number;
-@!cfont_num:internal_cfont_number;
-
-@ @<Set the matching CJK font@>=
-cfont_num:=font_matching_table(cur_chr);
-if cfont_num=null_cfont then begin {efont not mapped}
-  if cur_cface=null_cface then
-    cface_num:=lookup_cface(font_name[cur_chr])
-  else cface_num:=cur_cface;
-  @<Build a CJK font according to |cur_chr| and |cface_num| if it is not exist@>;
-  end
-else
-  if cur_cface<>null_cface and cfont_face[cfont_num]<>cur_cface then begin
-    cface_num:=cur_cface;
-    @<Build a CJK font according to |cur_chr| and |cface_num| if it is not exist@>;
-    end;
-define(cur_cfont_loc,data,cfont_num)
-
-@ @<Build a CJK font according to |cur_chr| and |cface_num| if it is not exist@>=
-cfont_num:=check_cfont(cface_num, font_size[cur_chr]);
-if undefined_cfont(cfont_num) then begin
-  cfont_num:=make_cfont(cface_num,font_dsize[cur_chr],font_size[cur_chr]);
-  make_cfont_id(cfont_num,a);
-  end
-
-@ @<Assignments@>=
-set_cfont: define(cur_cfont_loc,data,cur_chr);
-
-@ @<Other variables used by the procedure |prefixed_command|@>=
-cface_id:str_number;
-
-@ @<Assignments@>=
-pux_set_cface: begin
-  cface_num:=cur_chr;
-  if cface_num <> cfont_face[cur_cfont] then begin
-    @<Define the |cur_cfont| according to |cur_font| and |cface_num|@>;
-    end;
-  define(cur_cface_loc,data,cface_num);
-  end;
-
-@ @<Put each of \TeX's primitives into the hash table@>=
-primitive("puxgRotateCtext",puxg_assign_flag,int_base+puxg_rotate_ctext_code);
-primitive("puxXspace",puxg_assign_int,int_base+pux_xspace_code);
-primitive("puxCJKcharOther",puxg_assign_int,int_base+pux_wcharother_code);
-primitive("puxCJKinput",puxg_assign_int,int_base+pux_CJKinput_code);
-primitive("puxCharSet",puxg_assign_int,int_base+pux_charset_code);
-primitive("puxgCfaceDepth",puxg_assign_int,int_base+puxg_cface_depth_code);
-
-
-@ @<Cases of |print_cmd_chr|...@>=
-puxg_assign_flag:
-  if chr_code=puxg_rotate_ctext_code+int_base then
-    print_esc("puxgRotateCtext");
-puxg_assign_int:
-  if chr_code=pux_xspace_code+int_base then
-    print_esc("puxXspace")
-  else if chr_code=pux_wcharother_code+int_base then
-    print_esc("puxCJKcharOther")
-  else if chr_code=pux_CJKinput_code+int_base then
-    print_esc("puxCJKinput")
-  else if chr_code=pux_charset_code+int_base then
-    print_esc("puxCharSet")
-  else if chr_code=puxg_cface_depth_code+int_base then
-    print_esc("puxgCfaceDepth");
-
-@ @<Assignments@>=
-puxg_assign_flag: begin p:=cur_chr; scan_optional_equals; scan_int;
-  if cur_val=0 and eqtb[p].int<>0 then begin
-    print_err("Reset a PUTeX global parameter is not allowed here");
-    help2("If a PUTeX global parameter was set to be a nonzero value,")@/
-         ("it can't be reset to be zero again");
-    error;
-    end
-  else begin
-    if p=puxg_rotate_ctext_code+int_base then
-      @<Handle the command |puxgRotateCtext|@>;
-    word_define(p,cur_val);
-    end;
-  end;
-
-@ @<Handle the command |puxgRotateCtext|@>=
-if puxg_rotate_ctext=0 and cur_val<>0 then begin
-  n:=cface_base;
-  while n < cface_ptr do begin
-    if cface_style[n] mod 2 = 1 then
-      cface_style[n]:=cface_style[n]-rotated
-    else
-      cface_style[n]:=cface_style[n]+rotated;
-    incr(n);
-    end;
-  end
-
-@ @<Assignments@>=
-puxg_assign_int: begin p:=cur_chr; q:=p-int_base;
-  scan_optional_equals; scan_int;
-  if cur_val < 0 then begin
-    print_err("Negative "); print_param(p-int_base);
-    print(" value ("); print_int(cur_val); print("), it remains unchanged");
-    help1("This PUTeX parameter can't be negative.");
-    error;
-    end
-  else if q=pux_charset_code and cur_val > 255 then begin
-    print_err("Too large "); print_param(q);
-    print(" value ("); print_int(cur_val); print("), it remains unchanged");
-    help1("The value of document charset should be in the range 0..255.");
-    error;
-    end
-  else begin
-    case q of
-    pux_xspace_code,pux_wcharother_code,pux_CJKinput_code,pux_charset_code:word_define(p, cur_val);
-    puxg_cface_depth_code: if cur_val<>eqtb[p].int then
-            @<Set PUTeX global parameter |puxgCfaceDepth|@>;
-    othercases begin
-      print_err("Unknow integer parameter!");
-      error;
-      end;
-    endcases
-    end;
-  end;
-
-@ @<Set PUTeX global parameter |puxgCfaceDepth|@>=
-begin
-  if cur_val>1000 then begin
-    print_err("Improper `depth' value (");
-    print_int(cur_val); print("). It is ignored");
-    error;
-    end
-  else begin
-    word_define(p,cur_val);
-    cface_fw_default_depth:=convfix(puxg_cface_depth);
-    n:=cface_base;
-    while n<cface_ptr do begin
-      cface_fw_depth[n]:=cface_fw_default_depth;
-      incr(n);
-      end;
-    n:=cfont_base+1;
-    while n<cfont_ptr do begin
-      cfont_depth[n]:=fw_times_sd(cface_fw_depth[cfont_face[n]], cfont_size[n]);
-      incr(n);
-      end;
-    end;
-end
-
-@
-@d pux_set_cface_csp=0
-@d pux_set_cface_cesp=1
-@d pux_set_cface_depth=2
-@<Put each of \TeX's primitives into the hash table@>=
-primitive("PUXcfacecspace",pux_set_cface_attrib,pux_set_cface_csp);
-primitive("PUXcfacecespace",pux_set_cface_attrib,pux_set_cface_cesp);
-primitive("PUXcfacedepth",pux_set_cface_attrib,pux_set_cface_depth);
-
-@ @<Cases of |print_cmd_chr|...@>=
-pux_set_cface_attrib: begin
-  case chr_code of
-  pux_set_cface_csp:print_esc("PUXcfacecspace");
-  pux_set_cface_cesp:print_esc("PUXcfacecespace");
-  pux_set_cface_depth:print_esc("PUXcfacedepth");
-  endcases;
-  end;
-
-@ @<Assignments@>=
-pux_set_cface_attrib: begin p:=cur_chr;
-  @<Get the next non-blank non-call token@>;
-  if cur_cmd=pux_set_cface then
-    cface_num:=cur_chr
-  else begin
-    cface_num:=null_cface;
-    print_err("Missing a CJK font face identifier");
-    error;
-    end;
-  scan_optional_equals;
-  if p=pux_set_cface_csp or p=pux_set_cface_cesp then
-    @<Scan spacing dimension of CJK font face@>
-  else
-    scan_int;
-
-  if cface_num<>null_cface then begin
-    if p=pux_set_cface_csp then
-      @<Modify the cspace factor of the specified chinese face@>
-    else if p=pux_set_cface_cesp then
-      @<Modify the cespace factor of the specified chinese face@>
-    else if p=pux_set_cface_depth then
-      @<Modify the depth factor of the specified chinese face@>;
-    end;
-  end;
-
-@ @<Other variables used by the procedure |prefixed_command|@>=
-@!width_value:integer; {width of space}
-@!stretch_value:integer; {stretch of space}
-@!shrink_value:integer; {shrink of space}
-
-@
-@d puxg_set_cspace=0
-@d puxg_set_cespace=1
-
-@<Scan spacing dimension of CJK font face@>=
-begin
-  scan_optional_equals;
-  scan_int;
-  width_value:=cur_val;
-  if scan_keyword("plus") then begin
-    scan_int; stretch_value:=cur_val;
-    end
-  else {make stretch value compatible to \PUTeX 3}
-    if width_value < 250 and p = puxg_set_cspace then stretch_value:=125
-    else stretch_value:=width_value/2;
-
-  if scan_keyword("minus") then begin
-    scan_int; shrink_value:=cur_val;
-    end
-  else {make shrink value compatible to \PUTeX 3}
-     if width_value > 0 then shrink_value:=width_value div 3
-     else shrink_value:=-width_value div 3;
-end
-
-@ @<Modify the cspace factor of the specified chinese face@>=
-begin
-  if cface_csp_width[cface_num]<>width_value or 
-     cface_csp_stretch[cface_num]<>stretch_value or
-     cface_csp_shrink[cface_num]<>shrink_value then begin
-    cface_csp_width[cface_num]:=width_value; 
-    cface_csp_stretch[cface_num]:=stretch_value;
-    cface_csp_shrink[cface_num]:=shrink_value;
-    n:=cfont_base+1;
-    while n<cfont_ptr do begin
-      if cface_num = cfont_face[n] then set_cglue_spec(n);
-      incr(n);
-      end;
-    end;
-end
-
-@ @<Modify the cespace factor of the specified chinese face@>=
-begin
-  if cface_cesp_width[cface_num]<>width_value or 
-     cface_cesp_stretch[cface_num]<>stretch_value or
-     cface_cesp_shrink[cface_num]<>shrink_value then begin
-    cface_cesp_width[cface_num]:=width_value; 
-    cface_cesp_stretch[cface_num]:=stretch_value;
-    cface_cesp_shrink[cface_num]:=shrink_value;
-    n:=cfont_base+1;
-    while n<cfont_ptr do begin
-      if cface_num=cfont_face[n] then set_ceglue_spec(n);
-      incr(n);
-      end;
-    end;
-end
-
-@ @<Modify the depth factor of the specified chinese face@>=
-begin
-  cur_val:=convfix(cur_val);
-  if cface_fw_depth[cface_num]<>cur_val then begin
-    cface_fw_depth[cface_num]:=cur_val;
-    n:=cfont_base+1;
-    while n<cfont_ptr do begin
-      if cface_num=cfont_face[n] then
-        cfont_depth[n]:=fw_times_sd(cface_fw_depth[cface_num], cfont_size[n]);
-      incr(n);
-      end;
-    end;
-end
-
-@
-@d pux_set_cfont_csp=0
-@d pux_set_cfont_cesp=1
-@<Put each of \TeX's primitives into the hash table@>=
-primitive("PUXcfontcspace",pux_set_cfont_attrib,pux_set_cfont_csp);
-primitive("PUXcfontcespace",pux_set_cfont_attrib,pux_set_cfont_cesp);
-
-@ @<Cases of |print_cmd_chr|...@>=
-pux_set_cfont_attrib: begin
-  case chr_code of
-  pux_set_cfont_csp:print_esc("PUXcfontcspace");
-  pux_set_cfont_cesp:print_esc("PUXcfontcespace");
-  endcases;
-  end;
-
-@ @<Assignments@>=
-pux_set_cfont_attrib: begin p:=cur_chr;
-  @<Get the next non-blank non-call token@>;
-  if cur_cmd = set_cfont then {the first form}
-    begin
-    cfont_num:=cur_chr;
-    end
-  else if cur_cmd = set_font and cur_chr=cur_font then
-    cfont_num:=cur_cfont
-  else begin
-    print_err("Missing CJK font identifier");
-    help2("I was looking for a control sequence whose")@/
-    ("current meaning is a CJK font command.");
-    back_error; cfont_num:=null_cfont;
-    end;
-  scan_optional_equals;
-  case p of
-  pux_set_cfont_csp: begin
-    scan_glue(glue_val);
-    width(cfont_glue_spec[cfont_num]):=width(cur_val);
-    shrink(cfont_glue_spec[cfont_num]):=shrink(cur_val);
-    stretch(cfont_glue_spec[cfont_num]):=stretch(cur_val);
-    fast_delete_glue_ref(cur_val);
-    end;
-  pux_set_cfont_cesp: begin
-    scan_glue(glue_val);
-    width(cfont_ceglue_spec[cfont_num]):=width(cur_val);
-    shrink(cfont_ceglue_spec[cfont_num]):=shrink(cur_val);
-    stretch(cfont_ceglue_spec[cfont_num]):=stretch(cur_val);
-    fast_delete_glue_ref(cur_val);
-    end;
-  endcases;
-  end;
-
-@ @<Global variables@>=
-@!g_cspace_width:integer;
-@!g_cspace_shrink:integer;
-@!g_cspace_stretch:integer;
-@!g_cespace_width:integer;
-@!g_cespace_shrink:integer;
-@!g_cespace_stretch:integer;
-
-@
-@d default_csp_width=50
-@d default_cesp_width=150
-@<Set init...@>=
-g_cspace_width:=default_csp_width;
-g_cspace_shrink:=g_cspace_width div 3;
-g_cspace_stretch:=125;
-g_cespace_width:=default_cesp_width;
-g_cespace_shrink:=g_cespace_width div 3;
-g_cespace_stretch:=g_cespace_width div 2;
-
-@ @<Put each of \TeX's primitives into the hash table@>=
-primitive("puxgCspace",puxg_assign_space,puxg_set_cspace);
-primitive("puxgCEspace",puxg_assign_space,puxg_set_cespace);
-
-
-@ @<Cases of |print_cmd_chr|...@>=
-puxg_assign_space: begin
-  if chr_code = puxg_set_cspace then
-    print_esc("puxgCspace")
-  else if chr_code = puxg_set_cespace then
-    print_esc("puxgCEspace");
-  end;
-
-
-
-@ @<Assignments@>=
-puxg_assign_space:  begin p:=cur_chr;
-  @<Scan spacing dimension of CJK font face@>;
-  if p = puxg_set_cspace then begin
-    g_cspace_width:=width_value;
-    g_cspace_stretch:=stretch_value;
-    g_cspace_shrink:=shrink_value;
-    n:=cface_base;
-    while n < cface_ptr do begin
-       cface_csp_width[n]:=width_value;
-       cface_csp_shrink[n]:=shrink_value;
-       cface_csp_stretch[n]:=stretch_value;
-      incr(n);
-      end;
-    n:=cfont_base+1;
-    while n<cfont_ptr do begin
-      set_cglue_spec(n);
-      incr(n);
-      end;
-
-    end
-  else if p = puxg_set_cespace then begin
-    g_cespace_width:=width_value;
-    g_cespace_stretch:=stretch_value;
-    g_cespace_shrink:=shrink_value;
-    end;
-    n:=cface_base;
-    while n < cface_ptr do begin
-       cface_cesp_width[n]:=width_value;
-       cface_cesp_shrink[n]:=shrink_value;
-       cface_cesp_stretch[n]:=stretch_value;
-      incr(n);
-      end;
-    n:=cfont_base+1;
-    while n<cfont_ptr do begin
-      set_ceglue_spec(n);
-      incr(n);
-      end;
-  end;
-
-
-@* \[61] Dump Font Info.
-
-@<Other variables used by the procedure |prefixed_command|@>=
-@!old_setting:0..max_selector; {holds |selector| setting}
-
-@ @<Put each of \TeX's primitives into the hash table@>=
-primitive("PUXdumpfontinfo",pux_dump_font_info,0);
-
-@ @<Cases of |print_cmd_chr|...@>=
-pux_dump_font_info: print_esc("PUXdumpfontinfo"); {TCW}
-
-@ @<Assignments@>=
-pux_dump_font_info: begin old_setting:=selector; selector:=log_only;@/
-  @<Print TeX fonts@>;@/
-  @<Print CJK font faces@>;@/
-  @<Print CJK fonts@>;@/
-  @<Print font faces matching table@>;@/
-  selector:=old_setting;
-  end;
-
-@ @<Print TeX fonts@>=
-print_ln; print("Tex fonts"); print_ln;
-n:=0;
-while n <= font_ptr do
-  begin
-  print_int(n); print(": "); print(font_name[n]);@/
-  print(" dsize= "); print_scaled(font_dsize[n]); print("pt");@/
-  print(" at "); print_scaled(font_size[n]); print("pt");@/
-  print(" matched CJK font="); print_int(font_matching_table(n));
-  print_ln; incr(n);
-  end
-
-@ @<Print CJK font faces@>=
-print("Chinese faces"); print_ln;
-n:=0;
-while n < cface_ptr do
-  begin
-  print_int(n); print(": "); print("id="); print(cface[n]);@/
-  print(" name="); print(cface_name[n]);@/
-  print(" charset="); print_int(cface_charset[n]);@/
-  print(" weight="); print_int(cface_weight[n]);@/
-  print(" style="); print_int(cface_style[n]);@/
-  print(" w="); print_fixword(cface_fw_width[n]);@/
-  print(" h="); print_fixword(cface_fw_height[n]);@/
-  print(" d="); print_fixword(cface_fw_depth[n]);@/
-  print_ln; incr(n);
-  end
-
-@ @<Print CJK fonts@>=
-print("CJK fonts"); print_ln;
-n:=cfont_base;
-while n < cfont_ptr do
-  begin
-  print_int(n); print(":face= ");
-  print(cface[cfont_face[n]]);@/
-  print(" dsize= "); print_scaled(cfont_dsize[n]); print("pt");@/
-  print(" at "); print_scaled(cfont_size[n]); print("pt");@/
-  print_ln; incr(n);
-  end
-
-@ @<Print font faces matching table@>=
-print("English/CJK font faces matching table"); print_ln;
-n:=min_ectbl;
-while n < ectbl_ptr do
-  begin
-  print_int(n); print(": "); print("eface="); print(ectbl_eface_name[n]);@/
-  print(" cface_id="); print(cface[ectbl_cface_num(n)]);@/
-  print(" cface_num="); print_int(ectbl_cface_num(n));@/
-  print_ln; incr(n);
-  end
-
-@ @<Global variables@>=
-@!dvi_cf:internal_cfont_number;  {the current chinese font}
-
-@ @<Output the CJK font definitions for all fonts that were used@>=
-while cfont_ptr>cfont_base do
-  begin if cfont_used[cfont_ptr] then dvi_cfont_def(cfont_ptr);
-  decr(cfont_ptr);
-  end
-
-
-@ @<Change font |dvi_cf| to |f|@>=
-begin if not cfont_used[f] then
-  begin dvi_cfont_def(f); cfont_used[f]:=true;
-  end;
-  dvi_out(cfnt); dvi_out((f-cfont_base-1) div 256); dvi_out((f-cfont_base-1) mod 256);
-  dvi_cf:=f;
-end
-
-@* \[62] Dump/undump \PUTeX\ internal information.
-
-@ @<Dump the CJK font face information@>=
-dump_int(cface_ptr);
-dump_int(cface_fw_default_depth);
-for k:=cface_base to cface_ptr-1 do begin
-  dump_int(cface[k]);
-  dump_int(cface_name[k]);
-  dump_int(cface_charset[k]);
-  dump_int(cface_weight[k]);
-  dump_int(cface_style[k]);
-  dump_int(cface_fw_width[k]);
-  dump_int(cface_fw_height[k]);
-  dump_int(cface_fw_depth[k]);
-  dump_int(cface_csp_width[k]);
-  dump_int(cface_csp_shrink[k]);
-  dump_int(cface_csp_stretch[k]);
-  dump_int(cface_cesp_width[k]);
-  dump_int(cface_cesp_shrink[k]);
-  dump_int(cface_cesp_stretch[k]);
-  print_ln;
-  print_int(k); print(": "); print("id="); print(cface[k]);@/
-  print(" name="); print(cface_name[k]);@/
-  print(" charset="); print_int(cface_charset[k]);@/
-  print(" weight="); print_int(cface_weight[k]);@/
-  print(" style="); print_int(cface_style[k]);@/
-  print(" w="); print_fixword(cface_fw_width[k]);@/
-  print(" h="); print_fixword(cface_fw_height[k]);@/
-  print(" d="); print_fixword(cface_fw_depth[k]);@/
-  end;
-print_ln;
-print_int(cface_ptr-cface_base); print(" preloaded CJK font face");
-if cface_ptr<>cface_base+1 then print_char("s")
-
-@ @<Undump the CJK font face information@>=
-undump_size(cface_base)(max_cface)('cface max')(cface_ptr);
-undump_int(cface_fw_default_depth);
-for k:=cface_base to cface_ptr-1 do begin
-  undump_size(0)(pool_size)('cface id')(cface[k]);
-  undump_size(0)(pool_size)('cface name')(cface_name[k]);
-  undump_size(0)(255)('charset size')(cface_charset[k]);
-  undump_size(1)(1000)('cface weight')(cface_weight[k]);
-  undump_size(0)(255)('cface style')(cface_style[k]);
-  undump_int(cface_fw_width[k]);
-  undump_int(cface_fw_height[k]);
-  undump_int(cface_fw_depth[k]);
-  undump_int(cface_csp_width[k]);
-  undump_int(cface_csp_shrink[k]);
-  undump_int(cface_csp_stretch[k]);
-  undump_int(cface_cesp_width[k]);
-  undump_int(cface_cesp_shrink[k]);
-  undump_int(cface_cesp_stretch[k]);
-  end
-
-@ @<Dump the face matching table@>=
-dump_int(ectbl_ptr);
-for k:=min_ectbl to ectbl_ptr-1 do
-  dump_int(ectbl_eface_name[k])
-
-@ @<Unump the face matching table@>=
-undump_size(min_ectbl)(max_ectbl)('ectbl_ptr')(ectbl_ptr);
-for k:=min_ectbl to ectbl_ptr-1 do
-  undump_size(0)(pool_size)('ectbl eface name')(ectbl_eface_name[k])
-
-@ @<Dump the CJK font information@>=
-begin
-dump_int(cfont_ptr);
-for k:=default_cfont to cfont_ptr-1 do begin
-  dump_int(cfont_face[k]);
-  dump_int(cfont_dsize[k]);
-  dump_int(cfont_size[k]);
-  dump_int(cfont_width[k]);
-  dump_int(cfont_height[k]);
-  dump_int(cfont_depth[k]);
-  dump_int(cfont_glue_spec[k]);
-  dump_int(cfont_ceglue_spec[k]);
-  print_ln;
-  print_int(k); print(":face= ");
-  print(cface[cfont_face[k]]);@/
-  print(" dsize= "); print_scaled(cfont_dsize[k]); print("pt");@/
-  print(" at "); print_scaled(cfont_size[k]); print("pt");@/
-  end;
-end
-
-@ @<Undump the CJK font information@>=
-begin
-undump_size(cfont_base)(cfont_max)('cfont max')(cfont_ptr);
-for k:=default_cfont to cfont_ptr-1 do begin
-  undump_size(cface_base)(max_cface)('cface max')(cfont_face[k]);
-  undump_int(cfont_dsize[k]);
-  undump_int(cfont_size[k]);
-  undump_int(cfont_width[k]);
-  undump_int(cfont_height[k]);
-  undump_int(cfont_depth[k]);
-  undump_int(cfont_glue_spec[k]);
-  undump_int(cfont_ceglue_spec[k]);
-  end;
-end
-  
-@* \[63] Index.
-
-@z
-
diff --git a/src/web2c/putexdir/putex_version.h b/src/web2c/putexdir/putex_version.h
deleted file mode 100644 (file)
index 0063cf7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#define PUTEX_VERSION "4.0"
diff --git a/src/web2c/putexdir/putexextra.c b/src/web2c/putexdir/putexextra.c
deleted file mode 100644 (file)
index bfd4ea8..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/* uptexextra.c: Hand-coded routines for PUTeX.
-
-   This file is public domain.  */
-
-#define        EXTERN /* Instantiate data from putexd.h here.  */
-#define DLLPROC dlluptexmain
-
-/* This file defines TeX and PUTeX.  */
-#include <putexd.h>
-
-/* Hand-coded routines for TeX or Metafont in C.  */
-#include <lib/texmfmp.c>
diff --git a/src/web2c/putexdir/putexextra.h b/src/web2c/putexdir/putexextra.h
deleted file mode 100644 (file)
index 20a6acb..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/* putexextra.h: banner etc. for PUTeX.
-   This is included by PUTeX, from putexextra.c
-*/
-
-#include <putexdir/putex_version.h> /* for PUTEX_VERSION */
-
-#define BANNER "This is PUTeX, Version 3.1415926-" PUTEX_VERSION
-#define COPYRIGHT_HOLDER "Clerk Ma"
-#define AUTHOR NULL
-#define PROGRAM_HELP PUTEXHELP
-#define BUG_ADDRESS "clerkma@gmail.com"
-#define DUMP_VAR TEXformatdefault
-#define DUMP_LENGTH_VAR formatdefaultlength
-#define DUMP_OPTION "fmt"
-#define DUMP_EXT ".fmt"
-#define INPUT_FORMAT kpse_tex_format
-#define INI_PROGRAM "iniputex"
-#define VIR_PROGRAM "virputex"
-
-#ifdef Xchr
-#undef Xchr
-#define Xchr(x) (x)
-#endif /* Xchr */
diff --git a/src/web2c/synctexdir/am/synctex.am.add b/src/web2c/synctexdir/am/synctex.am.add
deleted file mode 100644 (file)
index 45cb064..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-if PUTEX_SYNCTEX
-
-putex_CPPFLAGS += -I$(srcdir)/synctexdir $(ZLIB_INCLUDES)
-
-putex_LDADD += $(ZLIB_LIBS)
-putex_prereq += $(ZLIB_DEPEND)
-
-putex_ch_synctex = \
-       synctexdir/synctex-def.ch0 \
-       synctexdir/synctex-mem.ch0 \
-       synctexdir/synctex-mem.ch2 \
-       synctexdir/synctex-rec.ch0 \
-       synctexdir/synctex-rec.ch1 \
-       synctexdir/synctex-rec.ch2
-
-dist_putex_SOURCES += \
-       synctexdir/synctex.c \
-       synctexdir/synctex.h \
-       synctexdir/synctex-common.h \
-       synctexdir/synctex-putex.h
-
-putex_CPPFLAGS += -D__SyncTeX__ -DSYNCTEX_ENGINE_H=\"synctex-putex.h\"
-
-endif PUTEX_SYNCTEX
diff --git a/src/web2c/synctexdir/synctex-putex.h b/src/web2c/synctexdir/synctex-putex.h
deleted file mode 100644 (file)
index 72f7d26..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include "putexd.h"
diff --git a/src/web2c/texmfmp-help.h b/src/web2c/texmfmp-help.h
deleted file mode 100644 (file)
index 4c33a77..0000000
+++ /dev/null
@@ -1,686 +0,0 @@
-/* The help messages for TeX & MF family of programs.
-
-Copyright 1995, 1996, 2008 - 2011 Karl Berry.
-Copyright 2001-05 Olaf Weber.
-
-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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.  */
-
-#ifndef TEXMFMP_HELP
-#define TEXMFMP_HELP
-
-#ifdef Aleph
-const_string ALEPHHELP[] = {
-    "Usage: aleph [OPTION]... [TEXNAME[.tex]] [COMMANDS]",
-    "   or: aleph [OPTION]... \\FIRST-LINE",
-    "   or: aleph [OPTION]... &FMT ARGS",
-    "  Run Aleph on TEXNAME, usually creating TEXNAME.dvi.",
-    "  Any remaining COMMANDS are processed as Aleph input, after TEXNAME is read.",
-    "  If the first line of TEXNAME is %&FMT, and FMT is an existing .fmt file,",
-    "  use it.  Else use `NAME.fmt', where NAME is the program invocation name,",
-    "  most commonly `aleph'.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a backslash,",
-    "  interpret all non-option arguments as a line of Aleph input.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a &, the",
-    "  next word is taken as the FMT to read, overriding all else.  Any",
-    "  remaining arguments are processed as above.",
-    "",
-    "  If no arguments or options are specified, prompt for input.",
-    "",
-    "-etex                   enable e-TeX extensions",
-    "[-no]-file-line-error   disable/enable file:line:error style messages",
-    "-fmt=FMTNAME            use FMTNAME instead of program name or a %& line",
-    "-halt-on-error          stop processing at the first error",
-    "-ini                    be inialeph, for dumping formats; this is implicitly",
-    "                          true if the program name is `inialeph'",
-    "-interaction=STRING     set interaction mode (STRING=batchmode/nonstopmode/",
-    "                          scrollmode/errorstopmode)",
-#ifdef IPC
-    "-ipc                    send DVI output to a socket as well as the usual",
-    "                          output file",
-    "-ipc-start              as -ipc, and also start the server at the other end",
-#endif /* IPC */
-    "-jobname=STRING         set the job name to STRING",
-    "-kpathsea-debug=NUMBER  set path searching debugging flags according to the",
-    "                          bits of NUMBER",
-    "[-no]-mktex=FMT         disable/enable mktexFMT generation (FMT=tex/tfm)",
-    "-output-comment=STRING  use STRING for DVI file comment instead of date",
-    "-output-directory=DIR   use existing DIR as the directory to write files in",
-    "[-no]-parse-first-line  disable/enable parsing of first line of input file",
-    "-progname=STRING        set program (and fmt) name to STRING",
-    "-recorder               enable filename recorder (always on)",
-    "[-no]-shell-escape      disable/enable \\write18{SHELL COMMAND}",
-    "-shell-restricted       enable restricted \\write18",
-    "-src-specials           insert source specials into the DVI file",
-    "-src-specials=WHERE     insert source specials in certain places of",
-    "                          the DVI file. WHERE is a comma-separated value",
-    "                          list: cr display hbox math par parend vbox",
-    "-help                   display this help and exit",
-    "-version                output version information and exit",
-    NULL
-};
-#endif /* Aleph */
-
-#ifdef epTeX
-const_string based_prog_name = "e-TeX";
-const_string EPTEXHELP[] = {
-    "Usage: eptex [OPTION]... [TEXNAME[.tex]] [COMMANDS]",
-    "   or: eptex [OPTION]... \\FIRST-LINE",
-    "   or: eptex [OPTION]... &FMT ARGS",
-    "  Run e-pTeX on TEXNAME, usually creating TEXNAME.dvi.",
-    "  Any remaining COMMANDS are processed as e-pTeX input, after TEXNAME is read.",
-    "  If the first line of TEXNAME is %&FMT, and FMT is an existing .fmt file,",
-    "  use it.  Else use `NAME.fmt', where NAME is the program invocation name,",
-    "  most commonly `eptex'.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a backslash,",
-    "  interpret all non-option arguments as a line of e-pTeX input.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a &, the",
-    "  next word is taken as the FMT to read, overriding all else.  Any",
-    "  remaining arguments are processed as above.",
-    "",
-    "  If no arguments or options are specified, prompt for input.",
-    "",
-    "-etex                   enable e-TeX extensions",
-    "-fmt=NAME               use NAME instead of program name or %&format.",
-#if defined(WIN32)
-    "[-no]-guess-input-enc   disable/enable to guess input file encoding",
-#endif
-    "-halt-on-error          stop processing at the first error",
-    "[-no]-file-line-error   disable/enable file:line:error style messages",
-    "-ini                    be iniptex.",
-    "-interaction=STRING     set interaction mode (STRING=batchmode|nonstopmode|",
-    "                          scrollmode|errorstopmode)",
-#ifdef IPC
-    "-ipc                    send DVI output to a socket as well as the usual",
-    "                          output file",
-    "-ipc-start              as -ipc, and also start the server at the other end",
-#endif /* IPC */
-    "-jobname=STRING         set the job name to STRING",
-    "-kanji=STRING           set Japanese encoding (STRING=euc|jis|sjis|utf8)",
-    "-kanji-internal=STRING  set Japanese internal encoding (STRING=euc|sjis)",
-    "-kpathsea-debug=NUMBER  set path searching debugging flags according to",
-    "                          the bits of NUMBER",
-    "[-no]-mktex=FMT         disable/enable mktexFMT generation (FMT=tex/tfm)",
-    "-mltex                  enable MLTeX extensions such as \\charsubdef",
-    "-output-comment=STRING  use STRING for DVI file comment instead of date",
-    "-output-directory=DIR   use existing DIR as the directory to write files in",
-    "[-no]-parse-first-line  disable/enable parsing of first line of input file",
-    "-progname=STRING        set program (and fmt) name to STRING",
-    "-recorder               enable filename recorder",
-    "[-no]-shell-escape      disable/enable \\write18{SHELL COMMAND}",
-    "-shell-restricted       enable restricted \\write18",
-#if defined(WIN32)
-    "-sjis-terminal          always output to stdout and stderr by CP932",
-#endif
-    "-src-specials           insert source specials into the DVI file",
-    "-src-specials=WHERE     insert source specials in certain places of",
-    "                          the DVI file. WHERE is a comma-separated value",
-    "                          list: cr display hbox math par parend vbox",
-#if defined(__SyncTeX__)
-    "-synctex=NUMBER         generate SyncTeX data for previewers if nonzero",
-#endif
-    "-translate-file=TCXNAME use the TCX file TCXNAME",
-    "-help                   print this message and exit.",
-    "-version                print version information and exit.",
-    NULL
-};
-#endif /* epTeX */
-
-#ifdef eTeX
-const_string ETEXHELP[] = {
-    "Usage: etex [OPTION]... [TEXNAME[.tex]] [COMMANDS]",
-    "   or: etex [OPTION]... \\FIRST-LINE",
-    "   or: etex [OPTION]... &FMT ARGS",
-    "  Run e-TeX on TEXNAME, usually creating TEXNAME.dvi.",
-    "  Any remaining COMMANDS are processed as e-TeX input, after TEXNAME is read.",
-    "  If the first line of TEXNAME is %&FMT, and FMT is an existing .fmt file,",
-    "  use it.  Else use `NAME.fmt', where NAME is the program invocation name,",
-    "  most commonly `etex'.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a backslash,",
-    "  interpret all non-option arguments as a line of e-TeX input.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a &, the",
-    "  next word is taken as the FMT to read, overriding all else.  Any",
-    "  remaining arguments are processed as above.",
-    "",
-    "  If no arguments or options are specified, prompt for input.",
-    "",
-    "-enc                    enable encTeX extensions such as \\mubyte",
-    "-etex                   enable e-TeX extensions",
-    "[-no]-file-line-error   disable/enable file:line:error style messages",
-    "-fmt=FMTNAME            use FMTNAME instead of program name or a %& line",
-    "-halt-on-error          stop processing at the first error",
-    "-ini                    be einitex, for dumping formats; this is implicitly",
-    "                          true if the program name is `einitex'",
-    "-interaction=STRING     set interaction mode (STRING=batchmode/nonstopmode/",
-    "                          scrollmode/errorstopmode)",
-#ifdef IPC
-    "-ipc                    send DVI output to a socket as well as the usual",
-    "                          output file",
-    "-ipc-start              as -ipc, and also start the server at the other end",
-#endif /* IPC */
-    "-jobname=STRING         set the job name to STRING",
-    "-kpathsea-debug=NUMBER  set path searching debugging flags according to",
-    "                          the bits of NUMBER",
-    "[-no]-mktex=FMT         disable/enable mktexFMT generation (FMT=tex/tfm)",
-    "-mltex                  enable MLTeX extensions such as \\charsubdef",
-    "-output-comment=STRING  use STRING for DVI file comment instead of date",
-    "-output-directory=DIR   use existing DIR as the directory to write files in",
-    "[-no]-parse-first-line  disable/enable parsing of first line of input file",
-    "-progname=STRING        set program (and fmt) name to STRING",
-    "-recorder               enable filename recorder",
-    "[-no]-shell-escape      disable/enable \\write18{SHELL COMMAND}",
-    "-shell-restricted       enable restricted \\write18",
-    "-src-specials           insert source specials into the DVI file",
-    "-src-specials=WHERE     insert source specials in certain places of",
-    "                          the DVI file. WHERE is a comma-separated value",
-    "                          list: cr display hbox math par parend vbox",
-#if defined(__SyncTeX__)
-    "-synctex=NUMBER         generate SyncTeX data for previewers if nonzero",
-#endif
-    "-translate-file=TCXNAME use the TCX file TCXNAME",
-    "-8bit                   make all characters printable by default",
-    "-help                   display this help and exit",
-    "-version                output version information and exit",
-    NULL
-};
-#endif /* eTeX */
-
-#ifdef eupTeX
-const_string based_prog_name = "e-TeX";
-const_string EUPTEXHELP[] = {
-    "Usage: euptex [OPTION]... [TEXNAME[.tex]] [COMMANDS]",
-    "   or: euptex [OPTION]... \\FIRST-LINE",
-    "   or: euptex [OPTION]... &FMT ARGS",
-    "  Run e-upTeX on TEXNAME, usually creating TEXNAME.dvi.",
-    "  Any remaining COMMANDS are processed as e-upTeX input, after TEXNAME is read.",
-    "  If the first line of TEXNAME is %&FMT, and FMT is an existing .fmt file,",
-    "  use it.  Else use `NAME.fmt', where NAME is the program invocation name,",
-    "  most commonly `euptex'.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a backslash,",
-    "  interpret all non-option arguments as a line of e-upTeX input.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a &, the",
-    "  next word is taken as the FMT to read, overriding all else.  Any",
-    "  remaining arguments are processed as above.",
-    "",
-    "  If no arguments or options are specified, prompt for input.",
-    "",
-    "-etex                   enable e-TeX extensions",
-    "-fmt=NAME               use NAME instead of program name or %&format.",
-#if defined(WIN32)
-    "[-no]-guess-input-enc   disable/enable to guess input file encoding",
-#endif
-    "-halt-on-error          stop processing at the first error",
-    "[-no]-file-line-error   disable/enable file:line:error style messages",
-    "-ini                    be iniptex.",
-    "-interaction=STRING     set interaction mode (STRING=batchmode|nonstopmode|",
-    "                          scrollmode|errorstopmode)",
-#ifdef IPC
-    "-ipc                    send DVI output to a socket as well as the usual",
-    "                          output file",
-    "-ipc-start              as -ipc, and also start the server at the other end",
-#endif /* IPC */
-    "-jobname=STRING         set the job name to STRING",
-    "-kanji=STRING           set Japanese encoding (STRING=euc|jis|sjis|utf8|uptex)",
-    "-kanji-internal=STRING  set Japanese internal encoding (STRING=euc|sjis|uptex)",
-    "-kpathsea-debug=NUMBER  set path searching debugging flags according to",
-    "                          the bits of NUMBER",
-    "[-no]-mktex=FMT         disable/enable mktexFMT generation (FMT=tex/tfm)",
-    "-mltex                  enable MLTeX extensions such as \\charsubdef",
-    "-output-comment=STRING  use STRING for DVI file comment instead of date",
-    "-output-directory=DIR   use existing DIR as the directory to write files in",
-    "[-no]-parse-first-line  disable/enable parsing of first line of input file",
-    "-progname=STRING        set program (and fmt) name to STRING",
-    "-recorder               enable filename recorder",
-    "[-no]-shell-escape      disable/enable \\write18{SHELL COMMAND}",
-    "-shell-restricted       enable restricted \\write18",
-#if defined(WIN32)
-    "-sjis-terminal          always output to stdout and stderr by CP932",
-#endif
-    "-src-specials           insert source specials into the DVI file",
-    "-src-specials=WHERE     insert source specials in certain places of",
-    "                          the DVI file. WHERE is a comma-separated value",
-    "                          list: cr display hbox math par parend vbox",
-#if defined(__SyncTeX__)
-    "-synctex=NUMBER         generate SyncTeX data for previewers if nonzero",
-#endif
-    "-translate-file=TCXNAME use the TCX file TCXNAME",
-    "-help                   print this message and exit.",
-    "-version                print version information and exit.",
-    NULL
-};
-#endif /* eupTeX */
-
-#ifdef MF
-const_string MFHELP[] = {
-    "Usage: mf [OPTION]... [MFNAME[.mf]] [COMMANDS]",
-    "   or: mf [OPTION]... \\FIRST-LINE",
-    "   or: mf [OPTION]... &BASE ARGS",
-    "  Run Metafont on MFNAME, usually creating MFNAME.tfm and MFNAME.NNNNgf,",
-    "  where NNNN is the resolution of the specified mode (2602 by default).",
-    "  Any following COMMANDS are processed as Metafont input,",
-    "  after MFNAME is read.",
-    "  If the first line of MFNAME is %&BASE, and BASE is an existing .base file,",
-    "  use it.  Else use `NAME.base', where NAME is the program invocation name,",
-    "  most commonly `mf'.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a backslash,",
-    "  interpret all non-option arguments as a line of Metafont input.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a &, the",
-    "  next word is taken as the BASE to read, overriding all else. Any",
-    "  remaining arguments are processed as above.",
-    "",
-    "  If no arguments or options are specified, prompt for input.",
-    "",
-    "-base=BASENAME          use BASENAME instead of program name or a %& line",
-    "[-no]-file-line-error   disable/enable file:line:error style messages",
-    "-halt-on-error          stop processing at the first error",
-    "-ini                    be inimf, for dumping bases; this is implicitly",
-    "                          true if the program name is `inimf'",
-    "-interaction=STRING     set interaction mode (STRING=batchmode/nonstopmode/",
-    "                          scrollmode/errorstopmode)",
-    "-jobname=STRING         set the job name to STRING",
-    "-kpathsea-debug=NUMBER  set path searching debugging flags according to",
-    "                          the bits of NUMBER",
-    "[-no]-mktex=FMT         disable/enable mktexFMT generation (FMT=mf)",
-    "-output-directory=DIR   use existing DIR as the directory to write files in",
-    "[-no]-parse-first-line  disable/enable parsing of first line of input file",
-    "-progname=STRING        set program (and base) name to STRING",
-    "-recorder               enable filename recorder",
-    "-translate-file=TCXNAME use the TCX file TCXNAME",
-    "-8bit                   make all characters printable by default",
-    "-help                   display this help and exit",
-    "-version                output version information and exit",
-    NULL
-};
-#endif /* MF */
-
-#ifdef pdfTeX
-const_string PDFTEXHELP[] = {
-    "Usage: pdftex [OPTION]... [TEXNAME[.tex]] [COMMANDS]",
-    "   or: pdftex [OPTION]... \\FIRST-LINE",
-    "   or: pdftex [OPTION]... &FMT ARGS",
-    "  Run pdfTeX on TEXNAME, usually creating TEXNAME.pdf.",
-    "  Any remaining COMMANDS are processed as pdfTeX input, after TEXNAME is read.",
-    "  If the first line of TEXNAME is %&FMT, and FMT is an existing .fmt file,",
-    "  use it.  Else use `NAME.fmt', where NAME is the program invocation name,",
-    "  most commonly `pdftex'.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a backslash,",
-    "  interpret all non-option arguments as a line of pdfTeX input.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a &, the",
-    "  next word is taken as the FMT to read, overriding all else.  Any",
-    "  remaining arguments are processed as above.",
-    "",
-    "  If no arguments or options are specified, prompt for input.",
-    "",
-    "-draftmode              switch on draft mode (generates no output PDF)",
-    "-enc                    enable encTeX extensions such as \\mubyte",
-    "-etex                   enable e-TeX extensions",
-    "[-no]-file-line-error   disable/enable file:line:error style messages",
-    "-fmt=FMTNAME            use FMTNAME instead of program name or a %& line",
-    "-halt-on-error          stop processing at the first error",
-    "-ini                    be pdfinitex, for dumping formats; this is implicitly",
-    "                          true if the program name is `pdfinitex'",
-    "-interaction=STRING     set interaction mode (STRING=batchmode/nonstopmode/",
-    "                          scrollmode/errorstopmode)",
-#ifdef IPC
-    "-ipc                    send DVI output to a socket as well as the usual",
-    "                          output file",
-    "-ipc-start              as -ipc, and also start the server at the other end",
-#endif /* IPC */
-    "-jobname=STRING         set the job name to STRING",
-    "-kpathsea-debug=NUMBER  set path searching debugging flags according to",
-    "                          the bits of NUMBER",
-    "[-no]-mktex=FMT         disable/enable mktexFMT generation (FMT=tex/tfm/pk)",
-    "-mltex                  enable MLTeX extensions such as \\charsubdef",
-    "-output-comment=STRING  use STRING for DVI file comment instead of date",
-    "                          (no effect for PDF)",
-    "-output-directory=DIR   use existing DIR as the directory to write files in",
-    "-output-format=FORMAT   use FORMAT for job output; FORMAT is `dvi' or `pdf'",
-    "[-no]-parse-first-line  disable/enable parsing of first line of input file",
-    "-progname=STRING        set program (and fmt) name to STRING",
-    "-recorder               enable filename recorder",
-    "[-no]-shell-escape      disable/enable \\write18{SHELL COMMAND}",
-    "-shell-restricted       enable restricted \\write18",
-    "-src-specials           insert source specials into the DVI file",
-    "-src-specials=WHERE     insert source specials in certain places of",
-    "                          the DVI file. WHERE is a comma-separated value",
-    "                          list: cr display hbox math par parend vbox",
-#if defined(__SyncTeX__)
-    "-synctex=NUMBER         generate SyncTeX data for previewers if nonzero",
-#endif
-    "-translate-file=TCXNAME use the TCX file TCXNAME",
-    "-8bit                   make all characters printable by default",
-    "-help                   display this help and exit",
-    "-version                output version information and exit",
-    NULL
-};
-#endif /* pdfTeX */
-
-#ifdef pTeX
-const_string based_prog_name = "TeX";
-const_string PTEXHELP[] = {
-    "Usage: ptex [OPTION]... [TEXNAME[.tex]] [COMMANDS]",
-    "   or: ptex [OPTION]... \\FIRST-LINE",
-    "   or: ptex [OPTION]... &FMT ARGS",
-    "  Run pTeX on TEXNAME, usually creating TEXNAME.dvi.",
-    "  Any remaining COMMANDS are processed as pTeX input, after TEXNAME is read.",
-    "  If the first line of TEXNAME is %&FMT, and FMT is an existing .fmt file,",
-    "  use it.  Else use `NAME.fmt', where NAME is the program invocation name,",
-    "  most commonly `ptex'.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a backslash,",
-    "  interpret all non-option arguments as a line of pTeX input.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a &, the",
-    "  next word is taken as the FMT to read, overriding all else.  Any",
-    "  remaining arguments are processed as above.",
-    "",
-    "  If no arguments or options are specified, prompt for input.",
-    "",
-    "-fmt=NAME               use NAME instead of program name or %&format.",
-#if defined(WIN32)
-    "[-no]-guess-input-enc   disable/enable to guess input file encoding",
-#endif
-    "-halt-on-error          stop processing at the first error",
-    "[-no]-file-line-error   disable/enable file:line:error style messages",
-    "-ini                    be iniptex.",
-    "-interaction=STRING     set interaction mode (STRING=batchmode|nonstopmode|",
-    "                          scrollmode|errorstopmode)",
-#ifdef IPC
-    "-ipc                    send DVI output to a socket as well as the usual",
-    "                          output file",
-    "-ipc-start              as -ipc, and also start the server at the other end",
-#endif /* IPC */
-    "-jobname=STRING         set the job name to STRING",
-    "-kanji=STRING           set Japanese encoding (STRING=euc|jis|sjis|utf8)",
-    "-kanji-internal=STRING  set Japanese internal encoding (STRING=euc|sjis)",
-    "-kpathsea-debug=NUMBER  set path searching debugging flags according to",
-    "                          the bits of NUMBER",
-    "[-no]-mktex=FMT         disable/enable mktexFMT generation (FMT=tex/tfm)",
-    "-mltex                  enable MLTeX extensions such as \\charsubdef",
-    "-output-comment=STRING  use STRING for DVI file comment instead of date",
-    "-output-directory=DIR   use existing DIR as the directory to write files in",
-    "[-no]-parse-first-line  disable/enable parsing of first line of input file",
-    "-progname=STRING        set program (and fmt) name to STRING",
-    "-recorder               enable filename recorder",
-    "[-no]-shell-escape      disable/enable \\write18{SHELL COMMAND}",
-    "-shell-restricted       enable restricted \\write18",
-#if defined(WIN32)
-    "-sjis-terminal          always output to stdout and stderr by CP932",
-#endif
-    "-src-specials           insert source specials into the DVI file",
-    "-src-specials=WHERE     insert source specials in certain places of",
-    "                          the DVI file. WHERE is a comma-separated value",
-    "                          list: cr display hbox math par parend vbox",
-#if defined(__SyncTeX__)
-    "-synctex=NUMBER         generate SyncTeX data for previewers if nonzero",
-#endif
-    "-translate-file=TCXNAME use the TCX file TCXNAME",
-    "-help                   print this message and exit.",
-    "-version                print version information and exit.",
-    NULL
-};
-#endif /* pTeX */
-
-#ifdef onlyTeX
-const_string TEXHELP[] = {
-    "Usage: tex [OPTION]... [TEXNAME[.tex]] [COMMANDS]",
-    "   or: tex [OPTION]... \\FIRST-LINE",
-    "   or: tex [OPTION]... &FMT ARGS",
-    "  Run TeX on TEXNAME, usually creating TEXNAME.dvi.",
-    "  Any remaining COMMANDS are processed as TeX input, after TEXNAME is read.",
-    "  If the first line of TEXNAME is %&FMT, and FMT is an existing .fmt file,",
-    "  use it.  Else use `NAME.fmt', where NAME is the program invocation name,",
-    "  most commonly `tex'.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a backslash,",
-    "  interpret all non-option arguments as a line of TeX input.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a &, the",
-    "  next word is taken as the FMT to read, overriding all else.  Any",
-    "  remaining arguments are processed as above.",
-    "",
-    "  If no arguments or options are specified, prompt for input.",
-    "",
-    "-enc                    enable encTeX extensions such as \\mubyte",
-    "[-no]-file-line-error   disable/enable file:line:error style messages",
-    "-fmt=FMTNAME            use FMTNAME instead of program name or a %& line",
-    "-halt-on-error          stop processing at the first error",
-    "-ini                    be initex, for dumping formats; this is implicitly",
-    "                          true if the program name is `initex'",
-    "-interaction=STRING     set interaction mode (STRING=batchmode/nonstopmode/",
-    "                          scrollmode/errorstopmode)",
-#ifdef IPC
-    "-ipc                    send DVI output to a socket as well as the usual",
-    "                          output file",
-    "-ipc-start              as -ipc, and also start the server at the other end",
-#endif /* IPC */
-    "-jobname=STRING         set the job name to STRING",
-    "-kpathsea-debug=NUMBER  set path searching debugging flags according to",
-    "                          the bits of NUMBER",
-    "[-no]-mktex=FMT         disable/enable mktexFMT generation (FMT=tex/tfm)",
-    "-mltex                  enable MLTeX extensions such as \\charsubdef",
-    "-output-comment=STRING  use STRING for DVI file comment instead of date",
-    "-output-directory=DIR   use existing DIR as the directory to write files in",
-    "[-no]-parse-first-line  disable/enable parsing of first line of input file",
-    "-progname=STRING        set program (and fmt) name to STRING",
-    "-recorder               enable filename recorder",
-    "[-no]-shell-escape      disable/enable \\write18{SHELL COMMAND}",
-    "-shell-restricted       enable restricted \\write18",
-    "-src-specials           insert source specials into the DVI file",
-    "-src-specials=WHERE     insert source specials in certain places of",
-    "                          the DVI file. WHERE is a comma-separated value",
-    "                          list: cr display hbox math par parend vbox",
-#if defined(__SyncTeX__)
-    "-synctex=NUMBER         generate SyncTeX data for previewers if nonzero",
-#endif
-    "-translate-file=TCXNAME use the TCX file TCXNAME",
-    "-8bit                   make all characters printable by default",
-    "-help                   display this help and exit",
-    "-version                output version information and exit",
-    NULL
-};
-#endif /* onlyTeX */
-
-#ifdef upTeX
-const_string based_prog_name = "TeX";
-const_string UPTEXHELP[] = {
-    "Usage: uptex [OPTION]... [TEXNAME[.tex]] [COMMANDS]",
-    "   or: uptex [OPTION]... \\FIRST-LINE",
-    "   or: uptex [OPTION]... &FMT ARGS",
-    "  Run upTeX on TEXNAME, usually creating TEXNAME.dvi.",
-    "  Any remaining COMMANDS are processed as upTeX input, after TEXNAME is read.",
-    "  If the first line of TEXNAME is %&FMT, and FMT is an existing .fmt file,",
-    "  use it.  Else use `NAME.fmt', where NAME is the program invocation name,",
-    "  most commonly `uptex'.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a backslash,",
-    "  interpret all non-option arguments as a line of upTeX input.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a &, the",
-    "  next word is taken as the FMT to read, overriding all else.  Any",
-    "  remaining arguments are processed as above.",
-    "",
-    "  If no arguments or options are specified, prompt for input.",
-    "",
-    "-fmt=NAME               use NAME instead of program name or %&format.",
-#if defined(WIN32)
-    "[-no]-guess-input-enc   disable/enable to guess input file encoding",
-#endif
-    "-halt-on-error          stop processing at the first error",
-    "[-no]-file-line-error   disable/enable file:line:error style messages",
-    "-ini                    be iniptex.",
-    "-interaction=STRING     set interaction mode (STRING=batchmode|nonstopmode|",
-    "                          scrollmode|errorstopmode)",
-#ifdef IPC
-    "-ipc                    send DVI output to a socket as well as the usual",
-    "                          output file",
-    "-ipc-start              as -ipc, and also start the server at the other end",
-#endif /* IPC */
-    "-jobname=STRING         set the job name to STRING",
-    "-kanji=STRING           set Japanese encoding (STRING=euc|jis|sjis|utf8|uptex)",
-    "-kanji-internal=STRING  set Japanese internal encoding (STRING=euc|sjis|uptex)",
-    "-kpathsea-debug=NUMBER  set path searching debugging flags according to",
-    "                          the bits of NUMBER",
-    "[-no]-mktex=FMT         disable/enable mktexFMT generation (FMT=tex/tfm)",
-    "-mltex                  enable MLTeX extensions such as \\charsubdef",
-    "-output-comment=STRING  use STRING for DVI file comment instead of date",
-    "-output-directory=DIR   use existing DIR as the directory to write files in",
-    "[-no]-parse-first-line  disable/enable parsing of first line of input file",
-    "-progname=STRING        set program (and fmt) name to STRING",
-    "-recorder               enable filename recorder",
-    "[-no]-shell-escape      disable/enable \\write18{SHELL COMMAND}",
-    "-shell-restricted       enable restricted \\write18",
-#if defined(WIN32)
-    "-sjis-terminal          always output to stdout and stderr by CP932",
-#endif
-    "-src-specials           insert source specials into the DVI file",
-    "-src-specials=WHERE     insert source specials in certain places of",
-    "                          the DVI file. WHERE is a comma-separated value",
-    "                          list: cr display hbox math par parend vbox",
-#if defined(__SyncTeX__)
-    "-synctex=NUMBER         generate SyncTeX data for previewers if nonzero",
-#endif
-    "-translate-file=TCXNAME use the TCX file TCXNAME",
-    "-help                   print this message and exit.",
-    "-version                print version information and exit.",
-    NULL
-};
-#endif /* upTeX */
-
-#ifdef XeTeX
-const_string XETEXHELP[] = {
-    "Usage: xetex [OPTION]... [TEXNAME[.tex]] [COMMANDS]",
-    "   or: xetex [OPTION]... \\FIRST-LINE",
-    "   or: xetex [OPTION]... &FMT ARGS",
-    "  Run XeTeX on TEXNAME, usually creating TEXNAME.pdf.",
-    "  Any remaining COMMANDS are processed as XeTeX input, after TEXNAME is read.",
-    "  If the first line of TEXNAME is %&FMT, and FMT is an existing .fmt file,",
-    "  use it.  Else use `NAME.fmt', where NAME is the program invocation name,",
-    "  most commonly `xetex'.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a backslash,",
-    "  interpret all non-option arguments as a line of XeTeX input.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a &, the",
-    "  next word is taken as the FMT to read, overriding all else.  Any",
-    "  remaining arguments are processed as above.",
-    "",
-    "  If no arguments or options are specified, prompt for input.",
-    "",
-    "-etex                   enable e-TeX extensions",
-    "[-no]-file-line-error   disable/enable file:line:error style messages",
-    "-fmt=FMTNAME            use FMTNAME instead of program name or a %& line",
-    "-halt-on-error          stop processing at the first error",
-    "-ini                    be xeinitex, for dumping formats; this is implicitly",
-    "                          true if the program name is `xeinitex'",
-    "-interaction=STRING     set interaction mode (STRING=batchmode/nonstopmode/",
-    "                          scrollmode/errorstopmode)",
-    "-jobname=STRING         set the job name to STRING",
-    "-kpathsea-debug=NUMBER  set path searching debugging flags according to",
-    "                          the bits of NUMBER",
-    "[-no]-mktex=FMT         disable/enable mktexFMT generation (FMT=tex/tfm)",
-    "-mltex                  enable MLTeX extensions such as \\charsubdef",
-    "-output-comment=STRING  use STRING for XDV file comment instead of date",
-    "-output-directory=DIR   use existing DIR as the directory to write files in",
-    "-output-driver=CMD      use CMD as the XDV-to-PDF driver instead of xdvipdfmx",
-    "-no-pdf                 generate XDV (extended DVI) output rather than PDF",
-    "[-no]-parse-first-line  disable/enable parsing of first line of input file",
-    "-papersize=STRING       set PDF media size to STRING",
-    "-progname=STRING        set program (and fmt) name to STRING",
-    "-recorder               enable filename recorder",
-    "[-no]-shell-escape      disable/enable \\write18{SHELL COMMAND}",
-    "-shell-restricted       enable restricted \\write18",
-    "-src-specials           insert source specials into the XDV file",
-    "-src-specials=WHERE     insert source specials in certain places of",
-    "                          the XDV file. WHERE is a comma-separated value",
-    "                          list: cr display hbox math par parend vbox",
-#if defined(__SyncTeX__)
-    "-synctex=NUMBER         generate SyncTeX data for previewers if nonzero",
-#endif
-    "-translate-file=TCXNAME (ignored)",
-    "-8bit                   make all characters printable, don't use ^^X sequences",
-    "-help                   display this help and exit",
-    "-version                output version information and exit",
-    NULL
-};
-#endif /* XeTeX */
-
-#ifdef PUTeX
-const_string PUTEXHELP[] = {
-    "Usage: putex [OPTION]... [TEXNAME[.tex]] [COMMANDS]",
-    "   or: putex [OPTION]... \\FIRST-LINE",
-    "   or: putex [OPTION]... &FMT ARGS",
-    "  Run PUTeX on TEXNAME, usually creating TEXNAME.cdi.",
-    "  Any remaining COMMANDS are processed as TeX input, after TEXNAME is read.",
-    "  If the first line of TEXNAME is %&FMT, and FMT is an existing .fmt file,",
-    "  use it.  Else use `NAME.fmt', where NAME is the program invocation name,",
-    "  most commonly `putex'.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a backslash,",
-    "  interpret all non-option arguments as a line of PUTeX input.",
-    "",
-    "  Alternatively, if the first non-option argument begins with a &, the",
-    "  next word is taken as the FMT to read, overriding all else.  Any",
-    "  remaining arguments are processed as above.",
-    "",
-    "  If no arguments or options are specified, prompt for input.",
-    "",
-    "[-no]-file-line-error   disable/enable file:line:error style messages",
-    "-fmt=FMTNAME            use FMTNAME instead of program name or a %& line",
-    "-halt-on-error          stop processing at the first error",
-    "-ini                    be initex, for dumping formats; this is implicitly",
-    "                          true if the program name is `initex'",
-    "-interaction=STRING     set interaction mode (STRING=batchmode/nonstopmode/",
-    "                          scrollmode/errorstopmode)",
-#ifdef IPC
-    "-ipc                    send CDI output to a socket as well as the usual",
-    "                          output file",
-    "-ipc-start              as -ipc, and also start the server at the other end",
-#endif /* IPC */
-    "-jobname=STRING         set the job name to STRING",
-    "-kpathsea-debug=NUMBER  set path searching debugging flags according to",
-    "                          the bits of NUMBER",
-    "[-no]-mktex=FMT         disable/enable mktexFMT generation (FMT=tex/tfm)",
-    "-output-comment=STRING  use STRING for CDI file comment instead of date",
-    "-output-directory=DIR   use existing DIR as the directory to write files in",
-    "[-no]-parse-first-line  disable/enable parsing of first line of input file",
-    "-progname=STRING        set program (and fmt) name to STRING",
-    "-recorder               enable filename recorder",
-    "[-no]-shell-escape      disable/enable \\write18{SHELL COMMAND}",
-    "-shell-restricted       enable restricted \\write18",
-    "-src-specials           insert source specials into the DVI file",
-    "-src-specials=WHERE     insert source specials in certain places of",
-    "                          the DVI file. WHERE is a comma-separated value",
-    "                          list: cr display hbox math par parend vbox",
-#if defined(__SyncTeX__)
-    "-synctex=NUMBER         generate SyncTeX data for previewers if nonzero",
-#endif
-    "-help                   display this help and exit",
-    "-version                output version information and exit",
-    NULL
-};
-#endif /* PUTeX */
-#endif /* TEXMFMP_HELP */
diff --git a/src/web2c/texmfmp.h b/src/web2c/texmfmp.h
deleted file mode 100644 (file)
index e15962b..0000000
+++ /dev/null
@@ -1,380 +0,0 @@
-/* texmf.h: Main include file for TeX and Metafont in C. This file is
-   included by {tex,mf}d.h, which is the first include in the C files
-   output by web2c.  */
-
-#include "cpascal.h"
-#include <kpathsea/c-pathch.h> /* for IS_DIR_SEP, used in the change files */
-#include <kpathsea/tex-make.h> /* for kpse_make_tex_discard_errors */
-
-#ifdef XeTeX
-#ifdef XETEX_MAC
-/* include this here to avoid conflict between clang's emmintrin.h and
- * texmfmem.h. Should be removed once a fixed clang is widely available
- * http://llvm.org/bugs/show_bug.cgi?id=14964 */
-#include <ApplicationServices/ApplicationServices.h>
-#endif
-/* added typedefs for unicodefile and voidpointer */
-#define XETEX_UNICODE_FILE_DEFINED     1
-typedef struct {
-  FILE *f;
-  long  savedChar;
-  short skipNextLF;
-  short encodingMode;
-  void *conversionData;
-} UFILE;
-typedef UFILE* unicodefile;
-
-typedef void* voidpointer;
-#endif
-
-/* If we have these macros, use them, as they provide a better guide to
-   the endianess when cross-compiling. */
-#if defined (BYTE_ORDER) && defined (BIG_ENDIAN) && defined (LITTLE_ENDIAN)
-#ifdef WORDS_BIGENDIAN
-#undef WORDS_BIGENDIAN
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
-#define WORDS_BIGENDIAN
-#endif
-#endif
-/* More of the same, but now NeXT-specific. */
-#ifdef NeXT
-#ifdef WORDS_BIGENDIAN
-#undef WORDS_BIGENDIAN
-#endif
-#ifdef __BIG_ENDIAN__
-#define WORDS_BIGENDIAN
-#endif
-#endif
-
-/* Some things are the same except for the name.  */
-#ifdef TeX
-#if defined (pdfTeX)
-#define TEXMFPOOLNAME "pdftex.pool"
-#define TEXMFENGINENAME "pdftex"
-#elif defined (eTeX)
-#define TEXMFPOOLNAME "etex.pool"
-#define TEXMFENGINENAME "etex"
-#elif defined (XeTeX)
-#define TEXMFPOOLNAME "xetex.pool"
-#define TEXMFENGINENAME "xetex"
-#elif defined (Aleph)
-#define TEXMFPOOLNAME "aleph.pool"
-#define TEXMFENGINENAME "aleph"
-#elif defined (pTeX)
-#define TEXMFPOOLNAME "ptex.pool"
-#define TEXMFENGINENAME "ptex"
-#include "ptexdir/kanji.h"
-#elif defined (epTeX)
-#define TEXMFPOOLNAME "eptex.pool"
-#define TEXMFENGINENAME "eptex"
-#include "ptexdir/kanji.h"
-#elif defined (upTeX)
-#define TEXMFPOOLNAME "uptex.pool"
-#define TEXMFENGINENAME "uptex"
-#include "uptexdir/kanji.h"
-#elif defined (eupTeX)
-#define TEXMFPOOLNAME "euptex.pool"
-#define TEXMFENGINENAME "euptex"
-#include "uptexdir/kanji.h"
-#elif defined (PUTeX)
-#define TEXMFPOOLNAME "putex.pool"
-#define TEXMFENGINENAME "putex"
-#else
-#define TEXMFPOOLNAME "tex.pool"
-#define TEXMFENGINENAME "tex"
-#endif
-#define DUMP_FILE fmtfile
-#define DUMP_FORMAT kpse_fmt_format
-#define writedvi WRITE_OUT
-#define flushdvi flush_out
-#define OUT_FILE dvifile
-#define OUT_BUF dvibuf
-#endif /* TeX */
-#ifdef MF
-#define TEXMFPOOLNAME "mf.pool"
-#define TEXMFENGINENAME "metafont"
-#define DUMP_FILE basefile
-#define DUMP_FORMAT kpse_base_format
-#define writegf WRITE_OUT
-#define OUT_FILE gffile
-#define OUT_BUF gfbuf
-#endif /* MF */
-
-/* Restore underscores.  */
-#define kpsedvipsconfigformat kpse_dvips_config_format
-#define kpsefontmapformat kpse_fontmap_format
-#define kpsemfpoolformat kpse_mfpool_format
-#define kpsempformat kpse_mp_format
-#define kpsemppoolformat kpse_mppool_format
-#define kpsetexpoolformat kpse_texpool_format
-#define kpsetexformat kpse_tex_format
-
-/* Hacks for TeX that are better not to #ifdef, see lib/openclose.c.  */
-extern int tfmtemp, texinputtype;
-
-/* pdfTeX routines also used for e-pTeX and e-upTeX */
-#if defined (pdfTeX) || defined (epTeX) || defined (eupTeX)
-extern char start_time_str[];
-extern void pdftex_fail(const char *fmt, ...);
-extern void initstarttime(void);
-extern char *makecstring(integer s);
-extern char *makecfilename(integer s);
-extern void getcreationdate(void);
-extern void getfilemoddate(integer s);
-extern void getfilesize(integer s);
-#endif
-
-/* pdftex etc. except for tex use these for pipe support */
-#if defined(TeX) && !defined(onlyTeX)
-extern boolean open_in_or_pipe (FILE **, int, const_string fopen_mode);
-extern boolean open_out_or_pipe (FILE **, const_string fopen_mode);
-extern void close_file_or_pipe (FILE *);
-#define ENABLE_PIPES 1
-#else
-#define ENABLE_PIPES 0
-#endif
-
-/* Executing shell commands.  */
-extern int runsystem (const char *cmd);
-
-/* The entry point.  */
-extern void maininit (int ac, string *av);
-#if defined(WIN32) && !defined(__MINGW32__) && defined(DLLPROC)
-extern __declspec(dllexport) int DLLPROC (int ac, string *av);
-#endif
-
-/* All but the Omega family use this. */
-#if !defined(Aleph)
-extern void readtcxfile (void);
-extern string translate_filename;
-#define translatefilename translate_filename
-#endif
-
-#ifdef TeX
-/* The type `glueratio' should be a floating point type which won't
-   unnecessarily increase the size of the memoryword structure.  This is
-   the basic requirement.  On most machines, if you're building a
-   normal-sized TeX, then glueratio must probably meet the following
-   restriction: sizeof(glueratio) <= sizeof(integer).  Usually, then,
-   glueratio must be `float'.  But if you build a big TeX, you can (on
-   most machines) and should make it `double' to avoid loss of precision
-   and conversions to and from double during calculations.  (All this
-   also goes for Metafont.)  Furthermore, if you have enough memory, it
-   won't hurt to have this defined to be `double' for running the
-   trip/trap tests.
-   
-   This type is set automatically to `float' by configure if a small TeX
-   is built.  */
-#ifndef GLUERATIO_TYPE
-#define GLUERATIO_TYPE double
-#endif
-typedef GLUERATIO_TYPE glueratio;
-
-#if defined(__DJGPP__) && defined (IPC)
-#undef IPC
-#endif
-
-#ifdef IPC
-extern void ipcpage (int);
-#endif /* IPC */
-#endif /* TeX */
-\f
-/* How to flush the DVI file.  */
-#define flush_out() fflush (OUT_FILE)
-
-/* Used to write to a TFM file.  */
-#define put2bytes(f, h) do { \
-    integer v = (integer) (h); putbyte (v >> 8, f);  putbyte (v & 0xff, f); \
-  } while (0)
-#define put4bytes(f, w) do { \
-    integer v = (integer) (w); \
-    putbyte (v >> 24, f); putbyte (v >> 16, f); \
-    putbyte (v >> 8, f);  putbyte (v & 0xff, f); \
-  } while (0)
-
-/* Read a line of input as quickly as possible.  */
-#define        inputln(stream, flag) input_line (stream)
-#ifdef XeTeX
-extern boolean input_line (UFILE *);
-#else
-extern boolean input_line (FILE *);
-#endif
-
-/* This routine has to return four values.  */
-#define        dateandtime(i,j,k,l) get_date_and_time (&(i), &(j), &(k), &(l))
-extern void get_date_and_time (integer *, integer *, integer *, integer *);
-
-#if defined(pdfTeX)
-/* Get high-res time info. */
-#define secondsandmicros(i,j) get_seconds_and_micros (&(i), &(j))
-extern void get_seconds_and_micros (integer *, integer *);
-#endif
-
-/* Copy command-line arguments into the buffer, despite the name.  */
-extern void topenin (void);
-
-/* Can't prototype this since it uses poolpointer and ASCIIcode, which
-   are defined later in mfd.h, and mfd.h uses stuff from here.  */
-/* Therefore the department of ugly hacks decided to move this declaration
-   to the *coerce.h files. */
-/* extern void calledit (); */
-
-/* These defines reroute the file i/o calls to the new pipe-enabled 
-   functions in texmfmp.c*/
-
-#if ENABLE_PIPES
-#undef aopenin
-#undef aopenout
-#undef aclose
-#define aopenin(f,p)  open_in_or_pipe(&(f),p,FOPEN_RBIN_MODE)
-#define aopenout(f)   open_out_or_pipe(&(f),FOPEN_W_MODE)
-#define aclose(f)     close_file_or_pipe(f)
-#endif
-
-/* `bopenin' (and out) is used only for reading (and writing) .tfm
-   files; `wopenin' (and out) only for dump files.  The filenames are
-   passed in as a global variable, `nameoffile'.  */
-#define bopenin(f)     open_input (&(f), kpse_tfm_format, FOPEN_RBIN_MODE)
-#define ocpopenin(f)   open_input (&(f), kpse_ocp_format, FOPEN_RBIN_MODE)
-#define ofmopenin(f)   open_input (&(f), kpse_ofm_format, FOPEN_RBIN_MODE)
-
-#define bopenout(f)    open_output (&(f), FOPEN_WBIN_MODE)
-#define bclose         aclose
-#ifdef XeTeX
-/* f is declared as gzFile, but we temporarily use it for a FILE *
-   so that we can use the standard open calls */
-#define wopenin(f)     (open_input ((FILE**)&(f), DUMP_FORMAT, FOPEN_RBIN_MODE) \
-                                               && (f = gzdopen(fileno((FILE*)f), FOPEN_RBIN_MODE)))
-#define wopenout(f)    (open_output ((FILE**)&(f), FOPEN_WBIN_MODE) \
-                                               && (f = gzdopen(fileno((FILE*)f), FOPEN_WBIN_MODE)) \
-                                               && (gzsetparams(f, 1, Z_DEFAULT_STRATEGY) == Z_OK))
-#define wclose(f)      gzclose(f)
-#else
-#define wopenin(f)     open_input (&(f), DUMP_FORMAT, FOPEN_RBIN_MODE)
-#define wopenout       bopenout
-#define wclose         aclose
-#endif
-
-#ifdef XeTeX
-#if ENABLE_PIPES
-extern boolean u_open_in_or_pipe(unicodefile* f, integer filefmt, const_string fopen_mode, integer mode, integer encodingData);
-#define uopenin(f,p,m,d) u_open_in_or_pipe(&(f), p, FOPEN_RBIN_MODE, m, d)
-#else
-#define uopenin(f,p,m,d) u_open_in(&(f), p, FOPEN_RBIN_MODE, m, d)
-#endif
-#endif
-
-/* Used in tex.ch (section 1338) to get a core dump in debugging mode.  */
-#ifdef unix
-#define dumpcore abort
-#else
-#define dumpcore uexit (1)
-#endif
-
-#ifdef MF
-extern boolean initscreen (void);
-extern void updatescreen (void);
-/* Can't prototype these for same reason as `calledit' above.  */
-#if 0  /* Therefore the real declaration is found in the coerce.h files.  */
-extern void blankrectangle (/*screencol, screencol, screenrow, screenrow*/);
-extern void paintrow (/*screenrow, pixelcolor, transspec, screencol*/);
-#endif
-#endif /* MF */
-
-\f
-/* (Un)dumping.  These are 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)
-
-/* Like do_undump, but check each value against LOW and HIGH.  The
-   slowdown isn't significant, and this improves the chances of
-   detecting incompatible format files.  In fact, Knuth himself noted
-   this problem with Web2c some years ago, so it seems worth fixing.  We
-   can't make this a subroutine because then we lose the type of BASE.  */
-#define undumpcheckedthings(low, high, base, len)                      \
-  do {                                                                  \
-    unsigned i;                                                         \
-    undumpthings (base, len);                                           \
-    for (i = 0; i < (len); i++) {                                       \
-      if ((&(base))[i] < (low) || (&(base))[i] > (high)) {              \
-        FATAL5 ("Item %u (=%ld) of .fmt array at %lx <%ld or >%ld",     \
-                i, (unsigned long) (&(base))[i], (unsigned long) &(base),\
-                (unsigned long) low, (unsigned long) high);                   \
-      }                                                                 \
-    }                                                                  \
-  } while (0)
-
-/* Like undump_checked_things, but only check the upper value. We use
-   this when the base type is unsigned, and thus all the values will be
-   greater than zero by definition.  */
-#define undumpuppercheckthings(high, base, len)                                \
-  do {                                                                  \
-    unsigned i;                                                         \
-    undumpthings (base, len);                                           \
-    for (i = 0; i < (len); i++) {                                       \
-      if ((&(base))[i] > (high)) {                                     \
-        FATAL4 ("Item %u (=%ld) of .fmt array at %lx >%ld",            \
-                i, (unsigned long) (&(base))[i], (unsigned long) &(base),\
-                (unsigned long) high);                                         \
-      }                                                                 \
-    }                                                                  \
-  } while (0)
-
-/* We define the routines to do the actual work in texmf.c.  */
-#ifdef XeTeX
-#include <zlib.h>
-extern void do_dump (char *, int, int, gzFile);
-extern void do_undump (char *, int, int, gzFile);
-#else
-extern void do_dump (char *, int, int, FILE *);
-extern void do_undump (char *, int, int, FILE *);
-#endif
-
-/* 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 dumpwd   generic_dump
-#define dumphh   generic_dump
-#define dumpqqqq generic_dump
-#define undumpwd   generic_undump
-#define undumphh   generic_undump
-#define        undumpqqqq generic_undump
-
-/* `dump_int' is called with constant integers, so we put them into a
-   variable first.  */
-#define        dumpint(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.  */
-#if defined(REGFIX) || defined(WIN32)
-#define undumpint(x)                                                   \
-  do                                                                   \
-    {                                                                  \
-      integer x_val;                                                   \
-      generic_undump (x_val);                                          \
-      x = x_val;                                                       \
-    }                                                                  \
-  while (0)
-#else
-#define        undumpint generic_undump
-#endif
-
-/* Handle SyncTeX, if requested */
-#if defined(TeX)
-# if defined(__SyncTeX__)
-#  include "synctexdir/synctex-common.h"
-extern char *generic_synctex_get_current_name(void);
-# endif
-#endif
-\f
diff --git a/src/web2c/web2c/convert b/src/web2c/web2c/convert
deleted file mode 100644 (file)
index a010d1a..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-#!/bin/sh
-# Convert WEB programs not needing special treatment to C.
-
-: ${srcdir=.}
-
-usage="Usage: $0 BASE
-
-BASE is the root part of the file to be converted; it is extended with
-.p to make the name of the (input) Pascal file, and extended with .c and
-.h to make the name of the main (output) C files.  Additional files
-BASEini.c, BASEd.h, BASEcoerce.h are created for the larger programs.
-"
-
-basefile=
-while test $# -gt 0; do
-  case $1 in
-    -*) echo "$1?" >&2; echo "$usage" >&2; exit 1;;
-     *) if test -n "$basefile"; then
-          echo "$1?" >&2; echo "$usage" >&2; exit 1; fi
-        basefile=$1;;
-  esac
-  shift
-done
-if test -z "$basefile"; then
-  echo "$0: missing base (Pascal) file argument." >&2
-  echo "$usage" >&2
-  exit 1
-fi
-
-pascalfile=$basefile.p
-cfile=$basefile.c
-
-# This is for tangleboot if the build and source directories are different.
-test -r $pascalfile || pascalfile=$srcdir/$pascalfile
-
-# We use cpascal.h by default instead of config.h because straight C
-# routines can only be confused by the definitions for `chr', etc.
-hfile=cpascal.h
-more_defines=
-web2c_options=-c$basefile
-precmd=
-midcmd=
-fixwrites_options=
-# This used to have various values to control the number of *tex[0-9].c files.
-# We now avoid to split the C code for MF and all TeX-like engines.
-splitup_options="-i -l 65000"
-postcmd=
-output="> $cfile"
-output_files="$cfile $basefile.h"
-
-case $basefile in
-  pbibtex|pdvitype|ppltotf|ptftopl)
-    more_defines="$srcdir/ptexdir/ptex.defines"
-    hfile=ptexdir/kanji.h
-    ;;
-  upbibtex|updvitype|uppltotf|uptftopl)
-    more_defines="$srcdir/uptexdir/uptex.defines"
-    hfile=uptexdir/kanji.h
-    ;;
-esac
-
-case $basefile in
-  bibtex|pbibtex|upbibtex)
-    midcmd="| sed -f $srcdir/web2c/cvtbib.sed"
-    ;;
-
-  mf|tex|aleph|etex|pdftex|ptex|eptex|euptex|uptex|xetex|putex)
-    case $basefile in
-      mf)
-        more_defines="$srcdir/web2c/texmf.defines $srcdir/web2c/mfmp.defines"
-        precmd="| sed -f $srcdir/web2c/cvtmf1.sed"
-        web2c_options="-m -c${basefile}coerce"
-        midcmd="| sed -f $srcdir/web2c/cvtmf2.sed"
-        ;;
-
-      *)
-        more_defines="$srcdir/web2c/texmf.defines $srcdir/synctexdir/synctex.defines"
-        prog_defines="$srcdir/${basefile}dir/$basefile.defines"
-        if test -f $prog_defines; then
-          more_defines="$more_defines $prog_defines"
-        fi
-        web2c_options="-t -c${basefile}coerce"
-        fixwrites_options=-t
-        ;;
-    esac
-    hfile=texmfmp.h
-    postcmd="| ./web2c/splitup $splitup_options $basefile"
-    cfile=${basefile}0.c # last output file, or thereabouts
-    output=
-    output_files="$basefile[0-9].c ${basefile}ini.c ${basefile}d.h \
-                  ${basefile}coerce.h"
-    ;;
-esac
-
-# Do it.
-#set -x
-eval "cat $srcdir/web2c/common.defines $more_defines $pascalfile \
-  $precmd \
-  | ./web2c/web2c -h$hfile $web2c_options \
-  $midcmd \
-  | ./web2c/fixwrites $fixwrites_options $basefile \
-  $postcmd \
-  $output"
-
-# Using the above pipeline as the condition of an if does no good, since
-# typical sh's use the status of the first command as the pipeline result.
-# So check for an empty output file, or one with the error marker we put in.
-if test ! -s $cfile || grep @error@ $output_files >/dev/null; then
-  : ${TMPDIR=/tmp}
-  # Don't just delete it, since it may be useful for debugging.
-  echo "$0: conversion of $pascalfile failed, moving dregs:" >&2
-  cmd="mv $output_files $TMPDIR"
-  (cd $TMPDIR && rm -f $output_files)
-  echo "$0:   $cmd" >&2
-  $cmd
-  exit 1
-fi
-
-case $basefile in
-  bibtex|pbibtex|upbibtex)
-    sed -e 's/(buftype)//g' -e 's/(pdstype)//g' <$basefile.h >x$basefile.h
-    mv x$basefile.h $basefile.h
-    ;;
-  mf|tex|aleph|etex|pdftex|ptex|eptex|euptex|uptex|xetex|putex)
-    sleep 2 # so timestamps are definitely later, to avoid make weirdness
-    cat $srcdir/web2c/coerce.h >>${basefile}coerce.h
-    touch ${basefile}d.h
-    ;;
-esac
-
-exit 0
diff --git a/src/web2c/web2c/splitup.c b/src/web2c/web2c/splitup.c
deleted file mode 100644 (file)
index 5e652c9..0000000
+++ /dev/null
@@ -1,249 +0,0 @@
-/* splitup -- take TeX or MF in C as a single stream on stdin,
-   and it produces several .c and .h files in the current directory
-   as its output.
-
-   $Id: splitup.c 27708 2012-09-18 17:43:20Z peter $
-
-   Tim Morgan  September 19, 1987.  */
-
-#include <w2c/config.h>
-#include <kpathsea/getopt.h>
-
-#if defined (FATAL)
-#undef FATAL
-#endif
-
-#define FATAL(str) do {                                                 \
-        fprintf (stderr, "%s: fatal: ", argv[0]);                       \
-        fputs (str, stderr);                                            \
-        fputs (".\n", stderr); exit (1); } while (0)
-
-
-#if defined (FATAL1)
-#undef FATAL1
-#endif
-
-#define FATAL1(str, e1) do {                                            \
-        fprintf (stderr, "%s: fatal: ", argv[0]);                       \
-        fprintf (stderr, str, e1);                                      \
-        fputs (".\n", stderr); exit (1); } while (0)
-
-
-#ifdef VMS
-#define unlink delete
-#endif
-
-int filenumber = 0, ifdef_nesting = 0, lines_in_file = 0;
-char *output_name = NULL;
-boolean has_ini;
-
-/* This used to be a fixed 2000, but since bibtex.c is almost 10000 lines
-   (200+K), we may as well decrease the number of split files we create.
-   Probably faster for the compiler, definitely faster for the linker,
-   simpler for the Makefiles, and generally better.  Now we specify this
-   in 'convert'. */
-long int max_lines;
-
-/* Do we split out a separate *ini.c file? */
-boolean do_ini;
-
-/* Don't need long filenames, since we generate them all.  */
-char buffer[1024], tempfile[100], filename[100], ini_name[100];
-
-FILE *out, *ini, *temp;
-
-/*
- * Read a line of input into the buffer, returning `false' on EOF.
- * If the line is of the form "#ifdef INI...", we set "has_ini"
- * `true' else `false'.  We also keep up with the #ifdef/#endif nesting
- * so we know when it's safe to finish writing the current file.
- */
-static int
-read_line (void)
-{
-  if (fgets (buffer, sizeof (buffer), stdin) == NULL)
-    return false;
-  if (strncmp (buffer, "#ifdef", 6) == 0
-      || strncmp (buffer, "#ifndef", 7) == 0)
-    {
-      ++ifdef_nesting;
-      if (strncmp (&buffer[7], "INI", 3) == 0)
-       has_ini = true;
-    }
-  else if (strncmp (buffer, "#endif", 6) == 0)
-    --ifdef_nesting;
-  return true;
-}
-\f
-#ifdef WIN32
-#include <io.h>
-#include <fcntl.h>
-#endif
-
-int
-main (int argc, string *argv)
-{
-  const_string coerce;
-  unsigned coerce_len;
-  int option;
-
-#ifdef WIN32
-  setmode(fileno(stdout), _O_BINARY);
-#endif
-
-  while ((option = getopt(argc, argv, "il:")) != -1) {
-    switch (option) {
-    case 'i':
-      do_ini = true;
-      break;
-    case 'l':
-      max_lines = atoi(optarg);
-      if (max_lines <= 0)
-        FATAL("[-i] [-l lines] name");
-      break;
-    default:
-      FATAL("[-i] [-l lines] name");
-      break;
-    }
-  }
-  if (optind + 1 != argc)
-    FATAL("[-i] [-l lines] name");
-  output_name = argv[optind];
-
-  sprintf (filename, "%sd.h", output_name);
-  sprintf (tempfile, "%s.tmp", output_name);
-  out = xfopen (filename, FOPEN_W_MODE);
-  fputs ("#undef TRIP\n#undef TRAP\n", out);
-  /* We have only one binary that can do both ini stuff and vir stuff.  */
-  fputs ("#define STAT\n#define INI\n", out);
-  
-  if (STREQ (output_name, "mf")) {
-    fputs ("#define INIMF\n#define MF\n", out);
-    coerce = "mfcoerce.h";
-  } else if (STREQ (output_name, "tex")) {
-    fputs ("#define INITEX\n#define TeX\n#define onlyTeX\n", out);
-    coerce = "texcoerce.h";
-  } else if (STREQ (output_name, "aleph")) {
-    fputs ("#define INITEX\n#define TeX\n#define Aleph\n", out);
-    coerce = "alephcoerce.h";
-  } else if (STREQ (output_name, "etex")) {
-    fputs ("#define INITEX\n#define TeX\n#define eTeX\n", out);
-    coerce = "etexcoerce.h";
-  } else if (STREQ (output_name, "pdftex")) {
-    fputs ("#define INITEX\n#define TeX\n#define pdfTeX\n", out);
-    coerce = "pdftexcoerce.h";
-  } else if (STREQ (output_name, "ptex")) {
-    fputs ("#define INITEX\n#define TeX\n#define pTeX\n", out);
-    coerce = "ptexcoerce.h";
-  } else if (STREQ (output_name, "eptex")) {
-    fputs ("#define INITEX\n#define TeX\n#define epTeX\n", out);
-    coerce = "eptexcoerce.h";
-  } else if (STREQ (output_name, "euptex")) {
-    fputs ("#define INITEX\n#define TeX\n#define eupTeX\n", out);
-    coerce = "euptexcoerce.h";
-  } else if (STREQ (output_name, "uptex")) {
-    fputs ("#define INITEX\n#define TeX\n#define upTeX\n", out);
-    coerce = "uptexcoerce.h";
-  } else if (STREQ (output_name, "xetex")) {
-    fputs ("#define INITEX\n#define TeX\n#define XeTeX\n", out);
-    coerce = "xetexcoerce.h";
-  } else if (STREQ (output_name, "putex")) {
-    fputs ("#define INITEX\n#define TeX\n#define PUTeX\n", out);
-    coerce = "putexcoerce.h";
-  } else
-    FATAL1 ("Can only split mf, tex, aleph, eptex, euptex, etex, pdftex, ptex, uptex, xetex or putex,\n not %s", output_name);
-  
-  coerce_len = strlen (coerce);
-  
-  /* Read everything up to coerce.h.  */
-  while (fgets (buffer, sizeof (buffer), stdin))
-    {
-      if (strncmp (&buffer[10], coerce, coerce_len) == 0)
-       break;
-
-      if (buffer[0] == '#' || buffer[0] == '\n' || buffer[0] == '}'
-         || buffer[0] == '/' || buffer[0] == ' '
-         || strncmp (buffer, "typedef", 7) == 0)
-       /*nothing */ ;
-      else
-       fputs ("EXTERN ", out);
-
-      fputs (buffer, out);
-    }
-
-  if (strncmp (&buffer[10], coerce, coerce_len) != 0)
-    FATAL1 ("No #include %s line", coerce);
-
-  fputs (buffer, out);
-  xfclose (out, filename);
-
-  if (do_ini) {
-    sprintf (ini_name, "%sini.c", output_name);
-    ini = xfopen (ini_name, FOPEN_W_MODE);
-    fputs ("#define EXTERN extern\n", ini);
-    fprintf (ini, "#include \"%sd.h\"\n\n", output_name);
-  }
-
-  sprintf (filename, "%s0.c", output_name);
-  out = xfopen (filename, FOPEN_W_MODE);
-  fputs ("#define EXTERN extern\n", out);
-  fprintf (out, "#include \"%sd.h\"\n\n", output_name);
-
-  do
-    {
-      /* Read one routine into a temp file */
-      has_ini = false;
-      temp = xfopen (tempfile, "wb+");
-
-      while (read_line ())
-       {
-         fputs (buffer, temp);
-         if (buffer[0] == '}')
-           break;              /* End of procedure */
-       }
-      while (ifdef_nesting > 0 && read_line ())
-       fputs (buffer, temp);
-      rewind (temp);
-
-      if (do_ini && has_ini)
-       {                       /* Contained "#ifdef INI..." */
-         while (fgets (buffer, sizeof (buffer), temp))
-           fputs (buffer, ini);
-       }
-      else
-       {                       /* Doesn't contain "#ifdef INI..." */
-         while (fgets (buffer, sizeof (buffer), temp))
-           {
-             fputs (buffer, out);
-             lines_in_file++;
-           }
-       }
-      xfclose (temp, tempfile);
-
-      /* Switch to new output file.  */
-      if (max_lines && lines_in_file > max_lines)
-       {
-         xfclose (out, filename);
-         sprintf (filename, "%s%d.c", output_name, ++filenumber);
-         out = xfopen (filename, FOPEN_W_MODE);
-         fputs ("#define EXTERN extern\n", out);
-         fprintf (out, "#include \"%sd.h\"\n\n", output_name);
-         lines_in_file = 0;
-       }
-    }
-  while (!feof (stdin));
-
-  xfclose (out, filename);
-  if (lines_in_file == 0)
-    unlink (filename);
-
-  if (do_ini)
-    xfclose (ini, ini_name);
-
-  if (unlink (tempfile)) {
-      perror (tempfile);
-      exit (EXIT_FAILURE);
-  }
-
-  return EXIT_SUCCESS;
-}