texlive[51833] Build/source/texk/web2c: Improve support of non-ascii

commits+kakuto at tug.org commits+kakuto at tug.org
Wed Aug 7 04:13:08 CEST 2019


Revision: 51833
          http://tug.org/svn/texlive?view=revision&revision=51833
Author:   kakuto
Date:     2019-08-07 04:13:07 +0200 (Wed, 07 Aug 2019)
Log Message:
-----------
Improve support of non-ascii path names (Windows only).

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/lib/ChangeLog
    trunk/Build/source/texk/web2c/lib/texmfmp.c
    trunk/Build/source/texk/web2c/synctexdir/ChangeLog
    trunk/Build/source/texk/web2c/synctexdir/synctex.c

Modified: trunk/Build/source/texk/web2c/lib/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/lib/ChangeLog	2019-08-06 23:53:12 UTC (rev 51832)
+++ trunk/Build/source/texk/web2c/lib/ChangeLog	2019-08-07 02:13:07 UTC (rev 51833)
@@ -1,3 +1,9 @@
+2019-08-07  Akira Kakuto  <kakuto at w32tex.org>
+
+	* texmfmp.c: Improve support of non-ascii path names in
+	synctex. Support -cnf-line=command_line_encoding=value.
+	These changes are for Windows only.
+
 2019-08-06  Karl Berry  <karl at freefriends.org>
 
 	* texmfmp.c (long_options): new option --cnf-line.

Modified: trunk/Build/source/texk/web2c/lib/texmfmp.c
===================================================================
--- trunk/Build/source/texk/web2c/lib/texmfmp.c	2019-08-06 23:53:12 UTC (rev 51832)
+++ trunk/Build/source/texk/web2c/lib/texmfmp.c	2019-08-07 02:13:07 UTC (rev 51833)
@@ -131,9 +131,18 @@
    --output-directory option is given.
    Borrowed from LuaTeX.
 */
+#if defined(_WIN32)
+#if defined(pdfTeX) || defined(upTeX) || defined(eupTeX) || defined(XeTeX) || defined(LuaTeX) || defined(LuajitTeX)
+#define W32USYNCTEX 1
+#endif
+#endif
+
 char *generic_synctex_get_current_name (void)
 {
   char *pwdbuf, *ret;
+#if defined(W32USYNCTEX)
+  wchar_t *wpwd;
+#endif /* W32USYNCTEX */
   if (!fullnameoffile) {
     ret = xstrdup("");
     return ret;
@@ -142,6 +151,14 @@
      return xstrdup(fullnameoffile);
   }
   pwdbuf = xgetcwd();
+#if defined(W32USYNCTEX)
+  if (file_system_codepage != 0 && file_system_codepage != win32_codepage) {
+     wpwd = get_wstring_from_mbstring(win32_codepage, pwdbuf, wpwd=NULL);
+     free (pwdbuf);
+     pwdbuf = get_mbstring_from_wstring(file_system_codepage, wpwd, pwdbuf=NULL);
+     free (wpwd);
+  }
+#endif /* W32USYNCTEX */
   ret = concat3(pwdbuf, DIR_SEP_STRING, fullnameoffile);
   free(pwdbuf) ;
   return ret;
@@ -750,6 +767,30 @@
   kpse_set_program_name (argv[0], NULL);
 #endif
 #if (IS_upTeX || defined(XeTeX) || defined(pdfTeX)) && defined(WIN32)
+/* 
+   -cnf-line=command_line_encoding=value cannot give effect because
+   command_line_encoding is read here before parsing the command
+   line. So we add the following.
+*/
+  { /* support old compilers which are incompatible with C99 */
+    int n;
+    for (n = 1; n < ac; n++) {
+      if (!strncasecmp (av[n], "-cnf-line=command_line_encoding=", 32)) {
+        putenv (av[n] + 10);
+        break;
+      }
+      if (!strncasecmp (av[n], "--cnf-line=command_line_encoding=", 33)) {
+        putenv (av[n] + 11);
+        break;
+      }
+      if (n < ac - 1 && (!strncasecmp (av[n], "-cnf-line", 9) ||
+          !strncasecmp (av[n], "--cnf-line", 10)) &&
+          !strncasecmp (av[n+1], "command_line_encoding=", 22)) {
+        putenv (av[n+1]);
+        break;
+      }
+    }
+  }
   enc = kpse_var_value("command_line_encoding");
   get_command_line_args_utf8(enc, &argc, &argv);
 #endif

Modified: trunk/Build/source/texk/web2c/synctexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/synctexdir/ChangeLog	2019-08-06 23:53:12 UTC (rev 51832)
+++ trunk/Build/source/texk/web2c/synctexdir/ChangeLog	2019-08-07 02:13:07 UTC (rev 51833)
@@ -1,3 +1,8 @@
+2019-08-07  Akira Kakuto  <kakuto at w32tex.org>
+
+	* synctex.c: Improve support of non-ascii path names
+	(Windows only).
+
 2018-10-25  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
 
 	* synctex.c: Cleanup for non-ascii file names (w32 only).

Modified: trunk/Build/source/texk/web2c/synctexdir/synctex.c
===================================================================
--- trunk/Build/source/texk/web2c/synctexdir/synctex.c	2019-08-06 23:53:12 UTC (rev 51832)
+++ trunk/Build/source/texk/web2c/synctexdir/synctex.c	2019-08-07 02:13:07 UTC (rev 51833)
@@ -293,7 +293,7 @@
 #   endif
 
 #if defined(_WIN32)
-#if defined(pdfTeX) || defined(upTeX) || defined(eupTeX) || defined(XeTeX)
+#if defined(pdfTeX) || defined(upTeX) || defined(eupTeX) || defined(XeTeX) || defined(LuaTeX) || defined(LuajitTeX)
 #define W32UPTEXSYNCTEX 1
 #include <wchar.h>
 static char *chgto_oem(char *src);
@@ -591,7 +591,8 @@
 }
 
 #undef fopen
-#define fopen fsyscp_fopen
+extern FILE *f_fsyscp_fopen(const char *filename, const char *mode);
+#define fopen f_fsyscp_fopen
 #define gzopen fsyscp_gzopen
 #define rename fsyscp_rename
 #define remove fsyscp_remove



More information about the tex-live-commits mailing list