documentation build cleaned up
This commit is contained in:
parent
ca8214a2a2
commit
1a88c01f92
13 changed files with 43 additions and 38 deletions
|
|
@ -155,4 +155,4 @@ Exception hierarchy
|
||||||
|
|
||||||
The exception tree is defined in the `system <system.html>`_ module:
|
The exception tree is defined in the `system <system.html>`_ module:
|
||||||
|
|
||||||
.. include:: exception_hierarchy_fragment.txt
|
.. include:: ../exception_hierarchy_fragment.txt
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ operator characters instead.
|
||||||
The following keywords are reserved and cannot be used as identifiers:
|
The following keywords are reserved and cannot be used as identifiers:
|
||||||
|
|
||||||
.. code-block:: nim
|
.. code-block:: nim
|
||||||
:file: keywords.txt
|
:file: ../keywords.txt
|
||||||
|
|
||||||
Some keywords are unused; they are reserved for future developments of the
|
Some keywords are unused; they are reserved for future developments of the
|
||||||
language.
|
language.
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,6 @@ Grammar
|
||||||
|
|
||||||
The grammar's start symbol is ``module``.
|
The grammar's start symbol is ``module``.
|
||||||
|
|
||||||
.. include:: grammar.txt
|
.. include:: ../grammar.txt
|
||||||
:literal:
|
:literal:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -694,7 +694,7 @@ branch switch ``system.reset`` has to be used.
|
||||||
Set type
|
Set type
|
||||||
--------
|
--------
|
||||||
|
|
||||||
.. include:: sets_fragment.txt
|
.. include:: ../sets_fragment.txt
|
||||||
|
|
||||||
Reference and pointer types
|
Reference and pointer types
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ Configuration file
|
||||||
niminst uses the Nim `parsecfg <parsecfg.html>`_ module to parse the
|
niminst uses the Nim `parsecfg <parsecfg.html>`_ module to parse the
|
||||||
configuration file. Here's an example of how the syntax looks like:
|
configuration file. Here's an example of how the syntax looks like:
|
||||||
|
|
||||||
.. include:: doc/mytest.cfg
|
.. include:: mytest.cfg
|
||||||
:literal:
|
:literal:
|
||||||
|
|
||||||
The value of a key-value pair can reference user-defined variables via
|
The value of a key-value pair can reference user-defined variables via
|
||||||
|
|
@ -190,6 +190,6 @@ Real world example
|
||||||
The installers for the Nim compiler itself are generated by niminst. Have a
|
The installers for the Nim compiler itself are generated by niminst. Have a
|
||||||
look at its configuration file:
|
look at its configuration file:
|
||||||
|
|
||||||
.. include:: compiler/installer.ini
|
.. include:: ../compiler/installer.ini
|
||||||
:literal:
|
:literal:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ include "system/inclrtl"
|
||||||
## This module contains the interface to the compiler's abstract syntax
|
## This module contains the interface to the compiler's abstract syntax
|
||||||
## tree (`AST`:idx:). Macros operate on this tree.
|
## tree (`AST`:idx:). Macros operate on this tree.
|
||||||
|
|
||||||
## .. include:: ../doc/astspec.txt
|
## .. include:: ../../doc/astspec.txt
|
||||||
|
|
||||||
type
|
type
|
||||||
NimNodeKind* = enum
|
NimNodeKind* = enum
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
## though.
|
## though.
|
||||||
## PRCE's licence follows:
|
## PRCE's licence follows:
|
||||||
##
|
##
|
||||||
## .. include:: ../doc/regexprs.txt
|
## .. include:: ../../doc/regexprs.txt
|
||||||
##
|
##
|
||||||
|
|
||||||
import
|
import
|
||||||
|
|
|
||||||
|
|
@ -606,28 +606,31 @@ proc setSockOpt*(socket: Socket, opt: SOBool, value: bool, level = SOL_SOCKET) {
|
||||||
var valuei = cint(if value: 1 else: 0)
|
var valuei = cint(if value: 1 else: 0)
|
||||||
setSockOptInt(socket.fd, cint(level), toCInt(opt), valuei)
|
setSockOptInt(socket.fd, cint(level), toCInt(opt), valuei)
|
||||||
|
|
||||||
when defined(posix) or defined(nimdoc):
|
when defined(posix) and not defined(nimdoc):
|
||||||
proc makeUnixAddr(path: string): Sockaddr_un =
|
proc makeUnixAddr(path: string): Sockaddr_un =
|
||||||
result.sun_family = AF_UNIX.toInt
|
result.sun_family = AF_UNIX.toInt
|
||||||
if path.len >= Sockaddr_un_path_length:
|
if path.len >= Sockaddr_un_path_length:
|
||||||
raise newException(ValueError, "socket path too long")
|
raise newException(ValueError, "socket path too long")
|
||||||
copyMem(addr result.sun_path, path.cstring, path.len + 1)
|
copyMem(addr result.sun_path, path.cstring, path.len + 1)
|
||||||
|
|
||||||
|
when defined(posix):
|
||||||
proc connectUnix*(socket: Socket, path: string) =
|
proc connectUnix*(socket: Socket, path: string) =
|
||||||
## Connects to Unix socket on `path`.
|
## Connects to Unix socket on `path`.
|
||||||
## This only works on Unix-style systems: Mac OS X, BSD and Linux
|
## This only works on Unix-style systems: Mac OS X, BSD and Linux
|
||||||
var socketAddr = makeUnixAddr(path)
|
when not defined(nimdoc):
|
||||||
if socket.fd.connect(cast[ptr SockAddr](addr socketAddr),
|
var socketAddr = makeUnixAddr(path)
|
||||||
sizeof(socketAddr).Socklen) != 0'i32:
|
if socket.fd.connect(cast[ptr SockAddr](addr socketAddr),
|
||||||
raiseOSError(osLastError())
|
sizeof(socketAddr).Socklen) != 0'i32:
|
||||||
|
raiseOSError(osLastError())
|
||||||
|
|
||||||
proc bindUnix*(socket: Socket, path: string) =
|
proc bindUnix*(socket: Socket, path: string) =
|
||||||
## Binds Unix socket to `path`.
|
## Binds Unix socket to `path`.
|
||||||
## This only works on Unix-style systems: Mac OS X, BSD and Linux
|
## This only works on Unix-style systems: Mac OS X, BSD and Linux
|
||||||
var socketAddr = makeUnixAddr(path)
|
when not defined(nimdoc):
|
||||||
if socket.fd.bindAddr(cast[ptr SockAddr](addr socketAddr),
|
var socketAddr = makeUnixAddr(path)
|
||||||
sizeof(socketAddr).Socklen) != 0'i32:
|
if socket.fd.bindAddr(cast[ptr SockAddr](addr socketAddr),
|
||||||
raiseOSError(osLastError())
|
sizeof(socketAddr).Socklen) != 0'i32:
|
||||||
|
raiseOSError(osLastError())
|
||||||
|
|
||||||
when defined(ssl):
|
when defined(ssl):
|
||||||
proc handshake*(socket: Socket): bool
|
proc handshake*(socket: Socket): bool
|
||||||
|
|
@ -1399,7 +1402,7 @@ proc connect*(socket: Socket, address: string, port = Port(0),
|
||||||
if selectWrite(s, timeout) != 1:
|
if selectWrite(s, timeout) != 1:
|
||||||
raise newException(TimeoutError, "Call to 'connect' timed out.")
|
raise newException(TimeoutError, "Call to 'connect' timed out.")
|
||||||
else:
|
else:
|
||||||
when defineSsl:
|
when defineSsl and not defined(nimdoc):
|
||||||
if socket.isSSL:
|
if socket.isSSL:
|
||||||
socket.fd.setBlocking(true)
|
socket.fd.setBlocking(true)
|
||||||
{.warning[Deprecated]: off.}
|
{.warning[Deprecated]: off.}
|
||||||
|
|
|
||||||
|
|
@ -15,21 +15,21 @@
|
||||||
|
|
||||||
## This is an example of how a configuration file may look like:
|
## This is an example of how a configuration file may look like:
|
||||||
##
|
##
|
||||||
## .. include:: doc/mytest.cfg
|
## .. include:: ../../doc/mytest.cfg
|
||||||
## :literal:
|
## :literal:
|
||||||
## The file ``examples/parsecfgex.nim`` demonstrates how to use the
|
## The file ``examples/parsecfgex.nim`` demonstrates how to use the
|
||||||
## configuration file parser:
|
## configuration file parser:
|
||||||
##
|
##
|
||||||
## .. code-block:: nim
|
## .. code-block:: nim
|
||||||
## :file: examples/parsecfgex.nim
|
## :file: ../../examples/parsecfgex.nim
|
||||||
##
|
##
|
||||||
## Examples
|
## Examples
|
||||||
## --------
|
## --------
|
||||||
##
|
##
|
||||||
## This is an example of a configuration file.
|
## This is an example of a configuration file.
|
||||||
##
|
##
|
||||||
## .. include:: config.ini
|
## ::
|
||||||
##
|
##
|
||||||
## charset = "utf-8"
|
## charset = "utf-8"
|
||||||
## [Package]
|
## [Package]
|
||||||
## name = "hello"
|
## name = "hello"
|
||||||
|
|
@ -38,11 +38,11 @@
|
||||||
## name = "lihf8515"
|
## name = "lihf8515"
|
||||||
## qq = "10214028"
|
## qq = "10214028"
|
||||||
## email = "lihaifeng@wxm.com"
|
## email = "lihaifeng@wxm.com"
|
||||||
##
|
##
|
||||||
## Creating a configuration file.
|
## Creating a configuration file.
|
||||||
## ==============================
|
## ==============================
|
||||||
## .. code-block:: nim
|
## .. code-block:: nim
|
||||||
##
|
##
|
||||||
## import parsecfg
|
## import parsecfg
|
||||||
## var dict=newConfig()
|
## var dict=newConfig()
|
||||||
## dict.setSectionKey("","charset","utf-8")
|
## dict.setSectionKey("","charset","utf-8")
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
## dict.setSectionKey("Author","qq","10214028")
|
## dict.setSectionKey("Author","qq","10214028")
|
||||||
## dict.setSectionKey("Author","email","lihaifeng@wxm.com")
|
## dict.setSectionKey("Author","email","lihaifeng@wxm.com")
|
||||||
## dict.writeConfig("config.ini")
|
## dict.writeConfig("config.ini")
|
||||||
##
|
##
|
||||||
## Reading a configuration file.
|
## Reading a configuration file.
|
||||||
## =============================
|
## =============================
|
||||||
## .. code-block:: nim
|
## .. code-block:: nim
|
||||||
|
|
@ -66,11 +66,11 @@
|
||||||
## var qq = dict.getSectionValue("Author","qq")
|
## var qq = dict.getSectionValue("Author","qq")
|
||||||
## var email = dict.getSectionValue("Author","email")
|
## var email = dict.getSectionValue("Author","email")
|
||||||
## echo pname & "\n" & name & "\n" & qq & "\n" & email
|
## echo pname & "\n" & name & "\n" & qq & "\n" & email
|
||||||
##
|
##
|
||||||
## Modifying a configuration file.
|
## Modifying a configuration file.
|
||||||
## ===============================
|
## ===============================
|
||||||
## .. code-block:: nim
|
## .. code-block:: nim
|
||||||
##
|
##
|
||||||
## import parsecfg
|
## import parsecfg
|
||||||
## var dict = loadConfig("config.ini")
|
## var dict = loadConfig("config.ini")
|
||||||
## dict.setSectionKey("Author","name","lhf")
|
## dict.setSectionKey("Author","name","lhf")
|
||||||
|
|
@ -79,7 +79,7 @@
|
||||||
## Deleting a section key in a configuration file.
|
## Deleting a section key in a configuration file.
|
||||||
## ===============================================
|
## ===============================================
|
||||||
## .. code-block:: nim
|
## .. code-block:: nim
|
||||||
##
|
##
|
||||||
## import parsecfg
|
## import parsecfg
|
||||||
## var dict = loadConfig("config.ini")
|
## var dict = loadConfig("config.ini")
|
||||||
## dict.delSectionKey("Author","email")
|
## dict.delSectionKey("Author","email")
|
||||||
|
|
@ -434,7 +434,7 @@ proc loadConfig*(filename: string): Config =
|
||||||
## Load the specified configuration file into a new Config instance.
|
## Load the specified configuration file into a new Config instance.
|
||||||
var dict = newOrderedTable[string, OrderedTableRef[string, string]]()
|
var dict = newOrderedTable[string, OrderedTableRef[string, string]]()
|
||||||
var curSection = "" ## Current section,
|
var curSection = "" ## Current section,
|
||||||
## the default value of the current section is "",
|
## the default value of the current section is "",
|
||||||
## which means that the current section is a common
|
## which means that the current section is a common
|
||||||
var p: CfgParser
|
var p: CfgParser
|
||||||
var fileStream = newFileStream(filename, fmRead)
|
var fileStream = newFileStream(filename, fmRead)
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
## document.
|
## document.
|
||||||
##
|
##
|
||||||
## .. code-block:: nim
|
## .. code-block:: nim
|
||||||
## :file: examples/htmltitle.nim
|
## :file: ../../examples/htmltitle.nim
|
||||||
##
|
##
|
||||||
##
|
##
|
||||||
## Example 2: Retrieve all HTML links
|
## Example 2: Retrieve all HTML links
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
## an HTML document contains.
|
## an HTML document contains.
|
||||||
##
|
##
|
||||||
## .. code-block:: nim
|
## .. code-block:: nim
|
||||||
## :file: examples/htmlrefs.nim
|
## :file: ../../examples/htmlrefs.nim
|
||||||
##
|
##
|
||||||
|
|
||||||
import
|
import
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
## Matching performance is hopefully competitive with optimized regular
|
## Matching performance is hopefully competitive with optimized regular
|
||||||
## expression engines.
|
## expression engines.
|
||||||
##
|
##
|
||||||
## .. include:: ../doc/pegdocs.txt
|
## .. include:: ../../doc/pegdocs.txt
|
||||||
##
|
##
|
||||||
|
|
||||||
include "system/inclrtl"
|
include "system/inclrtl"
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,11 @@
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
#
|
#
|
||||||
|
|
||||||
## | Nim's standard random number generator. Based on
|
##[Nim's standard random number generator. Based on
|
||||||
## | http://xoroshiro.di.unimi.it/
|
|
||||||
## | http://xoroshiro.di.unimi.it/xoroshiro128plus.c
|
| `http://xoroshiro.di.unimi.it/`_
|
||||||
|
| `http://xoroshiro.di.unimi.it/xoroshiro128plus.c`_
|
||||||
|
]##
|
||||||
|
|
||||||
include "system/inclrtl"
|
include "system/inclrtl"
|
||||||
{.push debugger:off.}
|
{.push debugger:off.}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
## Nim support for `substitution expressions`:idx: (`subex`:idx:).
|
## Nim support for `substitution expressions`:idx: (`subex`:idx:).
|
||||||
##
|
##
|
||||||
## .. include:: ../doc/subexes.txt
|
## .. include:: ../../doc/subexes.txt
|
||||||
##
|
##
|
||||||
|
|
||||||
{.push debugger:off .} # the user does not want to trace a part
|
{.push debugger:off .} # the user does not want to trace a part
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue