Skip to content

Commit

Permalink
Merge branch 'master' of github.com:JuliaLang/julia
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Aug 20, 2014
2 parents 2ce3ec1 + 538b3d4 commit 5426f6a
Show file tree
Hide file tree
Showing 40 changed files with 618 additions and 438 deletions.
18 changes: 8 additions & 10 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -742,23 +742,21 @@ else
endif
endef

ifeq ($(BUILD_OS), WINNT)
ifeq ($(BUILD_OS), WINNT) # MSYS
spawn = $(1)
else ifneq (,$(findstring CYGWIN,$(BUILD_OS)))
cygpath_w = $(1)
else ifneq (,$(findstring CYGWIN,$(BUILD_OS))) # Cygwin
spawn = $(1)
cygpath_w = `cygpath -w $(1)`
else
ifeq ($(OS), WINNT)
ifeq ($(OS), WINNT) # unix-to-Windows cross-compile
spawn = wine $(1)
else
cygpath_w = `winepath -w $(1)`
else # not Windows
spawn = $(1)
endif
endif

ifneq (,$(findstring CYGWIN,$(BUILD_OS)))
cygpath_w = `cygpath -w $(1)`
else
cygpath_w = $(1)
endif
endif

exec = $(shell $(call spawn,$(1)))

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ endif

# Overwrite JL_SYSTEM_IMAGE_PATH in julia binaries:
for julia in $(DESTDIR)$(bindir)/julia* ; do \
$(build_bindir)/stringreplace $$(strings -t x - $$julia | grep "sys.ji$$" | awk '{print $$1;}' ) "$(private_libdir_rel)/sys.ji" 256 $(call cygpath_w,$$julia); \
$(call spawn,$(build_bindir)/stringreplace $$(strings -t x - $$julia | grep "sys.ji$$" | awk '{print $$1;}' ) "$(private_libdir_rel)/sys.ji" 256 $(call cygpath_w,$$julia)); \
done

mkdir -p $(DESTDIR)$(sysconfdir)
Expand Down
20 changes: 17 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,21 @@ New language features
Library improvements
--------------------

