Skip to content

Commit 50c7318

Browse files
fix more jacked up RST all over the place
1 parent 3cf7a34 commit 50c7318

17 files changed

+90
-74
lines changed

doc/devdocs/eval.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ One of the hardest parts about learning how the Julia Language runs code is lear
88
how all of the pieces work together to execute a block of code.
99

1010
Each chunk of code typically makes a trip through many esoteric acronyms such as (in no particular order),
11-
`flisp`, `AST`, `C++`, `LLVM`, `eval`, `typeinf`, `macroexpand`, `sysimg` (or `system image`), `bootstrapping`,
12-
`compile`, `parse`, `execute`, `JIT`, `interpret`, `box`, `unbox`, `intrinsic function`, `primitive function`
11+
``flisp``, ``AST``, ``C++``, ``LLVM``, ``eval``, ``typeinf``, ``macroexpand``, ``sysimg`` (or ``system image``), ``bootstrapping``,
12+
``compile``, ``parse``, ``execute``, ``JIT``, ``interpret``, ``box``, ``unbox``, ``intrinsic function``, ``primitive function``
1313
before turning into the desired result (hopefully).
1414

1515
.. sidebar:: Definitions
@@ -30,26 +30,26 @@ Julia Execution
3030

3131
The 10,000 foot view of the whole process is as follows:
3232

33-
1. The user starts `julia`.
34-
2. The C function :c:func:`main` from `ui/repl.c` gets called.
33+
1. The user starts ``julia``.
34+
2. The C function :c:func:`main` from ``ui/repl.c`` gets called.
3535
This function processes the command line arguments, filling in the :c:type:`jl_options` struct and setting the variable :code:`ARGS`.
3636
It then initializes Julia (by calling `julia_init in task.c <https://github.com/JuliaLang/julia/blob/master/src/task.c>`_,
3737
which may load a previously compiled sysimg_).
3838
Finally, it passes off control to Julia by calling `Base._start() <https://github.com/JuliaLang/julia/blob/master/base/client.jl>`_.
39-
#. When `_start()` takes over control, the subsequent sequence of commands depends on the command line arguments given.
39+
#. When ``_start()`` takes over control, the subsequent sequence of commands depends on the command line arguments given.
4040
For example, if a filename was supplied, it will proceed to execute that file. Otherwise, it will start an interactive REPL.
4141
#. Skipping the details about how the REPL interacts with the user,
4242
let's just say the program ends up with a block of code that it wants to run.
4343
#. If the block of code to run is in a file, `jl_load(char *filename) <https://github.com/JuliaLang/julia/blob/master/src/toplevel.c>`_
44-
gets invoked to load the file and parse_ it. Each fragment of code is then passed to `eval` to execute.
44+
gets invoked to load the file and parse_ it. Each fragment of code is then passed to ``eval`` to execute.
4545
#. Each fragment of code (or AST), is handed off to :func:`eval` to turn into results.
4646
#. :func:`eval` takes each code fragment and tries to run it in `jl_toplevel_eval_flex() <https://github.com/JuliaLang/julia/blob/master/src/toplevel.c>`_.
47-
#. :c:func:`jl_toplevel_eval_flex` decides whether the code is a "toplevel" action (such as `using` or `module`), which would be invalid inside a function.
47+
#. :c:func:`jl_toplevel_eval_flex` decides whether the code is a "toplevel" action (such as ``using`` or ``module``), which would be invalid inside a function.
4848
If so, it passes off the code to the toplevel interpreter.
4949
#. :c:func:`jl_toplevel_eval_flex` then expands_ the code to eliminate any macros and to "lower" the AST to make it simpler to execute.
5050
#. :c:func:`jl_toplevel_eval_flex` then uses some simple heuristics to decide whether to JIT compiler the AST or to interpret it directly.
5151
#. The bulk of the work to interpret code is handled by `eval in interpreter.c <https://github.com/JuliaLang/julia/blob/master/src/interpreter.c>`_.
52-
#. If instead, the code is compiled, the bulk of the work is handled by `codegen.cpp`.
52+
#. If instead, the code is compiled, the bulk of the work is handled by ``codegen.cpp``.
5353
Whenever a Julia function is called for the first time with a given set of argument types, `type inference`_ will be run on that function.
5454
This information is used by the codegen_ step to generate faster code.
5555
#. Eventually, the user quits the REPL, or the end of the program is reached, and the :func:`_start` method returns.
@@ -80,8 +80,8 @@ Macro Expansion
8080
---------------
8181

