diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2018-10-25 02:57:22 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2018-10-25 02:57:22 +0000 |
commit | 77f0092362c5bd77d12f626b076d7a8c04af7152 (patch) | |
tree | ec8ae901175af06e3e4fea60cf05ca044b2bd89b /Build/source/texk/web2c | |
parent | 4cc1ff52d65bff379205e275bc683859a091d47f (diff) |
synctex.c: Cleanup for non-ascii file names (w32 only).
git-svn-id: svn://tug.org/texlive/trunk@48985 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c')
-rw-r--r-- | Build/source/texk/web2c/synctexdir/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/synctexdir/synctex.c | 32 |
2 files changed, 31 insertions, 5 deletions
diff --git a/Build/source/texk/web2c/synctexdir/ChangeLog b/Build/source/texk/web2c/synctexdir/ChangeLog index 1a0e601be0d..a49d19d71c1 100644 --- a/Build/source/texk/web2c/synctexdir/ChangeLog +++ b/Build/source/texk/web2c/synctexdir/ChangeLog @@ -1,3 +1,7 @@ +2018-10-25 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + * synctex.c: Cleanup for non-ascii file names (w32 only). + 2018-07-27 Karl Berry <karl@freefriends.org> * synctex_parser_api_level.txt: new file (contents "2.0.0"). diff --git a/Build/source/texk/web2c/synctexdir/synctex.c b/Build/source/texk/web2c/synctexdir/synctex.c index 987a8c2d94d..53645d3ba34 100644 --- a/Build/source/texk/web2c/synctexdir/synctex.c +++ b/Build/source/texk/web2c/synctexdir/synctex.c @@ -292,13 +292,14 @@ mem[NODE+TYPE##_node_size-synchronization_field_size+1].cint # 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 @@ void synctexabort(boolean log_opened __attribute__ ((unused))) 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 @@ static char *chgto_oem(char *src) 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 @@ static gzFile fsyscp_gzopen(const char *path, const char *mode) { 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 @@ static int fsyscp_remove(char *s) { 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 @@ static int fsyscp_rename(char *s1, char *s2) 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 @@ static int fsyscp_rename(char *s1, char *s2) } #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. |