Skip to content

Commit

Permalink
Move option parsing to libjulia
Browse files Browse the repository at this point in the history
  • Loading branch information
Keno committed Jul 8, 2016
1 parent 813cd6e commit 914233e
Show file tree
Hide file tree
Showing 9 changed files with 474 additions and 451 deletions.
6 changes: 5 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ SRCS := \
jltypes gf typemap ast builtins module interpreter \
alloc dlload sys init task array dump toplevel jl_uv jlapi signal-handling \
simplevector APInt-C runtime_intrinsics runtime_ccall \
threadgroup threading stackwalk gc gc-debug gc-pages safepoint
threadgroup threading stackwalk gc gc-debug gc-pages safepoint jloptions

ifeq ($(USEMSVC), 1)
SRCS += getopt
endif

LLVMLINK :=

Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jl_options_t jl_options = { 0, // quiet
NULL, // outputo
NULL, // outputji
0, // incremental
0 // image_file_specified
};

int jl_boot_file_loaded = 0;
Expand Down
451 changes: 451 additions & 0 deletions src/jloptions.c

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -1673,10 +1673,19 @@ typedef struct {
const char *outputo;
const char *outputji;
int8_t incremental;
int8_t image_file_specified;
} jl_options_t;

extern JL_DLLEXPORT jl_options_t jl_options;

// Parse an argc/argv pair to extract general julia options, passing back out
// any arguments that should be passed on to the script.
JL_DLLEXPORT void jl_parse_opts(int *argcp, char ***argvp);

// Set julia-level ARGS array according to the arguments provided in
// argc/argv
JL_DLLEXPORT void jl_set_ARGS(int argc, char **argv);

JL_DLLEXPORT int jl_generating_output(void);

// Settings for code_coverage and malloc_log
Expand Down
5 changes: 4 additions & 1 deletion test/cmdlineargs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,10 @@ let exename = `$(Base.julia_cmd()) --precompiled=yes`
end

# Make sure `julia --lisp` doesn't break
run(pipeline(DevNull, `$(Base.julia_cmd()) --lisp`, DevNull))
run(pipeline(DevNull, `$(joinpath(JULIA_HOME, Base.julia_exename())) --lisp`, DevNull))

# Test that `julia [some other option] --lisp` is disallowed
@test_throws ErrorException run(pipeline(DevNull, pipeline(`$(joinpath(JULIA_HOME, Base.julia_exename())) -Cnative --lisp`, stderr=DevNull), DevNull))

# --precompiled={yes|no}
let exename = `$(Base.julia_cmd())`
Expand Down
3 changes: 0 additions & 3 deletions ui/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ override CXXFLAGS += $(JCXXFLAGS)
override CPPFLAGS += $(JCPPFLAGS)

SRCS := repl
ifeq ($(USEMSVC), 1)
SRCS += getopt
endif

HEADERS := $(addprefix $(JULIAHOME)/src/,julia.h julia_threads.h julia_internal.h options.h) \
$(BUILDDIR)/../src/julia_version.h $(wildcard $(JULIAHOME)/src/support/*.h) $(LIBUV_INC)/uv.h
Expand Down
Loading

0 comments on commit 914233e

Please sign in to comment.