diff options
Diffstat (limited to 'lib/system')
-rw-r--r-- | lib/system/arc.nim | 6 | ||||
-rw-r--r-- | lib/system/arithmetics.nim | 4 | ||||
-rw-r--r-- | lib/system/basic_types.nim | 18 | ||||
-rw-r--r-- | lib/system/channels.nim | 12 | ||||
-rw-r--r-- | lib/system/comparisons.nim | 22 | ||||
-rw-r--r-- | lib/system/dollars.nim | 20 | ||||
-rw-r--r-- | lib/system/exceptions.nim | 12 | ||||
-rw-r--r-- | lib/system/excpt.nim | 8 | ||||
-rw-r--r-- | lib/system/gc_common.nim | 12 | ||||
-rw-r--r-- | lib/system/io.nim | 36 |
10 files changed, 75 insertions, 75 deletions
diff --git a/lib/system/arc.nim b/lib/system/arc.nim index 7f533089c..ed5e9f5ca 100644 --- a/lib/system/arc.nim +++ b/lib/system/arc.nim @@ -218,15 +218,15 @@ proc GC_ref*[T](x: ref T) = when not defined(gcOrc): template GC_fullCollect* = - ## Forces a full garbage collection pass. With ``--gc:arc`` a nop. + ## Forces a full garbage collection pass. With `--gc:arc` a nop. discard template setupForeignThreadGc* = - ## With ``--gc:arc`` a nop. + ## With `--gc:arc` a nop. discard template tearDownForeignThreadGc* = - ## With ``--gc:arc`` a nop. + ## With `--gc:arc` a nop. discard proc isObj(obj: PNimTypeV2, subclass: cstring): bool {.compilerRtl, inl.} = diff --git a/lib/system/arithmetics.nim b/lib/system/arithmetics.nim index d33401d1a..0dd329495 100644 --- a/lib/system/arithmetics.nim +++ b/lib/system/arithmetics.nim @@ -385,7 +385,7 @@ proc `*`*(x, y: uint64): uint64 {.magic: "MulU", noSideEffect.} proc `div`*(x, y: uint): uint {.magic: "DivU", noSideEffect.} ## Computes the integer division for unsigned integers. - ## This is roughly the same as ``trunc(x/y)``. + ## This is roughly the same as `trunc(x/y)`. proc `div`*(x, y: uint8): uint8 {.magic: "DivU", noSideEffect.} proc `div`*(x, y: uint16): uint16 {.magic: "DivU", noSideEffect.} proc `div`*(x, y: uint32): uint32 {.magic: "DivU", noSideEffect.} @@ -393,7 +393,7 @@ proc `div`*(x, y: uint64): uint64 {.magic: "DivU", noSideEffect.} proc `mod`*(x, y: uint): uint {.magic: "ModU", noSideEffect.} ## Computes the integer modulo operation (remainder) for unsigned integers. - ## This is the same as ``x - (x div y) * y``. + ## This is the same as `x - (x div y) * y`. proc `mod`*(x, y: uint8): uint8 {.magic: "ModU", noSideEffect.} proc `mod`*(x, y: uint16): uint16 {.magic: "ModU", noSideEffect.} proc `mod`*(x, y: uint32): uint32 {.magic: "ModU", noSideEffect.} diff --git a/lib/system/basic_types.nim b/lib/system/basic_types.nim index 9db81d1c4..7779e1ce9 100644 --- a/lib/system/basic_types.nim +++ b/lib/system/basic_types.nim @@ -16,8 +16,8 @@ type # we need to start a new type section here, so that ``0`` can have a type false = 0, true = 1 const - on* = true ## Alias for ``true``. - off* = false ## Alias for ``false``. + on* = true ## Alias for `true`. + off* = false ## Alias for `false`. type SomeSignedInt* = int|int8|int16|int32|int64 @@ -35,7 +35,7 @@ type BiggestInt* = int64 ## is an alias for the biggest signed integer type the Nim compiler - ## supports. Currently this is ``int64``, but it is platform-dependent + ## supports. Currently this is `int64`, but it is platform-dependent ## in general. @@ -43,20 +43,20 @@ type {.push hints: off.} proc `not`*(x: bool): bool {.magic: "Not", noSideEffect.} - ## Boolean not; returns true if ``x == false``. + ## Boolean not; returns true if `x == false`. proc `and`*(x, y: bool): bool {.magic: "And", noSideEffect.} - ## Boolean ``and``; returns true if ``x == y == true`` (if both arguments + ## Boolean `and`; returns true if `x == y == true` (if both arguments ## are true). ## - ## Evaluation is lazy: if ``x`` is false, ``y`` will not even be evaluated. + ## Evaluation is lazy: if `x` is false, `y` will not even be evaluated. proc `or`*(x, y: bool): bool {.magic: "Or", noSideEffect.} - ## Boolean ``or``; returns true if ``not (not x and not y)`` (if any of + ## Boolean `or`; returns true if `not (not x and not y)` (if any of ## the arguments is true). ## - ## Evaluation is lazy: if ``x`` is true, ``y`` will not even be evaluated. + ## Evaluation is lazy: if `x` is true, `y` will not even be evaluated. proc `xor`*(x, y: bool): bool {.magic: "Xor", noSideEffect.} - ## Boolean `exclusive or`; returns true if ``x != y`` (if either argument + ## Boolean `exclusive or`; returns true if `x != y` (if either argument ## is true while the other is false). {.pop.} diff --git a/lib/system/channels.nim b/lib/system/channels.nim index bb611a140..c7a445766 100644 --- a/lib/system/channels.nim +++ b/lib/system/channels.nim @@ -10,10 +10,10 @@ ## Channel support for threads. ## ## **Note**: This is part of the system module. Do not import it directly. -## To activate thread support compile with the ``--threads:on`` command line switch. +## To activate thread support compile with the `--threads:on` command line switch. ## -## **Note:** Channels are designed for the ``Thread`` type. They are unstable when -## used with ``spawn`` +## **Note:** Channels are designed for the `Thread` type. They are unstable when +## used with `spawn` ## ## **Note:** The current implementation of message passing does ## not work with cyclic data structures. @@ -109,7 +109,7 @@ ## in which case they will use a process-wide (thread-safe) shared heap. ## ## However, it is possible to manually allocate shared memory for channels -## using e.g. ``system.allocShared0`` and pass these pointers through thread +## using e.g. `system.allocShared0` and pass these pointers through thread ## arguments: ## ## .. code-block :: Nim @@ -410,8 +410,8 @@ proc tryRecv*[TMsg](c: var Channel[TMsg]): tuple[dataAvailable: bool, ## Tries to receive a message from the channel `c`, but this can fail ## for all sort of reasons, including contention. ## - ## If it fails, it returns ``(false, default(msg))`` otherwise it - ## returns ``(true, msg)``. + ## If it fails, it returns `(false, default(msg))` otherwise it + ## returns `(true, msg)`. var q = cast[PRawChannel](addr(c)) if q.mask != ChannelDeadMask: if tryAcquireSys(q.lock): diff --git a/lib/system/comparisons.nim b/lib/system/comparisons.nim index 9d70f84cc..6c67ca493 100644 --- a/lib/system/comparisons.nim +++ b/lib/system/comparisons.nim @@ -126,15 +126,15 @@ proc `<`*[T](x, y: ptr T): bool {.magic: "LtPtr", noSideEffect.} proc `<`*(x, y: pointer): bool {.magic: "LtPtr", noSideEffect.} template `!=`*(x, y: untyped): untyped = - ## Unequals operator. This is a shorthand for ``not (x == y)``. + ## Unequals operator. This is a shorthand for `not (x == y)`. not (x == y) template `>=`*(x, y: untyped): untyped = - ## "is greater or equals" operator. This is the same as ``y <= x``. + ## "is greater or equals" operator. This is the same as `y <= x`. y <= x template `>`*(x, y: untyped): untyped = - ## "is greater" operator. This is the same as ``y < x``. + ## "is greater" operator. This is the same as `y < x`. y < x @@ -160,14 +160,14 @@ proc `<`*(x, y: int32): bool {.magic: "LtI", noSideEffect.} proc `<`*(x, y: int64): bool {.magic: "LtI", noSideEffect.} proc `<=`*(x, y: uint): bool {.magic: "LeU", noSideEffect.} - ## Returns true if ``x <= y``. + ## Returns true if `x <= y`. proc `<=`*(x, y: uint8): bool {.magic: "LeU", noSideEffect.} proc `<=`*(x, y: uint16): bool {.magic: "LeU", noSideEffect.} proc `<=`*(x, y: uint32): bool {.magic: "LeU", noSideEffect.} proc `<=`*(x, y: uint64): bool {.magic: "LeU", noSideEffect.} proc `<`*(x, y: uint): bool {.magic: "LtU", noSideEffect.} - ## Returns true if ``x < y``. + ## Returns true if `x < y`. proc `<`*(x, y: uint8): bool {.magic: "LtU", noSideEffect.} proc `<`*(x, y: uint16): bool {.magic: "LtU", noSideEffect.} proc `<`*(x, y: uint32): bool {.magic: "LtU", noSideEffect.} @@ -175,7 +175,7 @@ proc `<`*(x, y: uint64): bool {.magic: "LtU", noSideEffect.} proc `<=%`*(x, y: int): bool {.inline.} = ## Treats `x` and `y` as unsigned and compares them. - ## Returns true if ``unsigned(x) <= unsigned(y)``. + ## Returns true if `unsigned(x) <= unsigned(y)`. cast[uint](x) <= cast[uint](y) proc `<=%`*(x, y: int8): bool {.inline.} = cast[uint8](x) <= cast[uint8](y) proc `<=%`*(x, y: int16): bool {.inline.} = cast[uint16](x) <= cast[uint16](y) @@ -184,7 +184,7 @@ proc `<=%`*(x, y: int64): bool {.inline.} = cast[uint64](x) <= cast[uint64](y) proc `<%`*(x, y: int): bool {.inline.} = ## Treats `x` and `y` as unsigned and compares them. - ## Returns true if ``unsigned(x) < unsigned(y)``. + ## Returns true if `unsigned(x) < unsigned(y)`. cast[uint](x) < cast[uint](y) proc `<%`*(x, y: int8): bool {.inline.} = cast[uint8](x) < cast[uint8](y) proc `<%`*(x, y: int16): bool {.inline.} = cast[uint16](x) < cast[uint16](y) @@ -193,11 +193,11 @@ proc `<%`*(x, y: int64): bool {.inline.} = cast[uint64](x) < cast[uint64](y) template `>=%`*(x, y: untyped): untyped = y <=% x ## Treats `x` and `y` as unsigned and compares them. - ## Returns true if ``unsigned(x) >= unsigned(y)``. + ## Returns true if `unsigned(x) >= unsigned(y)`. template `>%`*(x, y: untyped): untyped = y <% x ## Treats `x` and `y` as unsigned and compares them. - ## Returns true if ``unsigned(x) > unsigned(y)``. + ## Returns true if `unsigned(x) > unsigned(y)`. proc `==`*(x, y: uint): bool {.magic: "EqI", noSideEffect.} ## Compares two unsigned integers for equality. @@ -235,13 +235,13 @@ proc max*(x, y: int64): int64 {.magic: "MaxI", noSideEffect.} = proc min*[T](x: openArray[T]): T = - ## The minimum value of `x`. ``T`` needs to have a ``<`` operator. + ## The minimum value of `x`. `T` needs to have a `<` operator. result = x[0] for i in 1..high(x): if x[i] < result: result = x[i] proc max*[T](x: openArray[T]): T = - ## The maximum value of `x`. ``T`` needs to have a ``<`` operator. + ## The maximum value of `x`. `T` needs to have a `<` operator. result = x[0] for i in 1..high(x): if result < x[i]: result = x[i] diff --git a/lib/system/dollars.nim b/lib/system/dollars.nim index 238c59837..ce4e8e0ca 100644 --- a/lib/system/dollars.nim +++ b/lib/system/dollars.nim @@ -1,6 +1,6 @@ proc `$`*(x: int): string {.magic: "IntToStr", noSideEffect.} ## The stringify operator for an integer argument. Returns `x` - ## converted to a decimal string. ``$`` is Nim's general way of + ## converted to a decimal string. `$` is Nim's general way of ## spelling `toString`:idx:. template dollarImpl(x: uint | uint64, result: var string) = @@ -76,19 +76,19 @@ proc `$`*(x: cstring): string {.magic: "CStrToStr", noSideEffect.} proc `$`*(x: string): string {.magic: "StrToStr", noSideEffect.} ## The stringify operator for a string argument. Returns `x` ## as it is. This operator is useful for generic code, so - ## that ``$expr`` also works if ``expr`` is already a string. + ## that `$expr` also works if `expr` is already a string. proc `$`*[Enum: enum](x: Enum): string {.magic: "EnumToStr", noSideEffect.} ## The stringify operator for an enumeration argument. This works for ## any enumeration type thanks to compiler magic. ## - ## If a ``$`` operator for a concrete enumeration is provided, this is + ## If a `$` operator for a concrete enumeration is provided, this is ## used instead. (In other words: *Overwriting* is possible.) proc `$`*(t: typedesc): string {.magic: "TypeTrait".} ## Returns the name of the given type. ## - ## For more procedures dealing with ``typedesc``, see + ## For more procedures dealing with `typedesc`, see ## `typetraits module <typetraits.html>`_. ## ## .. code-block:: Nim @@ -114,7 +114,7 @@ else: proc `$`*[T: tuple|object](x: T): string = - ## Generic ``$`` operator for tuples that is lifted from the components + ## Generic `$` operator for tuples that is lifted from the components ## of `x`. Example: ## ## .. code-block:: Nim @@ -164,7 +164,7 @@ proc collectionToString[T](x: T, prefix, separator, suffix: string): string = result.add(suffix) proc `$`*[T](x: set[T]): string = - ## Generic ``$`` operator for sets that is lifted from the components + ## Generic `$` operator for sets that is lifted from the components ## of `x`. Example: ## ## .. code-block:: Nim @@ -172,7 +172,7 @@ proc `$`*[T](x: set[T]): string = collectionToString(x, "{", ", ", "}") proc `$`*[T](x: seq[T]): string = - ## Generic ``$`` operator for seqs that is lifted from the components + ## Generic `$` operator for seqs that is lifted from the components ## of `x`. Example: ## ## .. code-block:: Nim @@ -180,7 +180,7 @@ proc `$`*[T](x: seq[T]): string = collectionToString(x, "@[", ", ", "]") proc `$`*[T, U](x: HSlice[T, U]): string = - ## Generic ``$`` operator for slices that is lifted from the components + ## Generic `$` operator for slices that is lifted from the components ## of `x`. Example: ## ## .. code-block:: Nim @@ -192,11 +192,11 @@ proc `$`*[T, U](x: HSlice[T, U]): string = when not defined(nimNoArrayToString): proc `$`*[T, IDX](x: array[IDX, T]): string = - ## Generic ``$`` operator for arrays that is lifted from the components. + ## Generic `$` operator for arrays that is lifted from the components. collectionToString(x, "[", ", ", "]") proc `$`*[T](x: openArray[T]): string = - ## Generic ``$`` operator for openarrays that is lifted from the components + ## Generic `$` operator for openarrays that is lifted from the components ## of `x`. Example: ## ## .. code-block:: Nim diff --git a/lib/system/exceptions.nim b/lib/system/exceptions.nim index fc8bd89f7..b5f4fc325 100644 --- a/lib/system/exceptions.nim +++ b/lib/system/exceptions.nim @@ -39,7 +39,7 @@ type parent*: ref Exception ## Parent exception (can be used as a stack). name*: cstring ## The exception's name is its Nim identifier. ## This field is filled automatically in the - ## ``raise`` statement. + ## `raise` statement. msg* {.exportc: "message".}: string ## The exception's message. Not ## providing an exception message ## is bad style. @@ -52,7 +52,7 @@ type Defect* = object of Exception ## \ ## Abstract base class for all exceptions that Nim's runtime raises ## but that are strictly uncatchable as they can also be mapped to - ## a ``quit`` / ``trap`` / ``exit`` operation. + ## a `quit` / `trap` / `exit` operation. CatchableError* = object of Exception ## \ ## Abstract class for all exceptions that are catchable. @@ -110,13 +110,13 @@ type ## Raised if an object gets assigned to its parent's object. ObjectConversionDefect* = object of Defect ## \ ## Raised if an object is converted to an incompatible object type. - ## You can use ``of`` operator to check if conversion will succeed. + ## You can use `of` operator to check if conversion will succeed. FloatingPointDefect* = object of Defect ## \ ## Base class for floating point exceptions. FloatInvalidOpDefect* = object of FloatingPointDefect ## \ ## Raised by invalid operations according to IEEE. ## - ## Raised by ``0.0/0.0``, for example. + ## Raised by `0.0/0.0`, for example. FloatDivByZeroDefect* = object of FloatingPointDefect ## \ ## Raised by division by zero. ## @@ -134,13 +134,13 @@ type ## Raised for inexact results. ## ## The operation produced a result that cannot be represented with infinite - ## precision -- for example: ``2.0 / 3.0, log(1.1)`` + ## precision -- for example: `2.0 / 3.0, log(1.1)` ## ## **Note**: Nim currently does not detect these! DeadThreadDefect* = object of Defect ## \ ## Raised if it is attempted to send a message to a dead thread. NilAccessDefect* = object of Defect ## \ - ## Raised on dereferences of ``nil`` pointers. + ## Raised on dereferences of `nil` pointers. ## ## This is only raised if the `segfaults module <segfaults.html>`_ was imported! diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim index 19bf8911d..c3f8255b1 100644 --- a/lib/system/excpt.nim +++ b/lib/system/excpt.nim @@ -351,7 +351,7 @@ var onUnhandledException*: (proc (errorMsg: string) {. nimcall, gcsafe.}) ## Set this error \ ## handler to override the existing behaviour on an unhandled exception. ## - ## The default is to write a stacktrace to ``stderr`` and then call ``quit(1)``. + ## The default is to write a stacktrace to `stderr` and then call `quit(1)`. ## Unstable API. proc reportUnhandledErrorAux(e: ref Exception) {.nodestroy.} = @@ -424,7 +424,7 @@ when gotoBasedExceptions: result = addr(nimInErrorMode) proc nimTestErrorFlag() {.compilerRtl.} = - ## This proc must be called before ``currException`` is destroyed. + ## This proc must be called before `currException` is destroyed. ## It also must be called at the end of every thread to ensure no ## error is swallowed. if nimInErrorMode and currException != nil: @@ -527,8 +527,8 @@ proc getStackTrace(e: ref Exception): string = result = "" proc getStackTraceEntries*(e: ref Exception): seq[StackTraceEntry] = - ## Returns the attached stack trace to the exception ``e`` as - ## a ``seq``. This is not yet available for the JS backend. + ## Returns the attached stack trace to the exception `e` as + ## a `seq`. This is not yet available for the JS backend. when not defined(nimSeqsV2): shallowCopy(result, e.trace) else: diff --git a/lib/system/gc_common.nim b/lib/system/gc_common.nim index 658c5d025..7596de6fb 100644 --- a/lib/system/gc_common.nim +++ b/lib/system/gc_common.nim @@ -166,16 +166,16 @@ when defined(nimdoc): ## this thread will only be initialized once per thread, no matter how often ## it is called. ## - ## This function is available only when ``--threads:on`` and ``--tlsEmulation:off`` + ## This function is available only when `--threads:on` and `--tlsEmulation:off` ## switches are used discard proc tearDownForeignThreadGc*() {.gcsafe.} = - ## Call this to tear down the GC, previously initialized by ``setupForeignThreadGc``. + ## Call this to tear down the GC, previously initialized by `setupForeignThreadGc`. ## If GC has not been previously initialized, or has already been torn down, the ## call does nothing. ## - ## This function is available only when ``--threads:on`` and ``--tlsEmulation:off`` + ## This function is available only when `--threads:on` and `--tlsEmulation:off` ## switches are used discard elif declared(threadType): @@ -432,10 +432,10 @@ proc prepareDealloc(cell: PCell) = decTypeSize(cell, t) proc deallocHeap*(runFinalizers = true; allowGcAfterwards = true) = - ## Frees the thread local heap. Runs every finalizer if ``runFinalizers`` - ## is true. If ``allowGcAfterwards`` is true, a minimal amount of allocation + ## Frees the thread local heap. Runs every finalizer if `runFinalizers` + ## is true. If `allowGcAfterwards` is true, a minimal amount of allocation ## happens to ensure the GC can continue to work after the call - ## to ``deallocHeap``. + ## to `deallocHeap`. template deallocCell(x) = if isCell(x): # cast to PCell is correct here: diff --git a/lib/system/io.nim b/lib/system/io.nim index 5ac9f813e..9ecf817bc 100644 --- a/lib/system/io.nim +++ b/lib/system/io.nim @@ -7,7 +7,7 @@ # distribution, for details about the copyright. # -## This is a part of ``system.nim``, you should not manually import it. +## This is a part of `system.nim`, you should not manually import it. include inclrtl @@ -169,7 +169,7 @@ proc readBuffer*(f: File, buffer: pointer, len: Natural): int {. proc readBytes*(f: File, a: var openArray[int8|uint8], start, len: Natural): int {. tags: [ReadIOEffect], benign.} = - ## reads `len` bytes into the buffer `a` starting at ``a[start]``. Returns + ## reads `len` bytes into the buffer `a` starting at `a[start]`. Returns ## the actual number of bytes that have been read which may be less than ## `len` (if not as many bytes are remaining), but not greater. result = readBuffer(f, addr(a[start]), len) @@ -183,7 +183,7 @@ proc readChars*(f: File, a: var openArray[char]): int {.tags: [ReadIOEffect], be proc readChars*(f: File, a: var openArray[char], start, len: Natural): int {. tags: [ReadIOEffect], benign, deprecated: "use other `readChars` overload, possibly via: readChars(toOpenArray(buf, start, len-1))".} = - ## reads `len` bytes into the buffer `a` starting at ``a[start]``. Returns + ## reads `len` bytes into the buffer `a` starting at `a[start]`. Returns ## the actual number of bytes that have been read which may be less than ## `len` (if not as many bytes are remaining), but not greater. if (start + len) > len(a): @@ -205,7 +205,7 @@ proc writeBuffer*(f: File, buffer: pointer, len: Natural): int {. proc writeBytes*(f: File, a: openArray[int8|uint8], start, len: Natural): int {. tags: [WriteIOEffect], benign.} = - ## writes the bytes of ``a[start..start+len-1]`` to the file `f`. Returns + ## writes the bytes of `a[start..start+len-1]` to the file `f`. Returns ## the number of actual written bytes, which may be less than `len` in case ## of an error. var x = cast[ptr UncheckedArray[int8]](a) @@ -213,7 +213,7 @@ proc writeBytes*(f: File, a: openArray[int8|uint8], start, len: Natural): int {. proc writeChars*(f: File, a: openArray[char], start, len: Natural): int {. tags: [WriteIOEffect], benign.} = - ## writes the bytes of ``a[start..start+len-1]`` to the file `f`. Returns + ## writes the bytes of `a[start..start+len-1]` to the file `f`. Returns ## the number of actual written bytes, which may be less than `len` in case ## of an error. var x = cast[ptr UncheckedArray[int8]](a) @@ -325,7 +325,7 @@ proc flushFile*(f: File) {.tags: [WriteIOEffect].} = discard c_fflush(f) proc getFileHandle*(f: File): FileHandle = - ## returns the file handle of the file ``f``. This is only useful for + ## returns the file handle of the file `f`. This is only useful for ## platform specific programming. ## Note that on Windows this doesn't return the Windows-specific handle, ## but the C library's notion of a handle, whatever that means. @@ -333,7 +333,7 @@ proc getFileHandle*(f: File): FileHandle = c_fileno(f) proc getOsFileHandle*(f: File): FileHandle = - ## returns the OS file handle of the file ``f``. This is only useful for + ## returns the OS file handle of the file `f`. This is only useful for ## platform specific programming. when defined(windows): result = FileHandle getOsfhandle(cint getFileHandle(f)) @@ -343,7 +343,7 @@ proc getOsFileHandle*(f: File): FileHandle = when defined(nimdoc) or (defined(posix) and not defined(nimscript)) or defined(windows): proc setInheritable*(f: FileHandle, inheritable: bool): bool = ## control whether a file handle can be inherited by child processes. Returns - ## ``true`` on success. This requires the OS file handle, which can be + ## `true` on success. This requires the OS file handle, which can be ## retrieved via `getOsFileHandle <#getOsFileHandle,File>`_. ## ## This procedure is not guaranteed to be available for all platforms. Test for @@ -366,10 +366,10 @@ proc readLine*(f: File, line: var string): bool {.tags: [ReadIOEffect], benign.} = ## reads a line of text from the file `f` into `line`. May throw an IO ## exception. - ## A line of text may be delimited by ``LF`` or ``CRLF``. The newline - ## character(s) are not part of the returned string. Returns ``false`` - ## if the end of the file has been reached, ``true`` otherwise. If - ## ``false`` is returned `line` contains no new data. + ## A line of text may be delimited by `LF` or `CRLF`. The newline + ## character(s) are not part of the returned string. Returns `false` + ## if the end of the file has been reached, `true` otherwise. If + ## `false` is returned `line` contains no new data. proc c_memchr(s: pointer, c: cint, n: csize_t): pointer {. importc: "memchr", header: "<string.h>".} @@ -485,7 +485,7 @@ proc readLine*(f: File, line: var string): bool {.tags: [ReadIOEffect], proc readLine*(f: File): string {.tags: [ReadIOEffect], benign.} = ## reads a line of text from the file `f`. May throw an IO exception. - ## A line of text may be delimited by ``LF`` or ``CRLF``. The newline + ## A line of text may be delimited by `LF` or `CRLF`. The newline ## character(s) are not part of the returned string. result = newStringOfCap(80) if not readLine(f, result): raiseEOF() @@ -680,7 +680,7 @@ proc open*(f: var File, filename: string, ## Default mode is readonly. Returns true if the file could be opened. ## This throws no exception if the file could not be opened. ## - ## The file handle associated with the resulting ``File`` is not inheritable. + ## The file handle associated with the resulting `File` is not inheritable. var p = fopen(filename, FormatOpen[mode]) if p != nil: var f2 = cast[File](p) @@ -724,7 +724,7 @@ proc reopen*(f: File, filename: string, mode: FileMode = fmRead): bool {. proc open*(f: var File, filehandle: FileHandle, mode: FileMode = fmRead): bool {.tags: [], raises: [], benign.} = - ## Creates a ``File`` from a `filehandle` with given `mode`. + ## Creates a `File` from a `filehandle` with given `mode`. ## ## Default mode is readonly. Returns true if the file could be opened. ## @@ -740,10 +740,10 @@ proc open*(filename: string, mode: FileMode = fmRead, bufSize: int = -1): File = ## Opens a file named `filename` with given `mode`. ## - ## Default mode is readonly. Raises an ``IOError`` if the file + ## Default mode is readonly. Raises an `IOError` if the file ## could not be opened. ## - ## The file handle associated with the resulting ``File`` is not inheritable. + ## The file handle associated with the resulting `File` is not inheritable. if not open(result, filename, mode, bufSize): sysFatal(IOError, "cannot open: " & filename) @@ -889,7 +889,7 @@ proc writeFile*(filename: string, content: openArray[byte]) {.since: (1, 1).} = proc readLines*(filename: string, n: Natural): seq[string] = ## read `n` lines from the file named `filename`. Raises an IO exception ## in case of an error. Raises EOF if file does not contain at least `n` lines. - ## Available at compile time. A line of text may be delimited by ``LF`` or ``CRLF``. + ## Available at compile time. A line of text may be delimited by `LF` or `CRLF`. ## The newline character(s) are not part of the returned strings. var f: File = nil if open(f, filename): |