OSDN Git Service

long options.
authormaqiyuan <maqiyuan@users.sourceforge.jp>
Mon, 5 May 2014 08:41:56 +0000 (16:41 +0800)
committermaqiyuan <maqiyuan@users.sourceforge.jp>
Mon, 5 May 2014 08:41:56 +0000 (16:41 +0800)
src/texsourc/itex.c
src/texsourc/local.c
src/texsourc/openinou.c
src/texsourc/subroute.c
src/texsourc/tex3.c
src/texsourc/texd.h
src/texsourc/yandy_pdf_backend.c

index 830760e..cd084d0 100644 (file)
@@ -2874,7 +2874,7 @@ void do_initex (void)
 /* sec 0047 */
 bool get_strings_started (void)
 {
-  integer k, l;
+  integer k;
   str_number g;
 
   pool_ptr = 0;
index 3c87b3b..671f4e6 100644 (file)
@@ -79,8 +79,8 @@ char *copyright    = "\nCopyright (C) 1993--2000 Y&Y, Inc.\n"
                      "it under the terms of the GNU General Public License as published by\n"
                      "the Free Software Foundation; either version 2 of the License, or\n"
                      "(at your option) any later version.\n\n  ";
-char *yandyversion = "2.2.3";
-char *application  = "Y&Y TeX"; /* 96/Jan/17 */
+char *yandyversion = "2.2.4";
+char *application  = "Y&Y TeX";
 char *tex_version  = "This is TeX, Version 3.14159265";
 
 clock_t start_time, main_time, finish_time;
@@ -131,9 +131,9 @@ void show_usage (void)
       " yandytex [-?ivnwdrzpK] [-m=ini_mem] [-e=hyph_size] [-h=trie_size]\n"
       "          [-x=xchr_file] [-k=key_file] [-o=dvi_dir] [-l=log_dir] [-a=aux_dir]\n"
       "          [+format_file] [tex_file]\n\n"
-      "    -?    show this usage summary\n"
-      "    -i    start up as iniTeX (create format file)\n"
-      "    -v    be verbose (show implementation version number)\n"
+      "    --help    -?    show this usage summary\n"
+      "    --initex  -i    start up as iniTeX (create format file)\n"
+      "    --verbose -v    be verbose (show implementation version number)\n"
       "    -n    do not allow `non ASCII' characters in input files (complain instead)\n"
       "    -w    do not show `non ASCII' characters in hexadecimal (show as is)\n"
       "    -d    do not allow DOS style file names - i.e. do not convert \\ to /\n"
@@ -242,19 +242,8 @@ void read_xchr_sub (FILE * xchr_input)
   int k, from, to, count = 0;
   char *s;
 
-#ifdef USEMEMSET
-  memset (xchr, NOTDEF, MAXCHRS);           /* mark unused */
-#else
-  for (k = 0; k < MAXCHRS; k++)
-    xchr[k] = -1; /* mark unused */
-#endif
-
-#ifdef USEMEMSET
-  memset (xord, NOTDEF, MAXCHRS);           /* mark unused */
-#else
-  for (k = 0; k < MAXCHRS; k++)
-    xord[k] = -1;  /* mark unused */
-#endif
+  memset (xchr, NOTDEF, MAXCHRS);
+  memset (xord, NOTDEF, MAXCHRS);
 
 #ifdef ALLOCATEBUFFER
   while (fgets(buffer, current_buf_size, xchr_input) != NULL)
@@ -270,9 +259,9 @@ void read_xchr_sub (FILE * xchr_input)
 
     if (from >= 0 && from < MAXCHRS && to >= 0 && to < MAXCHRS)
     {
-      if (xchr[from]== (unsigned char) NOTDEF)
+      if (xchr[from] == (unsigned char) NOTDEF)
       {
-        xchr[from]= (unsigned char) to;
+        xchr[from] = (unsigned char) to;
       }
       else
       {
@@ -280,33 +269,33 @@ void read_xchr_sub (FILE * xchr_input)
         show_line(log_line, 0);
       }
 
-      if (xord[to]== NOTDEF)
+      if (xord[to] == NOTDEF)
       {
-        xord[to]= (unsigned char) from;
+        xord[to] = (unsigned char) from;
       }
       else
       {
         sprintf(log_line, "NOTE: %s collision: %d => %d, %d\n", "xord", to, xord[to], from);
         show_line(log_line, 0);
       }
+
       count++;
     }
   }
 
-/*  now fill in the gaps */ /* not clear this is a good idea ... */
   for (k = 0; k < MAXCHRS; k++)
   {
-    if (xchr[k]== NOTDEF)   /* if it has not been filled */
+    if (xchr[k] == NOTDEF)   /* if it has not been filled */
     {
-      if (xord[k]== NOTDEF) /* see whether used already */
+      if (xord[k] == NOTDEF) /* see whether used already */
       {
-        xchr[k]= (unsigned char) k; /* no, so make identity */
-        xord[k]= (unsigned char) k; /* no, so make identity */
+        xchr[k] = (unsigned char) k; /* no, so make identity */
+        xord[k] = (unsigned char) k; /* no, so make identity */
       }
     }
   }
 
