diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2014-01-12 15:14:01 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2014-01-12 15:14:01 +0000 |
commit | cbf13f50c39f0d3869df7ccf9ad1348a193c48d1 (patch) | |
tree | 5d770798b8e898b03da8068f3713853ee1167fda /Build/source | |
parent | f4bf26a1af8186c98c64a15d04e4b6a8cbeca85e (diff) |
Allow Unicode file names in (x)dvipdfmx on Windows (from T. Tanaka)
git-svn-id: svn://tug.org/texlive/trunk@32644 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r-- | Build/source/texk/dvipdfm-x/ChangeLog | 7 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/dpxfile.c | 24 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/dvipdfmx.c | 27 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/mfileio.c | 4 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/mfileio.h | 4 |
5 files changed, 64 insertions, 2 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index 247955b2343..124149cef59 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -1,3 +1,10 @@ +2014-01-12 TANAKA Takuji <KXD02663@nifty.ne.jp> + + * dvipdfm.c: Add '--kpathsea-debug' option and + fix a bug in '--dvipdfm' option. + * dvipdfm.c, mfileio.[ch], dbxfile.c: Allow Unicode file name + on Windows. + 2014-01-02 Peter Breitenlohner <peb@mppmu.mpg.de> * pngimage.c: Allow libpng >= 1.6.3 to read images with diff --git a/Build/source/texk/dvipdfm-x/dpxfile.c b/Build/source/texk/dvipdfm-x/dpxfile.c index ea956e034ca..d6b7de4f8bf 100644 --- a/Build/source/texk/dvipdfm-x/dpxfile.c +++ b/Build/source/texk/dvipdfm-x/dpxfile.c @@ -165,6 +165,9 @@ static int exec_spawn (char *cmd) char *p, *pp; char buf[1024]; int i, ret = -1; +#ifdef WIN32 + wchar_t **cmdvw, **qvw; +#endif if (!cmd) return -1; @@ -233,7 +236,16 @@ static int exec_spawn (char *cmd) qv++; } #ifdef WIN32 - ret = spawnvp (_P_WAIT, *cmdv, (const char* const*) cmdv); + cmdvw = xcalloc (i + 2, sizeof (wchar_t *)); + qv = cmdv; + qvw = cmdvw; + while (*qv) { + *qvw = get_wstring_from_fsyscp(*qv, *qvw=NULL); + qv++; + qvw++; + } + *qvw = NULL; + ret = _wspawnvp (_P_WAIT, *cmdvw, (const wchar_t* const*) cmdvw); #else i = fork (); if (i < 0) @@ -256,6 +268,16 @@ done: qv++; } free (cmdv); +#ifdef WIN32 + if (cmdvw) { + qvw = cmdvw; + while (*qvw) { + free (*qvw); + qvw++; + } + free (cmdvw); + } +#endif return ret; } diff --git a/Build/source/texk/dvipdfm-x/dvipdfmx.c b/Build/source/texk/dvipdfm-x/dvipdfmx.c index 4f65a49a8b6..b5e0eb7ba89 100644 --- a/Build/source/texk/dvipdfm-x/dvipdfmx.c +++ b/Build/source/texk/dvipdfm-x/dvipdfmx.c @@ -194,6 +194,7 @@ show_usage (void) fprintf (stdout, " --version\tOutput version information and exit\n"); fprintf (stdout, " -v \t\tBe verbose\n"); fprintf (stdout, " -vv\t\tBe more verbose\n"); + fprintf (stdout, " --kpathsea-debug number\tSet kpathsearch debugging flags [0]\n"); fprintf (stdout, " -x dimension\tSet horizontal offset [1.0in]\n"); fprintf (stdout, " -y dimension\tSet vertical offset [1.0in]\n"); fprintf (stdout, " -z number \tSet zlib compression level (0-9) [9]\n"); @@ -443,7 +444,14 @@ do_args (int argc, char *argv[]) exit(0); } else if (!is_xetex && !strcmp(flag, "dvipdfm")) { compat_mode = 1; - break; + goto Out_of_For_Loop; + } else if (!strcmp(flag, "kpathsea-debug")) { + CHECK_ARG(1, "kpathsearch debugging flags"); + kpathsea_debug = atoi(argv[1]); + if (kpathsea_debug < 0) + ERROR("Invalid kpathsearch debugging flags specified: %s", argv[1]); + POP_ARG(); + goto Out_of_For_Loop; } } fprintf(stderr, "Unknown option \"%s\"", argv[0]); @@ -636,6 +644,7 @@ do_args (int argc, char *argv[]) usage(); } } + Out_of_For_Loop: POP_ARG(); } @@ -875,16 +884,30 @@ do_mps_pages (void) } } +#ifdef WIN32 +int argc; +char **argv; +#endif /* TODO: MetaPost mode */ #if defined(MIKTEX) # define main Main #endif int CDECL +#ifdef WIN32 +main (int ac, char *av[]) +#else main (int argc, char *argv[]) +#endif { double dvi2pts; char *base; +#ifdef WIN32 + char *enc; + + argc=ac; + argv=av; +#endif #ifdef MIKTEX miktex_initialize(); @@ -892,6 +915,8 @@ main (int argc, char *argv[]) kpse_set_program_name(argv[0], "dvipdfmx"); /* we pretend to be dvipdfmx for kpse purposes */ #ifdef WIN32 texlive_gs_init (); + enc = kpse_var_value("command_line_encoding"); + get_command_line_args_utf8(enc, &argc, &argv); #endif #endif diff --git a/Build/source/texk/dvipdfm-x/mfileio.c b/Build/source/texk/dvipdfm-x/mfileio.c index f2ea51b5544..cabb40a8ddf 100644 --- a/Build/source/texk/dvipdfm-x/mfileio.c +++ b/Build/source/texk/dvipdfm-x/mfileio.c @@ -52,7 +52,11 @@ FILE *mfopen(const char *name, const char *mode, const char *function, int line) { FILE *tmp; io_debug_init(); +#if defined(WIN32) + tmp = fsyscp_fopen (name, mode); +#else tmp = fopen (name, mode); +#endif event += 1; fprintf(iodebug_file, "%p %07ld [fopen] %s:%d\n", tmp, event, function, line); diff --git a/Build/source/texk/dvipdfm-x/mfileio.h b/Build/source/texk/dvipdfm-x/mfileio.h index a749b589fc5..6955fd87e13 100644 --- a/Build/source/texk/dvipdfm-x/mfileio.h +++ b/Build/source/texk/dvipdfm-x/mfileio.h @@ -37,7 +37,11 @@ int mfclose (FILE *file, const char *function, int line); #define MFCLOSE(file) \ mfclose((file),__FUNCTION__,__LINE__) #else +#if defined(WIN32) +#define MFOPEN(name,mode) fsyscp_fopen((name),(mode)) +#else #define MFOPEN(name,mode) fopen((name),(mode)) +#endif #define MFCLOSE(file) fclose(file) #endif |