8282
When :func:`eval` encounters a macro, it expands that AST node before attempting to evaluate the expression.
83-
Macro expansion involves a handoff from :func:`eval` (in Julia), to the parser function :c:func:`jl_macroexpand` (written in `flisp`)
84-
to the Julia macro itself (written in - what else - `Julia`) via :c:func:`fl_invoke_julia_macro`, and back.
83+
Macro expansion involves a handoff from :func:`eval` (in Julia), to the parser function :c:func:`jl_macroexpand` (written in ``flisp``)
84+
to the Julia macro itself (written in - what else - Julia) via :c:func:`fl_invoke_julia_macro`, and back.
8585

8686
Typically, macro expansion is invoked as a first step during a call to :func:`expand`/:c:func:`jl_expand`,
8787
although it can also be invoked directly by a call to :func:`macroexpand`/:c:func:`jl_macroexpand`.
@@ -139,7 +139,7 @@ Type inference may also include other steps such as constant propagation and inl
139139
These pseudo-functions implement operations on raw bits such as add and sign extend
140140
that cannot be expressed directly in any other way.
141141
Since they operate on bits directly, they must be compiled into a function
142-
and surrounded by a call to `Core.Intrinsics.box(T, ...)` to reassign type information to the value.
142+
and surrounded by a call to ``Core.Intrinsics.box(T, ...)`` to reassign type information to the value.
143143

144144
.. _codegen:
145145

@@ -164,7 +164,7 @@ Other parts of codegen are handled by various helper files:
164164
Handles backtraces for JIT functions
165165

166166
`ccall.cpp <https://github.com/JuliaLang/julia/blob/master/src/ccall.cpp>`_
167-
Handles the ccall and llvmcall FFI, along with various `abi_*.cpp` files
167+
Handles the ccall and llvmcall FFI, along with various ``abi_*.cpp`` files
168168

169169
`intrinsics.cpp <https://github.com/JuliaLang/julia/blob/master/src/intrinsics.cpp>`_
170170
Handles the emission of various low-level intrinsic functions
@@ -183,14 +183,14 @@ System Image
183183
------------
184184

185185
The system image is a precompiled archive of a set of Julia files.
186-
The `sys.ji` file distributed with Julia is one such system image,
186+
The ``sys.ji`` file distributed with Julia is one such system image,
187187
generated by executing the file `sysimg.jl <https://github.com/JuliaLang/julia/blob/master/base/sysimg.jl>`_,
188188
and serializing the resulting environment (including Types, Functions, Modules, and all other defined values)
189189
into a file. Therefore, it contains a frozen version of the :mod:`Main`, :mod:`Core`, and :mod:`Base` modules (and whatever else was in the environment at the end of bootstrapping).
190190
This serializer/deserializer is implemented by `jl_save_system_image/jl_restore_system_image in dump.c <https://github.com/JuliaLang/julia/blob/master/src/dump.c>`_.
191191

192192
If there is no sysimg file (:code:`jl_options.image_file == NULL`),
193-
this also implies that `--build` was given on the command line,
193+
this also implies that ``--build`` was given on the command line,
194194
so the final result should be a new sysimg file.
195195
During Julia initialization, minimal :mod:`Core` and :mod:`Main` modules are created.
196196
Then a file named ``boot.jl`` is evaluated from the current directory.

doc/devdocs/llvm.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ directory ``src/``.
3737
|``sys.c`` | I/O and operating system utility functions |
3838
+---------------------+-------------------------------------------------------------+
3939