-  xchr[NOTDEF]= NOTDEF;         /* fixed point of mapping */
+  xchr[NOTDEF] = NOTDEF;         /* fixed point of mapping */
 
   if (trace_flag)
   {
@@ -315,7 +304,7 @@ void read_xchr_sub (FILE * xchr_input)
 
     for (k = 0; k < MAXCHRS; k++)
     {
-      if (xchr[k]!= NOTDEF)
+      if (xchr[k] != NOTDEF)
       {
         sprintf(log_line, "%d => %d\n", k, xchr[k]);
         show_line(log_line, 0);
@@ -334,34 +323,45 @@ void read_repl_sub (FILE * repl_input)
   int charnum[10];
   char *s, *t;
   
-#ifdef USEMEMSET
   memset(replacement, 0, MAXCHRS * sizeof(replacement[ 0]));
-#else
-  for (k = 0; k < MAXCHRS; k++)
-    replacement[k] = NULL;
-#endif
 
-  while (fgets(buffer, PATH_MAX, repl_input) != NULL) {
+
+  while (fgets(buffer, PATH_MAX, repl_input) != NULL)
+  {
     if (*buffer == '%' || *buffer == ';' || *buffer == '\n')
       continue;
 
     if ((m = sscanf (buffer, "%d%n %s", &chrs, &n, &charname)) == 0)
       continue;
-    else if (m == 2) {
-      if (*charname == '"') {   /* deal with quoted string "..." */
+    else if (m == 2)
+    {
+      if (*charname == '"')   /* deal with quoted string "..." */
+      {
         s = buffer + n;
         t = charname;
-        while (*s != '"' && *s != '\0') s++;  /* step up to " */
-        if (*s++ == '\0') continue;       /* sanity check */
-        while (*s != '\0') {  
-          if (*s == '"') {
+
+        while (*s != '"' && *s != '\0')
+          s++;  /* step up to " */
+
+        if (*s++ == '\0')
+          continue;       /* sanity check */
+
+        while (*s != '\0')
+        {
+          if (*s == '"')
+          {
             s++;            /* is it "" perhaps ? */
-            if (*s != '"') break;   /* no, end of string */
+
+            if (*s != '"')
+              break;   /* no, end of string */
           }
+
           *t++ = *s++;          /* copy over */
         }
+
         *t = '\0';              /* and terminate */
       }
+
       if (chrs >= 0 && chrs < MAXCHRS)
         replacement[chrs] = xstrdup(charname);
     }
@@ -381,10 +381,15 @@ void read_repl_sub (FILE * repl_input)
       show_line(log_line, 1);
     }
   }
-  if (trace_flag) {                  /* debugging output */
+
+  if (trace_flag)
+  {
     show_line("Key replacement table\n", 0);
-    for (k = 0; k < MAXCHRS; k++) {
-      if (replacement[k] != NULL) {
+
+    for (k = 0; k < MAXCHRS; k++)
+    {
+      if (replacement[k] != NULL)
+      {
         sprintf(log_line, "%d\t%s\n", k, replacement[k]);
         show_line(log_line, 0);
       }
@@ -670,10 +675,6 @@ void memory_error (char *s, int n)
   sprintf(log_line, "\n! Unable to allocate %d bytes for %s\n", n, s);
   show_line(log_line, 1);
   show_maximums(stderr);
-
-/*  exit (1); */      /* 94/Jan/22 */
-/*  return to let TeX do its thing (such as complain about runaway) */
-/*  don't set abort_flag here */
 }
 
 void trace_memory (char *s, int n)
@@ -2061,11 +2062,14 @@ int test_align (int address, int size, char *name)
 
 void check_fixed_align (int flag)
 {
-  if (test_align ((int) &mem_top, 4, "FIXED ALIGNMENT")) {
+  if (test_align ((int) &mem_top, 4, "FIXED ALIGNMENT"))
+  {
     show_line("PLEASE RECOMPILE ME!\n", 1);
   }
 #ifdef CHECKALIGNMENT
-  if (!flag) return;
+  if (!flag)
+    return;
+
   test_align ((int) &mem_top, 4, "mem_top");
   test_align ((int) &mem_max, 4, "mem_max");
   test_align ((int) &mem_min, 4, "mem_min");
@@ -2216,38 +2220,28 @@ void check_alloc_align (int flag)
 #endif
 }
 
-/* *** *** *** *** *** *** *** NEW APPROACH TO `ENV VARS' *** *** *** *** */
-
-/* grab `env var' from `dviwindo.ini' - or from DOS environment 94/May/19  */
-/* controlled by USEDVIWINDOINI environment variable            94/June/19 */
-
-bool usedviwindo        = true;               /* use [Environment] section in `dviwindo.ini' */
 bool backwardflag       = false;              /* don't cripple all advanced features */
 bool shorten_file_name  = false;              /* don't shorten file names to 8+3 for DOS */
-char *inifilename       = "dviwindo.ini";     /* name of ini file we look for */
-char *dviwindo          = "";                 /* full file name for dviwindo.ini with path */
-char *envsection        = "[Environment]";    /* Env var section in `dviwindo.ini' */
-char *wndsection        = "[Window]";         /* Window section in `dviwindo.ini' */
-char *workdirect        = "WorkingDirectory"; /* key in [Window] section */
 bool usesourcedirectory = true;               /* use source file directory as local when WorkingDirectory is set */
 bool workingdirectory   = false;              /* if working directory set in ini */
 
 /* cache to prevent allocating twice in a row */
 
-char *lastname=NULL, *lastvalue=NULL;
+char *lastname = NULL, *lastvalue = NULL;
 
 /* get value of env var - try first in dviwindo.ini then DOS env */
 /* returns allocated string -- these strings are not freed again */
 /* is it safe to do that now ? 98/Jan/31 */
 char *grabenv (char *varname)
 {
-  char line[PATH_MAX];
-  FILE *pinput;
   char *s;
-  int m, n;
 
-  if (varname == NULL) return NULL;    /* sanity check */
-  if (*varname == '\0') return NULL;   /* sanity check */
+  if (varname == NULL)
+    return NULL;
+
+  if (*varname == '\0')
+    return NULL;
+
 /*  speedup to avoid double lookup when called from set_paths in ourpaths.c */
 /*  if (lastname != NULL && strcmp(lastname, varname) == 0) { */
   if (lastname != NULL && _strcmpi(lastname, varname) == 0)
@@ -2257,72 +2251,28 @@ char *grabenv (char *varname)
       sprintf(log_line, "Cache hit: %s=%s\n", lastname, lastvalue);
       show_line(log_line, 0);
     }
-/*    return lastvalue; */        /* save some time here */
+
     return xstrdup(lastvalue);
-/*    duplicate so can free safely 98/Jan/31 */
-  }
-
-/*  hmm, following was not xstrdup(...) */ /* not cached */
-  if (usedviwindo == 0 || *dviwindo == '\0') {
-/*    return getenv(varname); */
-    s = getenv(varname);
-    if (s == NULL) return NULL;
-    else return xstrdup(s);       /* make safe 98/Jan/31 */
-  }
-
-  if (share_flag == 0) pinput = fopen(dviwindo, "r");
-  else pinput = _fsopen(dviwindo, "r", share_flag);
-
-  if (pinput != NULL) {
-    m = strlen(envsection);
-/*    search for [Environment] section */ /* should be case insensitive */
-    while (fgets (line, sizeof(line), pinput) != NULL) {
-      if (*line == ';') continue;
-      if (*line == '\n') continue;
-      if (_strnicmp(line, envsection, m) == 0) {  /* 98/Jan/31 */
-/*        search for varname=... */ /* should be case sensitive ? */
-        n = strlen(varname);
-        while (fgets (line, sizeof(line), pinput) != NULL) {
-          if (*line == ';') continue;
-          if (*line == '[') break;
-/*          if (*line == '\n') break; */  /* ??? */
-          if (*line <= ' ') continue;   /* 95/June/23 */
-/*          if (strncmp(line, varname, n) == 0 && */
-          if (_strnicmp(line, varname, n) == 0 &&
-            *(line+n) == '=') { /* found it ? */
-              (void) fclose (pinput);
-/*              flush trailing white space */
-              s = line + strlen(line) - 1;
-              while (*s <= ' ' && s > line) *s-- = '\0';
-              if (trace_flag) { /* DEBUGGING ONLY */
-                sprintf(log_line, "%s=%s\n", varname, line+n+1);
-                show_line(log_line, 0);
-              }
-              s = line+n+1;
-              if (lastname != NULL) free(lastname);
-              lastname = xstrdup (varname);
-              if (lastvalue != NULL) free(lastvalue);
-              lastvalue = xstrdup(s);
-              return xstrdup(s);    /* 98/Jan/31 */
-          }   /* end of matching varname */
-        }     /* end of while fgets */
-/*        break; */ /* ? not found in designated section */    
-      }       /* end of search for [Environment] section */
-    }
-    (void) fclose (pinput);
-  }           /* end of if fopen */
-  s = getenv(varname);    /* failed, so try and get from environment */
-/*  if (s != NULL) return s;  */
-  if (s != NULL) {
-/*    sdup = xstrdup(s); */   /* just to be safe --- 1995/Jan/31 */
-    if (lastname != NULL) free(lastname);
+  }
+
+  s = getenv(varname);
+
+  if (s != NULL)
+  {
+    if (lastname != NULL)
+      free(lastname);
+
     lastname = xstrdup (varname);
-    if (lastvalue != NULL) free(lastvalue);
-    lastvalue = xstrdup(s);   /* remember in case asked again ... */
-/*    return sdup; */
-    return xstrdup(s);    /* 98/Jan/31 */
+
+    if (lastvalue != NULL)
+      free(lastvalue);
+
+    lastvalue = xstrdup(s);
+
+    return xstrdup(s);
   }
-  else return NULL;   /* return NULL if not found anywhere */
+  else
+    return NULL;
 }
 
 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
@@ -2331,9 +2281,12 @@ void flush_trailing_slash (char *directory)
 {
   char *s;
 /*  flush trailing \ or / in directory, if any 1993/Dec/12 */
-  if (strcmp(directory, "") != 0) {
+  if (strcmp(directory, "") != 0)
+  {
     s = directory + strlen(directory) - 1;
-    if (*s == '\\' || *s == '/') *s = '\0';
+
+    if (*s == '\\' || *s == '/')
+      *s = '\0';
   }
 }
 
@@ -2375,32 +2328,34 @@ void knuthify (void)
   knuth_flag = true;       /* so other code can know about this */
 } /* end of knuthify */
 
-/* following have already been used up */
-
-/* abcdefghijklmnopqrstuvwxyz */
-
-/* ABCDEFGHIJKLMNOPQRSTUVWXYZ */
-
-/* ........ */
-
-int nohandler = 0;    /* experiment to avoid Ctrl-C interrupt handler */
-
 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
 
 /* following made global so analyze_flag can be made separate procedure */
 
-// char *xchrfile=""; /* save space use xstrdup */
-char *xchrfile = NULL; /* save space use xstrdup */
-// char *replfile="";/* save space use xstrdup */
-char *replfile = NULL;/* save space use xstrdup */
-
-/* abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ */
+char * xchrfile = NULL;
+char * replfile = NULL;
 
 /* analyze command line flag or argument */
 /* c is the flag letter itself, while optarg is start of arg if any */
 
-/* when making changes, revise allowedargs */
+char * short_options = "viKLZMdp2t?u";
 
+static struct option long_options[] =
+{
+  {"verbose",     no_argument, 0, 'v'},
+  {"initex",      no_argument, 0, 'i'},
+  {"knuthify",    no_argument, 0, 'K'},
+  {"cstyle",      no_argument, 0, 'L'},
+  {"showtfm",     no_argument, 0, 'Z'},
+  {"showmissing", no_argument, 0, 'M'},
+  {"deslash",     no_argument, 0, 'd'},
+  {"patterns",    no_argument, 0, 'p'},
+  {"suppressflig",no_argument, 0, '2'},
+  {"trace",       no_argument, 0, 't'},
+  {"help",        no_argument, 0, '?'},
+  {"usage",       no_argument, 0, 'u'},
+  {NULL,          0,           0, 0}
+};
 
 int analyze_flag (int c, char *optarg)
 {
@@ -2488,9 +2443,6 @@ int analyze_flag (int c, char *optarg)
       break;
 /*  case 'X':  truncate_long_lines = false; */ /* 98/Feb/2 */
               /* break; */
-    case 'W':
-      usedviwindo = false; /* 94/May/19 */
-      break;
     case 'J':
       show_line_break_stats = false; /* 96/Feb/8 */
       break;
@@ -2731,74 +2683,6 @@ char *programpath = ""; /* pathname of program */
 
 /* The following does not deslashify arguments ? Do we need to ? */
 
-int read_commands (char *filename)
-{
-  char commandfile[PATH_MAX]; 
-  FILE *command;
-  char line[PATH_MAX];
-  char *linedup;      /* need to copy line to preserve args */
-  char *s;
-/*  char *sn; */
-  char *optarg;
-  int c;
-
-/*  Try first in current directory (or use full name as specified) */
-  strcpy(commandfile, filename);
-  yy_extension(commandfile, "cmd");
-  if (share_flag == 0)
-         command = fopen(commandfile, "r");
-  else
-         command = _fsopen(commandfile, "r", share_flag);
-  if (command == NULL) {
-/*    If that fails, try in YANDYTeX program directory */
-    strcpy(commandfile, programpath);
-/*    don't need fancy footwork, since programpath non-empty */
-    strcat(commandfile, "\\");
-    strcat(commandfile, filename);
-    yy_extension(commandfile, "cmd");
-    if (share_flag == 0)
-               command = fopen(commandfile, "r");
-    else
-               command = _fsopen(commandfile, "r", share_flag);
-    if (command == NULL) {
-/*      perrormod(commandfile); */      /* debugging only */
-/*      strcpy(commandfile, ""); */   /* indicate failed */
-      return 0;       /* no command line file YYTEX.CMD */
-    }
-  }
-
-/*  allow for multiple lines --- ignore args that don't start with `-' */
-  while (fgets(line, PATH_MAX, command) != NULL) {
-/*    sprintf(log_line, "From %s:\t%s", commandfile, line); */
-/*    skip over comment lines and blank lines */
-    if (*line == '%' || *line == ';' || *line == '\n') continue;
-    if (strchr(line, '\n') == NULL) strcat(line, "\n");
-/*    sfplogline, rintf("From %s:\t%s", commandfile, line); */
-    linedup = xstrdup (line);         /* 93/Nov/15 */
-    if (linedup == NULL) {
-      show_line("ERROR: out of memory\n", 1);    /* read_commands */
-//      exit(1);
-      return -1;    // failure
-    }
-    s = strtok(linedup, " \t\n\r");       /* 93/Nov/15 */
-    while (s != NULL) {
-      if (*s == '-' || *s == '/') {
-        c = *(s+1);
-        optarg = s+2;
-/*        if (*optarg = '=') optarg++; */
-        if (*optarg == '=') optarg++;
-        if (analyze_flag(c, optarg) < 0) return -1;  // failure ???
-      }
-/*      else break; */              /* ignore non-flag items */
-      s = strtok(NULL, " \t\n\r");      /* go to next token */
-    }
-/*    If you want to see command lines in file - put -v in the file */
-/*    if (verbose_flag != 0) sprintf(log_line, "From %s:\t%s", commandfile, line); */
-  }
-  (void) fclose(command);   /* no longer needed */
-  return 1;       // success
-}
-
 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
 
 /* try and read commands on command line */
@@ -2808,55 +2692,71 @@ int read_command_line (int ac, char **av)
   char *optargnew;  /* equal to optarg, unless that starts with `='      */
                     /* in which case it is optarg+1 to step over the `=' */
                     /* if optarg = 0, then optargnew = 0 also            */
+  int option_idx = 0;
 
-//  show_line("read_command_line\n", 0);
-  if (ac < 2) return 0;     /* no args to analyze ? 94/Apr/10 */
+  if (ac < 2)
+    return 0;
 
 /*  while ((c = getopt(ac, av, "+vitrdczp?m:h:x:E:")) != EOF) {              */
 /*  NOTE: keep `Y' in there for `do not reorder arguments !                  */
 /*  WARNING: if adding flags, change also `allowedargs' and  `takeargs' !!!! */
-  while ((c = getopt(ac, av, allowedargs)) != EOF) {
+/*  while ((c = getopt(ac, av, allowedargs)) != EOF)
+  {
     if (optarg != 0 && *optarg == '=')
       optargnew = optarg+1;
     else
       optargnew = optarg;
+
     analyze_flag (c, optargnew);
   }
-  if (show_use || quitflag == 3) {
-//    showversion (stdout);
+*/
+  while ((c = getopt_long_only(ac, av, short_options, long_options, &option_idx)) != EOF)
+  {
+    analyze_flag (c, optargnew);
+  }
+
+  if (show_use || quitflag == 3)
+  {
     stamp_it(log_line);
     strcat(log_line, "\n");
     show_line(log_line, 0);
     stampcopy(log_line);
     strcat(log_line, "\n");
     show_line(log_line, 0);
-    if (show_use) show_usage();
-    else if (quitflag == 3) {
+
+    if (show_use)
+      show_usage();
+    else if (quitflag == 3)
+    {
       strcat(log_line, "\n");
       show_line(log_line, 0);
     }
-//    exit (0);
+
     return -1;        // failure
   } 
-#ifdef DEBUG
-  if (floating) testfloating();   /* debugging */
-#endif
 
-  if (replfile != NULL && *replfile != '\0') {  /* read user defined replacement */
-    if (read_xchr_file(replfile, 1, av)) {
-      if (trace_flag) show_line("KEY REPLACE ON\n", 0);
+  if (replfile != NULL && *replfile != '\0')
+  {
+    if (read_xchr_file(replfile, 1, av))
+    {
+      if (trace_flag)
+        show_line("KEY REPLACE ON\n", 0);
+
       key_replace = true;
     }
   } 
-/*  key_replace used in texmf.c (input_line) */
-  if (xchrfile != NULL && *xchrfile != '\0') {  /* read user defined xchr[] */
-    if (read_xchr_file(xchrfile, 0, av)) {
-      if (trace_flag) show_line("NON ASCII ON\n", 0);
+
+  if (xchrfile != NULL && *xchrfile != '\0')
+  {
+    if (read_xchr_file(xchrfile, 0, av))
+    {
+      if (trace_flag)
+        show_line("NON ASCII ON\n", 0);
+
       non_ascii = true;
     }
   } 
-/*  non_ascii used in texmf.c (t_open_in & input_line & call_edit) */
-/*  see also xchr [] & xord [] use in tex3.c and itex.c */
+
   return 0;
 }
 
@@ -3226,14 +3126,15 @@ int main_init (int ac, char **av)
 
   kpse_set_program_name(av[0], NULL);
 
-  if (sizeof(memory_word) != 8) /* compile time test */
+  // compile time test
+  if (sizeof(memory_word) != 8)
   {
     sprintf(log_line, "ERROR: Bad word size %d!\n", sizeof(memory_word));
     show_line(log_line, 1);
   }
 
-  start_time = clock();    /* get time */
-  main_time = start_time;   /* fill in, in case file never opened */
+  start_time = clock();
+  main_time = start_time;
 
   initbuffer[0] = '\0';         /* paranoia 94/Apr/10 */
 
@@ -3306,8 +3207,6 @@ int main_init (int ac, char **av)
   if (trace_flag)
     show_line("Entering init (local)\n", 0);
 
-/*   Print version *after* banner ? */ /* does this get in log file ? */
-
   probe_memory();             /* show top address */
   ini_max_address = max_address;       /* initial max address */
 
@@ -3418,12 +3317,6 @@ int endit (int flag)
   return flag;
 }
 
-/********************************************************************************/
-
-/* addition 98/Mar/31 print_csnames Frank Mittelbach */
-
-#define MAXCOLUMN 78
-
 void print_cs_name (FILE *output, int h)
 {
   int c, textof, n;
index f171ec5..140c44e 100644 (file)
@@ -291,6 +291,7 @@ bool open_input (FILE **f, path_constant_type path_index, char *fopen_mode)
     if (path_index == TFMFILEPATH)
     {
       tfm_temp = getc (*f);
+      //ungetc(tfm_temp, *f);
     } 
 
 #ifdef MSDOS
@@ -446,7 +447,7 @@ bool open_output (FILE **f, char *fopen_mode)
   {
     if (open_trace_flag)
     {
-      sprintf(log_line, "After prepend %s\n", name_of_file+1);
+      sprintf(log_line, "After prepend %s\n", name_of_file + 1);
       show_line(log_line, 0);
     }
   }
index 6176640..4367483 100644 (file)
@@ -36,9 +36,6 @@
 
 #include "texd.h"
 
-#include <io.h>    // needed for _finddata_t
-#include <ctype.h> // needed for isascii and isalpha
-
 #define NAME_MAX 255      // max size of name component
 
 #define PATH_SEP              '/'
 #define PATH_DELIMITER        ';'
 #define PATH_DELIMITER_STRING ";"
 
-// default paths to look for things
-
-#define TEXPATH    "C:/yandy/yandytex/"
-#define TEXFORMATS "C:/yandy/yandytex/fmt"
-#define TEXPOOL    "C:/yandy/yandytex/pool"
-#define TEXFONTS   "C:/yandy/yandytex/tfm"
-#define TEXINPUTS  TEXPATH "tex//;" "C:/tex;" "C:/texinput"
-
-extern bool usesourcedirectory; /* in local.c */
-
-extern bool workingdirectory;   /* in local.c */
-
-string truncate_pathname (string name);
-
-// the following do *not* use MALLOC
-extern char * xconcat  (char *buffer, char *s1, char *s2);           /* openinou.c */
-extern char * xconcat3 (char *buffer, char *s1, char *s2, char *s3); /* openinou.c */
-
-/////////////////////////////////////////////////////////////////////////
-
 // used only in jump_out in tex0.c, and in texbody in itex.c
 // and main in texmf.c and a few other abort situations in texmf.c
 /* texk/web2c/lib/uexit.c */
@@ -160,12 +137,6 @@ char * read_a_line (FILE *f,  char *line, int limit)
     return(NULL);          /* true EOF */
 }
 
-/* Modified 97/May/17 to avoid malloc for each line read */
-
-#ifndef MALLOCLINE
-  #define MAXLINE 256
-#endif
-
 /* Unixify filename and path (turn \ into /) --- assumes null terminated */
 /* NEED HACK! */
 char *unixify (char * t)
@@ -195,9 +166,4 @@ char *unixify (char * t)
 // #endif
 #endif /* DOS */
   return t;
-}
-
-/* NOTE: _dos_find... prevents running under Windows NT as console app ??? */
-/* Yes, so lets flush it! use _findfirst, _findnext, _findclose instead */
-
-char *get_env_shroud (char *);    /* in texmf.c */
\ No newline at end of file
+}
\ No newline at end of file
index 69f13bc..9ff3484 100644 (file)
@@ -2469,6 +2469,7 @@ internal_font_number read_font_info_(halfword u, str_number nom, str_number aire
   fileopened = true; 
   {
 /*  tfm_temp = getc(tfm_file);  */ /* done already in open_input, but why? */
+    //tfm_temp = getc(tfm_file);
     {
       lf = tfm_temp;
       if (lf > 127)
index 3e6e482..a80223d 100644 (file)
@@ -1072,140 +1072,133 @@ EXTERN int tfm_temp;        /* only used in tex3.c 95/Jan/7 */
 
 /* new stuff defined in local.c - bkph */
 
-#ifdef MSDOS
-  EXTERN bool is_initex;
-  EXTERN bool verbose_flag;
-  EXTERN bool trace_flag;
-  EXTERN bool debug_flag;
-  EXTERN bool heap_flag;
-  EXTERN bool open_trace_flag;
-  EXTERN bool cache_file_flag;
-  EXTERN bool knuth_flag;
-  EXTERN bool no_interrupts;
-  EXTERN bool c_style_flag;
-  EXTERN bool non_ascii;
-  EXTERN bool key_replace;
-  EXTERN bool deslash;
-  EXTERN bool trimeof;
-  EXTERN bool allow_patterns;
-  EXTERN bool show_fonts_used;
-  EXTERN bool reset_exceptions;
-  EXTERN bool show_current;
-  EXTERN bool current_flag;
-  EXTERN bool current_tfm;
-  EXTERN bool return_flag;
-  EXTERN bool want_version;
-  EXTERN bool civilize_flag;
-  EXTERN bool show_numeric;
-  EXTERN bool restrict_to_ascii;
-  EXTERN bool show_missing;
-  EXTERN bool full_file_name_flag;
-  EXTERN bool save_strings_flag;
-  EXTERN int mem_initex;
-  EXTERN int mem_extra_high;
-  EXTERN int mem_extra_low;
-  EXTERN int new_hyphen_prime;
-  EXTERN int missing_characters;
-  EXTERN int show_in_hex;
-  EXTERN int show_in_dos;
-  EXTERN int test_dir_access;
-  EXTERN int dir_method;
-  EXTERN int file_method;
-  /* EXTERN int waitflush; */
-  EXTERN int show_fmt_flag;
-  EXTERN int show_tfm_flag;
-  EXTERN bool show_texinput_flag;  /* 1998/Jan/28 */
-  EXTERN bool truncate_long_lines; /* 1998/Feb/2 */
-  EXTERN bool show_cs_names;       /* 1998/Mar/31 */
-  EXTERN int tab_step;
-  EXTERN int pseudo_tilde;
-  EXTERN int pseudo_space;
-  EXTERN int allow_quoted_names;
-  EXTERN int default_rule;
-  EXTERN char * format_file;
-  EXTERN char * source_direct;     /* 1998/Sep/29 */
-  EXTERN char * string_file;
-  EXTERN int share_flag;
-  EXTERN char * format_name;
-  EXTERN char * encoding_name;
-  EXTERN bool format_specific;
-  EXTERN bool encoding_specific;
-  EXTERN bool show_line_break_stats;  /* 1996/Feb/9 */
-  EXTERN int first_pass_count;        /* 1996/Feb/9 */
-  EXTERN int second_pass_count;       /* 1996/Feb/9 */
-  EXTERN int final_pass_count;        /* 1996/Feb/9 */
-  EXTERN int underfull_hbox;          /* 1996/Feb/9 */
-  EXTERN int overfull_hbox;           /* 1996/Feb/9 */
-  EXTERN int underfull_vbox;          /* 1996/Feb/9 */
-  EXTERN int overfull_vbox;           /* 1996/Feb/9 */
-  EXTERN int paragraph_failed;        /* 1996/Feb/9 */
-  EXTERN int single_line;             /* 1996/Feb/15 */
-  EXTERN FILE * errout;
-  EXTERN int font_dimen_zero;   /* 1998/Oct/5 */
-  EXTERN int ignore_frozen;     /* 1998/Oct/5 */
-  EXTERN bool suppress_f_ligs;  /* 1999/Jan/5 */
-  EXTERN int abort_flag;      // not yet hooked up ???
-  EXTERN int err_level;     // not yet hooked up ???
-  EXTERN int jump_used;       /* 1999/Nov/28 */
-  EXTERN jmp_buf jumpbuffer;  /* 1999/Nov/7 */
- #endif /* DOS */
-
-#ifdef MSDOS
-  extern int current_pool_size;        /* in local.c - bkph */
-  extern int current_max_strings;      /* in local.c - bkph */
-  extern int current_mem_size;         /* in local.c - bkph */
-  extern int current_font_mem_size;    /* in local.c - bkph */
-  extern int current_save_size;        /* in local.c - bkph */
-  extern int current_stack_size;       /* in local.c - bkph */
-  extern int current_nest_size;        /* in local.c - bkph */
-  extern int current_param_size;       /* in local.c - bkph */
-  extern int current_buf_size;         /* in local.c - bkph */
-  extern char *tex_version;            /* in local.c - bkph */
-  extern char *application;            /* in local.c - bkph */
-  extern char *yandyversion;           /* in local.c - bkph */
-  extern unsigned char wintodos[128];  /* in local.c - bkph */
-  extern char log_line[MAXLINE];       /* in local.c */
-  extern char *texpath;           /* in local.c */
-
-  memory_word * allocate_main_memory (int);     /* in local.c - bkph */
-  memory_word * realloc_main (int, int);        /* in local.c - bkph */
-  packed_ASCII_code * realloc_str_pool (int);   /* in local.c - bkph */
-  pool_pointer * realloc_str_start (int);       /* in local.c - bkph */
-  memory_word * realloc_save_stack (int);       /* in local.c - bkph */
-  list_state_record * realloc_nest_stack (int); /* in local.c - bkph */
-  in_state_record * realloc_input_stack (int);  /* in local.c - bkph */
-  halfword * realloc_param_stack (int);         /* in local.c - bkph */
-  ASCII_code * realloc_buffer (int);            /* in local.c - bkph */
-  fmemoryword * realloc_font_info (int);        /* in local.c - bkph */
-
-  int realloc_hyphen (int);         /* in local.c - bkph */
-  int allocate_tries (int);         /* in local.c - bkph */
-
-  void check_eqtb (char *);          /* in local.c - bkph */
-  void probe_memory (void);          /* in local.c - bkph */
-  void print_cs_names (FILE *, int); /* in local.c - bkph */
-  void perrormod(char *);            /* in local.c */
-  char *grabenv(char *);             /* in local.c - bkph */
-  void stamp_it (char *);            /* in local.c - bkph */
-  void stampcopy (char *);           /* in local.c - bkph */
-  bool prime (int);                  /* in local.c - bkph */
-  int endit (int);                   /* in local.c - bkph */
-
-  void uexit (int unix_code);     /* in lib/uexit.c - bkph */
-  void t_open_in (void);          /* in lib/texmf.c - bkph */
-
-
-  void call_edit (ASCII_code *filename, pool_pointer fnstart,
-         integer fnlength, integer linenumber); /* from lib/texmf.c - bkph */
-
-  void add_variable_space(int);       /* in itex.c - bkph */
-
-  void get_date_and_time (integer *minutes, integer *day,
-            integer *month, integer *year);   /* in lib/texmf.c - bkph */
-
-  char *unixify (char *);       /* in pathsrch.c bkph */
-
-#endif /* ifdef MSDOS */
+EXTERN bool is_initex;
+EXTERN bool verbose_flag;
+EXTERN bool trace_flag;
+EXTERN bool debug_flag;
+EXTERN bool heap_flag;
+EXTERN bool open_trace_flag;
+EXTERN bool cache_file_flag;
+EXTERN bool knuth_flag;
+EXTERN bool no_interrupts;
+EXTERN bool c_style_flag;
+EXTERN bool non_ascii;
+EXTERN bool key_replace;
+EXTERN bool deslash;
+EXTERN bool trimeof;
+EXTERN bool allow_patterns;
+EXTERN bool show_fonts_used;
+EXTERN bool reset_exceptions;
+EXTERN bool show_current;
+EXTERN bool current_flag;
+EXTERN bool current_tfm;
+EXTERN bool return_flag;
+EXTERN bool want_version;
+EXTERN bool civilize_flag;
+EXTERN bool show_numeric;
+EXTERN bool restrict_to_ascii;
+EXTERN bool show_missing;
+EXTERN bool full_file_name_flag;
+EXTERN bool save_strings_flag;
+EXTERN int mem_initex;
+EXTERN int mem_extra_high;
+EXTERN int mem_extra_low;
+EXTERN int new_hyphen_prime;
+EXTERN int missing_characters;
+EXTERN int show_in_hex;
+EXTERN int show_in_dos;
+EXTERN int test_dir_access;
+EXTERN int dir_method;
+EXTERN int file_method;
+/* EXTERN int waitflush; */
+EXTERN int show_fmt_flag;
+EXTERN int show_tfm_flag;
+EXTERN bool show_texinput_flag;  /* 1998/Jan/28 */
+EXTERN bool truncate_long_lines; /* 1998/Feb/2 */
+EXTERN bool show_cs_names;       /* 1998/Mar/31 */
+EXTERN int tab_step;
+EXTERN int pseudo_tilde;
+EXTERN int pseudo_space;
+EXTERN int allow_quoted_names;
+EXTERN int default_rule;
+EXTERN char * format_file;
+EXTERN char * source_direct;     /* 1998/Sep/29 */
+EXTERN char * string_file;
+EXTERN int share_flag;
+EXTERN char * format_name;
+EXTERN char * encoding_name;
+EXTERN bool format_specific;
+EXTERN bool encoding_specific;
+EXTERN bool show_line_break_stats;  /* 1996/Feb/9 */
+EXTERN int first_pass_count;        /* 1996/Feb/9 */
+EXTERN int second_pass_count;       /* 1996/Feb/9 */
+EXTERN int final_pass_count;        /* 1996/Feb/9 */
+EXTERN int underfull_hbox;          /* 1996/Feb/9 */
+EXTERN int overfull_hbox;           /* 1996/Feb/9 */
+EXTERN int underfull_vbox;          /* 1996/Feb/9 */
+EXTERN int overfull_vbox;           /* 1996/Feb/9 */
+EXTERN int paragraph_failed;        /* 1996/Feb/9 */
+EXTERN int single_line;             /* 1996/Feb/15 */
+EXTERN FILE * errout;
+EXTERN int font_dimen_zero;   /* 1998/Oct/5 */
+EXTERN int ignore_frozen;     /* 1998/Oct/5 */
+EXTERN bool suppress_f_ligs;  /* 1999/Jan/5 */
+EXTERN int abort_flag;      // not yet hooked up ???
+EXTERN int err_level;     // not yet hooked up ???
+EXTERN int jump_used;       /* 1999/Nov/28 */
+EXTERN jmp_buf jumpbuffer;  /* 1999/Nov/7 */
+extern int current_pool_size;        /* in local.c - bkph */
+extern int current_max_strings;      /* in local.c - bkph */
+extern int current_mem_size;         /* in local.c - bkph */
+extern int current_font_mem_size;    /* in local.c - bkph */
+extern int current_save_size;        /* in local.c - bkph */
+extern int current_stack_size;       /* in local.c - bkph */
+extern int current_nest_size;        /* in local.c - bkph */
+extern int current_param_size;       /* in local.c - bkph */
+extern int current_buf_size;         /* in local.c - bkph */
+extern char *tex_version;            /* in local.c - bkph */
+extern char *application;            /* in local.c - bkph */
+extern char *yandyversion;           /* in local.c - bkph */
+extern unsigned char wintodos[128];  /* in local.c - bkph */
+extern char log_line[MAXLINE];       /* in local.c */
+extern char *texpath;           /* in local.c */
+
+memory_word * allocate_main_memory (int);     /* in local.c - bkph */
+memory_word * realloc_main (int, int);        /* in local.c - bkph */
+packed_ASCII_code * realloc_str_pool (int);   /* in local.c - bkph */
+pool_pointer * realloc_str_start (int);       /* in local.c - bkph */
+memory_word * realloc_save_stack (int);       /* in local.c - bkph */
+list_state_record * realloc_nest_stack (int); /* in local.c - bkph */
+in_state_record * realloc_input_stack (int);  /* in local.c - bkph */
+halfword * realloc_param_stack (int);         /* in local.c - bkph */
+ASCII_code * realloc_buffer (int);            /* in local.c - bkph */
+fmemoryword * realloc_font_info (int);        /* in local.c - bkph */
+
+int realloc_hyphen (int);         /* in local.c - bkph */
+int allocate_tries (int);         /* in local.c - bkph */
+void check_eqtb (char *);          /* in local.c - bkph */
+void probe_memory (void);          /* in local.c - bkph */
+void print_cs_names (FILE *, int); /* in local.c - bkph */
+void perrormod(char *);            /* in local.c */
+char *grabenv(char *);             /* in local.c - bkph */
+void stamp_it (char *);            /* in local.c - bkph */
+void stampcopy (char *);           /* in local.c - bkph */
+bool prime (int);                  /* in local.c - bkph */
+int endit (int);                   /* in local.c - bkph */
+
+void uexit (int unix_code);     /* in lib/uexit.c - bkph */
+void t_open_in (void);          /* in lib/texmf.c - bkph */
+
+
+void call_edit (ASCII_code *filename, pool_pointer fnstart,
+                integer fnlength, integer linenumber); /* from lib/texmf.c - bkph */
+
+void add_variable_space(int);       /* in itex.c - bkph */
+
+void get_date_and_time (integer *minutes, integer *day,
+                        integer *month, integer *year);   /* in lib/texmf.c - bkph */
+
+char *unixify (char *);       /* in pathsrch.c bkph */
 
 /****************************************************************************/
 
@@ -2537,6 +2530,7 @@ EXTERN void free_tfm_map(void);
 EXTERN void pdf_ship_out(pointer p);
 EXTERN void pdf_vlist_out (void);
 EXTERN void pdf_hlist_out (void);
+EXTERN void pdf_begin_text(void);
 EXTERN void pdf_font_def(internal_font_number f);
 EXTERN void pdf_error_handler (HPDF_STATUS error_no, HPDF_STATUS detail_no, void * user_data);
 /********BINDING WITH LIBHARU*********/
\ No newline at end of file
index 479d6a4..0b7df59 100644 (file)
@@ -37,7 +37,8 @@
 
 #include "texd.h"
 
-int dot_string = 0;
+bool pdf_doing_string;
+bool pdf_doing_text;
 HPDF_Doc  yandy_pdf;
 HPDF_Page yandy_page;
 HPDF_Font yandy_font[1024];
@@ -124,7 +125,7 @@ int get_font_index(char * name)
 
 char * pdf_char_to_string(unsigned char i)
 {
-  char * str = malloc(2);
+  char * str = (char *) malloc(2);
   str[0] = i;
   str[1] = 0;
   return str;
@@ -167,46 +168,6 @@ void pdf_print_octal(integer n)
   }
 }
 
-void pdf_print_int(integer n)
-{
-  integer k;
-  integer m;
-
-  if (n < 0)
-  {
-    pdf_out('-');
-    if (n > -100000000)
-      n = -n;
-    else
-    {
-      m = -1 - n;
-      n = m / 10;
-      m = m % 10 + 1;
-      k = 1;
-      if (m < 10)
-        dig[0] = (char) m;
-      else
-      {
-        dig[0] = 0;
-        incr(n);
-      }
-    }
-  }
-  do
-    {
-      dig[k] = n % 10;
-      n = n / 10;
-      incr(k);
-    }
-  while (n != 0);
-
-  while (k > 0)
-  {
-    decr(k);
-    pdf_out('0' + dig[k]);
-  }
-}
-
 void pdf_print_char(unsigned char c)
 {
   if ((c < 32) || (c == 92) || (c == 40) || (c == 41) || (c > 127))
@@ -226,6 +187,18 @@ void pdf_print_string(char * s)
   HPDF_Stream_WriteStr(attr->stream, s);
 }
 
+void hpdf_print_char(unsigned char c)
+{
+  if ((c < 32) || (c == 92) || (c == 40) || (c == 41) || (c > 127))
+  {
+    pdf_print_string(" [(!\\051)] TJ\012");
+  }
+  else
+  {
+    HPDF_Page_ShowText(yandy_page, pdf_char_to_string(c));
+  }
+}
+
 void pdf_end_string(void)
 {
   if (pdf_doing_string)
@@ -235,20 +208,31 @@ void pdf_end_string(void)
   }
 }
 
-void pdf_begin_string(void)
+void pdf_begin_string(internal_font_number f)
 {
-  scaled s;
+  scaled s, v;
 
-//  if (pdf_doing_text)
-//    pdf_begin_text();
+  if (!pdf_doing_text)
+    pdf_begin_text();
 
-  if (f != pdf_f)
+  if (f != dvi_f)
   {
     pdf_end_string();
     pdf_font_def(f);
   }
 
-  s = cur_h - pdf_delta_h;
+  {
+    s = cur_h - pdf_delta_h;
+    v = pdf_v - cur_v;
+  }
+
+  if ((f != pdf_f) || (v != 0) || (s >= 0100000))
+  {
+    pdf_end_string();
+    //pdf_set_textmatrix();
+    pdf_f = f;
+    s = 0;
+  }
 
   if (!pdf_doing_string)
   {
@@ -261,14 +245,13 @@ void pdf_begin_string(void)
   {
     if (pdf_doing_string)
       pdf_out(')');
-    pdf_print_int(-s);
+    //pdf_print_int(-s);
     pdf_out('(');
     pdf_delta_h = cur_h;
   }
 
   pdf_doing_string = true;
 }
-
 void pdf_begin_text(void)
 {
   HPDF_Page_BeginText(yandy_page);
@@ -295,46 +278,48 @@ void pdf_error_handler (HPDF_STATUS error_no, HPDF_STATUS detail_no, void * user
 void pdf_font_def(internal_font_number f)
 {
   int k;
-  const char * fnt_name = NULL;
-  char * afm_name = NULL;
-  char * pfb_name = NULL;
-  char * buffer = malloc(length(font_name[f]));
+  const char * fnt_name;
+  char * afm_name;
+  char * pfb_name;
+  char buffer[256], cuffer[256], duffer[256];
   
-  strncpy(buffer, str_pool + str_start[font_name[f]], length(font_name[f]));
-  buffer[length(font_name[f])] = '\0';
-
-  if ((k = get_font_index(buffer)) != 0)
+  memset(buffer, 0, sizeof(buffer));
+  memset(duffer, 0, sizeof(duffer));
+  memset(cuffer, 0, sizeof(cuffer));
+  memcpy(buffer, (const char *) str_pool + str_start[font_name[f]], length(font_name[f]));
+  memcpy(duffer, (const char *) str_pool + str_start[font_name[f]], length(font_name[f]));
+  memcpy(cuffer, (const char *) str_pool + str_start[font_name[f]], length(font_name[f]));
+
+  //if ((k = get_font_index(buffer)) != 0)
+  //{
+  //  printf("PDF_FONT_DEF2: %s-%d.\n", buffer,get_font_index(buffer));
+  //  HPDF_Page_SetFontAndSize(yandy_page, yandy_font[get_font_index(buffer)], (font_size[f] / 65535));
+  //}
+  //else
+  k = get_font_index(buffer);
+
+  if (k == 0)
   {
-    printf("PDF_FONT_DEF2.\n");
-    HPDF_Page_SetFontAndSize(yandy_page, yandy_font[get_font_index(buffer)], (font_size[f] / 65535));
-  }
-  else
-  {
-    printf("PDF_FONT_DEF3.\n");
-    strncpy(buffer, str_pool + str_start[font_name[f]], length(font_name[f]));
-    buffer[length(font_name[f])] = '\0';
     afm_name = kpse_find_file(strcat(buffer, ".afm"), kpse_afm_format, 0);
-    printf("PDF_FONT_DEF3: %s.\n", afm_name);
-    free(buffer);
-    strncpy(buffer, str_pool + str_start[font_name[f]], length(font_name[f]));
-    buffer[length(font_name[f])] = '\0';
-    pfb_name = kpse_find_file(strcat(buffer, ".pfb"), kpse_type1_format, 0);
+    printf("PDF_FONT_DEF3: %s.\n", afm_name);    
+    //printf("PDF_FONT_DEF3: %s.\n", pfb_name);
+    pfb_name = kpse_find_file(strcat(duffer, ".pfb"), kpse_type1_format, 0);
     printf("PDF_FONT_DEF3: %s.\n", pfb_name);
 
-    if (get_font_index(buffer) == 0 && afm_name != NULL && pfb_name != NULL)
+    if (afm_name != NULL && pfb_name != NULL)
     {
-      k = insert_font_index(buffer);
+      printf("PDF_FONT_DEF4_NAME: %s.\n", cuffer);
+      k = insert_font_index(cuffer);
       printf("PDF_FONT_DEF4: %d.\n", k);
       fnt_name = HPDF_LoadType1FontFromFile (yandy_pdf, afm_name, pfb_name);
       yandy_font[k] = HPDF_GetFont(yandy_pdf, fnt_name, NULL);
     }
     else
     {
-      k = get_font_index(buffer);
+      k = 0; //get_font_index(buffer);
     }
-    
-    HPDF_Page_SetFontAndSize(yandy_page, yandy_font[k], (font_size[f] / 65535));
   }
+  HPDF_Page_SetFontAndSize(yandy_page, yandy_font[k], (font_size[f] / 65535));
 }
 
 void pdf_ship_out(halfword p)
@@ -409,7 +394,9 @@ void pdf_ship_out(halfword p)
     max_h = width(p) + h_offset;
 
   dvi_h = 0;
+  pdf_delta_h = 0;
   dvi_v = 0;
+  pdf_delta_v = 0;
   cur_h = h_offset;
   dvi_f = null_font;
 
@@ -433,7 +420,7 @@ void pdf_ship_out(halfword p)
     init_tfm_map();
     yandy_pdf = HPDF_New(pdf_error_handler, NULL);
     yandy_pdf->pdf_version = HPDF_VER_17;
-    HPDF_SetCompressionMode(yandy_pdf, HPDF_COMP_ALL);
+    //HPDF_SetCompressionMode(yandy_pdf, HPDF_COMP_ALL);
     HPDF_SetInfoAttr(yandy_pdf, HPDF_INFO_PRODUCER, "Y&YTeX 2.2.3");
     yandy_font[0] = HPDF_GetFont(yandy_pdf, "Times-Roman", NULL);
   }
@@ -442,8 +429,6 @@ void pdf_ship_out(halfword p)
   //dvi_out(bop);
   yandy_page = HPDF_AddPage (yandy_pdf);
   HPDF_Page_SetSize(yandy_page, HPDF_PAGE_SIZE_A4, HPDF_PAGE_PORTRAIT);
-  //yandy_font = HPDF_GetFont(yandy_pdf, HPDF_LoadType1FontFromFile(yandy_pdf, "cmr10.afm", "cmr10.pfb"), NULL);
-  //HPDF_Page_SetFontAndSize(yandy_page, yandy_font, (10));
 
   //for (k = 0; k <= 9; k++)
   //  dvi_four(count(k));
@@ -620,13 +605,13 @@ void pdf_hlist_out (void)
   p = list_ptr(this_box);
   incr(cur_s);
 
-  if (cur_s > 0)
-    dvi_out(141);
+  //if (cur_s > 0)
+  //  dvi_out(141);
 
-  if (cur_s > max_push)
-    max_push = cur_s;
+  //if (cur_s > max_push)
+  //  max_push = cur_s;
 
-  save_loc = dvi_offset + dvi_ptr;
+  //save_loc = dvi_offset + dvi_ptr;
   base_line = cur_v;
   left_edge = cur_h;
 
@@ -634,9 +619,10 @@ void pdf_hlist_out (void)
 lab21:
     if (is_char_node(p))
     {
-      synch_h();
-      synch_v();
-
+      //HPDF_Page_BeginText(yandy_page);
+      //HPDF_Page_SetTextMatrix(yandy_page, 1, 0, 0, 1, (cur_h/65536 + 72), (841.89 - (cur_v/65536 + 72)));
+      //HPDF_Page_MoveTextPos(yandy_page, (cur_h/65536 + 72), (841.89 - (cur_v/65536 + 72)));
+      //pdf_print_string(" [(");
       do
         {
           f = font(p);
@@ -646,28 +632,34 @@ lab21:
           {
             if (!font_used[f])
             {
-              dvi_font_def(f);
-              //pdf_font_def(f);
+              //dvi_font_def(f);
+              pdf_font_def(f);
+              //if (dvi_f != null_font)
+              //  pdf_print_string(")] TJ\012");
+              //pdf_print_string(" [(");
               font_used[f] = true;
             }
 
             dvi_f = f;
           }
 
-          //if (c >= 128)
-          //  dvi_out(set1);
-          //
-          //dvi_out(c);
-          pdf_font_def(f);
+          //pdf_print_char(c);
+          if (!pdf_doing_text)
           HPDF_Page_BeginText(yandy_page);
           HPDF_Page_MoveTextPos(yandy_page, (cur_h/65536 + 72), (841.89 - (cur_v/65536 + 72)));
-          HPDF_Page_ShowText(yandy_page, pdf_char_to_string(c));
+          //HPDF_Page_ShowText(yandy_page, pdf_char_to_string(c));
+          hpdf_print_char(c);
           HPDF_Page_EndText(yandy_page);
+          //pdf_begin_string(f);
+          //pdf_print_char(c);
+          //printf("HLISTOUT: %c.\n", c);
           cur_h = cur_h + char_width(f, char_info(f, c));
+          pdf_delta_h = pdf_delta_h + char_width(f, char_info(f, c));
           p = link(p);
         }
-      while(!(!(p >= hi_mem_min)));
-
+      while(((p >= hi_mem_min)));
+      //pdf_print_string(")] TJ\012");
+      //HPDF_Page_EndText(yandy_page);
       dvi_h = cur_h;
   }
   else
@@ -708,7 +700,7 @@ lab21:
         break;
 
       case whatsit_node:
-        out_what(p);
+        //out_what(p);
         break;
 
       case glue_node:
@@ -852,9 +844,9 @@ lab14:
 
     if ((rule_ht > 0) && (rule_wd > 0))
     {
-      synch_h();
+      //synch_h();
       cur_v = base_line + rule_dp;
-      synch_v();
+      //synch_v();
       //dvi_out(set_rule);
       //dvi_four(rule_ht);
       //dvi_four(rule_wd);
@@ -871,10 +863,10 @@ lab15:
     p = link(p);
   }
 
-  prune_movements(save_loc);
+  //prune_movements(save_loc);
 
-  if (cur_s > 0)
-    dvi_pop(save_loc);
+  //if (cur_s > 0)
+  //  dvi_pop(save_loc);
 
   decr(cur_s);
 }
@@ -909,13 +901,13 @@ void pdf_vlist_out (void)
   p = list_ptr(this_box);
   incr(cur_s);
 
-  if (cur_s > 0)
-    dvi_out(141);
+  //if (cur_s > 0)
+  //  dvi_out(141);
 
-  if (cur_s > max_push)
-    max_push = cur_s;
+  //if (cur_s > max_push)
+  //  max_push = cur_s;
 
-  save_loc = dvi_offset + dvi_ptr;
+  //save_loc = dvi_offset + dvi_ptr;
   left_edge = cur_h;
   cur_v = cur_v - height(this_box);
   top_edge = cur_v;
@@ -966,7 +958,7 @@ void pdf_vlist_out (void)
           break;
 
         case whatsit_node:
-          out_what(p);
+          //out_what(p);
           break;
 
         case glue_node:
@@ -1117,10 +1109,10 @@ lab15:
     p = link(p);
   }
 
-  prune_movements(save_loc);
+  //prune_movements(save_loc);
 
-  if (cur_s > 0)
-    dvi_pop(save_loc);
+  //if (cur_s > 0)
+  //  dvi_pop(save_loc);
 
   decr(cur_s);
-}
\ No newline at end of file
+}