* Added generic Cholesky factorization
* New `Dates` module for calendar dates and other time-interval calculations ([#7654]).

* Cholesky factorization is now parametrized on matrix type
* Added generic Cholesky factorization, and the Cholesky factorization is now parametrized on the matrix type ([#7236]).

* Symmetric and Hermitian immutables are now parametrized on matrix type
* Symmetric and Hermitian immutables are now parametrized on matrix type ([#7992]).

* Switch from `O(N)` to `O(logN)` algorithm for `dequeue!(pq, key)`
with PriorityQueues. This provides major speedups for large
queues.

* PriorityQueues now include the order type among their parameters,
`PriorityQueue{KeyType,ValueType,OrderType}`. An empty queue can
be constructed as `pq = PriorityQueue(KeyType,ValueType)`, if you
intend to use the default `Forward` order, or
`pq = PriorityQueue(KeyType, ValueType, OrderType)` otherwise.

Julia v0.3.0 Release Notes
==========================
Expand Down Expand Up @@ -924,6 +934,7 @@ Too numerous to mention.
[#7125]: https://github.com/JuliaLang/julia/issues/7125
[#7131]: https://github.com/JuliaLang/julia/issues/7131
[#7146]: https://github.com/JuliaLang/julia/issues/7146
[#7236]: https://github.com/JuliaLang/julia/issues/7236
[#7242]: https://github.com/JuliaLang/julia/issues/7242
[#7359]: https://github.com/JuliaLang/julia/issues/7359
[#7365]: https://github.com/JuliaLang/julia/issues/7365
Expand All @@ -933,3 +944,6 @@ Too numerous to mention.
[#7464]: https://github.com/JuliaLang/julia/issues/7464
[#7513]: https://github.com/JuliaLang/julia/issues/7513
[#7647]: https://github.com/JuliaLang/julia/issues/7647
[#7654]: https://github.com/JuliaLang/julia/issues/7654
[#7917]: https://github.com/JuliaLang/julia/issues/7917
[#7992]: https://github.com/JuliaLang/julia/issues/7992
9 changes: 6 additions & 3 deletions base/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -276,20 +276,23 @@ bytestring_beforecursor(buf::IOBuffer) = bytestring(pointer(buf.data), buf.ptr-1

function complete_line(c::REPLCompletionProvider, s)
partial = bytestring_beforecursor(s.input_buffer)
ret, range, should_complete = completions(partial, endof(partial))
full = LineEdit.input_string(s)
ret, range, should_complete = completions(full, endof(partial))
return ret, partial[range], should_complete
end

function complete_line(c::ShellCompletionProvider, s)
# First parse everything up to the current position
partial = bytestring_beforecursor(s.input_buffer)
ret, range, should_complete = shell_completions(partial, endof(partial))
full = LineEdit.input_string(s)
ret, range, should_complete = shell_completions(full, endof(partial))
return ret, partial[range], should_complete
end

function complete_line(c::LatexCompletions, s)
partial = bytestring_beforecursor(LineEdit.buffer(s))
ret, range, should_complete = latex_completions(partial, endof(partial))[2]
full = LineEdit.input_string(s)
ret, range, should_complete = latex_completions(full, endof(partial))[2]
return ret, partial[range], should_complete
end

Expand Down
71 changes: 29 additions & 42 deletions base/REPLCompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,23 +107,27 @@ function complete_keyword(s::ByteString)
sorted_keywords[r]
end

function complete_path(path::ByteString)
matches = ByteString[]
function complete_path(path::String, pos)
dir, prefix = splitdir(path)
if length(dir) == 0
files = readdir()
elseif isdir(dir)
files = readdir(dir)
else
return matches
local files
try
if length(dir) == 0
files = readdir()
elseif isdir(dir)
files = readdir(dir)
else
return UTF8String[], 0:-1, false
end
catch
return UTF8String[], 0:-1, false
end
matches = UTF8String[]
for file in files
if beginswith(file, prefix)
p = joinpath(dir, file)
push!(matches, isdir(p) ? joinpath(p,"") : p)
push!(matches, isdir(joinpath(dir, file)) ? joinpath(file,"") : file)
end
end
matches
matches, (nextind(path, pos-sizeof(prefix))):pos, length(matches) > 0
end

function complete_methods(input::String)
Expand Down Expand Up @@ -176,18 +180,23 @@ function latex_completions(string, pos)
end

function completions(string, pos)
inc_tag = Base.incomplete_tag(parse(string[1:pos], raise=false))
# First parse everything up to the current position
partial = string[1:pos]
inc_tag = Base.incomplete_tag(parse(partial , raise=false))
if inc_tag in [:cmd, :string]
startpos = nextind(string, rsearch(string, non_filename_chars, pos))
startpos = nextind(partial, rsearch(partial, non_filename_chars, pos))
r = startpos:pos
paths = complete_path(string[r])
if inc_tag == :string && length(paths) == 1 && !isdir(paths[1])
paths, r, success = complete_path(string[r], pos)
if inc_tag == :string &&
length(paths) == 1 && # Only close if there's a single choice,
!isdir(string[startpos:start(r)-1] * paths[1]) && # except if it's a directory
(length(string) <= pos || string[pos+1] != '"') # or there's already a " at the cursor.
paths[1] *= "\""
end
return sort(paths), r, true
return sort(paths), r, success
end

ok, ret = latex_completions(string,pos)
ok, ret = latex_completions(string, pos)
ok && return ret

if inc_tag == :other && string[pos] == '('
Expand Down Expand Up @@ -230,7 +239,7 @@ function completions(string, pos)
return sort(unique(suggestions)), (dotpos+1):pos, true
end

function shell_completions(string,pos)
function shell_completions(string, pos)
# First parse everything up to the current position
scs = string[1:pos]
local args, last_parse
Expand All @@ -239,34 +248,12 @@ function shell_completions(string,pos)
catch
return UTF8String[], 0:-1, false
end
# Now look at the last this we parsed
# Now look at the last thing we parsed
isempty(args.args[end].args) && return UTF8String[], 0:-1, false
arg = args.args[end].args[end]
if isa(arg,String)
# Treat this as a path (perhaps give a list of comands in the future as well?)
dir,name = splitdir(arg)
local files
try
if isempty(dir)
files = readdir()
else
isdir(dir) || return UTF8String[], 0:-1, false
files = readdir(dir)
end
catch
return UTF8String[], 0:-1, false
end
# Filter out files and directories that do not begin with the partial name we were
# completing and append "/" to directories to simplify further completion
ret = map(filter(x->beginswith(x, name), files)) do x
if !isdir(joinpath(dir, x))
return x
else
return x*"/"
end
end
r = (nextind(string, pos-sizeof(name))):pos
return ret, r, true
return complete_path(arg, pos)
elseif isexpr(arg, :escape) && (isexpr(arg.args[1], :incomplete) || isexpr(arg.args[1], :error))
r = first(last_parse):prevind(last_parse, last(last_parse))
partial = scs[r]
Expand Down
Loading

0 comments on commit 5426f6a

Please sign in to comment.