texlive[45333] Build/source/texk/web2c/luatexdir: luatex.c: Import

commits+kakuto at tug.org commits+kakuto at tug.org
Mon Sep 18 16:40:22 CEST 2017


Revision: 45333
          http://tug.org/svn/texlive?view=revision&revision=45333
Author:   kakuto
Date:     2017-09-18 16:40:21 +0200 (Mon, 18 Sep 2017)
Log Message:
-----------
luatex.c: Import comment from the upstream

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/luatexdir/ChangeLog
    trunk/Build/source/texk/web2c/luatexdir/luatex.c

Modified: trunk/Build/source/texk/web2c/luatexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/ChangeLog	2017-09-18 14:13:09 UTC (rev 45332)
+++ trunk/Build/source/texk/web2c/luatexdir/ChangeLog	2017-09-18 14:40:21 UTC (rev 45333)
@@ -1,3 +1,7 @@
+2017-09-18  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
+
+	* luatex.c : Import comment from the upstream.
+
 2017-09-05  Karl Berry  <karl at tug.org>
         and Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
 

Modified: trunk/Build/source/texk/web2c/luatexdir/luatex.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/luatex.c	2017-09-18 14:13:09 UTC (rev 45332)
+++ trunk/Build/source/texk/web2c/luatexdir/luatex.c	2017-09-18 14:40:21 UTC (rev 45333)
@@ -582,58 +582,85 @@
 
     return EXIT_SUCCESS;
 }
-

 
-/* 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'.  */
+/*
+    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;
 
+    buffer[first] = 0;          /* In case there are no arguments. */
 
-    buffer[first] = 0;          /* In case there are no arguments.  */
-
-    if (optind < argc) {        /* We have command line arguments.  */
+    if (optind < argc) {        /* We have command line arguments. */
         int k = first;
         for (i = optind; i < argc; i++) {
             char *ptr = &(argv[i][0]);
-            /* Don't use strcat, since in Aleph the buffer elements aren't
-               single bytes.  */
+            /*
+                We cannot use strcat, because we have multibyte UTF-8 input.
+            */
             while (*ptr) {
                 buffer[k++] = (packed_ASCII_code) * (ptr++);
             }
             buffer[k++] = ' ';
         }
-        argc = 0;               /* Don't do this again.  */
+        argc = 0;               /* Don't do this again. */
         buffer[k] = 0;
     }
 
-    /* Find the end of the buffer.  */
+    /*
+        Find the end of the buffer looking at spaces and newlines.
+    */
+
     for (last = first; buffer[last]; ++last);
 
-  /* Make `last' be one past the last non-space character in `buffer',
-     ignoring line terminators (but not, e.g., tabs).  This is because
-     we are supposed to treat this like a line of TeX input.  Although
-     there are pathological cases (SPC CR SPC CR) where this differs
-     from input_line below, and from previous behavior of removing all
-     whitespace, the simplicity of removing all trailing line terminators
-     seems more in keeping with actual command line processing.  */
+    /*
+        We conform to the way Web2c does handle trailing tabs and spaces. This
+        decade old behaviour was changed in September 2017 and can introduce
+        compatibility issues in existing workflows. Because we don't want too
+        many differences with upstream TeXlive we just follow up on that patch
+        and it's up to macro packages to deal with possible issues (which can be
+        done via the usual callbacks. One can wonder why we then still prune
+        spaces but we leave that to the reader.
+    */
+
+    /*  Patched original comment:
+
+        Make `last' be one past the last non-space character in `buffer',
+        ignoring line terminators (but not, e.g., tabs).  This is because
+        we are supposed to treat this like a line of TeX input.  Although
+        there are pathological cases (SPC CR SPC CR) where this differs
+        from input_line below, and from previous behavior of removing all
+        whitespace, the simplicity of removing all trailing line terminators
+        seems more in keeping with actual command line processing.
+    */
+
+    /*
+        The IS_SPC_OR_EOL macro deals with space characters (SPACE 32) and
+        newlines (CR and LF) and no longer looks at tabs (TAB 9).
+
+    */
+
 #define IS_SPC_OR_EOL(c) ((c) == ' ' || (c) == '\r' || (c) == '\n')
-  for (--last; last >= first && IS_SPC_OR_EOL (buffer[last]); --last) 
+  for (--last; last >= first && IS_SPC_OR_EOL (buffer[last]); --last)
     ;
   last++;
 
-    /* One more time, this time converting to TeX's internal character
-       representation.  */
+    /*
+        One more time, this time converting to TeX's internal character
+        representation.
+    */
 }
-

+
 /* 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



More information about the tex-live-commits mailing list