Fix many broken links

Note that contrary to what docgen.rst currently says, the ids have
to match exactly or else most web browsers will not jump to the
intended symbol.

(cherry picked from commit 93461aee34)
This commit is contained in:
Jjp137
2019-10-17 14:45:23 -07:00
committed by narimiran
parent cd60067638
commit dedff71ca0
35 changed files with 148 additions and 142 deletions

View File

@@ -157,7 +157,7 @@ AST:
As a side note, if you choose to use infix operators in a prefix form, the AST
behaves as a
[parenthetical function call](./macros.html#calls-expressions-call-with) with
[parenthetical function call](#callsslashexpressions-call-with) with
``nnkAccQuoted``, as follows:
Concrete syntax:

View File

@@ -107,7 +107,7 @@ Nim code calling the backend
Nim code can interface with the backend through the `Foreign function
interface <manual.html#foreign-function-interface>`_ mainly through the
`importc pragma <manual.html#importc-pragma>`_. The ``importc`` pragma is the
`importc pragma <manual.html#foreign-function-interface-importc-pragma>`_. The ``importc`` pragma is the
*generic* way of making backend symbols available in Nim and is available
in all the target backends (JavaScript too). The C++ or Objective-C backends
have their respective `ImportCpp <manual.html#implementation-specific-pragmas-importcpp-pragma>`_ and
@@ -124,16 +124,16 @@ statically or dynamically. The preferred way of integrating native code is to
use dynamic linking because it allows you to compile Nim programs without
the need for having the related development libraries installed. This is done
through the `dynlib pragma for import
<manual.html#dynlib-pragma-for-import>`_, though more specific control can be
<manual.html#foreign-function-interface-dynlib-pragma-for-import>`_, though more specific control can be
gained using the `dynlib module <dynlib.html>`_.
The `dynlibOverride <nimc.html#dynliboverride>`_ command line switch allows
to avoid dynamic linking if you need to statically link something instead.
Nim wrappers designed to statically link source files can use the `compile
pragma <nimc.html#compile-pragma>`_ if there are few sources or providing
pragma <manual.html#implementation-specific-pragmas-compile-pragma>`_ if there are few sources or providing
them along the Nim code is easier than using a system library. Libraries
installed on the host system can be linked in with the `PassL pragma
<nimc.html#passl-pragma>`_.
<manual.html#implementation-specific-pragmas-passl-pragma>`_.
To wrap native code, take a look at the `c2nim tool <https://nim-lang.org/docs/c2nim.html>`_ which helps
with the process of scanning and transforming header files into a Nim
@@ -215,7 +215,7 @@ Backend code calling Nim
------------------------
Backend code can interface with Nim code exposed through the `exportc
pragma <manual.html#exportc-pragma>`_. The ``exportc`` pragma is the *generic*
pragma <manual.html#foreign-function-interface-exportc-pragma>`_. The ``exportc`` pragma is the *generic*
way of making Nim symbols available to the backends. By default the Nim
compiler will mangle all the Nim symbols to avoid any name collision, so
the most significant thing the ``exportc`` pragma does is maintain the Nim
@@ -329,7 +329,7 @@ Nimcache naming logic
The `nimcache`:idx: directory is generated during compilation and will hold
either temporary or final files depending on your backend target. The default
name for the directory depends on the used backend and on your OS but you can
use the ``--nimcache`` `compiler switch <nimc.html#command-line-switches>`_ to
use the ``--nimcache`` `compiler switch <nimc.html#compiler-usage-command-line-switches>`_ to
change it.
@@ -349,14 +349,14 @@ Strings and C strings
---------------------
The manual mentions that `Nim strings are implicitly convertible to
cstrings <manual.html#cstring-type>`_ which makes interaction usually
cstrings <manual.html#types-cstring-type>`_ which makes interaction usually
painless. Most C functions accepting a Nim string converted to a
``cstring`` will likely not need to keep this string around and by the time
they return the string won't be needed any more. However, for the rare cases
where a Nim string has to be preserved and made available to the C backend
as a ``cstring``, you will need to manually prevent the string data from being
freed with `GC_ref <system.html#GC_ref>`_ and `GC_unref
<system.html#GC_unref>`_.
freed with `GC_ref <system.html#GC_ref,string>`_ and `GC_unref
<system.html#GC_unref,string>`_.
A similar thing happens with C code invoking Nim code which returns a
``cstring``. Consider the following proc:
@@ -382,9 +382,9 @@ Custom data types
Just like strings, custom data types that are to be shared between Nim and
the backend will need careful consideration of who controls who. If you want
to hand a Nim reference to C code, you will need to use `GC_ref
<system.html#GC_ref>`_ to mark the reference as used, so it does not get
<system.html#GC_ref,ref.T>`_ to mark the reference as used, so it does not get
freed. And for the C backend you will need to expose the `GC_unref
<system.html#GC_unref>`_ proc to clean up this memory when it is not required
<system.html#GC_unref,ref.T>`_ proc to clean up this memory when it is not required
any more.
Again, if you are wrapping a library which *mallocs* and *frees* data

View File

@@ -360,7 +360,8 @@ General commit rules
2. If you introduce changes which affect backwards compatibility,
make breaking changes, or have PR which is tagged as ``[feature]``,
the changes should be mentioned in `<changelog.md>`_.
the changes should be mentioned in `the changelog
<https://github.com/nim-lang/Nim/blob/devel/changelog.md>`_.
3. All changes introduced by the commit (diff lines) must be related to the
subject of the commit.

View File

@@ -295,8 +295,8 @@ The relationship of type to suffix is made by the proc ``complexName`` in the
``compiler/docgen.nim`` file. Here are some examples of complex names for
symbols in the `system module <system.html>`_.
* ``type SignedInt = int | int8 | int16 | int32 | int64`` **=>**
`#SignedInt <system.html#SignedInt>`_
* ``type SomeSignedInt = int | int8 | int16 | int32 | int64`` **=>**
`#SomeSignedInt <system.html#SomeSignedInt>`_
* ``var globalRaiseHook: proc (e: ref E_Base): bool {.nimcall.}`` **=>**
`#globalRaiseHook <system.html#globalRaiseHook>`_
* ``const NimVersion = "0.0.0"`` **=>**
@@ -307,22 +307,22 @@ symbols in the `system module <system.html>`_.
`#len,seq[T] <system.html#len,seq[T]>`_
* ``iterator pairs[T](a: seq[T]): tuple[key: int, val: T] {.inline.}`` **=>**
`#pairs.i,seq[T] <system.html#pairs.i,seq[T]>`_
* ``template newException[](exceptn: type; message: string): expr`` **=>**
`#newException.t,type,string
<system.html#newException.t,type,string>`_
* ``template newException[](exceptn: typedesc; message: string; parentException: ref Exception = nil): untyped`` **=>**
`#newException.t,typedesc,string,ref.Exception
<system.html#newException.t,typedesc,string,ref.Exception>`_
Index (idx) file format
=======================
Files with the ``.idx`` extension are generated when you use the `Index
switch`_ along with commands to generate documentation from source or text
switch <#related-options-index-switch>`_ along with commands to generate documentation from source or text
files. You can programatically generate indices with the `setIndexTerm()
<rstgen.html#setIndexTerm>`_ and `writeIndexFile()
<rstgen.html#writeIndexFile>`_ procs. The purpose of ``idx`` files is to hold
<rstgen.html#setIndexTerm,RstGenerator,string,string,string,string,string>`_ and `writeIndexFile()
<rstgen.html#writeIndexFile,RstGenerator,string>`_ procs. The purpose of ``idx`` files is to hold
the interesting symbols and their HTML references so they can be later
concatenated into a big index file with `mergeIndexes()
<rstgen.html#mergeIndexes>`_. This section documents the file format in
<rstgen.html#mergeIndexes,string>`_. This section documents the file format in
detail.
Index files are line oriented and tab separated (newline and tab characters
@@ -368,7 +368,7 @@ final index, and TOC entries found in ``.nim`` files are discarded.
Additional resources
====================
`Nim Compiler User Guide <nimc.html#command-line-switches>`_
`Nim Compiler User Guide <nimc.html#compiler-usage-command-line-switches>`_
`RST Quick Reference
<http://docutils.sourceforge.net/docs/user/rst/quickref.html>`_

View File

@@ -124,7 +124,7 @@ separators!).
The typical usage scenario for this option is to call it after the
user has typed the dot character for `the object oriented call
syntax <tut2.html#method-call-syntax>`_. Idetools will try to return
syntax <tut2.html#object-oriented-programming-method-call-syntax>`_. Idetools will try to return
the suggestions sorted first by scope (from innermost to outermost)
and then by item name.
@@ -359,7 +359,7 @@ defined, since at that point in the file the parser hasn't processed
the full line yet. The signature will be returned complete in
posterior instances of the method.
Methods imply `dynamic dispatch <tut2.html#dynamic-dispatch>`_ and
Methods imply `dynamic dispatch <tut2.html#object-oriented-programming-dynamic-dispatch>`_ and
idetools performs a static analysis on the code. For this reason
idetools may not return the definition of the correct method you
are querying because it may be impossible to know until the code

View File

@@ -47,7 +47,7 @@ csource command
---------------
The `csource`:idx: command builds the C sources for installation. It accepts
the same options as you would pass to the `boot command`_.
the same options as you would pass to the `boot command <#commands-boot-command>`_.
temp command
------------
@@ -55,7 +55,7 @@ temp command
The temp command builds the Nim compiler but with a different final name
(``nim_temp``), so it doesn't overwrite your normal compiler. You can use
this command to test different options, the same you would issue for the `boot
command`_.
command <#commands-boot-command>`_.
test command
------------

View File

@@ -329,7 +329,7 @@ Threading
---------
* `threadpool <threadpool.html>`_
Implements Nim's `spawn <manual.html#parallel-amp-spawn>`_.
Implements Nim's `spawn <manual_experimental.html#parallel-amp-spawn>`_.
Parsers

View File

@@ -1479,7 +1479,7 @@ order. The *names* of the fields also have to be identical.
The assignment operator for tuples copies each component.
The default assignment operator for objects copies each component. Overloading
of the assignment operator is described in `type-bound-operations-operator`_.
of the assignment operator is described `here <manual_experimental.html#type-bound-operations>`_.
.. code-block:: nim
@@ -2129,7 +2129,7 @@ conversions from ``string`` to ``SQL`` are allowed:
Now we have compile-time checking against SQL injection attacks. Since
``"".SQL`` is transformed to ``SQL("")`` no new syntax is needed for nice
looking ``SQL`` string literals. The hypothetical ``SQL`` type actually
exists in the library as the `TSqlQuery type <db_sqlite.html#TSqlQuery>`_ of
exists in the library as the `SqlQuery type <db_common.html#SqlQuery>`_ of
modules like `db_sqlite <db_sqlite.html>`_.
@@ -3481,7 +3481,7 @@ more argument in this case:
assert x == y
The command invocation syntax also can't have complex expressions as arguments.
For example: (`anonymous procs`_), ``if``, ``case`` or ``try``.
For example: (`anonymous procs <#procedures-anonymous-procs>`_), ``if``, ``case`` or ``try``.
Function calls with no arguments still needs () to
distinguish between a call and the function itself as a first class value.
@@ -3502,7 +3502,7 @@ Creating closures in loops
~~~~~~~~~~~~~~~~~~~~~~~~~~
Since closures capture local variables by reference it is often not wanted
behavior inside loop bodies. See `closureScope <system.html#closureScope>`_
behavior inside loop bodies. See `closureScope <system.html#closureScope.t,untyped>`_
for details on how to change this behavior.
Anonymous Procs
@@ -5892,7 +5892,7 @@ or ``ref T`` or ``ptr T`` this means no locations are modified. It is a static
error to mark a proc/iterator to have no side effect if the compiler cannot
verify this.
As a special semantic rule, the built-in `debugEcho <system.html#debugEcho>`_
As a special semantic rule, the built-in `debugEcho <system.html#debugEcho,varargs[typed,]>`_
pretends to be free of side effects, so that it can be used for debugging
routines marked as ``noSideEffect``.
@@ -6165,7 +6165,8 @@ factor.
immediate pragma
----------------
The immediate pragma is obsolete. See `Typed vs untyped parameters`_.
The immediate pragma is obsolete. See `Typed vs untyped parameters
<#templates-typed-vs-untyped-parameters>`_.
compilation option pragmas
@@ -7035,7 +7036,7 @@ is not set to C, other pragmas are available:
* `importcpp <manual.html#implementation-specific-pragmas-importcpp-pragma>`_
* `importobjc <manual.html#implementation-specific-pragmas-importobjc-pragma>`_
* `importjs <manul.html#implementation-specific-pragmas-importjs-pragma>`_
* `importjs <manual.html#implementation-specific-pragmas-importjs-pragma>`_
.. code-block:: Nim
proc p(s: cstring) {.importc: "prefix$1".}

View File

@@ -203,7 +203,7 @@ useful only when interfacing with imported types having such semantics.
Automatic dereferencing
=======================
If the `experimental mode <#pragmas-experimental-pragma>`_ is active and no other match
If the `experimental mode <manual.html#pragmas-experimental-pragma>`_ is active and no other match
is found, the first argument ``a`` is dereferenced automatically if it's a
pointer type and overloading resolution is tried with ``a[]`` instead.
@@ -814,7 +814,7 @@ This mechanism will be used by most data structures that support shared memory
like channels to implement thread safe automatic memory management.
The builtin ``deepCopy`` can even clone closures and their environments. See
the documentation of `spawn`_ for details.
the documentation of `spawn <#parallel-amp-spawn-spawn-statement>`_ for details.
Case statement macros

View File

@@ -114,7 +114,7 @@ Level Description
===== ============================================
0 Minimal output level for the compiler.
1 Displays compilation of all the compiled files, including those imported
by other modules or through the `compile pragma<#compile-pragma>`_.
by other modules or through the `compile pragma<manual.html#implementation-specific-pragmas-compile-pragma>`_.
This is the default level.
2 Displays compilation statistics, enumerates the dynamic
libraries that will be loaded by the final binary and dumps to
@@ -130,8 +130,8 @@ Compile time symbols
Through the ``-d:x`` or ``--define:x`` switch you can define compile time
symbols for conditional compilation. The defined switches can be checked in
source code with the `when statement <manual.html#when-statement>`_ and
`defined proc <system.html#defined>`_. The typical use of this switch is to
source code with the `when statement <manual.html#statements-and-expressions-when-statement>`_ and
`defined proc <system.html#defined,untyped>`_. The typical use of this switch is to
enable builds in release mode (``-d:release``) where optimizations are
enabled for better performance. Another common use is the ``-d:ssl`` switch to
activate SSL sockets.
@@ -215,7 +215,7 @@ The ``_r`` suffix is used for release builds, ``_d`` is for debug builds.
This makes it easy to delete all generated files.
The ``--nimcache``
`compiler switch <nimc.html#command-line-switches>`_ can be used to
`compiler switch <#compiler-usage-command-line-switches>`_ can be used to
to change the ``nimcache`` directory.
However, the generated C code is not platform independent. C code generated for

View File

@@ -105,7 +105,7 @@ completion symbols at some point in the file.
The typical usage scenario for this option is to call it after the
user has typed the dot character for `the object oriented call
syntax <tut2.html#method-call-syntax>`_. Nimsuggest will try to return
syntax <tut2.html#object-oriented-programming-method-call-syntax>`_. Nimsuggest will try to return
the suggestions sorted first by scope (from innermost to outermost)
and then by item name.

View File

@@ -83,4 +83,4 @@ Note how the set turns enum values into powers of 2.
If using enums and sets with C, use distinct cint.
For interoperability with C see also the
`bitsize pragma <#implementation-specific-pragmas-bitsize-pragma>`_.
`bitsize pragma <manual.html#implementation-specific-pragmas-bitsize-pragma>`_.

View File

@@ -67,8 +67,8 @@ done with spaces only, tabulators are not allowed.
String literals are enclosed in double quotes. The ``var`` statement declares
a new variable named ``name`` of type ``string`` with the value that is
returned by the `readLine <system.html#readLine,File>`_ procedure. Since the
compiler knows that `readLine <system.html#readLine,File>`_ returns a string,
returned by the `readLine <io.html#readLine,File>`_ procedure. Since the
compiler knows that `readLine <io.html#readLine,File>`_ returns a string,
you can leave out the type in the declaration (this is called `local type
inference`:idx:). So this will work too:
@@ -80,7 +80,7 @@ Note that this is basically the only form of type inference that exists in
Nim: it is a good compromise between brevity and readability.
The "hello world" program contains several identifiers that are already known
to the compiler: ``echo``, `readLine <system.html#readLine,File>`_, etc.
to the compiler: ``echo``, `readLine <io.html#readLine,File>`_, etc.
These built-ins are declared in the system_ module which is implicitly
imported by any other module.
@@ -326,7 +326,7 @@ the compiler that for every other value nothing should be done:
of 3, 8: echo "The number is 3 or 8"
else: discard
The empty `discard statement`_ is a *do nothing* statement. The compiler knows
The empty `discard statement <#procedures-discard-statement>`_ is a *do nothing* statement. The compiler knows
that a case statement with an else part cannot fail and thus the error
disappears. Note that it is impossible to cover all possible string values:
that is why string cases always need an ``else`` branch.
@@ -359,7 +359,7 @@ For statement
-------------
The ``for`` statement is a construct to loop over any element an *iterator*
provides. The example uses the built-in `countup <system.html#countup>`_
provides. The example uses the built-in `countup <system.html#countup.i,T,T,Positive>`_
iterator:
.. code-block:: nim
@@ -371,7 +371,7 @@ iterator:
The variable ``i`` is implicitly declared by the
``for`` loop and has the type ``int``, because that is what `countup
<system.html#countup>`_ returns. ``i`` runs through the values 1, 2, .., 10.
<system.html#countup.i,T,T,Positive>`_ returns. ``i`` runs through the values 1, 2, .., 10.
Each value is ``echo``-ed. This code does the same:
.. code-block:: nim
@@ -391,7 +391,7 @@ Counting down can be achieved as easily (but is less often needed):
# --> Outputs 10 9 8 7 6 5 4 3 2 1 on different lines
Since counting up occurs so often in programs, Nim also has a `..
<system.html#...i,S,T>`_ iterator that does the same:
<system.html#...i,T,T>`_ iterator that does the same:
.. code-block:: nim
for i in 1..10:
@@ -570,8 +570,8 @@ an expression is allowed:
Procedures
==========
To define new commands like `echo <system.html#echo>`_ and `readLine
<system.html#readLine,File>`_ in the examples, the concept of a `procedure`
To define new commands like `echo <system.html#echo,varargs[typed,]>`_ and `readLine
<io.html#readLine,File>`_ in the examples, the concept of a `procedure`
is needed. (Some languages call them *methods* or *functions*.) In Nim new
procedures are defined with the ``proc`` keyword:
@@ -753,7 +753,7 @@ Nim provides the ability to overload procedures similar to C++:
echo toString(13) # calls the toString(x: int) proc
echo toString(true) # calls the toString(x: bool) proc
(Note that ``toString`` is usually the `$ <system.html#$>`_ operator in
(Note that ``toString`` is usually the `$ <dollars.html>`_ operator in
Nim.) The compiler chooses the most appropriate proc for the ``toString``
calls. How this overloading resolution algorithm works exactly is not
discussed here (it will be specified in the manual soon). However, it does
@@ -845,7 +845,7 @@ Let's return to the simple counting example:
for i in countup(1, 10):
echo i
Can a `countup <system.html#countup>`_ proc be written that supports this
Can a `countup <system.html#countup.i,T,T,Positive>`_ proc be written that supports this
loop? Lets try:
.. code-block:: nim
@@ -1010,7 +1010,7 @@ floats and follow the IEEE-754 standard.
Automatic type conversion in expressions with different kinds of floating
point types is performed: the smaller type is converted to the larger. Integer
types are **not** converted to floating point types automatically, nor vice
versa. Use the `toInt <system.html#toInt>`_ and `toFloat <system.html#toFloat>`_
versa. Use the `toInt <system.html#toInt,float>`_ and `toFloat <system.html#toFloat,int>`_
procs for these conversions.
@@ -1031,13 +1031,13 @@ type as a function:
Internal type representation
============================
As mentioned earlier, the built-in `$ <system.html#$>`_ (stringify) operator
As mentioned earlier, the built-in `$ <dollars.html>`_ (stringify) operator
turns any basic type into a string, which you can then print to the console
using the ``echo`` proc. However, advanced types, and your own custom types,
won't work with the ``$`` operator until you define it for them.
Sometimes you just want to debug the current value of a complex type without
having to write its ``$`` operator. You can use then the `repr
<system.html#repr>`_ proc which works with any type and even complex data
<system.html#repr,T>`_ proc which works with any type and even complex data
graphs with cycles. The following example shows that even for basic types
there is a difference between the ``$`` and ``repr`` outputs:
@@ -1127,8 +1127,8 @@ Operation Comment
``pred(x, n)`` returns the `n`'th predecessor of `x`
----------------- --------------------------------------------------------
The `inc <system.html#inc>`_, `dec <system.html#dec>`_, `succ
<system.html#succ>`_ and `pred <system.html#pred>`_ operations can fail by
The `inc <system.html#inc,T,int>`_, `dec <system.html#dec,T,int>`_, `succ
<system.html#succ,T,int>`_ and `pred <system.html#pred,T,int>`_ operations can fail by
raising an `EOutOfRange` or `EOverflow` exception. (If the code has been
compiled with the proper runtime checks turned on.)
@@ -1150,7 +1150,7 @@ compile-time or runtime error. Assignments from the base type to one of its
subrange types (and vice versa) are allowed.
The ``system`` module defines the important `Natural <system.html#Natural>`_
type as ``range[0..high(int)]`` (`high <system.html#high>`_ returns the
type as ``range[0..high(int)]`` (`high <system.html#high,typedesc[T]>`_ returns the
maximal value). Other programming languages may suggest the use of unsigned
integers for natural numbers. This is often **unwise**: you don't want unsigned
arithmetic (which wraps around) just because the numbers cannot be negative.
@@ -1189,8 +1189,8 @@ Arrays are value types, like any other Nim type. The assignment operator
copies the whole array contents.
The built-in `len <system.html#len,TOpenArray>`_ proc returns the array's
length. `low(a) <system.html#low>`_ returns the lowest valid index for the
array `a` and `high(a) <system.html#high>`_ the highest valid index.
length. `low(a) <system.html#low,openArray[T]>`_ returns the lowest valid index for the
array `a` and `high(a) <system.html#high,openArray[T]>`_ the highest valid index.
.. code-block:: nim
:test: "nim c $1"
@@ -1265,8 +1265,8 @@ during runtime (like strings). Since sequences are resizable they are always
allocated on the heap and garbage collected.
Sequences are always indexed with an ``int`` starting at position 0. The `len
<system.html#len,seq[T]>`_, `low <system.html#low>`_ and `high
<system.html#high>`_ operations are available for sequences too. The notation
<system.html#len,seq[T]>`_, `low <system.html#low,openArray[T]>`_ and `high
<system.html#high,openArray[T]>`_ operations are available for sequences too. The notation
``x[i]`` can be used to access the i-th element of ``x``.
Sequences can be constructed by the array constructor ``[]`` in conjunction
@@ -1318,8 +1318,8 @@ Open arrays
Often fixed size arrays turn out to be too inflexible; procedures should be
able to deal with arrays of different sizes. The `openarray`:idx: type allows
this. Openarrays are always indexed with an ``int`` starting at position 0.
The `len <system.html#len,TOpenArray>`_, `low <system.html#low>`_ and `high
<system.html#high>`_ operations are available for open arrays too. Any array
The `len <system.html#len,TOpenArray>`_, `low <system.html#low,openArray[T]>`_ and `high
<system.html#high,openArray[T]>`_ operations are available for open arrays too. Any array
with a compatible base type can be passed to an openarray parameter, the index
type does not matter.
@@ -1377,8 +1377,8 @@ type conversions in this context:
# is transformed by the compiler to:
myWriteln(stdout, [$123, $"abc", $4.0])
In this example `$ <system.html#$>`_ is applied to any argument that is passed
to the parameter ``a``. Note that `$ <system.html#$>`_ applied to strings is a
In this example `$ <dollars.html>`_ is applied to any argument that is passed
to the parameter ``a``. Note that `$ <dollars.html>`_ applied to strings is a
nop.
@@ -1561,7 +1561,7 @@ having the same field types.
Tuples can be *unpacked* during variable assignment (and only then!). This can
be handy to assign directly the fields of the tuples to individually named
variables. An example of this is the `splitFile <os.html#splitFile>`_ proc
variables. An example of this is the `splitFile <os.html#splitFile,string>`_ proc
from the `os module <os.html>`_ which returns the directory, name and
extension of a path at the same time. For tuple unpacking to work you must
use parentheses around the values you want to assign the unpacking to,