<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">=======================
Nimrod Standard Library
=======================

:Author: Andreas Rumpf
:Version: |nimrodversion|

.. contents::

  "The good thing about reinventing the wheel is that you can get a round one."

Though the Nimrod Standard Library is still evolving, it is already quite
usable. It is divided into *pure libraries*, *impure libraries* and *wrappers*.

Pure libraries do not depend on any external ``*.dll`` or ``lib*.so`` binary
while impure libraries do. A wrapper is an impure library that is a very
low-level interface to a C library.

Read this `document &lt;apis.html&gt;`_ for a quick overview of the API design.

The `bottom &lt;#babel&gt;`_ of this page includes a list of 3rd party packages
created by the Nimrod community. These packages are a useful addition to the
modules in the standard library.


Pure libraries
==============

Core
----

* `system &lt;system.html&gt;`_
  Basic procs and operators that every program needs. It also provides IO
  facilities for reading and writing text and binary files. It is imported
  implicitly by the compiler. Do not import it directly. It relies on compiler
  magic to work.

* `unsigned &lt;unsigned.html&gt;`_
  This module implements basic arithmetic operators for unsigned integers.
  To discourage users from using unsigned integers, it's not part 
  of ``system``, but an extra import.

* `threads &lt;threads.html&gt;`_
  Nimrod thread support. **Note**: This is part of the system module. Do not
  import it explicitly.

* `channels &lt;channels.html&gt;`_
  Nimrod message passing support for threads. **Note**: This is part of the 
  system module. Do not import it explicitly.

* `locks &lt;locks.html&gt;`_
  Locks and condition variables for Nimrod.

* `macros &lt;macros.html&gt;`_
  Contains the AST API and documentation of Nimrod for writing macros.

* `typeinfo &lt;typeinfo.html&gt;`_
  Provides (unsafe) access to Nimrod's run time type information. 
  
* `actors &lt;actors.html&gt;`_
  Actor support for Nimrod; implemented as a layer on top of the threads and
  channels modules.


Collections and algorithms
--------------------------

* `algorithm &lt;algorithm.html&gt;`_
  Implements some common generic algorithms like sort or binary search.
* `tables &lt;tables.html&gt;`_
  Nimrod hash table support. Contains tables, ordered tables and count tables.
* `sets &lt;sets.html&gt;`_
  Nimrod hash and bit set support.
* `lists &lt;lists.html&gt;`_
  Nimrod linked list support. Contains singly and doubly linked lists and
  circular lists ("rings").
* `queues &lt;queues.html&gt;`_
  Implementation of a queue. The underlying implementation uses a ``seq``.
* `intsets &lt;intsets.html&gt;`_
  Efficient implementation of a set of ints as a sparse bit set.
* `critbits &lt;critbits.html&gt;`_
  This module implements a *crit bit tree* which is an efficient
  container for a set or a mapping of strings.
* `sequtils &lt;sequtils.html&gt;`_
  This module implements operations for the built-in seq type
  which were inspired by functional programming languages.


String handling
---------------

* `strutils &lt;strutils.html&gt;`_
  This module contains common string handling operations like changing
  case of a string, splitting a string into substrings, searching for
  substrings, replacing substrings.

* `parseutils &lt;parseutils.html&gt;`_
  This module contains helpers for parsing tokens, numbers, identifiers, etc.

* `strtabs &lt;strtabs.html&gt;`_
  The ``strtabs`` module implements an efficient hash table that is a mapping
  from strings to strings. Supports a case-sensitive, case-insensitive and
  style-insensitive mode. An efficient string substitution operator ``%``
  for the string table is also provided.

* `unicode &lt;unicode.html&gt;`_
  This module provides support to handle the Unicode UTF-8 encoding.
  
* `encodings &lt;encodings.html&gt;`_
  Converts between different character encodings. On UNIX, this uses 
  the ``iconv`` library, on Windows the Windows API.

