diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2000-02-29 18:14:30 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-02-29 18:14:30 +0000 |
commit | 49acb6c86ad2e0478eebe0cafad30e7a4989e180 (patch) | |
tree | 2a8a31c0f1e1cbbd8862f938ab14b19e71bee52e | |
parent | a5f83cbfbd62706f76b7efe925402f41fe90be0e (diff) | |
parent | 729a02f2394e6a50fe8352c9471391b53e54ac40 (diff) | |
download | perl-49acb6c86ad2e0478eebe0cafad30e7a4989e180.tar.gz |
Integrate with Sarathy.
p4raw-id: //depot/cfgperl@5365
-rw-r--r-- | perl.c | 11 | ||||
-rw-r--r-- | win32/Makefile | 4 | ||||
-rw-r--r-- | win32/makefile.mk | 4 | ||||
-rw-r--r-- | win32/win32.c | 29 | ||||
-rw-r--r-- | win32/win32.h | 1 |
5 files changed, 43 insertions, 6 deletions
@@ -906,12 +906,16 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) s = argv[0]+1; reswitch: switch (*s) { + case 'C': +#ifdef WIN32 + win32_argv2utf8(aTHX_ argc-1, argv+1); + /* FALL THROUGH */ +#endif #ifndef PERL_STRICT_CR case '\r': #endif case ' ': case '0': - case 'C': case 'F': case 'a': case 'c': @@ -3153,7 +3157,10 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register (void)gv_AVadd(PL_argvgv); av_clear(GvAVn(PL_argvgv)); for (; argc > 0; argc--,argv++) { - av_push(GvAVn(PL_argvgv),newSVpv(argv[0],0)); + SV *sv = newSVpv(argv[0],0); + av_push(GvAVn(PL_argvgv),sv); + if (PL_widesyscalls) + sv_utf8_upgrade(sv); } } if (PL_envgv = gv_fetchpv("ENV",TRUE, SVt_PVHV)) { diff --git a/win32/Makefile b/win32/Makefile index 27e597f738..88e270d63a 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -294,7 +294,7 @@ ARCHNAME = $(ARCHNAME)-thread # VC 6.0 can load the socket dll on demand. Makes the test suite # run in about 10% less time. -DELAYLOAD = -DELAYLOAD:wsock32.dll delayimp.lib +DELAYLOAD = -DELAYLOAD:wsock32.dll -DELAYLOAD:shell32.dll delayimp.lib # VC 6.0 seems capable of compiling perl correctly with optimizations # enabled. Anything earlier fails tests. @@ -818,7 +818,7 @@ perldll.def : $(MINIPERL) $(CONFIGPM) ..\global.sym ..\pp.sym ..\makedef.pl $(PERLDLL): perldll.def $(PERLDLL_OBJ) $(PERLDLL_RES) $(LINK32) -dll -def:perldll.def -out:$@ @<< - $(LINK_FLAGS) $(LIBFILES) $(PERLDLL_OBJ) $(PERLDLL_RES) + $(LINK_FLAGS) /base:0x28000000 $(LIBFILES) $(PERLDLL_OBJ) $(PERLDLL_RES) << $(XCOPY) $(PERLIMPLIB) $(COREDIR) diff --git a/win32/makefile.mk b/win32/makefile.mk index 44b5b3a2d7..724fb6304f 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -297,7 +297,7 @@ ARCHNAME !:= $(ARCHNAME)-thread # VC 6.0 can load the socket dll on demand. Makes the test suite # run in about 10% less time. -DELAYLOAD *= -DELAYLOAD:wsock32.dll delayimp.lib +DELAYLOAD *= -DELAYLOAD:wsock32.dll -DELAYLOAD:shell32.dll delayimp.lib # VC 6.0 seems capable of compiling perl correctly with optimizations # enabled. Anything earlier fails tests. @@ -1042,7 +1042,7 @@ $(PERLDLL): perldll.def $(PERLDLL_OBJ) $(PERLDLL_RES) perl.exp $(LKPOST)) .ELSE $(LINK32) -dll -def:perldll.def -out:$@ \ - @$(mktmp $(BLINK_FLAGS) $(LIBFILES) $(PERLDLL_RES) $(PERLDLL_OBJ:s,\,\\)) + @$(mktmp $(BLINK_FLAGS) $(LIBFILES) /base:0x28000000 $(PERLDLL_RES) $(PERLDLL_OBJ:s,\,\\)) .ENDIF $(XCOPY) $(PERLIMPLIB) $(COREDIR) diff --git a/win32/win32.c b/win32/win32.c index ff52692fec..87d4111609 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -15,6 +15,7 @@ #define Win32_Winsock #endif #include <windows.h> +#include <shellapi.h> #include <winnt.h> #include <io.h> @@ -4004,3 +4005,31 @@ Perl_sys_intern_dup(pTHX_ struct interp_intern *src, struct interp_intern *dst) } #endif +static void +win32_free_argvw(pTHXo_ void *ptr) +{ + char** argv = (char**)ptr; + while(*argv) { + Safefree(*argv); + *argv++ = Nullch; + } +} + +void +win32_argv2utf8(pTHX_ int argc, char** argv) +{ + char* psz; + int length, wargc; + LPWSTR* lpwStr = CommandLineToArgvW(GetCommandLineW(), &wargc); + if (lpwStr && argc) { + while (argc--) { + length = WideCharToMultiByte(CP_UTF8, 0, lpwStr[--wargc], -1, NULL, 0, NULL, NULL); + Newz(0, psz, length, char); + WideCharToMultiByte(CP_UTF8, 0, lpwStr[wargc], -1, psz, length, NULL, NULL); + argv[argc] = psz; + } + call_atexit(win32_free_argvw, argv); + } + GlobalFree((HGLOBAL)lpwStr); +} + diff --git a/win32/win32.h b/win32/win32.h index 6f4c0d061e..a96e20598a 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -321,6 +321,7 @@ extern char * win32_get_privlib(char *pl); extern char * win32_get_sitelib(char *pl); extern int IsWin95(void); extern int IsWinNT(void); +extern void win32_argv2utf8(pTHX_ int argc, char** argv); extern char * staticlinkmodules[]; |