From 8dd6d082fcb40610b22189342e24eff7ee7b1217 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Sun, 20 Jan 2013 02:02:22 -0500 Subject: [PATCH 1/2] make write() consistently return an Int byte count. fixes #1701 --- base/io.jl | 24 +++++++++++++++--------- base/stream.jl | 12 ++++++------ src/julia.h | 2 +- src/wrapper.c | 4 ++-- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/base/io.jl b/base/io.jl index 91c70644c6f2f..c197fdb067379 100644 --- a/base/io.jl +++ b/base/io.jl @@ -29,15 +29,19 @@ write(s::IO, x::Uint8) = error(typeof(s)," does not support byte I/O") if ENDIAN_BOM == 0x01020304 function write(s::IO, x::Integer) - for n = sizeof(x):-1:1 + sz = sizeof(x) + for n = sz:-1:1 write(s, uint8((x>>>((n-1)<<3)))) end + sz end else function write(s::IO, x::Integer) - for n = 1:sizeof(x) + sz = sizeof(x) + for n = 1:sz write(s, uint8((x>>>((n-1)<<3)))) end + sz end end @@ -46,9 +50,11 @@ write(s::IO, x::Float32) = write(s, box(Int32,unbox(Float32,x))) write(s::IO, x::Float64) = write(s, box(Int64,unbox(Float64,x))) function write(s::IO, a::AbstractArray) + nb = 0 for i = 1:length(a) - write(s, a[i]) + nb += write(s, a[i]) end + nb end function write(s::IO, c::Char) @@ -312,12 +318,11 @@ memio() = memio(0, true) ## low-level calls ## -write(s::IOStream, b::Uint8) = ccall(:jl_putc, Int32, (Uint8, Ptr{Void}), b, s.ios) -write(s::IOStream, c::Char) = ccall(:jl_pututf8, Int32, (Ptr{Void}, Char), s.ios, c) +write(s::IOStream, b::Uint8) = int(ccall(:jl_putc, Int32, (Uint8, Ptr{Void}), b, s.ios)) function write{T}(s::IOStream, a::Array{T}) if isa(T,BitsKind) - ccall(:jl_write, Uint, (Ptr{Void}, Ptr{Void}, Uint), + ccall(:ios_write, Int, (Ptr{Void}, Ptr{Void}, Uint), s.ios, a, length(a)*sizeof(T)) else invoke(write, (IO, Array), s, a) @@ -325,7 +330,7 @@ function write{T}(s::IOStream, a::Array{T}) end function write(s::IOStream, p::Ptr, nb::Integer) - ccall(:jl_write, Uint, (Ptr{Void}, Ptr{Void}, Uint), s.ios, p, nb) + ccall(:ios_write, Int, (Ptr{Void}, Ptr{Void}, Uint), s.ios, p, nb) end function write{T,N,A<:Array}(s::IOStream, a::SubArray{T,N,A}) @@ -334,10 +339,11 @@ function write{T,N,A<:Array}(s::IOStream, a::SubArray{T,N,A}) end colsz = size(a,1)*sizeof(T) if N<=1 - write(s, pointer(a, 1), colsz) + return write(s, pointer(a, 1), colsz) else cartesian_map((idxs...)->write(s, pointer(a, idxs), colsz), tuple(1, size(a)[2:]...)) + return colsz*trailingsize(a,2) end end @@ -367,7 +373,7 @@ end ## text I/O ## -write(s::IOStream, c::Char) = ccall(:ios_pututf8, Int32, (Ptr{Void}, Char), s.ios, c) +write(s::IOStream, c::Char) = int(ccall(:ios_pututf8, Int32, (Ptr{Void}, Char), s.ios, c)) read(s::IOStream, ::Type{Char}) = ccall(:jl_getutf8, Char, (Ptr{Void},), s.ios) takebuf_string(s::IOStream) = diff --git a/base/stream.jl b/base/stream.jl index e5d296163a412..4203a5a27153d 100644 --- a/base/stream.jl +++ b/base/stream.jl @@ -558,20 +558,20 @@ end ## low-level calls write(s::AsyncStream, b::ASCIIString) = - ccall(:jl_puts, Int32, (Ptr{Uint8},Ptr{Void}),b.data,handle(s)) + int(ccall(:jl_puts, Int32, (Ptr{Uint8},Ptr{Void}),b.data,handle(s))) write(s::AsyncStream, b::Uint8) = - ccall(:jl_putc, Int32, (Uint8, Ptr{Void}), b, handle(s)) + int(ccall(:jl_putc, Int32, (Uint8, Ptr{Void}), b, handle(s))) write(s::AsyncStream, c::Char) = - ccall(:jl_pututf8, Int32, (Ptr{Void},Char), handle(s), c) + int(ccall(:jl_pututf8, Int32, (Ptr{Void},Char), handle(s), c)) function write{T}(s::AsyncStream, a::Array{T}) if(isa(T,BitsKind)) - ccall(:jl_write, Uint,(Ptr{Void}, Ptr{Void}, Uint32),handle(s), a, uint(length(a)*sizeof(T))) + ccall(:jl_write, Int, (Ptr{Void}, Ptr{Void}, Uint32), handle(s), a, uint(length(a)*sizeof(T))) else invoke(write,(IO,Array),s,a) end end -write(s::AsyncStream, p::Ptr, nb::Integer) = ccall(:jl_write, Uint,(Ptr{Void}, Ptr{Void}, Uint),handle(s), p, uint(nb)) -_write(s::AsyncStream, p::Ptr{Void}, nb::Integer) = ccall(:jl_write, Uint,(Ptr{Void}, Ptr{Void}, Uint),handle(s),p,uint(nb)) +write(s::AsyncStream, p::Ptr, nb::Integer) = ccall(:jl_write, Int, (Ptr{Void}, Ptr{Void}, Uint), handle(s), p, uint(nb)) +_write(s::AsyncStream, p::Ptr{Void}, nb::Integer) = ccall(:jl_write, Int, (Ptr{Void}, Ptr{Void}, Uint), handle(s), p, uint(nb)) _jl_connect_raw(sock::TcpSocket,sockaddr::Ptr{Void}) = ccall(:jl_connect_raw,Int32,(Ptr{Void},Ptr{Void}),sock.handle,sockaddr) _jl_getaddrinfo(loop::Ptr{Void},host::ByteString,service::Ptr{Void},cb::Function) = ccall(:jl_getaddrinfo,Int32,(Ptr{Void},Ptr{Uint8},Ptr{Uint8},Function),loop,host,service,cb) diff --git a/src/julia.h b/src/julia.h index d8aed3ae6df28..c23e4f88a69dc 100644 --- a/src/julia.h +++ b/src/julia.h @@ -1125,7 +1125,7 @@ DLLEXPORT void jl_free2(void *p, void *hint); DLLEXPORT int jl_cpu_cores(void); -DLLEXPORT int jl_write(uv_stream_t *stream, const char *str, size_t n); +DLLEXPORT size_t jl_write(uv_stream_t *stream, const char *str, size_t n); DLLEXPORT int jl_printf(uv_stream_t *s, const char *format, ...); DLLEXPORT int jl_vprintf(uv_stream_t *s, const char *format, va_list args); diff --git a/src/wrapper.c b/src/wrapper.c index c70aad2b38467..e38ecfc585ba3 100755 --- a/src/wrapper.c +++ b/src/wrapper.c @@ -408,9 +408,9 @@ DLLEXPORT int jl_putc(unsigned char c, uv_stream_t *stream) } } -DLLEXPORT int jl_write(uv_stream_t *stream, const char *str, size_t n) +DLLEXPORT size_t jl_write(uv_stream_t *stream, const char *str, size_t n) { -//TODO: BAD!! Needed because Julia can't yet detect null stdio + //TODO: BAD!! Needed because Julia can't yet detect null stdio if (stream == 0) return 0; if (stream->type Date: Fri, 18 Jan 2013 16:37:54 +0000 Subject: [PATCH 2/2] Show contributor name on hover --- doc/_themes/julia/static/sidebar.js | 6 ++ doc/listpkg.jl | 11 ++-- doc/packages/packagelist.rst | 88 ++++++++++++++++++++--------- 3 files changed, 71 insertions(+), 34 deletions(-) diff --git a/doc/_themes/julia/static/sidebar.js b/doc/_themes/julia/static/sidebar.js index 573a88cafc2c8..74a4c7f367e0e 100644 --- a/doc/_themes/julia/static/sidebar.js +++ b/doc/_themes/julia/static/sidebar.js @@ -187,4 +187,10 @@ $(function() { $(window).scroll(set_sidebar_pos); sidebarview.scroll(set_button_margin); $(window).resize(set_sidebar_pos); + + $("img[alt]").each(function(){ + $(this).attr('title', $(this).attr('alt')); + }); + }); + diff --git a/doc/listpkg.jl b/doc/listpkg.jl index 66388fa355beb..b0d83312ef952 100644 --- a/doc/listpkg.jl +++ b/doc/listpkg.jl @@ -1,10 +1,7 @@ -require("pkg") -try -require("JSON") -catch -Pkg.add("JSON") + require("JSON") -end +require("Calendar") +using Calendar try global gh_auth @@ -88,7 +85,9 @@ function gen_listpkg() print(io, "----\n\n") end #for pkg + print(io, ".. footer: $(length(Pkg.Metadata.packages())) packages, generated $(now()) \n\n") end #cd + close(io) end #function diff --git a/doc/packages/packagelist.rst b/doc/packages/packagelist.rst index 001e4bec0826a..d671288ee46b1 100644 --- a/doc/packages/packagelist.rst +++ b/doc/packages/packagelist.rst @@ -416,17 +416,17 @@ ________________________________________________________ :alt: pao :target: https://github.com/pao - .. image:: https://secure.gravatar.com/avatar/a27d23ce4c080f3307cc6507f6fdfe87?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png + .. image:: https://secure.gravatar.com/avatar/2cbc175271c0dbdaf0aa8f68af6c13d4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png :height: 40px :width: 40px - :alt: dmbates - :target: https://github.com/dmbates + :alt: Glen Hertz + :target: https://github.com/GlenHertz - .. image:: https://secure.gravatar.com/avatar/903acb22f47a901577ee48d3962d5858?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png + .. image:: https://secure.gravatar.com/avatar/a27d23ce4c080f3307cc6507f6fdfe87?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png :height: 40px :width: 40px - :alt: Tom Short - :target: https://github.com/tshort + :alt: dmbates + :target: https://github.com/dmbates .. image:: https://secure.gravatar.com/avatar/80502de63c1b21d8f3ba663d72ba5be2?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png :height: 40px @@ -434,29 +434,23 @@ ________________________________________________________ :alt: Carlo Baldassi :target: https://github.com/carlobaldassi - .. image:: https://secure.gravatar.com/avatar/2cbc175271c0dbdaf0aa8f68af6c13d4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png - :height: 40px - :width: 40px - :alt: Glen Hertz - :target: https://github.com/GlenHertz - .. image:: https://secure.gravatar.com/avatar/8af4d5971a2308b86a94f58fb98129c5?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png :height: 40px :width: 40px :alt: Jameson Nash :target: https://github.com/vtjnash - .. image:: https://secure.gravatar.com/avatar/42c8c4ab92de3390bcd2f637ef6ca16c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png + .. image:: https://secure.gravatar.com/avatar/903acb22f47a901577ee48d3962d5858?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png :height: 40px :width: 40px - :alt: Kevin Squire - :target: https://github.com/kmsquire + :alt: Tom Short + :target: https://github.com/tshort - .. image:: https://secure.gravatar.com/avatar/b0cf54b8431443687735cb486599ea9c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png + .. image:: https://secure.gravatar.com/avatar/42c8c4ab92de3390bcd2f637ef6ca16c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png :height: 40px :width: 40px - :alt: Miles - :target: https://github.com/mlubin + :alt: Kevin Squire + :target: https://github.com/kmsquire .. image:: https://secure.gravatar.com/avatar/1af2db0b26142fd0c7ab082f3d445f73?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png :height: 40px @@ -464,6 +458,12 @@ ________________________________________________________ :alt: Ian Fiske :target: https://github.com/ianfiske + .. image:: https://secure.gravatar.com/avatar/b0cf54b8431443687735cb486599ea9c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png + :height: 40px + :width: 40px + :alt: Miles + :target: https://github.com/mlubin + .. image:: https://secure.gravatar.com/avatar/1b65c4698da5f30310e14aaee8f3f24e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png :height: 40px :width: 40px @@ -776,7 +776,7 @@ _____________________________________________ `GLUT `_ ______________________________________________ - .. image:: https://secure.gravatar.com/avatar/3753123303ea2852accbce22339f67b4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png + .. image:: https://secure.gravatar.com/avatar/37cebf4f44a1dbf71ee94aaea166ef00?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png :height: 80px :width: 80px :align: right @@ -796,6 +796,12 @@ ______________________________________________ Contributors: + .. image:: https://secure.gravatar.com/avatar/37cebf4f44a1dbf71ee94aaea166ef00?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png + :height: 40px + :width: 40px + :alt: Robert Ennis + :target: https://github.com/rennis250 + ---- `Gadfly `_ @@ -831,6 +837,12 @@ ________________________________________________ :alt: Daniel Jones :target: https://github.com/dcjones + .. image:: https://secure.gravatar.com/avatar/a27d23ce4c080f3307cc6507f6fdfe87?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png + :height: 40px + :width: 40px + :alt: dmbates + :target: https://github.com/dmbates + .. image:: https://secure.gravatar.com/avatar/2989a078f4caff6fb86fa30e59bd9aa9?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png :height: 40px :width: 40px @@ -843,18 +855,18 @@ ________________________________________________ :alt: Avik Sengupta :target: https://github.com/aviks - .. image:: https://secure.gravatar.com/avatar/a27d23ce4c080f3307cc6507f6fdfe87?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png + .. image:: https://secure.gravatar.com/avatar/37cebf4f44a1dbf71ee94aaea166ef00?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png :height: 40px :width: 40px - :alt: dmbates - :target: https://github.com/dmbates + :alt: Robert Ennis + :target: https://github.com/rennis250 ---- `GetC `_ ______________________________________________ - .. image:: https://secure.gravatar.com/avatar/3753123303ea2852accbce22339f67b4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png + .. image:: https://secure.gravatar.com/avatar/37cebf4f44a1dbf71ee94aaea166ef00?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png :height: 80px :width: 80px :align: right @@ -873,6 +885,12 @@ ______________________________________________ Contributors: + .. image:: https://secure.gravatar.com/avatar/37cebf4f44a1dbf71ee94aaea166ef00?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png + :height: 40px + :width: 40px + :alt: Robert Ennis + :target: https://github.com/rennis250 + ---- `Graphs `_ @@ -1597,7 +1615,7 @@ ______________________________________________ `ODBC `_ ___________________________________________ - .. image:: https://secure.gravatar.com/avatar/1214b9051c4ae96c1ca5c5e6cc25716e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png + .. image:: https://secure.gravatar.com/avatar/d788bf7fd037ebef5798d8881c5faa2f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png :height: 80px :width: 80px :align: right @@ -1616,7 +1634,7 @@ ___________________________________________ Contributors: - .. image:: https://secure.gravatar.com/avatar/1214b9051c4ae96c1ca5c5e6cc25716e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png + .. image:: https://secure.gravatar.com/avatar/d788bf7fd037ebef5798d8881c5faa2f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png :height: 40px :width: 40px :alt: Jacob Quinn @@ -1633,7 +1651,7 @@ ___________________________________________ `OpenGL `_ __________________________________________________ - .. image:: https://secure.gravatar.com/avatar/3753123303ea2852accbce22339f67b4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png + .. image:: https://secure.gravatar.com/avatar/37cebf4f44a1dbf71ee94aaea166ef00?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png :height: 80px :width: 80px :align: right @@ -1652,6 +1670,12 @@ __________________________________________________ Contributors: + .. image:: https://secure.gravatar.com/avatar/37cebf4f44a1dbf71ee94aaea166ef00?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png + :height: 40px + :width: 40px + :alt: Robert Ennis + :target: https://github.com/rennis250 + ---- `Optim `_ @@ -1838,7 +1862,7 @@ __________________________________________________ Dependencies:: - None + Options Any Version Contributors: @@ -1986,7 +2010,7 @@ ___________________________________________ `SDL `_ ____________________________________________ - .. image:: https://secure.gravatar.com/avatar/3753123303ea2852accbce22339f67b4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png + .. image:: https://secure.gravatar.com/avatar/37cebf4f44a1dbf71ee94aaea166ef00?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png :height: 80px :width: 80px :align: right @@ -2006,6 +2030,12 @@ ____________________________________________ Contributors: + .. image:: https://secure.gravatar.com/avatar/37cebf4f44a1dbf71ee94aaea166ef00?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png + :height: 40px + :width: 40px + :alt: Robert Ennis + :target: https://github.com/rennis250 + ---- `Sims `_ @@ -2400,3 +2430,5 @@ _________________________________________________ ---- +.. footer: 65 packages, generated 21 Jan 2013 00:58:48 GMT +