Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Jun 28, 2014
1 parent 99026b0 commit d7692a6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/support/ios.c
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,12 @@ ios_t *ios_file(ios_t *s, char *fname, int rd, int wr, int create, int trunc)
#if defined(_OS_WINDOWS_)
fd = open(fname, flags | O_BINARY, _S_IREAD | _S_IWRITE);
#else
fd = open(fname, flags, S_IRUSR | S_IWUSR /* 0600 */ | S_IRGRP | S_IROTH /* 0644 */);
size_t len = strlen(fname)+1;
size_t wlen = MultiByteToWideChar(CP_UTF8, 0, fname, len, NULL, 0);
if (!wlen) goto open_file_err;
wchar_t *fname_w = (wchar_t*)alloca(wlen*sizeof(wchar_t));
if (!MultiByteToWideChar(CP_UTF8, 0, fname, len, fname_w, wlen)) goto open_file_err;
fd = _wopen(fname_w, flags, S_IRUSR | S_IWUSR /* 0600 */ | S_IRGRP | S_IROTH /* 0644 */);
#endif
s = ios_fd(s, fd, 1, 1);
if (fd == -1)
Expand Down
4 changes: 4 additions & 0 deletions ui/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ JLDFLAGS += $(WHOLE_ARCHIVE) $(build_libdir)/libopenlibm.a $(NO_WHOLE_ARCHIVE)
endif
endif

ifeq ($(OS),WINNT)
JLDFLAGS += -municode
endif

release debug:
$(MAKE) julia-$@

Expand Down
19 changes: 17 additions & 2 deletions ui/repl.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,16 +300,31 @@ int true_main(int argc, char *argv[])
return iserr;
}

#ifndef _OS_WINDOWS_
int main(int argc, char *argv[])
{
#else
int wmain(int argc, wchar_t *argv[], wchar_t *envp[])
{
int i;
for (i=0; i<argc; i++) { // write the command line to UTF8
wchar_t *warg = argv[i];
size_t wlen = wcslen(warg)+1;
size_t len = WideCharToMultiByte(CP_UTF8, 0, warg, wlen, NULL, 0, NULL, NULL);
if (!len) return 1;
char *arg = (char*)alloca(len);
if (!WideCharToMultiByte(CP_UTF8, 0, warg, wlen, arg, len, NULL, NULL)) return 1;
argv[i] = (wchar_t*)arg;
}
#endif
libsupport_init();
parse_opts(&argc, &argv);
parse_opts(&argc, (char***)&argv);
if (lisp_prompt) {
jl_lisp_prompt();
return 0;
}
julia_init(lisp_prompt ? NULL : image_file);
return julia_trampoline(argc, argv, true_main);
return julia_trampoline(argc, (char**)argv, true_main);
}

#ifdef __cplusplus
Expand Down

0 comments on commit d7692a6

Please sign in to comment.