texlive[48985] Build/source/texk/web2c/synctexdir: synctex.c: Cleanup

commits+kakuto at tug.org commits+kakuto at tug.org
Thu Oct 25 04:57:23 CEST 2018


Revision: 48985
          http://tug.org/svn/texlive?view=revision&revision=48985
Author:   kakuto
Date:     2018-10-25 04:57:22 +0200 (Thu, 25 Oct 2018)
Log Message:
-----------
synctex.c: Cleanup for non-ascii file names (w32 only).

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

Modified: trunk/Build/source/texk/web2c/synctexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/synctexdir/ChangeLog	2018-10-25 00:18:04 UTC (rev 48984)
+++ trunk/Build/source/texk/web2c/synctexdir/ChangeLog	2018-10-25 02:57:22 UTC (rev 48985)
@@ -1,3 +1,7 @@
+2018-10-25  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
+
+	* synctex.c: Cleanup for non-ascii file names (w32 only).
+
 2018-07-27  Karl Berry  <karl at freefriends.org>
 
 	* synctex_parser_api_level.txt: new file (contents "2.0.0").

Modified: trunk/Build/source/texk/web2c/synctexdir/synctex.c
===================================================================
--- trunk/Build/source/texk/web2c/synctexdir/synctex.c	2018-10-25 00:18:04 UTC (rev 48984)
+++ trunk/Build/source/texk/web2c/synctexdir/synctex.c	2018-10-25 02:57:22 UTC (rev 48985)
@@ -292,13 +292,14 @@
 #       define SYNCTEX_OFFSET_IS_PDF 0
 #   endif
 
-#if defined(_WIN32) && (defined(pdfTeX) || defined(upTeX) || defined(eupTeX) || defined(XeTeX))
+#if defined(_WIN32)
+#if defined(pdfTeX) || defined(upTeX) || defined(eupTeX) || defined(XeTeX) || (defined(_MSC_VER) && (defined(LuaTeX) || defined(LuajitTeX)))
 #define W32UPTEXSYNCTEX 1
 #include <wchar.h>
 static char *chgto_oem(char *src);
 static int fsyscp_remove(char *name);
-#define remove fsyscp_remove
-#endif
+#endif /* pdfTeX ... */
+#endif /* _WIN32 */
 
 /*  This macro layer was added to take luatex into account as suggested by T. Hoekwater. */
 #   if !defined(SYNCTEX_GET_JOB_NAME)
@@ -496,7 +497,11 @@
             gzclose((gzFile) SYNCTEX_FILE);
         }
         SYNCTEX_FILE = NULL;
+#if defined(W32UPTEXSYNCTEX)
+        fsyscp_remove(synctex_ctxt.busy_name);
+#else
         remove(synctex_ctxt.busy_name);
+#endif /* W32UPTEXSYNCTEX */
         SYNCTEX_FREE(synctex_ctxt.busy_name);
         synctex_ctxt.busy_name = NULL;
     }
@@ -530,7 +535,7 @@
     f_codepage = AreFileApisANSI() ? GetACP() : GetOEMCP();
   }
 
-  if(f_codepage == file_system_codepage) {
+  if(file_system_codepage == 0 || f_codepage == file_system_codepage) {
     dst = xstrdup(src);
     return dst;
   }
@@ -545,6 +550,10 @@
 {
   gzFile  gzf;
   wchar_t *pathw = NULL;
+
+  if(!file_system_codepage)
+    return gzopen(path, mode);
+
   pathw = get_wstring_from_fsyscp(path, pathw);
   gzf = gzopen_w(pathw, mode);
   free(pathw);
@@ -555,6 +564,10 @@
 {
   wchar_t *sw = NULL;
   int ret;
+
+  if(!file_system_codepage)
+    return remove(s);
+
   sw = get_wstring_from_fsyscp(s, sw);
   ret = _wremove(sw);
   if(sw) free(sw);
@@ -566,6 +579,9 @@
   wchar_t *sw1 = NULL, *sw2 = NULL;
   int ret;
 
+  if(!file_system_codepage)
+    return rename(s1, s2);
+
   sw1 = get_wstring_from_fsyscp(s1, sw1);
   sw2 = get_wstring_from_fsyscp(s2, sw2);
   ret = _wrename(sw1, sw2);
@@ -575,10 +591,16 @@
 }
 
 #undef fopen
+#if defined(LuaTeX) || defined(LuajitTeX)
+extern FILE *futf8open(const char *filename, const char *mode);
+#define fopen futf8open
+#else
 #define fopen fsyscp_fopen
+#endif /* LuaTeX || LuajitTeX */
 #define gzopen fsyscp_gzopen
 #define rename fsyscp_rename
-#endif
+#define remove fsyscp_remove
+#endif /* W32UPTEXSYNCTEX */
 
 /*  synctex_dot_open ensures that the foo.synctex file is open.
  *  In case of problem, it definitely disables synchronization.



More information about the tex-live-commits mailing list