Replace double backticks with single backticks - Part 2 out of ~6 (#17206)
This commit is contained in:
parent
ac8166ab3d
commit
82d8e9bff3
10 changed files with 136 additions and 136 deletions
|
|
@ -130,22 +130,22 @@ iterator items*[T: Ordinal](s: Slice[T]): T =
|
|||
yield x
|
||||
|
||||
iterator pairs*[T](a: openArray[T]): tuple[key: int, val: T] {.inline.} =
|
||||
## Iterates over each item of `a`. Yields ``(index, a[index])`` pairs.
|
||||
## Iterates over each item of `a`. Yields `(index, a[index])` pairs.
|
||||
var i = 0
|
||||
while i < len(a):
|
||||
yield (i, a[i])
|
||||
inc(i)
|
||||
|
||||
iterator mpairs*[T](a: var openArray[T]): tuple[key: int, val: var T]{.inline.} =
|
||||
## Iterates over each item of `a`. Yields ``(index, a[index])`` pairs.
|
||||
## ``a[index]`` can be modified.
|
||||
## Iterates over each item of `a`. Yields `(index, a[index])` pairs.
|
||||
## `a[index]` can be modified.
|
||||
var i = 0
|
||||
while i < len(a):
|
||||
yield (i, a[i])
|
||||
inc(i)
|
||||
|
||||
iterator pairs*[IX, T](a: array[IX, T]): tuple[key: IX, val: T] {.inline.} =
|
||||
## Iterates over each item of `a`. Yields ``(index, a[index])`` pairs.
|
||||
## Iterates over each item of `a`. Yields `(index, a[index])` pairs.
|
||||
var i = low(IX)
|
||||
if i <= high(IX):
|
||||
while true:
|
||||
|
|
@ -154,8 +154,8 @@ iterator pairs*[IX, T](a: array[IX, T]): tuple[key: IX, val: T] {.inline.} =
|
|||
inc(i)
|
||||
|
||||
iterator mpairs*[IX, T](a: var array[IX, T]): tuple[key: IX, val: var T] {.inline.} =
|
||||
## Iterates over each item of `a`. Yields ``(index, a[index])`` pairs.
|
||||
## ``a[index]`` can be modified.
|
||||
## Iterates over each item of `a`. Yields `(index, a[index])` pairs.
|
||||
## `a[index]` can be modified.
|
||||
var i = low(IX)
|
||||
if i <= high(IX):
|
||||
while true:
|
||||
|
|
@ -164,7 +164,7 @@ iterator mpairs*[IX, T](a: var array[IX, T]): tuple[key: IX, val: var T] {.inlin
|
|||
inc(i)
|
||||
|
||||
iterator pairs*[T](a: seq[T]): tuple[key: int, val: T] {.inline.} =
|
||||
## Iterates over each item of `a`. Yields ``(index, a[index])`` pairs.
|
||||
## Iterates over each item of `a`. Yields `(index, a[index])` pairs.
|
||||
var i = 0
|
||||
let L = len(a)
|
||||
while i < L:
|
||||
|
|
@ -173,8 +173,8 @@ iterator pairs*[T](a: seq[T]): tuple[key: int, val: T] {.inline.} =
|
|||
assert(len(a) == L, "the length of the seq changed while iterating over it")
|
||||
|
||||
iterator mpairs*[T](a: var seq[T]): tuple[key: int, val: var T] {.inline.} =
|
||||
## Iterates over each item of `a`. Yields ``(index, a[index])`` pairs.
|
||||
## ``a[index]`` can be modified.
|
||||
## Iterates over each item of `a`. Yields `(index, a[index])` pairs.
|
||||
## `a[index]` can be modified.
|
||||
var i = 0
|
||||
let L = len(a)
|
||||
while i < L:
|
||||
|
|
@ -183,7 +183,7 @@ iterator mpairs*[T](a: var seq[T]): tuple[key: int, val: var T] {.inline.} =
|
|||
assert(len(a) == L, "the length of the seq changed while iterating over it")
|
||||
|
||||
iterator pairs*(a: string): tuple[key: int, val: char] {.inline.} =
|
||||
## Iterates over each item of `a`. Yields ``(index, a[index])`` pairs.
|
||||
## Iterates over each item of `a`. Yields `(index, a[index])` pairs.
|
||||
var i = 0
|
||||
let L = len(a)
|
||||
while i < L:
|
||||
|
|
@ -192,8 +192,8 @@ iterator pairs*(a: string): tuple[key: int, val: char] {.inline.} =
|
|||
assert(len(a) == L, "the length of the string changed while iterating over it")
|
||||
|
||||
iterator mpairs*(a: var string): tuple[key: int, val: var char] {.inline.} =
|
||||
## Iterates over each item of `a`. Yields ``(index, a[index])`` pairs.
|
||||
## ``a[index]`` can be modified.
|
||||
## Iterates over each item of `a`. Yields `(index, a[index])` pairs.
|
||||
## `a[index]` can be modified.
|
||||
var i = 0
|
||||
let L = len(a)
|
||||
while i < L:
|
||||
|
|
@ -202,7 +202,7 @@ iterator mpairs*(a: var string): tuple[key: int, val: var char] {.inline.} =
|
|||
assert(len(a) == L, "the length of the string changed while iterating over it")
|
||||
|
||||
iterator pairs*(a: cstring): tuple[key: int, val: char] {.inline.} =
|
||||
## Iterates over each item of `a`. Yields ``(index, a[index])`` pairs.
|
||||
## Iterates over each item of `a`. Yields `(index, a[index])` pairs.
|
||||
when defined(js):
|
||||
var i = 0
|
||||
var L = len(a)
|
||||
|
|
@ -216,8 +216,8 @@ iterator pairs*(a: cstring): tuple[key: int, val: char] {.inline.} =
|
|||
inc(i)
|
||||
|
||||
iterator mpairs*(a: var cstring): tuple[key: int, val: var char] {.inline.} =
|
||||
## Iterates over each item of `a`. Yields ``(index, a[index])`` pairs.
|
||||
## ``a[index]`` can be modified.
|
||||
## Iterates over each item of `a`. Yields `(index, a[index])` pairs.
|
||||
## `a[index]` can be modified.
|
||||
when defined(js):
|
||||
var i = 0
|
||||
var L = len(a)
|
||||
|
|
@ -297,10 +297,10 @@ iterator fieldPairs*[T: tuple|object](x: T): tuple[key: string, val: RootObj] {.
|
|||
## Iterates over every field of `x` returning their name and value.
|
||||
##
|
||||
## When you iterate over objects with different field types you have to use
|
||||
## the compile time ``when`` instead of a runtime ``if`` to select the code
|
||||
## the compile time `when` instead of a runtime `if` to select the code
|
||||
## you want to run for each type. To perform the comparison use the `is
|
||||
## operator <manual.html#generics-is-operator>`_.
|
||||
## Another way to do the same without ``when`` is to leave the task of
|
||||
## Another way to do the same without `when` is to leave the task of
|
||||
## picking the appropriate code to a secondary proc which you overload for
|
||||
## each field type and pass the `value` to.
|
||||
##
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@
|
|||
|
||||
const
|
||||
buildOS* {.magic: "BuildOS".}: string = ""
|
||||
## The OS this build is running on. Can be different from ``system.hostOS``
|
||||
## The OS this build is running on. Can be different from `system.hostOS`
|
||||
## for cross compilations.
|
||||
|
||||
buildCPU* {.magic: "BuildCPU".}: string = ""
|
||||
## The CPU this build is running on. Can be different from ``system.hostCPU``
|
||||
## The CPU this build is running on. Can be different from `system.hostCPU`
|
||||
## for cross compilations.
|
||||
|
||||
template builtin = discard
|
||||
|
|
@ -57,7 +57,7 @@ proc warningImpl(arg, orig: string) = discard
|
|||
proc hintImpl(arg, orig: string) = discard
|
||||
|
||||
proc paramStr*(i: int): string =
|
||||
## Retrieves the ``i``'th command line parameter.
|
||||
## Retrieves the `i`'th command line parameter.
|
||||
builtin
|
||||
|
||||
proc paramCount*(): int =
|
||||
|
|
@ -66,7 +66,7 @@ proc paramCount*(): int =
|
|||
|
||||
proc switch*(key: string, val="") =
|
||||
## Sets a Nim compiler command line switch, for
|
||||
## example ``switch("checks", "on")``.
|
||||
## example `switch("checks", "on")`.
|
||||
builtin
|
||||
|
||||
proc warning*(name: string; val: bool) =
|
||||
|
|
@ -82,9 +82,9 @@ proc hint*(name: string; val: bool) =
|
|||
proc patchFile*(package, filename, replacement: string) =
|
||||
## Overrides the location of a given file belonging to the
|
||||
## passed package.
|
||||
## If the ``replacement`` is not an absolute path, the path
|
||||
## If the `replacement` is not an absolute path, the path
|
||||
## is interpreted to be local to the Nimscript file that contains
|
||||
## the call to ``patchFile``, Nim's ``--path`` is not used at all
|
||||
## the call to `patchFile`, Nim's `--path` is not used at all
|
||||
## to resolve the filename!
|
||||
##
|
||||
## Example:
|
||||
|
|
@ -112,19 +112,19 @@ proc cmpic*(a, b: string): int =
|
|||
cmpIgnoreCase(a, b)
|
||||
|
||||
proc getEnv*(key: string; default = ""): string {.tags: [ReadIOEffect].} =
|
||||
## Retrieves the environment variable of name ``key``.
|
||||
## Retrieves the environment variable of name `key`.
|
||||
builtin
|
||||
|
||||
proc existsEnv*(key: string): bool {.tags: [ReadIOEffect].} =
|
||||
## Checks for the existence of an environment variable named ``key``.
|
||||
## Checks for the existence of an environment variable named `key`.
|
||||
builtin
|
||||
|
||||
proc putEnv*(key, val: string) {.tags: [WriteIOEffect].} =
|
||||
## Sets the value of the environment variable named ``key`` to ``val``.
|
||||
## Sets the value of the environment variable named `key` to `val`.
|
||||
builtin
|
||||
|
||||
proc delEnv*(key: string) {.tags: [WriteIOEffect].} =
|
||||
## Deletes the environment variable named ``key``.
|
||||
## Deletes the environment variable named `key`.
|
||||
builtin
|
||||
|
||||
proc fileExists*(filename: string): bool {.tags: [ReadIOEffect].} =
|
||||
|
|
@ -265,7 +265,7 @@ proc exec*(command: string) {.
|
|||
## Executes an external process. If the external process terminates with
|
||||
## a non-zero exit code, an OSError exception is raised.
|
||||
##
|
||||
## **Note:** If you need a version of ``exec`` that returns the exit code
|
||||
## **Note:** If you need a version of `exec` that returns the exit code
|
||||
## and text output of the command, you can use `system.gorgeEx
|
||||
## <system.html#gorgeEx,string,string,string>`_.
|
||||
log "exec: " & command:
|
||||
|
|
@ -286,7 +286,7 @@ proc exec*(command: string, input: string, cache = "") {.
|
|||
proc selfExec*(command: string) {.
|
||||
raises: [OSError], tags: [ExecIOEffect].} =
|
||||
## Executes an external command with the current nim/nimble executable.
|
||||
## ``Command`` must not contain the "nim " part.
|
||||
## `Command` must not contain the "nim " part.
|
||||
let c = selfExe() & " " & command
|
||||
log "exec: " & c:
|
||||
if rawExec(c) != 0:
|
||||
|
|
@ -323,9 +323,9 @@ proc projectPath*(): string =
|
|||
builtin
|
||||
|
||||
proc thisDir*(): string =
|
||||
## Retrieves the directory of the current ``nims`` script file. Its path is
|
||||
## obtained via ``currentSourcePath`` (although, currently,
|
||||
## ``currentSourcePath`` resolves symlinks, unlike ``thisDir``).
|
||||
## Retrieves the directory of the current `nims` script file. Its path is
|
||||
## obtained via `currentSourcePath` (although, currently,
|
||||
## `currentSourcePath` resolves symlinks, unlike `thisDir`).
|
||||
builtin
|
||||
|
||||
proc cd*(dir: string) {.raises: [OSError].} =
|
||||
|
|
@ -369,7 +369,7 @@ proc writeTask(name, desc: string) =
|
|||
echo name, spaces, desc
|
||||
|
||||
proc cppDefine*(define: string) =
|
||||
## tell Nim that ``define`` is a C preprocessor ``#define`` and so always
|
||||
## tell Nim that `define` is a C preprocessor `#define` and so always
|
||||
## needs to be mangled.
|
||||
builtin
|
||||
|
||||
|
|
@ -404,8 +404,8 @@ when not defined(nimble):
|
|||
## task build, "default build is via the C backend":
|
||||
## setCommand "c"
|
||||
##
|
||||
## For a task named ``foo``, this template generates a ``proc`` named
|
||||
## ``fooTask``. This is useful if you need to call one task in
|
||||
## For a task named `foo`, this template generates a `proc` named
|
||||
## `fooTask`. This is useful if you need to call one task in
|
||||
## another in your Nimscript.
|
||||
##
|
||||
## Example:
|
||||
|
|
|
|||
|
|
@ -407,14 +407,14 @@ proc GC_runOrc* =
|
|||
collectCycles()
|
||||
|
||||
proc GC_enableOrc*() =
|
||||
## Enables the cycle collector subsystem of ``--gc:orc``. This is a ``--gc:orc``
|
||||
## specific API. Check with ``when defined(gcOrc)`` for its existence.
|
||||
## Enables the cycle collector subsystem of `--gc:orc`. This is a `--gc:orc`
|
||||
## specific API. Check with `when defined(gcOrc)` for its existence.
|
||||
when not defined(nimStressOrc):
|
||||
rootsThreshold = defaultThreshold
|
||||
|
||||
proc GC_disableOrc*() =
|
||||
## Disables the cycle collector subsystem of ``--gc:orc``. This is a ``--gc:orc``
|
||||
## specific API. Check with ``when defined(gcOrc)`` for its existence.
|
||||
## Disables the cycle collector subsystem of `--gc:orc`. This is a `--gc:orc`
|
||||
## specific API. Check with `when defined(gcOrc)` for its existence.
|
||||
when not defined(nimStressOrc):
|
||||
rootsThreshold = high(int)
|
||||
|
||||
|
|
@ -424,16 +424,16 @@ proc GC_partialCollect*(limit: int) =
|
|||
partialCollect(limit)
|
||||
|
||||
proc GC_fullCollect* =
|
||||
## Forces a full garbage collection pass. With ``--gc:orc`` triggers the cycle
|
||||
## collector. This is an alias for ``GC_runOrc``.
|
||||
## Forces a full garbage collection pass. With `--gc:orc` triggers the cycle
|
||||
## collector. This is an alias for `GC_runOrc`.
|
||||
collectCycles()
|
||||
|
||||
proc GC_enableMarkAndSweep*() =
|
||||
## For ``--gc:orc`` an alias for ``GC_enableOrc``.
|
||||
## For `--gc:orc` an alias for `GC_enableOrc`.
|
||||
GC_enableOrc()
|
||||
|
||||
proc GC_disableMarkAndSweep*() =
|
||||
## For ``--gc:orc`` an alias for ``GC_disableOrc``.
|
||||
## For `--gc:orc` an alias for `GC_disableOrc`.
|
||||
GC_disableOrc()
|
||||
|
||||
when optimizedOrc:
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ when defined(nimStackTraceOverride):
|
|||
## Procedure types for overriding the default stack trace.
|
||||
type
|
||||
cuintptr_t* {.importc: "uintptr_t", nodecl.} = uint
|
||||
## This is the same as the type ``uintptr_t`` in C.
|
||||
## This is the same as the type `uintptr_t` in C.
|
||||
|
||||
StackTraceOverrideGetTracebackProc* = proc (): string {.
|
||||
nimcall, gcsafe, locks: 0, raises: [], tags: [], noinline.}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
##
|
||||
## **Note**: This is part of the system module. Do not import it directly.
|
||||
## To activate thread support you need to compile
|
||||
## with the ``--threads:on`` command line switch.
|
||||
## with the `--threads:on` command line switch.
|
||||
##
|
||||
## Nim's memory model for threads is quite different from other common
|
||||
## programming languages (C, Pascal): Each thread has its own
|
||||
|
|
@ -97,7 +97,7 @@ proc onThreadDestruction*(handler: proc () {.closure, gcsafe, raises: [].}) =
|
|||
## Registers a *thread local* handler that is called at the thread's
|
||||
## destruction.
|
||||
##
|
||||
## A thread is destructed when the ``.thread`` proc returns
|
||||
## A thread is destructed when the `.thread` proc returns
|
||||
## normally or when it raises an exception. Note that unhandled exceptions
|
||||
## in a thread nevertheless cause the whole process to die.
|
||||
threadDestructionHandlers.add handler
|
||||
|
|
@ -261,7 +261,7 @@ when hostOS == "windows":
|
|||
## Creates a new thread `t` and starts its execution.
|
||||
##
|
||||
## Entry point is the proc `tp`.
|
||||
## `param` is passed to `tp`. `TArg` can be ``void`` if you
|
||||
## `param` is passed to `tp`. `TArg` can be `void` if you
|
||||
## don't need to pass any data to the thread.
|
||||
t.core = cast[PGcThread](allocShared0(sizeof(GcThread)))
|
||||
|
||||
|
|
@ -310,7 +310,7 @@ else:
|
|||
## Creates a new thread `t` and starts its execution.
|
||||
##
|
||||
## Entry point is the proc `tp`. `param` is passed to `tp`.
|
||||
## `TArg` can be ``void`` if you
|
||||
## `TArg` can be `void` if you
|
||||
## don't need to pass any data to the thread.
|
||||
t.core = cast[PGcThread](allocShared0(sizeof(GcThread)))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue