tiny cleanup (#17957)

* tiny cleanup

* I'm not British
This commit is contained in:
Andreas Rumpf 2021-05-07 13:56:37 +02:00 • committed by GitHub
commit 56068101f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 13 deletions

View file

@ -573,10 +573,8 @@ proc isDefined*(conf: ConfigRef; symbol: string): bool =
of "sunos": result = conf.target.targetOS == osSolaris of "sunos": result = conf.target.targetOS == osSolaris
of "nintendoswitch": of "nintendoswitch":
result = conf.target.targetOS == osNintendoSwitch result = conf.target.targetOS == osNintendoSwitch
of "freertos": of "freertos", "lwip":
result = conf.target.targetOS == osFreeRTOS result = conf.target.targetOS == osFreeRTOS
of "lwip":
result = conf.target.targetOS in {osFreeRTOS}
of "littleendian": result = CPU[conf.target.targetCPU].endian == platform.littleEndian of "littleendian": result = CPU[conf.target.targetCPU].endian == platform.littleEndian
of "bigendian": result = CPU[conf.target.targetCPU].endian == platform.bigEndian of "bigendian": result = CPU[conf.target.targetCPU].endian == platform.bigEndian
of "cpu8": result = CPU[conf.target.targetCPU].bit == 8 of "cpu8": result = CPU[conf.target.targetCPU].bit == 8

View file

@ -459,7 +459,7 @@ Character literals are enclosed in single quotes `''` and can contain the
same escape sequences as strings - with one exception: the platform same escape sequences as strings - with one exception: the platform
dependent `newline`:idx: (``\p``) dependent `newline`:idx: (``\p``)
is not allowed as it may be wider than one character (it can be the pair is not allowed as it may be wider than one character (it can be the pair
CR/LF). Here are the valid `escape sequences`:idx: for character CR/LF). Here are the valid `escape sequences`:idx: for character
literals: literals:
================== =================================================== ================== ===================================================
@ -1843,7 +1843,7 @@ untraced references are *unsafe*. However, for certain low-level operations
(accessing the hardware) untraced references are unavoidable. (accessing the hardware) untraced references are unavoidable.
Traced references are declared with the **ref** keyword, untraced references Traced references are declared with the **ref** keyword, untraced references
are declared with the **ptr** keyword. In general, a `ptr T` is implicitly are declared with the **ptr** keyword. In general, a `ptr T` is implicitly
convertible to the `pointer` type. convertible to the `pointer` type.
An empty subscript `[]` notation can be used to de-refer a reference, An empty subscript `[]` notation can be used to de-refer a reference,
@ -2255,7 +2255,7 @@ conversions from `string` to `SQL` are allowed:
db.query("SELECT FROM users WHERE name = '$1'".SQL % [username]) db.query("SELECT FROM users WHERE name = '$1'".SQL % [username])
Now we have compile-time checking against SQL injection attacks. Since Now we have compile-time checking against SQL injection attacks. Since
`"".SQL` is transformed to `SQL("")` no new syntax is needed for nice `"".SQL` is transformed to `SQL("")` no new syntax is needed for nice
looking `SQL` string literals. The hypothetical `SQL` type actually looking `SQL` string literals. The hypothetical `SQL` type actually
exists in the library as the `SqlQuery type <db_common.html#SqlQuery>`_ of exists in the library as the `SqlQuery type <db_common.html#SqlQuery>`_ of
@ -4252,7 +4252,7 @@ Closure iterators and inline iterators have some restrictions:
5. Closure iterators are not supported by the JS backend. 5. Closure iterators are not supported by the JS backend.
(*) Closure iterators can be co-recursive with a factory proc which results (*) Closure iterators can be co-recursive with a factory proc which results
in similar syntax to a recursive iterator. More details follow. in similar syntax to a recursive iterator. More details follow.
Iterators that are neither marked `{.closure.}` nor `{.inline.}` explicitly Iterators that are neither marked `{.closure.}` nor `{.inline.}` explicitly
default to being inline, but this may change in future versions of the default to being inline, but this may change in future versions of the
@ -4366,12 +4366,12 @@ The call can be made more like an inline iterator with a for loop macro:
echo f echo f
Because of full backend function call aparatus involvment, closure iterator Because of full backend function call aparatus involvment, closure iterator
invocation is typically higher cost than inline iterators. Adornment by invocation is typically higher cost than inline iterators. Adornment by
a macro wrapper at the call site like this is a possibly useful reminder. a macro wrapper at the call site like this is a possibly useful reminder.
The factory `proc`, as an ordinary procedure, can be recursive. The The factory `proc`, as an ordinary procedure, can be recursive. The
above macro allows such recursion to look much like a recursive iterator above macro allows such recursion to look much like a recursive iterator
would. For example: would. For example:
.. code-block:: nim .. code-block:: nim
proc recCountDown(n: int): iterator(): int = proc recCountDown(n: int): iterator(): int =
@ -7094,7 +7094,7 @@ Similar to the `importc pragma for C
<#foreign-function-interface-importc-pragma>`_, the <#foreign-function-interface-importc-pragma>`_, the
`importcpp` pragma can be used to import `C++`:idx: methods or C++ symbols `importcpp` pragma can be used to import `C++`:idx: methods or C++ symbols
in general. The generated code then uses the C++ method calling in general. The generated code then uses the C++ method calling
syntax: `obj->method(arg)`:cpp:. In combination with the `header` and `emit` syntax: `obj->method(arg)`:cpp:. In combination with the `header` and `emit`
pragmas this allows *sloppy* interfacing with libraries written in C++: pragmas this allows *sloppy* interfacing with libraries written in C++:
.. code-block:: Nim .. code-block:: Nim
@ -7327,7 +7327,7 @@ ImportObjC pragma
----------------- -----------------
Similar to the `importc pragma for C Similar to the `importc pragma for C
<#foreign-function-interface-importc-pragma>`_, the `importobjc` pragma can <#foreign-function-interface-importc-pragma>`_, the `importobjc` pragma can
be used to import `Objective C`:idx: methods. The generated code then uses the be used to import `Objective C`:idx: methods. The generated code then uses the
Objective C method calling syntax: ``[obj method param1: arg]``. Objective C method calling syntax: ``[obj method param1: arg]``.
In addition with the `header` and `emit` pragmas this In addition with the `header` and `emit` pragmas this
allows *sloppy* interfacing with libraries written in Objective C: allows *sloppy* interfacing with libraries written in Objective C:
@ -7656,7 +7656,7 @@ Exportc pragma
-------------- --------------
The `exportc` pragma provides a means to export a type, a variable, or a The `exportc` pragma provides a means to export a type, a variable, or a
procedure to C. Enums and constants can't be exported. The optional argument procedure to C. Enums and constants can't be exported. The optional argument
is a string containing the C identifier. If the argument is missing, the C is a string containing the C identifier. If the argument is missing, the C
name is the Nim identifier *exactly as spelled*: name is the Nim identifier *exactly as spelled*:
.. code-block:: Nim .. code-block:: Nim