~ubuntu-branches/ubuntu/wily/julia/wily

« back to all changes in this revision

Viewing changes to base/util.jl

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot
  • Date: 2013-02-11 03:51:26 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20130211035126-hap464pbhd97wjbl
Tags: 0.1~20130211.git86fbe98d-1
* New upstream snapshot.
* debian/control:
   + add git to Recommends (for Julia package manager)
   + remove dependencies on libglpk-dev (it moved to its own package)
   + add explicit dependency on libgmp10 (there is no more a wrapper)
* fix-clean-rules.patch: remove patch, applied upstream
* gsvddense_blasint.patch: new patch
* Refresh other patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
 
107
107
which(f, args...) = whicht(f, map(a->(isa(a,Type) ? Type{a} : typeof(a)), args))
108
108
 
 
109
macro which(ex)
 
110
    ex = expand(ex)
 
111
    exret = expr(:call, :error, "expression is not a function call")
 
112
    if !isa(ex, Expr)
 
113
        # do nothing -> error
 
114
    elseif ex.head == :call
 
115
        exret = expr(:call, :which, map(esc, ex.args)...)
 
116
    elseif ex.head == :body
 
117
        a1 = ex.args[1]
 
118
        if isa(a1, Expr) && a1.head == :call
 
119
            a11 = a1.args[1]
 
120
            if isa(a11, TopNode) && a11.name == :assign
 
121
                exret = expr(:call, :which, eval(expr(:toplevel, :assign)), map(esc, a1.args[2:end])...)
 
122
            end
 
123
        end
 
124
    elseif ex.head == :thunk
 
125
        exret = expr(:call, :error, "expression is not a function call, or is too complex for @which to analyze; "
 
126
                                  * "break it down to simpler parts if possible")
 
127
    end
 
128
    exret
 
129
end
 
130
 
109
131
edit(file::String) = edit(file, 1)
110
132
function edit(file::String, line::Integer)
111
133
    editor = get(ENV, "JULIA_EDITOR", "emacs")
324
346
        end
325
347
    end
326
348
    for (func, entries) in help_function_dict
327
 
        if ismatch(r, func) || anyp(e->ismatch(r,e), entries)
 
349
        if ismatch(r, func) || any(e->ismatch(r,e), entries)
328
350
            for desc in entries
329
351
                nl = search(desc,'\n')
330
352
                if nl != 0