40-
Some of the `.cpp` files form a group that compile to a single object.
40+
Some of the ``.cpp`` files form a group that compile to a single object.
4141

4242
The difference between an intrinsic and a builtin is that a builtin is a first class
4343
function that can be used like any other Julia function. An intrinsic can operate
@@ -50,7 +50,7 @@ Julia currently uses LLVM's `Type Based Alias Analysis <http://llvm.org/docs/Lan
5050
To find the comments that document the inclusion relationships, look for ``static MDNode*``
5151
in ``src/codegen.cpp``.
5252

53-
The `-O` option enables LLVM's `Basic Alias Analysis <http://llvm.org/docs/AliasAnalysis.html#the-basicaa-pass>`_.
53+
The ``-O`` option enables LLVM's `Basic Alias Analysis <http://llvm.org/docs/AliasAnalysis.html#the-basicaa-pass>`_.
5454

5555
Building Julia with a different version of LLVM
5656
-----------------------------------------------
@@ -76,7 +76,7 @@ Here are example settings using ``bash`` syntax:
7676

7777
* ``export JULIA_LLVM_ARGS = -print-after-all`` dumps IR after each pass.
7878

79-
* ``export JULIA_LLVM_ARGS = -debug-only=loop-vectorize`` dumps LLVM `DEBUG(`...`)`
79+
* ``export JULIA_LLVM_ARGS = -debug-only=loop-vectorize`` dumps LLVM ``DEBUG(...)``
8080
diagnostics for loop vectorizer *if* you built Julia with ``LLVM_ASSERTIONS=1``.
8181
Otherwise you will get warnings about "Unknown command line argument".
8282
Counter-intuitively, building Julia with ``LLVM_DEBUG=1`` is *not* enough to

doc/manual/arrays.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ Function Description
8787
defaulting to the element type and dimensions of ``A`` if omitted.
8888
:func:`reinterpret(type, A) <reinterpret>` an array with the same binary data as the given array, but with the
8989
specified element type
90-
:func:`rand(dims) <rand>` `:obj:`Array` of ``Float64``\ s with random, iid[#]_ and uniformly
90+
:func:`rand(dims) <rand>` :obj:`Array` of ``Float64``\ s with random, iid[#]_ and uniformly
9191
distributed values in the half-open interval :math:`[0, 1)`
92-
:func:`randn(dims) <randn>` `:obj:`Array` of ``Float64``\ s with random, iid and standard normally
92+
:func:`randn(dims) <randn>` :obj:`Array` of ``Float64``\ s with random, iid and standard normally
9393
distributed random values
9494
:func:`eye(n) <eye>` ``n``-by-``n`` identity matrix
9595
:func:`eye(m, n) <eye>` ``m``-by-``n`` identity matrix
@@ -528,7 +528,7 @@ where elements are stored in column-major order (see additional notes in
528528
:ref:`man-performance-tips`). :obj:`Vector` and :obj:`Matrix` are aliases for
529529
the 1-d and 2-d cases. Specific operations such as scalar indexing,
530530
assignment, and a few other basic storage-specific operations are all
531-
that have to be implemented for `:obj:`Array`, so that the rest of the array
531+
that have to be implemented for :obj:`Array`, so that the rest of the array
532532
library can be implemented in a generic manner.
533533

534534
:obj:`SubArray` is a specialization of :obj:`AbstractArray` that performs
@@ -541,7 +541,7 @@ can later be used to index the original array indirectly.
541541

542542
:obj:`StridedVector` and :obj:`StridedMatrix` are convenient aliases defined
543543
to make it possible for Julia to call a wider range of BLAS and LAPACK
544-
functions by passing them either `:obj:`Array` or :obj:`SubArray` objects, and
544+
functions by passing them either :obj:`Array` or :obj:`SubArray` objects, and
545545
thus saving inefficiencies from memory allocation and copying.
546546

547547
The following example computes the QR decomposition of a small section

doc/manual/calling-c-and-fortran-code.rst