* `pegs &lt;pegs.html&gt;`_
  This module contains procedures and operators for handling PEGs.

* `ropes &lt;ropes.html&gt;`_
  This module contains support for a *rope* data type.
  Ropes can represent very long strings efficiently; especially concatenation
  is done in O(1) instead of O(n).

* `unidecode &lt;unidecode.html&gt;`_
  This module provides Unicode to ASCII transliterations:
  It finds the sequence of ASCII characters that is the closest approximation
  to the Unicode string.

* `matchers &lt;matchers.html&gt;`_
  This module contains various string matchers for email addresses, etc.

* `subexes &lt;subexes.html&gt;`_
  This module implements advanted string substitution operations.


Generic Operating System Services
---------------------------------

* `os &lt;os.html&gt;`_
  Basic operating system facilities like retrieving environment variables,
  reading command line arguments, working with directories, running shell
  commands, etc.

* `osproc &lt;osproc.html&gt;`_
  Module for process communication beyond ``os.execShellCmd``.

* `times &lt;times.html&gt;`_
  The ``times`` module contains basic support for working with time.

* `dynlib &lt;dynlib.html&gt;`_
  This module implements the ability to access symbols from shared libraries.

* `streams &lt;streams.html&gt;`_
  This module provides a stream interface and two implementations thereof:
  the `PFileStream` and the `PStringStream` which implement the stream
  interface for Nimrod file objects (`TFile`) and strings. Other modules
  may provide other implementations for this standard stream interface.

* `marshal &lt;marshal.html&gt;`_
  Contains procs for serialization and deseralization of arbitrary Nimrod 
  data structures.

* `terminal &lt;terminal.html&gt;`_
  This module contains a few procedures to control the *terminal*
  (also called *console*). The implementation simply uses ANSI escape
  sequences and does not depend on any other module.

