Created
August 19, 2016 20:53
-
-
Save MichaelHatherly/cc9f1ce532e9f851ff6906815e517775 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/base/file.jl b/base/file.jl | |
index 261c672..e3c69f2 100644 | |
--- a/base/file.jl | |
+++ b/base/file.jl | |
@@ -252,11 +252,6 @@ end | |
if is_windows() | |
-@doc """ | |
- tempdir() | |
- | |
-Obtain the path of a temporary directory (possibly shared with other processes). | |
-""" -> | |
function tempdir() | |
temppath = Array{UInt16}(32767) | |
lentemppath = ccall(:GetTempPathW,stdcall,UInt32,(UInt32,Ptr{UInt16}),length(temppath),temppath) | |
@@ -266,11 +261,6 @@ function tempdir() | |
resize!(temppath,lentemppath) | |
return transcode(String, temppath) | |
end | |
-@doc """ | |
- tempname() | |
- | |
-Generate a unique temporary file path. | |
-""" -> | |
tempname(uunique::UInt32=UInt32(0)) = tempname(tempdir(), uunique) | |
const temp_prefix = cwstring("jl_") | |
function tempname(temppath::AbstractString,uunique::UInt32) | |
@@ -285,22 +275,11 @@ function tempname(temppath::AbstractString,uunique::UInt32) | |
return transcode(String, tname) | |
end | |
-@doc """ | |
- mktemp(parent=tempdir()) | |
- | |
-Returns `(path, io)`, where `path` is the path of a new temporary file in `parent` and `io` | |
-is an open file object for this path. | |
-""" -> | |
function mktemp(parent=tempdir()) | |
filename = tempname(parent, UInt32(0)) | |
return (filename, Base.open(filename, "r+")) | |
end | |
-@doc """ | |
- mktempdir(parent=tempdir()) | |
- | |
-Create a temporary directory in the `parent` directory and return its path. | |
-""" -> | |
function mktempdir(parent=tempdir()) | |
seed::UInt32 = rand(UInt32) | |
while true | |
@@ -319,11 +298,6 @@ end | |
else # !windows | |
# Obtain a temporary filename. | |
-@doc """ | |
- tempname() | |
- | |
-Generate a unique temporary file path. | |
-""" -> | |
function tempname() | |
d = get(ENV, "TMPDIR", C_NULL) # tempnam ignores TMPDIR on darwin | |
p = ccall(:tempnam, Cstring, (Cstring,Cstring), d, :julia) | |
@@ -334,20 +308,9 @@ function tempname() | |
end | |
# Obtain a temporary directory's path. | |
-@doc """ | |
- tempdir() | |
- | |
-Obtain the path of a temporary directory (possibly shared with other processes). | |
-""" -> | |
tempdir() = dirname(tempname()) | |
# Create and return the name of a temporary file along with an IOStream | |
-@doc """ | |
- mktemp(parent=tempdir()) | |
- | |
-Returns `(path, io)`, where `path` is the path of a new temporary file in `parent` and `io` | |
-is an open file object for this path. | |
-""" -> | |
function mktemp(parent=tempdir()) | |
b = joinpath(parent, "tmpXXXXXX") | |
p = ccall(:mkstemp, Int32, (Cstring,), b) # modifies b | |
@@ -356,11 +319,6 @@ function mktemp(parent=tempdir()) | |
end | |
# Create and return the name of a temporary directory | |
-@doc """ | |
- mktempdir(parent=tempdir()) | |
- | |
-Create a temporary directory in the `parent` directory and return its path. | |
-""" -> | |
function mktempdir(parent=tempdir()) | |
b = joinpath(parent, "tmpXXXXXX") | |
p = ccall(:mkdtemp, Cstring, (Cstring,), b) | |
@@ -370,6 +328,37 @@ end | |
end # os-test | |
+ | |
+""" | |
+ tempdir() | |
+ | |
+Obtain the path of a temporary directory (possibly shared with other processes). | |
+""" | |
+tempdir() | |
+ | |
+""" | |
+ tempname() | |
+ | |
+Generate a unique temporary file path. | |
+""" | |
+tempname() | |
+ | |
+""" | |
+ mktemp(parent=tempdir()) | |
+ | |
+Returns `(path, io)`, where `path` is the path of a new temporary file in `parent` and `io` | |
+is an open file object for this path. | |
+""" | |
+mktemp(parent) | |
+ | |
+""" | |
+ mktempdir(parent=tempdir()) | |
+ | |
+Create a temporary directory in the `parent` directory and return its path. | |
+""" | |
+mktempdir(parent) | |
+ | |
+ | |
""" | |
mktemp(f::Function, parent=tempdir()) | |
diff --git a/base/interactiveutil.jl b/base/interactiveutil.jl | |
index d42a456..91ad7d9 100644 | |
--- a/base/interactiveutil.jl | |
+++ b/base/interactiveutil.jl | |
@@ -116,21 +116,11 @@ less(file, line::Integer) = error("could not find source file for function") | |
# clipboard copy and paste | |
if is_apple() | |
- @doc """ | |
- clipboard(x) | |
- | |
- Send a printed form of `x` to the operating system clipboard ("copy"). | |
- """ -> | |
function clipboard(x) | |
open(pipeline(`pbcopy`, stderr=STDERR), "w") do io | |
print(io, x) | |
end | |
end | |
- @doc """ | |
- clipboard() -> AbstractString | |
- | |
- Return a string with the contents of the operating system clipboard ("paste"). | |
- """ -> | |
clipboard() = readstring(`pbpaste`) | |
elseif is_linux() | |
@@ -143,11 +133,6 @@ elseif is_linux() | |
end | |
error("no clipboard command found, please install xsel or xclip") | |
end | |
- @doc """ | |
- clipboard(x) | |
- | |
- Send a printed form of `x` to the operating system clipboard ("copy"). | |
- """ -> | |
function clipboard(x) | |
c = clipboardcmd() | |
cmd = c == :xsel ? `xsel --nodetach --input --clipboard` : | |
@@ -157,11 +142,6 @@ elseif is_linux() | |
print(io, x) | |
end | |
end | |
- @doc """ | |
- clipboard() -> AbstractString | |
- | |
- Return a string with the contents of the operating system clipboard ("paste"). | |
- """ -> | |
function clipboard() | |
c = clipboardcmd() | |
cmd = c == :xsel ? `xsel --nodetach --output --clipboard` : | |
@@ -190,17 +170,7 @@ elseif is_windows() | |
systemerror(:SetClipboardData, pdata!=p) | |
ccall((:CloseClipboard, "user32"), stdcall, Void, ()) | |
end | |
- @doc """ | |
- clipboard(x) | |
- | |
- Send a printed form of `x` to the operating system clipboard ("copy"). | |
- """ -> | |
clipboard(x) = clipboard(sprint(io->print(io,x))::String) | |
- @doc """ | |
- clipboard() -> AbstractString | |
- | |
- Return a string with the contents of the operating system clipboard ("paste"). | |
- """ -> | |
function clipboard() | |
systemerror(:OpenClipboard, 0==ccall((:OpenClipboard, "user32"), stdcall, Cint, (Ptr{Void},), C_NULL)) | |
pdata = ccall((:GetClipboardData, "user32"), stdcall, Ptr{UInt16}, (UInt32,), 13) | |
@@ -221,6 +191,22 @@ else | |
clipboard(x="") = error("`clipboard` function not implemented for $(Sys.KERNEL)") | |
end | |
+ | |
+""" | |
+ clipboard(x) | |
+ | |
+Send a printed form of `x` to the operating system clipboard ("copy"). | |
+""" | |
+clipboard(x) | |
+ | |
+""" | |
+ clipboard() -> AbstractString | |
+ | |
+Return a string with the contents of the operating system clipboard ("paste"). | |
+""" | |
+clipboard() | |
+ | |
+ | |
# system information | |
# used by sysinfo.jl | |
@@ -567,15 +553,6 @@ end | |
downloadcmd = nothing | |
if is_windows() | |
- @doc """ | |
- download(url::AbstractString, [localfile::AbstractString]) | |
- | |
- Download a file from the given url, optionally renaming it to the given local file name. | |
- Note that this function relies on the availability of external tools such as `curl`, `wget` | |
- or `fetch` to download the file and is provided for convenience. For production use or | |
- situations in which more options are needed, please use a package that provides the desired | |
- functionality instead. | |
- """ -> | |
function download(url::AbstractString, filename::AbstractString) | |
res = ccall((:URLDownloadToFileW,:urlmon),stdcall,Cuint, | |
(Ptr{Void},Cwstring,Cwstring,Cuint,Ptr{Void}),C_NULL,url,filename,0,C_NULL) | |
@@ -585,15 +562,6 @@ if is_windows() | |
filename | |
end | |
else | |
- @doc """ | |
- download(url::AbstractString, [localfile::AbstractString]) | |
- | |
- Download a file from the given url, optionally renaming it to the given local file name. | |
- Note that this function relies on the availability of external tools such as `curl`, `wget` | |
- or `fetch` to download the file and is provided for convenience. For production use or | |
- situations in which more options are needed, please use a package that provides the desired | |
- functionality instead. | |
- """ -> | |
function download(url::AbstractString, filename::AbstractString) | |
global downloadcmd | |
if downloadcmd === nothing | |
@@ -621,6 +589,17 @@ function download(url::AbstractString) | |
download(url, filename) | |
end | |
+""" | |
+ download(url::AbstractString, [localfile::AbstractString]) | |
+ | |
+Download a file from the given url, optionally renaming it to the given local file name. | |
+Note that this function relies on the availability of external tools such as `curl`, `wget` | |
+or `fetch` to download the file and is provided for convenience. For production use or | |
+situations in which more options are needed, please use a package that provides the desired | |
+functionality instead. | |
+""" | |
+download(url, filename) | |
+ | |
# workspace management | |
""" | |
diff --git a/base/io.jl b/base/io.jl | |
index dc9d02a..6622ea8 100644 | |
--- a/base/io.jl | |
+++ b/base/io.jl | |
@@ -199,59 +199,49 @@ the value `0x01020304`. | |
const ENDIAN_BOM = reinterpret(UInt32,UInt8[1:4;])[1] | |
if ENDIAN_BOM == 0x01020304 | |
- @doc """ | |
- ntoh(x) | |
- | |
- Converts the endianness of a value from Network byte order (big-endian) to that used by the Host. | |
- """ -> | |
ntoh(x) = x | |
- @doc """ | |
- hton(x) | |
- | |
- Converts the endianness of a value from that used by the Host to Network byte order (big-endian). | |
- """ -> | |
hton(x) = x | |
- @doc """ | |
- ltoh(x) | |
- | |
- Converts the endianness of a value from Little-endian to that used by the Host. | |
- """ -> | |
ltoh(x) = bswap(x) | |
- @doc """ | |
- htol(x) | |
- | |
- Converts the endianness of a value from that used by the Host to Little-endian. | |
- """ -> | |
htol(x) = bswap(x) | |
elseif ENDIAN_BOM == 0x04030201 | |
- @doc """ | |
- ntoh(x) | |
- | |
- Converts the endianness of a value from Network byte order (big-endian) to that used by the Host. | |
- """ -> | |
ntoh(x) = bswap(x) | |
- @doc """ | |
- hton(x) | |
- | |
- Converts the endianness of a value from that used by the Host to Network byte order (big-endian). | |
- """ -> | |
hton(x) = bswap(x) | |
- @doc """ | |
- ltoh(x) | |
- | |
- Converts the endianness of a value from Little-endian to that used by the Host. | |
- """ -> | |
ltoh(x) = x | |
- @doc """ | |
- htol(x) | |
- | |
- Converts the endianness of a value from that used by the Host to Little-endian. | |
- """ -> | |
htol(x) = x | |
else | |
error("seriously? what is this machine?") | |
end | |
+ | |
+""" | |
+ ntoh(x) | |
+ | |
+Converts the endianness of a value from Network byte order (big-endian) to that used by the Host. | |
+""" | |
+ntoh(x) | |
+ | |
+""" | |
+ hton(x) | |
+ | |
+Converts the endianness of a value from that used by the Host to Network byte order (big-endian). | |
+""" | |
+hton(x) | |
+ | |
+""" | |
+ ltoh(x) | |
+ | |
+Converts the endianness of a value from Little-endian to that used by the Host. | |
+""" | |
+ltoh(x) | |
+ | |
+""" | |
+ htol(x) | |
+ | |
+Converts the endianness of a value from that used by the Host to Little-endian. | |
+""" | |
+htol(x) | |
+ | |
+ | |
""" | |
isreadonly(stream) -> Bool | |
diff --git a/base/path.jl b/base/path.jl | |
index e2c0b57..cb1c412 100644 | |
--- a/base/path.jl | |
+++ b/base/path.jl | |
@@ -24,19 +24,7 @@ if is_unix() | |
const path_dir_splitter = r"^(.*?)(/+)([^/]*)$" | |
const path_ext_splitter = r"^((?:.*/)?(?:\.|[^/\.])[^/]*?)(\.[^/\.]*|)$" | |
- | |
- @doc """ | |
- splitdrive(path::AbstractString) -> (AbstractString, AbstractString) | |
- | |
- On Windows, split a path into the drive letter part and the path part. On Unix systems, the | |
- first component is always the empty string. | |
- """ -> | |
splitdrive(path::String) = ("",path) | |
- @doc """ | |
- homedir() -> AbstractString | |
- | |
- Return the current user's home directory. | |
- """ -> | |
homedir() = ENV["HOME"] | |
elseif is_windows() | |
const path_separator = "\\" | |
@@ -46,26 +34,32 @@ elseif is_windows() | |
const path_dir_splitter = r"^(.*?)([/\\]+)([^/\\]*)$" | |
const path_ext_splitter = r"^((?:.*[/\\])?(?:\.|[^/\\\.])[^/\\]*?)(\.[^/\\\.]*|)$" | |
- @doc """ | |
- splitdrive(path::AbstractString) -> (AbstractString, AbstractString) | |
- | |
- On Windows, split a path into the drive letter part and the path part. On Unix systems, the | |
- first component is always the empty string. | |
- """ -> | |
function splitdrive(path::String) | |
m = match(r"^(\w+:|\\\\\w+\\\w+|\\\\\?\\UNC\\\w+\\\w+|\\\\\?\\\w+:|)(.*)$", path) | |
String(m.captures[1]), String(m.captures[2]) | |
end | |
- @doc """ | |
- homedir() -> AbstractString | |
- | |
- Return the current user's home directory. | |
- """ -> | |
homedir() = get(ENV,"HOME",string(ENV["HOMEDRIVE"],ENV["HOMEPATH"])) | |
else | |
error("path primitives for this OS need to be defined") | |
end | |
+ | |
+""" | |
+ splitdrive(path::AbstractString) -> (AbstractString, AbstractString) | |
+ | |
+On Windows, split a path into the drive letter part and the path part. On Unix systems, the | |
+first component is always the empty string. | |
+""" | |
+splitdrive(path::AbstractString) | |
+ | |
+""" | |
+ homedir() -> AbstractString | |
+ | |
+Return the current user's home directory. | |
+""" | |
+homedir() | |
+ | |
+ | |
""" | |
isabspath(path::AbstractString) -> Bool | |
@@ -249,11 +243,6 @@ abspath(a::String) = normpath(isabspath(a) ? a : joinpath(pwd(),a)) | |
abspath(a::AbstractString, b::AbstractString...) = abspath(joinpath(a,b...)) | |
if is_windows() | |
-@doc """ | |
- realpath(path::AbstractString) -> AbstractString | |
- | |
-Canonicalize a path by expanding symbolic links and removing "." and ".." entries. | |
-""" -> | |
function realpath(path::AbstractString) | |
p = cwstring(path) | |
buf = zeros(UInt16, length(p)) | |
@@ -283,11 +272,6 @@ function longpath(path::AbstractString) | |
end | |
else # !windows | |
-@doc """ | |
- realpath(path::AbstractString) -> AbstractString | |
- | |
-Canonicalize a path by expanding symbolic links and removing "." and ".." entries. | |
-""" -> | |
function realpath(path::AbstractString) | |
p = ccall(:realpath, Ptr{UInt8}, (Cstring, Ptr{UInt8}), path, C_NULL) | |
systemerror(:realpath, p == C_NULL) | |
@@ -295,19 +279,18 @@ function realpath(path::AbstractString) | |
end | |
end # os-test | |
-if is_windows() | |
-@doc """ | |
- expanduser(path::AbstractString) -> AbstractString | |
-On Unix systems, replace a tilde character at the start of a path with the current user's home directory. | |
-""" -> | |
+""" | |
+ realpath(path::AbstractString) -> AbstractString | |
+ | |
+Canonicalize a path by expanding symbolic links and removing "." and ".." entries. | |
+""" | |
+realpath(path::AbstractString) | |
+ | |
+ | |
+if is_windows() | |
expanduser(path::AbstractString) = path # on windows, ~ means "temporary file" | |
else | |
-@doc """ | |
- expanduser(path::AbstractString) -> AbstractString | |
- | |
-On Unix systems, replace a tilde character at the start of a path with the current user's home directory. | |
-""" -> | |
function expanduser(path::AbstractString) | |
i = start(path) | |
c, i = next(path,i) | |
@@ -319,6 +302,15 @@ function expanduser(path::AbstractString) | |
end | |
end | |
+ | |
+""" | |
+ expanduser(path::AbstractString) -> AbstractString | |
+ | |
+On Unix systems, replace a tilde character at the start of a path with the current user's home directory. | |
+""" | |
+expanduser(path::AbstractString) | |
+ | |
+ | |
""" | |
relpath(path::AbstractString, startpath::AbstractString = ".") -> AbstractString | |
diff --git a/base/random.jl b/base/random.jl | |
index db6fec8..7a2e741 100644 | |
--- a/base/random.jl | |
+++ b/base/random.jl | |
@@ -30,11 +30,6 @@ type Close1Open2 <: FloatInterval end | |
if is_windows() | |
- @doc """ | |
- RandomDevice() | |
- | |
- Create a `RandomDevice` RNG object. Two such objects will always generate different streams of random numbers. | |
- """ -> | |
immutable RandomDevice <: AbstractRNG | |
buffer::Vector{UInt128} | |
@@ -48,11 +43,6 @@ if is_windows() | |
rand!{T<:Union{Bool, Base.BitInteger}}(rd::RandomDevice, A::Array{T}) = (win32_SystemFunction036!(A); A) | |
else # !windows | |
- @doc """ | |
- RandomDevice() | |
- | |
- Create a `RandomDevice` RNG object. Two such objects will always generate different streams of random numbers. | |
- """ -> | |
immutable RandomDevice <: AbstractRNG | |
file::IOStream | |
unlimited::Bool | |
@@ -64,6 +54,15 @@ else # !windows | |
rand!{T<:Union{Bool, Base.BitInteger}}(rd::RandomDevice, A::Array{T}) = read!(rd.file, A) | |
end # os-test | |
+ | |
+""" | |
+ RandomDevice() | |
+ | |
+Create a `RandomDevice` RNG object. Two such objects will always generate different streams of random numbers. | |
+""" | |
+RandomDevice | |
+ | |
+ | |
rand(rng::RandomDevice, ::Type{Close1Open2}) = | |
reinterpret(Float64, 0x3ff0000000000000 | rand(rng, UInt64) & 0x000fffffffffffff) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment