diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2013-12-03 14:32:09 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2013-12-03 14:32:09 +0000 |
commit | 5b0be858da5f93a678e7665f67921f8e63559f5a (patch) | |
tree | 8fd7977521cfc2ed41d72c599ffc50330b50c0e0 /Build/source/texk/web2c/lib | |
parent | e12d9594464166e09a2127166d663cedbcd9a050 (diff) |
Support KANJI file name in (e)upTeX and XeTeX on Windows (from T. Tanaka)
git-svn-id: svn://tug.org/texlive/trunk@32308 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/lib')
-rw-r--r-- | Build/source/texk/web2c/lib/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/openclose.c | 22 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/texmfmp.c | 46 |
3 files changed, 70 insertions, 3 deletions
diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog index 3d19d8073b4..c81beaad816 100644 --- a/Build/source/texk/web2c/lib/ChangeLog +++ b/Build/source/texk/web2c/lib/ChangeLog @@ -1,3 +1,8 @@ +2013-12-03 TANAKA Takuji <KXD02663@nifty.ne.jp> + + * openclose.c, texmfmp.c: Support KANJI file name in (e)upTeX and + XeTeX on Windows. + 2013-06-11 Peter Breitenlohner <peb@mppmu.mpg.de> Update to e-pTeX and e-upTeX 130605 from Hironori Kitagawa. diff --git a/Build/source/texk/web2c/lib/openclose.c b/Build/source/texk/web2c/lib/openclose.c index 2620b8894bd..35301b5187c 100644 --- a/Build/source/texk/web2c/lib/openclose.c +++ b/Build/source/texk/web2c/lib/openclose.c @@ -57,7 +57,11 @@ recorder_start(void) recorder_name = temp; } +#if defined(WIN32) + recorder_file = fsyscp_xfopen(recorder_name, FOPEN_W_MODE); +#else recorder_file = xfopen(recorder_name, FOPEN_W_MODE); +#endif cwd = xgetcwd(); fprintf(recorder_file, "PWD %s\n", cwd); @@ -101,7 +105,7 @@ recorder_change_filename (string new_name) /* reopen the recorder file by FOPEN_A_MODE. */ #if defined(WIN32) - recorder_file = fopen (recorder_name, FOPEN_A_MODE); + recorder_file = fsyscp_xfopen (recorder_name, FOPEN_A_MODE); #endif if (temp) @@ -165,7 +169,11 @@ open_input (FILE **f_ptr, int filefmt, const_string fopen_mode) them from there. We only look for the name as-is. */ if (output_directory && !kpse_absolute_p (nameoffile+1, false)) { fname = concat3 (output_directory, DIR_SEP_STRING, nameoffile + 1); +#if defined(WIN32) + *f_ptr = fsyscp_xfopen (fname, fopen_mode); +#else *f_ptr = fopen (fname, fopen_mode); +#endif if (*f_ptr) { free (nameoffile); namelength = strlen (fname); @@ -182,7 +190,11 @@ open_input (FILE **f_ptr, int filefmt, const_string fopen_mode) /* A negative FILEFMT means don't use a path. */ if (filefmt < 0) { /* no_file_path, for BibTeX .aux files and MetaPost things. */ +#if defined(WIN32) + *f_ptr = fsyscp_xfopen(nameoffile + 1, fopen_mode); +#else *f_ptr = fopen(nameoffile + 1, fopen_mode); +#endif /* FIXME... fullnameoffile = xstrdup(nameoffile + 1); */ } else { /* The only exception to `must_exist' being true is \openin, for @@ -227,7 +239,11 @@ open_input (FILE **f_ptr, int filefmt, const_string fopen_mode) *f_ptr = nkf_open (nameoffile + 1, fopen_mode); } else #endif +#if defined(WIN32) + *f_ptr = fsyscp_xfopen (nameoffile + 1, fopen_mode); +#else *f_ptr = xfopen (nameoffile + 1, fopen_mode); +#endif } } } @@ -275,7 +291,11 @@ open_output (FILE **f_ptr, const_string fopen_mode) } /* Is the filename openable as given? */ +#if defined(WIN32) + *f_ptr = fsyscp_xfopen (fname, fopen_mode); +#else *f_ptr = fopen (fname, fopen_mode); +#endif if (!*f_ptr) { /* Can't open as given. Try the envvar. */ diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c index 515d68b0b50..548012365e2 100644 --- a/Build/source/texk/web2c/lib/texmfmp.c +++ b/Build/source/texk/web2c/lib/texmfmp.c @@ -628,7 +628,9 @@ void maininit (int ac, string *av) { string main_input_file; - +#if (IS_upTeX || defined(XeTeX)) && defined(WIN32) + string enc; +#endif /* Save to pass along to topenin. */ argc = ac; argv = av; @@ -655,11 +657,51 @@ maininit (int ac, string *av) kpse_set_program_name (argv[0], NULL); initkanji (); #endif +#if defined(XeTeX) && defined(WIN32) + kpse_set_program_name (argv[0], NULL); +#endif +#if (IS_upTeX || defined(XeTeX)) && defined(WIN32) + enc = kpse_var_value("command_line_encoding"); + if (enc) { +#ifdef DEBUG + fprintf(stderr, "command_line_encoding (%s)\n", enc); +#endif /* DEBUG */ + if (!(strncmp(enc,"utf8",5) && strncmp(enc,"utf-8",6))) { + DWORD ret; + LPWSTR *argvw; + INT argcw, i; + string s; +#ifdef DEBUG + HANDLE hStderr; + hStderr = GetStdHandle( STD_ERROR_HANDLE ); +#endif /* DEBUG */ + file_system_codepage = CP_UTF8; + is_cp932_system = 0; + argvw = CommandLineToArgvW(GetCommandLineW(), &argcw); + argc = argcw; + argv = xmalloc(sizeof(char *)*(argcw+1)); + for (i=0; i<argcw; i++) { + s = get_utf8_from_wstring(argvw[i], s=NULL); + argv[i] = s; +#ifdef DEBUG + fprintf(stderr, "Commandline arguments %d:(%s) [", i, argv[i]); + WriteConsoleW( hStderr, argvw[i], wcslen(argvw[i]), &ret, NULL); + fprintf(stderr, "]\n"); +#endif /* DEBUG */ + } + argv[argcw] = NULL; + } + } +#endif /* If the user says --help or --version, we need to notice early. And since we want the --ini option, have to do it before getting into the web (which would read the base file, etc.). */ +#if (IS_upTeX || defined(XeTeX)) && defined(WIN32) + parse_options (argc, argv); +#else parse_options (ac, av); +#endif #if IS_pTeX /* In pTeX and friends, texmf.cnf is not recorded in the case of --recorder, @@ -679,7 +721,7 @@ maininit (int ac, string *av) /* Do this early so we can inspect kpse_invocation_name and kpse_program_name below, and because we have to do this before any path searching. */ -#if IS_pTeX +#if IS_pTeX || (defined(XeTeX) && defined(WIN32)) if (user_progname) kpse_reset_program_name (user_progname); #else |