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
ViralBShah committed Jan 21, 2013
2 parents 61ced81 + a2dfe91 commit 68b547e
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 52 deletions.
24 changes: 15 additions & 9 deletions base/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down Expand Up @@ -312,20 +318,19 @@ 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)
end
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})
Expand All @@ -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

Expand Down Expand Up @@ -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) =
Expand Down
12 changes: 6 additions & 6 deletions base/stream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions doc/_themes/julia/static/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
});

});

11 changes: 5 additions & 6 deletions doc/listpkg.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
require("pkg")
try
require("JSON")
catch
Pkg.add("JSON")

require("JSON")
end
require("Calendar")
using Calendar

try
global gh_auth
Expand Down Expand Up @@ -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

Expand Down
88 changes: 60 additions & 28 deletions doc/packages/packagelist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -416,54 +416,54 @@ ________________________________________________________
: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
:width: 40px
: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
:width: 40px
: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
Expand Down Expand Up @@ -776,7 +776,7 @@ _____________________________________________
`GLUT <https://github.com/rennis250/GLUT.jl>`_
______________________________________________

.. 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
Expand All @@ -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 <https://github.com/dcjones/Gadfly.jl>`_
Expand Down Expand Up @@ -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
Expand All @@ -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 <https://github.com/rennis250/GetC.jl>`_
______________________________________________

.. 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
Expand All @@ -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 <https://github.com/johnmyleswhite/Graphs.jl>`_
Expand Down Expand Up @@ -1597,7 +1615,7 @@ ______________________________________________
`ODBC <https://github.com/karbarcca/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
Expand All @@ -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
Expand All @@ -1633,7 +1651,7 @@ ___________________________________________
`OpenGL <https://github.com/rennis250/OpenGL.jl>`_
__________________________________________________

.. 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
Expand All @@ -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 <https://github.com/johnmyleswhite/Optim.jl>`_
Expand Down Expand Up @@ -1838,7 +1862,7 @@ __________________________________________________

Dependencies::

None
Options Any Version

Contributors:

Expand Down Expand Up @@ -1986,7 +2010,7 @@ ___________________________________________
`SDL <https://github.com/rennis250/SDL.jl>`_
____________________________________________

.. 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
Expand All @@ -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 <https://github.com/tshort/Sims.jl>`_
Expand Down Expand Up @@ -2400,3 +2430,5 @@ _________________________________________________

----

.. footer: 65 packages, generated 21 Jan 2013 00:58:48 GMT
2 changes: 1 addition & 1 deletion src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions src/wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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<UV_HANDLE_TYPE_MAX) { //is uv handle
Expand Down

0 comments on commit 68b547e

Please sign in to comment.