Lines changed: 45 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ to fail or produce indeterminate results on a different system.
222222
Note that no C header files are used anywhere in the process of calling C
223223
functions: you are responsible for making sure that your Julia types and
224224
call signatures accurately reflect those in the C header file. (The `Clang
225-
package` <https://github.com/ihnorton/Clang.jl> can be used to auto-generate
225+
package <https://github.com/ihnorton/Clang.jl>`_ can be used to auto-generate
226226
Julia code from a C header file.)
227227

228228
Auto-conversion:
@@ -341,7 +341,7 @@ Julia type with the same name, prefixed by C. This can help for writing portable
341341
+===================================+=================+======================+===================================+
342342
| ``unsigned char`` | ``CHARACTER`` | ``Cuchar`` | ``UInt8`` |
343343
| | | | |
344-
| ``bool`` (`C++`) | | | |
344+
| ``bool`` (C++) | | | |
345345
+-----------------------------------+-----------------+----------------------+-----------------------------------+
346346
| ``short`` | ``INTEGER*2`` | ``Cshort`` | ``Int16`` |
347347
| | | | |
@@ -351,7 +351,7 @@ Julia type with the same name, prefixed by C. This can help for writing portable
351351
+-----------------------------------+-----------------+----------------------+-----------------------------------+
352352
| ``int`` | ``INTEGER*4`` | ``Cint`` | ``Int32`` |
353353
| | | | |
354-
| ``BOOL`` (`C`, typical) | ``LOGICAL*4`` | | |
354+
| ``BOOL`` (C, typical) | ``LOGICAL*4`` | | |
355355
+-----------------------------------+-----------------+----------------------+-----------------------------------+
356356
| ``unsigned int`` | | ``Cuint`` | ``UInt32`` |
357357
+-----------------------------------+-----------------+----------------------+-----------------------------------+
@@ -433,40 +433,55 @@ C name Standard Julia Alias Julia Base Type
433433
``UInt16`` (Windows)
434434
====================== ====================== =======
435435

436-
`Remember`: when calling a Fortran function, all inputs must be passed by reference, so all type correspondences
437-
above should contain an additional ``Ptr{..}`` or ``Ref{..}`` wrapper around their type specification.
436+
.. note::
438437

439-
`Warning`: For string arguments (``char*``) the Julia type should be ``Cstring`` (if NUL-terminated data is expected)
440-
or either ``Ptr{Cchar}`` or ``Ptr{UInt8}`` otherwise (these two pointer types have the same effect), as described above,
441-
not ``ASCIIString``. Similarly, for array arguments (``T[]`` or ``T*``), the Julia
442-
type should again be ``Ptr{T}``, not ``Vector{T}``.
438+
When calling a Fortran function, all inputs must be passed by reference, so
439+
all type correspondences above should contain an additional ``Ptr{..}`` or
440+
``Ref{..}`` wrapper around their type specification.
443441

444-
`Warning`: Julia's ``Char`` type is 32 bits, which is not the same as the wide
445-
character type (``wchar_t`` or ``wint_t``) on all platforms.
442+
.. warning::
446443

447-
`Note`: For ``wchar_t*`` arguments, the Julia type should be ``Cwstring`` (if the C routine
448-
expects a NUL-terminated string) or ``Ptr{Cwchar_t}`` otherwise,
449-
and data can be converted to/from ordinary Julia strings by the
450-
``wstring(s)`` function (equivalent to either ``utf16(s)`` or ``utf32(s)``
451-
depending upon the width of ``Cwchar_t``); this conversion will be called
452-
automatically for ``Cwstring`` arguments. Note also that ASCII, UTF-8,
453-
UTF-16, and UTF-32 string data in Julia is internally NUL-terminated, so
454-
it can be passed to C functions expecting NUL-terminated data without making
455-
a copy (but using the ``Cwstring`` type will cause an error to be thrown
456-
if the string itself contains NUL characters).
444+
For string arguments (``char*``) the Julia type should be ``Cstring`` (if NUL-
445+
terminated data is expected) or either ``Ptr{Cchar}`` or ``Ptr{UInt8}``
446+
otherwise (these two pointer types have the same effect), as described above,
447+
not ``ASCIIString``. Similarly, for array arguments (``T[]`` or ``T*``), the
448+
Julia type should again be ``Ptr{T}``, not ``Vector{T}``.
457449

