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

« back to all changes in this revision

Viewing changes to base/show.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:
1
1
# formerly built-in methods. can be replaced any time.
2
2
 
3
 
show(x) = show(OUTPUT_STREAM::Stream, x)
 
3
show(x) = show(OUTPUT_STREAM::IO, x)
4
4
 
5
5
print(io::IO, s::Symbol) = ccall(:jl_print_symbol, Void, (Ptr{Void}, Any,), io, s)
6
 
show(io::IO, x::ANY) = ccall(:jl_show_any, Void, (Any, Any,), io::Stream, x)
 
6
show(io::IO, x::ANY) = ccall(:jl_show_any, Void, (Any, Any,), io::IO, x)
7
7
 
8
8
showcompact(io::IO, x) = show(io, x)
9
 
showcompact(x) = showcompact(OUTPUT_STREAM::Stream, x)
 
9
showcompact(x) = showcompact(OUTPUT_STREAM::IO, x)
10
10
 
11
11
macro show(exs...)
12
12
    blk = expr(:block)
399
399
 
400
400
function show(io::IO, mt::MethodTable)
401
401
    name = mt.name
402
 
    println(io, "Methods for generic function ", name)
 
402
    println(io, "# methods for generic function ", name)
403
403
    d = mt.defs
404
404
    while !is(d,())
405
405
        print(io, name)
492
492
# dumptype is for displaying abstract type hierarchies like Jameson
493
493
# Nash's wiki page: https://github.com/JuliaLang/julia/wiki/Types-Hierarchy
494
494
 
495
 
function dumptype(io::Stream, x, n::Int, indent)
 
495
function dumptype(io::IO, x, n::Int, indent)
496
496
    # based on Jameson Nash's examples/typetree.jl
497
497
    println(io, x)
498
498
    if n == 0   # too deeply nested
533
533
 
534
534
# For abstract types, use _dumptype only if it's a form that will be called
535
535
# interactively.
536
 
xdump(fn::Function, io::Stream, x::AbstractKind) = dumptype(io, x, 5, "")
537
 
xdump(fn::Function, io::Stream, x::AbstractKind, n::Int) = dumptype(io, x, n, "")
 
536
xdump(fn::Function, io::IO, x::AbstractKind) = dumptype(io, x, 5, "")
 
537
xdump(fn::Function, io::IO, x::AbstractKind, n::Int) = dumptype(io, x, n, "")
538
538
 
539
539
# defaults:
540
 
xdump(fn::Function, io::Stream, x) = xdump(xdump, io, x, 5, "")  # default is 5 levels
541
 
xdump(fn::Function, io::Stream, x, n::Int) = xdump(xdump, io, x, n, "")
542
 
xdump(fn::Function, args...) = xdump(fn, OUTPUT_STREAM::Stream, args...)
543
 
xdump(io::Stream, args...) = xdump(xdump, io, args...)
544
 
xdump(args...) = xdump(xdump, OUTPUT_STREAM::Stream, args...)
 
540
xdump(fn::Function, io::IO, x) = xdump(xdump, io, x, 5, "")  # default is 5 levels
 
541
xdump(fn::Function, io::IO, x, n::Int) = xdump(xdump, io, x, n, "")
 
542
xdump(fn::Function, args...) = xdump(fn, OUTPUT_STREAM::IO, args...)
 
543
xdump(io::IO, args...) = xdump(xdump, io, args...)
 
544
xdump(args...) = xdump(xdump, OUTPUT_STREAM::IO, args...)
545
545
 
546
546
 
547
547
# Here are methods specifically for dump:
548
548
dump(io::IO, x, n::Int) = dump(io, x, n, "")
549
549
dump(io::IO, x) = dump(io, x, 5, "")  # default is 5 levels
550
 
dump(args...) = dump(OUTPUT_STREAM::Stream, args...)
 
550
dump(args...) = dump(OUTPUT_STREAM::IO, args...)
551
551
dump(io::IO, x::String, n::Int, indent) = println(io, typeof(x), " \"", x, "\"")
552
552
dump(io::IO, x, n::Int, indent) = xdump(dump, io, x, n, indent)
553
553
 
575
575
dump(io::IO, x::TypeVar, n::Int, indent) = println(io, x.name)
576
576
 
577
577
 
578
 
showall(x) = showall(OUTPUT_STREAM::Stream, x)
 
578
showall(x) = showall(OUTPUT_STREAM::IO, x)
579
579
 
580
580
function showall{T}(io::IO, a::AbstractArray{T,1})
581
581
    if is(T,Any)
776
776
        for i = 1:nd
777
777
            ii = idxs[i]
778
778
            if size(a,i+2) > 10
779
 
                if ii == 4 && allp(x->x==1,idxs[1:i-1])
 
779
                if ii == 4 && all(x->x==1,idxs[1:i-1])
780
780
                    for j=i+1:nd
781
781
                        szj = size(a,j+2)
782
782
                        if szj>10 && 3 < idxs[j] <= szj-3
887
887
 
888
888
print_bit_chunk(io::IO, c::Uint64) = print_bit_chunk(io, c, 64)
889
889
 
890
 
print_bit_chunk(c::Uint64, l::Integer) = print_bit_chunk(STDOUT, c, l)
891
 
print_bit_chunk(c::Uint64) = print_bit_chunk(STDOUT, c)
 
890
print_bit_chunk(c::Uint64, l::Integer) = print_bit_chunk(OUTPUT_STREAM, c, l)
 
891
print_bit_chunk(c::Uint64) = print_bit_chunk(OUTPUT_STREAM, c)
892
892
 
893
893
function bitshow(io::IO, B::BitArray)
894
894
    if length(B) == 0
901
901
    l = (@_mod64 (length(B)-1)) + 1
902
902
    print_bit_chunk(io, B.chunks[end], l)
903
903
end
904
 
bitshow(B::BitArray) = bitshow(STDOUT, B)
 
904
bitshow(B::BitArray) = bitshow(OUTPUT_STREAM, B)
905
905
 
906
906
bitstring(B::BitArray) = sprint(bitshow, B)