diff options
author | Grzegorz Adam Hankiewicz <gradha@imap.cc> | 2014-11-03 15:50:05 +0100 |
---|---|---|
committer | Grzegorz Adam Hankiewicz <gradha@imap.cc> | 2014-11-03 15:50:05 +0100 |
commit | a7aa2de166072343041183543da08f372633520e (patch) | |
tree | f6bb2687b2f6040c3a20bc267f597f32e2db7494 /lib/system.nim | |
parent | 8853023fd8c0ecd241b22a674db62723f4bf0305 (diff) | |
parent | 2df195c8e27aff3bf77b86e4b8234a20afd58ce8 (diff) | |
download | Nim-a7aa2de166072343041183543da08f372633520e.tar.gz |
Merge branch 'pr_adds_code_directive_to_rst' into pr_bigbreak_adds_code_directive_to_rst
Conflicts: doc/tut2.txt lib/packages/docutils/rstgen.nim lib/system.nim
Diffstat (limited to 'lib/system.nim')
-rw-r--r-- | lib/system.nim | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/lib/system.nim b/lib/system.nim index a9b4da77a..7b78d1cf1 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -1102,11 +1102,11 @@ else: const QuitSuccess* = 0 - ## is the value that should be passed to ``quit`` to indicate + ## is the value that should be passed to `quit <#quit>`_ to indicate ## success. QuitFailure* = 1 - ## is the value that should be passed to ``quit`` to indicate + ## is the value that should be passed to `quit <#quit>`_ to indicate ## failure. var programResult* {.exportc: "nim_program_result".}: int @@ -1119,10 +1119,11 @@ proc quit*(errorcode: int = QuitSuccess) {. ## Stops the program immediately with an exit code. ## ## Before stopping the program the "quit procedures" are called in the - ## opposite order they were added with ``addQuitProc``. ``quit`` never - ## returns and ignores any exception that may have been raised by the quit - ## procedures. It does *not* call the garbage collector to free all the - ## memory, unless a quit procedure calls ``GC_collect``. + ## opposite order they were added with `addQuitProc <#addQuitProc>`_. + ## ``quit`` never returns and ignores any exception that may have been raised + ## by the quit procedures. It does *not* call the garbage collector to free + ## all the memory, unless a quit procedure calls `GC_fullCollect + ## <#GC_fullCollect>`_. ## ## The proc ``quit(QuitSuccess)`` is called implicitly when your nim ## program finishes without incident. A raised unhandled exception is @@ -1130,7 +1131,8 @@ proc quit*(errorcode: int = QuitSuccess) {. ## ## Note that this is a *runtime* call and using ``quit`` inside a macro won't ## have any compile time effect. If you need to stop the compiler inside a - ## macro, use the ``error`` or ``fatal`` pragmas. + ## macro, use the `error <manual.html#error-pragma>`_ or `fatal + ## <manual.html#fatal-pragma>`_ pragmas. template sysAssert(cond: bool, msg: string) = when defined(useSysAssert): @@ -1284,11 +1286,12 @@ proc toBiggestInt*(f: BiggestFloat): BiggestInt {. proc addQuitProc*(QuitProc: proc() {.noconv.}) {. importc: "atexit", header: "<stdlib.h>".} - ## adds/registers a quit procedure. Each call to ``addQuitProc`` - ## registers another quit procedure. Up to 30 procedures can be - ## registered. They are executed on a last-in, first-out basis - ## (that is, the last function registered is the first to be executed). - ## ``addQuitProc`` raises an EOutOfIndex if ``quitProc`` cannot be + ## Adds/registers a quit procedure. + ## + ## Each call to ``addQuitProc`` registers another quit procedure. Up to 30 + ## procedures can be registered. They are executed on a last-in, first-out + ## basis (that is, the last function registered is the first to be executed). + ## ``addQuitProc`` raises an EOutOfIndex exception if ``QuitProc`` cannot be ## registered. # Support for addQuitProc() is done by Ansi C's facilities here. @@ -2349,9 +2352,12 @@ when not defined(JS): #and not defined(NimrodVM): ## current file position is not at the beginning of the file. proc readFile*(filename: string): TaintedString {.tags: [ReadIOEffect], benign.} - ## Opens a file named `filename` for reading. Then calls `readAll` - ## and closes the file afterwards. Returns the string. - ## Raises an IO exception in case of an error. + ## Opens a file named `filename` for reading. + ## + ## Then calls `readAll <#readAll>`_ and closes the file afterwards. + ## Returns the string. Raises an IO exception in case of an error. If + ## you need to call this inside a compile time macro you can use + ## `staticRead <#staticRead>`_. proc writeFile*(filename, content: string) {.tags: [WriteIOEffect], benign.} ## Opens a file named `filename` for writing. Then writes the @@ -2852,19 +2858,20 @@ proc `[]=`*[T](s: var seq[T], x: Slice[int], b: openArray[T]) = spliceImpl(s, a, L, b) proc slurp*(filename: string): string {.magic: "Slurp".} - ## This is an alias for ``staticRead``. + ## This is an alias for `staticRead <#staticRead>`_. proc staticRead*(filename: string): string {.magic: "Slurp".} - ## Compile-time ``readFile`` proc for easy `resource`:idx: embedding: + ## Compile-time `readFile <#readFile>`_ proc for easy `resource`:idx: + ## embedding: ## ## .. code-block:: nim ## const myResource = staticRead"mydatafile.bin" ## - ## ``slurp`` is an alias for ``staticRead``. + ## `slurp <#slurp>`_ is an alias for ``staticRead``. proc gorge*(command: string, input = ""): string {. magic: "StaticExec".} = discard - ## This is an alias for ``staticExec``. + ## This is an alias for `staticExec <#staticExec>`_. proc staticExec*(command: string, input = ""): string {. magic: "StaticExec".} = discard @@ -2876,8 +2883,8 @@ proc staticExec*(command: string, input = ""): string {. ## const buildInfo = "Revision " & staticExec("git rev-parse HEAD") & ## "\nCompiled on " & staticExec("uname -v") ## - ## ``gorge`` is an alias for ``staticExec``. Note that you can use this proc - ## inside a pragma like `passC <nimc.html#passc-pragma>`_ or `passL + ## `gorge <#gorge>`_ is an alias for ``staticExec``. Note that you can use + ## this proc inside a pragma like `passC <nimc.html#passc-pragma>`_ or `passL ## <nimc.html#passl-pragma>`_. proc `+=`*[T: SomeOrdinal|uint|uint64](x: var T, y: T) {.magic: "Inc", noSideEffect.} |