458-
`Note`: C functions that take an argument of the type ``char**`` can be called by using
459-
a ``Ptr{Ptr{UInt8}}`` type within Julia. For example,
460-
C functions of the form::
450+
.. warning::
461451

462-
int main(int argc, char **argv);
452+
Julia's ``Char`` type is 32 bits, which is not the same as the wide character
453+
type (``wchar_t`` or ``wint_t``) on all platforms.
463454

464-
can be called via the following Julia code::
455+
.. note::
465456

466-
argv = [ "a.out", "arg1", "arg2" ]
467-
ccall(:main, Int32, (Int32, Ptr{Ptr{UInt8}}), length(argv), argv)
457+
For ``wchar_t*`` arguments, the Julia type should be ``Cwstring`` (if the C
458+
routine expects a NUL-terminated string) or ``Ptr{Cwchar_t}`` otherwise, and
459+
data can be converted to/from ordinary Julia strings by the ``wstring(s)``
460+
function (equivalent to either ``utf16(s)`` or ``utf32(s)`` depending upon the
461+
width of ``Cwchar_t``); this conversion will be called automatically for
462+
``Cwstring`` arguments. Note also that ASCII, UTF-8, UTF-16, and UTF-32
463+
string data in Julia is internally NUL-terminated, so it can be passed to C
464+
functions expecting NUL-terminated data without making a copy (but using the
465+
``Cwstring`` type will cause an error to be thrown if the string itself
466+
contains NUL characters).
468467

469-
`Note`: A C function declared to return ``Void`` will return the value ``nothing`` in Julia.
468+
.. note::
469+
470+
C functions that take an argument of the type ``char**`` can be called by
471+
using a ``Ptr{Ptr{UInt8}}`` type within Julia. For example, C functions of the
472+
form::
473+
474+
int main(int argc, char **argv);
475+
476+
can be called via the following Julia code::
477+
478+
argv = [ "a.out", "arg1", "arg2" ]
479+
ccall(:main, Int32, (Int32, Ptr{Ptr{UInt8}}), length(argv), argv)
480+
481+
.. note::
482+
483+
A C function declared to return ``Void`` will return the value ``nothing`` in
484+
Julia.
470485

471486
Struct Type correspondences
472487
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -524,7 +539,7 @@ Memory allocation and deallocation of such objects must be
524539
handled by calls to the appropriate cleanup routines in the libraries
525540
being used, just like in any C program. Do not try to free an object
526541
received from a C library with ``Libc.free`` in Julia, as this may result
527-
in the ``free`` function being called via the wrong `libc` library and
542+
in the ``free`` function being called via the wrong ``libc`` library and
528543
cause Julia to crash. The reverse (passing an object allocated in Julia
529544
to be freed by an external library) is equally invalid.
530545

doc/manual/documentation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ Adds docstring ``"..."`` to expression generated by expanding ``@m expression``.
355355
for expressions decorated with ``@inline``, ``@noinline``, ``@generated``, or any other
356356
macro to be documented in the same way as undecorated expressions.
357357

358-
Macro authors should take note that only macros that generate a `single expression` will
358+
Macro authors should take note that only macros that generate a single expression will
359359
automatically support docstrings. If a macro returns a block containing multiple
360360
subexpressions then the subexpression that should be documented must be marked using the
361361
:func:`@__doc__` macro.

doc/manual/faq.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ inside a specific function or set of functions, you have two options:
128128
What does the ``...`` operator do?
129129
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
130130

131-
The two uses of the `...` operator: slurping and splatting
132-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
131+
The two uses of the ``...`` operator: slurping and splatting
132+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133133

134134
Many newcomers to Julia find the use of ``...`` operator confusing. Part of
135135
what makes the ``...`` operator confusing is that it means two different things

0 commit comments

Comments
 (0)