* `memfiles &lt;memfiles.html&gt;`_
  This module provides support for memory mapped files (Posix's ``mmap``) 
  on the different operating systems.

* `fsmonitor &lt;fsmonitor.html&gt;`_
  This module implements the ability to monitor a directory/file for changes
  using Posix's inotify API.

Math libraries
--------------

* `math &lt;math.html&gt;`_
  Mathematical operations like cosine, square root.

* `complex &lt;complex.html&gt;`_
  This module implements complex numbers and their mathematical operations.



Internet Protocols and Support
------------------------------

* `cgi &lt;cgi.html&gt;`_
  This module implements helpers for CGI applications.

* `scgi &lt;scgi.html&gt;`_
  This module implements helpers for SCGI applications.

* `sockets &lt;sockets.html&gt;`_
  This module implements a simple portable type-safe sockets layer.

* `asyncio &lt;asyncio.html&gt;`_
  This module implements an asynchronous event loop for sockets.

* `browsers &lt;browsers.html&gt;`_
  This module implements procs for opening URLs with the user's default
  browser.

* `httpserver &lt;httpserver.html&gt;`_
  This module implements a simple HTTP server.

* `httpclient &lt;httpclient.html&gt;`_
  This module implements a simple HTTP client.

* `smtp &lt;smtp.html&gt;`_
  This module implement a simple SMTP client. 

* `irc &lt;irc.html&gt;`_
  This module implements an asynchronous IRC client.

* `ftpclient &lt;ftpclient.html&gt;`_
  This module implements an FTP client.

* `cookies &lt;cookies.html&gt;`_
  This module contains helper procs for parsing and generating cookies.

* `mimetypes &lt;mimetypes.html&gt;`_
  This module implements a mimetypes database.

* `uri &lt;uri.html&gt;`_
  This module provides functions for working with URIs.

* `asyncdispatch &lt;asyncdispatch.html&gt;`_
  This module implements an asynchronous dispatcher for IO operations.

  **Note:** This module is still largely experimental.

* `asyncnet &lt;asyncnet.html&gt;`_
  This module implements asynchronous sockets based on the ``asyncdispatch``
  module.

  **Note:** This module is still largely experimental.

* `asynchttpserver &lt;asynchttpserver.html&gt;`_
  This module implements an asynchronous HTTP server using the ``asyncnet``
  module.

  **Note:** This module is still largely experimental.

* `net &lt;net.html&gt;`_
  This module implements a high-level sockets API. It will replace the
  ``sockets`` module in the future.

* `rawsockets &lt;rawsockets.html&gt;`_
  This module implements a low-level sockets API.

* `selectors &lt;selectors.html&gt;`_
  This module implements a selector API with backends specific to each OS.
  Currently epoll on Linux and select on other operating systems.

Parsers
-------

* `parseopt &lt;parseopt.html&gt;`_
  The ``parseopt`` module implements a command line option parser.
  **Deprecated since version 0.9.3:** Use the `parseopt2
  &lt;parseopt2.html&gt;`_ module instead.

* `parseopt2 &lt;parseopt2.html&gt;`_
  The ``parseopt2`` module implements a command line option parser. This
  supports long and short command options with optional values and command line
  arguments.

* `parsecfg &lt;parsecfg.html&gt;`_
  The ``parsecfg`` module implements a high performance configuration file
  parser. The configuration file's syntax is similar to the Windows ``.ini``
  format, but much more powerful, as it is not a line based parser. String
  literals, raw string literals and triple quote string literals are supported
  as in the Nimrod programming language.

* `parsexml &lt;parsexml.html&gt;`_
  The ``parsexml`` module implements a simple high performance XML/HTML parser.
  The only encoding that is supported is UTF-8. The parser has been designed
  to be somewhat error correcting, so that even some "wild HTML" found on the
  Web can be parsed with it.

* `parsecsv &lt;parsecsv.html&gt;`_
  The ``parsecsv`` module implements a simple high performance CSV parser.

* `parsesql &lt;parsesql.html&gt;`_
  The ``parsesql`` module implements a simple high performance SQL parser.

* `json &lt;json.html&gt;`_
  High performance JSON parser.

* `lexbase &lt;lexbase.html&gt;`_
  This is a low level module that implements an extremely efficient buffering
  scheme for lexers and parsers. This is used by the diverse parsing modules.

* `highlite &lt;highlite.html&gt;`_
  Source highlighter for programming or markup languages.  Currently
  only few languages are supported, other languages may be added.
  The interface supports one language nested in another.

* `rst &lt;rst.html&gt;`_
  This module implements a reStructuredText parser. A large subset
  is implemented. Some features of the markdown wiki syntax are
  also supported.

* `rstast &lt;rstast.html&gt;`_
  This module implements an AST for the reStructuredText parser.

* `rstgen &lt;rstgen.html&gt;`_
  This module implements a generator of HTML/Latex from reStructuredText.


XML Processing
--------------

* `xmldom &lt;xmldom.html&gt;`_
  This module implements the XML DOM Level 2.

* `xmldomparser &lt;xmldomparser.html&gt;`_
  This module parses an XML Document into a XML DOM Doc&lt;style&gt;pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */&lt;/style&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;/*&lt;span class="w"&gt; &lt;/span&gt;Table&lt;span class="w"&gt; &lt;/span&gt;of&lt;span class="w"&gt; &lt;/span&gt;DBX&lt;span class="w"&gt; &lt;/span&gt;symbol&lt;span class="w"&gt; &lt;/span&gt;codes&lt;span class="w"&gt; &lt;/span&gt;for&lt;span class="w"&gt; &lt;/span&gt;the&lt;span class="w"&gt; &lt;/span&gt;GNU&lt;span class="w"&gt; &lt;/span&gt;system.
&lt;span class="w"&gt;   &lt;/span&gt;Copyright&lt;span class="w"&gt; &lt;/span&gt;(C)&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1988&lt;/span&gt;,&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1997&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;Free&lt;span class="w"&gt; &lt;/span&gt;Software&lt;span class="w"&gt; &lt;/span&gt;Foundation,&lt;span class="w"&gt; &lt;/span&gt;Inc.
&lt;span class="w"&gt;   &lt;/span&gt;This&lt;span class="w"&gt; &lt;/span&gt;file&lt;span class="w"&gt; &lt;/span&gt;is&lt;span class="w"&gt; &lt;/span&gt;part&lt;span class="w"&gt; &lt;/span&gt;of&lt;span class="w"&gt; &lt;/span&gt;the&lt;span class="w"&gt; &lt;/span&gt;GNU&lt;span class="w"&gt; &lt;/span&gt;C&lt;span class="w"&gt; &lt;/span&gt;Library.

&lt;span class="w"&gt;   &lt;/span&gt;The&lt;span class="w"&gt; &lt;/span&gt;GNU&lt;span class="w"&gt; &lt;/span&gt;C&lt;span class="w"&gt; &lt;/span&gt;Library&lt;span class="w"&gt; &lt;/span&gt;is&lt;span class="w"&gt; &lt;/span&gt;free&lt;span class="w"&gt; &lt;/span&gt;software;&lt;span class="w"&gt; &lt;/span&gt;you&lt;span class="w"&gt; &lt;/span&gt;can&lt;span class="w"&gt; &lt;/span&gt;redistribute&lt;span class="w"&gt; &lt;/span&gt;it&lt;span class="w"&gt; &lt;/span&gt;and/or
&lt;span class="w"&gt;   &lt;/span&gt;modify&lt;span class="w"&gt; &lt;/span&gt;it&lt;span class="w"&gt; &lt;/span&gt;under&lt;span class="w"&gt; &lt;/span&gt;the&lt;span class="w"&gt; &lt;/span&gt;terms&lt;span class="w"&gt; &lt;/span&gt;of&lt;span class="w"&gt; &lt;/span&gt;the&lt;span class="w"&gt; &lt;/span&gt;GNU&lt;span class="w"&gt; &lt;/span&gt;Library&lt;span class="w"&gt; &lt;/span&gt;General&lt;span class="w"&gt; &lt;/span&gt;Public&lt;span class="w"&gt; &lt;/span&gt;License&lt;span class="w"&gt; &lt;/span&gt;as
&lt;span class="w"&gt;   &lt;/span&gt;published&lt;span class="w"&gt; &lt;/span&gt;by&lt;span class="w"&gt; &lt;/span&gt;the&lt;span class="w"&gt; &lt;/span&gt;Free&lt;span class="w"&gt; &lt;/span&gt;Software&lt;span class="w"&gt; &lt;/span&gt;Foundation;&lt;span class="w"&gt; &lt;/span&gt;either&lt;span class="w"&gt; &lt;/span&gt;version&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;of&lt;span class="w"&gt; &lt;/span&gt;the
&lt;span class="w"&gt;   &lt;/span&gt;License,&lt;span class="w"&gt; &lt;/span&gt;or&lt;span class="w"&gt; &lt;/span&gt;(at&lt;span class="w"&gt; &lt;/span&gt;your&lt;span class="w"&gt; &lt;/span&gt;option)&lt;span class="w"&gt; &lt;/span&gt;any&lt;span class="w"&gt; &lt;/span&gt;later&lt;span class="w"&gt; &lt;/span&gt;version.

&lt;span class="w"&gt;   &lt;/span&gt;The&lt;span class="w"&gt; &lt;/span&gt;GNU&lt;span class="w"&gt; &lt;/span&gt;C&lt;span class="w"&gt; &lt;/span&gt;Library&lt;span class="w"&gt; &lt;/span&gt;is&lt;span class="w"&gt; &lt;/span&gt;distributed&lt;span class="w"&gt; &lt;/span&gt;in&lt;span class="w"&gt; &lt;/span&gt;the&lt;span class="w"&gt; &lt;/span&gt;hope&lt;span class="w"&gt; &lt;/span&gt;that&lt;span class=</pre></body></html>