diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2013-12-01 15:05:15 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2013-12-01 15:05:15 +0000 |
commit | b91ea14a043007a08ec25199870aa0a3a3fbbc1f (patch) | |
tree | 9e4607d05889e3ab457a8f3c137598907b413b25 /Build/source/texk/web2c | |
parent | 2fdc70b46aa72675253c5d8b51fcab18d509af38 (diff) |
Support KANJI file name in (e)up-TeX on Windows (T. Tanaka)
git-svn-id: svn://tug.org/texlive/trunk@32288 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c')
-rw-r--r-- | Build/source/texk/web2c/lib/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/openclose.c | 26 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/texmfmp.c | 39 |
3 files changed, 67 insertions, 3 deletions
diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog index 3d19d8073b4..ecc655cf371 100644 --- a/Build/source/texk/web2c/lib/ChangeLog +++ b/Build/source/texk/web2c/lib/ChangeLog @@ -1,3 +1,8 @@ +2013-12-01 TANAKA Takuji <KXD02663@nifty.ne.jp> + + * openclose.c, texmfmp.c: Support KANJI file name in (e)up-TeX 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..1d545358d22 100644 --- a/Build/source/texk/web2c/lib/openclose.c +++ b/Build/source/texk/web2c/lib/openclose.c @@ -56,9 +56,13 @@ recorder_start(void) free(recorder_name); 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); free(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..4696eefd429 100644 --- a/Build/source/texk/web2c/lib/texmfmp.c +++ b/Build/source/texk/web2c/lib/texmfmp.c @@ -628,6 +628,9 @@ void maininit (int ac, string *av) { string main_input_file; +#if IS_upTeX && defined(WIN32) + string enc; +#endif /* Save to pass along to topenin. */ argc = ac; @@ -655,11 +658,47 @@ maininit (int ac, string *av) kpse_set_program_name (argv[0], NULL); initkanji (); #endif +#if IS_upTeX && 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 */ + } + } + } +#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(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, |