Skip to content

Commit

Permalink
get rid of those pesky signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeInnes committed Jun 27, 2015
1 parent 362ac82 commit fe1bd3f
Show file tree
Hide file tree
Showing 18 changed files with 437 additions and 6,109 deletions.
692 changes: 56 additions & 636 deletions doc/stdlib/arrays.rst

Large diffs are not rendered by default.

826 changes: 49 additions & 777 deletions doc/stdlib/base.rst

Large diffs are not rendered by default.

88 changes: 8 additions & 80 deletions doc/stdlib/c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,163 +6,91 @@

.. function:: ccall((symbol, library) or function_pointer, ReturnType, (ArgumentType1, ...), ArgumentValue1, ...)

::
ccall((symbol, library) or function_pointer, ReturnType, (ArgumentType1, ...), ArgumentValue1, ...)
Call function in C-exported shared library, specified by AbstractString or :Symbol. Note that the argument type tuple must be a literal tuple, and not a tuple-valued variable or expression. Alternatively, ccall may also be used to call a function pointer, such as one returned by dlsym. Each ``ArgumentValue`` to the ``ccall`` will be converted to the corresponding ``ArgumentType``, by automatic insertion of calls to ArgumentValue))``. (see also the documentation for each of these functions for further details). In most cases, this simply results in a call to `convert(ArgumentType, ArgumentValue)``


.. function:: cglobal((symbol, library) [, type=Void])
.. function:: cglobal((symbol, library)[, type=Void])

::
cglobal((symbol, library)[, type=Void])
Obtain a pointer to a global variable in a C-exported shared library, specified exactly as in ``ccall``. Returns a supplied. The values can be read or written by ``unsafe_load`` or


.. function:: cfunction(function::Function, ReturnType::Type, (ArgumentTypes...))

::
cfunction(function::Function, ReturnType::Type, (ArgumentTypes...))
Generate C-callable function pointer from Julia function. Type annotation of the return value in the callback function is a must for situations where Julia cannot infer the return type automatically. For example:


.. function:: unsafe_convert(T,x)
.. function:: unsafe_convert(T, x)

::
unsafe_convert(T, x)
Convert ``x`` to a value of type ``T`` In cases where ``convert`` would need to take a Julia object and turn it into a ``Ptr``, this function should be used to define and perform that conversion. Be careful to ensure that a julia reference to ``x`` exists as long as the result of this function will be used. Accordingly, the argument ``x`` to this function should never be an expression, only a variable name or field reference. For example, ``x=a.b.c`` is acceptable, but ``x=[a,b,c]`` is not. The ``unsafe`` prefix on this function indicates that using the result of this function after the ``x`` argument to this function is no longer accessible to the program may cause undefined behavior, including program corruption or segfaults, at any later time.


.. function:: cconvert(T,x)
.. function:: cconvert(T, x)

::
cconvert(T, x)
Convert ``x`` to a value of type ``T``, typically by calling In cases where ``x`` cannot be safely converted to ``T``, unlike from ``T``, which however is suitable for ``unsafe_convert`` to handle. Neither ``convert`` nor ``cconvert`` should take a Julia object and turn it into a ``Ptr``.


.. function:: unsafe_load(p::Ptr{T},i::Integer)
.. function:: unsafe_load(p::Ptr{T}, i::Integer)

::
unsafe_load(p::Ptr{T}, i::Integer)
Load a value of type ``T`` from the address of the ith element expression ``p[i-1]``. The ``unsafe`` prefix on this function indicates that no validation is performed on the pointer ``p`` to ensure that it is valid. Incorrect usage may segfault your program or return garbage answers, in the same manner as C.


.. function:: unsafe_store!(p::Ptr{T},x,i::Integer)
.. function:: unsafe_store!(p::Ptr{T}, x, i::Integer)

::
unsafe_store!(p::Ptr{T}, x, i::Integer)
Store a value of type ``T`` to the address of the ith element expression ``p[i-1] = x``. The ``unsafe`` prefix on this function indicates that no validation is performed on the pointer ``p`` to ensure that it is valid. Incorrect usage may corrupt or segfault your program, in the same manner as C.


.. function:: unsafe_copy!(dest::Ptr{T}, src::Ptr{T}, N)
.. function:: unsafe_copy!(dest::Array, do, src::Array, so, N)

::
unsafe_copy!(dest::Array, do, src::Array, so, N)
Copy ``N`` elements from a source array to a destination, starting at offset ``so`` in the source and ``do`` in the destination The ``unsafe`` prefix on this function indicates that no validation is performed to ensure that N is inbounds on either array. Incorrect usage may corrupt or segfault your program, in the same manner as C.


.. function:: unsafe_copy!(dest::Array, do, src::Array, so, N)

::
unsafe_copy!(dest::Array, do, src::Array, so, N)
Copy ``N`` elements from a source array to a destination, starting at offset ``so`` in the source and ``do`` in the destination The ``unsafe`` prefix on this function indicates that no validation is performed to ensure that N is inbounds on either array. Incorrect usage may corrupt or segfault your program, in the same manner as C.


.. function:: copy!(dest, src)
.. function:: copy!(dest, do, src, so, N)

::
copy!(dest, do, src, so, N)
Copy ``N`` elements from collection ``src`` starting at offset


.. function:: copy!(dest, do, src, so, N)

::
copy!(dest, do, src, so, N)
Copy ``N`` elements from collection ``src`` starting at offset


.. function:: pointer(array [, index])
.. function:: pointer(array[, index])

::
pointer(array[, index])
Get the native address of an array or string element. Be careful to ensure that a julia reference to ``a`` exists as long as this pointer will be used. This function is ``unsafe`` like Calling ``Ref(array[, index])`` is generally preferable to this function.


.. function:: pointer_to_array(pointer, dims[, take_ownership::Bool])

::
pointer_to_array(pointer, dims[, take_ownership::Bool])
Wrap a native pointer as a Julia Array object. The pointer element type determines the array element type. ``own`` optionally specifies whether Julia should take ownership of the memory, calling ``free`` on the pointer when the array is no longer referenced.


.. function:: pointer_from_objref(object_instance)

::
pointer_from_objref(object_instance)
Get the memory address of a Julia object as a ``Ptr``. The existence of the resulting ``Ptr`` will not protect the object from garbage collection, so you must ensure that the object remains referenced for the whole time that the ``Ptr`` will be used.


.. function:: unsafe_pointer_to_objref(p::Ptr)

::
unsafe_pointer_to_objref(p::Ptr)
Convert a ``Ptr`` to an object reference. Assumes the pointer refers to a valid heap-allocated Julia object. If this is not the case, undefined behavior results, hence this function is considered


.. function:: disable_sigint(f::Function)

::
disable_sigint(f::Function)
Disable Ctrl-C handler during execution of a function, for calling external code that is not interrupt safe. Intended to be called using ``do`` block syntax as follows:


.. function:: reenable_sigint(f::Function)

::
reenable_sigint(f::Function)
Re-enable Ctrl-C handler during execution of a function. Temporarily reverses the effect of ``disable_sigint``.


.. function:: systemerror(sysfunc, iftrue)

::
systemerror(sysfunc, iftrue)
Raises a ``SystemError`` for ``errno`` with the descriptive string


Expand Down
Loading

0 comments on commit fe1bd3f

Please sign in to comment.