Deploy to GitHub pages

This commit is contained in:
github-actions[bot]
2025-10-31 16:08:19 +00:00
committed by GitHub
commit 030b631899
872 changed files with 349451 additions and 0 deletions

978
algorithm.html Normal file
View File

@@ -0,0 +1,978 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/algorithm</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/algorithm</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li><a class="reference" id="basic-usage_toc" href="#basic-usage">Basic usage</a></li>
<li><a class="reference" id="see-also_toc" href="#see-also">See also</a></li>
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#SortOrder" title="SortOrder = enum
Descending, Ascending">SortOrder</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">*
<li><a class="reference" href="#%2A%2Cint%2CSortOrder" title="`*`(x: int; order: SortOrder): int">`*`(x: int; order: SortOrder): int</a></li>
</ul>
<ul class="simple nested-toc-section">binarySearch
<li><a class="reference" href="#binarySearch%2CopenArray%5BT%5D%2CK%2Cproc%28T%2CK%29" title="binarySearch[T, K](a: openArray[T]; key: K;
cmp: proc (x: T; y: K): int {.closure.}): int">binarySearch[T, K](a: openArray[T]; key: K;
cmp: proc (x: T; y: K): int {.closure.}): int</a></li>
<li><a class="reference" href="#binarySearch%2CopenArray%5BT%5D%2CT" title="binarySearch[T](a: openArray[T]; key: T): int">binarySearch[T](a: openArray[T]; key: T): int</a></li>
</ul>
<ul class="simple nested-toc-section">fill
<li><a class="reference" href="#fill%2CopenArray%5BT%5D%2CNatural%2CNatural%2CT" title="fill[T](a: var openArray[T]; first, last: Natural; value: T)">fill[T](a: var openArray[T]; first, last: Natural; value: T)</a></li>
<li><a class="reference" href="#fill%2CopenArray%5BT%5D%2CT" title="fill[T](a: var openArray[T]; value: T)">fill[T](a: var openArray[T]; value: T)</a></li>
</ul>
<ul class="simple nested-toc-section">isSorted
<li><a class="reference" href="#isSorted%2CopenArray%5BT%5D%2Cproc%28T%2CT%29" title="isSorted[T](a: openArray[T]; cmp: proc (x, y: T): int {.closure.};
order = SortOrder.Ascending): bool">isSorted[T](a: openArray[T]; cmp: proc (x, y: T): int {.closure.};
order = SortOrder.Ascending): bool</a></li>
<li><a class="reference" href="#isSorted%2CopenArray%5BT%5D" title="isSorted[T](a: openArray[T]; order = SortOrder.Ascending): bool">isSorted[T](a: openArray[T]; order = SortOrder.Ascending): bool</a></li>
</ul>
<ul class="simple nested-toc-section">lowerBound
<li><a class="reference" href="#lowerBound%2CopenArray%5BT%5D%2CK%2Cproc%28T%2CK%29" title="lowerBound[T, K](a: openArray[T]; key: K; cmp: proc (x: T; k: K): int {.closure.}): int">lowerBound[T, K](a: openArray[T]; key: K; cmp: proc (x: T; k: K): int {.closure.}): int</a></li>
<li><a class="reference" href="#lowerBound%2CopenArray%5BT%5D%2CT" title="lowerBound[T](a: openArray[T]; key: T): int">lowerBound[T](a: openArray[T]; key: T): int</a></li>
</ul>
<ul class="simple nested-toc-section">merge
<li><a class="reference" href="#merge%2Cseq%5BT%5D%2CopenArray%5BT%5D%2CopenArray%5BT%5D" title="merge[T](result: var seq[T]; x, y: openArray[T])">merge[T](result: var seq[T]; x, y: openArray[T])</a></li>
<li><a class="reference" href="#merge%2Cseq%5BT%5D%2CopenArray%5BT%5D%2CopenArray%5BT%5D%2Cproc%28T%2CT%29" title="merge[T](result: var seq[T]; x, y: openArray[T];
cmp: proc (x, y: T): int {.closure.})">merge[T](result: var seq[T]; x, y: openArray[T];
cmp: proc (x, y: T): int {.closure.})</a></li>
</ul>
<ul class="simple nested-toc-section">nextPermutation
<li><a class="reference" href="#nextPermutation%2CopenArray%5BT%5D" title="nextPermutation[T](x: var openArray[T]): bool">nextPermutation[T](x: var openArray[T]): bool</a></li>
</ul>
<ul class="simple nested-toc-section">prevPermutation
<li><a class="reference" href="#prevPermutation%2CopenArray%5BT%5D" title="prevPermutation[T](x: var openArray[T]): bool">prevPermutation[T](x: var openArray[T]): bool</a></li>
</ul>
<ul class="simple nested-toc-section">product
<li><a class="reference" href="#product%2CopenArray%5Bseq%5BT%5D%5D" title="product[T](x: openArray[seq[T]]): seq[seq[T]]">product[T](x: openArray[seq[T]]): seq[seq[T]]</a></li>
</ul>
<ul class="simple nested-toc-section">reverse
<li><a class="reference" href="#reverse%2CopenArray%5BT%5D" title="reverse[T](a: var openArray[T])">reverse[T](a: var openArray[T])</a></li>
<li><a class="reference" href="#reverse%2CopenArray%5BT%5D%2CNatural%2CNatural" title="reverse[T](a: var openArray[T]; first, last: Natural)">reverse[T](a: var openArray[T]; first, last: Natural)</a></li>
</ul>
<ul class="simple nested-toc-section">reversed
<li><a class="reference" href="#reversed%2CopenArray%5BT%5D" title="reversed[T](a: openArray[T]): seq[T]">reversed[T](a: openArray[T]): seq[T]</a></li>
<li><a class="reference" href="#reversed%2CopenArray%5BT%5D%2CNatural%2Cint" title="reversed[T](a: openArray[T]; first: Natural; last: int): seq[T]">reversed[T](a: openArray[T]; first: Natural; last: int): seq[T]</a></li>
</ul>
<ul class="simple nested-toc-section">rotatedLeft
<li><a class="reference" href="#rotatedLeft%2CopenArray%5BT%5D%2Cint" title="rotatedLeft[T](arg: openArray[T]; dist: int): seq[T]">rotatedLeft[T](arg: openArray[T]; dist: int): seq[T]</a></li>
<li><a class="reference" href="#rotatedLeft%2CopenArray%5BT%5D%2CHSlice%5Bint%2Cint%5D%2Cint" title="rotatedLeft[T](arg: openArray[T]; slice: HSlice[int, int]; dist: int): seq[T]">rotatedLeft[T](arg: openArray[T]; slice: HSlice[int, int]; dist: int): seq[T]</a></li>
</ul>
<ul class="simple nested-toc-section">rotateLeft
<li><a class="reference" href="#rotateLeft%2CopenArray%5BT%5D%2Cint" title="rotateLeft[T](arg: var openArray[T]; dist: int): int">rotateLeft[T](arg: var openArray[T]; dist: int): int</a></li>
<li><a class="reference" href="#rotateLeft%2CopenArray%5BT%5D%2CHSlice%5Bint%2Cint%5D%2Cint" title="rotateLeft[T](arg: var openArray[T]; slice: HSlice[int, int]; dist: int): int">rotateLeft[T](arg: var openArray[T]; slice: HSlice[int, int]; dist: int): int</a></li>
</ul>
<ul class="simple nested-toc-section">sort
<li><a class="reference" href="#sort%2CopenArray%5BT%5D%2Cproc%28T%2CT%29" title="sort[T](a: var openArray[T]; cmp: proc (x, y: T): int {.closure.};
order = SortOrder.Ascending)">sort[T](a: var openArray[T]; cmp: proc (x, y: T): int {.closure.};
order = SortOrder.Ascending)</a></li>
<li><a class="reference" href="#sort%2CopenArray%5BT%5D" title="sort[T](a: var openArray[T]; order = SortOrder.Ascending)">sort[T](a: var openArray[T]; order = SortOrder.Ascending)</a></li>
</ul>
<ul class="simple nested-toc-section">sorted
<li><a class="reference" href="#sorted%2CopenArray%5BT%5D%2Cproc%28T%2CT%29" title="sorted[T](a: openArray[T]; cmp: proc (x, y: T): int {.closure.};
order = SortOrder.Ascending): seq[T]">sorted[T](a: openArray[T]; cmp: proc (x, y: T): int {.closure.};
order = SortOrder.Ascending): seq[T]</a></li>
<li><a class="reference" href="#sorted%2CopenArray%5BT%5D" title="sorted[T](a: openArray[T]; order = SortOrder.Ascending): seq[T]">sorted[T](a: openArray[T]; order = SortOrder.Ascending): seq[T]</a></li>
</ul>
<ul class="simple nested-toc-section">upperBound
<li><a class="reference" href="#upperBound%2CopenArray%5BT%5D%2CK%2Cproc%28T%2CK%29" title="upperBound[T, K](a: openArray[T]; key: K; cmp: proc (x: T; k: K): int {.closure.}): int">upperBound[T, K](a: openArray[T]; key: K; cmp: proc (x: T; k: K): int {.closure.}): int</a></li>
<li><a class="reference" href="#upperBound%2CopenArray%5BT%5D%2CT" title="upperBound[T](a: openArray[T]; key: T): int">upperBound[T](a: openArray[T]; key: T): int</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">sortedByIt
<li><a class="reference" href="#sortedByIt.t%2Cuntyped%2Cuntyped" title="sortedByIt(seq1, op: untyped): untyped">sortedByIt(seq1, op: untyped): untyped</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">This module implements some common generic algorithms on <tt class="docutils literal"><span class="pre"><span class="Identifier">openArray</span></span></tt>s.
<h1><a class="toc-backref" id="basic-usage" href="#basic-usage">Basic usage</a></h1>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">algorithm</span>
<span class="Keyword">type</span> <span class="Identifier">People</span> <span class="Operator">=</span> <span class="Keyword">tuple</span>
<span class="Identifier">year</span><span class="Punctuation">:</span> <span class="Identifier">int</span>
<span class="Identifier">name</span><span class="Punctuation">:</span> <span class="Identifier">string</span>
<span class="Keyword">var</span> <span class="Identifier">a</span><span class="Punctuation">:</span> <span class="Identifier">seq</span><span class="Punctuation">[</span><span class="Identifier">People</span><span class="Punctuation">]</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="Punctuation">(</span><span class="DecNumber">2000</span><span class="Punctuation">,</span> <span class="StringLit">&quot;John&quot;</span><span class="Punctuation">)</span><span class="Punctuation">)</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="Punctuation">(</span><span class="DecNumber">2005</span><span class="Punctuation">,</span> <span class="StringLit">&quot;Marie&quot;</span><span class="Punctuation">)</span><span class="Punctuation">)</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">add</span><span class="Punctuation">(</span><span class="Punctuation">(</span><span class="DecNumber">2010</span><span class="Punctuation">,</span> <span class="StringLit">&quot;Jane&quot;</span><span class="Punctuation">)</span><span class="Punctuation">)</span>
<span class="Comment"># Sorting with default system.cmp</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">sort</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="Punctuation">(</span><span class="Identifier">year</span><span class="Punctuation">:</span> <span class="DecNumber">2000</span><span class="Punctuation">,</span> <span class="Identifier">name</span><span class="Punctuation">:</span> <span class="StringLit">&quot;John&quot;</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Punctuation">(</span><span class="Identifier">year</span><span class="Punctuation">:</span> <span class="DecNumber">2005</span><span class="Punctuation">,</span> <span class="Identifier">name</span><span class="Punctuation">:</span> <span class="StringLit">&quot;Marie&quot;</span><span class="Punctuation">)</span><span class="Punctuation">,</span>
<span class="Punctuation">(</span><span class="Identifier">year</span><span class="Punctuation">:</span> <span class="DecNumber">2010</span><span class="Punctuation">,</span> <span class="Identifier">name</span><span class="Punctuation">:</span> <span class="StringLit">&quot;Jane&quot;</span><span class="Punctuation">)</span><span class="Punctuation">]</span>
<span class="Keyword">proc</span> <span class="Identifier">myCmp</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">,</span> <span class="Identifier">y</span><span class="Punctuation">:</span> <span class="Identifier">People</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">int</span> <span class="Operator">=</span>
<span class="Identifier">cmp</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Operator">.</span><span class="Identifier">name</span><span class="Punctuation">,</span> <span class="Identifier">y</span><span class="Operator">.</span><span class="Identifier">name</span><span class="Punctuation">)</span>
<span class="Comment"># Sorting with custom proc</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">sort</span><span class="Punctuation">(</span><span class="Identifier">myCmp</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="Punctuation">(</span><span class="Identifier">year</span><span class="Punctuation">:</span> <span class="DecNumber">2010</span><span class="Punctuation">,</span> <span class="Identifier">name</span><span class="Punctuation">:</span> <span class="StringLit">&quot;Jane&quot;</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Punctuation">(</span><span class="Identifier">year</span><span class="Punctuation">:</span> <span class="DecNumber">2000</span><span class="Punctuation">,</span> <span class="Identifier">name</span><span class="Punctuation">:</span> <span class="StringLit">&quot;John&quot;</span><span class="Punctuation">)</span><span class="Punctuation">,</span>
<span class="Punctuation">(</span><span class="Identifier">year</span><span class="Punctuation">:</span> <span class="DecNumber">2005</span><span class="Punctuation">,</span> <span class="Identifier">name</span><span class="Punctuation">:</span> <span class="StringLit">&quot;Marie&quot;</span><span class="Punctuation">)</span><span class="Punctuation">]</span></pre>
<h1><a class="toc-backref" id="see-also" href="#see-also">See also</a></h1><ul class="simple"><li><a class="reference external" href="sequtils.html">sequtils module</a> for working with the built-in seq type</li>
<li><a class="reference external" href="tables.html">tables module</a> for sorting tables</li>
</ul>
</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="since.html">since</a>, <a class="reference external" href="assertions.html">assertions</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="SortOrder">
<dt><pre><a href="algorithm.html#SortOrder"><span class="Identifier">SortOrder</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">Descending</span><span class="Other">,</span> <span class="Identifier">Ascending</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L52" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L52" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="*-procs-all">
<div id="*,int,SortOrder">
<dt><pre><span class="Keyword">proc</span> <a href="#%2A%2Cint%2CSortOrder"><span class="Identifier">`*`</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">;</span> <span class="Identifier">order</span><span class="Other">:</span> <a href="algorithm.html#SortOrder"><span class="Identifier">SortOrder</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Flips the sign of <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt> if <tt class="docutils literal"><span class="pre"><span class="Identifier">order</span> <span class="Operator">==</span> <span class="Identifier">Descending</span></span></tt>. If <tt class="docutils literal"><span class="pre"><span class="Identifier">order</span> <span class="Operator">==</span> <span class="Identifier">Ascending</span></span></tt> then <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt> is returned.</p>
<p><tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt> is supposed to be the result of a comparator, i.e.<p><tt class="docutils literal"><span class="pre"><span class="Operator">&lt;</span> <span class="DecNumber">0</span></span></tt> for <em>less than</em>,<br/><tt class="docutils literal"><span class="pre"><span class="Operator">==</span> <span class="DecNumber">0</span></span></tt> for <em>equal</em>,<br/><tt class="docutils literal"><span class="pre"><span class="Operator">&gt;</span> <span class="DecNumber">0</span></span></tt> for <em>greater than</em>.<br/></p></p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">assert</span> <span class="Operator">-</span><span class="DecNumber">123</span> <span class="Operator">*</span> <span class="Identifier">Descending</span> <span class="Operator">==</span> <span class="DecNumber">123</span>
<span class="Identifier">assert</span> <span class="DecNumber">123</span> <span class="Operator">*</span> <span class="Identifier">Descending</span> <span class="Operator">==</span> <span class="Operator">-</span><span class="DecNumber">123</span>
<span class="Identifier">assert</span> <span class="Operator">-</span><span class="DecNumber">123</span> <span class="Operator">*</span> <span class="Identifier">Ascending</span> <span class="Operator">==</span> <span class="Operator">-</span><span class="DecNumber">123</span>
<span class="Identifier">assert</span> <span class="DecNumber">123</span> <span class="Operator">*</span> <span class="Identifier">Ascending</span> <span class="Operator">==</span> <span class="DecNumber">123</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L55" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L55" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="binarySearch-procs-all">
<div id="binarySearch,openArray[T],K,proc(T,K)">
<dt><pre><span class="Keyword">proc</span> <a href="#binarySearch%2CopenArray%5BT%5D%2CK%2Cproc%28T%2CK%29"><span class="Identifier">binarySearch</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">K</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <span class="Identifier">K</span><span class="Other">;</span>
<span class="Identifier">cmp</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">y</span><span class="Other">:</span> <span class="Identifier">K</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">closure</span>.}<span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.
<span class="Identifier">effectsOf</span><span class="Other">:</span> <span class="Identifier">cmp</span>.}</pre></dt>
<dd>
<p>Binary search for <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> in <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt>. Return the index of <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> or -1 if not found. Assumes that <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt> is sorted according to <tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span></span></tt>.</p>
<p><tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span></span></tt> is the comparator function to use, the expected return values are the same as those of system.cmp.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">assert</span> <span class="Identifier">binarySearch</span><span class="Punctuation">(</span><span class="Punctuation">[</span><span class="StringLit">&quot;a&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;b&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;c&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;d&quot;</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="StringLit">&quot;d&quot;</span><span class="Punctuation">,</span> <span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">[</span><span class="Identifier">string</span><span class="Punctuation">]</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">3</span>
<span class="Identifier">assert</span> <span class="Identifier">binarySearch</span><span class="Punctuation">(</span><span class="Punctuation">[</span><span class="StringLit">&quot;a&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;b&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;c&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;d&quot;</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="StringLit">&quot;c&quot;</span><span class="Punctuation">,</span> <span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">[</span><span class="Identifier">string</span><span class="Punctuation">]</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">2</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L160" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L160" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="binarySearch,openArray[T],T">
<dt><pre><span class="Keyword">proc</span> <a href="#binarySearch%2CopenArray%5BT%5D%2CT"><span class="Identifier">binarySearch</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a></pre></dt>
<dd>
Binary search for <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> in <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt>. Return the index of <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> or -1 if not found. Assumes that <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt> is sorted.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">assert</span> <span class="Identifier">binarySearch</span><span class="Punctuation">(</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">4</span>
<span class="Identifier">assert</span> <span class="Identifier">binarySearch</span><span class="Punctuation">(</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">2</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L211" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L211" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="fill-procs-all">
<div id="fill,openArray[T],Natural,Natural,T">
<dt><pre><span class="Keyword">proc</span> <a href="#fill%2CopenArray%5BT%5D%2CNatural%2CNatural%2CT"><span class="Identifier">fill</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">first</span><span class="Other">,</span> <span class="Identifier">last</span><span class="Other">:</span> <a href="system.html#Natural"><span class="Identifier">Natural</span></a><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span></pre></dt>
<dd>
<p>Assigns <tt class="docutils literal"><span class="pre"><span class="Identifier">value</span></span></tt> to all elements of the slice <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span><span class="Punctuation">[</span><span class="Identifier">first</span><span class="Operator">..</span><span class="Identifier">last</span><span class="Punctuation">]</span></span></tt>.</p>
<p>If an invalid range is passed, it raises <tt class="docutils literal"><span class="pre"><span class="Identifier">IndexDefect</span></span></tt>.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span><span class="Punctuation">:</span> <span class="Identifier">array</span><span class="Punctuation">[</span><span class="DecNumber">6</span><span class="Punctuation">,</span> <span class="Identifier">int</span><span class="Punctuation">]</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">fill</span><span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">9</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="DecNumber">9</span><span class="Punctuation">,</span> <span class="DecNumber">9</span><span class="Punctuation">,</span> <span class="DecNumber">9</span><span class="Punctuation">,</span> <span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="DecNumber">0</span><span class="Punctuation">]</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">fill</span><span class="Punctuation">(</span><span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">7</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="DecNumber">9</span><span class="Punctuation">,</span> <span class="DecNumber">9</span><span class="Punctuation">,</span> <span class="DecNumber">7</span><span class="Punctuation">,</span> <span class="DecNumber">7</span><span class="Punctuation">,</span> <span class="DecNumber">7</span><span class="Punctuation">]</span>
<span class="Identifier">doAssertRaises</span><span class="Punctuation">(</span><span class="Identifier">IndexDefect</span><span class="Punctuation">,</span> <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">fill</span><span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">7</span><span class="Punctuation">,</span> <span class="DecNumber">9</span><span class="Punctuation">)</span><span class="Punctuation">)</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L77" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L77" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="fill,openArray[T],T">
<dt><pre><span class="Keyword">proc</span> <a href="#fill%2CopenArray%5BT%5D%2CT"><span class="Identifier">fill</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span></pre></dt>
<dd>
Assigns <tt class="docutils literal"><span class="pre"><span class="Identifier">value</span></span></tt> to all elements of the container <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt>.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span><span class="Punctuation">:</span> <span class="Identifier">array</span><span class="Punctuation">[</span><span class="DecNumber">6</span><span class="Punctuation">,</span> <span class="Identifier">int</span><span class="Punctuation">]</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">fill</span><span class="Punctuation">(</span><span class="DecNumber">9</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">9</span><span class="Punctuation">,</span> <span class="DecNumber">9</span><span class="Punctuation">,</span> <span class="DecNumber">9</span><span class="Punctuation">,</span> <span class="DecNumber">9</span><span class="Punctuation">,</span> <span class="DecNumber">9</span><span class="Punctuation">,</span> <span class="DecNumber">9</span><span class="Punctuation">]</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">fill</span><span class="Punctuation">(</span><span class="DecNumber">4</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">]</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L90" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L90" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="isSorted-procs-all">
<div id="isSorted,openArray[T],proc(T,T)">
<dt><pre><span class="Keyword">func</span> <a href="#isSorted%2CopenArray%5BT%5D%2Cproc%28T%2CT%29"><span class="Identifier">isSorted</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">cmp</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">closure</span>.}<span class="Other">;</span>
<span class="Identifier">order</span> <span class="Other">=</span> <a href="algorithm.html#SortOrder"><span class="Identifier">SortOrder</span></a><span class="Other">.</span><span class="Identifier">Ascending</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span class="Identifier">effectsOf</span><span class="Other">:</span> <span class="Identifier">cmp</span>.}</pre></dt>
<dd>
<p>Checks to see whether <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt> is already sorted in <tt class="docutils literal"><span class="pre"><span class="Identifier">order</span></span></tt> using <tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span></span></tt> for the comparison. The parameters are identical to <tt class="docutils literal"><span class="pre"><span class="Identifier">sort</span></span></tt>. Requires O(n) time.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#isSorted,openArray[T]">isSorted proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">let</span>
<span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">]</span>
<span class="Identifier">b</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span>
<span class="Identifier">c</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">]</span>
<span class="Identifier">d</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="StringLit">&quot;adam&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;brian&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;cat&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;dande&quot;</span><span class="Punctuation">]</span>
<span class="Identifier">e</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="StringLit">&quot;adam&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;dande&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;brian&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;cat&quot;</span><span class="Punctuation">]</span>
<span class="Identifier">assert</span> <span class="Identifier">isSorted</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">false</span>
<span class="Identifier">assert</span> <span class="Identifier">isSorted</span><span class="Punctuation">(</span><span class="Identifier">b</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">true</span>
<span class="Identifier">assert</span> <span class="Identifier">isSorted</span><span class="Punctuation">(</span><span class="Identifier">c</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">false</span>
<span class="Identifier">assert</span> <span class="Identifier">isSorted</span><span class="Punctuation">(</span><span class="Identifier">c</span><span class="Punctuation">,</span> <span class="Identifier">Descending</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">true</span>
<span class="Identifier">assert</span> <span class="Identifier">isSorted</span><span class="Punctuation">(</span><span class="Identifier">d</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">true</span>
<span class="Identifier">assert</span> <span class="Identifier">isSorted</span><span class="Punctuation">(</span><span class="Identifier">e</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">false</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L508" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L508" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="isSorted,openArray[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#isSorted%2CopenArray%5BT%5D"><span class="Identifier">isSorted</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">order</span> <span class="Other">=</span> <a href="algorithm.html#SortOrder"><span class="Identifier">SortOrder</span></a><span class="Other">.</span><span class="Identifier">Ascending</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a></pre></dt>
<dd>
<p>Shortcut version of <tt class="docutils literal"><span class="pre"><span class="Identifier">isSorted</span></span></tt> that uses <tt class="docutils literal"><span class="pre"><span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">[</span><span class="Identifier">T</span><span class="Punctuation">]</span></span></tt> as the comparison function.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#isSorted,openArray[T],proc(T,T)">isSorted func</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">let</span>
<span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">]</span>
<span class="Identifier">b</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span>
<span class="Identifier">c</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">]</span>
<span class="Identifier">d</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="StringLit">&quot;adam&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;brian&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;cat&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;dande&quot;</span><span class="Punctuation">]</span>
<span class="Identifier">e</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="StringLit">&quot;adam&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;dande&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;brian&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;cat&quot;</span><span class="Punctuation">]</span>
<span class="Identifier">assert</span> <span class="Identifier">isSorted</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">false</span>
<span class="Identifier">assert</span> <span class="Identifier">isSorted</span><span class="Punctuation">(</span><span class="Identifier">b</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">true</span>
<span class="Identifier">assert</span> <span class="Identifier">isSorted</span><span class="Punctuation">(</span><span class="Identifier">c</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">false</span>
<span class="Identifier">assert</span> <span class="Identifier">isSorted</span><span class="Punctuation">(</span><span class="Identifier">c</span><span class="Punctuation">,</span> <span class="Identifier">Descending</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">true</span>
<span class="Identifier">assert</span> <span class="Identifier">isSorted</span><span class="Punctuation">(</span><span class="Identifier">d</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">true</span>
<span class="Identifier">assert</span> <span class="Identifier">isSorted</span><span class="Punctuation">(</span><span class="Identifier">e</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">false</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L535" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L535" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="lowerBound-procs-all">
<div id="lowerBound,openArray[T],K,proc(T,K)">
<dt><pre><span class="Keyword">proc</span> <a href="#lowerBound%2CopenArray%5BT%5D%2CK%2Cproc%28T%2CK%29"><span class="Identifier">lowerBound</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">K</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <span class="Identifier">K</span><span class="Other">;</span>
<span class="Identifier">cmp</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">k</span><span class="Other">:</span> <span class="Identifier">K</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">closure</span>.}<span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.
<span class="Identifier">effectsOf</span><span class="Other">:</span> <span class="Identifier">cmp</span>.}</pre></dt>
<dd>
<p>Returns the index of the first element in <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt> that is not less than (i.e. greater or equal to) <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt>, or last if no such element is found. In other words if you have a sorted sequence and you call <tt class="docutils literal"><span class="pre"><span class="Identifier">insert</span><span class="Punctuation">(</span><span class="Identifier">thing</span><span class="Punctuation">,</span> <span class="Identifier">elm</span><span class="Punctuation">,</span> <span class="Identifier">lowerBound</span><span class="Punctuation">(</span><span class="Identifier">thing</span><span class="Punctuation">,</span> <span class="Identifier">elm</span><span class="Punctuation">)</span><span class="Punctuation">)</span></span></tt> the sequence will still be sorted. Assumes that <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt> is sorted according to <tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span></span></tt>.</p>
<p>If an invalid range is passed, it raises <tt class="docutils literal"><span class="pre"><span class="Identifier">IndexDefect</span></span></tt>.</p>
<p>This version uses <tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span></span></tt> to compare the elements. The expected return values are the same as those of <tt class="docutils literal"><span class="pre"><span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span></span></tt>.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#upperBound,openArray[T],K,proc(T,K)">upperBound proc</a> sorted by <tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span></span></tt> in the specified order</li>
<li><a class="reference external" href="#upperBound,openArray[T],T">upperBound proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">arr</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">6</span><span class="Punctuation">,</span> <span class="DecNumber">7</span><span class="Punctuation">,</span> <span class="DecNumber">8</span><span class="Punctuation">,</span> <span class="DecNumber">9</span><span class="Punctuation">]</span>
<span class="Identifier">assert</span> <span class="Identifier">arr</span><span class="Operator">.</span><span class="Identifier">lowerBound</span><span class="Punctuation">(</span><span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">2</span>
<span class="Identifier">assert</span> <span class="Identifier">arr</span><span class="Operator">.</span><span class="Identifier">lowerBound</span><span class="Punctuation">(</span><span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">3</span>
<span class="Identifier">assert</span> <span class="Identifier">arr</span><span class="Operator">.</span><span class="Identifier">lowerBound</span><span class="Punctuation">(</span><span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">3</span>
<span class="Identifier">arr</span><span class="Operator">.</span><span class="Identifier">insert</span><span class="Punctuation">(</span><span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="Identifier">arr</span><span class="Operator">.</span><span class="Identifier">lowerBound</span><span class="Punctuation">(</span><span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Punctuation">)</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">arr</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">6</span><span class="Punctuation">,</span> <span class="DecNumber">7</span><span class="Punctuation">,</span> <span class="DecNumber">8</span><span class="Punctuation">,</span> <span class="DecNumber">9</span><span class="Punctuation">]</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L222" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L222" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="lowerBound,openArray[T],T">
<dt><pre><span class="Keyword">proc</span> <a href="#lowerBound%2CopenArray%5BT%5D%2CT"><span class="Identifier">lowerBound</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a></pre></dt>
<dd>
<p>Returns the index of the first element in <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt> that is not less than (i.e. greater or equal to) <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt>, or last if no such element is found. In other words if you have a sorted sequence and you call <tt class="docutils literal"><span class="pre"><span class="Identifier">insert</span><span class="Punctuation">(</span><span class="Identifier">thing</span><span class="Punctuation">,</span> <span class="Identifier">elm</span><span class="Punctuation">,</span> <span class="Identifier">lowerBound</span><span class="Punctuation">(</span><span class="Identifier">thing</span><span class="Punctuation">,</span> <span class="Identifier">elm</span><span class="Punctuation">)</span><span class="Punctuation">)</span></span></tt> the sequence will still be sorted. Assumes that <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt> is sorted.</p>
<p>This version uses the default comparison function <tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span></span></tt>.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#upperBound,openArray[T],K,proc(T,K)">upperBound proc</a> sorted by <tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span></span></tt> in the specified order</li>
<li><a class="reference external" href="#upperBound,openArray[T],T">upperBound proc</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L258" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L258" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="merge-procs-all">
<div id="merge,seq[T],openArray[T],openArray[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#merge%2Cseq%5BT%5D%2CopenArray%5BT%5D%2CopenArray%5BT%5D"><span class="Identifier">merge</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">result</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<p>Shortcut version of <tt class="docutils literal"><span class="pre"><span class="Identifier">merge</span></span></tt> that uses <tt class="docutils literal"><span class="pre"><span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">[</span><span class="Identifier">T</span><span class="Punctuation">]</span></span></tt> as the comparison function.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#merge,seq[T],openArray[T],openArray[T],proc(T,T)">merge proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">let</span> <span class="Identifier">x</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">10</span><span class="Punctuation">,</span> <span class="DecNumber">15</span><span class="Punctuation">,</span> <span class="DecNumber">20</span><span class="Punctuation">,</span> <span class="DecNumber">25</span><span class="Punctuation">]</span>
<span class="Keyword">let</span> <span class="Identifier">y</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">50</span><span class="Punctuation">,</span> <span class="DecNumber">40</span><span class="Punctuation">,</span> <span class="DecNumber">30</span><span class="Punctuation">,</span> <span class="DecNumber">20</span><span class="Punctuation">,</span> <span class="DecNumber">10</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">sorted</span>
<span class="Keyword">var</span> <span class="Identifier">merged</span><span class="Punctuation">:</span> <span class="Identifier">seq</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span>
<span class="Identifier">merged</span><span class="Operator">.</span><span class="Identifier">merge</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">,</span> <span class="Identifier">y</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">merged</span><span class="Operator">.</span><span class="Identifier">isSorted</span>
<span class="Identifier">assert</span> <span class="Identifier">merged</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">10</span><span class="Punctuation">,</span> <span class="DecNumber">10</span><span class="Punctuation">,</span> <span class="DecNumber">15</span><span class="Punctuation">,</span> <span class="DecNumber">20</span><span class="Punctuation">,</span> <span class="DecNumber">20</span><span class="Punctuation">,</span> <span class="DecNumber">25</span><span class="Punctuation">,</span> <span class="DecNumber">30</span><span class="Punctuation">,</span> <span class="DecNumber">40</span><span class="Punctuation">,</span> <span class="DecNumber">50</span><span class="Punctuation">]</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L632" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L632" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="merge,seq[T],openArray[T],openArray[T],proc(T,T)">
<dt><pre><span class="Keyword">proc</span> <a href="#merge%2Cseq%5BT%5D%2CopenArray%5BT%5D%2CopenArray%5BT%5D%2Cproc%28T%2CT%29"><span class="Identifier">merge</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">result</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">cmp</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">closure</span>.}<span class="Other">)</span> {.<span class="Identifier">effectsOf</span><span class="Other">:</span> <span class="Identifier">cmp</span>.}</pre></dt>
<dd>
Merges two sorted <tt class="docutils literal"><span class="pre"><span class="Identifier">openArray</span></span></tt>. <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">y</span></span></tt> are assumed to be sorted. If you do not wish to provide your own <tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span></span></tt>, you may use <tt class="docutils literal"><span class="pre"><span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span></span></tt> or instead call the overloaded version of <tt class="docutils literal"><span class="pre"><span class="Identifier">merge</span></span></tt>, which uses <tt class="docutils literal"><span class="pre"><span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span></span></tt>.<div class="admonition admonition-info"><span class="admonition-info-text"><b>Note:</b></span>
The original data of <tt class="docutils literal"><span class="pre"><span class="Identifier">result</span></span></tt> is not cleared, new data is appended to <tt class="docutils literal"><span class="pre"><span class="Identifier">result</span></span></tt>.</div>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#merge,seq[T],openArray[T],openArray[T]">merge proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">let</span> <span class="Identifier">x</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">6</span><span class="Punctuation">]</span>
<span class="Keyword">let</span> <span class="Identifier">y</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">]</span>
<span class="Keyword">block</span><span class="Punctuation">:</span>
<span class="Keyword">var</span> <span class="Identifier">merged</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">7</span><span class="Punctuation">]</span> <span class="Comment"># new data is appended to merged sequence</span>
<span class="Identifier">merged</span><span class="Operator">.</span><span class="Identifier">merge</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">,</span> <span class="Identifier">y</span><span class="Punctuation">,</span> <span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">merged</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">7</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">6</span><span class="Punctuation">]</span>
<span class="Keyword">block</span><span class="Punctuation">:</span>
<span class="Keyword">var</span> <span class="Identifier">merged</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">7</span><span class="Punctuation">]</span> <span class="Comment"># if you only want new data, clear merged sequence first</span>
<span class="Identifier">merged</span><span class="Operator">.</span><span class="Identifier">setLen</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">)</span>
<span class="Identifier">merged</span><span class="Operator">.</span><span class="Identifier">merge</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">,</span> <span class="Identifier">y</span><span class="Punctuation">,</span> <span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">merged</span><span class="Operator">.</span><span class="Identifier">isSorted</span>
<span class="Identifier">assert</span> <span class="Identifier">merged</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">6</span><span class="Punctuation">]</span>
<span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">sugar</span>
<span class="Keyword">var</span> <span class="Identifier">res</span><span class="Punctuation">:</span> <span class="Identifier">seq</span><span class="Punctuation">[</span><span class="Punctuation">(</span><span class="Identifier">int</span><span class="Punctuation">,</span> <span class="Identifier">int</span><span class="Punctuation">)</span><span class="Punctuation">]</span>
<span class="Identifier">res</span><span class="Operator">.</span><span class="Identifier">merge</span><span class="Punctuation">(</span><span class="Punctuation">[</span><span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">)</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="Punctuation">[</span><span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">)</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="Identifier">b</span><span class="Punctuation">)</span> <span class="Operator">=&gt;</span> <span class="Identifier">a</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">]</span> <span class="Operator">-</span> <span class="Identifier">b</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">]</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">res</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">)</span><span class="Punctuation">]</span>
<span class="Identifier">assert</span> <span class="Identifier">seq</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">default</span><span class="Operator">.</span><span class="Identifier">dup</span><span class="Punctuation">(</span><span class="Identifier">merge</span><span class="Punctuation">(</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="Punctuation">[</span><span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">]</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">]</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L555" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L555" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="nextPermutation-procs-all">
<div id="nextPermutation,openArray[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#nextPermutation%2CopenArray%5BT%5D"><span class="Identifier">nextPermutation</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span class="Identifier">discardable</span>.}</pre></dt>
<dd>
<p>Calculates the next lexicographic permutation, directly modifying <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt>. The result is whether a permutation happened, otherwise we have reached the last-ordered permutation.</p>
<p>If you start with an unsorted array/seq, the repeated permutations will <strong>not</strong> give you all permutations but stop with the last.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#prevPermutation,openArray[T]">prevPermutation proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">]</span>
<span class="Identifier">assert</span> <span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">nextPermutation</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">true</span>
<span class="Identifier">assert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">]</span>
<span class="Identifier">assert</span> <span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">nextPermutation</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">true</span>
<span class="Identifier">assert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">]</span>
<span class="Identifier">assert</span> <span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">prevPermutation</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">true</span>
<span class="Identifier">assert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">]</span>
<span class="Identifier">v</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">0</span><span class="Punctuation">]</span>
<span class="Identifier">assert</span> <span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">nextPermutation</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">false</span>
<span class="Identifier">assert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">0</span><span class="Punctuation">]</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L684" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L684" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="prevPermutation-procs-all">
<div id="prevPermutation,openArray[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#prevPermutation%2CopenArray%5BT%5D"><span class="Identifier">prevPermutation</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span class="Identifier">discardable</span>.}</pre></dt>
<dd>
<p>Calculates the previous lexicographic permutation, directly modifying <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt>. The result is whether a permutation happened, otherwise we have reached the first-ordered permutation.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#nextPermutation,openArray[T]">nextPermutation proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">]</span>
<span class="Identifier">assert</span> <span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">prevPermutation</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">false</span>
<span class="Identifier">assert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">]</span>
<span class="Identifier">assert</span> <span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">nextPermutation</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">true</span>
<span class="Identifier">assert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">]</span>
<span class="Identifier">assert</span> <span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">prevPermutation</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">true</span>
<span class="Identifier">assert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">]</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L724" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L724" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="product-procs-all">
<div id="product,openArray[seq[T]]">
<dt><pre><span class="Keyword">proc</span> <a href="#product%2CopenArray%5Bseq%5BT%5D%5D"><span class="Identifier">product</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">]</span></pre></dt>
<dd>
Produces the Cartesian product of the array. Every element of the result is a combination of one element from each seq in <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt>, with the ith element coming from <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span><span class="Punctuation">[</span><span class="Identifier">i</span><span class="Punctuation">]</span></span></tt>.<div class="admonition admonition-warning"><span class="admonition-warning-text"><b>Warning:</b></span>
complexity may explode.</div>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">assert</span> <span class="Identifier">product</span><span class="Punctuation">(</span><span class="Operator">@</span><span class="Punctuation">[</span><span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">2</span><span class="Punctuation">]</span><span class="Punctuation">]</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">]</span><span class="Punctuation">]</span>
<span class="Identifier">assert</span> <span class="Identifier">product</span><span class="Punctuation">(</span><span class="Operator">@</span><span class="Punctuation">[</span><span class="Operator">@</span><span class="Punctuation">[</span><span class="StringLit">&quot;A&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;K&quot;</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="StringLit">&quot;Q&quot;</span><span class="Punctuation">]</span><span class="Punctuation">]</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="Operator">@</span><span class="Punctuation">[</span><span class="StringLit">&quot;K&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;Q&quot;</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="StringLit">&quot;A&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;Q&quot;</span><span class="Punctuation">]</span><span class="Punctuation">]</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L647" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L647" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="reverse-procs-all">
<div id="reverse,openArray[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#reverse%2CopenArray%5BT%5D"><span class="Identifier">reverse</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
<dd>
<p>Reverses the contents of the container <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt>.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#reversed,openArray[T],Natural,int">reversed proc</a> reverse a slice and returns a <tt class="docutils literal"><span class="pre"><span class="Identifier">seq</span><span class="Punctuation">[</span><span class="Identifier">T</span><span class="Punctuation">]</span></span></tt></li>
<li><a class="reference external" href="#reversed,openArray[T]">reversed proc</a> reverse and returns a <tt class="docutils literal"><span class="pre"><span class="Identifier">seq</span><span class="Punctuation">[</span><span class="Identifier">T</span><span class="Punctuation">]</span></span></tt></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">6</span><span class="Punctuation">]</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">reverse</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">6</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">]</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">reverse</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">6</span><span class="Punctuation">]</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L123" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L123" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="reverse,openArray[T],Natural,Natural">
<dt><pre><span class="Keyword">proc</span> <a href="#reverse%2CopenArray%5BT%5D%2CNatural%2CNatural"><span class="Identifier">reverse</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">first</span><span class="Other">,</span> <span class="Identifier">last</span><span class="Other">:</span> <a href="system.html#Natural"><span class="Identifier">Natural</span></a><span class="Other">)</span></pre></dt>
<dd>
<p>Reverses the slice <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span><span class="Punctuation">[</span><span class="Identifier">first</span><span class="Operator">..</span><span class="Identifier">last</span><span class="Punctuation">]</span></span></tt>.</p>
<p>If an invalid range is passed, it raises <tt class="docutils literal"><span class="pre"><span class="Identifier">IndexDefect</span></span></tt>.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#reversed,openArray[T],Natural,int">reversed proc</a> reverse a slice and returns a <tt class="docutils literal"><span class="pre"><span class="Identifier">seq</span><span class="Punctuation">[</span><span class="Identifier">T</span><span class="Punctuation">]</span></span></tt></li>
<li><a class="reference external" href="#reversed,openArray[T]">reversed proc</a> reverse and returns a <tt class="docutils literal"><span class="pre"><span class="Identifier">seq</span><span class="Punctuation">[</span><span class="Identifier">T</span><span class="Punctuation">]</span></span></tt></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">6</span><span class="Punctuation">]</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">reverse</span><span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">6</span><span class="Punctuation">]</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">reverse</span><span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">6</span><span class="Punctuation">]</span>
<span class="Identifier">doAssertRaises</span><span class="Punctuation">(</span><span class="Identifier">IndexDefect</span><span class="Punctuation">,</span> <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">reverse</span><span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">7</span><span class="Punctuation">)</span><span class="Punctuation">)</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L101" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L101" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="reversed-procs-all">
<div id="reversed,openArray[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#reversed%2CopenArray%5BT%5D"><span class="Identifier">reversed</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<p>Returns the elements of <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt> in reverse order.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#reverse,openArray[T]">reverse proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">assert</span> <span class="Punctuation">[</span><span class="DecNumber">10</span><span class="Punctuation">,</span> <span class="DecNumber">11</span><span class="Punctuation">,</span> <span class="DecNumber">12</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">reversed</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">12</span><span class="Punctuation">,</span> <span class="DecNumber">11</span><span class="Punctuation">,</span> <span class="DecNumber">10</span><span class="Punctuation">]</span>
<span class="Identifier">assert</span> <span class="Identifier">seq</span><span class="Punctuation">[</span><span class="Identifier">string</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">default</span><span class="Operator">.</span><span class="Identifier">reversed</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="Punctuation">]</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L138" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L138" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="reversed,openArray[T],Natural,int">
<dt><pre><span class="Keyword">proc</span> <a href="#reversed%2CopenArray%5BT%5D%2CNatural%2Cint"><span class="Identifier">reversed</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">first</span><span class="Other">:</span> <a href="system.html#Natural"><span class="Identifier">Natural</span></a><span class="Other">;</span> <span class="Identifier">last</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span>
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">&quot;use: `reversed(toOpenArray(a, first, last))`&quot;</span></span>.}</pre></dt>
<dd>
<div class="deprecation-message">
<b>Deprecated:</b> use: `reversed(toOpenArray(a, first, last))`
</div>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L151" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L151" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="rotatedLeft-procs-all">
<div id="rotatedLeft,openArray[T],int">
<dt><pre><span class="Keyword">proc</span> <a href="#rotatedLeft%2CopenArray%5BT%5D%2Cint"><span class="Identifier">rotatedLeft</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">arg</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">dist</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span></pre></dt>
<dd>
<p>Same as <tt class="docutils literal"><span class="pre"><span class="Identifier">rotateLeft</span></span></tt>, just with the difference that it does not modify the argument. It creates a new <tt class="docutils literal"><span class="pre"><span class="Identifier">seq</span></span></tt> instead.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#rotateLeft,openArray[T],int">rotateLeft proc</a> for the in-place version of this proc</li>
<li><a class="reference external" href="#rotatedLeft,openArray[T],HSlice[int,int],int">rotatedLeft proc</a> for a version which rotates a range</li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span>
<span class="Identifier">a</span> <span class="Operator">=</span> <span class="Identifier">rotatedLeft</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">]</span>
<span class="Identifier">a</span> <span class="Operator">=</span> <span class="Identifier">rotatedLeft</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">]</span>
<span class="Identifier">a</span> <span class="Operator">=</span> <span class="Identifier">rotatedLeft</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="Operator">-</span><span class="DecNumber">6</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L901" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L901" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="rotatedLeft,openArray[T],HSlice[int,int],int">
<dt><pre><span class="Keyword">proc</span> <a href="#rotatedLeft%2CopenArray%5BT%5D%2CHSlice%5Bint%2Cint%5D%2Cint"><span class="Identifier">rotatedLeft</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">arg</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">slice</span><span class="Other">:</span> <a href="system.html#HSlice"><span class="Identifier">HSlice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">,</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">dist</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span>
<span class="Identifier">T</span><span class="Other">]</span></pre></dt>
<dd>
<p>Same as <tt class="docutils literal"><span class="pre"><span class="Identifier">rotateLeft</span></span></tt>, just with the difference that it does not modify the argument. It creates a new <tt class="docutils literal"><span class="pre"><span class="Identifier">seq</span></span></tt> instead.</p>
<p>Elements outside of <tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span></span></tt> will be left unchanged. If an invalid range (<tt class="docutils literal"><span class="pre"><span class="Identifier">HSlice</span></span></tt>) is passed, it raises <tt class="docutils literal"><span class="pre"><span class="Identifier">IndexDefect</span></span></tt>.</p>
<dl class="docutils"><dt><tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span></span></tt></dt>
<dd>The indices of the element range that should be rotated.</dd>
<dt><tt class="docutils literal"><span class="pre"><span class="Identifier">dist</span></span></tt></dt>
<dd>The distance in amount of elements that the data should be rotated. Can be negative, can be any number.</dd>
</dl>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#rotateLeft,openArray[T],HSlice[int,int],int">rotateLeft proc</a> for the in-place version of this proc</li>
<li><a class="reference external" href="#rotatedLeft,openArray[T],int">rotatedLeft proc</a> for a version which rotates the whole container</li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span>
<span class="Identifier">a</span> <span class="Operator">=</span> <span class="Identifier">rotatedLeft</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="DecNumber">1</span> <span class="Operator">..</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">]</span>
<span class="Identifier">a</span> <span class="Operator">=</span> <span class="Identifier">rotatedLeft</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="DecNumber">1</span> <span class="Operator">..</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">]</span>
<span class="Identifier">a</span> <span class="Operator">=</span> <span class="Identifier">rotatedLeft</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="DecNumber">1</span> <span class="Operator">..</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="Operator">-</span><span class="DecNumber">2</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">]</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L871" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L871" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="rotateLeft-procs-all">
<div id="rotateLeft,openArray[T],int">
<dt><pre><span class="Keyword">proc</span> <a href="#rotateLeft%2CopenArray%5BT%5D%2Cint"><span class="Identifier">rotateLeft</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">arg</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">dist</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">discardable</span>.}</pre></dt>
<dd>
<p>Same as <tt class="docutils literal"><span class="pre"><span class="Identifier">rotateLeft</span></span></tt>, but with default arguments for slice, so that this procedure operates on the entire <tt class="docutils literal"><span class="pre"><span class="Identifier">arg</span></span></tt>, and not just on a part of it.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#rotateLeft,openArray[T],HSlice[int,int],int">rotateLeft proc</a> for a version which rotates a range</li>
<li><a class="reference external" href="#rotatedLeft,openArray[T],int">rotatedLeft proc</a> for a version which returns a <tt class="docutils literal"><span class="pre"><span class="Identifier">seq</span><span class="Punctuation">[</span><span class="Identifier">T</span><span class="Punctuation">]</span></span></tt></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">rotateLeft</span><span class="Punctuation">(</span><span class="DecNumber">2</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">]</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">rotateLeft</span><span class="Punctuation">(</span><span class="DecNumber">4</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">]</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">rotateLeft</span><span class="Punctuation">(</span><span class="Operator">-</span><span class="DecNumber">6</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L851" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L851" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="rotateLeft,openArray[T],HSlice[int,int],int">
<dt><pre><span class="Keyword">proc</span> <a href="#rotateLeft%2CopenArray%5BT%5D%2CHSlice%5Bint%2Cint%5D%2Cint"><span class="Identifier">rotateLeft</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">arg</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">slice</span><span class="Other">:</span> <a href="system.html#HSlice"><span class="Identifier">HSlice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">,</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">dist</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.
<span class="Identifier">discardable</span>.}</pre></dt>
<dd>
Performs a left rotation on a range of elements. If you want to rotate right, use a negative <tt class="docutils literal"><span class="pre"><span class="Identifier">dist</span></span></tt>. Specifically, <tt class="docutils literal"><span class="pre"><span class="Identifier">rotateLeft</span></span></tt> rotates the elements at <tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span></span></tt> by <tt class="docutils literal"><span class="pre"><span class="Identifier">dist</span></span></tt> positions.<p>The element at index <tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span><span class="Operator">.</span><span class="Identifier">a</span> <span class="Operator">+</span> <span class="Identifier">dist</span></span></tt> will be at index <tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span><span class="Operator">.</span><span class="Identifier">a</span></span></tt>.<br/>The element at index <tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span><span class="Operator">.</span><span class="Identifier">b</span></span></tt> will be at <tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span><span class="Operator">.</span><span class="Identifier">a</span> <span class="Operator">+</span> <span class="Identifier">dist</span> <span class="Operator">-</span> <span class="DecNumber">1</span></span></tt>.<br/>The element at index <tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span><span class="Operator">.</span><span class="Identifier">a</span></span></tt> will be at <tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span><span class="Operator">.</span><span class="Identifier">b</span> <span class="Operator">+</span> <span class="DecNumber">1</span> <span class="Operator">-</span> <span class="Identifier">dist</span></span></tt>.<br/>The element at index <tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span><span class="Operator">.</span><span class="Identifier">a</span> <span class="Operator">+</span> <span class="Identifier">dist</span> <span class="Operator">-</span> <span class="DecNumber">1</span></span></tt> will be at <tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span><span class="Operator">.</span><span class="Identifier">b</span></span></tt>.<br/></p><p>Elements outside of <tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span></span></tt> will be left unchanged. The time complexity is linear to <tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span><span class="Operator">.</span><span class="Identifier">b</span> <span class="Operator">-</span> <span class="Identifier">slice</span><span class="Operator">.</span><span class="Identifier">a</span> <span class="Operator">+</span> <span class="DecNumber">1</span></span></tt>. If an invalid range (<tt class="docutils literal"><span class="pre"><span class="Identifier">HSlice</span></span></tt>) is passed, it raises <tt class="docutils literal"><span class="pre"><span class="Identifier">IndexDefect</span></span></tt>.</p>
<dl class="docutils"><dt><tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span></span></tt></dt>
<dd>The indices of the element range that should be rotated.</dd>
<dt><tt class="docutils literal"><span class="pre"><span class="Identifier">dist</span></span></tt></dt>
<dd>The distance in amount of elements that the data should be rotated. Can be negative, can be any number.</dd>
</dl>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#rotateLeft,openArray[T],int">rotateLeft proc</a> for a version which rotates the whole container</li>
<li><a class="reference external" href="#rotatedLeft,openArray[T],HSlice[int,int],int">rotatedLeft proc</a> for a version which returns a <tt class="docutils literal"><span class="pre"><span class="Identifier">seq</span><span class="Punctuation">[</span><span class="Identifier">T</span><span class="Punctuation">]</span></span></tt></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">rotateLeft</span><span class="Punctuation">(</span><span class="DecNumber">1</span> <span class="Operator">..</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">rotateLeft</span><span class="Punctuation">(</span><span class="DecNumber">1</span> <span class="Operator">..</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span>
<span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">rotateLeft</span><span class="Punctuation">(</span><span class="DecNumber">1</span> <span class="Operator">..</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="Operator">-</span><span class="DecNumber">3</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span>
<span class="Identifier">doAssertRaises</span><span class="Punctuation">(</span><span class="Identifier">IndexDefect</span><span class="Punctuation">,</span> <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">rotateLeft</span><span class="Punctuation">(</span><span class="DecNumber">1</span> <span class="Operator">..</span> <span class="DecNumber">7</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">)</span><span class="Punctuation">)</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L813" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L813" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="sort-procs-all">
<div id="sort,openArray[T],proc(T,T)">
<dt><pre><span class="Keyword">func</span> <a href="#sort%2CopenArray%5BT%5D%2Cproc%28T%2CT%29"><span class="Identifier">sort</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">cmp</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">closure</span>.}<span class="Other">;</span>
<span class="Identifier">order</span> <span class="Other">=</span> <a href="algorithm.html#SortOrder"><span class="Identifier">SortOrder</span></a><span class="Other">.</span><span class="Identifier">Ascending</span><span class="Other">)</span> {.<span class="Identifier">effectsOf</span><span class="Other">:</span> <span class="Identifier">cmp</span>.}</pre></dt>
<dd>
<p>Default Nim sort (an implementation of merge sort). The sorting is guaranteed to be stable (that is, equal elements stay in the same order) and the worst case is guaranteed to be O(n log n). Sorts by <tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span></span></tt> in the specified <tt class="docutils literal"><span class="pre"><span class="Identifier">order</span></span></tt>.</p>
<p>The current implementation uses an iterative mergesort to achieve this. It uses a temporary sequence of length <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">len</span> <span class="Keyword">div</span> <span class="DecNumber">2</span></span></tt>. If you do not wish to provide your own <tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span></span></tt>, you may use <tt class="docutils literal"><span class="pre"><span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span></span></tt> or instead call the overloaded version of <tt class="docutils literal"><span class="pre"><span class="Identifier">sort</span></span></tt>, which uses <tt class="docutils literal"><span class="pre"><span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span></span></tt>.</p>
<p><pre class="listing"><span class="Identifier">sort</span><span class="Punctuation">(</span><span class="Identifier">myIntArray</span><span class="Punctuation">,</span> <span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Punctuation">)</span>
<span class="Comment"># do not use cmp[string] here as we want to use the specialized</span>
<span class="Comment"># overload:</span>
<span class="Identifier">sort</span><span class="Punctuation">(</span><span class="Identifier">myStrArray</span><span class="Punctuation">,</span> <span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">)</span></pre></p>
<p>You can inline adhoc comparison procs with the <a class="reference external" href="manual.html#procedures-do-notation">do notation</a>. Example:</p>
<p><pre class="listing"><span class="Identifier">people</span><span class="Operator">.</span><span class="Identifier">sort</span> <span class="Keyword">do</span> <span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">,</span> <span class="Identifier">y</span><span class="Punctuation">:</span> <span class="Identifier">Person</span><span class="Punctuation">)</span> <span class="Operator">-&gt;</span> <span class="Identifier">int</span><span class="Punctuation">:</span>
<span class="Identifier">result</span> <span class="Operator">=</span> <span class="Identifier">cmp</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Operator">.</span><span class="Identifier">surname</span><span class="Punctuation">,</span> <span class="Identifier">y</span><span class="Operator">.</span><span class="Identifier">surname</span><span class="Punctuation">)</span>
<span class="Keyword">if</span> <span class="Identifier">result</span> <span class="Operator">==</span> <span class="DecNumber">0</span><span class="Punctuation">:</span>
<span class="Identifier">result</span> <span class="Operator">=</span> <span class="Identifier">cmp</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Operator">.</span><span class="Identifier">name</span><span class="Punctuation">,</span> <span class="Identifier">y</span><span class="Operator">.</span><span class="Identifier">name</span><span class="Punctuation">)</span></pre></p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#sort,openArray[T]">sort proc</a></li>
<li><a class="reference external" href="#sorted,openArray[T],proc(T,T)">sorted proc</a> sorted by <tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span></span></tt> in the specified order</li>
<li><a class="reference external" href="#sorted,openArray[T]">sorted proc</a></li>
<li><a class="reference external" href="#sortedByIt.t,untyped,untyped">sortedByIt template</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">d</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="StringLit">&quot;boo&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;fo&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;barr&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;qux&quot;</span><span class="Punctuation">]</span>
<span class="Keyword">proc</span> <span class="Identifier">myCmp</span><span class="Punctuation">(</span><span class="Identifier">x</span><span class="Punctuation">,</span> <span class="Identifier">y</span><span class="Punctuation">:</span> <span class="Identifier">string</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">int</span> <span class="Operator">=</span>
<span class="Keyword">if</span> <span class="Identifier">x</span><span class="Operator">.</span><span class="Identifier">len</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator">&gt;</span> <span class="Identifier">y</span><span class="Operator">.</span><span class="Identifier">len</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Keyword">or</span> <span class="Identifier">x</span><span class="Operator">.</span><span class="Identifier">len</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">y</span><span class="Operator">.</span><span class="Identifier">len</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="DecNumber">1</span>
<span class="Keyword">else</span><span class="Punctuation">:</span> <span class="Operator">-</span><span class="DecNumber">1</span>
<span class="Identifier">sort</span><span class="Punctuation">(</span><span class="Identifier">d</span><span class="Punctuation">,</span> <span class="Identifier">myCmp</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">d</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="StringLit">&quot;fo&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;qux&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;boo&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;barr&quot;</span><span class="Punctuation">]</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L369" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L369" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="sort,openArray[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#sort%2CopenArray%5BT%5D"><span class="Identifier">sort</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">order</span> <span class="Other">=</span> <a href="algorithm.html#SortOrder"><span class="Identifier">SortOrder</span></a><span class="Other">.</span><span class="Identifier">Ascending</span><span class="Other">)</span></pre></dt>
<dd>
<p>Shortcut version of <tt class="docutils literal"><span class="pre"><span class="Identifier">sort</span></span></tt> that uses <tt class="docutils literal"><span class="pre"><span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">[</span><span class="Identifier">T</span><span class="Punctuation">]</span></span></tt> as the comparison function.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#sort,openArray[T],proc(T,T)">sort func</a></li>
<li><a class="reference external" href="#sorted,openArray[T],proc(T,T)">sorted proc</a> sorted by <tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span></span></tt> in the specified order</li>
<li><a class="reference external" href="#sorted,openArray[T]">sorted proc</a></li>
<li><a class="reference external" href="#sortedByIt.t,untyped,untyped">sortedByIt template</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L422" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L422" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="sorted-procs-all">
<div id="sorted,openArray[T],proc(T,T)">
<dt><pre><span class="Keyword">proc</span> <a href="#sorted%2CopenArray%5BT%5D%2Cproc%28T%2CT%29"><span class="Identifier">sorted</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">cmp</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">closure</span>.}<span class="Other">;</span>
<span class="Identifier">order</span> <span class="Other">=</span> <a href="algorithm.html#SortOrder"><span class="Identifier">SortOrder</span></a><span class="Other">.</span><span class="Identifier">Ascending</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> {.<span class="Identifier">effectsOf</span><span class="Other">:</span> <span class="Identifier">cmp</span>.}</pre></dt>
<dd>
<p>Returns <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt> sorted by <tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span></span></tt> in the specified <tt class="docutils literal"><span class="pre"><span class="Identifier">order</span></span></tt>.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#sort,openArray[T],proc(T,T)">sort func</a></li>
<li><a class="reference external" href="#sort,openArray[T]">sort proc</a></li>
<li><a class="reference external" href="#sortedByIt.t,untyped,untyped">sortedByIt template</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">let</span>
<span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">]</span>
<span class="Identifier">b</span> <span class="Operator">=</span> <span class="Identifier">sorted</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Punctuation">)</span>
<span class="Identifier">c</span> <span class="Operator">=</span> <span class="Identifier">sorted</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="Identifier">Descending</span><span class="Punctuation">)</span>
<span class="Identifier">d</span> <span class="Operator">=</span> <span class="Identifier">sorted</span><span class="Punctuation">(</span><span class="Punctuation">[</span><span class="StringLit">&quot;adam&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;dande&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;brian&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;cat&quot;</span><span class="Punctuation">]</span><span class="Punctuation">,</span> <span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">[</span><span class="Identifier">string</span><span class="Punctuation">]</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">b</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span>
<span class="Identifier">assert</span> <span class="Identifier">c</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">]</span>
<span class="Identifier">assert</span> <span class="Identifier">d</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="StringLit">&quot;adam&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;brian&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;cat&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;dande&quot;</span><span class="Punctuation">]</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L432" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L432" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="sorted,openArray[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#sorted%2CopenArray%5BT%5D"><span class="Identifier">sorted</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">order</span> <span class="Other">=</span> <a href="algorithm.html#SortOrder"><span class="Identifier">SortOrder</span></a><span class="Other">.</span><span class="Identifier">Ascending</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span></pre></dt>
<dd>
<p>Shortcut version of <tt class="docutils literal"><span class="pre"><span class="Identifier">sorted</span></span></tt> that uses <tt class="docutils literal"><span class="pre"><span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">[</span><span class="Identifier">T</span><span class="Punctuation">]</span></span></tt> as the comparison function.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#sort,openArray[T],proc(T,T)">sort func</a></li>
<li><a class="reference external" href="#sort,openArray[T]">sort proc</a></li>
<li><a class="reference external" href="#sortedByIt.t,untyped,untyped">sortedByIt template</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">let</span>
<span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">]</span>
<span class="Identifier">b</span> <span class="Operator">=</span> <span class="Identifier">sorted</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span>
<span class="Identifier">c</span> <span class="Operator">=</span> <span class="Identifier">sorted</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="Identifier">Descending</span><span class="Punctuation">)</span>
<span class="Identifier">d</span> <span class="Operator">=</span> <span class="Identifier">sorted</span><span class="Punctuation">(</span><span class="Punctuation">[</span><span class="StringLit">&quot;adam&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;dande&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;brian&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;cat&quot;</span><span class="Punctuation">]</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">b</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span>
<span class="Identifier">assert</span> <span class="Identifier">c</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">]</span>
<span class="Identifier">assert</span> <span class="Identifier">d</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="StringLit">&quot;adam&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;brian&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;cat&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;dande&quot;</span><span class="Punctuation">]</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L454" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L454" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="upperBound-procs-all">
<div id="upperBound,openArray[T],K,proc(T,K)">
<dt><pre><span class="Keyword">proc</span> <a href="#upperBound%2CopenArray%5BT%5D%2CK%2Cproc%28T%2CK%29"><span class="Identifier">upperBound</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">K</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <span class="Identifier">K</span><span class="Other">;</span>
<span class="Identifier">cmp</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">k</span><span class="Other">:</span> <span class="Identifier">K</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">closure</span>.}<span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.
<span class="Identifier">effectsOf</span><span class="Other">:</span> <span class="Identifier">cmp</span>.}</pre></dt>
<dd>
<p>Returns the index of the first element in <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt> that is greater than <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt>, or last if no such element is found. In other words if you have a sorted sequence and you call <tt class="docutils literal"><span class="pre"><span class="Identifier">insert</span><span class="Punctuation">(</span><span class="Identifier">thing</span><span class="Punctuation">,</span> <span class="Identifier">elm</span><span class="Punctuation">,</span> <span class="Identifier">upperBound</span><span class="Punctuation">(</span><span class="Identifier">thing</span><span class="Punctuation">,</span> <span class="Identifier">elm</span><span class="Punctuation">)</span><span class="Punctuation">)</span></span></tt> the sequence will still be sorted. Assumes that <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt> is sorted according to <tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span></span></tt>.</p>
<p>If an invalid range is passed, it raises <tt class="docutils literal"><span class="pre"><span class="Identifier">IndexDefect</span></span></tt>.</p>
<p>This version uses <tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span></span></tt> to compare the elements. The expected return values are the same as those of <tt class="docutils literal"><span class="pre"><span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span></span></tt>.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#lowerBound,openArray[T],K,proc(T,K)">lowerBound proc</a> sorted by <tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span></span></tt> in the specified order</li>
<li><a class="reference external" href="#lowerBound,openArray[T],T">lowerBound proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">arr</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">6</span><span class="Punctuation">,</span> <span class="DecNumber">7</span><span class="Punctuation">,</span> <span class="DecNumber">8</span><span class="Punctuation">,</span> <span class="DecNumber">9</span><span class="Punctuation">]</span>
<span class="Identifier">assert</span> <span class="Identifier">arr</span><span class="Operator">.</span><span class="Identifier">upperBound</span><span class="Punctuation">(</span><span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">2</span>
<span class="Identifier">assert</span> <span class="Identifier">arr</span><span class="Operator">.</span><span class="Identifier">upperBound</span><span class="Punctuation">(</span><span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">3</span>
<span class="Identifier">assert</span> <span class="Identifier">arr</span><span class="Operator">.</span><span class="Identifier">upperBound</span><span class="Punctuation">(</span><span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">3</span>
<span class="Identifier">arr</span><span class="Operator">.</span><span class="Identifier">insert</span><span class="Punctuation">(</span><span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="Identifier">arr</span><span class="Operator">.</span><span class="Identifier">upperBound</span><span class="Punctuation">(</span><span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="Identifier">system</span><span class="Operator">.</span><span class="Identifier">cmp</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Punctuation">)</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">arr</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">6</span><span class="Punctuation">,</span> <span class="DecNumber">7</span><span class="Punctuation">,</span> <span class="DecNumber">8</span><span class="Punctuation">,</span> <span class="DecNumber">9</span><span class="Punctuation">]</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L272" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L272" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="upperBound,openArray[T],T">
<dt><pre><span class="Keyword">proc</span> <a href="#upperBound%2CopenArray%5BT%5D%2CT"><span class="Identifier">upperBound</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a></pre></dt>
<dd>
<p>Returns the index of the first element in <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt> that is greater than <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt>, or last if no such element is found. In other words if you have a sorted sequence and you call <tt class="docutils literal"><span class="pre"><span class="Identifier">insert</span><span class="Punctuation">(</span><span class="Identifier">thing</span><span class="Punctuation">,</span> <span class="Identifier">elm</span><span class="Punctuation">,</span> <span class="Identifier">upperBound</span><span class="Punctuation">(</span><span class="Identifier">thing</span><span class="Punctuation">,</span> <span class="Identifier">elm</span><span class="Punctuation">)</span><span class="Punctuation">)</span></span></tt> the sequence will still be sorted. Assumes that <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt> is sorted.</p>
<p>This version uses the default comparison function <tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span></span></tt>.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#lowerBound,openArray[T],K,proc(T,K)">lowerBound proc</a> sorted by <tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span></span></tt> in the specified order</li>
<li><a class="reference external" href="#lowerBound,openArray[T],T">lowerBound proc</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L308" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L308" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="sortedByIt-templates-all">
<div id="sortedByIt.t,untyped,untyped">
<dt><pre><span class="Keyword">template</span> <a href="#sortedByIt.t%2Cuntyped%2Cuntyped"><span class="Identifier">sortedByIt</span></a><span class="Other">(</span><span class="Identifier">seq1</span><span class="Other">,</span> <span class="Identifier">op</span><span class="Other">:</span> <a href="system.html#untyped"><span class="Identifier">untyped</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#untyped"><span class="Identifier">untyped</span></a></pre></dt>
<dd>
<p>Convenience template around the <tt class="docutils literal"><span class="pre"><span class="Identifier">sorted</span></span></tt> proc to reduce typing.</p>
<p>The template injects the <tt class="docutils literal"><span class="pre"><span class="Identifier">it</span></span></tt> variable which you can use directly in an expression.</p>
<p>Because the underlying <tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> is defined for tuples you can also do a nested sort.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#sort,openArray[T],proc(T,T)">sort func</a></li>
<li><a class="reference external" href="#sort,openArray[T]">sort proc</a></li>
<li><a class="reference external" href="#sorted,openArray[T],proc(T,T)">sorted proc</a> sorted by <tt class="docutils literal"><span class="pre"><span class="Identifier">cmp</span></span></tt> in the specified order</li>
<li><a class="reference external" href="#sorted,openArray[T]">sorted proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">type</span> <span class="Identifier">Person</span> <span class="Operator">=</span> <span class="Keyword">tuple</span><span class="Punctuation">[</span><span class="Identifier">name</span><span class="Punctuation">:</span> <span class="Identifier">string</span><span class="Punctuation">,</span> <span class="Identifier">age</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">]</span>
<span class="Keyword">var</span>
<span class="Identifier">p1</span><span class="Punctuation">:</span> <span class="Identifier">Person</span> <span class="Operator">=</span> <span class="Punctuation">(</span><span class="Identifier">name</span><span class="Punctuation">:</span> <span class="StringLit">&quot;p1&quot;</span><span class="Punctuation">,</span> <span class="Identifier">age</span><span class="Punctuation">:</span> <span class="DecNumber">60</span><span class="Punctuation">)</span>
<span class="Identifier">p2</span><span class="Punctuation">:</span> <span class="Identifier">Person</span> <span class="Operator">=</span> <span class="Punctuation">(</span><span class="Identifier">name</span><span class="Punctuation">:</span> <span class="StringLit">&quot;p2&quot;</span><span class="Punctuation">,</span> <span class="Identifier">age</span><span class="Punctuation">:</span> <span class="DecNumber">20</span><span class="Punctuation">)</span>
<span class="Identifier">p3</span><span class="Punctuation">:</span> <span class="Identifier">Person</span> <span class="Operator">=</span> <span class="Punctuation">(</span><span class="Identifier">name</span><span class="Punctuation">:</span> <span class="StringLit">&quot;p3&quot;</span><span class="Punctuation">,</span> <span class="Identifier">age</span><span class="Punctuation">:</span> <span class="DecNumber">30</span><span class="Punctuation">)</span>
<span class="Identifier">p4</span><span class="Punctuation">:</span> <span class="Identifier">Person</span> <span class="Operator">=</span> <span class="Punctuation">(</span><span class="Identifier">name</span><span class="Punctuation">:</span> <span class="StringLit">&quot;p4&quot;</span><span class="Punctuation">,</span> <span class="Identifier">age</span><span class="Punctuation">:</span> <span class="DecNumber">30</span><span class="Punctuation">)</span>
<span class="Identifier">people</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="Identifier">p1</span><span class="Punctuation">,</span> <span class="Identifier">p2</span><span class="Punctuation">,</span> <span class="Identifier">p4</span><span class="Punctuation">,</span> <span class="Identifier">p3</span><span class="Punctuation">]</span>
<span class="Identifier">assert</span> <span class="Identifier">people</span><span class="Operator">.</span><span class="Identifier">sortedByIt</span><span class="Punctuation">(</span><span class="Identifier">it</span><span class="Operator">.</span><span class="Identifier">name</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="Punctuation">(</span><span class="Identifier">name</span><span class="Punctuation">:</span> <span class="StringLit">&quot;p1&quot;</span><span class="Punctuation">,</span> <span class="Identifier">age</span><span class="Punctuation">:</span> <span class="DecNumber">60</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Punctuation">(</span><span class="Identifier">name</span><span class="Punctuation">:</span> <span class="StringLit">&quot;p2&quot;</span><span class="Punctuation">,</span>
<span class="Identifier">age</span><span class="Punctuation">:</span> <span class="DecNumber">20</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Punctuation">(</span><span class="Identifier">name</span><span class="Punctuation">:</span> <span class="StringLit">&quot;p3&quot;</span><span class="Punctuation">,</span> <span class="Identifier">age</span><span class="Punctuation">:</span> <span class="DecNumber">30</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Punctuation">(</span><span class="Identifier">name</span><span class="Punctuation">:</span> <span class="StringLit">&quot;p4&quot;</span><span class="Punctuation">,</span> <span class="Identifier">age</span><span class="Punctuation">:</span> <span class="DecNumber">30</span><span class="Punctuation">)</span><span class="Punctuation">]</span>
<span class="Comment"># Nested sort</span>
<span class="Identifier">assert</span> <span class="Identifier">people</span><span class="Operator">.</span><span class="Identifier">sortedByIt</span><span class="Punctuation">(</span><span class="Punctuation">(</span><span class="Identifier">it</span><span class="Operator">.</span><span class="Identifier">age</span><span class="Punctuation">,</span> <span class="Identifier">it</span><span class="Operator">.</span><span class="Identifier">name</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="Punctuation">(</span><span class="Identifier">name</span><span class="Punctuation">:</span> <span class="StringLit">&quot;p2&quot;</span><span class="Punctuation">,</span> <span class="Identifier">age</span><span class="Punctuation">:</span> <span class="DecNumber">20</span><span class="Punctuation">)</span><span class="Punctuation">,</span>
<span class="Punctuation">(</span><span class="Identifier">name</span><span class="Punctuation">:</span> <span class="StringLit">&quot;p3&quot;</span><span class="Punctuation">,</span> <span class="Identifier">age</span><span class="Punctuation">:</span> <span class="DecNumber">30</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Punctuation">(</span><span class="Identifier">name</span><span class="Punctuation">:</span> <span class="StringLit">&quot;p4&quot;</span><span class="Punctuation">,</span> <span class="Identifier">age</span><span class="Punctuation">:</span> <span class="DecNumber">30</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Punctuation">(</span><span class="Identifier">name</span><span class="Punctuation">:</span> <span class="StringLit">&quot;p1&quot;</span><span class="Punctuation">,</span> <span class="Identifier">age</span><span class="Punctuation">:</span> <span class="DecNumber">60</span><span class="Punctuation">)</span><span class="Punctuation">]</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/algorithm.nim#L472" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/algorithm.nim#L472" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:07:42 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

47
algorithm.idx Normal file
View File

@@ -0,0 +1,47 @@
nimTitle algorithm algorithm.html module std/algorithm 0
nim Descending algorithm.html#Descending SortOrder.Descending 52
nim Ascending algorithm.html#Ascending SortOrder.Ascending 52
nim SortOrder algorithm.html#SortOrder enum SortOrder 52
nim `*` algorithm.html#*,int,SortOrder proc `*`(x: int; order: SortOrder): int 55
nim fill algorithm.html#fill,openArray[T],Natural,Natural,T proc fill[T](a: var openArray[T]; first, last: Natural; value: T) 77
nim fill algorithm.html#fill,openArray[T],T proc fill[T](a: var openArray[T]; value: T) 90
nim reverse algorithm.html#reverse,openArray[T],Natural,Natural proc reverse[T](a: var openArray[T]; first, last: Natural) 101
nim reverse algorithm.html#reverse,openArray[T] proc reverse[T](a: var openArray[T]) 123
nim reversed algorithm.html#reversed,openArray[T] proc reversed[T](a: openArray[T]): seq[T] 138
nim reversed algorithm.html#reversed,openArray[T],Natural,int proc reversed[T](a: openArray[T]; first: Natural; last: int): seq[T] 151
nim binarySearch algorithm.html#binarySearch,openArray[T],K,proc(T,K) proc binarySearch[T, K](a: openArray[T]; key: K;\n cmp: proc (x: T; y: K): int {.closure.}): int 160
nim binarySearch algorithm.html#binarySearch,openArray[T],T proc binarySearch[T](a: openArray[T]; key: T): int 211
nim lowerBound algorithm.html#lowerBound,openArray[T],K,proc(T,K) proc lowerBound[T, K](a: openArray[T]; key: K; cmp: proc (x: T; k: K): int {.closure.}): int 222
nim lowerBound algorithm.html#lowerBound,openArray[T],T proc lowerBound[T](a: openArray[T]; key: T): int 258
nim upperBound algorithm.html#upperBound,openArray[T],K,proc(T,K) proc upperBound[T, K](a: openArray[T]; key: K; cmp: proc (x: T; k: K): int {.closure.}): int 272
nim upperBound algorithm.html#upperBound,openArray[T],T proc upperBound[T](a: openArray[T]; key: T): int 308
nim sort algorithm.html#sort,openArray[T],proc(T,T) proc sort[T](a: var openArray[T]; cmp: proc (x, y: T): int {.closure.};\n order = SortOrder.Ascending) 369
nim sort algorithm.html#sort,openArray[T] proc sort[T](a: var openArray[T]; order = SortOrder.Ascending) 422
nim sorted algorithm.html#sorted,openArray[T],proc(T,T) proc sorted[T](a: openArray[T]; cmp: proc (x, y: T): int {.closure.};\n order = SortOrder.Ascending): seq[T] 432
nim sorted algorithm.html#sorted,openArray[T] proc sorted[T](a: openArray[T]; order = SortOrder.Ascending): seq[T] 454
nim sortedByIt algorithm.html#sortedByIt.t,untyped,untyped template sortedByIt(seq1, op: untyped): untyped 472
nim isSorted algorithm.html#isSorted,openArray[T],proc(T,T) proc isSorted[T](a: openArray[T]; cmp: proc (x, y: T): int {.closure.};\n order = SortOrder.Ascending): bool 508
nim isSorted algorithm.html#isSorted,openArray[T] proc isSorted[T](a: openArray[T]; order = SortOrder.Ascending): bool 535
nim merge algorithm.html#merge,seq[T],openArray[T],openArray[T],proc(T,T) proc merge[T](result: var seq[T]; x, y: openArray[T];\n cmp: proc (x, y: T): int {.closure.}) 555
nim merge algorithm.html#merge,seq[T],openArray[T],openArray[T] proc merge[T](result: var seq[T]; x, y: openArray[T]) 632
nim product algorithm.html#product,openArray[seq[T]] proc product[T](x: openArray[seq[T]]): seq[seq[T]] 647
nim nextPermutation algorithm.html#nextPermutation,openArray[T] proc nextPermutation[T](x: var openArray[T]): bool 684
nim prevPermutation algorithm.html#prevPermutation,openArray[T] proc prevPermutation[T](x: var openArray[T]): bool 724
nim rotateLeft algorithm.html#rotateLeft,openArray[T],HSlice[int,int],int proc rotateLeft[T](arg: var openArray[T]; slice: HSlice[int, int]; dist: int): int 813
nim rotateLeft algorithm.html#rotateLeft,openArray[T],int proc rotateLeft[T](arg: var openArray[T]; dist: int): int 851
nim rotatedLeft algorithm.html#rotatedLeft,openArray[T],HSlice[int,int],int proc rotatedLeft[T](arg: openArray[T]; slice: HSlice[int, int]; dist: int): seq[T] 871
nim rotatedLeft algorithm.html#rotatedLeft,openArray[T],int proc rotatedLeft[T](arg: openArray[T]; dist: int): seq[T] 901
heading Basic usage algorithm.html#basic-usage Basic usage 0
heading See also algorithm.html#see-also See also 0
nimgrp rotateleft algorithm.html#rotateLeft-procs-all proc 813
nimgrp sort algorithm.html#sort-procs-all proc 369
nimgrp issorted algorithm.html#isSorted-procs-all proc 508
nimgrp lowerbound algorithm.html#lowerBound-procs-all proc 222
nimgrp reverse algorithm.html#reverse-procs-all proc 101
nimgrp sorted algorithm.html#sorted-procs-all proc 432
nimgrp reversed algorithm.html#reversed-procs-all proc 138
nimgrp binarysearch algorithm.html#binarySearch-procs-all proc 160
nimgrp merge algorithm.html#merge-procs-all proc 555
nimgrp rotatedleft algorithm.html#rotatedLeft-procs-all proc 871
nimgrp fill algorithm.html#fill-procs-all proc 77
nimgrp upperbound algorithm.html#upperBound-procs-all proc 272

92
apis.html Normal file
View File

@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>API naming design</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">API naming design</h1>
<p>The API is designed to be <strong>easy to use</strong> and consistent. Ease of use is measured by the number of calls to achieve a concrete high-level action.</p>
<h1 id="naming-scheme">Naming scheme</h1><p>The library uses a simple naming scheme that makes use of common abbreviations to keep the names short but meaningful. Since version 0.8.2 many symbols have been renamed to fit this scheme. The ultimate goal is that the programmer can <em>guess</em> a name.</p>
<table border="1" class="docutils"><tr><th>English word</th><th>To use</th><th>Notes</th></tr>
<tr><td>initialize</td><td>initT </td><td><tt class="docutils literal"><span class="pre"><span class="Identifier">init</span></span></tt> is used to create a value type <tt class="docutils literal"><span class="pre"><span class="Identifier">T</span></span></tt></td></tr>
<tr><td>new</td><td>newP </td><td><tt class="docutils literal"><span class="pre"><span class="Identifier">new</span></span></tt> is used to create a reference type <tt class="docutils literal"><span class="pre"><span class="Identifier">P</span></span></tt></td></tr>
<tr><td>find</td><td>find</td><td>should return the position where something was found; for a bool result use <tt class="docutils literal"><span class="pre"><span class="Identifier">contains</span></span></tt></td></tr>
<tr><td>contains</td><td>contains</td><td>often short for <tt class="docutils literal"><span class="pre"><span class="Identifier">find</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator">&gt;=</span> <span class="DecNumber">0</span></span></tt></td></tr>
<tr><td>append</td><td>add</td><td>use <tt class="docutils literal"><span class="pre"><span class="Identifier">add</span></span></tt> instead of <tt class="docutils literal"><span class="pre"><span class="Identifier">append</span></span></tt></td></tr>
<tr><td>compare</td><td>cmp</td><td>should return an int with the <tt class="docutils literal"><span class="pre"><span class="Operator">&lt;</span> <span class="DecNumber">0</span></span></tt> <tt class="docutils literal"><span class="pre"><span class="Operator">==</span> <span class="DecNumber">0</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Operator">&gt;</span> <span class="DecNumber">0</span></span></tt> semantics; for a bool result use <tt class="docutils literal"><span class="pre"><span class="Identifier">sameXYZ</span></span></tt></td></tr>
<tr><td>put</td><td>put, <tt class="docutils literal"><span class="pre"><span class="Punctuation">[</span><span class="Punctuation">]</span><span class="Operator">=</span></span></tt></td><td>consider overloading <tt class="docutils literal"><span class="pre"><span class="Punctuation">[</span><span class="Punctuation">]</span><span class="Operator">=</span></span></tt> for put</td></tr>
<tr><td>get</td><td>get, <tt class="docutils literal"><span class="pre"><span class="Punctuation">[</span><span class="Punctuation">]</span></span></tt></td><td>consider overloading <tt class="docutils literal"><span class="pre"><span class="Punctuation">[</span><span class="Punctuation">]</span></span></tt> for get; consider to not use <tt class="docutils literal"><span class="pre"><span class="Identifier">get</span></span></tt> as a prefix: <tt class="docutils literal"><span class="pre"><span class="Identifier">len</span></span></tt> instead of <tt class="docutils literal"><span class="pre"><span class="Identifier">getLen</span></span></tt></td></tr>
<tr><td>length</td><td>len</td><td>also used for <em>number of elements</em></td></tr>
<tr><td>size</td><td>size, len</td><td>size should refer to a byte size</td></tr>
<tr><td>capacity</td><td>cap</td><td></td></tr>
<tr><td>memory</td><td>mem</td><td>implies a low-level operation</td></tr>
<tr><td>items</td><td>items</td><td>default iterator over a collection</td></tr>
<tr><td>pairs</td><td>pairs</td><td>iterator over (key, value) pairs</td></tr>
<tr><td>delete</td><td>delete, del</td><td>del is supposed to be faster than delete, because it does not keep the order; delete keeps the order</td></tr>
<tr><td>remove</td><td>delete, del</td><td>inconsistent right now</td></tr>
<tr><td>remove-and-return</td><td>pop</td><td><tt class="docutils literal"><span class="pre"><span class="Identifier">Table</span></span></tt>/<tt class="docutils literal"><span class="pre"><span class="Identifier">TableRef</span></span></tt> alias to <tt class="docutils literal"><span class="pre"><span class="Identifier">take</span></span></tt></td></tr>
<tr><td>include</td><td>incl</td><td></td></tr>
<tr><td>exclude</td><td>excl</td><td></td></tr>
<tr><td>command</td><td>cmd</td><td></td></tr>
<tr><td>execute</td><td>exec</td><td></td></tr>
<tr><td>environment</td><td>env</td><td></td></tr>
<tr><td>variable</td><td>var</td><td></td></tr>
<tr><td>value</td><td>value, val </td><td>val is preferred, inconsistent right now</td></tr>
<tr><td>executable</td><td>exe</td><td></td></tr>
<tr><td>directory</td><td>dir</td><td></td></tr>
<tr><td>path</td><td>path</td><td>path is the string &quot;/usr/bin&quot; (for example), dir is the content of &quot;/usr/bin&quot;; inconsistent right now</td></tr>
<tr><td>extension</td><td>ext</td><td></td></tr>
<tr><td>separator</td><td>sep</td><td></td></tr>
<tr><td>column</td><td>col, column </td><td>col is preferred, inconsistent right now</td></tr>
<tr><td>application</td><td>app</td><td></td></tr>
<tr><td>configuration</td><td>cfg</td><td></td></tr>
<tr><td>message</td><td>msg</td><td></td></tr>
<tr><td>argument</td><td>arg</td><td></td></tr>
<tr><td>object</td><td>obj</td><td></td></tr>
<tr><td>parameter</td><td>param</td><td></td></tr>
<tr><td>operator</td><td>opr</td><td></td></tr>
<tr><td>procedure</td><td>proc</td><td></td></tr>
<tr><td>function</td><td>func</td><td></td></tr>
<tr><td>coordinate</td><td>coord</td><td></td></tr>
<tr><td>rectangle</td><td>rect</td><td></td></tr>
<tr><td>point</td><td>point</td><td></td></tr>
<tr><td>symbol</td><td>sym</td><td></td></tr>
<tr><td>literal</td><td>lit</td><td></td></tr>
<tr><td>string</td><td>str</td><td></td></tr>
<tr><td>identifier</td><td>ident</td><td></td></tr>
<tr><td>indentation</td><td>indent</td><td></td></tr>
</table>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:07:10 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

2
apis.idx Normal file
View File

@@ -0,0 +1,2 @@
markupTitle API naming design apis.html API naming design 0
heading Naming scheme apis.html#naming-scheme Naming scheme 0

250
appdirs.html Normal file
View File

@@ -0,0 +1,250 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/appdirs</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/appdirs</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">getCacheDir
<li><a class="reference" href="#getCacheDir" title="getCacheDir(): Path">getCacheDir(): Path</a></li>
<li><a class="reference" href="#getCacheDir%2CPath" title="getCacheDir(app: Path): Path">getCacheDir(app: Path): Path</a></li>
</ul>
<ul class="simple nested-toc-section">getConfigDir
<li><a class="reference" href="#getConfigDir" title="getConfigDir(): Path">getConfigDir(): Path</a></li>
</ul>
<ul class="simple nested-toc-section">getDataDir
<li><a class="reference" href="#getDataDir" title="getDataDir(): Path">getDataDir(): Path</a></li>
</ul>
<ul class="simple nested-toc-section">getHomeDir
<li><a class="reference" href="#getHomeDir" title="getHomeDir(): Path">getHomeDir(): Path</a></li>
</ul>
<ul class="simple nested-toc-section">getTempDir
<li><a class="reference" href="#getTempDir" title="getTempDir(): Path">getTempDir(): Path</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/appdirs.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/appdirs.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">This module implements helpers for determining special directories used by apps.</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="osappdirs.html">osappdirs</a>, <a class="reference external" href="paths.html">paths</a>, <a class="reference external" href="envvars.html">envvars</a>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="getCacheDir-procs-all">
<div id="getCacheDir">
<dt><pre><span class="Keyword">proc</span> <a href="#getCacheDir"><span class="Identifier">getCacheDir</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Returns the cache directory of the current user for applications.</p>
<p>This makes use of the following environment variables:</p>
<ul class="simple"><li>On Windows: <tt class="docutils literal"><span class="pre"><span class="Identifier">getEnv</span><span class="Punctuation">(</span><span class="StringLit">&quot;LOCALAPPDATA&quot;</span><span class="Punctuation">)</span></span></tt></li>
<li>On macOS: <tt class="docutils literal"><span class="pre"><span class="Identifier">getEnv</span><span class="Punctuation">(</span><span class="StringLit">&quot;XDG_CACHE_HOME&quot;</span><span class="Punctuation">,</span> <span class="Identifier">getEnv</span><span class="Punctuation">(</span><span class="StringLit">&quot;HOME&quot;</span><span class="Punctuation">)</span> <span class="Operator">/</span> <span class="StringLit">&quot;Library/Caches&quot;</span><span class="Punctuation">)</span></span></tt></li>
<li>On other platforms: <tt class="docutils literal"><span class="pre"><span class="Identifier">getEnv</span><span class="Punctuation">(</span><span class="StringLit">&quot;XDG_CACHE_HOME&quot;</span><span class="Punctuation">,</span> <span class="Identifier">getEnv</span><span class="Punctuation">(</span><span class="StringLit">&quot;HOME&quot;</span><span class="Punctuation">)</span> <span class="Operator">/</span> <span class="StringLit">&quot;.cache&quot;</span><span class="Punctuation">)</span></span></tt></li>
</ul>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference internal nimdoc" title="proc getHomeDir(): Path" href="#getHomeDir">getHomeDir proc</a></li>
<li><a class="reference internal nimdoc" title="proc getTempDir(): Path" href="#getTempDir">getTempDir proc</a></li>
<li><a class="reference internal nimdoc" title="proc getConfigDir(): Path" href="#getConfigDir">getConfigDir proc</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/appdirs.nim#L53" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/appdirs.nim#L53" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="getCacheDir,Path">
<dt><pre><span class="Keyword">proc</span> <a href="#getCacheDir%2CPath"><span class="Identifier">getCacheDir</span></a><span class="Other">(</span><span class="Identifier">app</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">)</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns the cache directory for an application <tt class="docutils literal"><span class="pre"><span class="Identifier">app</span></span></tt>.<ul class="simple"><li>On Windows, this uses: <tt class="docutils literal"><span class="pre"><span class="Identifier">getCacheDir</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator">/</span> <span class="Identifier">app</span> <span class="Operator">/</span> <span class="StringLit">&quot;cache&quot;</span></span></tt></li>
<li>On other platforms, this uses: <tt class="docutils literal"><span class="pre"><span class="Identifier">getCacheDir</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator">/</span> <span class="Identifier">app</span></span></tt></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/appdirs.nim#L71" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/appdirs.nim#L71" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getConfigDir-procs-all">
<div id="getConfigDir">
<dt><pre><span class="Keyword">proc</span> <a href="#getConfigDir"><span class="Identifier">getConfigDir</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><a href="envvars.html#ReadEnvEffect"><span class="Identifier">ReadEnvEffect</span></a><span class="Other">,</span> <a href="exceptions.html#ReadIOEffect"><span class="Identifier">ReadIOEffect</span></a><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Returns the config directory of the current user for applications.</p>
<p>On non-Windows OSs, this proc conforms to the XDG Base Directory spec. Thus, this proc returns the value of the <tt class="docutils literal"><span class="pre"><span class="Identifier">XDG_CONFIG_HOME</span></span></tt> environment variable if it is set, otherwise it returns the default configuration directory (&quot;~/.config/&quot;).</p>
<p>An OS-dependent trailing slash is always present at the end of the returned string: <tt class="docutils literal"><span class="pre"><span class="Operator">\\</span></span></tt> on Windows and <tt class="docutils literal"><span class="pre"><span class="Operator">/</span></span></tt> on all other OSs.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference internal nimdoc" title="proc getHomeDir(): Path" href="#getHomeDir">getHomeDir proc</a></li>
<li><a class="reference internal nimdoc" title="proc getTempDir(): Path" href="#getTempDir">getTempDir proc</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/appdirs.nim#L37" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/appdirs.nim#L37" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getDataDir-procs-all">
<div id="getDataDir">
<dt><pre><span class="Keyword">proc</span> <a href="#getDataDir"><span class="Identifier">getDataDir</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><a href="envvars.html#ReadEnvEffect"><span class="Identifier">ReadEnvEffect</span></a><span class="Other">,</span> <a href="exceptions.html#ReadIOEffect"><span class="Identifier">ReadIOEffect</span></a><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Returns the data directory of the current user for applications.</p>
<p>On non-Windows OSs, this proc conforms to the XDG Base Directory spec. Thus, this proc returns the value of the <tt class="docutils literal"><span class="pre"><span class="Identifier">XDG_DATA_HOME</span></span></tt> environment variable if it is set, otherwise it returns the default configuration directory (&quot;~/.local/share&quot; or &quot;~/Library/Application Support&quot; on macOS).</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference internal nimdoc" title="proc getHomeDir(): Path" href="#getHomeDir">getHomeDir proc</a></li>
<li><a class="reference internal nimdoc" title="proc getConfigDir(): Path" href="#getConfigDir">getConfigDir proc</a></li>
<li><a class="reference internal nimdoc" title="proc getTempDir(): Path" href="#getTempDir">getTempDir proc</a></li>
<li><a class="reference external" href="./paths.html#expandTilde,Path">paths: expandTilde proc</a></li>
<li><a class="reference external" href="./paths.html#getCurrentDir">paths: getCurrentDir proc</a></li>
<li><a class="reference internal" href="#setCurrentDir">setCurrentDir</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/appdirs.nim#L20" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/appdirs.nim#L20" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getHomeDir-procs-all">
<div id="getHomeDir">
<dt><pre><span class="Keyword">proc</span> <a href="#getHomeDir"><span class="Identifier">getHomeDir</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><a href="envvars.html#ReadEnvEffect"><span class="Identifier">ReadEnvEffect</span></a><span class="Other">,</span> <a href="exceptions.html#ReadIOEffect"><span class="Identifier">ReadIOEffect</span></a><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Returns the home directory of the current user.</p>
<p>This proc is wrapped by the <a class="reference external" href="./paths.html#expandTilde,Path">paths: expandTilde proc</a> for the convenience of processing paths coming from user configuration files.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference internal nimdoc" title="proc getConfigDir(): Path" href="#getConfigDir">getConfigDir proc</a></li>
<li><a class="reference internal nimdoc" title="proc getTempDir(): Path" href="#getTempDir">getTempDir proc</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/appdirs.nim#L9" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/appdirs.nim#L9" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getTempDir-procs-all">
<div id="getTempDir">
<dt><pre><span class="Keyword">proc</span> <a href="#getTempDir"><span class="Identifier">getTempDir</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><a href="envvars.html#ReadEnvEffect"><span class="Identifier">ReadEnvEffect</span></a><span class="Other">,</span> <a href="exceptions.html#ReadIOEffect"><span class="Identifier">ReadIOEffect</span></a><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Returns the temporary directory of the current user for applications to save temporary files in.</p>
<p>On Windows, it calls <a class="reference external" href="https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppathw">GetTempPath</a>. On Posix based platforms, it will check <tt class="docutils literal"><span class="pre"><span class="Identifier">TMPDIR</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">TEMP</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">TMP</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">TEMPDIR</span></span></tt> environment variables in order. On all platforms, <tt class="docutils literal"><span class="pre"><span class="Operator">/</span><span class="Identifier">tmp</span></span></tt> will be returned if the procs fails.</p>
<p>You can override this implementation by adding <tt class="docutils literal"><span class="pre"><span class="Operator">-</span><span class="Identifier">d</span><span class="Punctuation">:</span><span class="Identifier">tempDir</span><span class="Operator">=</span><span class="Identifier">mytempname</span></span></tt> to your compiler invocation.</p>
<div class="admonition admonition-info"><span class="admonition-info-text"><b>Note:</b></span>
This proc does not check whether the returned path exists.</div>
<p>See also:</p>
<ul class="simple"><li><a class="reference internal nimdoc" title="proc getHomeDir(): Path" href="#getHomeDir">getHomeDir proc</a></li>
<li><a class="reference internal nimdoc" title="proc getConfigDir(): Path" href="#getConfigDir">getConfigDir proc</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/appdirs.nim#L78" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/appdirs.nim#L78" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:07:59 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

8
appdirs.idx Normal file
View File

@@ -0,0 +1,8 @@
nimTitle appdirs appdirs.html module std/appdirs 0
nim getHomeDir appdirs.html#getHomeDir proc getHomeDir(): Path 9
nim getDataDir appdirs.html#getDataDir proc getDataDir(): Path 20
nim getConfigDir appdirs.html#getConfigDir proc getConfigDir(): Path 37
nim getCacheDir appdirs.html#getCacheDir proc getCacheDir(): Path 53
nim getCacheDir appdirs.html#getCacheDir,Path proc getCacheDir(app: Path): Path 71
nim getTempDir appdirs.html#getTempDir proc getTempDir(): Path 78
nimgrp getcachedir appdirs.html#getCacheDir-procs-all proc 53

172
asciitables.html Normal file
View File

@@ -0,0 +1,172 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/private/asciitables</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/private/asciitables</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#Cell" title="Cell = object
text*: string
width*, row*, col*, ncols*, nrows*: int">Cell</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">alignTable
<li><a class="reference" href="#alignTable%2Cstring%2Cchar%2Cchar%2Cstring" title="alignTable(s: string; delim = '\t'; fill = ' '; sep = &quot; &quot;): string">alignTable(s: string; delim = '\t'; fill = ' '; sep = &quot; &quot;): string</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#15" id="65">Iterators</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">parseTableCells
<li><a class="reference" href="#parseTableCells.i%2Cstring%2Cchar" title="parseTableCells(s: string; delim = '\t'): Cell">parseTableCells(s: string; delim = '\t'): Cell</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/private/asciitables.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/private/asciitables.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="Cell">
<dt><pre><a href="asciitables.html#Cell"><span class="Identifier">Cell</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">text</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a>
<span class="Identifier">width</span><span class="Operator">*</span><span class="Other">,</span> <span class="Identifier">row</span><span class="Operator">*</span><span class="Other">,</span> <span class="Identifier">col</span><span class="Operator">*</span><span class="Other">,</span> <span class="Identifier">ncols</span><span class="Operator">*</span><span class="Other">,</span> <span class="Identifier">nrows</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/private/asciitables.nim#L6" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/private/asciitables.nim#L6" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="alignTable-procs-all">
<div id="alignTable,string,char,char,string">
<dt><pre><span class="Keyword">proc</span> <a href="#alignTable%2Cstring%2Cchar%2Cchar%2Cstring"><span class="Identifier">alignTable</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">delim</span> <span class="Other">=</span> <span class="CharLit">'\t'</span><span class="Other">;</span> <span class="Identifier">fill</span> <span class="Other">=</span> <span class="CharLit">' '</span><span class="Other">;</span> <span class="Identifier">sep</span> <span class="Other">=</span> <span class="StringLit">&quot; &quot;</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Formats a <tt class="docutils literal"><span class="pre"><span class="Identifier">delim</span></span></tt>-delimited <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt> representing a table; each cell is aligned to a width that's computed for each column; consecutive columns are delimited by <tt class="docutils literal"><span class="pre"><span class="Identifier">sep</span></span></tt>, and alignment space is filled using <tt class="docutils literal"><span class="pre"><span class="Identifier">fill</span></span></tt>. More customized formatting can be done by calling <tt class="docutils literal"><span class="pre"><span class="Identifier">parseTableCells</span></span></tt> directly.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/private/asciitables.nim#L71" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/private/asciitables.nim#L71" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="15">
<h1><a class="toc-backref" href="#15">Iterators</a></h1>
<dl class="item">
<div id="parseTableCells-iterators-all">
<div id="parseTableCells.i,string,char">
<dt><pre><span class="Keyword">iterator</span> <a href="#parseTableCells.i%2Cstring%2Cchar"><span class="Identifier">parseTableCells</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">delim</span> <span class="Other">=</span> <span class="CharLit">'\t'</span><span class="Other">)</span><span class="Other">:</span> <a href="asciitables.html#Cell"><span class="Identifier">Cell</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Iterates over all cells in a <tt class="docutils literal"><span class="pre"><span class="Identifier">delim</span></span></tt>-delimited <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt>, after a 1st pass that computes number of rows, columns, and width of each column.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/private/asciitables.nim#L10" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/private/asciitables.nim#L10" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:00 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

4
asciitables.idx Normal file
View File

@@ -0,0 +1,4 @@
nimTitle asciitables asciitables.html module std/private/asciitables 0
nim Cell asciitables.html#Cell object Cell 6
nim parseTableCells asciitables.html#parseTableCells.i,string,char iterator parseTableCells(s: string; delim = '\t'): Cell 10
nim alignTable asciitables.html#alignTable,string,char,char,string proc alignTable(s: string; delim = '\t'; fill = ' '; sep = " "): string 71

241
assertions.html Normal file
View File

@@ -0,0 +1,241 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/assertions</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/assertions</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">failedAssertImpl
<li><a class="reference" href="#failedAssertImpl%2Cstring" title="failedAssertImpl(msg: string)">failedAssertImpl(msg: string)</a></li>
</ul>
<ul class="simple nested-toc-section">raiseAssert
<li><a class="reference" href="#raiseAssert%2Cstring" title="raiseAssert(msg: string)">raiseAssert(msg: string)</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">assert
<li><a class="reference" href="#assert.t%2Cuntyped%2Cstring" title="assert(cond: untyped; msg = &quot;&quot;)">assert(cond: untyped; msg = &quot;&quot;)</a></li>
</ul>
<ul class="simple nested-toc-section">doAssert
<li><a class="reference" href="#doAssert.t%2Cuntyped%2Cstring" title="doAssert(cond: untyped; msg = &quot;&quot;)">doAssert(cond: untyped; msg = &quot;&quot;)</a></li>
</ul>
<ul class="simple nested-toc-section">doAssertRaises
<li><a class="reference" href="#doAssertRaises.t%2Ctypedesc%2Cuntyped" title="doAssertRaises(exception: typedesc; code: untyped)">doAssertRaises(exception: typedesc; code: untyped)</a></li>
</ul>
<ul class="simple nested-toc-section">onFailedAssert
<li><a class="reference" href="#onFailedAssert.t%2Cuntyped%2Cuntyped" title="onFailedAssert(msg, code: untyped): untyped">onFailedAssert(msg, code: untyped): untyped</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/assertions.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/assertions.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">This module implements assertion handling.</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="miscdollars.html">miscdollars</a>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="failedAssertImpl-procs-all">
<div id="failedAssertImpl,string">
<dt><pre><span class="Keyword">proc</span> <a href="#failedAssertImpl%2Cstring"><span class="Identifier">failedAssertImpl</span></a><span class="Other">(</span><span class="Identifier">msg</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Raises an <tt class="docutils literal"><span class="pre"><span class="Identifier">AssertionDefect</span></span></tt> with <tt class="docutils literal"><span class="pre"><span class="Identifier">msg</span></span></tt>, but this is hidden from the effect system. Called when an assertion failed.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/assertions.nim#L38" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/assertions.nim#L38" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="raiseAssert-procs-all">
<div id="raiseAssert,string">
<dt><pre><span class="Keyword">proc</span> <a href="#raiseAssert%2Cstring"><span class="Identifier">raiseAssert</span></a><span class="Other">(</span><span class="Identifier">msg</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span> {.<span class="Identifier">noinline</span><span class="Other">,</span> <span class="Identifier">noreturn</span><span class="Other">,</span> <span class="Identifier">nosinks</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Raises an <tt class="docutils literal"><span class="pre"><span class="Identifier">AssertionDefect</span></span></tt> with <tt class="docutils literal"><span class="pre"><span class="Identifier">msg</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/assertions.nim#L31" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/assertions.nim#L31" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="assert-templates-all">
<div id="assert.t,untyped,string">
<dt><pre><span class="Keyword">template</span> <a href="#assert.t%2Cuntyped%2Cstring"><span class="Identifier">assert</span></a><span class="Other">(</span><span class="Identifier">cond</span><span class="Other">:</span> <a href="system.html#untyped"><span class="Identifier">untyped</span></a><span class="Other">;</span> <span class="Identifier">msg</span> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">)</span></pre></dt>
<dd>
<p>Raises <tt class="docutils literal"><span class="pre"><span class="Identifier">AssertionDefect</span></span></tt> with <tt class="docutils literal"><span class="pre"><span class="Identifier">msg</span></span></tt> if <tt class="docutils literal"><span class="pre"><span class="Identifier">cond</span></span></tt> is false. Note that <tt class="docutils literal"><span class="pre"><span class="Identifier">AssertionDefect</span></span></tt> is hidden from the effect system, so it doesn't produce <tt class="docutils literal"><span class="pre"><span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">raises</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Identifier">AssertionDefect</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Punctuation">}</span></span></tt>. This exception is only supposed to be caught by unit testing frameworks.</p>
<p>No code will be generated for <tt class="docutils literal"><span class="pre"><span class="Identifier">assert</span></span></tt> when passing <tt class="docutils literal"><span class="pre"><span class="Operator">-</span><span class="Identifier">d</span><span class="Punctuation">:</span><span class="Identifier">danger</span></span></tt> (implied by <tt class="docutils literal"><span class="pre"><span class="Operator">--</span><span class="Identifier">assertions</span><span class="Punctuation">:</span><span class="Identifier">off</span></span></tt>). See <a class="reference external" href="nimc.html#compiler-usage-commandminusline-switches">command line switches</a>.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">assert</span> <span class="DecNumber">1</span> <span class="Operator">==</span> <span class="DecNumber">1</span></pre>
<p><strong class="examples_text">Example: cmd: --assertions:off</strong></p>
<pre class="listing"><span class="Identifier">assert</span> <span class="DecNumber">1</span> <span class="Operator">==</span> <span class="DecNumber">2</span> <span class="Comment"># no code generated, no failure here</span></pre>
<p><strong class="examples_text">Example: cmd: -d:danger</strong></p>
<pre class="listing"><span class="Identifier">assert</span> <span class="DecNumber">1</span> <span class="Operator">==</span> <span class="DecNumber">2</span> <span class="Comment"># ditto</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/assertions.nim#L54" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/assertions.nim#L54" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="doAssert-templates-all">
<div id="doAssert.t,untyped,string">
<dt><pre><span class="Keyword">template</span> <a href="#doAssert.t%2Cuntyped%2Cstring"><span class="Identifier">doAssert</span></a><span class="Other">(</span><span class="Identifier">cond</span><span class="Other">:</span> <a href="system.html#untyped"><span class="Identifier">untyped</span></a><span class="Other">;</span> <span class="Identifier">msg</span> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">)</span></pre></dt>
<dd>
Similar to <a class="reference external" href="#assert.t,untyped,string">assert</a> but is always turned on regardless of <tt class="docutils literal"><span class="pre"><span class="Operator">--</span><span class="Identifier">assertions</span></span></tt>.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">doAssert</span> <span class="DecNumber">1</span> <span class="Operator">==</span> <span class="DecNumber">1</span> <span class="Comment"># generates code even when built with `-d:danger` or `--assertions:off`</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/assertions.nim#L68" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/assertions.nim#L68" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="doAssertRaises-templates-all">
<div id="doAssertRaises.t,typedesc,untyped">
<dt><pre><span class="Keyword">template</span> <a href="#doAssertRaises.t%2Ctypedesc%2Cuntyped"><span class="Identifier">doAssertRaises</span></a><span class="Other">(</span><span class="Identifier">exception</span><span class="Other">:</span> <a href="system.html#typedesc"><span class="Identifier">typedesc</span></a><span class="Other">;</span> <span class="Identifier">code</span><span class="Other">:</span> <a href="system.html#untyped"><span class="Identifier">untyped</span></a><span class="Other">)</span></pre></dt>
<dd>
Raises <tt class="docutils literal"><span class="pre"><span class="Identifier">AssertionDefect</span></span></tt> if specified <tt class="docutils literal"><span class="pre"><span class="Identifier">code</span></span></tt> does not raise <tt class="docutils literal"><span class="pre"><span class="Identifier">exception</span></span></tt>.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">doAssertRaises</span><span class="Punctuation">(</span><span class="Identifier">ValueError</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Keyword">raise</span> <span class="Identifier">newException</span><span class="Punctuation">(</span><span class="Identifier">ValueError</span><span class="Punctuation">,</span> <span class="StringLit">&quot;Hello World&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">doAssertRaises</span><span class="Punctuation">(</span><span class="Identifier">CatchableError</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Keyword">raise</span> <span class="Identifier">newException</span><span class="Punctuation">(</span><span class="Identifier">ValueError</span><span class="Punctuation">,</span> <span class="StringLit">&quot;Hello World&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">doAssertRaises</span><span class="Punctuation">(</span><span class="Identifier">AssertionDefect</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">doAssert</span> <span class="Identifier">false</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/assertions.nim#L91" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/assertions.nim#L91" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="onFailedAssert-templates-all">
<div id="onFailedAssert.t,untyped,untyped">
<dt><pre><span class="Keyword">template</span> <a href="#onFailedAssert.t%2Cuntyped%2Cuntyped"><span class="Identifier">onFailedAssert</span></a><span class="Other">(</span><span class="Identifier">msg</span><span class="Other">,</span> <span class="Identifier">code</span><span class="Other">:</span> <a href="system.html#untyped"><span class="Identifier">untyped</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#untyped"><span class="Identifier">untyped</span></a> {.<span class="Identifier">dirty</span>.}</pre></dt>
<dd>
Sets an assertion failure handler that will intercept any assert statements following <tt class="docutils literal"><span class="pre"><span class="Identifier">onFailedAssert</span></span></tt> in the current scope.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">type</span> <span class="Identifier">MyError</span> <span class="Operator">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">CatchableError</span>
<span class="Identifier">lineinfo</span><span class="Punctuation">:</span> <span class="Keyword">tuple</span><span class="Punctuation">[</span><span class="Identifier">filename</span><span class="Punctuation">:</span> <span class="Identifier">string</span><span class="Punctuation">,</span> <span class="Identifier">line</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">,</span> <span class="Identifier">column</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">]</span>
<span class="Comment"># block-wide policy to change the failed assert exception type in order to</span>
<span class="Comment"># include a lineinfo</span>
<span class="Identifier">onFailedAssert</span><span class="Punctuation">(</span><span class="Identifier">msg</span><span class="Punctuation">)</span><span class="Punctuation">:</span>
<span class="Keyword">raise</span> <span class="Punctuation">(</span><span class="Keyword">ref</span> <span class="Identifier">MyError</span><span class="Punctuation">)</span><span class="Punctuation">(</span><span class="Identifier">msg</span><span class="Punctuation">:</span> <span class="Identifier">msg</span><span class="Punctuation">,</span> <span class="Identifier">lineinfo</span><span class="Punctuation">:</span> <span class="Identifier">instantiationInfo</span><span class="Punctuation">(</span><span class="Operator">-</span><span class="DecNumber">2</span><span class="Punctuation">)</span><span class="Punctuation">)</span>
<span class="Identifier">doAssertRaises</span><span class="Punctuation">(</span><span class="Identifier">MyError</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">doAssert</span> <span class="Identifier">false</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/assertions.nim#L74" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/assertions.nim#L74" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:07:52 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

7
assertions.idx Normal file
View File

@@ -0,0 +1,7 @@
nimTitle assertions assertions.html module std/assertions 0
nim raiseAssert assertions.html#raiseAssert,string proc raiseAssert(msg: string) 31
nim failedAssertImpl assertions.html#failedAssertImpl,string proc failedAssertImpl(msg: string) 38
nim assert assertions.html#assert.t,untyped,string template assert(cond: untyped; msg = "") 54
nim doAssert assertions.html#doAssert.t,untyped,string template doAssert(cond: untyped; msg = "") 68
nim onFailedAssert assertions.html#onFailedAssert.t,untyped,untyped template onFailedAssert(msg, code: untyped): untyped 74
nim doAssertRaises assertions.html#doAssertRaises.t,typedesc,untyped template doAssertRaises(exception: typedesc; code: untyped) 91

97
async.html Normal file
View File

@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/async</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/async</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<a class="reference reference-toplevel" href="#19" id="69">Exports</a>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/async.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/async.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">Exports <a class="reference external" href="asyncmacro.html">asyncmacro</a> and <a class="reference external" href="asyncfutures.html">asyncfutures</a> for native backends, and <a class="reference external" href="asyncjs.html">asyncjs</a> on the JS backend. </p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="asyncmacro.html">asyncmacro</a>, <a class="reference external" href="asyncfutures.html">asyncfutures</a>
</dl>
</div>
<div class="section" id="19">
<h1><a class="toc-backref" href="#19">Exports</a></h1>
<dl class="item">
<a href="asyncmacro.html#multisync.m,untyped"><span class="Identifier">multisync</span></a>, <a href="asyncmacro.html#await.t,Future[T]"><span class="Identifier">await</span></a>, <a href="asyncmacro.html#async.m,untyped"><span class="Identifier">async</span></a>, <a href="asyncmacro.html#await.t,typed"><span class="Identifier">await</span></a>, <a href="asyncfutures.html#and,Future[T],Future[Y]"><span class="Identifier">and</span></a>, <a href="asyncfutures.html#addCallback,FutureBase,proc)"><span class="Identifier">addCallback</span></a>, <a href="asyncfutures.html#asyncCheck,Future[T]"><span class="Identifier">asyncCheck</span></a>, <a href="asyncfutures.html#or,Future[T],Future[Y]"><span class="Identifier">or</span></a>, <a href="asyncfutures.html#read"><span class="Identifier">read</span></a>, <a href="asyncfutures.html#fail,Future[T],ref.Exception"><span class="Identifier">fail</span></a>, <a href="asyncfutures.html#setCallSoonProc"><span class="Identifier">setCallSoonProc</span></a>, <a href="asyncfutures.html#callSoon,proc)"><span class="Identifier">callSoon</span></a>, <a href="asyncfutures.html#addCallback,Future[T],proc(Future[T])"><span class="Identifier">addCallback</span></a>, <a href="asyncfutures.html#clean,FutureVar[T]"><span class="Identifier">clean</span></a>, <a href="asyncfutures.html#clearCallbacks,FutureBase"><span class="Identifier">clearCallbacks</span></a>, <a href="asyncfutures.html#newFutureVar,string"><span class="Identifier">newFutureVar</span></a>, <a href="asyncfutures.html#mget,FutureVar[T]"><span class="Identifier">mget</span></a>, <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a>, <a href="asyncfutures.html#failed,FutureBase"><span class="Identifier">failed</span></a>, <a href="asyncfutures.html#$,seq[StackTraceEntry]"><span class="Identifier">$</span></a>, <a href="asyncfutures.html#callback=,FutureBase,proc)"><span class="Identifier">callback=</span></a>, <a href="asyncfutures.html#complete,FutureVar[T],sinkT"><span class="Identifier">complete</span></a>, <a href="asyncfutures.html#callback=,Future[T],proc(Future[T])"><span class="Identifier">callback=</span></a>, <a href="asyncfutures.html#NimAsyncContinueSuffix"><span class="Identifier">NimAsyncContinueSuffix</span></a>, <a href="asyncfutures.html#FutureBase"><span class="Identifier">FutureBase</span></a>, <a href="asyncfutures.html#all,varargs[Future[T]]"><span class="Identifier">all</span></a>, <a href="asyncfutures.html#complete,FutureVar[T]"><span class="Identifier">complete</span></a>, <a href="asyncfutures.html#FutureError"><span class="Identifier">FutureError</span></a>, <a href="asyncfutures.html#getCallSoonProc"><span class="Identifier">getCallSoonProc</span></a>, <a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a>, <a href="asyncfutures.html#isFutureLoggingEnabled"><span class="Identifier">isFutureLoggingEnabled</span></a>, <a href="asyncfutures.html#complete,Future[void]"><span class="Identifier">complete</span></a>, <a href="asyncfutures.html#readError,Future[T]"><span class="Identifier">readError</span></a>, <a href="asyncfutures.html#complete,Future[T],sinkT"><span class="Identifier">complete</span></a>, <a href="asyncfutures.html#newFuture,string"><span class="Identifier">newFuture</span></a>, <a href="asyncfutures.html#read_2"><span class="Identifier">read</span></a>, <a href="asyncfutures.html#finished"><span class="Identifier">finished</span></a>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:07:31 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

1
async.idx Normal file
View File

@@ -0,0 +1 @@
nimTitle async async.html module std/async 0

1096
asyncdispatch.html Normal file

File diff suppressed because it is too large Load Diff

63
asyncdispatch.idx Normal file
View File

@@ -0,0 +1,63 @@
nimTitle asyncdispatch asyncdispatch.html module std/asyncdispatch 0
nim callSoon asyncdispatch.html#callSoon,proc) proc callSoon(cbproc: proc () {.gcsafe.}) 286
nim CompletionData asyncdispatch.html#CompletionData object CompletionData 309
nim PDispatcher asyncdispatch.html#PDispatcher type PDispatcher 317
nim CustomRef asyncdispatch.html#CustomRef type CustomRef 324
nim AsyncFD asyncdispatch.html#AsyncFD type AsyncFD 326
nim AsyncEvent asyncdispatch.html#AsyncEvent type AsyncEvent 339
nim Callback asyncdispatch.html#Callback type Callback 341
nim `==` asyncdispatch.html#==,AsyncFD,AsyncFD proc `==`(x: AsyncFD; y: AsyncFD): bool 344
nim newDispatcher asyncdispatch.html#newDispatcher proc newDispatcher(): owned PDispatcher 346
nim setGlobalDispatcher asyncdispatch.html#setGlobalDispatcher,sinkPDispatcher proc setGlobalDispatcher(disp: sink PDispatcher) 356
nim getGlobalDispatcher asyncdispatch.html#getGlobalDispatcher proc getGlobalDispatcher(): PDispatcher 362
nim getIoHandler asyncdispatch.html#getIoHandler,PDispatcher proc getIoHandler(disp: PDispatcher): Handle 367
nim register asyncdispatch.html#register,AsyncFD proc register(fd: AsyncFD) 372
nim hasPendingOperations asyncdispatch.html#hasPendingOperations proc hasPendingOperations(): bool 390
nim newCustom asyncdispatch.html#newCustom proc newCustom(): CustomRef 487
nim recv asyncdispatch.html#recv,AsyncFD,int proc recv(socket: AsyncFD; size: int; flags = {SafeDisconn}): owned(Future[string]) 494
nim recvInto asyncdispatch.html#recvInto,AsyncFD,pointer,int proc recvInto(socket: AsyncFD; buf: pointer; size: int; flags = {SafeDisconn}): owned(\n Future[int]) 567
nim send asyncdispatch.html#send,AsyncFD,pointer,int proc send(socket: AsyncFD; buf: pointer; size: int; flags = {SafeDisconn}): owned(\n Future[void]) 633
nim sendTo asyncdispatch.html#sendTo,AsyncFD,pointer,int,ptr.SockAddr,SockLen proc sendTo(socket: AsyncFD; data: pointer; size: int; saddr: ptr SockAddr;\n saddrLen: SockLen; flags = {SafeDisconn}): owned(Future[void]) 678
nim recvFromInto asyncdispatch.html#recvFromInto,AsyncFD,pointer,int,ptr.SockAddr,ptr.SockLen proc recvFromInto(socket: AsyncFD; data: pointer; size: int; saddr: ptr SockAddr;\n saddrLen: ptr SockLen; flags = {SafeDisconn}): owned(Future[int]) 723
nim acceptAddr asyncdispatch.html#acceptAddr,AsyncFD proc acceptAddr(socket: AsyncFD; flags = {SafeDisconn};\n inheritable = defined(nimInheritHandles)): owned(\n Future[tuple[address: string, client: AsyncFD]]) 771
nim setInheritable asyncdispatch.html#setInheritable,AsyncFD,bool proc setInheritable(fd: AsyncFD; inheritable: bool): bool 868
nim closeSocket asyncdispatch.html#closeSocket,AsyncFD proc closeSocket(socket: AsyncFD) 870
nim unregister asyncdispatch.html#unregister,AsyncFD proc unregister(fd: AsyncFD) 875
nim contains asyncdispatch.html#contains,PDispatcher,AsyncFD proc contains(disp: PDispatcher; fd: AsyncFD): bool 879
nim addRead asyncdispatch.html#addRead,AsyncFD,Callback proc addRead(fd: AsyncFD; cb: Callback) 974
nim addWrite asyncdispatch.html#addWrite,AsyncFD,Callback proc addWrite(fd: AsyncFD; cb: Callback) 992
nim addTimer asyncdispatch.html#addTimer,int,bool,Callback proc addTimer(timeout: int; oneshot: bool; cb: Callback) 1045
nim addProcess asyncdispatch.html#addProcess,int,Callback proc addProcess(pid: int; cb: Callback) 1079
nim newAsyncEvent asyncdispatch.html#newAsyncEvent proc newAsyncEvent(): AsyncEvent 1098
nim trigger asyncdispatch.html#trigger,AsyncEvent proc trigger(ev: AsyncEvent) 1113
nim unregister asyncdispatch.html#unregister,AsyncEvent proc unregister(ev: AsyncEvent) 1118
nim close asyncdispatch.html#close,AsyncEvent proc close(ev: AsyncEvent) 1129
nim addEvent asyncdispatch.html#addEvent,AsyncEvent,Callback proc addEvent(ev: AsyncEvent; cb: Callback) 1136
nim drain asyncdispatch.html#drain,int proc drain(timeout = 500) 1696
nim poll asyncdispatch.html#poll,int proc poll(timeout = 500) 1708
nim createAsyncNativeSocket asyncdispatch.html#createAsyncNativeSocket,cint,cint,cint proc createAsyncNativeSocket(domain: cint; sockType: cint; protocol: cint;\n inheritable = defined(nimInheritHandles)): AsyncFD 1725
nim createAsyncNativeSocket asyncdispatch.html#createAsyncNativeSocket,Domain,SockType,Protocol proc createAsyncNativeSocket(domain: Domain = Domain.AF_INET;\n sockType: SockType = SOCK_STREAM;\n protocol: Protocol = IPPROTO_TCP;\n inheritable = defined(nimInheritHandles)): AsyncFD 1730
nim dial asyncdispatch.html#dial,string,Port,Protocol proc dial(address: string; port: Port; protocol: Protocol = IPPROTO_TCP): owned(\n Future[AsyncFD]) 1890
nim connect asyncdispatch.html#connect,AsyncFD,string,Port proc connect(socket: AsyncFD; address: string; port: Port; domain = Domain.AF_INET): owned(\n Future[void]) 1905
nim sleepAsync asyncdispatch.html#sleepAsync proc sleepAsync(ms: int | float): owned(Future[void]) 1920
nim withTimeout asyncdispatch.html#withTimeout,Future[T],int proc withTimeout[T](fut: Future[T]; timeout: int): owned(Future[bool]) 1932
nim accept asyncdispatch.html#accept,AsyncFD proc accept(socket: AsyncFD; flags = {SafeDisconn};\n inheritable = defined(nimInheritHandles)): owned(Future[AsyncFD]) 1954
nim send asyncdispatch.html#send,AsyncFD,string proc send(socket: AsyncFD; data: string; flags = {SafeDisconn}): owned(Future[void]) 1978
nim readAll asyncdispatch.html#readAll,FutureStream[string] proc readAll(future: FutureStream[string]): owned(Future[string]) 2001
nim runForever asyncdispatch.html#runForever proc runForever() 2015
nim waitFor asyncdispatch.html#waitFor,Future[T] proc waitFor[T](fut: Future[T]): T 2020
nim activeDescriptors asyncdispatch.html#activeDescriptors proc activeDescriptors(): int 2027
nim maxDescriptors asyncdispatch.html#maxDescriptors proc maxDescriptors(): int 2040
heading Asynchronous procedures asyncdispatch.html#asynchronous-procedures Asynchronous procedures 0
heading Handling Exceptions asyncdispatch.html#asynchronous-procedures-handling-exceptions Handling Exceptions 0
heading Discarding futures asyncdispatch.html#discarding-futures Discarding futures 0
heading Handling futures asyncdispatch.html#handling-futures Handling futures 0
heading Examples asyncdispatch.html#examples Examples 0
heading Investigating pending futures asyncdispatch.html#investigating-pending-futures Investigating pending futures 0
heading Limitations/Bugs asyncdispatch.html#limitationsslashbugs Limitations/Bugs 0
heading Multiple async backend support asyncdispatch.html#multiple-async-backend-support Multiple async backend support 0
idx epoll asyncdispatch.html#epoll_1 Multiple async backend support 0
idx kqueue asyncdispatch.html#kqueue_1 Multiple async backend support 0
nimgrp createasyncnativesocket asyncdispatch.html#createAsyncNativeSocket-procs-all proc 1725
nimgrp send asyncdispatch.html#send-procs-all proc 633
nimgrp unregister asyncdispatch.html#unregister-procs-all proc 875

417
asyncfile.html Normal file
View File

@@ -0,0 +1,417 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/asyncfile</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/asyncfile</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#AsyncFile" title="AsyncFile = ref object">AsyncFile</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">close
<li><a class="reference" href="#close%2CAsyncFile" title="close(f: AsyncFile)">close(f: AsyncFile)</a></li>
</ul>
<ul class="simple nested-toc-section">getFilePos
<li><a class="reference" href="#getFilePos%2CAsyncFile" title="getFilePos(f: AsyncFile): int64">getFilePos(f: AsyncFile): int64</a></li>
</ul>
<ul class="simple nested-toc-section">getFileSize
<li><a class="reference" href="#getFileSize%2CAsyncFile" title="getFileSize(f: AsyncFile): int64">getFileSize(f: AsyncFile): int64</a></li>
</ul>
<ul class="simple nested-toc-section">newAsyncFile
<li><a class="reference" href="#newAsyncFile%2CAsyncFD" title="newAsyncFile(fd: AsyncFD): AsyncFile">newAsyncFile(fd: AsyncFD): AsyncFile</a></li>
</ul>
<ul class="simple nested-toc-section">openAsync
<li><a class="reference" href="#openAsync%2Cstring" title="openAsync(filename: string; mode = fmRead): AsyncFile">openAsync(filename: string; mode = fmRead): AsyncFile</a></li>
</ul>
<ul class="simple nested-toc-section">read
<li><a class="reference" href="#read%2CAsyncFile%2Cint" title="read(f: AsyncFile; size: int): Future[string]">read(f: AsyncFile; size: int): Future[string]</a></li>
</ul>
<ul class="simple nested-toc-section">readAll
<li><a class="reference" href="#readAll%2CAsyncFile" title="readAll(f: AsyncFile): Future[string]">readAll(f: AsyncFile): Future[string]</a></li>
</ul>
<ul class="simple nested-toc-section">readBuffer
<li><a class="reference" href="#readBuffer%2CAsyncFile%2Cpointer%2Cint" title="readBuffer(f: AsyncFile; buf: pointer; size: int): Future[int]">readBuffer(f: AsyncFile; buf: pointer; size: int): Future[int]</a></li>
</ul>
<ul class="simple nested-toc-section">readLine
<li><a class="reference" href="#readLine%2CAsyncFile" title="readLine(f: AsyncFile): Future[string]">readLine(f: AsyncFile): Future[string]</a></li>
</ul>
<ul class="simple nested-toc-section">readToStream
<li><a class="reference" href="#readToStream%2CAsyncFile%2CFutureStream%5Bstring%5D" title="readToStream(f: AsyncFile; fs: FutureStream[string]): owned(Future[void])">readToStream(f: AsyncFile; fs: FutureStream[string]): owned(Future[void])</a></li>
</ul>
<ul class="simple nested-toc-section">setFilePos
<li><a class="reference" href="#setFilePos%2CAsyncFile%2Cint64" title="setFilePos(f: AsyncFile; pos: int64)">setFilePos(f: AsyncFile; pos: int64)</a></li>
</ul>
<ul class="simple nested-toc-section">setFileSize
<li><a class="reference" href="#setFileSize%2CAsyncFile%2Cint64" title="setFileSize(f: AsyncFile; length: int64)">setFileSize(f: AsyncFile; length: int64)</a></li>
</ul>
<ul class="simple nested-toc-section">write
<li><a class="reference" href="#write%2CAsyncFile%2Cstring" title="write(f: AsyncFile; data: string): Future[void]">write(f: AsyncFile; data: string): Future[void]</a></li>
</ul>
<ul class="simple nested-toc-section">writeBuffer
<li><a class="reference" href="#writeBuffer%2CAsyncFile%2Cpointer%2Cint" title="writeBuffer(f: AsyncFile; buf: pointer; size: int): Future[void]">writeBuffer(f: AsyncFile; buf: pointer; size: int): Future[void]</a></li>
</ul>
<ul class="simple nested-toc-section">writeFromStream
<li><a class="reference" href="#writeFromStream%2CAsyncFile%2CFutureStream%5Bstring%5D" title="writeFromStream(f: AsyncFile; fs: FutureStream[string]): owned(Future[void])">writeFromStream(f: AsyncFile; fs: FutureStream[string]): owned(Future[void])</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfile.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfile.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"><p>This module implements asynchronous file reading and writing.</p>
<p><pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Punctuation">[</span><span class="Identifier">asyncfile</span><span class="Punctuation">,</span> <span class="Identifier">asyncdispatch</span><span class="Punctuation">,</span> <span class="Identifier">os</span><span class="Punctuation">]</span>
<span class="Keyword">proc</span> <span class="Identifier">main</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">async</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
<span class="Keyword">var</span> <span class="Identifier">file</span> <span class="Operator">=</span> <span class="Identifier">openAsync</span><span class="Punctuation">(</span><span class="Identifier">getTempDir</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator">/</span> <span class="StringLit">&quot;foobar.txt&quot;</span><span class="Punctuation">,</span> <span class="Identifier">fmReadWrite</span><span class="Punctuation">)</span>
<span class="Identifier">await</span> <span class="Identifier">file</span><span class="Operator">.</span><span class="Identifier">write</span><span class="Punctuation">(</span><span class="StringLit">&quot;test&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">file</span><span class="Operator">.</span><span class="Identifier">setFilePos</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">)</span>
<span class="Keyword">let</span> <span class="Identifier">data</span> <span class="Operator">=</span> <span class="Identifier">await</span> <span class="Identifier">file</span><span class="Operator">.</span><span class="Identifier">readAll</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Identifier">data</span> <span class="Operator">==</span> <span class="StringLit">&quot;test&quot;</span>
<span class="Identifier">file</span><span class="Operator">.</span><span class="Identifier">close</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Identifier">waitFor</span> <span class="Identifier">main</span><span class="Punctuation">(</span><span class="Punctuation">)</span></pre></p>
</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="asyncdispatch.html">asyncdispatch</a>, <a class="reference external" href="os.html">os</a>, <a class="reference external" href="assertions.html">assertions</a>, <a class="reference external" href="syncio.html">syncio</a>, <a class="reference external" href="widestrs.html">widestrs</a>, <a class="reference external" href="winlean.html">winlean</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="AsyncFile">
<dt><pre><a href="asyncfile.html#AsyncFile"><span class="Identifier">AsyncFile</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfile.nim#L41" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfile.nim#L41" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="close-procs-all">
<div id="close,AsyncFile">
<dt><pre><span class="Keyword">proc</span> <a href="#close%2CAsyncFile"><span class="Identifier">close</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="asyncfile.html#AsyncFile"><span class="Identifier">AsyncFile</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Closes the file specified.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfile.nim#L505" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfile.nim#L505" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getFilePos-procs-all">
<div id="getFilePos,AsyncFile">
<dt><pre><span class="Keyword">proc</span> <a href="#getFilePos%2CAsyncFile"><span class="Identifier">getFilePos</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="asyncfile.html#AsyncFile"><span class="Identifier">AsyncFile</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int64"><span class="Identifier">int64</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Retrieves the current position of the file pointer that is used to read from the specified file. The file's first byte has the index zero.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfile.nim#L314" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfile.nim#L314" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getFileSize-procs-all">
<div id="getFileSize,AsyncFile">
<dt><pre><span class="Keyword">proc</span> <a href="#getFileSize%2CAsyncFile"><span class="Identifier">getFileSize</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="asyncfile.html#AsyncFile"><span class="Identifier">AsyncFile</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int64"><span class="Identifier">int64</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Retrieves the specified file's size.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfile.nim#L78" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfile.nim#L78" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newAsyncFile-procs-all">
<div id="newAsyncFile,AsyncFD">
<dt><pre><span class="Keyword">proc</span> <a href="#newAsyncFile%2CAsyncFD"><span class="Identifier">newAsyncFile</span></a><span class="Other">(</span><span class="Identifier">fd</span><span class="Other">:</span> <a href="asyncdispatch.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">)</span><span class="Other">:</span> <a href="asyncfile.html#AsyncFile"><span class="Identifier">AsyncFile</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Creates <tt class="docutils literal"><span class="pre"><span class="Identifier">AsyncFile</span></span></tt> with a previously opened file descriptor <tt class="docutils literal"><span class="pre"><span class="Identifier">fd</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfile.nim#L92" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfile.nim#L92" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="openAsync-procs-all">
<div id="openAsync,string">
<dt><pre><span class="Keyword">proc</span> <a href="#openAsync%2Cstring"><span class="Identifier">openAsync</span></a><span class="Other">(</span><span class="Identifier">filename</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">mode</span> <span class="Other">=</span> <span class="Identifier">fmRead</span><span class="Other">)</span><span class="Other">:</span> <a href="asyncfile.html#AsyncFile"><span class="Identifier">AsyncFile</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Opens a file specified by the path in <tt class="docutils literal"><span class="pre"><span class="Identifier">filename</span></span></tt> using the specified FileMode <tt class="docutils literal"><span class="pre"><span class="Identifier">mode</span></span></tt> asynchronously.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfile.nim#L98" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfile.nim#L98" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="read-procs-all">
<div id="read,AsyncFile,int">
<dt><pre><span class="Keyword">proc</span> <a href="#read%2CAsyncFile%2Cint"><span class="Identifier">read</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="asyncfile.html#AsyncFile"><span class="Identifier">AsyncFile</span></a><span class="Other">;</span> <span class="Identifier">size</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Read <tt class="docutils literal"><span class="pre"><span class="Identifier">size</span></span></tt> bytes from the specified file asynchronously starting at the current position of the file pointer. <tt class="docutils literal"><span class="pre"><span class="Identifier">size</span></span></tt> should be greater than zero.</p>
<p>If the file pointer is past the end of the file then an empty string is returned.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfile.nim#L204" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfile.nim#L204" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="readAll-procs-all">
<div id="readAll,AsyncFile">
<dt><pre><span class="Keyword">proc</span> <a href="#readAll%2CAsyncFile"><span class="Identifier">readAll</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="asyncfile.html#AsyncFile"><span class="Identifier">AsyncFile</span></a><span class="Other">)</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Reads all data from the specified file.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfile.nim#L329" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfile.nim#L329" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="readBuffer-procs-all">
<div id="readBuffer,AsyncFile,pointer,int">
<dt><pre><span class="Keyword">proc</span> <a href="#readBuffer%2CAsyncFile%2Cpointer%2Cint"><span class="Identifier">readBuffer</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="asyncfile.html#AsyncFile"><span class="Identifier">AsyncFile</span></a><span class="Other">;</span> <span class="Identifier">buf</span><span class="Other">:</span> <a href="system.html#pointer"><span class="Identifier">pointer</span></a><span class="Other">;</span> <span class="Identifier">size</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Read <tt class="docutils literal"><span class="pre"><span class="Identifier">size</span></span></tt> bytes from the specified file asynchronously starting at the current position of the file pointer.</p>
<p>If the file pointer is past the end of the file then zero is returned and no bytes are read into <tt class="docutils literal"><span class="pre"><span class="Identifier">buf</span></span></tt></p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfile.nim#L127" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfile.nim#L127" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="readLine-procs-all">
<div id="readLine,AsyncFile">
<dt><pre><span class="Keyword">proc</span> <a href="#readLine%2CAsyncFile"><span class="Identifier">readLine</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="asyncfile.html#AsyncFile"><span class="Identifier">AsyncFile</span></a><span class="Other">)</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Reads a single line from the specified file asynchronously.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfile.nim#L299" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfile.nim#L299" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="readToStream-procs-all">
<div id="readToStream,AsyncFile,FutureStream[string]">
<dt><pre><span class="Keyword">proc</span> <a href="#readToStream%2CAsyncFile%2CFutureStream%5Bstring%5D"><span class="Identifier">readToStream</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="asyncfile.html#AsyncFile"><span class="Identifier">AsyncFile</span></a><span class="Other">;</span> <span class="Identifier">fs</span><span class="Other">:</span> <a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#owned"><span class="Identifier">owned</span></a><span class="Other">(</span>
<a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Writes data to the specified future stream as the file is read.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfile.nim#L529" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfile.nim#L529" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="setFilePos-procs-all">
<div id="setFilePos,AsyncFile,int64">
<dt><pre><span class="Keyword">proc</span> <a href="#setFilePos%2CAsyncFile%2Cint64"><span class="Identifier">setFilePos</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="asyncfile.html#AsyncFile"><span class="Identifier">AsyncFile</span></a><span class="Other">;</span> <span class="Identifier">pos</span><span class="Other">:</span> <a href="system.html#int64"><span class="Identifier">int64</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Sets the position of the file pointer that is used for read/write operations. The file's first byte has the index zero.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfile.nim#L320" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfile.nim#L320" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="setFileSize-procs-all">
<div id="setFileSize,AsyncFile,int64">
<dt><pre><span class="Keyword">proc</span> <a href="#setFileSize%2CAsyncFile%2Cint64"><span class="Identifier">setFileSize</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="asyncfile.html#AsyncFile"><span class="Identifier">AsyncFile</span></a><span class="Other">;</span> <span class="Identifier">length</span><span class="Other">:</span> <a href="system.html#int64"><span class="Identifier">int64</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Set a file length.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfile.nim#L488" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfile.nim#L488" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="write-procs-all">
<div id="write,AsyncFile,string">
<dt><pre><span class="Keyword">proc</span> <a href="#write%2CAsyncFile%2Cstring"><span class="Identifier">write</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="asyncfile.html#AsyncFile"><span class="Identifier">AsyncFile</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Writes <tt class="docutils literal"><span class="pre"><span class="Identifier">data</span></span></tt> to the file specified asynchronously.</p>
<p>The returned Future will complete once all data has been written to the specified file.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfile.nim#L407" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfile.nim#L407" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="writeBuffer-procs-all">
<div id="writeBuffer,AsyncFile,pointer,int">
<dt><pre><span class="Keyword">proc</span> <a href="#writeBuffer%2CAsyncFile%2Cpointer%2Cint"><span class="Identifier">writeBuffer</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="asyncfile.html#AsyncFile"><span class="Identifier">AsyncFile</span></a><span class="Other">;</span> <span class="Identifier">buf</span><span class="Other">:</span> <a href="system.html#pointer"><span class="Identifier">pointer</span></a><span class="Other">;</span> <span class="Identifier">size</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Writes <tt class="docutils literal"><span class="pre"><span class="Identifier">size</span></span></tt> bytes from <tt class="docutils literal"><span class="pre"><span class="Identifier">buf</span></span></tt> to the file specified asynchronously.</p>
<p>The returned Future will complete once all data has been written to the specified file.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfile.nim#L338" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfile.nim#L338" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="writeFromStream-procs-all">
<div id="writeFromStream,AsyncFile,FutureStream[string]">
<dt><pre><span class="Keyword">proc</span> <a href="#writeFromStream%2CAsyncFile%2CFutureStream%5Bstring%5D"><span class="Identifier">writeFromStream</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="asyncfile.html#AsyncFile"><span class="Identifier">AsyncFile</span></a><span class="Other">;</span> <span class="Identifier">fs</span><span class="Other">:</span> <a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#owned"><span class="Identifier">owned</span></a><span class="Other">(</span>
<a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Reads data from the specified future stream until it is completed. The data which is read is written to the file immediately and freed from memory.</p>
<p>This procedure is perfect for saving streamed data to a file without wasting memory.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfile.nim#L515" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfile.nim#L515" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:07:36 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

17
asyncfile.idx Normal file
View File

@@ -0,0 +1,17 @@
nimTitle asyncfile asyncfile.html module std/asyncfile 0
nim AsyncFile asyncfile.html#AsyncFile type AsyncFile 41
nim getFileSize asyncfile.html#getFileSize,AsyncFile proc getFileSize(f: AsyncFile): int64 78
nim newAsyncFile asyncfile.html#newAsyncFile,AsyncFD proc newAsyncFile(fd: AsyncFD): AsyncFile 92
nim openAsync asyncfile.html#openAsync,string proc openAsync(filename: string; mode = fmRead): AsyncFile 98
nim readBuffer asyncfile.html#readBuffer,AsyncFile,pointer,int proc readBuffer(f: AsyncFile; buf: pointer; size: int): Future[int] 127
nim read asyncfile.html#read,AsyncFile,int proc read(f: AsyncFile; size: int): Future[string] 204
nim readLine asyncfile.html#readLine,AsyncFile proc readLine(f: AsyncFile): Future[string] 299
nim getFilePos asyncfile.html#getFilePos,AsyncFile proc getFilePos(f: AsyncFile): int64 314
nim setFilePos asyncfile.html#setFilePos,AsyncFile,int64 proc setFilePos(f: AsyncFile; pos: int64) 320
nim readAll asyncfile.html#readAll,AsyncFile proc readAll(f: AsyncFile): Future[string] 329
nim writeBuffer asyncfile.html#writeBuffer,AsyncFile,pointer,int proc writeBuffer(f: AsyncFile; buf: pointer; size: int): Future[void] 338
nim write asyncfile.html#write,AsyncFile,string proc write(f: AsyncFile; data: string): Future[void] 407
nim setFileSize asyncfile.html#setFileSize,AsyncFile,int64 proc setFileSize(f: AsyncFile; length: int64) 488
nim close asyncfile.html#close,AsyncFile proc close(f: AsyncFile) 505
nim writeFromStream asyncfile.html#writeFromStream,AsyncFile,FutureStream[string] proc writeFromStream(f: AsyncFile; fs: FutureStream[string]): owned(Future[void]) 515
nim readToStream asyncfile.html#readToStream,AsyncFile,FutureStream[string] proc readToStream(f: AsyncFile; fs: FutureStream[string]): owned(Future[void]) 529

594
asyncftpclient.html Normal file
View File

@@ -0,0 +1,594 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>src/asyncftpclient</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">src/asyncftpclient</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li><a class="reference" id="connecting-to-an-ftp-server_toc" href="#connecting-to-an-ftp-server">Connecting to an FTP server</a></li>
<li><a class="reference" id="uploading-a-new-file_toc" href="#uploading-a-new-file">Uploading a new file</a></li>
<li><a class="reference" id="checking-the-progress-of-a-file-transfer_toc" href="#checking-the-progress-of-a-file-transfer">Checking the progress of a file transfer</a></li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#AsyncFtpClient" title="AsyncFtpClient = ref object
csock*: AsyncSocket
dsock*: AsyncSocket
user*, pass*: string
address*: string
port*: Port
jobInProgress*: bool
job*: FtpJob
dsockConnected*: bool
when defined(ssl):">AsyncFtpClient</a></li>
<li><a class="reference" href="#FtpEvent" title="FtpEvent = object
filename*: string
case typ*: FtpEventType
of EvLines:
lines*: string ## Lines that have been transferred.
of EvRetr, EvStore: ## Retr/Store operation finished.
nil
of EvTransferProgress:
bytesTotal*: BiggestInt ## Bytes total.
bytesFinished*: BiggestInt ## Bytes transferred.
speed*: BiggestInt ## Speed in bytes/s
currentJob*: FtpJobType ## The current job being performed.">FtpEvent</a></li>
<li><a class="reference" href="#FtpEventType" title="FtpEventType = enum
EvTransferProgress, EvLines, EvRetr, EvStore">FtpEventType</a></li>
<li><a class="reference" href="#FtpJobType" title="FtpJobType = enum
JRetrText, JRetr, JStore">FtpJobType</a></li>
<li><a class="reference" href="#ProgressChangedProc" title="ProgressChangedProc = proc (total, progress: BiggestInt; speed: float): Future[
void] {.closure, gcsafe.}">ProgressChangedProc</a></li>
<li><a class="reference" href="#ReplyError" title="ReplyError = object of IOError">ReplyError</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">cd
<li><a class="reference" href="#cd%2CAsyncFtpClient%2Cstring" title="cd(ftp: AsyncFtpClient; dir: string): owned(Future[void])">cd(ftp: AsyncFtpClient; dir: string): owned(Future[void])</a></li>
</ul>
<ul class="simple nested-toc-section">cdup
<li><a class="reference" href="#cdup%2CAsyncFtpClient" title="cdup(ftp: AsyncFtpClient): owned(Future[void])">cdup(ftp: AsyncFtpClient): owned(Future[void])</a></li>
</ul>
<ul class="simple nested-toc-section">chmod
<li><a class="reference" href="#chmod%2CAsyncFtpClient%2Cstring%2Cset%5BFilePermission%5D" title="chmod(ftp: AsyncFtpClient; path: string; permissions: set[FilePermission]): owned(
Future[void])">chmod(ftp: AsyncFtpClient; path: string; permissions: set[FilePermission]): owned(
Future[void])</a></li>
</ul>
<ul class="simple nested-toc-section">connect
<li><a class="reference" href="#connect%2CAsyncFtpClient" title="connect(ftp: AsyncFtpClient): owned(Future[void])">connect(ftp: AsyncFtpClient): owned(Future[void])</a></li>
</ul>
<ul class="simple nested-toc-section">createDir
<li><a class="reference" href="#createDir%2CAsyncFtpClient%2Cstring" title="createDir(ftp: AsyncFtpClient; dir: string; recursive = false): owned(
Future[void])">createDir(ftp: AsyncFtpClient; dir: string; recursive = false): owned(
Future[void])</a></li>
</ul>
<ul class="simple nested-toc-section">defaultOnProgressChanged
<li><a class="reference" href="#defaultOnProgressChanged%2CBiggestInt%2CBiggestInt%2Cfloat" title="defaultOnProgressChanged(total, progress: BiggestInt; speed: float): Future[void]">defaultOnProgressChanged(total, progress: BiggestInt; speed: float): Future[void]</a></li>
</ul>
<ul class="simple nested-toc-section">fileExists
<li><a class="reference" href="#fileExists%2CAsyncFtpClient%2Cstring" title="fileExists(ftp: AsyncFtpClient; file: string): Future[bool]">fileExists(ftp: AsyncFtpClient; file: string): Future[bool]</a></li>
</ul>
<ul class="simple nested-toc-section">list
<li><a class="reference" href="#list%2CAsyncFtpClient%2Cstring" title="list(ftp: AsyncFtpClient; dir = &quot;&quot;): Future[string]">list(ftp: AsyncFtpClient; dir = &quot;&quot;): Future[string]</a></li>
</ul>
<ul class="simple nested-toc-section">listDirs
<li><a class="reference" href="#listDirs%2CAsyncFtpClient%2Cstring" title="listDirs(ftp: AsyncFtpClient; dir = &quot;&quot;): Future[seq[string]]">listDirs(ftp: AsyncFtpClient; dir = &quot;&quot;): Future[seq[string]]</a></li>
</ul>
<ul class="simple nested-toc-section">newAsyncFtpClient
<li><a class="reference" href="#newAsyncFtpClient%2Cstring%2Cstring%2Cstring%2Cint%2CSslContext" title="newAsyncFtpClient(address: string; port = Port(21); user, pass = &quot;&quot;;
progressInterval: int = 1000; useTls = false;
sslContext: SslContext = nil): AsyncFtpClient">newAsyncFtpClient(address: string; port = Port(21); user, pass = &quot;&quot;;
progressInterval: int = 1000; useTls = false;
sslContext: SslContext = nil): AsyncFtpClient</a></li>
</ul>
<ul class="simple nested-toc-section">pwd
<li><a class="reference" href="#pwd%2CAsyncFtpClient" title="pwd(ftp: AsyncFtpClient): Future[string]">pwd(ftp: AsyncFtpClient): Future[string]</a></li>
</ul>
<ul class="simple nested-toc-section">removeDir
<li><a class="reference" href="#removeDir%2CAsyncFtpClient%2Cstring" title="removeDir(ftp: AsyncFtpClient; dir: string): owned(Future[void])">removeDir(ftp: AsyncFtpClient; dir: string): owned(Future[void])</a></li>
</ul>
<ul class="simple nested-toc-section">removeFile
<li><a class="reference" href="#removeFile%2CAsyncFtpClient%2Cstring" title="removeFile(ftp: AsyncFtpClient; filename: string): owned(Future[void])">removeFile(ftp: AsyncFtpClient; filename: string): owned(Future[void])</a></li>
</ul>
<ul class="simple nested-toc-section">rename
<li><a class="reference" href="#rename%2CAsyncFtpClient%2Cstring%2Cstring" title="rename(ftp: AsyncFtpClient; nameFrom: string; nameTo: string): owned(
Future[void])">rename(ftp: AsyncFtpClient; nameFrom: string; nameTo: string): owned(
Future[void])</a></li>
</ul>
<ul class="simple nested-toc-section">retrFile
<li><a class="reference" href="#retrFile%2CAsyncFtpClient%2Cstring%2Cstring%2CProgressChangedProc" title="retrFile(ftp: AsyncFtpClient; file, dest: string;
onProgressChanged: ProgressChangedProc = defaultOnProgressChanged): owned(
Future[void])">retrFile(ftp: AsyncFtpClient; file, dest: string;
onProgressChanged: ProgressChangedProc = defaultOnProgressChanged): owned(
Future[void])</a></li>
</ul>
<ul class="simple nested-toc-section">retrText
<li><a class="reference" href="#retrText%2CAsyncFtpClient%2Cstring" title="retrText(ftp: AsyncFtpClient; file: string): Future[string]">retrText(ftp: AsyncFtpClient; file: string): Future[string]</a></li>
</ul>
<ul class="simple nested-toc-section">send
<li><a class="reference" href="#send%2CAsyncFtpClient%2Cstring" title="send(ftp: AsyncFtpClient; m: string): Future[string]">send(ftp: AsyncFtpClient; m: string): Future[string]</a></li>
</ul>
<ul class="simple nested-toc-section">store
<li><a class="reference" href="#store%2CAsyncFtpClient%2Cstring%2Cstring%2CProgressChangedProc" title="store(ftp: AsyncFtpClient; file, dest: string;
onProgressChanged: ProgressChangedProc = defaultOnProgressChanged): owned(
Future[void])">store(ftp: AsyncFtpClient; file, dest: string;
onProgressChanged: ProgressChangedProc = defaultOnProgressChanged): owned(
Future[void])</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<div id="tocRoot"></div>
<p class="module-desc"><div class="admonition admonition-info"><span class="admonition-info-text"><b>Note:</b></span>
In order to use this module, run <tt class="docutils literal"><span class="pre"><span class="Identifier">nimble</span> <span class="Identifier">install</span> <span class="Identifier">asyncftpclient</span></span></tt>.</div>
<p>This module implements an asynchronous FTP client. It allows you to connect to an FTP server and perform operations on it such as for example:</p>
<ul class="simple"><li>The upload of new files.</li>
<li>The removal of existing files.</li>
<li>Download of files.</li>
<li>Changing of files' permissions.</li>
<li>Navigation through the FTP server's directories.</li>
</ul>
<h1><a class="toc-backref" id="connecting-to-an-ftp-server" href="#connecting-to-an-ftp-server">Connecting to an FTP server</a></h1><p>In order to begin any sort of transfer of files you must first connect to an FTP server. You can do so with the <tt class="docutils literal"><span class="pre"><span class="Identifier">connect</span></span></tt> procedure.</p>
<p><pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">asyncdispatch</span>
<span class="Keyword">import</span> <span class="Identifier">pkg</span><span class="Operator">/</span><span class="Identifier">asyncftpclient</span>
<span class="Keyword">proc</span> <span class="Identifier">main</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">async</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
<span class="Keyword">var</span> <span class="Identifier">ftp</span> <span class="Operator">=</span> <span class="Identifier">newAsyncFtpClient</span><span class="Punctuation">(</span><span class="StringLit">&quot;example.com&quot;</span><span class="Punctuation">,</span> <span class="Identifier">user</span> <span class="Operator">=</span> <span class="StringLit">&quot;test&quot;</span><span class="Punctuation">,</span> <span class="Identifier">pass</span> <span class="Operator">=</span> <span class="StringLit">&quot;test&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">await</span> <span class="Identifier">ftp</span><span class="Operator">.</span><span class="Identifier">connect</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Identifier">echo</span><span class="Punctuation">(</span><span class="StringLit">&quot;Connected&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">waitFor</span><span class="Punctuation">(</span><span class="Identifier">main</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Punctuation">)</span></pre></p>
<p>A new <tt class="docutils literal"><span class="pre"><span class="Identifier">main</span></span></tt> async procedure must be declared to allow the use of the <tt class="docutils literal"><span class="pre"><span class="Identifier">await</span></span></tt> keyword. The connection will complete asynchronously and the client will be connected after the <tt class="docutils literal"><span class="pre"><span class="Identifier">await</span> <span class="Identifier">ftp</span><span class="Operator">.</span><span class="Identifier">connect</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> call.</p>
<h1><a class="toc-backref" id="uploading-a-new-file" href="#uploading-a-new-file">Uploading a new file</a></h1><p>After a connection is made you can use the <tt class="docutils literal"><span class="pre"><span class="Identifier">store</span></span></tt> procedure to upload a new file to the FTP server. Make sure to check you are in the correct working directory before you do so with the <tt class="docutils literal"><span class="pre"><span class="Identifier">pwd</span></span></tt> procedure, you can also instead specify an absolute path.</p>
<p><pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">asyncdispatch</span>
<span class="Keyword">import</span> <span class="Identifier">pkg</span><span class="Operator">/</span><span class="Identifier">asyncftpclient</span>
<span class="Keyword">proc</span> <span class="Identifier">main</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">async</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
<span class="Keyword">var</span> <span class="Identifier">ftp</span> <span class="Operator">=</span> <span class="Identifier">newAsyncFtpClient</span><span class="Punctuation">(</span><span class="StringLit">&quot;example.com&quot;</span><span class="Punctuation">,</span> <span class="Identifier">user</span> <span class="Operator">=</span> <span class="StringLit">&quot;test&quot;</span><span class="Punctuation">,</span> <span class="Identifier">pass</span> <span class="Operator">=</span> <span class="StringLit">&quot;test&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">await</span> <span class="Identifier">ftp</span><span class="Operator">.</span><span class="Identifier">connect</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Keyword">let</span> <span class="Identifier">currentDir</span> <span class="Operator">=</span> <span class="Identifier">await</span> <span class="Identifier">ftp</span><span class="Operator">.</span><span class="Identifier">pwd</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">currentDir</span> <span class="Operator">==</span> <span class="StringLit">&quot;/home/user/&quot;</span>
<span class="Identifier">await</span> <span class="Identifier">ftp</span><span class="Operator">.</span><span class="Identifier">store</span><span class="Punctuation">(</span><span class="StringLit">&quot;file.txt&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;file.txt&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">echo</span><span class="Punctuation">(</span><span class="StringLit">&quot;File finished uploading&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">waitFor</span><span class="Punctuation">(</span><span class="Identifier">main</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Punctuation">)</span></pre></p>
<h1><a class="toc-backref" id="checking-the-progress-of-a-file-transfer" href="#checking-the-progress-of-a-file-transfer">Checking the progress of a file transfer</a></h1><p>The progress of either a file upload or a file download can be checked by specifying a <tt class="docutils literal"><span class="pre"><span class="Identifier">onProgressChanged</span></span></tt> procedure to the <tt class="docutils literal"><span class="pre"><span class="Identifier">store</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Identifier">retrFile</span></span></tt> procedures.</p>
<p>Procs that take an <tt class="docutils literal"><span class="pre"><span class="Identifier">onProgressChanged</span></span></tt> callback will call this every <tt class="docutils literal"><span class="pre"><span class="Identifier">progressInterval</span></span></tt> milliseconds.</p>
<p><pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">asyncdispatch</span>
<span class="Keyword">import</span> <span class="Identifier">pkg</span><span class="Operator">/</span><span class="Identifier">asyncftpclient</span>
<span class="Keyword">proc</span> <span class="Identifier">onProgressChanged</span><span class="Punctuation">(</span><span class="Identifier">total</span><span class="Punctuation">,</span> <span class="Identifier">progress</span><span class="Punctuation">:</span> <span class="Identifier">BiggestInt</span><span class="Punctuation">,</span>
<span class="Identifier">speed</span><span class="Punctuation">:</span> <span class="Identifier">float</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">async</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
<span class="Identifier">echo</span><span class="Punctuation">(</span><span class="StringLit">&quot;Uploaded &quot;</span><span class="Punctuation">,</span> <span class="Identifier">progress</span><span class="Punctuation">,</span> <span class="StringLit">&quot; of &quot;</span><span class="Punctuation">,</span> <span class="Identifier">total</span><span class="Punctuation">,</span> <span class="StringLit">&quot; bytes&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">echo</span><span class="Punctuation">(</span><span class="StringLit">&quot;Current speed: &quot;</span><span class="Punctuation">,</span> <span class="Identifier">speed</span><span class="Punctuation">,</span> <span class="StringLit">&quot; kb/s&quot;</span><span class="Punctuation">)</span>
<span class="Keyword">proc</span> <span class="Identifier">main</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">async</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
<span class="Keyword">var</span> <span class="Identifier">ftp</span> <span class="Operator">=</span> <span class="Identifier">newAsyncFtpClient</span><span class="Punctuation">(</span><span class="StringLit">&quot;example.com&quot;</span><span class="Punctuation">,</span> <span class="Identifier">user</span> <span class="Operator">=</span> <span class="StringLit">&quot;test&quot;</span><span class="Punctuation">,</span> <span class="Identifier">pass</span> <span class="Operator">=</span> <span class="StringLit">&quot;test&quot;</span><span class="Punctuation">,</span> <span class="Identifier">progressInterval</span> <span class="Operator">=</span> <span class="DecNumber">500</span><span class="Punctuation">)</span>
<span class="Identifier">await</span> <span class="Identifier">ftp</span><span class="Operator">.</span><span class="Identifier">connect</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Identifier">await</span> <span class="Identifier">ftp</span><span class="Operator">.</span><span class="Identifier">store</span><span class="Punctuation">(</span><span class="StringLit">&quot;file.txt&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;/home/user/file.txt&quot;</span><span class="Punctuation">,</span> <span class="Identifier">onProgressChanged</span><span class="Punctuation">)</span>
<span class="Identifier">echo</span><span class="Punctuation">(</span><span class="StringLit">&quot;File finished uploading&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">waitFor</span><span class="Punctuation">(</span><span class="Identifier">main</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Punctuation">)</span></pre></p>
</p>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="AsyncFtpClient">
<dt><pre><a href="asyncftpclient.html#AsyncFtpClient"><span class="Identifier">AsyncFtpClient</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span>
<span class="Identifier">csock</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">AsyncSocket</span>
<span class="Identifier">dsock</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">AsyncSocket</span>
<span class="Identifier">user</span><span class="Operator">*</span><span class="Other">,</span> <span class="Identifier">pass</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">string</span>
<span class="Identifier">address</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">string</span>
<span class="Identifier">port</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">Port</span>
<span class="Identifier">jobInProgress</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">bool</span>
<span class="Identifier">job</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">FtpJob</span>
<span class="Identifier">dsockConnected</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">bool</span>
<span class="Keyword">when</span> <span class="Identifier">defined</span><span class="Other">(</span><span class="Identifier">ssl</span><span class="Other">)</span><span class="Other">:</span></pre></dt>
<dd>
</dd>
</div>
<div id="FtpEvent">
<dt><pre><a href="asyncftpclient.html#FtpEvent"><span class="Identifier">FtpEvent</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">filename</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">string</span>
<span class="Keyword">case</span> <span class="Identifier">typ</span><span class="Operator">*</span><span class="Other">:</span> <a href="asyncftpclient.html#FtpEventType"><span class="Identifier">FtpEventType</span></a>
<span class="Keyword">of</span> <span class="Identifier">EvLines</span><span class="Other">:</span>
<span class="Identifier">lines</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">string</span> <span class="Comment">## Lines that have been transferred.</span>
<span class="Keyword">of</span> <span class="Identifier">EvRetr</span><span class="Other">,</span> <span class="Identifier">EvStore</span><span class="Other">:</span> <span class="Comment">## Retr/Store operation finished.</span>
<span class="Keyword">nil</span>
<span class="Keyword">of</span> <span class="Identifier">EvTransferProgress</span><span class="Other">:</span>
<span class="Identifier">bytesTotal</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">BiggestInt</span> <span class="Comment">## Bytes total.</span>
<span class="Identifier">bytesFinished</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">BiggestInt</span> <span class="Comment">## Bytes transferred.</span>
<span class="Identifier">speed</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">BiggestInt</span> <span class="Comment">## Speed in bytes/s</span>
<span class="Identifier">currentJob</span><span class="Operator">*</span><span class="Other">:</span> <a href="asyncftpclient.html#FtpJobType"><span class="Identifier">FtpJobType</span></a> <span class="Comment">## The current job being performed.</span></pre></dt>
<dd>
Event
</dd>
</div>
<div id="FtpEventType">
<dt><pre><a href="asyncftpclient.html#FtpEventType"><span class="Identifier">FtpEventType</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">EvTransferProgress</span><span class="Other">,</span> <span class="Identifier">EvLines</span><span class="Other">,</span> <span class="Identifier">EvRetr</span><span class="Other">,</span> <span class="Identifier">EvStore</span></pre></dt>
<dd>
</dd>
</div>
<div id="FtpJobType">
<dt><pre><a href="asyncftpclient.html#FtpJobType"><span class="Identifier">FtpJobType</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">JRetrText</span><span class="Other">,</span> <span class="Identifier">JRetr</span><span class="Other">,</span> <span class="Identifier">JStore</span></pre></dt>
<dd>
</dd>
</div>
<div id="ProgressChangedProc">
<dt><pre><a href="asyncftpclient.html#ProgressChangedProc"><span class="Identifier">ProgressChangedProc</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">total</span><span class="Other">,</span> <span class="Identifier">progress</span><span class="Other">:</span> <span class="Identifier">BiggestInt</span><span class="Other">;</span> <span class="Identifier">speed</span><span class="Other">:</span> <span class="Identifier">float</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span>
<span class="Identifier">void</span><span class="Other">]</span> {.<span class="Identifier">closure</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span></span>.}</pre></dt>
<dd>
</dd>
</div>
<div id="ReplyError">
<dt><pre><a href="asyncftpclient.html#ReplyError"><span class="Identifier">ReplyError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">IOError</span></pre></dt>
<dd>
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="cd-procs-all">
<div id="cd,AsyncFtpClient,string">
<dt><pre><span class="Keyword">proc</span> <a href="#cd%2CAsyncFtpClient%2Cstring"><span class="Identifier">cd</span></a><span class="Other">(</span><span class="Identifier">ftp</span><span class="Other">:</span> <a href="asyncftpclient.html#AsyncFtpClient"><span class="Identifier">AsyncFtpClient</span></a><span class="Other">;</span> <span class="Identifier">dir</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span><span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ReplyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Changes the current directory on the remote FTP server to <tt class="docutils literal"><span class="pre"><span class="Identifier">dir</span></span></tt>.
</dd>
</div>
</div>
<div id="cdup-procs-all">
<div id="cdup,AsyncFtpClient">
<dt><pre><span class="Keyword">proc</span> <a href="#cdup%2CAsyncFtpClient"><span class="Identifier">cdup</span></a><span class="Other">(</span><span class="Identifier">ftp</span><span class="Other">:</span> <a href="asyncftpclient.html#AsyncFtpClient"><span class="Identifier">AsyncFtpClient</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span><span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ReplyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Changes the current directory to the parent of the current directory.
</dd>
</div>
</div>
<div id="chmod-procs-all">
<div id="chmod,AsyncFtpClient,string,set[FilePermission]">
<dt><pre><span class="Keyword">proc</span> <a href="#chmod%2CAsyncFtpClient%2Cstring%2Cset%5BFilePermission%5D"><span class="Identifier">chmod</span></a><span class="Other">(</span><span class="Identifier">ftp</span><span class="Other">:</span> <a href="asyncftpclient.html#AsyncFtpClient"><span class="Identifier">AsyncFtpClient</span></a><span class="Other">;</span> <span class="Identifier">path</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">permissions</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><span class="Identifier">FilePermission</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span>
<span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ReplyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Changes permission of <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt> to <tt class="docutils literal"><span class="pre"><span class="Identifier">permissions</span></span></tt>.
</dd>
</div>
</div>
<div id="connect-procs-all">
<div id="connect,AsyncFtpClient">
<dt><pre><span class="Keyword">proc</span> <a href="#connect%2CAsyncFtpClient"><span class="Identifier">connect</span></a><span class="Other">(</span><span class="Identifier">ftp</span><span class="Other">:</span> <a href="asyncftpclient.html#AsyncFtpClient"><span class="Identifier">AsyncFtpClient</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span><span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">,</span> <span class="Identifier">ReplyError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Connect to the FTP server specified by <tt class="docutils literal"><span class="pre"><span class="Identifier">ftp</span></span></tt>.
</dd>
</div>
</div>
<div id="createDir-procs-all">
<div id="createDir,AsyncFtpClient,string">
<dt><pre><span class="Keyword">proc</span> <a href="#createDir%2CAsyncFtpClient%2Cstring"><span class="Identifier">createDir</span></a><span class="Other">(</span><span class="Identifier">ftp</span><span class="Other">:</span> <a href="asyncftpclient.html#AsyncFtpClient"><span class="Identifier">AsyncFtpClient</span></a><span class="Other">;</span> <span class="Identifier">dir</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">recursive</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span>
<span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ReplyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Creates a directory <tt class="docutils literal"><span class="pre"><span class="Identifier">dir</span></span></tt>. If <tt class="docutils literal"><span class="pre"><span class="Identifier">recursive</span></span></tt> is true, the topmost subdirectory of <tt class="docutils literal"><span class="pre"><span class="Identifier">dir</span></span></tt> will be created first, following the secondmost... etc. this allows you to give a full path as the <tt class="docutils literal"><span class="pre"><span class="Identifier">dir</span></span></tt> without worrying about subdirectories not existing.
</dd>
</div>
</div>
<div id="defaultOnProgressChanged-procs-all">
<div id="defaultOnProgressChanged,BiggestInt,BiggestInt,float">
<dt><pre><span class="Keyword">proc</span> <a href="#defaultOnProgressChanged%2CBiggestInt%2CBiggestInt%2Cfloat"><span class="Identifier">defaultOnProgressChanged</span></a><span class="Other">(</span><span class="Identifier">total</span><span class="Other">,</span> <span class="Identifier">progress</span><span class="Other">:</span> <span class="Identifier">BiggestInt</span><span class="Other">;</span> <span class="Identifier">speed</span><span class="Other">:</span> <span class="Identifier">float</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span>
<span class="Identifier">void</span><span class="Other">]</span> {.<span class="Identifier">nimcall</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Default FTP <tt class="docutils literal"><span class="pre"><span class="Identifier">onProgressChanged</span></span></tt> handler. Does nothing.
</dd>
</div>
</div>
<div id="fileExists-procs-all">
<div id="fileExists,AsyncFtpClient,string">
<dt><pre><span class="Keyword">proc</span> <a href="#fileExists%2CAsyncFtpClient%2Cstring"><span class="Identifier">fileExists</span></a><span class="Other">(</span><span class="Identifier">ftp</span><span class="Other">:</span> <a href="asyncftpclient.html#AsyncFtpClient"><span class="Identifier">AsyncFtpClient</span></a><span class="Other">;</span> <span class="Identifier">file</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">bool</span><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">,</span>
<span class="Identifier">ReplyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">LibraryError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Determines whether <tt class="docutils literal"><span class="pre"><span class="Identifier">file</span></span></tt> exists.
</dd>
</div>
</div>
<div id="list-procs-all">
<div id="list,AsyncFtpClient,string">
<dt><pre><span class="Keyword">proc</span> <a href="#list%2CAsyncFtpClient%2Cstring"><span class="Identifier">list</span></a><span class="Other">(</span><span class="Identifier">ftp</span><span class="Other">:</span> <a href="asyncftpclient.html#AsyncFtpClient"><span class="Identifier">AsyncFtpClient</span></a><span class="Other">;</span> <span class="Identifier">dir</span> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">,</span> <span class="Identifier">ReplyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">LibraryError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Lists all files in <tt class="docutils literal"><span class="pre"><span class="Identifier">dir</span></span></tt>. If <tt class="docutils literal"><span class="pre"><span class="Identifier">dir</span></span></tt> is <tt class="docutils literal"><span class="pre"><span class="StringLit">&quot;&quot;</span></span></tt>, uses the current working directory.
</dd>
</div>
</div>
<div id="listDirs-procs-all">
<div id="listDirs,AsyncFtpClient,string">
<dt><pre><span class="Keyword">proc</span> <a href="#listDirs%2CAsyncFtpClient%2Cstring"><span class="Identifier">listDirs</span></a><span class="Other">(</span><span class="Identifier">ftp</span><span class="Other">:</span> <a href="asyncftpclient.html#AsyncFtpClient"><span class="Identifier">AsyncFtpClient</span></a><span class="Other">;</span> <span class="Identifier">dir</span> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">,</span>
<span class="Identifier">ReplyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">LibraryError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns a list of filenames in the given directory. If <tt class="docutils literal"><span class="pre"><span class="Identifier">dir</span></span></tt> is &quot;&quot;, the current directory is used. If <tt class="docutils literal"><span class="pre"><span class="Identifier">async</span></span></tt> is true, this function will return immediately and it will be your job to use asyncdispatch's <tt class="docutils literal"><span class="pre"><span class="Identifier">poll</span></span></tt> to progress this operation.
</dd>
</div>
</div>
<div id="newAsyncFtpClient-procs-all">
<div id="newAsyncFtpClient,string,string,string,int,SslContext">
<dt><pre><span class="Keyword">proc</span> <a href="#newAsyncFtpClient%2Cstring%2Cstring%2Cstring%2Cint%2CSslContext"><span class="Identifier">newAsyncFtpClient</span></a><span class="Other">(</span><span class="Identifier">address</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">port</span> <span class="Other">=</span> <span class="Identifier">Port</span><span class="Other">(</span><span class="DecNumber">21</span><span class="Other">)</span><span class="Other">;</span> <span class="Identifier">user</span><span class="Other">,</span> <span class="Identifier">pass</span> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">;</span>
<span class="Identifier">progressInterval</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="DecNumber">1000</span><span class="Other">;</span> <span class="Identifier">useTls</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">;</span>
<span class="Identifier">sslContext</span><span class="Other">:</span> <span class="Identifier">SslContext</span> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">)</span><span class="Other">:</span> <a href="asyncftpclient.html#AsyncFtpClient"><span class="Identifier">AsyncFtpClient</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Creates a new <tt class="docutils literal"><span class="pre"><span class="Identifier">AsyncFtpClient</span></span></tt> object.
</dd>
</div>
</div>
<div id="pwd-procs-all">
<div id="pwd,AsyncFtpClient">
<dt><pre><span class="Keyword">proc</span> <a href="#pwd%2CAsyncFtpClient"><span class="Identifier">pwd</span></a><span class="Other">(</span><span class="Identifier">ftp</span><span class="Other">:</span> <a href="asyncftpclient.html#AsyncFtpClient"><span class="Identifier">AsyncFtpClient</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">,</span> <span class="Identifier">ReplyError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns the current working directory.
</dd>
</div>
</div>
<div id="removeDir-procs-all">
<div id="removeDir,AsyncFtpClient,string">
<dt><pre><span class="Keyword">proc</span> <a href="#removeDir%2CAsyncFtpClient%2Cstring"><span class="Identifier">removeDir</span></a><span class="Other">(</span><span class="Identifier">ftp</span><span class="Other">:</span> <a href="asyncftpclient.html#AsyncFtpClient"><span class="Identifier">AsyncFtpClient</span></a><span class="Other">;</span> <span class="Identifier">dir</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span><span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ReplyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Delete a directory <tt class="docutils literal"><span class="pre"><span class="Identifier">dir</span></span></tt> on the remote FTP server
</dd>
</div>
</div>
<div id="removeFile-procs-all">
<div id="removeFile,AsyncFtpClient,string">
<dt><pre><span class="Keyword">proc</span> <a href="#removeFile%2CAsyncFtpClient%2Cstring"><span class="Identifier">removeFile</span></a><span class="Other">(</span><span class="Identifier">ftp</span><span class="Other">:</span> <a href="asyncftpclient.html#AsyncFtpClient"><span class="Identifier">AsyncFtpClient</span></a><span class="Other">;</span> <span class="Identifier">filename</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span><span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ReplyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Delete a file <tt class="docutils literal"><span class="pre"><span class="Identifier">filename</span></span></tt> on the remote FTP server
</dd>
</div>
</div>
<div id="rename-procs-all">
<div id="rename,AsyncFtpClient,string,string">
<dt><pre><span class="Keyword">proc</span> <a href="#rename%2CAsyncFtpClient%2Cstring%2Cstring"><span class="Identifier">rename</span></a><span class="Other">(</span><span class="Identifier">ftp</span><span class="Other">:</span> <a href="asyncftpclient.html#AsyncFtpClient"><span class="Identifier">AsyncFtpClient</span></a><span class="Other">;</span> <span class="Identifier">nameFrom</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">nameTo</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span>
<span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ReplyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Rename a file or directory on the remote FTP Server from current name <tt class="docutils literal"><span class="pre"><span class="Identifier">name_from</span></span></tt> to new name <tt class="docutils literal"><span class="pre"><span class="Identifier">name_to</span></span></tt>
</dd>
</div>
</div>
<div id="retrFile-procs-all">
<div id="retrFile,AsyncFtpClient,string,string,ProgressChangedProc">
<dt><pre><span class="Keyword">proc</span> <a href="#retrFile%2CAsyncFtpClient%2Cstring%2Cstring%2CProgressChangedProc"><span class="Identifier">retrFile</span></a><span class="Other">(</span><span class="Identifier">ftp</span><span class="Other">:</span> <a href="asyncftpclient.html#AsyncFtpClient"><span class="Identifier">AsyncFtpClient</span></a><span class="Other">;</span> <span class="Identifier">file</span><span class="Other">,</span> <span class="Identifier">dest</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span>
<span class="Identifier">onProgressChanged</span><span class="Other">:</span> <a href="asyncftpclient.html#ProgressChangedProc"><span class="Identifier">ProgressChangedProc</span></a> <span class="Other">=</span> <span class="Identifier">defaultOnProgressChanged</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span>
<span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span>
<span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">,</span> <span class="Identifier">ReplyError</span><span class="Other">,</span> <span class="Identifier">LibraryError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">TimeEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Downloads <tt class="docutils literal"><span class="pre"><span class="Identifier">file</span></span></tt> and saves it to <tt class="docutils literal"><span class="pre"><span class="Identifier">dest</span></span></tt>. The <tt class="docutils literal"><span class="pre"><span class="Identifier">EvRetr</span></span></tt> event is passed to the specified <tt class="docutils literal"><span class="pre"><span class="Identifier">handleEvent</span></span></tt> function when the download is finished. The event's <tt class="docutils literal"><span class="pre"><span class="Identifier">filename</span></span></tt> field will be equal to <tt class="docutils literal"><span class="pre"><span class="Identifier">file</span></span></tt>.
</dd>
</div>
</div>
<div id="retrText-procs-all">
<div id="retrText,AsyncFtpClient,string">
<dt><pre><span class="Keyword">proc</span> <a href="#retrText%2CAsyncFtpClient%2Cstring"><span class="Identifier">retrText</span></a><span class="Other">(</span><span class="Identifier">ftp</span><span class="Other">:</span> <a href="asyncftpclient.html#AsyncFtpClient"><span class="Identifier">AsyncFtpClient</span></a><span class="Other">;</span> <span class="Identifier">file</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">,</span>
<span class="Identifier">ReplyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">LibraryError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Retrieves <tt class="docutils literal"><span class="pre"><span class="Identifier">file</span></span></tt>. File must be ASCII text.
</dd>
</div>
</div>
<div id="send-procs-all">
<div id="send,AsyncFtpClient,string">
<dt><pre><span class="Keyword">proc</span> <a href="#send%2CAsyncFtpClient%2Cstring"><span class="Identifier">send</span></a><span class="Other">(</span><span class="Identifier">ftp</span><span class="Other">:</span> <a href="asyncftpclient.html#AsyncFtpClient"><span class="Identifier">AsyncFtpClient</span></a><span class="Other">;</span> <span class="Identifier">m</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">,</span> <span class="Identifier">ReplyError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Send a message to the server, and wait for a primary reply. <tt class="docutils literal"><span class="pre"><span class="Operator">\</span><span class="Identifier">c</span><span class="Operator">\</span><span class="Identifier">L</span></span></tt> is added for you.</p>
<p>You need to make sure that the message <tt class="docutils literal"><span class="pre"><span class="Identifier">m</span></span></tt> doesn't contain any newline characters. Failing to do so will raise <tt class="docutils literal"><span class="pre"><span class="Identifier">AssertionDefect</span></span></tt>.</p>
<p><strong>Note:</strong> The server may return multiple lines of coded replies.</p>
</dd>
</div>
</div>
<div id="store-procs-all">
<div id="store,AsyncFtpClient,string,string,ProgressChangedProc">
<dt><pre><span class="Keyword">proc</span> <a href="#store%2CAsyncFtpClient%2Cstring%2Cstring%2CProgressChangedProc"><span class="Identifier">store</span></a><span class="Other">(</span><span class="Identifier">ftp</span><span class="Other">:</span> <a href="asyncftpclient.html#AsyncFtpClient"><span class="Identifier">AsyncFtpClient</span></a><span class="Other">;</span> <span class="Identifier">file</span><span class="Other">,</span> <span class="Identifier">dest</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span>
<span class="Identifier">onProgressChanged</span><span class="Other">:</span> <a href="asyncftpclient.html#ProgressChangedProc"><span class="Identifier">ProgressChangedProc</span></a> <span class="Other">=</span> <span class="Identifier">defaultOnProgressChanged</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span>
<span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span>
<span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">,</span> <span class="Identifier">ReplyError</span><span class="Other">,</span> <span class="Identifier">LibraryError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">TimeEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Uploads <tt class="docutils literal"><span class="pre"><span class="Identifier">file</span></span></tt> to <tt class="docutils literal"><span class="pre"><span class="Identifier">dest</span></span></tt> on the remote FTP server. Usage of this function asynchronously is recommended to view the progress of the download. The <tt class="docutils literal"><span class="pre"><span class="Identifier">EvStore</span></span></tt> event is passed to the specified <tt class="docutils literal"><span class="pre"><span class="Identifier">handleEvent</span></span></tt> function when the upload is finished, and the <tt class="docutils literal"><span class="pre"><span class="Identifier">filename</span></span></tt> field will be equal to <tt class="docutils literal"><span class="pre"><span class="Identifier">file</span></span></tt>.
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:08 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

35
asyncftpclient.idx Normal file
View File

@@ -0,0 +1,35 @@
nimTitle asyncftpclient asyncftpclient.html module src/asyncftpclient 0
nim AsyncFtpClient asyncftpclient.html#AsyncFtpClient type AsyncFtpClient 110
nim JRetrText asyncftpclient.html#JRetrText FtpJobType.JRetrText 124
nim JRetr asyncftpclient.html#JRetr FtpJobType.JRetr 124
nim JStore asyncftpclient.html#JStore FtpJobType.JStore 124
nim FtpJobType asyncftpclient.html#FtpJobType enum FtpJobType 124
nim EvTransferProgress asyncftpclient.html#EvTransferProgress FtpEventType.EvTransferProgress 141
nim EvLines asyncftpclient.html#EvLines FtpEventType.EvLines 141
nim EvRetr asyncftpclient.html#EvRetr FtpEventType.EvRetr 141
nim EvStore asyncftpclient.html#EvStore FtpEventType.EvStore 141
nim FtpEventType asyncftpclient.html#FtpEventType enum FtpEventType 141
nim FtpEvent asyncftpclient.html#FtpEvent object FtpEvent 144
nim ReplyError asyncftpclient.html#ReplyError object ReplyError 157
nim ProgressChangedProc asyncftpclient.html#ProgressChangedProc type ProgressChangedProc 159
nim send asyncftpclient.html#send,AsyncFtpClient,string proc send(ftp: AsyncFtpClient; m: string): Future[string] 177
nim connect asyncftpclient.html#connect,AsyncFtpClient proc connect(ftp: AsyncFtpClient): owned(Future[void]) 224
nim pwd asyncftpclient.html#pwd,AsyncFtpClient proc pwd(ftp: AsyncFtpClient): Future[string] 259
nim cd asyncftpclient.html#cd,AsyncFtpClient,string proc cd(ftp: AsyncFtpClient; dir: string): owned(Future[void]) 265
nim cdup asyncftpclient.html#cdup,AsyncFtpClient proc cdup(ftp: AsyncFtpClient): owned(Future[void]) 269
nim listDirs asyncftpclient.html#listDirs,AsyncFtpClient,string proc listDirs(ftp: AsyncFtpClient; dir = ""): Future[seq[string]] 286
nim fileExists asyncftpclient.html#fileExists,AsyncFtpClient,string proc fileExists(ftp: AsyncFtpClient; file: string): Future[bool] 297
nim createDir asyncftpclient.html#createDir,AsyncFtpClient,string proc createDir(ftp: AsyncFtpClient; dir: string; recursive = false): owned(\n Future[void]) 303
nim chmod asyncftpclient.html#chmod,AsyncFtpClient,string,set[FilePermission] proc chmod(ftp: AsyncFtpClient; path: string; permissions: set[FilePermission]): owned(\n Future[void]) 321
nim list asyncftpclient.html#list,AsyncFtpClient,string proc list(ftp: AsyncFtpClient; dir = ""): Future[string] 342
nim retrText asyncftpclient.html#retrText,AsyncFtpClient,string proc retrText(ftp: AsyncFtpClient; file: string): Future[string] 352
nim defaultOnProgressChanged asyncftpclient.html#defaultOnProgressChanged,BiggestInt,BiggestInt,float proc defaultOnProgressChanged(total, progress: BiggestInt; speed: float): Future[void] 388
nim retrFile asyncftpclient.html#retrFile,AsyncFtpClient,string,string,ProgressChangedProc proc retrFile(ftp: AsyncFtpClient; file, dest: string;\n onProgressChanged: ProgressChangedProc = defaultOnProgressChanged): owned(\n Future[void]) 396
nim store asyncftpclient.html#store,AsyncFtpClient,string,string,ProgressChangedProc proc store(ftp: AsyncFtpClient; file, dest: string;\n onProgressChanged: ProgressChangedProc = defaultOnProgressChanged): owned(\n Future[void]) 448
nim rename asyncftpclient.html#rename,AsyncFtpClient,string,string proc rename(ftp: AsyncFtpClient; nameFrom: string; nameTo: string): owned(\n Future[void]) 463
nim removeFile asyncftpclient.html#removeFile,AsyncFtpClient,string proc removeFile(ftp: AsyncFtpClient; filename: string): owned(Future[void]) 469
nim removeDir asyncftpclient.html#removeDir,AsyncFtpClient,string proc removeDir(ftp: AsyncFtpClient; dir: string): owned(Future[void]) 473
nim newAsyncFtpClient asyncftpclient.html#newAsyncFtpClient,string,string,string,int,SslContext proc newAsyncFtpClient(address: string; port = Port(21); user, pass = "";\n progressInterval: int = 1000; useTls = false;\n sslContext: SslContext = nil): AsyncFtpClient 477
heading Connecting to an FTP server asyncftpclient.html#connecting-to-an-ftp-server Connecting to an FTP server 0
heading Uploading a new file asyncftpclient.html#uploading-a-new-file Uploading a new file 0
heading Checking the progress of a file transfer asyncftpclient.html#checking-the-progress-of-a-file-transfer Checking the progress of a file transfer 0

669
asyncfutures.html Normal file
View File

@@ -0,0 +1,669 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/asyncfutures</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/asyncfutures</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#Future" title="Future[T] = ref object of FutureBase">Future</a></li>
<li><a class="reference" href="#FutureBase" title="FutureBase = ref object of RootObj
error*: ref Exception ## Stored exception
errorStackTrace*: string
when not defined(release) or defined(futureLogging):">FutureBase</a></li>
<li><a class="reference" href="#FutureError" title="FutureError = object of Defect
cause*: FutureBase">FutureError</a></li>
<li><a class="reference" href="#FutureVar" title="FutureVar[T] = distinct Future[T]">FutureVar</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#isFutureLoggingEnabled" title="isFutureLoggingEnabled = false">isFutureLoggingEnabled</a></li>
<li><a class="reference" href="#NimAsyncContinueSuffix" title="NimAsyncContinueSuffix = &quot;NimAsyncContinue&quot;">NimAsyncContinueSuffix</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">$
<li><a class="reference" href="#%24%2Cseq%5BStackTraceEntry%5D" title="`$`(stackTraceEntries: seq[StackTraceEntry]): string">`$`(stackTraceEntries: seq[StackTraceEntry]): string</a></li>
</ul>
<ul class="simple nested-toc-section">addCallback
<li><a class="reference" href="#addCallback%2CFutureBase%2Cproc%29" title="addCallback(future: FutureBase; cb: proc () {.closure, gcsafe.})">addCallback(future: FutureBase; cb: proc () {.closure, gcsafe.})</a></li>
<li><a class="reference" href="#addCallback%2CFuture%5BT%5D%2Cproc%28Future%5BT%5D%29" title="addCallback[T](future: Future[T];
cb: proc (future: Future[T]) {.closure, gcsafe.})">addCallback[T](future: Future[T];
cb: proc (future: Future[T]) {.closure, gcsafe.})</a></li>
</ul>
<ul class="simple nested-toc-section">all
<li><a class="reference" href="#all%2Cvarargs%5BFuture%5BT%5D%5D" title="all[T](futs: varargs[Future[T]]): auto">all[T](futs: varargs[Future[T]]): auto</a></li>
</ul>
<ul class="simple nested-toc-section">and
<li><a class="reference" href="#and%2CFuture%5BT%5D%2CFuture%5BY%5D" title="`and`[T, Y](fut1: Future[T]; fut2: Future[Y]): Future[void]">`and`[T, Y](fut1: Future[T]; fut2: Future[Y]): Future[void]</a></li>
</ul>
<ul class="simple nested-toc-section">asyncCheck
<li><a class="reference" href="#asyncCheck%2CFuture%5BT%5D" title="asyncCheck[T](future: Future[T])">asyncCheck[T](future: Future[T])</a></li>
</ul>
<ul class="simple nested-toc-section">callback=
<li><a class="reference" href="#callback%3D%2CFutureBase%2Cproc%29" title="callback=(future: FutureBase; cb: proc () {.closure, gcsafe.})">callback=(future: FutureBase; cb: proc () {.closure, gcsafe.})</a></li>
<li><a class="reference" href="#callback%3D%2CFuture%5BT%5D%2Cproc%28Future%5BT%5D%29" title="callback=[T](future: Future[T]; cb: proc (future: Future[T]) {.closure, gcsafe.})">callback=[T](future: Future[T]; cb: proc (future: Future[T]) {.closure, gcsafe.})</a></li>
</ul>
<ul class="simple nested-toc-section">callSoon
<li><a class="reference" href="#callSoon%2Cproc%29" title="callSoon(cbproc: proc () {.gcsafe.})">callSoon(cbproc: proc () {.gcsafe.})</a></li>
</ul>
<ul class="simple nested-toc-section">clean
<li><a class="reference" href="#clean%2CFutureVar%5BT%5D" title="clean[T](future: FutureVar[T])">clean[T](future: FutureVar[T])</a></li>
</ul>
<ul class="simple nested-toc-section">clearCallbacks
<li><a class="reference" href="#clearCallbacks%2CFutureBase" title="clearCallbacks(future: FutureBase)">clearCallbacks(future: FutureBase)</a></li>
</ul>
<ul class="simple nested-toc-section">complete
<li><a class="reference" href="#complete%2CFuture%5Bvoid%5D" title="complete(future: Future[void]; val = Future[void].default)">complete(future: Future[void]; val = Future[void].default)</a></li>
<li><a class="reference" href="#complete%2CFuture%5BT%5D%2CsinkT" title="complete[T](future: Future[T]; val: sink T)">complete[T](future: Future[T]; val: sink T)</a></li>
<li><a class="reference" href="#complete%2CFutureVar%5BT%5D" title="complete[T](future: FutureVar[T])">complete[T](future: FutureVar[T])</a></li>
<li><a class="reference" href="#complete%2CFutureVar%5BT%5D%2CsinkT" title="complete[T](future: FutureVar[T]; val: sink T)">complete[T](future: FutureVar[T]; val: sink T)</a></li>
</ul>
<ul class="simple nested-toc-section">fail
<li><a class="reference" href="#fail%2CFuture%5BT%5D%2Cref.Exception" title="fail[T](future: Future[T]; error: ref Exception)">fail[T](future: Future[T]; error: ref Exception)</a></li>
</ul>
<ul class="simple nested-toc-section">failed
<li><a class="reference" href="#failed%2CFutureBase" title="failed(future: FutureBase): bool">failed(future: FutureBase): bool</a></li>
</ul>
<ul class="simple nested-toc-section">finished
<li><a class="reference" href="#finished" title="finished(future: FutureBase | FutureVar): bool">finished(future: FutureBase | FutureVar): bool</a></li>
</ul>
<ul class="simple nested-toc-section">getCallSoonProc
<li><a class="reference" href="#getCallSoonProc" title="getCallSoonProc(): (proc (cbproc: proc ()) {.gcsafe.})">getCallSoonProc(): (proc (cbproc: proc ()) {.gcsafe.})</a></li>
</ul>
<ul class="simple nested-toc-section">mget
<li><a class="reference" href="#mget%2CFutureVar%5BT%5D" title="mget[T](future: FutureVar[T]): var T">mget[T](future: FutureVar[T]): var T</a></li>
</ul>
<ul class="simple nested-toc-section">newFuture
<li><a class="reference" href="#newFuture%2Cstring" title="newFuture[T](fromProc: string = &quot;unspecified&quot;): owned(Future[T])">newFuture[T](fromProc: string = &quot;unspecified&quot;): owned(Future[T])</a></li>
</ul>
<ul class="simple nested-toc-section">newFutureVar
<li><a class="reference" href="#newFutureVar%2Cstring" title="newFutureVar[T](fromProc = &quot;unspecified&quot;): owned(FutureVar[T])">newFutureVar[T](fromProc = &quot;unspecified&quot;): owned(FutureVar[T])</a></li>
</ul>
<ul class="simple nested-toc-section">or
<li><a class="reference" href="#or%2CFuture%5BT%5D%2CFuture%5BY%5D" title="`or`[T, Y](fut1: Future[T]; fut2: Future[Y]): Future[void]">`or`[T, Y](fut1: Future[T]; fut2: Future[Y]): Future[void]</a></li>
</ul>
<ul class="simple nested-toc-section">read
<li><a class="reference" href="#read_2" title="read(future: Future[void] | FutureVar[void])">read(future: Future[void] | FutureVar[void])</a></li>
<li><a class="reference" href="#read" title="read[T](future: Future[T] | FutureVar[T]): lent T">read[T](future: Future[T] | FutureVar[T]): lent T</a></li>
</ul>
<ul class="simple nested-toc-section">readError
<li><a class="reference" href="#readError%2CFuture%5BT%5D" title="readError[T](future: Future[T]): ref Exception">readError[T](future: Future[T]): ref Exception</a></li>
</ul>
<ul class="simple nested-toc-section">setCallSoonProc
<li><a class="reference" href="#setCallSoonProc" title="setCallSoonProc(p: (proc (cbproc: proc ()) {.gcsafe.}))">setCallSoonProc(p: (proc (cbproc: proc ()) {.gcsafe.}))</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="os.html">os</a>, <a class="reference external" href="sets.html">sets</a>, <a class="reference external" href="tables.html">tables</a>, <a class="reference external" href="strutils.html">strutils</a>, <a class="reference external" href="times.html">times</a>, <a class="reference external" href="heapqueue.html">heapqueue</a>, <a class="reference external" href="options.html">options</a>, <a class="reference external" href="deques.html">deques</a>, <a class="reference external" href="cstrutils.html">cstrutils</a>, <a class="reference external" href="typetraits.html">typetraits</a>, <a class="reference external" href="stacktraces.html">stacktraces</a>, <a class="reference external" href="objectdollar.html">objectdollar</a>, <a class="reference external" href="assertions.html">assertions</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="Future">
<dt><pre><a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="asyncfutures.html#FutureBase"><span class="Identifier">FutureBase</span></a></pre></dt>
<dd>
Typed future.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L37" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L37" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="FutureBase">
<dt><pre><a href="asyncfutures.html#FutureBase"><span class="Identifier">FutureBase</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="system.html#RootObj"><span class="Identifier">RootObj</span></a>
<span class="Identifier">error</span><span class="Operator">*</span><span class="Other">:</span> <span class="Keyword">ref</span> <a href="system.html#Exception"><span class="Identifier">Exception</span></a> <span class="Comment">## Stored exception</span>
<span class="Identifier">errorStackTrace</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a>
<span class="Keyword">when</span> <span class="Keyword">not</span> <span class="Identifier">defined</span><span class="Other">(</span><span class="Identifier">release</span><span class="Other">)</span> <span class="Keyword">or</span> <span class="Identifier">defined</span><span class="Other">(</span><span class="Identifier">futureLogging</span><span class="Other">)</span><span class="Other">:</span></pre></dt>
<dd>
Untyped future.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L26" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L26" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="FutureError">
<dt><pre><a href="asyncfutures.html#FutureError"><span class="Identifier">FutureError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="system.html#Defect"><span class="Identifier">Defect</span></a>
<span class="Identifier">cause</span><span class="Operator">*</span><span class="Other">:</span> <a href="asyncfutures.html#FutureBase"><span class="Identifier">FutureBase</span></a></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L42" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L42" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="FutureVar">
<dt><pre><a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Other">=</span> <span class="Keyword">distinct</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L40" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L40" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="isFutureLoggingEnabled">
<dt><pre><a href="asyncfutures.html#isFutureLoggingEnabled"><span class="Identifier">isFutureLoggingEnabled</span></a> <span class="Other">=</span> <span class="DecNumber">false</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L48" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L48" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="NimAsyncContinueSuffix">
<dt><pre><a href="asyncfutures.html#NimAsyncContinueSuffix"><span class="Identifier">NimAsyncContinueSuffix</span></a> <span class="Other">=</span> <span class="StringLit">&quot;NimAsyncContinue&quot;</span></pre></dt>
<dd>
For internal usage. Do not use.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L51" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L51" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="$-procs-all">
<div id="$,seq[StackTraceEntry]">
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2Cseq%5BStackTraceEntry%5D"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">stackTraceEntries</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><a href="system.html#StackTraceEntry"><span class="Identifier">StackTraceEntry</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L314" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L314" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="addCallback-procs-all">
<div id="addCallback,FutureBase,proc)">
<dt><pre><span class="Keyword">proc</span> <a href="#addCallback%2CFutureBase%2Cproc%29"><span class="Identifier">addCallback</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">;</span> <span class="Identifier">cb</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Other">)</span> {.<span class="Identifier">closure</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span></span>.}<span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Adds the callbacks proc to be called when the future completes.</p>
<p>If future has already completed then <tt class="docutils literal"><span class="pre"><span class="Identifier">cb</span></span></tt> will be called immediately.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L249" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L249" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="addCallback,Future[T],proc(Future[T])">
<dt><pre><span class="Keyword">proc</span> <a href="#addCallback%2CFuture%5BT%5D%2Cproc%28Future%5BT%5D%29"><span class="Identifier">addCallback</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">cb</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span> {.<span class="Identifier">closure</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span></span>.}<span class="Other">)</span></pre></dt>
<dd>
<p>Adds the callbacks proc to be called when the future completes.</p>
<p>If future has already completed then <tt class="docutils literal"><span class="pre"><span class="Identifier">cb</span></span></tt> will be called immediately.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L259" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L259" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="all-procs-all">
<div id="all,varargs[Future[T]]">
<dt><pre><span class="Keyword">proc</span> <a href="#all%2Cvarargs%5BFuture%5BT%5D%5D"><span class="Identifier">all</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">futs</span><span class="Other">:</span> <a href="system.html#varargs"><span class="Identifier">varargs</span></a><span class="Other">[</span><a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#auto"><span class="Identifier">auto</span></a></pre></dt>
<dd>
<p>Returns a future which will complete once all futures in <tt class="docutils literal"><span class="pre"><span class="Identifier">futs</span></span></tt> complete. If the argument is empty, the returned future completes immediately.</p>
<p>If the awaited futures are not <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span><span class="Punctuation">[</span><span class="Identifier">void</span><span class="Punctuation">]</span></span></tt>, the returned future will hold the values of all awaited futures in a sequence.</p>
<p>If the awaited futures <em>are</em> <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span><span class="Punctuation">[</span><span class="Identifier">void</span><span class="Punctuation">]</span></span></tt>, this proc returns <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span><span class="Punctuation">[</span><span class="Identifier">void</span><span class="Punctuation">]</span></span></tt>.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L459" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L459" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="and-procs-all">
<div id="and,Future[T],Future[Y]">
<dt><pre><span class="Keyword">proc</span> <a href="#and%2CFuture%5BT%5D%2CFuture%5BY%5D"><span class="Identifier">`and`</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">Y</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fut1</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">fut2</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">Y</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span></pre></dt>
<dd>
Returns a future which will complete once both <tt class="docutils literal"><span class="pre"><span class="Identifier">fut1</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">fut2</span></span></tt> complete.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L431" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L431" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="asyncCheck-procs-all">
<div id="asyncCheck,Future[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#asyncCheck%2CFuture%5BT%5D"><span class="Identifier">asyncCheck</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
<dd>
<p>Sets a callback on <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt> which raises an exception if the future finished with an error.</p>
<p>This should be used instead of <tt class="docutils literal"><span class="pre"><span class="Keyword">discard</span></span></tt> to discard void futures, or use <tt class="docutils literal"><span class="pre"><span class="Identifier">waitFor</span></span></tt> if you need to wait for the future's completion.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L416" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L416" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="callback=-procs-all">
<div id="callback=,FutureBase,proc)">
<dt><pre><span class="Keyword">proc</span> <a href="#callback%3D%2CFutureBase%2Cproc%29"><span class="Identifier">callback=</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">;</span> <span class="Identifier">cb</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Other">)</span> {.<span class="Identifier">closure</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span></span>.}<span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Clears the list of callbacks and sets the callback proc to be called when the future completes.</p>
<p>If future has already completed then <tt class="docutils literal"><span class="pre"><span class="Identifier">cb</span></span></tt> will be called immediately.</p>
<p>It's recommended to use <tt class="docutils literal"><span class="pre"><span class="Identifier">addCallback</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Identifier">then</span></span></tt> instead.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L269" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L269" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="callback=,Future[T],proc(Future[T])">
<dt><pre><span class="Keyword">proc</span> <a href="#callback%3D%2CFuture%5BT%5D%2Cproc%28Future%5BT%5D%29"><span class="Identifier">callback=</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">cb</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span> {.<span class="Identifier">closure</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span></span>.}<span class="Other">)</span></pre></dt>
<dd>
<p>Sets the callback proc to be called when the future completes.</p>
<p>If future has already completed then <tt class="docutils literal"><span class="pre"><span class="Identifier">cb</span></span></tt> will be called immediately.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L278" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L278" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="callSoon-procs-all">
<div id="callSoon,proc)">
<dt><pre><span class="Keyword">proc</span> <a href="#callSoon%2Cproc%29"><span class="Identifier">callSoon</span></a><span class="Other">(</span><span class="Identifier">cbproc</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span></span>.}<span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Call <tt class="docutils literal"><span class="pre"><span class="Identifier">cbproc</span></span></tt> &quot;soon&quot;.</p>
<p>If async dispatcher is running, <tt class="docutils literal"><span class="pre"><span class="Identifier">cbproc</span></span></tt> will be executed during next dispatcher tick.</p>
<p>If async dispatcher is not running, <tt class="docutils literal"><span class="pre"><span class="Identifier">cbproc</span></span></tt> will be executed immediately.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L100" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L100" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="clean-procs-all">
<div id="clean,FutureVar[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#clean%2CFutureVar%5BT%5D"><span class="Identifier">clean</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
<dd>
Resets the <tt class="docutils literal"><span class="pre"><span class="Identifier">finished</span></span></tt> status of <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L139" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L139" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="clearCallbacks-procs-all">
<div id="clearCallbacks,FutureBase">
<dt><pre><span class="Keyword">proc</span> <a href="#clearCallbacks%2CFutureBase"><span class="Identifier">clearCallbacks</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L245" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L245" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="complete-procs-all">
<div id="complete,Future[void]">
<dt><pre><span class="Keyword">proc</span> <a href="#complete%2CFuture%5Bvoid%5D"><span class="Identifier">complete</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">val</span> <span class="Other">=</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span><span class="Other">.</span><span class="Identifier">default</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L210" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L210" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="complete,Future[T],sinkT">
<dt><pre><span class="Keyword">proc</span> <a href="#complete%2CFuture%5BT%5D%2CsinkT"><span class="Identifier">complete</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">val</span><span class="Other">:</span> <a href="system.html#sink"><span class="Identifier">sink</span></a> <span class="Identifier">T</span><span class="Other">)</span></pre></dt>
<dd>
Completes <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt> with value <tt class="docutils literal"><span class="pre"><span class="Identifier">val</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L206" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L206" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="complete,FutureVar[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#complete%2CFutureVar%5BT%5D"><span class="Identifier">complete</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
<dd>
Completes a <tt class="docutils literal"><span class="pre"><span class="Identifier">FutureVar</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L213" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L213" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="complete,FutureVar[T],sinkT">
<dt><pre><span class="Keyword">proc</span> <a href="#complete%2CFutureVar%5BT%5D%2CsinkT"><span class="Identifier">complete</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">val</span><span class="Other">:</span> <a href="system.html#sink"><span class="Identifier">sink</span></a> <span class="Identifier">T</span><span class="Other">)</span></pre></dt>
<dd>
<p>Completes a <tt class="docutils literal"><span class="pre"><span class="Identifier">FutureVar</span></span></tt> with value <tt class="docutils literal"><span class="pre"><span class="Identifier">val</span></span></tt>.</p>
<p>Any previously stored value will be overwritten.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L222" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L222" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="fail-procs-all">
<div id="fail,Future[T],ref.Exception">
<dt><pre><span class="Keyword">proc</span> <a href="#fail%2CFuture%5BT%5D%2Cref.Exception"><span class="Identifier">fail</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">error</span><span class="Other">:</span> <span class="Keyword">ref</span> <a href="system.html#Exception"><span class="Identifier">Exception</span></a><span class="Other">)</span></pre></dt>
<dd>
Completes <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt> with <tt class="docutils literal"><span class="pre"><span class="Identifier">error</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L234" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L234" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="failed-procs-all">
<div id="failed,FutureBase">
<dt><pre><span class="Keyword">proc</span> <a href="#failed%2CFutureBase"><span class="Identifier">failed</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Determines whether <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt> completed with an error.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L412" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L412" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="finished-procs-all">
<div id="finished">
<dt><pre><span class="Keyword">proc</span> <a href="#finished"><span class="Identifier">finished</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#FutureBase"><span class="Identifier">FutureBase</span></a> <span class="Operator">|</span> <a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a></pre></dt>
<dd>
<p>Determines whether <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt> has completed.</p>
<p><tt class="docutils literal"><span class="pre"><span class="Identifier">True</span></span></tt> may indicate an error or a value. Use <tt class="docutils literal"><span class="pre"><span class="Identifier">failed</span></span></tt> to distinguish.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L403" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L403" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getCallSoonProc-procs-all">
<div id="getCallSoonProc">
<dt><pre><span class="Keyword">proc</span> <a href="#getCallSoonProc"><span class="Identifier">getCallSoonProc</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <span class="Other">(</span><span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">cbproc</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Other">)</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span></span>.}<span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Get current implementation of <tt class="docutils literal"><span class="pre"><span class="Identifier">callSoon</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L92" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L92" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="mget-procs-all">
<div id="mget,FutureVar[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#mget%2CFutureVar%5BT%5D"><span class="Identifier">mget</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span></pre></dt>
<dd>
<p>Returns a mutable value stored in <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt>.</p>
<p>Unlike <tt class="docutils literal"><span class="pre"><span class="Identifier">read</span></span></tt>, this function will not raise an exception if the Future has not been finished.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L396" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L396" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newFuture-procs-all">
<div id="newFuture,string">
<dt><pre><span class="Keyword">proc</span> <a href="#newFuture%2Cstring"><span class="Identifier">newFuture</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fromProc</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> <span class="Other">=</span> <span class="StringLit">&quot;unspecified&quot;</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span><a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
<dd>
<p>Creates a new future.</p>
<p>Specifying <tt class="docutils literal"><span class="pre"><span class="Identifier">fromProc</span></span></tt>, which is a string specifying the name of the proc that this future belongs to, is a good habit as it helps with debugging.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L121" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L121" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newFutureVar-procs-all">
<div id="newFutureVar,string">
<dt><pre><span class="Keyword">proc</span> <a href="#newFutureVar%2Cstring"><span class="Identifier">newFutureVar</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fromProc</span> <span class="Other">=</span> <span class="StringLit">&quot;unspecified&quot;</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span><a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
<dd>
<p>Create a new <tt class="docutils literal"><span class="pre"><span class="Identifier">FutureVar</span></span></tt>. This Future type is ideally suited for situations where you want to avoid unnecessary allocations of Futures.</p>
<p>Specifying <tt class="docutils literal"><span class="pre"><span class="Identifier">fromProc</span></span></tt>, which is a string specifying the name of the proc that this future belongs to, is a good habit as it helps with debugging.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L129" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L129" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="or-procs-all">
<div id="or,Future[T],Future[Y]">
<dt><pre><span class="Keyword">proc</span> <a href="#or%2CFuture%5BT%5D%2CFuture%5BY%5D"><span class="Identifier">`or`</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">Y</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fut1</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">fut2</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">Y</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span></pre></dt>
<dd>
Returns a future which will complete once either <tt class="docutils literal"><span class="pre"><span class="Identifier">fut1</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Identifier">fut2</span></span></tt> complete.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L447" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L447" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="read-procs-all">
<div id="read_2">
<dt><pre><span class="Keyword">proc</span> <a href="#read_2"><span class="Identifier">read</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span> <span class="Operator">|</span> <a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span><span class="Other">)</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L384" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L384" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="read">
<dt><pre><span class="Keyword">proc</span> <a href="#read"><span class="Identifier">read</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Operator">|</span> <a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#lent"><span class="Identifier">lent</span></a> <span class="Identifier">T</span></pre></dt>
<dd>
<p>Retrieves the value of <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt>. Future must be finished otherwise this function will fail with a <tt class="docutils literal"><span class="pre"><span class="Identifier">ValueError</span></span></tt> exception.</p>
<p>If the result of the future is an error then that error will be raised.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L377" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L377" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="readError-procs-all">
<div id="readError,Future[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#readError%2CFuture%5BT%5D"><span class="Identifier">readError</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ref</span> <a href="system.html#Exception"><span class="Identifier">Exception</span></a></pre></dt>
<dd>
<p>Retrieves the exception stored in <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt>.</p>
<p>An <tt class="docutils literal"><span class="pre"><span class="Identifier">ValueError</span></span></tt> exception will be thrown if no exception exists in the specified Future.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L387" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L387" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="setCallSoonProc-procs-all">
<div id="setCallSoonProc">
<dt><pre><span class="Keyword">proc</span> <a href="#setCallSoonProc"><span class="Identifier">setCallSoonProc</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <span class="Other">(</span><span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">cbproc</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Other">)</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span></span>.}<span class="Other">)</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Change current implementation of <tt class="docutils literal"><span class="pre"><span class="Identifier">callSoon</span></span></tt>. This is normally called when dispatcher from <tt class="docutils literal"><span class="pre"><span class="Identifier">asyncdispatcher</span></span></tt> is initialized.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncfutures.nim#L96" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncfutures.nim#L96" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:07:46 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

38
asyncfutures.idx Normal file
View File

@@ -0,0 +1,38 @@
nimTitle asyncfutures asyncfutures.html module std/asyncfutures 0
nim FutureBase asyncfutures.html#FutureBase type FutureBase 26
nim Future asyncfutures.html#Future type Future 37
nim FutureVar asyncfutures.html#FutureVar type FutureVar 40
nim FutureError asyncfutures.html#FutureError object FutureError 42
nim isFutureLoggingEnabled asyncfutures.html#isFutureLoggingEnabled const isFutureLoggingEnabled 48
nim NimAsyncContinueSuffix asyncfutures.html#NimAsyncContinueSuffix const NimAsyncContinueSuffix 51
nim getCallSoonProc asyncfutures.html#getCallSoonProc proc getCallSoonProc(): (proc (cbproc: proc ()) {.gcsafe.}) 92
nim setCallSoonProc asyncfutures.html#setCallSoonProc proc setCallSoonProc(p: (proc (cbproc: proc ()) {.gcsafe.})) 96
nim callSoon asyncfutures.html#callSoon,proc) proc callSoon(cbproc: proc () {.gcsafe.}) 100
nim newFuture asyncfutures.html#newFuture,string proc newFuture[T](fromProc: string = "unspecified"): owned(Future[T]) 121
nim newFutureVar asyncfutures.html#newFutureVar,string proc newFutureVar[T](fromProc = "unspecified"): owned(FutureVar[T]) 129
nim clean asyncfutures.html#clean,FutureVar[T] proc clean[T](future: FutureVar[T]) 139
nim complete asyncfutures.html#complete,Future[T],sinkT proc complete[T](future: Future[T]; val: sink T) 206
nim complete asyncfutures.html#complete,Future[void] proc complete(future: Future[void]; val = Future[void].default) 210
nim complete asyncfutures.html#complete,FutureVar[T] proc complete[T](future: FutureVar[T]) 213
nim complete asyncfutures.html#complete,FutureVar[T],sinkT proc complete[T](future: FutureVar[T]; val: sink T) 222
nim fail asyncfutures.html#fail,Future[T],ref.Exception proc fail[T](future: Future[T]; error: ref Exception) 234
nim clearCallbacks asyncfutures.html#clearCallbacks,FutureBase proc clearCallbacks(future: FutureBase) 245
nim addCallback asyncfutures.html#addCallback,FutureBase,proc) proc addCallback(future: FutureBase; cb: proc () {.closure, gcsafe.}) 249
nim addCallback asyncfutures.html#addCallback,Future[T],proc(Future[T]) proc addCallback[T](future: Future[T];\n cb: proc (future: Future[T]) {.closure, gcsafe.}) 259
nim callback= asyncfutures.html#callback=,FutureBase,proc) proc callback=(future: FutureBase; cb: proc () {.closure, gcsafe.}) 269
nim callback= asyncfutures.html#callback=,Future[T],proc(Future[T]) proc callback=[T](future: Future[T]; cb: proc (future: Future[T]) {.closure, gcsafe.}) 278
nim `$` asyncfutures.html#$,seq[StackTraceEntry] proc `$`(stackTraceEntries: seq[StackTraceEntry]): string 314
nim read asyncfutures.html#read proc read[T](future: Future[T] | FutureVar[T]): lent T 377
nim read asyncfutures.html#read_2 proc read(future: Future[void] | FutureVar[void]) 384
nim readError asyncfutures.html#readError,Future[T] proc readError[T](future: Future[T]): ref Exception 387
nim mget asyncfutures.html#mget,FutureVar[T] proc mget[T](future: FutureVar[T]): var T 396
nim finished asyncfutures.html#finished proc finished(future: FutureBase | FutureVar): bool 403
nim failed asyncfutures.html#failed,FutureBase proc failed(future: FutureBase): bool 412
nim asyncCheck asyncfutures.html#asyncCheck,Future[T] proc asyncCheck[T](future: Future[T]) 416
nim `and` asyncfutures.html#and,Future[T],Future[Y] proc `and`[T, Y](fut1: Future[T]; fut2: Future[Y]): Future[void] 431
nim `or` asyncfutures.html#or,Future[T],Future[Y] proc `or`[T, Y](fut1: Future[T]; fut2: Future[Y]): Future[void] 447
nim all asyncfutures.html#all,varargs[Future[T]] proc all[T](futs: varargs[Future[T]]): auto 459
nimgrp complete asyncfutures.html#complete-procs-all proc 206
nimgrp read asyncfutures.html#read-procs-all proc 377
nimgrp callback= asyncfutures.html#callback=-procs-all proc 269
nimgrp addcallback asyncfutures.html#addCallback-procs-all proc 249

418
asynchttpserver.html Normal file

File diff suppressed because one or more lines are too long

13
asynchttpserver.idx Normal file
View File

@@ -0,0 +1,13 @@
nimTitle asynchttpserver asynchttpserver.html module std/asynchttpserver 0
nim Request asynchttpserver.html#Request object Request 61
nim AsyncHttpServer asynchttpserver.html#AsyncHttpServer type AsyncHttpServer 70
nim getPort asynchttpserver.html#getPort,AsyncHttpServer proc getPort(self: AsyncHttpServer): Port 77
nim newAsyncHttpServer asynchttpserver.html#newAsyncHttpServer,int proc newAsyncHttpServer(reuseAddr = true; reusePort = false; maxBody = 8388608): AsyncHttpServer 90
nim sendHeaders asynchttpserver.html#sendHeaders,Request,HttpHeaders proc sendHeaders(req: Request; headers: HttpHeaders): Future[void] 99
nim respond asynchttpserver.html#respond,Request,HttpCode,string,HttpHeaders proc respond(req: Request; code: HttpCode; content: string;\n headers: HttpHeaders = nil): Future[void] 105
nim nimMaxDescriptorsFallback asynchttpserver.html#nimMaxDescriptorsFallback const nimMaxDescriptorsFallback 377
nim listen asynchttpserver.html#listen,AsyncHttpServer,Port,string proc listen(server: AsyncHttpServer; port: Port; address = ""; domain = AF_INET) 382
nim shouldAcceptRequest asynchttpserver.html#shouldAcceptRequest,AsyncHttpServer,int proc shouldAcceptRequest(server: AsyncHttpServer; assumedDescriptorsPerRequest = 5): bool 397
nim acceptRequest asynchttpserver.html#acceptRequest,AsyncHttpServer,proc(Request) proc acceptRequest(server: AsyncHttpServer; callback: proc (request: Request): Future[\n void] {.closure, gcsafe.}): owned(Future[void]) 406
nim serve asynchttpserver.html#serve,AsyncHttpServer,Port,proc(Request),string,int proc serve(server: AsyncHttpServer; port: Port;\n callback: proc (request: Request): Future[void] {.closure, gcsafe.};\n address = ""; assumedDescriptorsPerRequest = -1; domain = AF_INET): owned(\n Future[void]) 416
nim close asynchttpserver.html#close,AsyncHttpServer proc close(server: AsyncHttpServer) 439

328
asyncjs.html Normal file
View File

@@ -0,0 +1,328 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/asyncjs</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/asyncjs</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li><a class="reference" id="javascript-compatibility_toc" href="#javascript-compatibility">JavaScript compatibility</a></li>
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#Error" title="Error {.importjs: &quot;Error&quot;.} = ref object of JsRoot
message*: cstring
name*: cstring">Error</a></li>
<li><a class="reference" href="#Future" title="Future[T] = ref object
future*: T">Future</a></li>
<li><a class="reference" href="#OnReject" title="OnReject = proc (reason: Error)">OnReject</a></li>
<li><a class="reference" href="#PromiseJs" title="PromiseJs {.importjs: &quot;Promise&quot;.} = ref object">PromiseJs</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">catch
<li><a class="reference" href="#catch%2CFuture%5BT%5D%2COnReject" title="catch[T](future: Future[T]; onReject: OnReject): Future[void]">catch[T](future: Future[T]; onReject: OnReject): Future[void]</a></li>
</ul>
<ul class="simple nested-toc-section">newPromise
<li><a class="reference" href="#newPromise%2Cproc%28proc%29%29" title="newPromise(handler: proc (resolve: proc ())): Future[void]">newPromise(handler: proc (resolve: proc ())): Future[void]</a></li>
<li><a class="reference" href="#newPromise%2Cproc%28proc%28T%29%29" title="newPromise[T](handler: proc (resolve: proc (response: T))): Future[T]">newPromise[T](handler: proc (resolve: proc (response: T))): Future[T]</a></li>
</ul>
<ul class="simple nested-toc-section">then
<li><a class="reference" href="#then%2CFuture%5BT%5D%2Cproc%2COnReject" title="then[T](future: Future[T]; onSuccess: proc; onReject: OnReject = nil): auto">then[T](future: Future[T]; onSuccess: proc; onReject: OnReject = nil): auto</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#17" id="67">Macros</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">async
<li><a class="reference" href="#async.m%2Cuntyped" title="async(arg: untyped): untyped">async(arg: untyped): untyped</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/js/asyncjs.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/js/asyncjs.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"><p>This module implements types and macros for writing asynchronous code for the JS backend. It provides tools for interaction with JavaScript async API-s and libraries, writing async procedures in Nim and converting callback-based code to promises.</p>
<p>A Nim procedure is asynchronous when it includes the <tt class="docutils literal"><span class="pre"><span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">async</span><span class="Operator">.</span><span class="Punctuation">}</span></span></tt> pragma. It should always have a <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span><span class="Punctuation">[</span><span class="Identifier">T</span><span class="Punctuation">]</span></span></tt> return type or not have a return type at all. A <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span><span class="Punctuation">[</span><span class="Identifier">void</span><span class="Punctuation">]</span></span></tt> return type is assumed by default.</p>
<p>This is roughly equivalent to the <tt class="docutils literal"><span class="pre"><span class="Identifier">async</span></span></tt> keyword in JavaScript code.</p>
<p><pre class="listing"><span class="Keyword">proc</span> <span class="Identifier">loadGame</span><span class="Punctuation">(</span><span class="Identifier">name</span><span class="Punctuation">:</span> <span class="Identifier">string</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">Future</span><span class="Punctuation">[</span><span class="Identifier">Game</span><span class="Punctuation">]</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">async</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
<span class="Comment"># code</span></pre></p>
<p>should be equivalent to</p>
<p><pre class="listing">async function loadGame(name) {
// code
}</pre></p>
<p>A call to an asynchronous procedure usually needs <tt class="docutils literal"><span class="pre"><span class="Identifier">await</span></span></tt> to wait for the completion of the <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span></span></tt>.</p>
<p><pre class="listing"><span class="Keyword">var</span> <span class="Identifier">game</span> <span class="Operator">=</span> <span class="Identifier">await</span> <span class="Identifier">loadGame</span><span class="Punctuation">(</span><span class="Identifier">name</span><span class="Punctuation">)</span></pre></p>
<p>Often, you might work with callback-based API-s. You can wrap them with asynchronous procedures using promises and <tt class="docutils literal"><span class="pre"><span class="Identifier">newPromise</span></span></tt>:</p>
<p><pre class="listing"><span class="Keyword">proc</span> <span class="Identifier">loadGame</span><span class="Punctuation">(</span><span class="Identifier">name</span><span class="Punctuation">:</span> <span class="Identifier">string</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">Future</span><span class="Punctuation">[</span><span class="Identifier">Game</span><span class="Punctuation">]</span> <span class="Operator">=</span>
<span class="Keyword">var</span> <span class="Identifier">promise</span> <span class="Operator">=</span> <span class="Identifier">newPromise</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Keyword">do</span> <span class="Punctuation">(</span><span class="Identifier">resolve</span><span class="Punctuation">:</span> <span class="Keyword">proc</span><span class="Punctuation">(</span><span class="Identifier">response</span><span class="Punctuation">:</span> <span class="Identifier">Game</span><span class="Punctuation">)</span><span class="Punctuation">)</span><span class="Punctuation">:</span>
<span class="Identifier">cbBasedLoadGame</span><span class="Punctuation">(</span><span class="Identifier">name</span><span class="Punctuation">)</span> <span class="Keyword">do</span> <span class="Punctuation">(</span><span class="Identifier">game</span><span class="Punctuation">:</span> <span class="Identifier">Game</span><span class="Punctuation">)</span><span class="Punctuation">:</span>
<span class="Identifier">resolve</span><span class="Punctuation">(</span><span class="Identifier">game</span><span class="Punctuation">)</span>
<span class="Keyword">return</span> <span class="Identifier">promise</span></pre></p>
<p>Forward definitions work properly, you just need to always add the <tt class="docutils literal"><span class="pre"><span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">async</span><span class="Operator">.</span><span class="Punctuation">}</span></span></tt> pragma:</p>
<p><pre class="listing"><span class="Keyword">proc</span> <span class="Identifier">loadGame</span><span class="Punctuation">(</span><span class="Identifier">name</span><span class="Punctuation">:</span> <span class="Identifier">string</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">Future</span><span class="Punctuation">[</span><span class="Identifier">Game</span><span class="Punctuation">]</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">async</span><span class="Operator">.</span><span class="Punctuation">}</span></pre></p>
<h1><a class="toc-backref" id="javascript-compatibility" href="#javascript-compatibility">JavaScript compatibility</a></h1><p>Nim currently generates <tt class="docutils literal"><span class="pre"><span class="Identifier">async</span><span class="Operator">/</span><span class="Identifier">await</span></span></tt> JavaScript code which is supported in modern EcmaScript and most modern versions of browsers, Node.js and Electron. If you need to use this module with older versions of JavaScript, you can use a tool that backports the resulting JavaScript code, as babel.</p>
</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="jsffi.html">jsffi</a>, <a class="reference external" href="macros.html">macros</a>, <a class="reference external" href="since.html">since</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="Error">
<dt><pre><a href="asyncjs.html#Error"><span class="Identifier">Error</span></a> {.<span class="Identifier">importjs</span><span class="Other">:</span> <span class="StringLit">&quot;Error&quot;</span>.} <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="system.html#JsRoot"><span class="Identifier">JsRoot</span></a>
<span class="Identifier">message</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#cstring"><span class="Identifier">cstring</span></a>
<span class="Identifier">name</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#cstring"><span class="Identifier">cstring</span></a></pre></dt>
<dd>
<a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error</a>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/js/asyncjs.nim#L195" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/js/asyncjs.nim#L195" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="Future">
<dt><pre><a href="asyncjs.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span>
<span class="Identifier">future</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">T</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/js/asyncjs.nim#L75" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/js/asyncjs.nim#L75" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="OnReject">
<dt><pre><a href="asyncjs.html#OnReject"><span class="Identifier">OnReject</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">reason</span><span class="Other">:</span> <a href="asyncjs.html#Error"><span class="Identifier">Error</span></a><span class="Other">)</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/js/asyncjs.nim#L200" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/js/asyncjs.nim#L200" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="PromiseJs">
<dt><pre><a href="asyncjs.html#PromiseJs"><span class="Identifier">PromiseJs</span></a> {.<span class="Identifier">importjs</span><span class="Other">:</span> <span class="StringLit">&quot;Promise&quot;</span>.} <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/js/asyncjs.nim#L79" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/js/asyncjs.nim#L79" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="catch-procs-all">
<div id="catch,Future[T],OnReject">
<dt><pre><span class="Keyword">proc</span> <a href="#catch%2CFuture%5BT%5D%2COnReject"><span class="Identifier">catch</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncjs.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">onReject</span><span class="Other">:</span> <a href="asyncjs.html#OnReject"><span class="Identifier">OnReject</span></a><span class="Other">)</span><span class="Other">:</span> <a href="asyncjs.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span></pre></dt>
<dd>
See <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch</a>
<p><strong class="examples_text">Example: cmd: -r:off</strong></p>
<pre class="listing"><span class="Keyword">from</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">sugar</span> <span class="Keyword">import</span> <span class="Punctuation">`</span><span class="Operator">=&gt;</span><span class="Punctuation">`</span>
<span class="Keyword">from</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">strutils</span> <span class="Keyword">import</span> <span class="Identifier">contains</span>
<span class="Keyword">proc</span> <span class="Identifier">fn</span><span class="Punctuation">(</span><span class="Identifier">n</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">Future</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">async</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
<span class="Keyword">if</span> <span class="Identifier">n</span> <span class="Operator">&gt;=</span> <span class="DecNumber">7</span><span class="Punctuation">:</span> <span class="Keyword">raise</span> <span class="Identifier">newException</span><span class="Punctuation">(</span><span class="Identifier">ValueError</span><span class="Punctuation">,</span> <span class="StringLit">&quot;foobar: &quot;</span> <span class="Operator">&amp;</span> <span class="Operator">$</span><span class="Identifier">n</span><span class="Punctuation">)</span>
<span class="Keyword">else</span><span class="Punctuation">:</span> <span class="Identifier">result</span> <span class="Operator">=</span> <span class="Identifier">n</span> <span class="Operator">*</span> <span class="DecNumber">2</span>
<span class="Keyword">proc</span> <span class="Identifier">main</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">async</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
<span class="Keyword">var</span> <span class="Identifier">reason</span><span class="Punctuation">:</span> <span class="Identifier">Error</span>
<span class="Identifier">await</span> <span class="Identifier">fn</span><span class="Punctuation">(</span><span class="DecNumber">6</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">catch</span><span class="Punctuation">(</span><span class="Punctuation">(</span><span class="Identifier">r</span><span class="Punctuation">:</span> <span class="Identifier">Error</span><span class="Punctuation">)</span> <span class="Operator">=&gt;</span> <span class="Punctuation">(</span><span class="Identifier">reason</span> <span class="Operator">=</span> <span class="Identifier">r</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Comment"># note: `()` are needed, `=&gt; reason = r` would not work</span>
<span class="Identifier">assert</span> <span class="Identifier">reason</span> <span class="Operator">==</span> <span class="Keyword">nil</span>
<span class="Identifier">await</span> <span class="Identifier">fn</span><span class="Punctuation">(</span><span class="DecNumber">7</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">catch</span><span class="Punctuation">(</span><span class="Punctuation">(</span><span class="Identifier">r</span><span class="Punctuation">:</span> <span class="Identifier">Error</span><span class="Punctuation">)</span> <span class="Operator">=&gt;</span> <span class="Punctuation">(</span><span class="Identifier">reason</span> <span class="Operator">=</span> <span class="Identifier">r</span><span class="Punctuation">)</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">reason</span> <span class="Operator">!=</span> <span class="Keyword">nil</span>
<span class="Identifier">assert</span> <span class="StringLit">&quot;foobar: 7&quot;</span> <span class="Keyword">in</span> <span class="Operator">$</span><span class="Identifier">reason</span><span class="Operator">.</span><span class="Identifier">message</span>
<span class="Keyword">discard</span> <span class="Identifier">main</span><span class="Punctuation">(</span><span class="Punctuation">)</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/js/asyncjs.nim#L249" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/js/asyncjs.nim#L249" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newPromise-procs-all">
<div id="newPromise,proc(proc))">
<dt><pre><span class="Keyword">proc</span> <a href="#newPromise%2Cproc%28proc%29%29"><span class="Identifier">newPromise</span></a><span class="Other">(</span><span class="Identifier">handler</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">resolve</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Other">)</span><span class="Other">)</span><span class="Other">)</span><span class="Other">:</span> <a href="asyncjs.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span> {.
<span class="Identifier">importjs</span><span class="Other">:</span> <span class="StringLit">&quot;(new Promise(#))&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
A helper for wrapping callback-based functions into promises and async procedures.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/js/asyncjs.nim#L173" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/js/asyncjs.nim#L173" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="newPromise,proc(proc(T))">
<dt><pre><span class="Keyword">proc</span> <a href="#newPromise%2Cproc%28proc%28T%29%29"><span class="Identifier">newPromise</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">handler</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">resolve</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">response</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">)</span><span class="Other">)</span><span class="Other">:</span> <a href="asyncjs.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> {.
<span class="Identifier">importjs</span><span class="Other">:</span> <span class="StringLit">&quot;(new Promise(#))&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
A helper for wrapping callback-based functions into promises and async procedures.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/js/asyncjs.nim#L169" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/js/asyncjs.nim#L169" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="then-procs-all">
<div id="then,Future[T],proc,OnReject">
<dt><pre><span class="Keyword">proc</span> <a href="#then%2CFuture%5BT%5D%2Cproc%2COnReject"><span class="Identifier">then</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncjs.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">onSuccess</span><span class="Other">:</span> <span class="Keyword">proc</span><span class="Other">;</span> <span class="Identifier">onReject</span><span class="Other">:</span> <a href="asyncjs.html#OnReject"><span class="Identifier">OnReject</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#auto"><span class="Identifier">auto</span></a></pre></dt>
<dd>
See <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then</a> Returns a <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span></span></tt> from the return type of <tt class="docutils literal"><span class="pre"><span class="Identifier">onSuccess</span><span class="Punctuation">(</span><span class="Identifier">T</span><span class="Operator">.</span><span class="Identifier">default</span><span class="Punctuation">)</span></span></tt>.
<p><strong class="examples_text">Example: cmd: -r:off</strong></p>
<pre class="listing"><span class="Keyword">from</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">sugar</span> <span class="Keyword">import</span> <span class="Punctuation">`</span><span class="Operator">=&gt;</span><span class="Punctuation">`</span>
<span class="Keyword">proc</span> <span class="Identifier">fn</span><span class="Punctuation">(</span><span class="Identifier">n</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">Future</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">async</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
<span class="Keyword">if</span> <span class="Identifier">n</span> <span class="Operator">&gt;=</span> <span class="DecNumber">7</span><span class="Punctuation">:</span> <span class="Keyword">raise</span> <span class="Identifier">newException</span><span class="Punctuation">(</span><span class="Identifier">ValueError</span><span class="Punctuation">,</span> <span class="StringLit">&quot;foobar: &quot;</span> <span class="Operator">&amp;</span> <span class="Operator">$</span><span class="Identifier">n</span><span class="Punctuation">)</span>
<span class="Keyword">else</span><span class="Punctuation">:</span> <span class="Identifier">result</span> <span class="Operator">=</span> <span class="Identifier">n</span> <span class="Operator">*</span> <span class="DecNumber">2</span>
<span class="Keyword">proc</span> <span class="Identifier">asyncFact</span><span class="Punctuation">(</span><span class="Identifier">n</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">Future</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">async</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
<span class="Keyword">if</span> <span class="Identifier">n</span> <span class="Operator">&gt;</span> <span class="DecNumber">0</span><span class="Punctuation">:</span> <span class="Identifier">result</span> <span class="Operator">=</span> <span class="Identifier">n</span> <span class="Operator">*</span> <span class="Identifier">await</span> <span class="Identifier">asyncFact</span><span class="Punctuation">(</span><span class="Identifier">n</span><span class="Operator">-</span><span class="DecNumber">1</span><span class="Punctuation">)</span>
<span class="Keyword">else</span><span class="Punctuation">:</span> <span class="Identifier">result</span> <span class="Operator">=</span> <span class="DecNumber">1</span>
<span class="Keyword">proc</span> <span class="Identifier">main</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">async</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
<span class="Keyword">block</span><span class="Punctuation">:</span> <span class="Comment"># then</span>
<span class="Identifier">assert</span> <span class="Identifier">asyncFact</span><span class="Punctuation">(</span><span class="DecNumber">3</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">await</span> <span class="Operator">==</span> <span class="DecNumber">3</span><span class="Operator">*</span><span class="DecNumber">2</span>
<span class="Identifier">assert</span> <span class="Identifier">asyncFact</span><span class="Punctuation">(</span><span class="DecNumber">3</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">then</span><span class="Punctuation">(</span><span class="Identifier">asyncFact</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">await</span> <span class="Operator">==</span> <span class="DecNumber">6</span><span class="Operator">*</span><span class="DecNumber">5</span><span class="Operator">*</span><span class="DecNumber">4</span><span class="Operator">*</span><span class="DecNumber">3</span><span class="Operator">*</span><span class="DecNumber">2</span>
<span class="Keyword">let</span> <span class="Identifier">x1</span> <span class="Operator">=</span> <span class="Identifier">await</span> <span class="Identifier">fn</span><span class="Punctuation">(</span><span class="DecNumber">3</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">x1</span> <span class="Operator">==</span> <span class="DecNumber">3</span> <span class="Operator">*</span> <span class="DecNumber">2</span>
<span class="Keyword">let</span> <span class="Identifier">x2</span> <span class="Operator">=</span> <span class="Identifier">await</span> <span class="Identifier">fn</span><span class="Punctuation">(</span><span class="DecNumber">4</span><span class="Punctuation">)</span>
<span class="Operator">.</span><span class="Identifier">then</span><span class="Punctuation">(</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span> <span class="Operator">=&gt;</span> <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">float</span><span class="Punctuation">)</span>
<span class="Operator">.</span><span class="Identifier">then</span><span class="Punctuation">(</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">:</span> <span class="Identifier">float</span><span class="Punctuation">)</span> <span class="Operator">=&gt;</span> <span class="Operator">$</span><span class="Identifier">a</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">x2</span> <span class="Operator">==</span> <span class="StringLit">&quot;8.0&quot;</span>
<span class="Keyword">block</span><span class="Punctuation">:</span> <span class="Comment"># then with `onReject` callback</span>
<span class="Keyword">var</span> <span class="Identifier">witness</span> <span class="Operator">=</span> <span class="DecNumber">1</span>
<span class="Identifier">await</span> <span class="Identifier">fn</span><span class="Punctuation">(</span><span class="DecNumber">6</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">then</span><span class="Punctuation">(</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span> <span class="Operator">=&gt;</span> <span class="Punctuation">(</span><span class="Identifier">witness</span> <span class="Operator">=</span> <span class="DecNumber">2</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Punctuation">(</span><span class="Identifier">r</span><span class="Punctuation">:</span> <span class="Identifier">Error</span><span class="Punctuation">)</span> <span class="Operator">=&gt;</span> <span class="Punctuation">(</span><span class="Identifier">witness</span> <span class="Operator">=</span> <span class="DecNumber">3</span><span class="Punctuation">)</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">witness</span> <span class="Operator">==</span> <span class="DecNumber">2</span>
<span class="Identifier">await</span> <span class="Identifier">fn</span><span class="Punctuation">(</span><span class="DecNumber">7</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">then</span><span class="Punctuation">(</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span> <span class="Operator">=&gt;</span> <span class="Punctuation">(</span><span class="Identifier">witness</span> <span class="Operator">=</span> <span class="DecNumber">2</span><span class="Punctuation">)</span><span class="Punctuation">,</span> <span class="Punctuation">(</span><span class="Identifier">r</span><span class="Punctuation">:</span> <span class="Identifier">Error</span><span class="Punctuation">)</span> <span class="Operator">=&gt;</span> <span class="Punctuation">(</span><span class="Identifier">witness</span> <span class="Operator">=</span> <span class="DecNumber">3</span><span class="Punctuation">)</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">witness</span> <span class="Operator">==</span> <span class="DecNumber">3</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/js/asyncjs.nim#L202" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/js/asyncjs.nim#L202" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="17">
<h1><a class="toc-backref" href="#17">Macros</a></h1>
<dl class="item">
<div id="async-macros-all">
<div id="async.m,untyped">
<dt><pre><span class="Keyword">macro</span> <a href="#async.m%2Cuntyped"><span class="Identifier">async</span></a><span class="Other">(</span><span class="Identifier">arg</span><span class="Other">:</span> <a href="system.html#untyped"><span class="Identifier">untyped</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#untyped"><span class="Identifier">untyped</span></a></pre></dt>
<dd>
Macro which converts normal procedures into javascript-compatible async procedures.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/js/asyncjs.nim#L159" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/js/asyncjs.nim#L159" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:04 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

12
asyncjs.idx Normal file
View File

@@ -0,0 +1,12 @@
nimTitle asyncjs asyncjs.html module std/asyncjs 0
nim Future asyncjs.html#Future type Future 75
nim PromiseJs asyncjs.html#PromiseJs type PromiseJs 79
nim async asyncjs.html#async.m,untyped macro async(arg: untyped): untyped 159
nim newPromise asyncjs.html#newPromise,proc(proc(T)) proc newPromise[T](handler: proc (resolve: proc (response: T))): Future[T] 169
nim newPromise asyncjs.html#newPromise,proc(proc)) proc newPromise(handler: proc (resolve: proc ())): Future[void] 173
nim Error asyncjs.html#Error type Error 195
nim OnReject asyncjs.html#OnReject type OnReject 200
nim then asyncjs.html#then,Future[T],proc,OnReject proc then[T](future: Future[T]; onSuccess: proc; onReject: OnReject = nil): auto 202
nim catch asyncjs.html#catch,Future[T],OnReject proc catch[T](future: Future[T]; onReject: OnReject): Future[void] 249
heading JavaScript compatibility asyncjs.html#javascript-compatibility JavaScript compatibility 0
nimgrp newpromise asyncjs.html#newPromise-procs-all proc 169

180
asyncmacro.html Normal file
View File

@@ -0,0 +1,180 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/asyncmacro</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/asyncmacro</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#17" id="67">Macros</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">async
<li><a class="reference" href="#async.m%2Cuntyped" title="async(prc: untyped): untyped">async(prc: untyped): untyped</a></li>
</ul>
<ul class="simple nested-toc-section">multisync
<li><a class="reference" href="#multisync.m%2Cuntyped" title="multisync(prc: untyped): untyped">multisync(prc: untyped): untyped</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">await
<li><a class="reference" href="#await.t%2Ctyped" title="await(f: typed): untyped">await(f: typed): untyped</a></li>
<li><a class="reference" href="#await.t%2CFuture%5BT%5D" title="await[T](f: Future[T]): auto">await[T](f: Future[T]): auto</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncmacro.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncmacro.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">Implements the <tt class="docutils literal"><span class="pre"><span class="Identifier">async</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">multisync</span></span></tt> macros for <tt class="docutils literal"><span class="pre"><span class="Identifier">asyncdispatch</span></span></tt>.</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="macros.html">macros</a>, <a class="reference external" href="strutils.html">strutils</a>, <a class="reference external" href="asyncfutures.html">asyncfutures</a>
</dl>
</div>
<div class="section" id="17">
<h1><a class="toc-backref" href="#17">Macros</a></h1>
<dl class="item">
<div id="async-macros-all">
<div id="async.m,untyped">
<dt><pre><span class="Keyword">macro</span> <a href="#async.m%2Cuntyped"><span class="Identifier">async</span></a><span class="Other">(</span><span class="Identifier">prc</span><span class="Other">:</span> <a href="system.html#untyped"><span class="Identifier">untyped</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#untyped"><span class="Identifier">untyped</span></a></pre></dt>
<dd>
Macro which processes async procedures into the appropriate iterators and yield statements.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncmacro.nim#L328" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncmacro.nim#L328" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="multisync-macros-all">
<div id="multisync.m,untyped">
<dt><pre><span class="Keyword">macro</span> <a href="#multisync.m%2Cuntyped"><span class="Identifier">multisync</span></a><span class="Other">(</span><span class="Identifier">prc</span><span class="Other">:</span> <a href="system.html#untyped"><span class="Identifier">untyped</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#untyped"><span class="Identifier">untyped</span></a></pre></dt>
<dd>
<p>Macro which processes async procedures into both asynchronous and synchronous procedures.</p>
<p>The generated async procedures use the <tt class="docutils literal"><span class="pre"><span class="Identifier">async</span></span></tt> macro, whereas the generated synchronous procedures simply strip off the <tt class="docutils literal"><span class="pre"><span class="Identifier">await</span></span></tt> calls.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncmacro.nim#L387" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncmacro.nim#L387" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="await-templates-all">
<div id="await.t,typed">
<dt><pre><span class="Keyword">template</span> <a href="#await.t%2Ctyped"><span class="Identifier">await</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="system.html#typed"><span class="Identifier">typed</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#untyped"><span class="Identifier">untyped</span></a> {.<span class="Identifier">used</span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncmacro.nim#L161" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncmacro.nim#L161" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="await.t,Future[T]">
<dt><pre><span class="Keyword">template</span> <a href="#await.t%2CFuture%5BT%5D"><span class="Identifier">await</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#auto"><span class="Identifier">auto</span></a> {.<span class="Identifier">used</span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncmacro.nim#L165" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncmacro.nim#L165" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:07:21 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

6
asyncmacro.idx Normal file
View File

@@ -0,0 +1,6 @@
nimTitle asyncmacro asyncmacro.html module std/asyncmacro 0
nim await asyncmacro.html#await.t,typed template await(f: typed): untyped 161
nim await asyncmacro.html#await.t,Future[T] template await[T](f: Future[T]): auto 165
nim async asyncmacro.html#async.m,untyped macro async(prc: untyped): untyped 328
nim multisync asyncmacro.html#multisync.m,untyped macro multisync(prc: untyped): untyped 387
nimgrp await asyncmacro.html#await-templates-all template 161

896
asyncnet.html Normal file
View File

@@ -0,0 +1,896 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/asyncnet</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/asyncnet</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li><a class="reference" id="asynchronous-io-in-nim_toc" href="#asynchronous-io-in-nim">Asynchronous IO in Nim</a></li>
<li><a class="reference" id="ssl_toc" href="#ssl">SSL</a></li>
<li><a class="reference" id="examples_toc" href="#examples">Examples</a></li>
<ul class="simple"><li><a class="reference" id="examples-chat-server_toc" href="#examples-chat-server">Chat server</a></li>
</ul><li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#AsyncSocket" title="AsyncSocket = ref AsyncSocketDesc">AsyncSocket</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">accept
<li><a class="reference" href="#accept%2CAsyncSocket" title="accept(socket: AsyncSocket; flags = {SafeDisconn}): owned(Future[AsyncSocket])">accept(socket: AsyncSocket; flags = {SafeDisconn}): owned(Future[AsyncSocket])</a></li>
</ul>
<ul class="simple nested-toc-section">acceptAddr
<li><a class="reference" href="#acceptAddr%2CAsyncSocket" title="acceptAddr(socket: AsyncSocket; flags = {SafeDisconn};
inheritable = defined(nimInheritHandles)): owned(
Future[tuple[address: string, client: AsyncSocket]])">acceptAddr(socket: AsyncSocket; flags = {SafeDisconn};
inheritable = defined(nimInheritHandles)): owned(
Future[tuple[address: string, client: AsyncSocket]])</a></li>
</ul>
<ul class="simple nested-toc-section">bindAddr
<li><a class="reference" href="#bindAddr%2CAsyncSocket%2Cstring" title="bindAddr(socket: AsyncSocket; port = Port(0); address = &quot;&quot;)">bindAddr(socket: AsyncSocket; port = Port(0); address = &quot;&quot;)</a></li>
</ul>
<ul class="simple nested-toc-section">bindUnix
<li><a class="reference" href="#bindUnix%2CAsyncSocket%2Cstring" title="bindUnix(socket: AsyncSocket; path: string)">bindUnix(socket: AsyncSocket; path: string)</a></li>
</ul>
<ul class="simple nested-toc-section">close
<li><a class="reference" href="#close%2CAsyncSocket" title="close(socket: AsyncSocket)">close(socket: AsyncSocket)</a></li>
</ul>
<ul class="simple nested-toc-section">connect
<li><a class="reference" href="#connect%2CAsyncSocket%2Cstring%2CPort" title="connect(socket: AsyncSocket; address: string; port: Port): owned(
Future[void])">connect(socket: AsyncSocket; address: string; port: Port): owned(
Future[void])</a></li>
</ul>
<ul class="simple nested-toc-section">connectUnix
<li><a class="reference" href="#connectUnix%2CAsyncSocket%2Cstring" title="connectUnix(socket: AsyncSocket; path: string): owned(Future[void])">connectUnix(socket: AsyncSocket; path: string): owned(Future[void])</a></li>
</ul>
<ul class="simple nested-toc-section">dial
<li><a class="reference" href="#dial%2Cstring%2CPort" title="dial(address: string; port: Port; protocol = IPPROTO_TCP; buffered = true): owned(
Future[AsyncSocket])">dial(address: string; port: Port; protocol = IPPROTO_TCP; buffered = true): owned(
Future[AsyncSocket])</a></li>
</ul>
<ul class="simple nested-toc-section">getFd
<li><a class="reference" href="#getFd%2CAsyncSocket" title="getFd(socket: AsyncSocket): SocketHandle">getFd(socket: AsyncSocket): SocketHandle</a></li>
</ul>
<ul class="simple nested-toc-section">getLocalAddr
<li><a class="reference" href="#getLocalAddr%2CAsyncSocket" title="getLocalAddr(socket: AsyncSocket): (string, Port)">getLocalAddr(socket: AsyncSocket): (string, Port)</a></li>
</ul>
<ul class="simple nested-toc-section">getPeerAddr
<li><a class="reference" href="#getPeerAddr%2CAsyncSocket" title="getPeerAddr(socket: AsyncSocket): (string, Port)">getPeerAddr(socket: AsyncSocket): (string, Port)</a></li>
</ul>
<ul class="simple nested-toc-section">getPeerCertificates
<li><a class="reference" href="#getPeerCertificates%2CAsyncSocket" title="getPeerCertificates(socket: AsyncSocket): seq[Certificate]">getPeerCertificates(socket: AsyncSocket): seq[Certificate]</a></li>
</ul>
<ul class="simple nested-toc-section">getSockOpt
<li><a class="reference" href="#getSockOpt%2CAsyncSocket%2CSOBool" title="getSockOpt(socket: AsyncSocket; opt: SOBool; level = SOL_SOCKET): bool">getSockOpt(socket: AsyncSocket; opt: SOBool; level = SOL_SOCKET): bool</a></li>
</ul>
<ul class="simple nested-toc-section">hasDataBuffered
<li><a class="reference" href="#hasDataBuffered%2CAsyncSocket" title="hasDataBuffered(s: AsyncSocket): bool">hasDataBuffered(s: AsyncSocket): bool</a></li>
</ul>
<ul class="simple nested-toc-section">isClosed
<li><a class="reference" href="#isClosed%2CAsyncSocket" title="isClosed(socket: AsyncSocket): bool">isClosed(socket: AsyncSocket): bool</a></li>
</ul>
<ul class="simple nested-toc-section">isSsl
<li><a class="reference" href="#isSsl%2CAsyncSocket" title="isSsl(socket: AsyncSocket): bool">isSsl(socket: AsyncSocket): bool</a></li>
</ul>
<ul class="simple nested-toc-section">listen
<li><a class="reference" href="#listen%2CAsyncSocket" title="listen(socket: AsyncSocket; backlog = SOMAXCONN)">listen(socket: AsyncSocket; backlog = SOMAXCONN)</a></li>
</ul>
<ul class="simple nested-toc-section">newAsyncSocket
<li><a class="reference" href="#newAsyncSocket%2Ccint%2Ccint%2Ccint" title="newAsyncSocket(domain, sockType, protocol: cint; buffered = true;
inheritable = defined(nimInheritHandles)): owned(AsyncSocket)">newAsyncSocket(domain, sockType, protocol: cint; buffered = true;
inheritable = defined(nimInheritHandles)): owned(AsyncSocket)</a></li>
<li><a class="reference" href="#newAsyncSocket%2CDomain%2CSockType%2CProtocol" title="newAsyncSocket(domain: Domain = AF_INET; sockType: SockType = SOCK_STREAM;
protocol: Protocol = IPPROTO_TCP; buffered = true;
inheritable = defined(nimInheritHandles)): owned(AsyncSocket)">newAsyncSocket(domain: Domain = AF_INET; sockType: SockType = SOCK_STREAM;
protocol: Protocol = IPPROTO_TCP; buffered = true;
inheritable = defined(nimInheritHandles)): owned(AsyncSocket)</a></li>
<li><a class="reference" href="#newAsyncSocket%2CAsyncFD%2CDomain%2CSockType%2CProtocol" title="newAsyncSocket(fd: AsyncFD; domain: Domain = AF_INET;
sockType: SockType = SOCK_STREAM;
protocol: Protocol = IPPROTO_TCP; buffered = true;
inheritable = defined(nimInheritHandles)): owned(AsyncSocket)">newAsyncSocket(fd: AsyncFD; domain: Domain = AF_INET;
sockType: SockType = SOCK_STREAM;
protocol: Protocol = IPPROTO_TCP; buffered = true;
inheritable = defined(nimInheritHandles)): owned(AsyncSocket)</a></li>
</ul>
<ul class="simple nested-toc-section">recv
<li><a class="reference" href="#recv%2CAsyncSocket%2Cint" title="recv(socket: AsyncSocket; size: int; flags = {SafeDisconn}): owned(
Future[string])">recv(socket: AsyncSocket; size: int; flags = {SafeDisconn}): owned(
Future[string])</a></li>
</ul>
<ul class="simple nested-toc-section">recvFrom
<li><a class="reference" href="#recvFrom%2CAsyncSocket%2CFutureVar%5Bstring%5D%2Cint%2CFutureVar%5Bstring%5D%2CFutureVar%5BPort%5D" title="recvFrom(socket: AsyncSocket; data: FutureVar[string]; size: int;
address: FutureVar[string]; port: FutureVar[Port];
flags = {SafeDisconn}): owned(Future[int])">recvFrom(socket: AsyncSocket; data: FutureVar[string]; size: int;
address: FutureVar[string]; port: FutureVar[Port];
flags = {SafeDisconn}): owned(Future[int])</a></li>
<li><a class="reference" href="#recvFrom%2CAsyncSocket%2Cint" title="recvFrom(socket: AsyncSocket; size: int; flags = {SafeDisconn}): owned(
Future[tuple[data: string, address: string, port: Port]])">recvFrom(socket: AsyncSocket; size: int; flags = {SafeDisconn}): owned(
Future[tuple[data: string, address: string, port: Port]])</a></li>
</ul>
<ul class="simple nested-toc-section">recvInto
<li><a class="reference" href="#recvInto%2CAsyncSocket%2Cpointer%2Cint" title="recvInto(socket: AsyncSocket; buf: pointer; size: int; flags = {SafeDisconn}): owned(
Future[int])">recvInto(socket: AsyncSocket; buf: pointer; size: int; flags = {SafeDisconn}): owned(
Future[int])</a></li>
</ul>
<ul class="simple nested-toc-section">recvLine
<li><a class="reference" href="#recvLine%2CAsyncSocket" title="recvLine(socket: AsyncSocket; flags = {SafeDisconn}; maxLength = MaxLineLength): owned(
Future[string])">recvLine(socket: AsyncSocket; flags = {SafeDisconn}; maxLength = MaxLineLength): owned(
Future[string])</a></li>
</ul>
<ul class="simple nested-toc-section">recvLineInto
<li><a class="reference" href="#recvLineInto%2CAsyncSocket%2CFutureVar%5Bstring%5D" title="recvLineInto(socket: AsyncSocket; resString: FutureVar[string];
flags = {SafeDisconn}; maxLength = MaxLineLength): owned(
Future[void])">recvLineInto(socket: AsyncSocket; resString: FutureVar[string];
flags = {SafeDisconn}; maxLength = MaxLineLength): owned(
Future[void])</a></li>
</ul>
<ul class="simple nested-toc-section">send
<li><a class="reference" href="#send%2CAsyncSocket%2Cpointer%2Cint" title="send(socket: AsyncSocket; buf: pointer; size: int; flags = {SafeDisconn}): owned(
Future[void])">send(socket: AsyncSocket; buf: pointer; size: int; flags = {SafeDisconn}): owned(
Future[void])</a></li>
<li><a class="reference" href="#send%2CAsyncSocket%2Cstring" title="send(socket: AsyncSocket; data: string; flags = {SafeDisconn}): owned(
Future[void])">send(socket: AsyncSocket; data: string; flags = {SafeDisconn}): owned(
Future[void])</a></li>
</ul>
<ul class="simple nested-toc-section">sendTo
<li><a class="reference" href="#sendTo%2CAsyncSocket%2Cstring%2CPort%2Cstring" title="sendTo(socket: AsyncSocket; address: string; port: Port; data: string;
flags = {SafeDisconn}): owned(Future[void])">sendTo(socket: AsyncSocket; address: string; port: Port; data: string;
flags = {SafeDisconn}): owned(Future[void])</a></li>
</ul>
<ul class="simple nested-toc-section">setSockOpt
<li><a class="reference" href="#setSockOpt%2CAsyncSocket%2CSOBool%2Cbool" title="setSockOpt(socket: AsyncSocket; opt: SOBool; value: bool; level = SOL_SOCKET)">setSockOpt(socket: AsyncSocket; opt: SOBool; value: bool; level = SOL_SOCKET)</a></li>
</ul>
<ul class="simple nested-toc-section">sslHandle
<li><a class="reference" href="#sslHandle%2CAsyncSocket" title="sslHandle(self: AsyncSocket): SslPtr">sslHandle(self: AsyncSocket): SslPtr</a></li>
</ul>
<ul class="simple nested-toc-section">wrapConnectedSocket
<li><a class="reference" href="#wrapConnectedSocket%2CSslContext%2CAsyncSocket%2CSslHandshakeType%2Cstring" title="wrapConnectedSocket(ctx: SslContext; socket: AsyncSocket;
handshake: SslHandshakeType; hostname: string = &quot;&quot;)">wrapConnectedSocket(ctx: SslContext; socket: AsyncSocket;
handshake: SslHandshakeType; hostname: string = &quot;&quot;)</a></li>
</ul>
<ul class="simple nested-toc-section">wrapSocket
<li><a class="reference" href="#wrapSocket%2CSslContext%2CAsyncSocket" title="wrapSocket(ctx: SslContext; socket: AsyncSocket)">wrapSocket(ctx: SslContext; socket: AsyncSocket)</a></li>
</ul>
</ul>
</details>
</li>
<li>
<a class="reference reference-toplevel" href="#19" id="69">Exports</a>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">This module implements a high-level asynchronous sockets API based on the asynchronous dispatcher defined in the <tt class="docutils literal"><span class="pre"><span class="Identifier">asyncdispatch</span></span></tt> module.
<h1><a class="toc-backref" id="asynchronous-io-in-nim" href="#asynchronous-io-in-nim">Asynchronous IO in Nim</a></h1><p>Async IO in Nim consists of multiple layers (from highest to lowest):</p>
<ul class="simple"><li><tt class="docutils literal"><span class="pre"><span class="Identifier">asyncnet</span></span></tt> module</li>
<li>Async await</li>
<li><tt class="docutils literal"><span class="pre"><span class="Identifier">asyncdispatch</span></span></tt> module (event loop)</li>
<li><tt class="docutils literal"><span class="pre"><span class="Identifier">selectors</span></span></tt> module</li>
</ul>
<p>Each builds on top of the layers below it. The selectors module is an abstraction for the various system <tt class="docutils literal"><span class="pre"><span class="Identifier">select</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> mechanisms such as epoll or kqueue. If you wish you can use it directly, and some people have done so <a class="reference external" href="https://goran.krampe.se/2014/10/25/nim-socketserver/">successfully</a>. But you must be aware that on Windows it only supports <tt class="docutils literal"><span class="pre"><span class="Identifier">select</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt>.</p>
<p>The async dispatcher implements the proactor pattern and also has an implementation of IOCP. It implements the proactor pattern for other OS' via the selectors module. Futures are also implemented here, and indeed all the procedures return a future.</p>
<p>The final layer is the async await transformation. This allows you to write asynchronous code in a synchronous style and works similar to C#'s await. The transformation works by converting any async procedures into an iterator.</p>
<p>This is all single threaded, fully non-blocking and does give you a lot of control. In theory you should be able to work with any of these layers interchangeably (as long as you only care about non-Windows platforms).</p>
<p>For most applications using <tt class="docutils literal"><span class="pre"><span class="Identifier">asyncnet</span></span></tt> is the way to go as it builds over all the layers, providing some extra features such as buffering.</p>
<h1><a class="toc-backref" id="ssl" href="#ssl">SSL</a></h1><p>SSL can be enabled by compiling with the <tt class="docutils literal"><span class="pre"><span class="Operator">-</span><span class="Identifier">d</span><span class="Punctuation">:</span><span class="Identifier">ssl</span></span></tt> flag.</p>
<p>You must create a new SSL context with the <tt class="docutils literal"><span class="pre"><span class="Identifier">newContext</span></span></tt> function defined in the <tt class="docutils literal"><span class="pre"><span class="Identifier">net</span></span></tt> module. You may then call <tt class="docutils literal"><span class="pre"><span class="Identifier">wrapSocket</span></span></tt> on your socket using the newly created SSL context to get an SSL socket.</p>
<h1><a class="toc-backref" id="examples" href="#examples">Examples</a></h1>
<h2><a class="toc-backref" id="examples-chat-server" href="#examples-chat-server">Chat server</a></h2><p>The following example demonstrates a simple chat server.</p>
<p><pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Punctuation">[</span><span class="Identifier">asyncnet</span><span class="Punctuation">,</span> <span class="Identifier">asyncdispatch</span><span class="Punctuation">]</span>
<span class="Keyword">var</span> <span class="Identifier">clients</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">threadvar</span><span class="Operator">.</span><span class="Punctuation">}</span><span class="Punctuation">:</span> <span class="Identifier">seq</span><span class="Punctuation">[</span><span class="Identifier">AsyncSocket</span><span class="Punctuation">]</span>
<span class="Keyword">proc</span> <span class="Identifier">processClient</span><span class="Punctuation">(</span><span class="Identifier">client</span><span class="Punctuation">:</span> <span class="Identifier">AsyncSocket</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">async</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
<span class="Keyword">while</span> <span class="Identifier">true</span><span class="Punctuation">:</span>
<span class="Keyword">let</span> <span class="Identifier">line</span> <span class="Operator">=</span> <span class="Identifier">await</span> <span class="Identifier">client</span><span class="Operator">.</span><span class="Identifier">recvLine</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Keyword">if</span> <span class="Identifier">line</span><span class="Operator">.</span><span class="Identifier">len</span> <span class="Operator">==</span> <span class="DecNumber">0</span><span class="Punctuation">:</span> <span class="Keyword">break</span>
<span class="Keyword">for</span> <span class="Identifier">c</span> <span class="Keyword">in</span> <span class="Identifier">clients</span><span class="Punctuation">:</span>
<span class="Identifier">await</span> <span class="Identifier">c</span><span class="Operator">.</span><span class="Identifier">send</span><span class="Punctuation">(</span><span class="Identifier">line</span> <span class="Operator">&amp;</span> <span class="StringLit">&quot;</span><span class="EscapeSequence">\c</span><span class="EscapeSequence">\L</span><span class="StringLit">&quot;</span><span class="Punctuation">)</span>
<span class="Keyword">proc</span> <span class="Identifier">serve</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">async</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
<span class="Identifier">clients</span> <span class="Operator">=</span> <span class="Operator">@</span><span class="Punctuation">[</span><span class="Punctuation">]</span>
<span class="Keyword">var</span> <span class="Identifier">server</span> <span class="Operator">=</span> <span class="Identifier">newAsyncSocket</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Identifier">server</span><span class="Operator">.</span><span class="Identifier">setSockOpt</span><span class="Punctuation">(</span><span class="Identifier">OptReuseAddr</span><span class="Punctuation">,</span> <span class="Identifier">true</span><span class="Punctuation">)</span>
<span class="Identifier">server</span><span class="Operator">.</span><span class="Identifier">bindAddr</span><span class="Punctuation">(</span><span class="Identifier">Port</span><span class="Punctuation">(</span><span class="DecNumber">12345</span><span class="Punctuation">)</span><span class="Punctuation">)</span>
<span class="Identifier">server</span><span class="Operator">.</span><span class="Identifier">listen</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Keyword">while</span> <span class="Identifier">true</span><span class="Punctuation">:</span>
<span class="Keyword">let</span> <span class="Identifier">client</span> <span class="Operator">=</span> <span class="Identifier">await</span> <span class="Identifier">server</span><span class="Operator">.</span><span class="Identifier">accept</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Identifier">clients</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">client</span>
<span class="Identifier">asyncCheck</span> <span class="Identifier">processClient</span><span class="Punctuation">(</span><span class="Identifier">client</span><span class="Punctuation">)</span>
<span class="Identifier">asyncCheck</span> <span class="Identifier">serve</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Identifier">runForever</span><span class="Punctuation">(</span><span class="Punctuation">)</span></pre></p>
</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="since.html">since</a>, <a class="reference external" href="assertions.html">assertions</a>, <a class="reference external" href="syncio.html">syncio</a>, <a class="reference external" href="asyncdispatch.html">asyncdispatch</a>, <a class="reference external" href="nativesockets.html">nativesockets</a>, <a class="reference external" href="net.html">net</a>, <a class="reference external" href="os.html">os</a>, <a class="reference external" href="openssl.html">openssl</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="AsyncSocket">
<dt><pre><a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Identifier">AsyncSocketDesc</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L135" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L135" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="accept-procs-all">
<div id="accept,AsyncSocket">
<dt><pre><span class="Keyword">proc</span> <a href="#accept%2CAsyncSocket"><span class="Identifier">accept</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">;</span> <span class="Identifier">flags</span> <span class="Other">=</span> <span class="Other">{</span><span class="Identifier">SafeDisconn</span><span class="Other">}</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span>
<a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Accepts a new connection. Returns a future containing the client socket corresponding to that connection. If <tt class="docutils literal"><span class="pre"><span class="Identifier">inheritable</span></span></tt> is false (the default), the resulting client socket will not be inheritable by child processes. The future will complete when the connection is successfully accepted.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L506" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L506" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="acceptAddr-procs-all">
<div id="acceptAddr,AsyncSocket">
<dt><pre><span class="Keyword">proc</span> <a href="#acceptAddr%2CAsyncSocket"><span class="Identifier">acceptAddr</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">;</span> <span class="Identifier">flags</span> <span class="Other">=</span> <span class="Other">{</span><span class="Identifier">SafeDisconn</span><span class="Other">}</span><span class="Other">;</span>
<span class="Identifier">inheritable</span> <span class="Other">=</span> <span class="Identifier">defined</span><span class="Other">(</span><span class="Identifier">nimInheritHandles</span><span class="Other">)</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span>
<a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">address</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">,</span> <span class="Identifier">client</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">]</span><span class="Other">]</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Accepts a new connection. Returns a future containing the client socket corresponding to that connection and the remote address of the client.</p>
<p>If <tt class="docutils literal"><span class="pre"><span class="Identifier">inheritable</span></span></tt> is false (the default), the resulting client socket will not be inheritable by child processes.</p>
<p>The future will complete when the connection is successfully accepted.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L482" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L482" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="bindAddr-procs-all">
<div id="bindAddr,AsyncSocket,string">
<dt><pre><span class="Keyword">proc</span> <a href="#bindAddr%2CAsyncSocket%2Cstring"><span class="Identifier">bindAddr</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">;</span> <span class="Identifier">port</span> <span class="Other">=</span> <a href="nativesockets.html#Port"><span class="Identifier">Port</span></a><span class="Other">(</span><span class="DecNumber">0</span><span class="Other">)</span><span class="Other">;</span> <span class="Identifier">address</span> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#ReadIOEffect"><span class="Identifier">ReadIOEffect</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Binds <tt class="docutils literal"><span class="pre"><span class="Identifier">address</span></span></tt>:<tt class="docutils literal"><span class="pre"><span class="Identifier">port</span></span></tt> to the socket.</p>
<p>If <tt class="docutils literal"><span class="pre"><span class="Identifier">address</span></span></tt> is &quot;&quot; then ADDR_ANY will be bound.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L654" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L654" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="bindUnix-procs-all">
<div id="bindUnix,AsyncSocket,string">
<dt><pre><span class="Keyword">proc</span> <a href="#bindUnix%2CAsyncSocket%2Cstring"><span class="Identifier">bindUnix</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">;</span> <span class="Identifier">path</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#ReadIOEffect"><span class="Identifier">ReadIOEffect</span></a><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Binds Unix socket to <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt>. This only works on Unix-style systems: Mac OS X, BSD and Linux
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L712" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L712" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="close-procs-all">
<div id="close,AsyncSocket">
<dt><pre><span class="Keyword">proc</span> <a href="#close%2CAsyncSocket"><span class="Identifier">close</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">LibraryError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Closes the socket.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L734" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L734" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="connect-procs-all">
<div id="connect,AsyncSocket,string,Port">
<dt><pre><span class="Keyword">proc</span> <a href="#connect%2CAsyncSocket%2Cstring%2CPort"><span class="Identifier">connect</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">;</span> <span class="Identifier">address</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">port</span><span class="Other">:</span> <a href="nativesockets.html#Port"><span class="Identifier">Port</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#owned"><span class="Identifier">owned</span></a><span class="Other">(</span>
<a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span>
<span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Connects <tt class="docutils literal"><span class="pre"><span class="Identifier">socket</span></span></tt> to server at <tt class="docutils literal"><span class="pre"><span class="Identifier">address</span><span class="Punctuation">:</span><span class="Identifier">port</span></span></tt>.</p>
<p>Returns a <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span></span></tt> which will complete when the connection succeeds or an error occurs.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L310" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L310" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="connectUnix-procs-all">
<div id="connectUnix,AsyncSocket,string">
<dt><pre><span class="Keyword">proc</span> <a href="#connectUnix%2CAsyncSocket%2Cstring"><span class="Identifier">connectUnix</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">;</span> <span class="Identifier">path</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span><a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Binds Unix socket to <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt>. This only works on Unix-style systems: Mac OS X, BSD and Linux
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L681" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L681" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="dial-procs-all">
<div id="dial,string,Port">
<dt><pre><span class="Keyword">proc</span> <a href="#dial%2Cstring%2CPort"><span class="Identifier">dial</span></a><span class="Other">(</span><span class="Identifier">address</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">port</span><span class="Other">:</span> <a href="nativesockets.html#Port"><span class="Identifier">Port</span></a><span class="Other">;</span> <span class="Identifier">protocol</span> <span class="Other">=</span> <span class="Identifier">IPPROTO_TCP</span><span class="Other">;</span> <span class="Identifier">buffered</span> <span class="Other">=</span> <span class="Identifier">true</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span>
<a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Establishes connection to the specified <tt class="docutils literal"><span class="pre"><span class="Identifier">address</span></span></tt>:<tt class="docutils literal"><span class="pre"><span class="Identifier">port</span></span></tt> pair via the specified protocol. The procedure iterates through possible resolutions of the <tt class="docutils literal"><span class="pre"><span class="Identifier">address</span></span></tt> until it succeeds, meaning that it seamlessly works with both IPv4 and IPv6. Returns AsyncSocket ready to send or receive data.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L299" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L299" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getFd-procs-all">
<div id="getFd,AsyncSocket">
<dt><pre><span class="Keyword">proc</span> <a href="#getFd%2CAsyncSocket"><span class="Identifier">getFd</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">)</span><span class="Other">:</span> <a href="winlean.html#SocketHandle"><span class="Identifier">SocketHandle</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns the socket's file descriptor.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L837" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L837" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getLocalAddr-procs-all">
<div id="getLocalAddr,AsyncSocket">
<dt><pre><span class="Keyword">proc</span> <a href="#getLocalAddr%2CAsyncSocket"><span class="Identifier">getLocalAddr</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Other">(</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">,</span> <a href="nativesockets.html#Port"><span class="Identifier">Port</span></a><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Get the socket's local address and port number.</p>
<p>This is high-level interface for <span id="getsockname_1">getsockname</span>.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L180" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L180" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getPeerAddr-procs-all">
<div id="getPeerAddr,AsyncSocket">
<dt><pre><span class="Keyword">proc</span> <a href="#getPeerAddr%2CAsyncSocket"><span class="Identifier">getPeerAddr</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Other">(</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">,</span> <a href="nativesockets.html#Port"><span class="Identifier">Port</span></a><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Get the socket's peer address and port number.</p>
<p>This is high-level interface for <span id="getpeername_1">getpeername</span>.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L187" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L187" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getPeerCertificates-procs-all">
<div id="getPeerCertificates,AsyncSocket">
<dt><pre><span class="Keyword">proc</span> <a href="#getPeerCertificates%2CAsyncSocket"><span class="Identifier">getPeerCertificates</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><a href="net.html#Certificate"><span class="Identifier">Certificate</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns the certificate chain received by the peer we are connected to through the given socket. The handshake must have been completed and the certificate chain must have been verified successfully or else an empty sequence is returned. The chain is ordered from leaf certificate to root certificate.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L810" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L810" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getSockOpt-procs-all">
<div id="getSockOpt,AsyncSocket,SOBool">
<dt><pre><span class="Keyword">proc</span> <a href="#getSockOpt%2CAsyncSocket%2CSOBool"><span class="Identifier">getSockOpt</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">;</span> <span class="Identifier">opt</span><span class="Other">:</span> <a href="net.html#SOBool"><span class="Identifier">SOBool</span></a><span class="Other">;</span> <span class="Identifier">level</span> <span class="Other">=</span> <span class="Identifier">SOL_SOCKET</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#ReadIOEffect"><span class="Identifier">ReadIOEffect</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Retrieves option <tt class="docutils literal"><span class="pre"><span class="Identifier">opt</span></span></tt> as a boolean value.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L821" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L821" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="hasDataBuffered-procs-all">
<div id="hasDataBuffered,AsyncSocket">
<dt><pre><span class="Keyword">proc</span> <a href="#hasDataBuffered%2CAsyncSocket"><span class="Identifier">hasDataBuffered</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Determines whether an AsyncSocket has data buffered.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L674" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L674" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="isClosed-procs-all">
<div id="isClosed,AsyncSocket">
<dt><pre><span class="Keyword">proc</span> <a href="#isClosed%2CAsyncSocket"><span class="Identifier">isClosed</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Determines whether the socket has been closed.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L841" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L841" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="isSsl-procs-all">
<div id="isSsl,AsyncSocket">
<dt><pre><span class="Keyword">proc</span> <a href="#isSsl%2CAsyncSocket"><span class="Identifier">isSsl</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Determines whether <tt class="docutils literal"><span class="pre"><span class="Identifier">socket</span></span></tt> is a SSL socket.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L833" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L833" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="listen-procs-all">
<div id="listen,AsyncSocket">
<dt><pre><span class="Keyword">proc</span> <a href="#listen%2CAsyncSocket"><span class="Identifier">listen</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">;</span> <span class="Identifier">backlog</span> <span class="Other">=</span> <span class="Identifier">SOMAXCONN</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#ReadIOEffect"><span class="Identifier">ReadIOEffect</span></a><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Marks <tt class="docutils literal"><span class="pre"><span class="Identifier">socket</span></span></tt> as accepting connections. <tt class="docutils literal"><span class="pre"><span class="Identifier">Backlog</span></span></tt> specifies the maximum length of the queue of pending connections.</p>
<p>Raises an OSError error upon failure.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L645" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L645" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newAsyncSocket-procs-all">
<div id="newAsyncSocket,cint,cint,cint">
<dt><pre><span class="Keyword">proc</span> <a href="#newAsyncSocket%2Ccint%2Ccint%2Ccint"><span class="Identifier">newAsyncSocket</span></a><span class="Other">(</span><span class="Identifier">domain</span><span class="Other">,</span> <span class="Identifier">sockType</span><span class="Other">,</span> <span class="Identifier">protocol</span><span class="Other">:</span> <a href="ctypes.html#cint"><span class="Identifier">cint</span></a><span class="Other">;</span> <span class="Identifier">buffered</span> <span class="Other">=</span> <span class="Identifier">true</span><span class="Other">;</span>
<span class="Identifier">inheritable</span> <span class="Other">=</span> <span class="Identifier">defined</span><span class="Other">(</span><span class="Identifier">nimInheritHandles</span><span class="Other">)</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span><span class="Identifier">AsyncSocket</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Creates a new asynchronous socket.</p>
<p>This procedure will also create a brand new file descriptor for this socket.</p>
<p>If <tt class="docutils literal"><span class="pre"><span class="Identifier">inheritable</span></span></tt> is false (the default), the new file descriptor will not be inheritable by child processes.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L193" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L193" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="newAsyncSocket,Domain,SockType,Protocol">
<dt><pre><span class="Keyword">proc</span> <a href="#newAsyncSocket%2CDomain%2CSockType%2CProtocol"><span class="Identifier">newAsyncSocket</span></a><span class="Other">(</span><span class="Identifier">domain</span><span class="Other">:</span> <a href="nativesockets.html#Domain"><span class="Identifier">Domain</span></a> <span class="Other">=</span> <span class="Identifier">AF_INET</span><span class="Other">;</span> <span class="Identifier">sockType</span><span class="Other">:</span> <a href="nativesockets.html#SockType"><span class="Identifier">SockType</span></a> <span class="Other">=</span> <span class="Identifier">SOCK_STREAM</span><span class="Other">;</span>
<span class="Identifier">protocol</span><span class="Other">:</span> <a href="nativesockets.html#Protocol"><span class="Identifier">Protocol</span></a> <span class="Other">=</span> <span class="Identifier">IPPROTO_TCP</span><span class="Other">;</span> <span class="Identifier">buffered</span> <span class="Other">=</span> <span class="Identifier">true</span><span class="Other">;</span>
<span class="Identifier">inheritable</span> <span class="Other">=</span> <span class="Identifier">defined</span><span class="Other">(</span><span class="Identifier">nimInheritHandles</span><span class="Other">)</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span><span class="Identifier">AsyncSocket</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Creates a new asynchronous socket.</p>
<p>This procedure will also create a brand new file descriptor for this socket.</p>
<p>If <tt class="docutils literal"><span class="pre"><span class="Identifier">inheritable</span></span></tt> is false (the default), the new file descriptor will not be inheritable by child processes.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L165" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L165" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="newAsyncSocket,AsyncFD,Domain,SockType,Protocol">
<dt><pre><span class="Keyword">proc</span> <a href="#newAsyncSocket%2CAsyncFD%2CDomain%2CSockType%2CProtocol"><span class="Identifier">newAsyncSocket</span></a><span class="Other">(</span><span class="Identifier">fd</span><span class="Other">:</span> <a href="asyncdispatch.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">;</span> <span class="Identifier">domain</span><span class="Other">:</span> <a href="nativesockets.html#Domain"><span class="Identifier">Domain</span></a> <span class="Other">=</span> <span class="Identifier">AF_INET</span><span class="Other">;</span>
<span class="Identifier">sockType</span><span class="Other">:</span> <a href="nativesockets.html#SockType"><span class="Identifier">SockType</span></a> <span class="Other">=</span> <span class="Identifier">SOCK_STREAM</span><span class="Other">;</span>
<span class="Identifier">protocol</span><span class="Other">:</span> <a href="nativesockets.html#Protocol"><span class="Identifier">Protocol</span></a> <span class="Other">=</span> <span class="Identifier">IPPROTO_TCP</span><span class="Other">;</span> <span class="Identifier">buffered</span> <span class="Other">=</span> <span class="Identifier">true</span><span class="Other">;</span>
<span class="Identifier">inheritable</span> <span class="Other">=</span> <span class="Identifier">defined</span><span class="Other">(</span><span class="Identifier">nimInheritHandles</span><span class="Other">)</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span><span class="Identifier">AsyncSocket</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Creates a new <tt class="docutils literal"><span class="pre"><span class="Identifier">AsyncSocket</span></span></tt> based on the supplied params.</p>
<p>The supplied <tt class="docutils literal"><span class="pre"><span class="Identifier">fd</span></span></tt>'s non-blocking state will be enabled implicitly.</p>
<p>If <tt class="docutils literal"><span class="pre"><span class="Identifier">inheritable</span></span></tt> is false (the default), the supplied <tt class="docutils literal"><span class="pre"><span class="Identifier">fd</span></span></tt> will not be inheritable by child processes.</p>
<p><strong>Note</strong>: This procedure will <strong>NOT</strong> register <tt class="docutils literal"><span class="pre"><span class="Identifier">fd</span></span></tt> with the global async dispatcher. You need to do this manually. If you have used <tt class="docutils literal"><span class="pre"><span class="Identifier">newAsyncNativeSocket</span></span></tt> to create <tt class="docutils literal"><span class="pre"><span class="Identifier">fd</span></span></tt> then it's already registered.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L137" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L137" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="recv-procs-all">
<div id="recv,AsyncSocket,int">
<dt><pre><span class="Keyword">proc</span> <a href="#recv%2CAsyncSocket%2Cint"><span class="Identifier">recv</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">;</span> <span class="Identifier">size</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">;</span> <span class="Identifier">flags</span> <span class="Other">=</span> <span class="Other">{</span><span class="Identifier">SafeDisconn</span><span class="Other">}</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span>
<a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Reads <strong>up to</strong> <tt class="docutils literal"><span class="pre"><span class="Identifier">size</span></span></tt> bytes from <tt class="docutils literal"><span class="pre"><span class="Identifier">socket</span></span></tt>.</p>
<p>For buffered sockets this function will attempt to read all the requested data. It will read this data in <tt class="docutils literal"><span class="pre"><span class="Identifier">BufferSize</span></span></tt> chunks.</p>
<p>For unbuffered sockets this function makes no effort to read all the data requested. It will return as much data as the operating system gives it.</p>
<p>If socket is disconnected during the recv operation then the future may complete with only a part of the requested data.</p>
<p>If socket is disconnected and no data is available to be read then the future will complete with a value of <tt class="docutils literal"><span class="pre"><span class="StringLit">&quot;&quot;</span></span></tt>.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L402" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L402" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="recvFrom-procs-all">
<div id="recvFrom,AsyncSocket,FutureVar[string],int,FutureVar[string],FutureVar[Port]">
<dt><pre><span class="Keyword">proc</span> <a href="#recvFrom%2CAsyncSocket%2CFutureVar%5Bstring%5D%2Cint%2CFutureVar%5Bstring%5D%2CFutureVar%5BPort%5D"><span class="Identifier">recvFrom</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">size</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">;</span>
<span class="Identifier">address</span><span class="Other">:</span> <a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">port</span><span class="Other">:</span> <a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">[</span><a href="nativesockets.html#Port"><span class="Identifier">Port</span></a><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">flags</span> <span class="Other">=</span> <span class="Other">{</span><span class="Identifier">SafeDisconn</span><span class="Other">}</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span><a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Receives a datagram data from <tt class="docutils literal"><span class="pre"><span class="Identifier">socket</span></span></tt> into <tt class="docutils literal"><span class="pre"><span class="Identifier">data</span></span></tt>, which must be at least of size <tt class="docutils literal"><span class="pre"><span class="Identifier">size</span></span></tt>. The address and port of datagram's sender will be stored into <tt class="docutils literal"><span class="pre"><span class="Identifier">address</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">port</span></span></tt>, respectively. Returned future will complete once one datagram has been received, and will return size of packet received.</p>
<p>If an error occurs an OSError exception will be raised.</p>
<p>This proc is normally used with connectionless sockets (UDP sockets).</p>
<p><strong>Notes</strong></p>
<ul class="simple"><li><tt class="docutils literal"><span class="pre"><span class="Identifier">data</span></span></tt> must be initialized to the length of <tt class="docutils literal"><span class="pre"><span class="Identifier">size</span></span></tt>.</li>
<li><tt class="docutils literal"><span class="pre"><span class="Identifier">address</span></span></tt> must be initialized to 46 in length.</li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L894" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L894" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="recvFrom,AsyncSocket,int">
<dt><pre><span class="Keyword">proc</span> <a href="#recvFrom%2CAsyncSocket%2Cint"><span class="Identifier">recvFrom</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">;</span> <span class="Identifier">size</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">;</span> <span class="Identifier">flags</span> <span class="Other">=</span> <span class="Other">{</span><span class="Identifier">SafeDisconn</span><span class="Other">}</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span>
<a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">data</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">,</span> <span class="Identifier">address</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">,</span> <span class="Identifier">port</span><span class="Other">:</span> <a href="nativesockets.html#Port"><span class="Identifier">Port</span></a><span class="Other">]</span><span class="Other">]</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Receives a datagram data from <tt class="docutils literal"><span class="pre"><span class="Identifier">socket</span></span></tt>, which must be at least of size <tt class="docutils literal"><span class="pre"><span class="Identifier">size</span></span></tt>. Returned future will complete once one datagram has been received and will return tuple with: data of packet received; and address and port of datagram's sender.</p>
<p>If an error occurs an OSError exception will be raised.</p>
<p>This proc is normally used with connectionless sockets (UDP sockets).</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L948" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L948" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="recvInto-procs-all">
<div id="recvInto,AsyncSocket,pointer,int">
<dt><pre><span class="Keyword">proc</span> <a href="#recvInto%2CAsyncSocket%2Cpointer%2Cint"><span class="Identifier">recvInto</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">;</span> <span class="Identifier">buf</span><span class="Other">:</span> <a href="system.html#pointer"><span class="Identifier">pointer</span></a><span class="Other">;</span> <span class="Identifier">size</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">;</span>
<span class="Identifier">flags</span> <span class="Other">=</span> <span class="Other">{</span><span class="Identifier">SafeDisconn</span><span class="Other">}</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span><a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Reads <strong>up to</strong> <tt class="docutils literal"><span class="pre"><span class="Identifier">size</span></span></tt> bytes from <tt class="docutils literal"><span class="pre"><span class="Identifier">socket</span></span></tt> into <tt class="docutils literal"><span class="pre"><span class="Identifier">buf</span></span></tt>.</p>
<p>For buffered sockets this function will attempt to read all the requested data. It will read this data in <tt class="docutils literal"><span class="pre"><span class="Identifier">BufferSize</span></span></tt> chunks.</p>
<p>For unbuffered sockets this function makes no effort to read all the data requested. It will return as much data as the operating system gives it.</p>
<p>If socket is disconnected during the recv operation then the future may complete with only a part of the requested data.</p>
<p>If socket is disconnected and no data is available to be read then the future will complete with a value of <tt class="docutils literal"><span class="pre"><span class="DecNumber">0</span></span></tt>.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L354" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L354" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="recvLine-procs-all">
<div id="recvLine,AsyncSocket">
<dt><pre><span class="Keyword">proc</span> <a href="#recvLine%2CAsyncSocket"><span class="Identifier">recvLine</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">;</span> <span class="Identifier">flags</span> <span class="Other">=</span> <span class="Other">{</span><span class="Identifier">SafeDisconn</span><span class="Other">}</span><span class="Other">;</span>
<span class="Identifier">maxLength</span> <span class="Other">=</span> <span class="Identifier">MaxLineLength</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span><a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Reads a line of data from <tt class="docutils literal"><span class="pre"><span class="Identifier">socket</span></span></tt>. Returned future will complete once a full line is read or an error occurs.</p>
<p>If a full line is read <tt class="docutils literal"><span class="pre"><span class="Operator">\</span><span class="Identifier">r</span><span class="Operator">\</span><span class="Identifier">L</span></span></tt> is not added to <tt class="docutils literal"><span class="pre"><span class="Identifier">line</span></span></tt>, however if solely <tt class="docutils literal"><span class="pre"><span class="Operator">\</span><span class="Identifier">r</span><span class="Operator">\</span><span class="Identifier">L</span></span></tt> is read then <tt class="docutils literal"><span class="pre"><span class="Identifier">line</span></span></tt> will be set to it.</p>
<p>If the socket is disconnected, <tt class="docutils literal"><span class="pre"><span class="Identifier">line</span></span></tt> will be set to <tt class="docutils literal"><span class="pre"><span class="StringLit">&quot;&quot;</span></span></tt>.</p>
<p>If the socket is disconnected in the middle of a line (before <tt class="docutils literal"><span class="pre"><span class="Operator">\</span><span class="Identifier">r</span><span class="Operator">\</span><span class="Identifier">L</span></span></tt> is read) then line will be set to <tt class="docutils literal"><span class="pre"><span class="StringLit">&quot;&quot;</span></span></tt>. The partial line <strong>will be lost</strong>.</p>
<p>The <tt class="docutils literal"><span class="pre"><span class="Identifier">maxLength</span></span></tt> parameter determines the maximum amount of characters that can be read. The result is truncated after that.</p>
<div class="admonition admonition-warning"><span class="admonition-warning-text"><b>Warning:</b></span>
The <tt class="docutils literal"><span class="pre"><span class="Identifier">Peek</span></span></tt> flag is not yet implemented.</div>
<div class="admonition admonition-warning"><span class="admonition-warning-text"><b>Warning:</b></span>
<tt class="docutils literal"><span class="pre"><span class="Identifier">recvLine</span></span></tt> on unbuffered sockets assumes that the protocol uses <tt class="docutils literal"><span class="pre"><span class="Operator">\</span><span class="Identifier">r</span><span class="Operator">\</span><span class="Identifier">L</span></span></tt> to delimit a new line.</div>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L617" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L617" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="recvLineInto-procs-all">
<div id="recvLineInto,AsyncSocket,FutureVar[string]">
<dt><pre><span class="Keyword">proc</span> <a href="#recvLineInto%2CAsyncSocket%2CFutureVar%5Bstring%5D"><span class="Identifier">recvLineInto</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">;</span> <span class="Identifier">resString</span><span class="Other">:</span> <a href="asyncfutures.html#FutureVar"><span class="Identifier">FutureVar</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">flags</span> <span class="Other">=</span> <span class="Other">{</span><span class="Identifier">SafeDisconn</span><span class="Other">}</span><span class="Other">;</span> <span class="Identifier">maxLength</span> <span class="Other">=</span> <span class="Identifier">MaxLineLength</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#owned"><span class="Identifier">owned</span></a><span class="Other">(</span>
<a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Reads a line of data from <tt class="docutils literal"><span class="pre"><span class="Identifier">socket</span></span></tt> into <tt class="docutils literal"><span class="pre"><span class="Identifier">resString</span></span></tt>.</p>
<p>If a full line is read <tt class="docutils literal"><span class="pre"><span class="Operator">\</span><span class="Identifier">r</span><span class="Operator">\</span><span class="Identifier">L</span></span></tt> is not added to <tt class="docutils literal"><span class="pre"><span class="Identifier">line</span></span></tt>, however if solely <tt class="docutils literal"><span class="pre"><span class="Operator">\</span><span class="Identifier">r</span><span class="Operator">\</span><span class="Identifier">L</span></span></tt> is read then <tt class="docutils literal"><span class="pre"><span class="Identifier">line</span></span></tt> will be set to it.</p>
<p>If the socket is disconnected, <tt class="docutils literal"><span class="pre"><span class="Identifier">line</span></span></tt> will be set to <tt class="docutils literal"><span class="pre"><span class="StringLit">&quot;&quot;</span></span></tt>.</p>
<p>If the socket is disconnected in the middle of a line (before <tt class="docutils literal"><span class="pre"><span class="Operator">\</span><span class="Identifier">r</span><span class="Operator">\</span><span class="Identifier">L</span></span></tt> is read) then line will be set to <tt class="docutils literal"><span class="pre"><span class="StringLit">&quot;&quot;</span></span></tt>. The partial line <strong>will be lost</strong>.</p>
<p>The <tt class="docutils literal"><span class="pre"><span class="Identifier">maxLength</span></span></tt> parameter determines the maximum amount of characters that can be read. <tt class="docutils literal"><span class="pre"><span class="Identifier">resString</span></span></tt> will be truncated after that.</p>
<div class="admonition admonition-warning"><span class="admonition-warning-text"><b>Warning:</b></span>
The <tt class="docutils literal"><span class="pre"><span class="Identifier">Peek</span></span></tt> flag is not yet implemented.</div>
<div class="admonition admonition-warning"><span class="admonition-warning-text"><b>Warning:</b></span>
<tt class="docutils literal"><span class="pre"><span class="Identifier">recvLineInto</span></span></tt> on unbuffered sockets assumes that the protocol uses <tt class="docutils literal"><span class="pre"><span class="Operator">\</span><span class="Identifier">r</span><span class="Operator">\</span><span class="Identifier">L</span></span></tt> to delimit a new line.</div>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L525" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L525" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="send-procs-all">
<div id="send,AsyncSocket,pointer,int">
<dt><pre><span class="Keyword">proc</span> <a href="#send%2CAsyncSocket%2Cpointer%2Cint"><span class="Identifier">send</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">;</span> <span class="Identifier">buf</span><span class="Other">:</span> <a href="system.html#pointer"><span class="Identifier">pointer</span></a><span class="Other">;</span> <span class="Identifier">size</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">;</span> <span class="Identifier">flags</span> <span class="Other">=</span> <span class="Other">{</span><span class="Identifier">SafeDisconn</span><span class="Other">}</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#owned"><span class="Identifier">owned</span></a><span class="Other">(</span>
<a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Sends <tt class="docutils literal"><span class="pre"><span class="Identifier">size</span></span></tt> bytes from <tt class="docutils literal"><span class="pre"><span class="Identifier">buf</span></span></tt> to <tt class="docutils literal"><span class="pre"><span class="Identifier">socket</span></span></tt>. The returned future will complete once all data has been sent.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L455" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L455" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="send,AsyncSocket,string">
<dt><pre><span class="Keyword">proc</span> <a href="#send%2CAsyncSocket%2Cstring"><span class="Identifier">send</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">flags</span> <span class="Other">=</span> <span class="Other">{</span><span class="Identifier">SafeDisconn</span><span class="Other">}</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#owned"><span class="Identifier">owned</span></a><span class="Other">(</span>
<a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">SslError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Sends <tt class="docutils literal"><span class="pre"><span class="Identifier">data</span></span></tt> to <tt class="docutils literal"><span class="pre"><span class="Identifier">socket</span></span></tt>. The returned future will complete once all data has been sent.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L469" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L469" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="sendTo-procs-all">
<div id="sendTo,AsyncSocket,string,Port,string">
<dt><pre><span class="Keyword">proc</span> <a href="#sendTo%2CAsyncSocket%2Cstring%2CPort%2Cstring"><span class="Identifier">sendTo</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">;</span> <span class="Identifier">address</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">port</span><span class="Other">:</span> <a href="nativesockets.html#Port"><span class="Identifier">Port</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span>
<span class="Identifier">flags</span> <span class="Other">=</span> <span class="Other">{</span><span class="Identifier">SafeDisconn</span><span class="Other">}</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span><a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">stackTrace</span><span class="Other">:</span> <span class="DecNumber">false</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>This proc sends <tt class="docutils literal"><span class="pre"><span class="Identifier">data</span></span></tt> to the specified <tt class="docutils literal"><span class="pre"><span class="Identifier">address</span></span></tt>, which may be an IP address or a hostname. If a hostname is specified this function will try each IP of that hostname. The returned future will complete once all data has been sent.</p>
<p>If an error occurs an OSError exception will be raised.</p>
<p>This proc is normally used with connectionless sockets (UDP sockets).</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L847" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L847" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="setSockOpt-procs-all">
<div id="setSockOpt,AsyncSocket,SOBool,bool">
<dt><pre><span class="Keyword">proc</span> <a href="#setSockOpt%2CAsyncSocket%2CSOBool%2Cbool"><span class="Identifier">setSockOpt</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">;</span> <span class="Identifier">opt</span><span class="Other">:</span> <a href="net.html#SOBool"><span class="Identifier">SOBool</span></a><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a><span class="Other">;</span>
<span class="Identifier">level</span> <span class="Other">=</span> <span class="Identifier">SOL_SOCKET</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#WriteIOEffect"><span class="Identifier">WriteIOEffect</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Sets option <tt class="docutils literal"><span class="pre"><span class="Identifier">opt</span></span></tt> to a boolean value specified by <tt class="docutils literal"><span class="pre"><span class="Identifier">value</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L827" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L827" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="sslHandle-procs-all">
<div id="sslHandle,AsyncSocket">
<dt><pre><span class="Keyword">proc</span> <a href="#sslHandle%2CAsyncSocket"><span class="Identifier">sslHandle</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">)</span><span class="Other">:</span> <a href="openssl.html#SslPtr"><span class="Identifier">SslPtr</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Retrieve the ssl pointer of <tt class="docutils literal"><span class="pre"><span class="Identifier">socket</span></span></tt>. Useful for interfacing with <tt class="docutils literal"><span class="pre"><span class="Identifier">openssl</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L762" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L762" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="wrapConnectedSocket-procs-all">
<div id="wrapConnectedSocket,SslContext,AsyncSocket,SslHandshakeType,string">
<dt><pre><span class="Keyword">proc</span> <a href="#wrapConnectedSocket%2CSslContext%2CAsyncSocket%2CSslHandshakeType%2Cstring"><span class="Identifier">wrapConnectedSocket</span></a><span class="Other">(</span><span class="Identifier">ctx</span><span class="Other">:</span> <a href="net.html#SslContext"><span class="Identifier">SslContext</span></a><span class="Other">;</span> <span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">;</span>
<span class="Identifier">handshake</span><span class="Other">:</span> <a href="net.html#SslHandshakeType"><span class="Identifier">SslHandshakeType</span></a><span class="Other">;</span> <span class="Identifier">hostname</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">SslError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Wraps a connected socket in an SSL context. This function effectively turns <tt class="docutils literal"><span class="pre"><span class="Identifier">socket</span></span></tt> into an SSL socket. <tt class="docutils literal"><span class="pre"><span class="Identifier">hostname</span></span></tt> should be specified so that the client knows which hostname the server certificate should be validated against.</p>
<p>This should be called on a connected socket, and will perform an SSL handshake immediately.</p>
<p><strong>Disclaimer</strong>: This code is not well tested, may be very unsafe and prone to security vulnerabilities.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L785" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L785" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="wrapSocket-procs-all">
<div id="wrapSocket,SslContext,AsyncSocket">
<dt><pre><span class="Keyword">proc</span> <a href="#wrapSocket%2CSslContext%2CAsyncSocket"><span class="Identifier">wrapSocket</span></a><span class="Other">(</span><span class="Identifier">ctx</span><span class="Other">:</span> <a href="net.html#SslContext"><span class="Identifier">SslContext</span></a><span class="Other">;</span> <span class="Identifier">socket</span><span class="Other">:</span> <a href="asyncnet.html#AsyncSocket"><span class="Identifier">AsyncSocket</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">SslError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Wraps a socket in an SSL context. This function effectively turns <tt class="docutils literal"><span class="pre"><span class="Identifier">socket</span></span></tt> into an SSL socket.</p>
<p><strong>Disclaimer</strong>: This code is not well tested, may be very unsafe and prone to security vulnerabilities.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncnet.nim#L767" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncnet.nim#L767" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="19">
<h1><a class="toc-backref" href="#19">Exports</a></h1>
<dl class="item">
<a href="net.html#SOBool"><span class="Identifier">SOBool</span></a>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:07:39 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

44
asyncnet.idx Normal file
View File

@@ -0,0 +1,44 @@
nimTitle asyncnet asyncnet.html module std/asyncnet 0
nim AsyncSocket asyncnet.html#AsyncSocket type AsyncSocket 135
nim newAsyncSocket asyncnet.html#newAsyncSocket,AsyncFD,Domain,SockType,Protocol proc newAsyncSocket(fd: AsyncFD; domain: Domain = AF_INET;\n sockType: SockType = SOCK_STREAM;\n protocol: Protocol = IPPROTO_TCP; buffered = true;\n inheritable = defined(nimInheritHandles)): owned(AsyncSocket) 137
nim newAsyncSocket asyncnet.html#newAsyncSocket,Domain,SockType,Protocol proc newAsyncSocket(domain: Domain = AF_INET; sockType: SockType = SOCK_STREAM;\n protocol: Protocol = IPPROTO_TCP; buffered = true;\n inheritable = defined(nimInheritHandles)): owned(AsyncSocket) 165
nim getLocalAddr asyncnet.html#getLocalAddr,AsyncSocket proc getLocalAddr(socket: AsyncSocket): (string, Port) 180
nim getPeerAddr asyncnet.html#getPeerAddr,AsyncSocket proc getPeerAddr(socket: AsyncSocket): (string, Port) 187
nim newAsyncSocket asyncnet.html#newAsyncSocket,cint,cint,cint proc newAsyncSocket(domain, sockType, protocol: cint; buffered = true;\n inheritable = defined(nimInheritHandles)): owned(AsyncSocket) 193
nim dial asyncnet.html#dial,string,Port proc dial(address: string; port: Port; protocol = IPPROTO_TCP; buffered = true): owned(\n Future[AsyncSocket]) 299
nim connect asyncnet.html#connect,AsyncSocket,string,Port proc connect(socket: AsyncSocket; address: string; port: Port): owned(\n Future[void]) 310
nim recvInto asyncnet.html#recvInto,AsyncSocket,pointer,int proc recvInto(socket: AsyncSocket; buf: pointer; size: int; flags = {SafeDisconn}): owned(\n Future[int]) 354
nim recv asyncnet.html#recv,AsyncSocket,int proc recv(socket: AsyncSocket; size: int; flags = {SafeDisconn}): owned(\n Future[string]) 402
nim send asyncnet.html#send,AsyncSocket,pointer,int proc send(socket: AsyncSocket; buf: pointer; size: int; flags = {SafeDisconn}): owned(\n Future[void]) 455
nim send asyncnet.html#send,AsyncSocket,string proc send(socket: AsyncSocket; data: string; flags = {SafeDisconn}): owned(\n Future[void]) 469
nim acceptAddr asyncnet.html#acceptAddr,AsyncSocket proc acceptAddr(socket: AsyncSocket; flags = {SafeDisconn};\n inheritable = defined(nimInheritHandles)): owned(\n Future[tuple[address: string, client: AsyncSocket]]) 482
nim accept asyncnet.html#accept,AsyncSocket proc accept(socket: AsyncSocket; flags = {SafeDisconn}): owned(Future[AsyncSocket]) 506
nim recvLineInto asyncnet.html#recvLineInto,AsyncSocket,FutureVar[string] proc recvLineInto(socket: AsyncSocket; resString: FutureVar[string];\n flags = {SafeDisconn}; maxLength = MaxLineLength): owned(\n Future[void]) 525
nim recvLine asyncnet.html#recvLine,AsyncSocket proc recvLine(socket: AsyncSocket; flags = {SafeDisconn}; maxLength = MaxLineLength): owned(\n Future[string]) 617
nim listen asyncnet.html#listen,AsyncSocket proc listen(socket: AsyncSocket; backlog = SOMAXCONN) 645
nim bindAddr asyncnet.html#bindAddr,AsyncSocket,string proc bindAddr(socket: AsyncSocket; port = Port(0); address = "") 654
nim hasDataBuffered asyncnet.html#hasDataBuffered,AsyncSocket proc hasDataBuffered(s: AsyncSocket): bool 674
nim connectUnix asyncnet.html#connectUnix,AsyncSocket,string proc connectUnix(socket: AsyncSocket; path: string): owned(Future[void]) 681
nim bindUnix asyncnet.html#bindUnix,AsyncSocket,string proc bindUnix(socket: AsyncSocket; path: string) 712
nim close asyncnet.html#close,AsyncSocket proc close(socket: AsyncSocket) 734
nim sslHandle asyncnet.html#sslHandle,AsyncSocket proc sslHandle(self: AsyncSocket): SslPtr 762
nim wrapSocket asyncnet.html#wrapSocket,SslContext,AsyncSocket proc wrapSocket(ctx: SslContext; socket: AsyncSocket) 767
nim wrapConnectedSocket asyncnet.html#wrapConnectedSocket,SslContext,AsyncSocket,SslHandshakeType,string proc wrapConnectedSocket(ctx: SslContext; socket: AsyncSocket;\n handshake: SslHandshakeType; hostname: string = "") 785
nim getPeerCertificates asyncnet.html#getPeerCertificates,AsyncSocket proc getPeerCertificates(socket: AsyncSocket): seq[Certificate] 810
nim getSockOpt asyncnet.html#getSockOpt,AsyncSocket,SOBool proc getSockOpt(socket: AsyncSocket; opt: SOBool; level = SOL_SOCKET): bool 821
nim setSockOpt asyncnet.html#setSockOpt,AsyncSocket,SOBool,bool proc setSockOpt(socket: AsyncSocket; opt: SOBool; value: bool; level = SOL_SOCKET) 827
nim isSsl asyncnet.html#isSsl,AsyncSocket proc isSsl(socket: AsyncSocket): bool 833
nim getFd asyncnet.html#getFd,AsyncSocket proc getFd(socket: AsyncSocket): SocketHandle 837
nim isClosed asyncnet.html#isClosed,AsyncSocket proc isClosed(socket: AsyncSocket): bool 841
nim sendTo asyncnet.html#sendTo,AsyncSocket,string,Port,string proc sendTo(socket: AsyncSocket; address: string; port: Port; data: string;\n flags = {SafeDisconn}): owned(Future[void]) 847
nim recvFrom asyncnet.html#recvFrom,AsyncSocket,FutureVar[string],int,FutureVar[string],FutureVar[Port] proc recvFrom(socket: AsyncSocket; data: FutureVar[string]; size: int;\n address: FutureVar[string]; port: FutureVar[Port];\n flags = {SafeDisconn}): owned(Future[int]) 894
nim recvFrom asyncnet.html#recvFrom,AsyncSocket,int proc recvFrom(socket: AsyncSocket; size: int; flags = {SafeDisconn}): owned(\n Future[tuple[data: string, address: string, port: Port]]) 948
heading Asynchronous IO in Nim asyncnet.html#asynchronous-io-in-nim Asynchronous IO in Nim 0
heading SSL asyncnet.html#ssl SSL 0
heading Examples asyncnet.html#examples Examples 0
heading Chat server asyncnet.html#examples-chat-server Chat server 0
idx getpeername asyncnet.html#getpeername_1 Chat server 0
idx getsockname asyncnet.html#getsockname_1 Chat server 0
nimgrp recvfrom asyncnet.html#recvFrom-procs-all proc 891
nimgrp newasyncsocket asyncnet.html#newAsyncSocket-procs-all proc 137
nimgrp send asyncnet.html#send-procs-all proc 454

297
asyncstreams.html Normal file
View File

@@ -0,0 +1,297 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/asyncstreams</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/asyncstreams</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#FutureStream" title="FutureStream[T] = ref object
error*: ref Exception">FutureStream</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">callback=
<li><a class="reference" href="#callback%3D%2CFutureStream%5BT%5D%2Cproc%28FutureStream%5BT%5D%29" title="callback=[T](future: FutureStream[T];
cb: proc (future: FutureStream[T]) {.closure, gcsafe.})">callback=[T](future: FutureStream[T];
cb: proc (future: FutureStream[T]) {.closure, gcsafe.})</a></li>
</ul>
<ul class="simple nested-toc-section">complete
<li><a class="reference" href="#complete%2CFutureStream%5BT%5D" title="complete[T](future: FutureStream[T])">complete[T](future: FutureStream[T])</a></li>
</ul>
<ul class="simple nested-toc-section">fail
<li><a class="reference" href="#fail%2CFutureStream%5BT%5D%2Cref.Exception" title="fail[T](future: FutureStream[T]; error: ref Exception)">fail[T](future: FutureStream[T]; error: ref Exception)</a></li>
</ul>
<ul class="simple nested-toc-section">failed
<li><a class="reference" href="#failed%2CFutureStream%5BT%5D" title="failed[T](future: FutureStream[T]): bool">failed[T](future: FutureStream[T]): bool</a></li>
</ul>
<ul class="simple nested-toc-section">finished
<li><a class="reference" href="#finished%2CFutureStream%5BT%5D" title="finished[T](future: FutureStream[T]): bool">finished[T](future: FutureStream[T]): bool</a></li>
</ul>
<ul class="simple nested-toc-section">len
<li><a class="reference" href="#len%2CFutureStream%5BT%5D" title="len[T](future: FutureStream[T]): int">len[T](future: FutureStream[T]): int</a></li>
</ul>
<ul class="simple nested-toc-section">newFutureStream
<li><a class="reference" href="#newFutureStream%2Cstring" title="newFutureStream[T](fromProc = &quot;unspecified&quot;): FutureStream[T]">newFutureStream[T](fromProc = &quot;unspecified&quot;): FutureStream[T]</a></li>
</ul>
<ul class="simple nested-toc-section">read
<li><a class="reference" href="#read%2CFutureStream%5BT%5D" title="read[T](future: FutureStream[T]): owned(Future[(bool, T)])">read[T](future: FutureStream[T]): owned(Future[(bool, T)])</a></li>
</ul>
<ul class="simple nested-toc-section">write
<li><a class="reference" href="#write%2CFutureStream%5BT%5D%2CT" title="write[T](future: FutureStream[T]; value: T): Future[void]">write[T](future: FutureStream[T]; value: T): Future[void]</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">Unstable API.</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="asyncfutures.html">asyncfutures</a>, <a class="reference external" href="assertions.html">assertions</a>, <a class="reference external" href="deques.html">deques</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="FutureStream">
<dt><pre><a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span>
<span class="Identifier">error</span><span class="Operator">*</span><span class="Other">:</span> <span class="Keyword">ref</span> <a href="system.html#Exception"><span class="Identifier">Exception</span></a></pre></dt>
<dd>
Special future that acts as a queue. Its API is still experimental and so is subject to change.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L20" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L20" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="callback=-procs-all">
<div id="callback=,FutureStream[T],proc(FutureStream[T])">
<dt><pre><span class="Keyword">proc</span> <a href="#callback%3D%2CFutureStream%5BT%5D%2Cproc%28FutureStream%5BT%5D%29"><span class="Identifier">callback=</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">cb</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span> {.<span class="Identifier">closure</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span></span>.}<span class="Other">)</span></pre></dt>
<dd>
<p>Sets the callback proc to be called when data was placed inside the future stream.</p>
<p>The callback is also called when the future is completed. So you should use <tt class="docutils literal"><span class="pre"><span class="Identifier">finished</span></span></tt> to check whether data is available.</p>
<p>If the future stream already has data or is finished then <tt class="docutils literal"><span class="pre"><span class="Identifier">cb</span></span></tt> will be called immediately.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L60" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L60" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="complete-procs-all">
<div id="complete,FutureStream[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#complete%2CFutureStream%5BT%5D"><span class="Identifier">complete</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
<dd>
Completes a <tt class="docutils literal"><span class="pre"><span class="Identifier">FutureStream</span></span></tt> signalling the end of data.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L45" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L45" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="fail-procs-all">
<div id="fail,FutureStream[T],ref.Exception">
<dt><pre><span class="Keyword">proc</span> <a href="#fail%2CFutureStream%5BT%5D%2Cref.Exception"><span class="Identifier">fail</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">error</span><span class="Other">:</span> <span class="Keyword">ref</span> <a href="system.html#Exception"><span class="Identifier">Exception</span></a><span class="Other">)</span></pre></dt>
<dd>
Completes <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt> with <tt class="docutils literal"><span class="pre"><span class="Identifier">error</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L52" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L52" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="failed-procs-all">
<div id="failed,FutureStream[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#failed%2CFutureStream%5BT%5D"><span class="Identifier">failed</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a></pre></dt>
<dd>
Determines whether <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt> completed with an error.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L81" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L81" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="finished-procs-all">
<div id="finished,FutureStream[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#finished%2CFutureStream%5BT%5D"><span class="Identifier">finished</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a></pre></dt>
<dd>
Check if a <tt class="docutils literal"><span class="pre"><span class="Identifier">FutureStream</span></span></tt> is finished. <tt class="docutils literal"><span class="pre"><span class="Identifier">true</span></span></tt> value means that no more data will be placed inside the stream <em>and</em> that there is no data waiting to be retrieved.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L75" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L75" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="len-procs-all">
<div id="len,FutureStream[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#len%2CFutureStream%5BT%5D"><span class="Identifier">len</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a></pre></dt>
<dd>
Returns the amount of data pieces inside the stream.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L145" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L145" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newFutureStream-procs-all">
<div id="newFutureStream,string">
<dt><pre><span class="Keyword">proc</span> <a href="#newFutureStream%2Cstring"><span class="Identifier">newFutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fromProc</span> <span class="Other">=</span> <span class="StringLit">&quot;unspecified&quot;</span><span class="Other">)</span><span class="Other">:</span> <a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span></pre></dt>
<dd>
Create a new <tt class="docutils literal"><span class="pre"><span class="Identifier">FutureStream</span></span></tt>. This future's callback is activated when two events occur:<ul class="simple"><li>New data is written into the future stream.</li>
<li>The future stream is completed (this means that no more data will be written).</li>
</ul>
<p>Specifying <tt class="docutils literal"><span class="pre"><span class="Identifier">fromProc</span></span></tt>, which is a string specifying the name of the proc that this future belongs to, is a good habit as it helps with debugging.</p>
<p><strong>Note:</strong> The API of FutureStream is still new and so has a higher likelihood of changing in the future.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L29" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L29" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="read-procs-all">
<div id="read,FutureStream[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#read%2CFutureStream%5BT%5D"><span class="Identifier">read</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">owned</span><span class="Other">(</span><a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Other">(</span><a href="system.html#bool"><span class="Identifier">bool</span></a><span class="Other">,</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
<dd>
<p>Returns a future that will complete when the <tt class="docutils literal"><span class="pre"><span class="Identifier">FutureStream</span></span></tt> has data placed into it. The future will be completed with the oldest value stored inside the stream. The return value will also determine whether data was retrieved, <tt class="docutils literal"><span class="pre"><span class="Identifier">false</span></span></tt> means that the future stream was completed and no data was retrieved.</p>
<p>This function will remove the data that was returned from the underlying <tt class="docutils literal"><span class="pre"><span class="Identifier">FutureStream</span></span></tt>.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L100" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L100" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="write-procs-all">
<div id="write,FutureStream[T],T">
<dt><pre><span class="Keyword">proc</span> <a href="#write%2CFutureStream%5BT%5D%2CT"><span class="Identifier">write</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="asyncstreams.html#FutureStream"><span class="Identifier">FutureStream</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="asyncfutures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><a href="system.html#void"><span class="Identifier">void</span></a><span class="Other">]</span></pre></dt>
<dd>
<p>Writes the specified value inside the specified future stream.</p>
<p>This will raise <tt class="docutils literal"><span class="pre"><span class="Identifier">ValueError</span></span></tt> if <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt> is finished.</p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/asyncstreams.nim#L85" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/asyncstreams.nim#L85" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:07:43 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

11
asyncstreams.idx Normal file
View File

@@ -0,0 +1,11 @@
nimTitle asyncstreams asyncstreams.html module std/asyncstreams 0
nim FutureStream asyncstreams.html#FutureStream type FutureStream 20
nim newFutureStream asyncstreams.html#newFutureStream,string proc newFutureStream[T](fromProc = "unspecified"): FutureStream[T] 29
nim complete asyncstreams.html#complete,FutureStream[T] proc complete[T](future: FutureStream[T]) 45
nim fail asyncstreams.html#fail,FutureStream[T],ref.Exception proc fail[T](future: FutureStream[T]; error: ref Exception) 52
nim callback= asyncstreams.html#callback=,FutureStream[T],proc(FutureStream[T]) proc callback=[T](future: FutureStream[T];\n cb: proc (future: FutureStream[T]) {.closure, gcsafe.}) 60
nim finished asyncstreams.html#finished,FutureStream[T] proc finished[T](future: FutureStream[T]): bool 75
nim failed asyncstreams.html#failed,FutureStream[T] proc failed[T](future: FutureStream[T]): bool 81
nim write asyncstreams.html#write,FutureStream[T],T proc write[T](future: FutureStream[T]; value: T): Future[void] 85
nim read asyncstreams.html#read,FutureStream[T] proc read[T](future: FutureStream[T]): owned(Future[(bool, T)]) 100
nim len asyncstreams.html#len,FutureStream[T] proc len[T](future: FutureStream[T]): int 145

197
atlas.html Normal file
View File

@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>doc/atlas</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">doc/atlas</h1>
<h1 id="atlas-package-cloner">Atlas Package Cloner</h1><p>Atlas is a simple package cloner tool. It manages project dependencies in an isolated <tt class="docutils literal"><span class="pre">deps/</span></tt> directory.</p>
<p>Atlas is compatible with Nimble in the sense that it supports the Nimble file format.</p>
<h2 id="concepts">Concepts</h2><p>Atlas uses two main concepts:</p>
<ol class="simple"><li>Projects</li>
<li>Dependencies</li>
</ol>
<h3 id="projects">Projects</h3><p>A project is a directory that has a file <tt class="docutils literal"><span class="pre">atlas.config</span></tt> inside it. Use <tt class="docutils literal"><span class="pre">atlas init</span></tt> to create a project out of the current working directory.</p>
<p>Projects can share dependencies and be developed locally by using the <tt class="docutils literal"><span class="pre">link</span></tt> command. This creates <tt class="docutils literal"><span class="pre">nimble-link</span></tt> files that allow projects to share their dependencies.</p>
<p>The project structure looks like this:</p>
<p><pre class="listing"> $project / project.nimble
$project / nim.cfg
$project / other main project files...
$project / deps / atlas.config
$project / deps / dependency-A
$project / deps / dependency-B
$project / deps / dependency-C.nimble-link (for linked projects)</pre></p>
<p>The deps directory can be set via <tt class="docutils literal"><span class="pre">--deps:DIR</span></tt> during <tt class="docutils literal"><span class="pre">atlas init</span></tt>.</p>
<h3 id="dependencies">Dependencies</h3><p>Inside a project there is a <tt class="docutils literal"><span class="pre">deps</span></tt> directory where your dependencies are kept. It is easy to move a dependency one level up and out of the <tt class="docutils literal"><span class="pre">deps</span></tt> directory, turning it into a project. Likewise, you can move a project to the <tt class="docutils literal"><span class="pre">deps</span></tt> directory, turning it into a dependency.</p>
<p>The only distinction between a project and a dependency is its location. For dependency resolution a project always has a higher priority than a dependency.</p>
<h2 id="no-magic">No magic</h2><p>Atlas works by managing two files for you, the <tt class="docutils literal"><span class="pre">project.nimble</span></tt> file and the <tt class="docutils literal"><span class="pre">nim.cfg</span></tt> file. You can edit these manually too, Atlas doesn't touch what should be left untouched.</p>
<h2 id="how-it-works">How it works</h2><p>Atlas uses git commits internally; version requirements are translated to git commits via git tags and a fallback of searching Nimble file commits.</p>
<p>Atlas uses URLs internally; Nimble package names are translated to URLs via Nimble's <tt class="docutils literal"><span class="pre">packages.json</span></tt> file. Atlas uses &quot;shortnames&quot; for known URLs from packages. Unofficial URLs, including forks, using a name triplet of the form <tt class="docutils literal"><span class="pre">projectName.author.host</span></tt>. For example Atlas would be <tt class="docutils literal"><span class="pre">atlas.nim-lang.github.com</span></tt>. Packages can be added using <tt class="docutils literal"><span class="pre">nameOverrides</span></tt> in <tt class="docutils literal"><span class="pre">atlas.config</span></tt> which adds a new name to URL mapping.</p>
<p>Atlas does not call the Nim compiler for a build, instead it creates/patches a <tt class="docutils literal"><span class="pre">nim.cfg</span></tt> file for the compiler. For example:</p>
<p><pre class="listing">############# begin Atlas config section ##########
--noNimblePath
--path:&quot;deps/nimx&quot;
--path:&quot;deps/sdl2/src&quot;
--path:&quot;deps/opengl/src&quot;
--path:&quot;../linked-project/src&quot;
--path:&quot;../linked-project/deps/msgpack4nim/&quot;
############# end Atlas config section ##########</pre></p>
<p>The version selection is deterministic, it picks up the <em>minimum</em> required version. Thanks to this design, lock files are much less important.</p>
<h2 id="commands">Commands</h2><p>Atlas supports the following commands:</p>
<h3 id="use-lturlgt-slash-ltpackage-namegt">Use &lt;url&gt; / &lt;package name&gt;</h3><p>Clone the package behind <tt class="docutils literal"><span class="pre">url</span></tt> or <tt class="docutils literal"><span class="pre">package name</span></tt> and its dependencies into the <tt class="docutils literal"><span class="pre">deps</span></tt> directory and make it available for your current project. Atlas will create or patch the files <tt class="docutils literal"><span class="pre">$project.nimble</span></tt> and <tt class="docutils literal"><span class="pre">nim.cfg</span></tt> for you so that you can simply import the required modules.</p>
<p>For example:</p>
<p><pre class="listing"> mkdir newproject
cd newproject
git init
atlas use lexim
# add `import lexim` to your example.nim file
nim c example.nim
</pre></p>
<h3 id="link-ltpathgt">Link &lt;path&gt;</h3><p>Link another project into the current project to share its dependencies. This creates <tt class="docutils literal"><span class="pre">nimble-link</span></tt> files that allow the projects to share their dependencies.</p>
<p>For example:</p>
<p><pre class="listing"> atlas link ../other-project</pre></p>
<p>This will link the other project and make its dependencies available to your current project. The other project must be another Atlas project and have a Nimble file.</p>
<p>The linked project will be added to this project's Nimble file if it's not already present.</p>
<p>Note, that the other project's <tt class="docutils literal"><span class="pre">nameOverrides</span></tt> and <tt class="docutils literal"><span class="pre">urlOverrides</span></tt> <em>aren't</em> imported. You may need to import the name-overrides to properly use the deps. This is due to the triplet-naming above.</p>
<h3 id="cloneslashupdate-lturlgtslashltpackage-namegt">Clone/Update &lt;url&gt;/&lt;package name&gt;</h3><p>Clones a URL and all of its dependencies (recursively) into the project. Creates or patches a <tt class="docutils literal"><span class="pre">nim.cfg</span></tt> file with the required <tt class="docutils literal"><span class="pre">--path</span></tt> entries.</p>
<p><strong>Note</strong>: Due to the used algorithms an <tt class="docutils literal"><span class="pre">update</span></tt> is the same as a <tt class="docutils literal"><span class="pre">clone</span></tt>.</p>
<p>If a <tt class="docutils literal"><span class="pre">&lt;package name&gt;</span></tt> is given instead the name is first translated into an URL via <tt class="docutils literal"><span class="pre">packages.json</span></tt> or via a github search.</p>
<h2 id="when-statements">When Statements</h2><p>When statements provide support for boolean expressions with a subset of compile time defines. The list of defines currently supported:</p>
<p>windows, posix, linux, macosx, freebsd, openbsd, netbsd, solaris; amd64, x86_64, i386, arm, arm64, mips, powerpc;</p>
<p>If a when statement isn't supported consider using <tt class="docutils literal"><span class="pre">feature</span></tt> statements instead.</p>
<h3 id="feature-statements">Feature Statements</h3><p>Features in Nimble files enable optional requirements for things different scenarios. This is useful when dealing with scenarios like testing only dependencies.</p>
<p><em>Note</em>: Currently features aren't saved to the Atlas config you must always pass <tt class="docutils literal"><span class="pre">atlas --feature:foobar</span></tt> when doing any command. This simplifies configuration and state management in Atlas. It only does what you ask it to do.</p>
<p><pre class="listing"><span class="Identifier">require</span> <span class="StringLit">&quot;normallib&quot;</span>
<span class="Identifier">feature</span> <span class="StringLit">&quot;testing&quot;</span><span class="Punctuation">:</span>
<span class="Identifier">require</span> <span class="StringLit">&quot;mytestlib&quot;</span></pre></p>
<p>Features are lazily cloned by Atlas until they are specified by either a requires feature or passed from the command line.</p>
<p>In Nimble files you can enable features for a a given package like so:</p>
<p><pre class="listing"><span class="Identifier">require</span> <span class="StringLit">&quot;somelib[testing]&quot;</span>
<span class="Identifier">require</span> <span class="StringLit">&quot;anotherlib[testing, async]&quot;</span></pre></p>
<h3 id="search-ltterm-term2-term3-dotdotdotgt">Search &lt;term term2 term3 ...&gt;</h3><p>Search the package index <tt class="docutils literal"><span class="pre">packages.json</span></tt> for a package that contains the given terms in its description (or name or list of tags).</p>
<h3 id="install-ltprojdotnimblegt">Install &lt;proj.nimble&gt;</h3><p>Use the .nimble file to setup the project's dependencies.</p>
<h3 id="updateprojects-slash-updatedeps-filterfilter">UpdateProjects / updateDeps <a class="reference internal" href="#filter">filter</a></h3><p>Update every project / dependency in the project that has a remote URL that matches <tt class="docutils literal"><span class="pre">filter</span></tt> if a filter is given. The project / dependency is only updated if there are no uncommitted changes.</p>
<h3 id="others">Others</h3><p>Run <tt class="docutils literal"><span class="pre">atlas --help</span></tt> for more features.</p>
<h2 id="package-overrides">Package Overrides</h2><p>Sometimes two URLs can conflict for the same dependency shortname. For example, when a project uses a forked dependency with bug fixes. These conflicts need to be manually resolved using <tt class="docutils literal"><span class="pre">pkgOverrides</span></tt> in <tt class="docutils literal"><span class="pre">atlas.config</span></tt>. The format is package name and the selected URL:</p>
<p><pre class="listing"> &quot;pkgOverrides&quot;: {
&quot;asynctools&quot;: &quot;https://github.com/timotheecour/asynctools&quot;
},</pre></p>
<h2 id="overrides">Overrides</h2><p>You can override how Atlas resolves a package name or a URL. The overrides use a simple pattern matching language and are flexible enough to integrate private gitlab repositories.</p>
<p><pre class="listing">{
&quot;resolver&quot;: &quot;SemVer&quot;,
&quot;nameOverrides&quot;: {
&quot;customProject&quot;: &quot;https://gitlab.company.com/customProject&quot;
},
&quot;urlOverrides&quot;: {
&quot;https://github.com/araq/ormin&quot;: &quot;https://github.com/useMyForkInstead/ormin&quot;
},
&quot;plugins&quot;: &quot;&quot;,
}
</pre></p>
<p>The <tt class="docutils literal"><span class="pre">$</span></tt> has a special meaning in a pattern:</p>
<table border="1" class="docutils"><tr><th>Syntax</th><th>Meaning</th></tr>
<tr><td><tt class="docutils literal"><span class="pre">$$</span></tt></td><td>Matches a single dollar sign.</td></tr>
<tr><td><tt class="docutils literal"><span class="pre">$*</span></tt></td><td>Matches until the token following the <tt class="docutils literal"><span class="pre">$*</span></tt> was found.</td></tr>
<tr><td></td><td>The match is allowed to be of 0 length.</td></tr>
<tr><td><tt class="docutils literal"><span class="pre">$+</span></tt></td><td>Matches until the token following the <tt class="docutils literal"><span class="pre">$+</span></tt> was found.</td></tr>
<tr><td></td><td>The match must consist of at least one char.</td></tr>
<tr><td><tt class="docutils literal"><span class="pre">$s</span></tt></td><td>Skips optional whitespace.</td></tr>
</table><p>For example, here is how to override any github link:</p>
<p><pre class="listing"> &quot;urlOverrides&quot;: {
&quot;https://github.com/$+&quot;: &quot;https://utopia.forall/$#&quot;
}</pre></p>
<p>You can use <tt class="docutils literal"><span class="pre">$1</span></tt> or <tt class="docutils literal"><span class="pre">$#</span></tt> to refer to captures.</p>
<h2 id="virtual-nim-environments">Virtual Nim environments</h2><p>Atlas supports setting up a virtual Nim environment via the <tt class="docutils literal"><span class="pre">env</span></tt> command. You can even install multiple different Nim versions into the same project.</p>
<p>For example:</p>
<p><pre class="listing">atlas env 1.6.12
atlas env devel</pre></p>
<p>When completed, run <tt class="docutils literal"><span class="pre">source nim-1.6.12/activate.sh</span></tt> on UNIX and <tt class="docutils literal"><span class="pre">nim-1.6.12/activate.bat</span></tt> on Windows.</p>
<h2 id="dependency-resolution">Dependency resolution</h2><p>To change the used dependency resolution mechanism, edit the <tt class="docutils literal"><span class="pre">resolver</span></tt> value of your <tt class="docutils literal"><span class="pre">atlas.config</span></tt> file. The possible values are:</p>
<h3 id="maxver">MaxVer</h3><p>The default resolution mechanism is called &quot;MaxVer&quot; where the highest available version is selected that still fits the requirements.</p>
<p>Suppose you have a dependency called &quot;mylibrary&quot; with the following available versions: 1.0.0, 1.1.0, and 2.0.0. <tt class="docutils literal"><span class="pre">MaxVer</span></tt> selects the version 2.0.0.</p>
<h3 id="semver">SemVer</h3><p>Adhere to Semantic Versioning (SemVer) by selecting the highest version that satisfies the specified version range. SemVer follows the format of <tt class="docutils literal"><span class="pre">MAJOR.MINOR.PATCH</span></tt>, where:</p>
<p>MAJOR version indicates incompatible changes.</p>
<p>MINOR version indicates backward-compatible new features.</p>
<p>PATCH version indicates backward-compatible bug fixes.</p>
<p>Consider the same &quot;mylibrary&quot; dependency with versions 1.0.0, 1.1.0, and 2.0.0. If you set the resolver to <tt class="docutils literal"><span class="pre">SemVer</span></tt> and specify a version range requirement of <tt class="docutils literal"><span class="pre">&gt;= 1.0.0</span></tt>, the highest version that satisfies the range that does not introduce incompatible changes will be selected. In this case, the selected version would be 1.1.0.</p>
<h3 id="minver">MinVer</h3><p>For the &quot;mylibrary&quot; dependency with versions 1.0.0, 1.1.0, and 2.0.0, if you set the resolver to <tt class="docutils literal"><span class="pre">MinVer</span></tt> and specify multiple minimum versions, the highest version among the minimum required versions will be selected. For example, if you specify a minimum requirement of both <tt class="docutils literal"><span class="pre">&gt;=1.0.0</span></tt> and <tt class="docutils literal"><span class="pre">&gt;=2.0.0</span></tt>, the selected version would be 2.0.0.</p>
<h2 id="reproducible-builds-slash-lockfiles">Reproducible builds / lockfiles</h2><p>Atlas supports lockfiles for reproducible builds via its <tt class="docutils literal"><span class="pre">pin</span></tt> and <tt class="docutils literal"><span class="pre">rep</span></tt> commands.</p>
<p><strong>Notice</strong>: Atlas helps with reproducible builds, but it is not a complete solution. For a truely reproducible build you also need to pin the used C++ compiler, any third party dependencies (&quot;libc&quot; etc.) and the version of your operating system.</p>
<h3 id="pin-atlasdotlockatlasdotlock">pin <a class="reference internal" href="#atlas.lock">atlas.lock</a></h3><p><tt class="docutils literal"><span class="pre">atlas pin</span></tt> can be run either in the project or in a specific project. It &quot;pins&quot; the used repositories to their current commit hashes. If run in the project the entire project is &quot;pinned&quot; in the <tt class="docutils literal"><span class="pre">atlas.lock</span></tt> file. If run in a project the project's dependencies but not the project itself is &quot;pinned&quot; in the lock file.</p>
<h3 id="rep-atlasdotlockatlasdotlock">rep <a class="reference internal" href="#atlas.lock">atlas.lock</a></h3><p>The <tt class="docutils literal"><span class="pre">rep</span></tt> command replays or repeats the projects to use the pinned commit hashes. If the projects have any &quot;build&quot; instructions these are performed too unless the <tt class="docutils literal"><span class="pre">--noexec</span></tt> switch is used.</p>
<h2 id="plugins">Plugins</h2><p>Atlas operates on a graph of dependencies. A dependency is a git project of a specific commit. The graph and version selection algorithms are mostly programming language agnostic. Thus it is easy to integrate foreign projects as dependencies into your project.</p>
<p>This is accomplished by Atlas plugins. A plugin is a NimScript snippet that can call into external tools via <tt class="docutils literal"><span class="pre">exec</span></tt>.</p>
<p>To enable plugins, add the line <tt class="docutils literal"><span class="pre">plugins=&quot;_plugins&quot;</span></tt> to your <tt class="docutils literal"><span class="pre">atlas.config</span></tt> file. Then create a directory <tt class="docutils literal"><span class="pre">_plugins</span></tt> in your project. Every <tt class="docutils literal"><span class="pre">*.nims</span></tt> file inside the plugins directory is integrated into Atlas.</p>
<h3 id="builders">Builders</h3><p>A builder is a build tool like <tt class="docutils literal"><span class="pre">make</span></tt> or <tt class="docutils literal"><span class="pre">cmake</span></tt>. What tool to use is determined by the existence of certain files in the project's top level directory. For example, a file <tt class="docutils literal"><span class="pre">CMakeLists.txt</span></tt> indicates a <tt class="docutils literal"><span class="pre">cmake</span></tt> based build:</p>
<p><pre class="listing">
<span class="Identifier">builder</span> <span class="StringLit">&quot;CMakeLists.txt&quot;</span><span class="Punctuation">:</span>
<span class="Identifier">mkDir</span> <span class="StringLit">&quot;build&quot;</span>
<span class="Identifier">withDir</span> <span class="StringLit">&quot;build&quot;</span><span class="Punctuation">:</span>
<span class="Identifier">exec</span> <span class="StringLit">&quot;cmake ..&quot;</span>
<span class="Identifier">exec</span> <span class="StringLit">&quot;cmake --build . --config Release&quot;</span>
</pre></p>
<p>Save this as <tt class="docutils literal"><span class="pre">_plugins/cmake.nims</span></tt>. Then every dependency that contains a <tt class="docutils literal"><span class="pre">CMakeLists.txt</span></tt> file will be build with <tt class="docutils literal"><span class="pre">cmake</span></tt>.</p>
<p><strong>Note</strong>: To disable any kind of action that might run arbitrary code, use the <tt class="docutils literal"><span class="pre">--noexec</span></tt> switch. </p>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:07:12 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

29
atlas.idx Normal file
View File

@@ -0,0 +1,29 @@
markupTitle atlas.md atlas.html atlas.md 0
heading Atlas Package Cloner atlas.html#atlas-package-cloner Atlas Package Cloner 0
heading Concepts atlas.html#concepts Concepts 0
heading Projects atlas.html#projects Projects 0
heading Dependencies atlas.html#dependencies Dependencies 0
heading No magic atlas.html#no-magic No magic 0
heading How it works atlas.html#how-it-works How it works 0
heading Commands atlas.html#commands Commands 0
heading Use <url> / <package name> atlas.html#use-lturlgt-slash-ltpackage-namegt Use &lt;url&gt; / &lt;package name&gt; 0
heading Link <path> atlas.html#link-ltpathgt Link &lt;path&gt; 0
heading Clone/Update <url>/<package name> atlas.html#cloneslashupdate-lturlgtslashltpackage-namegt Clone/Update &lt;url&gt;/&lt;package name&gt; 0
heading When Statements atlas.html#when-statements When Statements 0
heading Feature Statements atlas.html#feature-statements Feature Statements 0
heading Search <term term2 term3 ...> atlas.html#search-ltterm-term2-term3-dotdotdotgt Search &lt;term term2 term3 ...&gt; 0
heading Install <proj.nimble> atlas.html#install-ltprojdotnimblegt Install &lt;proj.nimble&gt; 0
heading UpdateProjects / updateDeps filterfilter atlas.html#updateprojects-slash-updatedeps-filterfilter UpdateProjects / updateDeps <a class="reference internal" href="#filter">filter</a> 0
heading Others atlas.html#others Others 0
heading Package Overrides atlas.html#package-overrides Package Overrides 0
heading Overrides atlas.html#overrides Overrides 0
heading Virtual Nim environments atlas.html#virtual-nim-environments Virtual Nim environments 0
heading Dependency resolution atlas.html#dependency-resolution Dependency resolution 0
heading MaxVer atlas.html#maxver MaxVer 0
heading SemVer atlas.html#semver SemVer 0
heading MinVer atlas.html#minver MinVer 0
heading Reproducible builds / lockfiles atlas.html#reproducible-builds-slash-lockfiles Reproducible builds / lockfiles 0
heading pin atlas.lockatlas.lock atlas.html#pin-atlasdotlockatlasdotlock pin <a class="reference internal" href="#atlas.lock">atlas.lock</a> 0
heading rep atlas.lockatlas.lock atlas.html#rep-atlasdotlockatlasdotlock rep <a class="reference internal" href="#atlas.lock">atlas.lock</a> 0
heading Plugins atlas.html#plugins Plugins 0
heading Builders atlas.html#builders Builders 0

611
atomics.html Normal file
View File

@@ -0,0 +1,611 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/atomics</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/atomics</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#Atomic" title="Atomic[T] {.importcpp: &quot;std::atomic&quot;, completeStruct.} = object">Atomic</a></li>
<li><a class="reference" href="#AtomicFlag" title="AtomicFlag {.importcpp: &quot;std::atomic_flag&quot;, size: 1.} = object">AtomicFlag</a></li>
<li><a class="reference" href="#MemoryOrder" title="MemoryOrder {.importcpp: &quot;std::memory_order&quot;.} = enum
moRelaxed, ## No ordering constraints. Only the atomicity and ordering against
## other atomic operations is guaranteed.
moConsume, ## This ordering is currently discouraged as it's semantics are
## being revised. Acquire operations should be preferred.
moAcquire, ## When applied to a load operation, no reads or writes in the
## current thread can be reordered before this operation.
moRelease, ## When applied to a store operation, no reads or writes in the
## current thread can be reorderd after this operation.
moAcquireRelease, ## When applied to a read-modify-write operation, this behaves like
## both an acquire and a release operation.
moSequentiallyConsistent ## Behaves like Acquire when applied to load, like Release when
## applied to a store and like AcquireRelease when applied to a
## read-modify-write operation.
## Also guarantees that all threads observe the same total ordering
## with other moSequentiallyConsistent operations.">MemoryOrder</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">+=
<li><a class="reference" href="#%2B%3D%2CAtomic%5BT%3A%20SomeInteger%5D%2CT" title="`+=`[T: SomeInteger](location: var Atomic[T]; value: T)">`+=`[T: SomeInteger](location: var Atomic[T]; value: T)</a></li>
</ul>
<ul class="simple nested-toc-section">-=
<li><a class="reference" href="#-%3D%2CAtomic%5BT%3A%20SomeInteger%5D%2CT" title="`-=`[T: SomeInteger](location: var Atomic[T]; value: T)">`-=`[T: SomeInteger](location: var Atomic[T]; value: T)</a></li>
</ul>
<ul class="simple nested-toc-section">atomicDec
<li><a class="reference" href="#atomicDec%2CAtomic%5BT%3A%20SomeInteger%5D%2CT" title="atomicDec[T: SomeInteger](location: var Atomic[T]; value: T = 1)">atomicDec[T: SomeInteger](location: var Atomic[T]; value: T = 1)</a></li>
</ul>
<ul class="simple nested-toc-section">atomicInc
<li><a class="reference" href="#atomicInc%2CAtomic%5BT%3A%20SomeInteger%5D%2CT" title="atomicInc[T: SomeInteger](location: var Atomic[T]; value: T = 1)">atomicInc[T: SomeInteger](location: var Atomic[T]; value: T = 1)</a></li>
</ul>
<ul class="simple nested-toc-section">clear
<li><a class="reference" href="#clear%2CAtomicFlag%2CMemoryOrder" title="clear(location: var AtomicFlag; order: MemoryOrder = moSequentiallyConsistent)">clear(location: var AtomicFlag; order: MemoryOrder = moSequentiallyConsistent)</a></li>
</ul>
<ul class="simple nested-toc-section">compareExchange
<li><a class="reference" href="#compareExchange%2CAtomic%5BT%5D%2CT%2CT%2CMemoryOrder" title="compareExchange[T](location: var Atomic[T]; expected: var T; desired: T;
order: MemoryOrder = moSequentiallyConsistent): bool">compareExchange[T](location: var Atomic[T]; expected: var T; desired: T;
order: MemoryOrder = moSequentiallyConsistent): bool</a></li>
<li><a class="reference" href="#compareExchange%2CAtomic%5BT%5D%2CT%2CT%2CMemoryOrder%2CMemoryOrder" title="compareExchange[T](location: var Atomic[T]; expected: var T; desired: T;
success, failure: MemoryOrder): bool">compareExchange[T](location: var Atomic[T]; expected: var T; desired: T;
success, failure: MemoryOrder): bool</a></li>
</ul>
<ul class="simple nested-toc-section">compareExchangeWeak
<li><a class="reference" href="#compareExchangeWeak%2CAtomic%5BT%5D%2CT%2CT%2CMemoryOrder" title="compareExchangeWeak[T](location: var Atomic[T]; expected: var T; desired: T;
order: MemoryOrder = moSequentiallyConsistent): bool">compareExchangeWeak[T](location: var Atomic[T]; expected: var T; desired: T;
order: MemoryOrder = moSequentiallyConsistent): bool</a></li>
<li><a class="reference" href="#compareExchangeWeak%2CAtomic%5BT%5D%2CT%2CT%2CMemoryOrder%2CMemoryOrder" title="compareExchangeWeak[T](location: var Atomic[T]; expected: var T; desired: T;
success, failure: MemoryOrder): bool">compareExchangeWeak[T](location: var Atomic[T]; expected: var T; desired: T;
success, failure: MemoryOrder): bool</a></li>
</ul>
<ul class="simple nested-toc-section">exchange
<li><a class="reference" href="#exchange%2CAtomic%5BT%5D%2CT%2CMemoryOrder" title="exchange[T](location: var Atomic[T]; desired: T;
order: MemoryOrder = moSequentiallyConsistent): T">exchange[T](location: var Atomic[T]; desired: T;
order: MemoryOrder = moSequentiallyConsistent): T</a></li>
</ul>
<ul class="simple nested-toc-section">fence
<li><a class="reference" href="#fence%2CMemoryOrder" title="fence(order: MemoryOrder)">fence(order: MemoryOrder)</a></li>
</ul>
<ul class="simple nested-toc-section">fetchAdd
<li><a class="reference" href="#fetchAdd%2CAtomic%5BT%3A%20SomeInteger%5D%2CT%2CMemoryOrder" title="fetchAdd[T: SomeInteger](location: var Atomic[T]; value: T;
order: MemoryOrder = moSequentiallyConsistent): T">fetchAdd[T: SomeInteger](location: var Atomic[T]; value: T;
order: MemoryOrder = moSequentiallyConsistent): T</a></li>
</ul>
<ul class="simple nested-toc-section">fetchAnd
<li><a class="reference" href="#fetchAnd%2CAtomic%5BT%3A%20SomeInteger%5D%2CT%2CMemoryOrder" title="fetchAnd[T: SomeInteger](location: var Atomic[T]; value: T;
order: MemoryOrder = moSequentiallyConsistent): T">fetchAnd[T: SomeInteger](location: var Atomic[T]; value: T;
order: MemoryOrder = moSequentiallyConsistent): T</a></li>
</ul>
<ul class="simple nested-toc-section">fetchOr
<li><a class="reference" href="#fetchOr%2CAtomic%5BT%3A%20SomeInteger%5D%2CT%2CMemoryOrder" title="fetchOr[T: SomeInteger](location: var Atomic[T]; value: T;
order: MemoryOrder = moSequentiallyConsistent): T">fetchOr[T: SomeInteger](location: var Atomic[T]; value: T;
order: MemoryOrder = moSequentiallyConsistent): T</a></li>
</ul>
<ul class="simple nested-toc-section">fetchSub
<li><a class="reference" href="#fetchSub%2CAtomic%5BT%3A%20SomeInteger%5D%2CT%2CMemoryOrder" title="fetchSub[T: SomeInteger](location: var Atomic[T]; value: T;
order: MemoryOrder = moSequentiallyConsistent): T">fetchSub[T: SomeInteger](location: var Atomic[T]; value: T;
order: MemoryOrder = moSequentiallyConsistent): T</a></li>
</ul>
<ul class="simple nested-toc-section">fetchXor
<li><a class="reference" href="#fetchXor%2CAtomic%5BT%3A%20SomeInteger%5D%2CT%2CMemoryOrder" title="fetchXor[T: SomeInteger](location: var Atomic[T]; value: T;
order: MemoryOrder = moSequentiallyConsistent): T">fetchXor[T: SomeInteger](location: var Atomic[T]; value: T;
order: MemoryOrder = moSequentiallyConsistent): T</a></li>
</ul>
<ul class="simple nested-toc-section">load
<li><a class="reference" href="#load%2CAtomic%5BT%5D%2CMemoryOrder" title="load[T](location: var Atomic[T]; order: MemoryOrder = moSequentiallyConsistent): T">load[T](location: var Atomic[T]; order: MemoryOrder = moSequentiallyConsistent): T</a></li>
</ul>
<ul class="simple nested-toc-section">signalFence
<li><a class="reference" href="#signalFence%2CMemoryOrder" title="signalFence(order: MemoryOrder)">signalFence(order: MemoryOrder)</a></li>
</ul>
<ul class="simple nested-toc-section">store
<li><a class="reference" href="#store%2CAtomic%5BT%5D%2CT%2CMemoryOrder" title="store[T](location: var Atomic[T]; desired: T;
order: MemoryOrder = moSequentiallyConsistent)">store[T](location: var Atomic[T]; desired: T;
order: MemoryOrder = moSequentiallyConsistent)</a></li>
</ul>
<ul class="simple nested-toc-section">testAndSet
<li><a class="reference" href="#testAndSet%2CAtomicFlag%2CMemoryOrder" title="testAndSet(location: var AtomicFlag;
order: MemoryOrder = moSequentiallyConsistent): bool">testAndSet(location: var AtomicFlag;
order: MemoryOrder = moSequentiallyConsistent): bool</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"><p>Types and operations for atomic operations and lockless algorithms.</p>
<p>Unstable API.</p>
<p>By default, C++ uses C11 atomic primitives. To use C++ <tt class="docutils literal"><span class="pre"><span class="Identifier">std</span><span class="Punctuation">:</span><span class="Punctuation">:</span><span class="Identifier">atomic</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Operator">-</span><span class="Identifier">d</span><span class="Punctuation">:</span><span class="Identifier">nimUseCppAtomics</span></span></tt> can be defined.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">atomics</span>
<span class="Comment"># Atomic</span>
<span class="Keyword">var</span> <span class="Identifier">loc</span><span class="Punctuation">:</span> <span class="Identifier">Atomic</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span>
<span class="Identifier">loc</span><span class="Operator">.</span><span class="Identifier">store</span><span class="Punctuation">(</span><span class="DecNumber">4</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">loc</span><span class="Operator">.</span><span class="Identifier">load</span> <span class="Operator">==</span> <span class="DecNumber">4</span>
<span class="Identifier">loc</span><span class="Operator">.</span><span class="Identifier">store</span><span class="Punctuation">(</span><span class="DecNumber">2</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">loc</span><span class="Operator">.</span><span class="Identifier">load</span><span class="Punctuation">(</span><span class="Identifier">moRelaxed</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">2</span>
<span class="Identifier">loc</span><span class="Operator">.</span><span class="Identifier">store</span><span class="Punctuation">(</span><span class="DecNumber">9</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">loc</span><span class="Operator">.</span><span class="Identifier">load</span><span class="Punctuation">(</span><span class="Identifier">moAcquire</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">9</span>
<span class="Identifier">loc</span><span class="Operator">.</span><span class="Identifier">store</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="Identifier">moRelease</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">loc</span><span class="Operator">.</span><span class="Identifier">load</span> <span class="Operator">==</span> <span class="DecNumber">0</span>
<span class="Identifier">assert</span> <span class="Identifier">loc</span><span class="Operator">.</span><span class="Identifier">exchange</span><span class="Punctuation">(</span><span class="DecNumber">7</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">0</span>
<span class="Identifier">assert</span> <span class="Identifier">loc</span><span class="Operator">.</span><span class="Identifier">load</span> <span class="Operator">==</span> <span class="DecNumber">7</span>
<span class="Keyword">var</span> <span class="Identifier">expected</span> <span class="Operator">=</span> <span class="DecNumber">7</span>
<span class="Identifier">assert</span> <span class="Identifier">loc</span><span class="Operator">.</span><span class="Identifier">compareExchange</span><span class="Punctuation">(</span><span class="Identifier">expected</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="Identifier">moRelaxed</span><span class="Punctuation">,</span> <span class="Identifier">moRelaxed</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">expected</span> <span class="Operator">==</span> <span class="DecNumber">7</span>
<span class="Identifier">assert</span> <span class="Identifier">loc</span><span class="Operator">.</span><span class="Identifier">load</span> <span class="Operator">==</span> <span class="DecNumber">5</span>
<span class="Identifier">assert</span> <span class="Keyword">not</span> <span class="Identifier">loc</span><span class="Operator">.</span><span class="Identifier">compareExchange</span><span class="Punctuation">(</span><span class="Identifier">expected</span><span class="Punctuation">,</span> <span class="DecNumber">12</span><span class="Punctuation">,</span> <span class="Identifier">moRelaxed</span><span class="Punctuation">,</span> <span class="Identifier">moRelaxed</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">expected</span> <span class="Operator">==</span> <span class="DecNumber">5</span>
<span class="Identifier">assert</span> <span class="Identifier">loc</span><span class="Operator">.</span><span class="Identifier">load</span> <span class="Operator">==</span> <span class="DecNumber">5</span>
<span class="Identifier">assert</span> <span class="Identifier">loc</span><span class="Operator">.</span><span class="Identifier">fetchAdd</span><span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">5</span>
<span class="Identifier">assert</span> <span class="Identifier">loc</span><span class="Operator">.</span><span class="Identifier">fetchAdd</span><span class="Punctuation">(</span><span class="DecNumber">2</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">6</span>
<span class="Identifier">assert</span> <span class="Identifier">loc</span><span class="Operator">.</span><span class="Identifier">fetchSub</span><span class="Punctuation">(</span><span class="DecNumber">3</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">8</span>
<span class="Identifier">loc</span><span class="Operator">.</span><span class="Identifier">atomicInc</span><span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">loc</span><span class="Operator">.</span><span class="Identifier">load</span> <span class="Operator">==</span> <span class="DecNumber">6</span>
<span class="Comment"># AtomicFlag</span>
<span class="Keyword">var</span> <span class="Identifier">flag</span><span class="Punctuation">:</span> <span class="Identifier">AtomicFlag</span>
<span class="Identifier">assert</span> <span class="Keyword">not</span> <span class="Identifier">flag</span><span class="Operator">.</span><span class="Identifier">testAndSet</span>
<span class="Identifier">assert</span> <span class="Identifier">flag</span><span class="Operator">.</span><span class="Identifier">testAndSet</span>
<span class="Identifier">flag</span><span class="Operator">.</span><span class="Identifier">clear</span><span class="Punctuation">(</span><span class="Identifier">moRelaxed</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Keyword">not</span> <span class="Identifier">flag</span><span class="Operator">.</span><span class="Identifier">testAndSet</span></pre></p>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="Atomic">
<dt><pre><a href="atomics.html#Atomic"><span class="Identifier">Atomic</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> {.<span class="Identifier">importcpp</span><span class="Other">:</span> <span class="StringLit">&quot;std::atomic&quot;</span><span class="Other">,</span> <span class="Identifier">completeStruct</span>.} <span class="Other">=</span> <span class="Keyword">object</span></pre></dt>
<dd>
An atomic object with underlying type <tt class="docutils literal"><span class="pre"><span class="Identifier">T</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L94" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L94" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="AtomicFlag">
<dt><pre><a href="atomics.html#AtomicFlag"><span class="Identifier">AtomicFlag</span></a> {.<span class="Identifier">importcpp</span><span class="Other">:</span> <span class="StringLit">&quot;std::atomic_flag&quot;</span><span class="Other">,</span> <span class="Identifier">size</span><span class="Other">:</span> <span class="DecNumber">1</span>.} <span class="Other">=</span> <span class="Keyword">object</span></pre></dt>
<dd>
An atomic boolean state.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L98" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L98" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="MemoryOrder">
<dt><pre><a href="atomics.html#MemoryOrder"><span class="Identifier">MemoryOrder</span></a> {.<span class="Identifier">importcpp</span><span class="Other">:</span> <span class="StringLit">&quot;std::memory_order&quot;</span>.} <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">moRelaxed</span><span class="Other">,</span> <span class="Comment">## No ordering constraints. Only the atomicity and ordering against</span>
<span class="Comment">## other atomic operations is guaranteed.</span>
<span class="Identifier">moConsume</span><span class="Other">,</span> <span class="Comment">## This ordering is currently discouraged as it's semantics are</span>
<span class="Comment">## being revised. Acquire operations should be preferred.</span>
<span class="Identifier">moAcquire</span><span class="Other">,</span> <span class="Comment">## When applied to a load operation, no reads or writes in the</span>
<span class="Comment">## current thread can be reordered before this operation.</span>
<span class="Identifier">moRelease</span><span class="Other">,</span> <span class="Comment">## When applied to a store operation, no reads or writes in the</span>
<span class="Comment">## current thread can be reorderd after this operation.</span>
<span class="Identifier">moAcquireRelease</span><span class="Other">,</span> <span class="Comment">## When applied to a read-modify-write operation, this behaves like</span>
<span class="Comment">## both an acquire and a release operation.</span>
<span class="Identifier">moSequentiallyConsistent</span> <span class="Comment">## Behaves like Acquire when applied to load, like Release when</span>
<span class="Comment">## applied to a store and like AcquireRelease when applied to a</span>
<span class="Comment">## read-modify-write operation.</span>
<span class="Comment">## Also guarantees that all threads observe the same total ordering</span>
<span class="Comment">## with other moSequentiallyConsistent operations.</span></pre></dt>
<dd>
Specifies how non-atomic operations can be reordered around atomic operations.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L62" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L62" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="+=-procs-all">
<div id="+=,Atomic[T: SomeInteger],T">
<dt><pre><span class="Keyword">proc</span> <a href="#%2B%3D%2CAtomic%5BT%3A%20SomeInteger%5D%2CT"><span class="Identifier">`+=`</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">location</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="atomics.html#Atomic"><span class="Identifier">Atomic</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
Atomically increments the atomic integer by some <tt class="docutils literal"><span class="pre"><span class="Identifier">value</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L427" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L427" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="-=-procs-all">
<div id="-=,Atomic[T: SomeInteger],T">
<dt><pre><span class="Keyword">proc</span> <a href="#-%3D%2CAtomic%5BT%3A%20SomeInteger%5D%2CT"><span class="Identifier">`-=`</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">location</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="atomics.html#Atomic"><span class="Identifier">Atomic</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
Atomically decrements the atomic integer by some <tt class="docutils literal"><span class="pre"><span class="Identifier">value</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L431" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L431" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="atomicDec-procs-all">
<div id="atomicDec,Atomic[T: SomeInteger],T">
<dt><pre><span class="Keyword">proc</span> <a href="#atomicDec%2CAtomic%5BT%3A%20SomeInteger%5D%2CT"><span class="Identifier">atomicDec</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">location</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="atomics.html#Atomic"><span class="Identifier">Atomic</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">T</span> <span class="Other">=</span> <span class="DecNumber">1</span><span class="Other">)</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
Atomically decrements the atomic integer by some <tt class="docutils literal"><span class="pre"><span class="Identifier">value</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L423" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L423" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="atomicInc-procs-all">
<div id="atomicInc,Atomic[T: SomeInteger],T">
<dt><pre><span class="Keyword">proc</span> <a href="#atomicInc%2CAtomic%5BT%3A%20SomeInteger%5D%2CT"><span class="Identifier">atomicInc</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">location</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="atomics.html#Atomic"><span class="Identifier">Atomic</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">T</span> <span class="Other">=</span> <span class="DecNumber">1</span><span class="Other">)</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
Atomically increments the atomic integer by some <tt class="docutils literal"><span class="pre"><span class="Identifier">value</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L419" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L419" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="clear-procs-all">
<div id="clear,AtomicFlag,MemoryOrder">
<dt><pre><span class="Keyword">proc</span> <a href="#clear%2CAtomicFlag%2CMemoryOrder"><span class="Identifier">clear</span></a><span class="Other">(</span><span class="Identifier">location</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="atomics.html#AtomicFlag"><span class="Identifier">AtomicFlag</span></a><span class="Other">;</span>
<span class="Identifier">order</span><span class="Other">:</span> <a href="atomics.html#MemoryOrder"><span class="Identifier">MemoryOrder</span></a> <span class="Other">=</span> <span class="Identifier">moSequentiallyConsistent</span><span class="Other">)</span> {.
<span class="Identifier">importcpp</span><span class="Other">:</span> <span class="StringLit">&quot;#.clear(@)&quot;</span><span class="Other">,</span> <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;atomic&gt;&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Atomically sets the value of the atomic flag to false.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L157" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L157" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="compareExchange-procs-all">
<div id="compareExchange,Atomic[T],T,T,MemoryOrder">
<dt><pre><span class="Keyword">proc</span> <a href="#compareExchange%2CAtomic%5BT%5D%2CT%2CT%2CMemoryOrder"><span class="Identifier">compareExchange</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">location</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="atomics.html#Atomic"><span class="Identifier">Atomic</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">expected</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">desired</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span>
<span class="Identifier">order</span><span class="Other">:</span> <a href="atomics.html#MemoryOrder"><span class="Identifier">MemoryOrder</span></a> <span class="Other">=</span> <span class="Identifier">moSequentiallyConsistent</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.
<span class="Identifier">importcpp</span><span class="Other">:</span> <span class="StringLit">&quot;#.compare_exchange_strong(@)&quot;</span><span class="Other">,</span> <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;atomic&gt;&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Atomically compares the value of the atomic object with the <tt class="docutils literal"><span class="pre"><span class="Identifier">expected</span></span></tt> value and performs exchange with the <tt class="docutils literal"><span class="pre"><span class="Identifier">desired</span></span></tt> one if equal or load if not. Returns true if the exchange was successful.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L114" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L114" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="compareExchange,Atomic[T],T,T,MemoryOrder,MemoryOrder">
<dt><pre><span class="Keyword">proc</span> <a href="#compareExchange%2CAtomic%5BT%5D%2CT%2CT%2CMemoryOrder%2CMemoryOrder"><span class="Identifier">compareExchange</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">location</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="atomics.html#Atomic"><span class="Identifier">Atomic</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">expected</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">desired</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span>
<span class="Identifier">success</span><span class="Other">,</span> <span class="Identifier">failure</span><span class="Other">:</span> <a href="atomics.html#MemoryOrder"><span class="Identifier">MemoryOrder</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.
<span class="Identifier">importcpp</span><span class="Other">:</span> <span class="StringLit">&quot;#.compare_exchange_strong(@)&quot;</span><span class="Other">,</span> <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;atomic&gt;&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Same as above, but allows for different memory orders for success and failure.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L119" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L119" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="compareExchangeWeak-procs-all">
<div id="compareExchangeWeak,Atomic[T],T,T,MemoryOrder">
<dt><pre><span class="Keyword">proc</span> <a href="#compareExchangeWeak%2CAtomic%5BT%5D%2CT%2CT%2CMemoryOrder"><span class="Identifier">compareExchangeWeak</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">location</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="atomics.html#Atomic"><span class="Identifier">Atomic</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">expected</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span>
<span class="Identifier">desired</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span>
<span class="Identifier">order</span><span class="Other">:</span> <a href="atomics.html#MemoryOrder"><span class="Identifier">MemoryOrder</span></a> <span class="Other">=</span> <span class="Identifier">moSequentiallyConsistent</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.
<span class="Identifier">importcpp</span><span class="Other">:</span> <span class="StringLit">&quot;#.compare_exchange_weak(@)&quot;</span><span class="Other">,</span> <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;atomic&gt;&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Same as above, but is allowed to fail spuriously.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L123" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L123" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="compareExchangeWeak,Atomic[T],T,T,MemoryOrder,MemoryOrder">
<dt><pre><span class="Keyword">proc</span> <a href="#compareExchangeWeak%2CAtomic%5BT%5D%2CT%2CT%2CMemoryOrder%2CMemoryOrder"><span class="Identifier">compareExchangeWeak</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">location</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="atomics.html#Atomic"><span class="Identifier">Atomic</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">expected</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span>
<span class="Identifier">desired</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">success</span><span class="Other">,</span> <span class="Identifier">failure</span><span class="Other">:</span> <a href="atomics.html#MemoryOrder"><span class="Identifier">MemoryOrder</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.
<span class="Identifier">importcpp</span><span class="Other">:</span> <span class="StringLit">&quot;#.compare_exchange_weak(@)&quot;</span><span class="Other">,</span> <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;atomic&gt;&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Same as above, but allows for different memory orders for success and failure.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L126" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L126" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="exchange-procs-all">
<div id="exchange,Atomic[T],T,MemoryOrder">
<dt><pre><span class="Keyword">proc</span> <a href="#exchange%2CAtomic%5BT%5D%2CT%2CMemoryOrder"><span class="Identifier">exchange</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">location</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="atomics.html#Atomic"><span class="Identifier">Atomic</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">desired</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span>
<span class="Identifier">order</span><span class="Other">:</span> <a href="atomics.html#MemoryOrder"><span class="Identifier">MemoryOrder</span></a> <span class="Other">=</span> <span class="Identifier">moSequentiallyConsistent</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.
<span class="Identifier">importcpp</span><span class="Other">:</span> <span class="StringLit">&quot;#.exchange(@)&quot;</span><span class="Other">,</span> <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;atomic&gt;&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Atomically replaces the value of the atomic object with the <tt class="docutils literal"><span class="pre"><span class="Identifier">desired</span></span></tt> value and returns the old value.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L110" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L110" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="fence-procs-all">
<div id="fence,MemoryOrder">
<dt><pre><span class="Keyword">proc</span> <a href="#fence%2CMemoryOrder"><span class="Identifier">fence</span></a><span class="Other">(</span><span class="Identifier">order</span><span class="Other">:</span> <a href="atomics.html#MemoryOrder"><span class="Identifier">MemoryOrder</span></a><span class="Other">)</span> {.<span class="Identifier">importcpp</span><span class="Other">:</span> <span class="StringLit">&quot;std::atomic_thread_fence(@)&quot;</span><span class="Other">,</span>
<span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;atomic&gt;&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Ensures memory ordering without using atomic operations.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L160" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L160" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="fetchAdd-procs-all">
<div id="fetchAdd,Atomic[T: SomeInteger],T,MemoryOrder">
<dt><pre><span class="Keyword">proc</span> <a href="#fetchAdd%2CAtomic%5BT%3A%20SomeInteger%5D%2CT%2CMemoryOrder"><span class="Identifier">fetchAdd</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">location</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="atomics.html#Atomic"><span class="Identifier">Atomic</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span>
<span class="Identifier">order</span><span class="Other">:</span> <a href="atomics.html#MemoryOrder"><span class="Identifier">MemoryOrder</span></a> <span class="Other">=</span> <span class="Identifier">moSequentiallyConsistent</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.
<span class="Identifier">importcpp</span><span class="Other">:</span> <span class="StringLit">&quot;#.fetch_add(@)&quot;</span><span class="Other">,</span> <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;atomic&gt;&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Atomically adds a <tt class="docutils literal"><span class="pre"><span class="Identifier">value</span></span></tt> to the atomic integer and returns the original value.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L132" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L132" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="fetchAnd-procs-all">
<div id="fetchAnd,Atomic[T: SomeInteger],T,MemoryOrder">
<dt><pre><span class="Keyword">proc</span> <a href="#fetchAnd%2CAtomic%5BT%3A%20SomeInteger%5D%2CT%2CMemoryOrder"><span class="Identifier">fetchAnd</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">location</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="atomics.html#Atomic"><span class="Identifier">Atomic</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span>
<span class="Identifier">order</span><span class="Other">:</span> <a href="atomics.html#MemoryOrder"><span class="Identifier">MemoryOrder</span></a> <span class="Other">=</span> <span class="Identifier">moSequentiallyConsistent</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.
<span class="Identifier">importcpp</span><span class="Other">:</span> <span class="StringLit">&quot;#.fetch_and(@)&quot;</span><span class="Other">,</span> <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;atomic&gt;&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Atomically replaces the atomic integer with it's bitwise AND with the specified <tt class="docutils literal"><span class="pre"><span class="Identifier">value</span></span></tt> and returns the original value.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L140" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L140" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="fetchOr-procs-all">
<div id="fetchOr,Atomic[T: SomeInteger],T,MemoryOrder">
<dt><pre><span class="Keyword">proc</span> <a href="#fetchOr%2CAtomic%5BT%3A%20SomeInteger%5D%2CT%2CMemoryOrder"><span class="Identifier">fetchOr</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">location</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="atomics.html#Atomic"><span class="Identifier">Atomic</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span>
<span class="Identifier">order</span><span class="Other">:</span> <a href="atomics.html#MemoryOrder"><span class="Identifier">MemoryOrder</span></a> <span class="Other">=</span> <span class="Identifier">moSequentiallyConsistent</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.
<span class="Identifier">importcpp</span><span class="Other">:</span> <span class="StringLit">&quot;#.fetch_or(@)&quot;</span><span class="Other">,</span> <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;atomic&gt;&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Atomically replaces the atomic integer with it's bitwise OR with the specified <tt class="docutils literal"><span class="pre"><span class="Identifier">value</span></span></tt> and returns the original value.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L144" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L144" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="fetchSub-procs-all">
<div id="fetchSub,Atomic[T: SomeInteger],T,MemoryOrder">
<dt><pre><span class="Keyword">proc</span> <a href="#fetchSub%2CAtomic%5BT%3A%20SomeInteger%5D%2CT%2CMemoryOrder"><span class="Identifier">fetchSub</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">location</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="atomics.html#Atomic"><span class="Identifier">Atomic</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span>
<span class="Identifier">order</span><span class="Other">:</span> <a href="atomics.html#MemoryOrder"><span class="Identifier">MemoryOrder</span></a> <span class="Other">=</span> <span class="Identifier">moSequentiallyConsistent</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.
<span class="Identifier">importcpp</span><span class="Other">:</span> <span class="StringLit">&quot;#.fetch_sub(@)&quot;</span><span class="Other">,</span> <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;atomic&gt;&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Atomically subtracts a <tt class="docutils literal"><span class="pre"><span class="Identifier">value</span></span></tt> to the atomic integer and returns the original value.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L136" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L136" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="fetchXor-procs-all">
<div id="fetchXor,Atomic[T: SomeInteger],T,MemoryOrder">
<dt><pre><span class="Keyword">proc</span> <a href="#fetchXor%2CAtomic%5BT%3A%20SomeInteger%5D%2CT%2CMemoryOrder"><span class="Identifier">fetchXor</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">location</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="atomics.html#Atomic"><span class="Identifier">Atomic</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span>
<span class="Identifier">order</span><span class="Other">:</span> <a href="atomics.html#MemoryOrder"><span class="Identifier">MemoryOrder</span></a> <span class="Other">=</span> <span class="Identifier">moSequentiallyConsistent</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.
<span class="Identifier">importcpp</span><span class="Other">:</span> <span class="StringLit">&quot;#.fetch_xor(@)&quot;</span><span class="Other">,</span> <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;atomic&gt;&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Atomically replaces the atomic integer with it's bitwise XOR with the specified <tt class="docutils literal"><span class="pre"><span class="Identifier">value</span></span></tt> and returns the original value.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L148" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L148" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="load-procs-all">
<div id="load,Atomic[T],MemoryOrder">
<dt><pre><span class="Keyword">proc</span> <a href="#load%2CAtomic%5BT%5D%2CMemoryOrder"><span class="Identifier">load</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">location</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="atomics.html#Atomic"><span class="Identifier">Atomic</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">order</span><span class="Other">:</span> <a href="atomics.html#MemoryOrder"><span class="Identifier">MemoryOrder</span></a> <span class="Other">=</span> <span class="Identifier">moSequentiallyConsistent</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.
<span class="Identifier">importcpp</span><span class="Other">:</span> <span class="StringLit">&quot;#.load(@)&quot;</span><span class="Other">,</span> <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;atomic&gt;&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Atomically obtains the value of the atomic object.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L103" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L103" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="signalFence-procs-all">
<div id="signalFence,MemoryOrder">
<dt><pre><span class="Keyword">proc</span> <a href="#signalFence%2CMemoryOrder"><span class="Identifier">signalFence</span></a><span class="Other">(</span><span class="Identifier">order</span><span class="Other">:</span> <a href="atomics.html#MemoryOrder"><span class="Identifier">MemoryOrder</span></a><span class="Other">)</span> {.<span class="Identifier">importcpp</span><span class="Other">:</span> <span class="StringLit">&quot;std::atomic_signal_fence(@)&quot;</span><span class="Other">,</span>
<span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;atomic&gt;&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Prevents reordering of accesses by the compiler as would fence, but inserts no CPU instructions for memory ordering.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L163" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L163" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="store-procs-all">
<div id="store,Atomic[T],T,MemoryOrder">
<dt><pre><span class="Keyword">proc</span> <a href="#store%2CAtomic%5BT%5D%2CT%2CMemoryOrder"><span class="Identifier">store</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">location</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="atomics.html#Atomic"><span class="Identifier">Atomic</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">desired</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span>
<span class="Identifier">order</span><span class="Other">:</span> <a href="atomics.html#MemoryOrder"><span class="Identifier">MemoryOrder</span></a> <span class="Other">=</span> <span class="Identifier">moSequentiallyConsistent</span><span class="Other">)</span> {.
<span class="Identifier">importcpp</span><span class="Other">:</span> <span class="StringLit">&quot;#.store(@)&quot;</span><span class="Other">,</span> <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;atomic&gt;&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Atomically replaces the value of the atomic object with the <tt class="docutils literal"><span class="pre"><span class="Identifier">desired</span></span></tt> value.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L106" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L106" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="testAndSet-procs-all">
<div id="testAndSet,AtomicFlag,MemoryOrder">
<dt><pre><span class="Keyword">proc</span> <a href="#testAndSet%2CAtomicFlag%2CMemoryOrder"><span class="Identifier">testAndSet</span></a><span class="Other">(</span><span class="Identifier">location</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="atomics.html#AtomicFlag"><span class="Identifier">AtomicFlag</span></a><span class="Other">;</span>
<span class="Identifier">order</span><span class="Other">:</span> <a href="atomics.html#MemoryOrder"><span class="Identifier">MemoryOrder</span></a> <span class="Other">=</span> <span class="Identifier">moSequentiallyConsistent</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.
<span class="Identifier">importcpp</span><span class="Other">:</span> <span class="StringLit">&quot;#.test_and_set(@)&quot;</span><span class="Other">,</span> <span class="Identifier">header</span><span class="Other">:</span> <span class="StringLit">&quot;&lt;atomic&gt;&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Atomically sets the atomic flag to true and returns the original value.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/concurrency/atomics.nim#L154" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/concurrency/atomics.nim#L154" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:07:48 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

26
atomics.idx Normal file
View File

@@ -0,0 +1,26 @@
nimTitle atomics atomics.html module std/atomics 0
nim MemoryOrder atomics.html#MemoryOrder enum MemoryOrder 62
nim Atomic atomics.html#Atomic object Atomic 94
nim AtomicFlag atomics.html#AtomicFlag object AtomicFlag 98
nim load atomics.html#load,Atomic[T],MemoryOrder proc load[T](location: var Atomic[T]; order: MemoryOrder = moSequentiallyConsistent): T 103
nim store atomics.html#store,Atomic[T],T,MemoryOrder proc store[T](location: var Atomic[T]; desired: T;\n order: MemoryOrder = moSequentiallyConsistent) 106
nim exchange atomics.html#exchange,Atomic[T],T,MemoryOrder proc exchange[T](location: var Atomic[T]; desired: T;\n order: MemoryOrder = moSequentiallyConsistent): T 110
nim compareExchange atomics.html#compareExchange,Atomic[T],T,T,MemoryOrder proc compareExchange[T](location: var Atomic[T]; expected: var T; desired: T;\n order: MemoryOrder = moSequentiallyConsistent): bool 114
nim compareExchange atomics.html#compareExchange,Atomic[T],T,T,MemoryOrder,MemoryOrder proc compareExchange[T](location: var Atomic[T]; expected: var T; desired: T;\n success, failure: MemoryOrder): bool 119
nim compareExchangeWeak atomics.html#compareExchangeWeak,Atomic[T],T,T,MemoryOrder proc compareExchangeWeak[T](location: var Atomic[T]; expected: var T; desired: T;\n order: MemoryOrder = moSequentiallyConsistent): bool 123
nim compareExchangeWeak atomics.html#compareExchangeWeak,Atomic[T],T,T,MemoryOrder,MemoryOrder proc compareExchangeWeak[T](location: var Atomic[T]; expected: var T; desired: T;\n success, failure: MemoryOrder): bool 126
nim fetchAdd atomics.html#fetchAdd,Atomic[T: SomeInteger],T,MemoryOrder proc fetchAdd[T: SomeInteger](location: var Atomic[T]; value: T;\n order: MemoryOrder = moSequentiallyConsistent): T 132
nim fetchSub atomics.html#fetchSub,Atomic[T: SomeInteger],T,MemoryOrder proc fetchSub[T: SomeInteger](location: var Atomic[T]; value: T;\n order: MemoryOrder = moSequentiallyConsistent): T 136
nim fetchAnd atomics.html#fetchAnd,Atomic[T: SomeInteger],T,MemoryOrder proc fetchAnd[T: SomeInteger](location: var Atomic[T]; value: T;\n order: MemoryOrder = moSequentiallyConsistent): T 140
nim fetchOr atomics.html#fetchOr,Atomic[T: SomeInteger],T,MemoryOrder proc fetchOr[T: SomeInteger](location: var Atomic[T]; value: T;\n order: MemoryOrder = moSequentiallyConsistent): T 144
nim fetchXor atomics.html#fetchXor,Atomic[T: SomeInteger],T,MemoryOrder proc fetchXor[T: SomeInteger](location: var Atomic[T]; value: T;\n order: MemoryOrder = moSequentiallyConsistent): T 148
nim testAndSet atomics.html#testAndSet,AtomicFlag,MemoryOrder proc testAndSet(location: var AtomicFlag;\n order: MemoryOrder = moSequentiallyConsistent): bool 154
nim clear atomics.html#clear,AtomicFlag,MemoryOrder proc clear(location: var AtomicFlag; order: MemoryOrder = moSequentiallyConsistent) 157
nim fence atomics.html#fence,MemoryOrder proc fence(order: MemoryOrder) 160
nim signalFence atomics.html#signalFence,MemoryOrder proc signalFence(order: MemoryOrder) 163
nim atomicInc atomics.html#atomicInc,Atomic[T: SomeInteger],T proc atomicInc[T: SomeInteger](location: var Atomic[T]; value: T = 1) 419
nim atomicDec atomics.html#atomicDec,Atomic[T: SomeInteger],T proc atomicDec[T: SomeInteger](location: var Atomic[T]; value: T = 1) 423
nim `+=` atomics.html#+=,Atomic[T: SomeInteger],T proc `+=`[T: SomeInteger](location: var Atomic[T]; value: T) 427
nim `-=` atomics.html#-=,Atomic[T: SomeInteger],T proc `-=`[T: SomeInteger](location: var Atomic[T]; value: T) 431
nimgrp compareexchange atomics.html#compareExchange-procs-all proc 114
nimgrp compareexchangeweak atomics.html#compareExchangeWeak-procs-all proc 123

237
backends.html Normal file
View File

@@ -0,0 +1,237 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Nim Backend Integration</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">Nim Backend Integration</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<div class="search-groupby">
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li><a class="reference" id="introduction_toc" href="#introduction">Introduction</a></li>
<li><a class="reference" id="backends_toc" href="#backends">Backends</a></li>
<ul class="simple"><li><a class="reference" id="backends-the-c-like-targets_toc" href="#backends-the-c-like-targets">The C like targets</a></li>
<li><a class="reference" id="backends-the-javascript-target_toc" href="#backends-the-javascript-target">The JavaScript target</a></li>
</ul><li><a class="reference" id="interfacing_toc" href="#interfacing">Interfacing</a></li>
<ul class="simple"><li><a class="reference" id="interfacing-nim-code-calling-the-backend_toc" href="#interfacing-nim-code-calling-the-backend">Nim code calling the backend</a></li>
<ul class="simple"><li><a class="reference" id="nim-code-calling-the-backend-c-invocation-example_toc" href="#nim-code-calling-the-backend-c-invocation-example">C invocation example</a></li>
<li><a class="reference" id="nim-code-calling-the-backend-javascript-invocation-example_toc" href="#nim-code-calling-the-backend-javascript-invocation-example">JavaScript invocation example</a></li>
</ul><li><a class="reference" id="interfacing-backend-code-calling-nim_toc" href="#interfacing-backend-code-calling-nim">Backend code calling Nim</a></li>
<ul class="simple"><li><a class="reference" id="backend-code-calling-nim-nim-invocation-example-from-c_toc" href="#backend-code-calling-nim-nim-invocation-example-from-c">Nim invocation example from C</a></li>
<li><a class="reference" id="backend-code-calling-nim-nim-invocation-example-from-javascript_toc" href="#backend-code-calling-nim-nim-invocation-example-from-javascript">Nim invocation example from JavaScript</a></li>
</ul><li><a class="reference" id="interfacing-nimcache-naming-logic_toc" href="#interfacing-nimcache-naming-logic">Nimcache naming logic</a></li>
</ul><li><a class="reference" id="memory-management_toc" href="#memory-management">Memory management</a></li>
<ul class="simple"><li><a class="reference" id="memory-management-strings-and-c-strings_toc" href="#memory-management-strings-and-c-strings">Strings and C strings</a></li>
<li><a class="reference" id="memory-management-custom-data-types_toc" href="#memory-management-custom-data-types">Custom data types</a></li>
</ul>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/doc/backends.md#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/doc/backends.md#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"><table class="docinfo" frame="void" rules="none"><col class="docinfo-name" /><col class="docinfo-content" /><tbody valign="top"><tr><th class="docinfo-name">Author:</th><td>Puppet Master</td></tr>
<tr><th class="docinfo-name">Version:</th><td>2.3.1</td></tr>
</tbody></table><blockquote class="markdown-quote"><p>&quot;Heresy grows from idleness.&quot; -- Unknown.</p></blockquote>
<h1><a class="toc-backref" id="introduction" href="#introduction">Introduction</a></h1><p>The <a class="reference external" href="nimc.html">Nim Compiler User Guide</a> documents the typical compiler invocation, using the <tt class="docutils literal"><span class="pre option">compile</span></tt> or <tt class="docutils literal"><span class="pre option">c</span></tt> command to transform a <tt class="docutils literal"><span class="pre">.nim</span></tt> file into one or more <tt class="docutils literal"><span class="pre">.c</span></tt> files which are then compiled with the platform's C compiler into a static binary. However, there are other commands to compile to C++, Objective-C, or JavaScript. This document tries to concentrate in a single place all the backend and interfacing options.</p>
<p>The Nim compiler supports mainly two backend families: the C, C++ and Objective-C targets and the JavaScript target. <a class="reference external" href=" #backends-the-c-like-targets">The C like targets</a> creates source files that can be compiled into a library or a final executable. <a class="reference external" href=" #backends-the-javascript-target">The JavaScript target</a> can generate a <tt class="docutils literal"><span class="pre">.js</span></tt> file which you reference from an HTML file or create a <a class="reference external" href=" https://nodejs.org">standalone Node.js program</a>.</p>
<p>On top of generating libraries or standalone applications, Nim offers bidirectional interfacing with the backend targets through generic and specific pragmas.</p>
<h1><a class="toc-backref" id="backends" href="#backends">Backends</a></h1>
<h2><a class="toc-backref" id="backends-the-c-like-targets" href="#backends-the-c-like-targets">The C like targets</a></h2><p>The commands to compile to either C, C++ or Objective-C are:</p>
<div class="option-list"><div class="option-list-item odd"><div class="option-list-label"><tt><span class="option">compileToC, cc</span></tt></div><div class="option-list-description">compile project with C code generator</div></div>
<div class="option-list-item"><div class="option-list-label"><tt><span class="option">compileToCpp, cpp</span></tt></div><div class="option-list-description">compile project to C++ code</div></div>
<div class="option-list-item odd"><div class="option-list-label"><tt><span class="option">compileToOC, objc</span></tt></div><div class="option-list-description">compile project to Objective C code</div></div>
</div><p>The most significant difference between these commands is that if you look into the <tt class="docutils literal"><span class="pre">nimcache</span></tt> directory you will find <tt class="docutils literal"><span class="pre">.c</span></tt>, <tt class="docutils literal"><span class="pre">.cpp</span></tt> or <tt class="docutils literal"><span class="pre">.m</span></tt> files, other than that all of them will produce a native binary for your project. This allows you to take the generated code and place it directly into a project using any of these languages. Here are some typical command- line invocations:</p>
<p><pre class="listing"><span class="program">nim</span> <span class="option">c</span> <span class="Identifier">hallo.nim</span>
<span class="program">nim</span> <span class="option">cpp</span> <span class="Identifier">hallo.nim</span>
<span class="program">nim</span> <span class="option">objc</span> <span class="Identifier">hallo.nim</span></pre></p>
<p>The compiler commands select the target backend, but if needed you can <a class="reference external" href=" nimc.html#crossminuscompilation">specify additional switches for cross-compilation</a> to select the target CPU, operative system or compiler/linker commands.</p>
<h2><a class="toc-backref" id="backends-the-javascript-target" href="#backends-the-javascript-target">The JavaScript target</a></h2><p>Nim can also generate <span id="javascript_1">JavaScript</span> code through the <tt class="docutils literal"><span class="pre option">js</span></tt> command.</p>
<p>Nim targets JavaScript 1.5 which is supported by any widely used browser. Since JavaScript does not have a portable means to include another module, Nim just generates a long <tt class="docutils literal"><span class="pre">.js</span></tt> file.</p>
<p>Features or modules that the JavaScript platform does not support are not available. This includes:</p>
<ul class="simple"><li>manual memory management (<tt class="docutils literal"><span class="pre"><span class="Identifier">alloc</span></span></tt>, etc.)</li>
<li>casting and other unsafe operations (<tt class="docutils literal"><span class="pre"><span class="Keyword">cast</span></span></tt> operator, <tt class="docutils literal"><span class="pre"><span class="Identifier">zeroMem</span></span></tt>, etc.)</li>
<li>file management</li>
<li>OS-specific operations</li>
<li>threading, coroutines</li>
<li>some modules of the standard library</li>
</ul>
<p>To compensate, the standard library has modules <a class="reference external" href=" lib.html#pure-libraries-modules-for-the-javascript-backend">catered to the JS backend</a> and more support will come in the future (for instance, Node.js bindings to get OS info).</p>
<p>To compile a Nim module into a <tt class="docutils literal"><span class="pre">.js</span></tt> file use the <tt class="docutils literal"><span class="pre option">js</span></tt> command; the default is a <tt class="docutils literal"><span class="pre">.js</span></tt> file that is supposed to be referenced in an <tt class="docutils literal"><span class="pre">.html</span></tt> file. However, you can also run the code with <span id="nodejs_1">nodejs</span> (<a class="reference external" href="https://nodejs.org">https://nodejs.org</a>):</p>
<p><pre class="listing"><span class="program">nim</span> <span class="option">js</span> <span class="option">-r</span> <span class="Identifier">examples/hallo.nim</span></pre></p>
<p>If you experience errors saying that <tt class="docutils literal"><span class="pre"><span class="Identifier">globalThis</span></span></tt> is not defined, be sure to run a recent version of Node.js (at least 12.0).</p>
<h1><a class="toc-backref" id="interfacing" href="#interfacing">Interfacing</a></h1><p>Nim offers bidirectional interfacing with the target backend. This means that you can call backend code from Nim and Nim code can be called by the backend code. Usually the direction of which calls which depends on your software architecture (is Nim your main program or is Nim providing a component?).</p>
<h2><a class="toc-backref" id="interfacing-nim-code-calling-the-backend" href="#interfacing-nim-code-calling-the-backend">Nim code calling the backend</a></h2><p>Nim code can interface with the backend through the <a class="reference external" href="manual.html#foreign-function-interface">Foreign function interface</a> mainly through the <a class="reference external" href="manual.html#foreign-function-interface-importc-pragma">importc pragma</a>. The <tt class="docutils literal"><span class="pre"><span class="Identifier">importc</span></span></tt> pragma is the <em>generic</em> way of making backend symbols available in Nim and is available in all the target backends (JavaScript too). The C++ or Objective-C backends have their respective <a class="reference external" href=" manual.html#implementation-specific-pragmas-importcpp-pragma">ImportCpp</a> and <a class="reference external" href="manual.html#implementation-specific-pragmas-importobjc-pragma">ImportObjC</a> pragmas to call methods from classes.</p>
<p>Whenever you use any of these pragmas you need to integrate native code into your final binary. In the case of JavaScript this is no problem at all, the same HTML file which hosts the generated JavaScript will likely provide other JavaScript functions which you are importing with <tt class="docutils literal"><span class="pre"><span class="Identifier">importc</span></span></tt>.</p>
<p>However, for the C like targets you need to link external code either statically or dynamically. The preferred way of integrating native code is to use dynamic linking because it allows you to compile Nim programs without the need for having the related development libraries installed. This is done through the <a class="reference external" href=" manual.html#foreign-function-interface-dynlib-pragma-for-import">dynlib pragma for import</a>, though more specific control can be gained using the <a class="reference external" href="dynlib.html">dynlib module</a>.</p>
<p>The <a class="reference external" href="nimc.html#dynliboverride">dynlibOverride</a> command line switch allows to avoid dynamic linking if you need to statically link something instead. Nim wrappers designed to statically link source files can use the <a class="reference external" href="manual.html#implementation-specific-pragmas-compile-pragma">compile pragma</a> if there are few sources or providing them along the Nim code is easier than using a system library. Libraries installed on the host system can be linked in with the <a class="reference external" href="manual.html#implementation-specific-pragmas-passl-pragma">PassL pragma</a>.</p>
<p>To wrap native code, take a look at the <a class="reference external" href=" https://github.com/nim-lang/c2nim/blob/master/doc/c2nim.rst">c2nim tool</a> which helps with the process of scanning and transforming header files into a Nim interface.</p>
<h3><a class="toc-backref" id="nim-code-calling-the-backend-c-invocation-example" href="#nim-code-calling-the-backend-c-invocation-example">C invocation example</a></h3><p>Create a <tt class="docutils literal"><span class="pre">logic.c</span></tt> file with the following content:</p>
<p><pre class="listing"><span class="Keyword">int</span> <span class="Identifier">addTwoIntegers</span><span class="Punctuation">(</span><span class="Keyword">int</span> <span class="Identifier">a</span><span class="Punctuation">,</span> <span class="Keyword">int</span> <span class="Identifier">b</span><span class="Punctuation">)</span>
<span class="Punctuation">{</span>
<span class="Keyword">return</span> <span class="Identifier">a</span> <span class="Operator">+</span> <span class="Identifier">b</span><span class="Punctuation">;</span>
<span class="Punctuation">}</span></pre></p>
<p>Create a <tt class="docutils literal"><span class="pre">calculator.nim</span></tt> file with the following content:</p>
<p><pre class="listing"><span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">compile</span><span class="Punctuation">:</span> <span class="StringLit">&quot;logic.c&quot;</span><span class="Operator">.</span><span class="Punctuation">}</span>
<span class="Keyword">proc</span> <span class="Identifier">addTwoIntegers</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="Identifier">b</span><span class="Punctuation">:</span> <span class="Identifier">cint</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">cint</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importc</span><span class="Operator">.</span><span class="Punctuation">}</span>
<span class="Keyword">when</span> <span class="Identifier">isMainModule</span><span class="Punctuation">:</span>
<span class="Identifier">echo</span> <span class="Identifier">addTwoIntegers</span><span class="Punctuation">(</span><span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">7</span><span class="Punctuation">)</span></pre></p>
<p>With these two files in place, you can run <tt class="docutils literal"><span class="pre"><span class="program">nim</span> <span class="option">c</span> <span class="option">-r</span> <span class="Identifier">calculator.nim</span></span></tt> and the Nim compiler will compile the <tt class="docutils literal"><span class="pre">logic.c</span></tt> file in addition to <tt class="docutils literal"><span class="pre">calculator.nim</span></tt> and link both into an executable, which outputs <tt class="docutils literal"><span class="pre"><span class="DecNumber">10</span></span></tt> when run. Another way to link the C file statically and get the same effect would be to remove the line with the <tt class="docutils literal"><span class="pre"><span class="Identifier">compile</span></span></tt> pragma and run the following typical Unix commands:</p>
<p><pre class="listing"><span class="program">gcc</span> <span class="option">-c</span> <span class="Identifier">logic.c</span>
<span class="program">ar</span> <span class="option">rvs</span> <span class="Identifier">mylib.a</span> <span class="Identifier">logic.o</span>
<span class="program">nim</span> <span class="option">c</span> <span class="Identifier">--passL:mylib.a</span> <span class="option">-r</span> <span class="Identifier">calculator.nim</span></pre></p>
<p>Just like in this example we pass the path to the <tt class="docutils literal"><span class="pre">mylib.a</span></tt> library (and we could as well pass <tt class="docutils literal"><span class="pre">logic.o</span></tt>) we could be passing switches to link any other static C library.</p>
<h3><a class="toc-backref" id="nim-code-calling-the-backend-javascript-invocation-example" href="#nim-code-calling-the-backend-javascript-invocation-example">JavaScript invocation example</a></h3><p>Create a <tt class="docutils literal"><span class="pre">host.html</span></tt> file with the following content:</p>
<p><pre class="listing">&lt;html&gt;&lt;body&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
function addTwoIntegers(a, b)
{
return a + b;
}
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;calculator.js&quot;&gt;&lt;/script&gt;
&lt;/body&gt;&lt;/html&gt;</pre></p>
<p>Create a <tt class="docutils literal"><span class="pre">calculator.nim</span></tt> file with the following content (or reuse the one from the previous section):</p>
<p><pre class="listing"><span class="Keyword">proc</span> <span class="Identifier">addTwoIntegers</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="Identifier">b</span><span class="Punctuation">:</span> <span class="Identifier">int</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">int</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">importc</span><span class="Operator">.</span><span class="Punctuation">}</span>
<span class="Keyword">when</span> <span class="Identifier">isMainModule</span><span class="Punctuation">:</span>
<span class="Identifier">echo</span> <span class="Identifier">addTwoIntegers</span><span class="Punctuation">(</span><span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">7</span><span class="Punctuation">)</span></pre></p>
<p>Compile the Nim code to JavaScript with <tt class="docutils literal"><span class="pre"><span class="program">nim</span> <span class="option">js</span> <span class="Identifier">-o:calculator.js</span> <span class="Identifier">calculator.nim</span></span></tt> and open <tt class="docutils literal"><span class="pre">host.html</span></tt> in a browser. If the browser supports javascript, you should see the value <tt class="docutils literal"><span class="pre"><span class="DecNumber">10</span></span></tt> in the browser's console. Use the <a class="reference external" href="dom.html">dom module</a> for specific DOM querying and modification procs or take a look at <a class="reference external" href="https://github.com/pragmagic/karax">karax</a> for how to develop browser-based applications.</p>
<h2><a class="toc-backref" id="interfacing-backend-code-calling-nim" href="#interfacing-backend-code-calling-nim">Backend code calling Nim</a></h2><p>Backend code can interface with Nim code exposed through the <a class="reference external" href="manual.html#foreign-function-interface-exportc-pragma">exportc pragma</a>. The <tt class="docutils literal"><span class="pre"><span class="Identifier">exportc</span></span></tt> pragma is the <em>generic</em> way of making Nim symbols available to the backends. By default, the Nim compiler will mangle all the Nim symbols to avoid any name collision, so the most significant thing the <tt class="docutils literal"><span class="pre"><span class="Identifier">exportc</span></span></tt> pragma does is maintain the Nim symbol name, or if specified, use an alternative symbol for the backend in case the symbol rules don't match.</p>
<p>The JavaScript target doesn't have any further interfacing considerations since it also has garbage collection, but the C targets require you to initialize Nim's internals, which is done calling a <tt class="docutils literal"><span class="pre"><span class="Identifier">NimMain</span></span></tt> function. Also, C code requires you to specify a forward declaration for functions or the compiler will assume certain types for the return value and parameters which will likely make your program crash at runtime.</p>
<p>The name <tt class="docutils literal"><span class="pre"><span class="Identifier">NimMain</span></span></tt> can be influenced via the <tt class="docutils literal"><span class="pre"><span class="Operator">--</span><span class="Identifier">nimMainPrefix</span><span class="Punctuation">:</span><span class="Identifier">prefix</span></span></tt> switch. Use <tt class="docutils literal"><span class="pre"><span class="Operator">--</span><span class="Identifier">nimMainPrefix</span><span class="Punctuation">:</span><span class="Identifier">MyLib</span></span></tt> and the function to call is named <tt class="docutils literal"><span class="pre"><span class="Identifier">MyLibNimMain</span></span></tt>.</p>
<p>When compiling to static or dynamic libraries, they don't call destructors of global variables as normal Nim programs would do. A C API <tt class="docutils literal"><span class="pre"><span class="Identifier">NimDestroyGlobals</span></span></tt> is provided to call these global destructors. It is influenced by the <tt class="docutils literal"><span class="pre"><span class="Operator">--</span><span class="Identifier">nimMainPrefix</span><span class="Punctuation">:</span><span class="Identifier">prefix</span></span></tt> switch, too.</p>
<h3><a class="toc-backref" id="backend-code-calling-nim-nim-invocation-example-from-c" href="#backend-code-calling-nim-nim-invocation-example-from-c">Nim invocation example from C</a></h3><p>Create a <tt class="docutils literal"><span class="pre">fib.nim</span></tt> file with the following content:</p>
<p><pre class="listing"><span class="Keyword">proc</span> <span class="Identifier">fib</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">:</span> <span class="Identifier">cint</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">cint</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">exportc</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
<span class="Keyword">if</span> <span class="Identifier">a</span> <span class="Operator">&lt;=</span> <span class="DecNumber">2</span><span class="Punctuation">:</span>
<span class="Identifier">result</span> <span class="Operator">=</span> <span class="DecNumber">1</span>
<span class="Keyword">else</span><span class="Punctuation">:</span>
<span class="Identifier">result</span> <span class="Operator">=</span> <span class="Identifier">fib</span><span class="Punctuation">(</span><span class="Identifier">a</span> <span class="Operator">-</span> <span class="DecNumber">1</span><span class="Punctuation">)</span> <span class="Operator">+</span> <span class="Identifier">fib</span><span class="Punctuation">(</span><span class="Identifier">a</span> <span class="Operator">-</span> <span class="DecNumber">2</span><span class="Punctuation">)</span></pre></p>
<p>Create a <tt class="docutils literal"><span class="pre">maths.c</span></tt> file with the following content:</p>
<p><pre class="listing"><span class="Preprocessor">#include</span> <span class="Operator">&lt;</span><span class="Identifier">stdio</span><span class="Punctuation">.</span><span class="Identifier">h</span><span class="Operator">&gt;</span>
<span class="Keyword">int</span> <span class="Identifier">fib</span><span class="Punctuation">(</span><span class="Keyword">int</span> <span class="Identifier">a</span><span class="Punctuation">)</span><span class="Punctuation">;</span>
<span class="Keyword">void</span> <span class="Identifier">NimMain</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Punctuation">;</span>
<span class="Keyword">int</span> <span class="Identifier">main</span><span class="Punctuation">(</span><span class="Keyword">void</span><span class="Punctuation">)</span>
<span class="Punctuation">{</span>
<span class="Identifier">NimMain</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Punctuation">;</span>
<span class="Keyword">for</span> <span class="Punctuation">(</span><span class="Keyword">int</span> <span class="Identifier">f</span> <span class="Operator">=</span> <span class="DecNumber">0</span><span class="Punctuation">;</span> <span class="Identifier">f</span> <span class="Operator">&lt;</span> <span class="DecNumber">10</span><span class="Punctuation">;</span> <span class="Identifier">f</span><span class="Operator">++</span><span class="Punctuation">)</span>
<span class="Identifier">printf</span><span class="Punctuation">(</span><span class="StringLit">&quot;Fib of %d is %d</span><span class="EscapeSequence">\n</span><span class="StringLit">&quot;</span><span class="Punctuation">,</span> <span class="Identifier">f</span><span class="Punctuation">,</span> <span class="Identifier">fib</span><span class="Punctuation">(</span><span class="Identifier">f</span><span class="Punctuation">)</span><span class="Punctuation">)</span><span class="Punctuation">;</span>
<span class="Keyword">return</span> <span class="DecNumber">0</span><span class="Punctuation">;</span>
<span class="Punctuation">}</span></pre></p>
<p>Now you can run the following Unix like commands to first generate C sources from the Nim code, then link them into a static binary along your main C program:</p>
<p><pre class="listing"><span class="program">nim</span> <span class="option">c</span> <span class="option">--noMain</span> <span class="option">--noLinking</span> <span class="Identifier">fib.nim</span>
<span class="program">gcc</span> <span class="option">-o</span> <span class="option">m</span> <span class="Identifier">-I$HOME/.cache/nim/fib_d</span> <span class="Identifier">-Ipath/to/nim/lib</span> <span class="Identifier">$HOME/.cache/nim/fib_d/*.c</span> <span class="Identifier">maths.c</span></pre></p>
<p>The first command runs the Nim compiler with three special options to avoid generating a <tt class="docutils literal"><span class="pre"><span class="Identifier">main</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> function in the generated files and to avoid linking the object files into a final binary. All the generated files are placed into the <tt class="docutils literal"><span class="pre">nimcache</span></tt> directory. That's why the next command compiles the <tt class="docutils literal"><span class="pre">maths.c</span></tt> source plus all the <tt class="docutils literal"><span class="pre">.c</span></tt> files from <tt class="docutils literal"><span class="pre">nimcache</span></tt>. In addition to this path, you also have to tell the C compiler where to find Nim's <tt class="docutils literal"><span class="pre">nimbase.h</span></tt> header file.</p>
<p>Instead of depending on the generation of the individual <tt class="docutils literal"><span class="pre">.c</span></tt> files you can also ask the Nim compiler to generate a statically linked library:</p>
<p><pre class="listing"><span class="program">nim</span> <span class="option">c</span> <span class="option">--app:staticLib</span> <span class="Identifier">fib.nim</span>
<span class="program">gcc</span> <span class="option">-o</span> <span class="option">m</span> <span class="option">-Inimcache</span> <span class="Identifier">-Ipath/to/nim/lib</span> <span class="Identifier">maths.c</span> <span class="Identifier">libfib.nim.a</span></pre></p>
<p>The Nim compiler will handle linking the source files generated in the <tt class="docutils literal"><span class="pre">nimcache</span></tt> directory into the <tt class="docutils literal"><span class="pre">libfib.nim.a</span></tt> static library, which you can then link into your C program. Note that these commands are generic and will vary for each system. For instance, on Linux systems you will likely need to use <tt class="docutils literal"><span class="pre option">-ldl</span></tt> too to link in required dlopen functionality.</p>
<h3><a class="toc-backref" id="backend-code-calling-nim-nim-invocation-example-from-javascript" href="#backend-code-calling-nim-nim-invocation-example-from-javascript">Nim invocation example from JavaScript</a></h3><p>Create a <tt class="docutils literal"><span class="pre">mhost.html</span></tt> file with the following content:</p>
<p><pre class="listing">&lt;html&gt;&lt;body&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;fib.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
alert(&quot;Fib for 9 is &quot; + fib(9));
&lt;/script&gt;
&lt;/body&gt;&lt;/html&gt;</pre></p>
<p>Create a <tt class="docutils literal"><span class="pre">fib.nim</span></tt> file with the following content (or reuse the one from the previous section):</p>
<p><pre class="listing"><span class="Keyword">proc</span> <span class="Identifier">fib</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">:</span> <span class="Identifier">cint</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">cint</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">exportc</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
<span class="Keyword">if</span> <span class="Identifier">a</span> <span class="Operator">&lt;=</span> <span class="DecNumber">2</span><span class="Punctuation">:</span>
<span class="Identifier">result</span> <span class="Operator">=</span> <span class="DecNumber">1</span>
<span class="Keyword">else</span><span class="Punctuation">:</span>
<span class="Identifier">result</span> <span class="Operator">=</span> <span class="Identifier">fib</span><span class="Punctuation">(</span><span class="Identifier">a</span> <span class="Operator">-</span> <span class="DecNumber">1</span><span class="Punctuation">)</span> <span class="Operator">+</span> <span class="Identifier">fib</span><span class="Punctuation">(</span><span class="Identifier">a</span> <span class="Operator">-</span> <span class="DecNumber">2</span><span class="Punctuation">)</span></pre></p>
<p>Compile the Nim code to JavaScript with <tt class="docutils literal"><span class="pre"><span class="program">nim</span> <span class="option">js</span> <span class="Identifier">-o:fib.js</span> <span class="Identifier">fib.nim</span></span></tt> and open <tt class="docutils literal"><span class="pre">mhost.html</span></tt> in a browser. If the browser supports javascript, you should see an alert box displaying the text <tt class="docutils literal"><span class="pre">Fib for 9 is 34</span></tt>. As mentioned earlier, JavaScript doesn't require an initialization call to <tt class="docutils literal"><span class="pre"><span class="Identifier">NimMain</span></span></tt> or a similar function and you can call the exported Nim proc directly.</p>
<h2><a class="toc-backref" id="interfacing-nimcache-naming-logic" href="#interfacing-nimcache-naming-logic">Nimcache naming logic</a></h2><p>The <span id="nimcache_1">nimcache</span> directory is generated during compilation and will hold either temporary or final files depending on your backend target. The default name for the directory depends on the used backend and on your OS but you can use the <tt class="docutils literal"><span class="pre option">--nimcache</span></tt> <a class="reference external" href=" nimc.html#compiler-usage-commandminusline-switches">compiler switch</a> to change it.</p>
<h1><a class="toc-backref" id="memory-management" href="#memory-management">Memory management</a></h1><p>In the previous sections, the <tt class="docutils literal"><span class="pre"><span class="Identifier">NimMain</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> function reared its head. Since JavaScript already provides automatic memory management, you can freely pass objects between the two languages without problems. In C and derivative languages you need to be careful about what you do and how you share memory. The previous examples only dealt with simple scalar values, but passing a Nim string to C, or reading back a C string in Nim already requires you to be aware of who controls what to avoid crashing.</p>
<h2><a class="toc-backref" id="memory-management-strings-and-c-strings" href="#memory-management-strings-and-c-strings">Strings and C strings</a></h2><p>The manual mentions that <a class="reference external" href="manual.html#types-cstring-type">Nim strings are implicitly convertible to cstrings</a> which makes interaction usually painless. Most C functions accepting a Nim string converted to a <tt class="docutils literal"><span class="pre"><span class="Identifier">cstring</span></span></tt> will likely not need to keep this string around and by the time they return the string won't be needed anymore.</p>
<p>A similar thing happens with C code invoking Nim code which returns a <tt class="docutils literal"><span class="pre"><span class="Identifier">cstring</span></span></tt>. Consider the following proc:</p>
<p><pre class="listing"><span class="Keyword">proc</span> <span class="Identifier">gimme</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">cstring</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">exportc</span><span class="Operator">.</span><span class="Punctuation">}</span> <span class="Operator">=</span>
<span class="Identifier">result</span> <span class="Operator">=</span> <span class="StringLit">&quot;Hey there C code! &quot;</span> <span class="Operator">&amp;</span> <span class="Operator">$</span><span class="Identifier">rand</span><span class="Punctuation">(</span><span class="DecNumber">100</span><span class="Punctuation">)</span></pre></p>
<p>Since Nim's reference counting mechanism is not aware of the C code, once the <tt class="docutils literal"><span class="pre"><span class="Identifier">gimme</span></span></tt> proc has finished it can reclaim the memory of the <tt class="docutils literal"><span class="pre"><span class="Identifier">cstring</span></span></tt>.</p>
<h2><a class="toc-backref" id="memory-management-custom-data-types" href="#memory-management-custom-data-types">Custom data types</a></h2><p>Just like strings, custom data types that are to be shared between Nim and the backend will need careful consideration of who controls who. If you want to hand a Nim reference to C code, you will need to use <a class="reference external" href=" system.html#GC_ref,ref.T">GC_ref</a> to mark the reference as used, so it does not get freed. And for the C backend you will need to expose the <a class="reference external" href=" system.html#GC_unref,ref.T">GC_unref</a> proc to clean up this memory when it is not required anymore.</p>
<p>Again, if you are wrapping a library which <em>mallocs</em> and <em>frees</em> data structures, you need to expose the appropriate <em>free</em> function to Nim so you can clean it up. And of course, once cleaned you should avoid accessing it from Nim (or C for that matter). Typically C data structures have their own <tt class="docutils literal"><span class="pre"><span class="Identifier">malloc_structure</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">free_structure</span></span></tt> specific functions, so wrapping these for the Nim side should be enough. </p>
</p>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:07:11 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

19
backends.idx Normal file
View File

@@ -0,0 +1,19 @@
markupTitle Nim Backend Integration backends.html Nim Backend Integration 0
heading Introduction backends.html#introduction Introduction 0
heading Backends backends.html#backends Backends 0
heading The C like targets backends.html#backends-the-c-like-targets The C like targets 0
heading The JavaScript target backends.html#backends-the-javascript-target The JavaScript target 0
idx JavaScript backends.html#javascript_1 The JavaScript target 0
idx nodejs backends.html#nodejs_1 The JavaScript target 0
heading Interfacing backends.html#interfacing Interfacing 0
heading Nim code calling the backend backends.html#interfacing-nim-code-calling-the-backend Nim code calling the backend 0
heading C invocation example backends.html#nim-code-calling-the-backend-c-invocation-example C invocation example 0
heading JavaScript invocation example backends.html#nim-code-calling-the-backend-javascript-invocation-example JavaScript invocation example 0
heading Backend code calling Nim backends.html#interfacing-backend-code-calling-nim Backend code calling Nim 0
heading Nim invocation example from C backends.html#backend-code-calling-nim-nim-invocation-example-from-c Nim invocation example from C 0
heading Nim invocation example from JavaScript backends.html#backend-code-calling-nim-nim-invocation-example-from-javascript Nim invocation example from JavaScript 0
heading Nimcache naming logic backends.html#interfacing-nimcache-naming-logic Nimcache naming logic 0
idx nimcache backends.html#nimcache_1 Nimcache naming logic 0
heading Memory management backends.html#memory-management Memory management 0
heading Strings and C strings backends.html#memory-management-strings-and-c-strings Strings and C strings 0
heading Custom data types backends.html#memory-management-custom-data-types Custom data types 0

244
base64.html Normal file
View File

@@ -0,0 +1,244 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/base64</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/base64</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li><a class="reference" id="basic-usage_toc" href="#basic-usage">Basic usage</a></li>
<ul class="simple"><li><a class="reference" id="basic-usage-encoding-data_toc" href="#basic-usage-encoding-data">Encoding data</a></li>
<li><a class="reference" id="basic-usage-decoding-data_toc" href="#basic-usage-decoding-data">Decoding data</a></li>
<li><a class="reference" id="basic-usage-url-safe-base64_toc" href="#basic-usage-url-safe-base64">URL Safe Base64</a></li>
</ul><li><a class="reference" id="see-also_toc" href="#see-also">See also</a></li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">decode
<li><a class="reference" href="#decode%2Cstring" title="decode(s: string): string">decode(s: string): string</a></li>
</ul>
<ul class="simple nested-toc-section">encode
<li><a class="reference" href="#encode%2CopenArray%5BT%5D" title="encode[T: byte | char](s: openArray[T]; safe = false): string">encode[T: byte | char](s: openArray[T]; safe = false): string</a></li>
<li><a class="reference" href="#encode%2CopenArray%5BT%5D_2" title="encode[T: SomeInteger and not byte](s: openArray[T]; safe = false): string">encode[T: SomeInteger and not byte](s: openArray[T]; safe = false): string</a></li>
</ul>
<ul class="simple nested-toc-section">encodeMime
<li><a class="reference" href="#encodeMime%2Cstring%2Cstring" title="encodeMime(s: string; lineLen = 75.Positive; newLine = &quot;\r\n&quot;; safe = false): string">encodeMime(s: string; lineLen = 75.Positive; newLine = &quot;\r\n&quot;; safe = false): string</a></li>
</ul>
<ul class="simple nested-toc-section">initDecodeTable
<li><a class="reference" href="#initDecodeTable" title="initDecodeTable(): array[256, char]">initDecodeTable(): array[256, char]</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/base64.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/base64.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"><p>This module implements a base64 encoder and decoder.</p>
<p>Unstable API.</p>
<p>Base64 is an encoding and decoding technique used to convert binary data to an ASCII string format. Each Base64 digit represents exactly 6 bits of data. Three 8-bit bytes (i.e., a total of 24 bits) can therefore be represented by four 6-bit Base64 digits.</p>
<h1><a class="toc-backref" id="basic-usage" href="#basic-usage">Basic usage</a></h1>
<h2><a class="toc-backref" id="basic-usage-encoding-data" href="#basic-usage-encoding-data">Encoding data</a></h2>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">base64</span>
<span class="Keyword">let</span> <span class="Identifier">encoded</span> <span class="Operator">=</span> <span class="Identifier">encode</span><span class="Punctuation">(</span><span class="StringLit">&quot;Hello World&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">encoded</span> <span class="Operator">==</span> <span class="StringLit">&quot;SGVsbG8gV29ybGQ=&quot;</span></pre>Apart from strings you can also encode lists of integers or characters:
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">base64</span>
<span class="Keyword">let</span> <span class="Identifier">encodedInts</span> <span class="Operator">=</span> <span class="Identifier">encode</span><span class="Punctuation">(</span><span class="Punctuation">[</span><span class="DecNumber">1'</span><span class="Identifier">u8</span><span class="Punctuation">,</span><span class="DecNumber">2</span><span class="Punctuation">,</span><span class="DecNumber">3</span><span class="Punctuation">]</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">encodedInts</span> <span class="Operator">==</span> <span class="StringLit">&quot;AQID&quot;</span>
<span class="Keyword">let</span> <span class="Identifier">encodedChars</span> <span class="Operator">=</span> <span class="Identifier">encode</span><span class="Punctuation">(</span><span class="Punctuation">[</span><span class="Punctuation">'</span><span class="Identifier">h</span><span class="CharLit">','</span><span class="Identifier">e</span><span class="CharLit">','</span><span class="Identifier">y</span><span class="CharLit">'])</span>
<span class="Identifier">assert</span> <span class="Identifier">encodedChars</span> <span class="Operator">==</span> <span class="StringLit">&quot;aGV5&quot;</span></pre>
<h2><a class="toc-backref" id="basic-usage-decoding-data" href="#basic-usage-decoding-data">Decoding data</a></h2>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">base64</span>
<span class="Keyword">let</span> <span class="Identifier">decoded</span> <span class="Operator">=</span> <span class="Identifier">decode</span><span class="Punctuation">(</span><span class="StringLit">&quot;SGVsbG8gV29ybGQ=&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">assert</span> <span class="Identifier">decoded</span> <span class="Operator">==</span> <span class="StringLit">&quot;Hello World&quot;</span></pre>
<h2><a class="toc-backref" id="basic-usage-url-safe-base64" href="#basic-usage-url-safe-base64">URL Safe Base64</a></h2>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">base64</span>
<span class="Identifier">assert</span> <span class="Identifier">encode</span><span class="Punctuation">(</span><span class="StringLit">&quot;c</span><span class="EscapeSequence">\xf7</span><span class="StringLit">&gt;&quot;</span><span class="Punctuation">,</span> <span class="Identifier">safe</span> <span class="Operator">=</span> <span class="Identifier">true</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;Y_c-&quot;</span>
<span class="Identifier">assert</span> <span class="Identifier">encode</span><span class="Punctuation">(</span><span class="StringLit">&quot;c</span><span class="EscapeSequence">\xf7</span><span class="StringLit">&gt;&quot;</span><span class="Punctuation">,</span> <span class="Identifier">safe</span> <span class="Operator">=</span> <span class="Identifier">false</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;Y/c+&quot;</span></pre>
<h1><a class="toc-backref" id="see-also" href="#see-also">See also</a></h1><ul class="simple"><li><a class="reference external" href="hashes.html">hashes module</a> for efficient computations of hash values for diverse Nim types</li>
<li><a class="reference external" href="md5.html">md5 module</a> for the MD5 checksum algorithm</li>
<li><a class="reference external" href="sha1.html">sha1 module</a> for the SHA-1 checksum algorithm</li>
</ul>
</p>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="decode-procs-all">
<div id="decode,string">
<dt><pre><span class="Keyword">proc</span> <a href="#decode%2Cstring"><span class="Identifier">decode</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Decodes string <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt> in base64 representation back into its original form. The initial whitespace is skipped.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#encode,openArray[T]">encode proc</a> for encoding an openarray</li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">assert</span> <span class="Identifier">decode</span><span class="Punctuation">(</span><span class="StringLit">&quot;SGVsbG8gV29ybGQ=&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;Hello World&quot;</span>
<span class="Identifier">assert</span> <span class="Identifier">decode</span><span class="Punctuation">(</span><span class="StringLit">&quot; SGVsbG8gV29ybGQ=&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;Hello World&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/base64.nim#L216" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/base64.nim#L216" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="encode-procs-all">
<div id="encode,openArray[T]">
<dt><pre><span class="Keyword">proc</span> <a href="#encode%2CopenArray%5BT%5D"><span class="Identifier">encode</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#byte"><span class="Identifier">byte</span></a> <span class="Operator">|</span> <a href="system.html#char"><span class="Identifier">char</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">safe</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a></pre></dt>
<dd>
<p>Encodes <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt> into base64 representation.</p>
<p>If <tt class="docutils literal"><span class="pre"><span class="Identifier">safe</span></span></tt> is <tt class="docutils literal"><span class="pre"><span class="Identifier">true</span></span></tt> then it will encode using the URL-Safe and Filesystem-safe standard alphabet characters, which substitutes <tt class="docutils literal"><span class="pre"><span class="Operator">-</span></span></tt> instead of <tt class="docutils literal"><span class="pre"><span class="Operator">+</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">_</span></span></tt> instead of <tt class="docutils literal"><span class="pre"><span class="Operator">/</span></span></tt>.</p>
<ul class="simple"><li><a class="reference external" href="https://en.wikipedia.org/wiki/Base64#URL_applications">https://en.wikipedia.org/wiki/Base64#URL_applications</a></li>
<li><a class="reference external" href="https://tools.ietf.org/html/rfc4648#page-7">https://tools.ietf.org/html/rfc4648#page-7</a></li>
</ul>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#decode,string">decode proc</a> for decoding a string</li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">assert</span> <span class="Identifier">encode</span><span class="Punctuation">(</span><span class="StringLit">&quot;Hello World&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;SGVsbG8gV29ybGQ=&quot;</span>
<span class="Identifier">assert</span> <span class="Identifier">encode</span><span class="Punctuation">(</span><span class="Punctuation">[</span><span class="Punctuation">'</span><span class="Identifier">n</span><span class="CharLit">', '</span><span class="Identifier">i</span><span class="CharLit">', '</span><span class="Identifier">m</span><span class="CharLit">']) == &quot;bmlt&quot;</span>
<span class="Identifier">assert</span> <span class="Identifier">encode</span><span class="Punctuation">(</span><span class="Operator">@</span><span class="Punctuation">[</span><span class="Punctuation">'</span><span class="Identifier">n</span><span class="CharLit">', '</span><span class="Identifier">i</span><span class="CharLit">', '</span><span class="Identifier">m</span><span class="CharLit">']) == &quot;bmlt&quot;</span>
<span class="Identifier">assert</span> <span class="Identifier">encode</span><span class="Punctuation">(</span><span class="Punctuation">[</span><span class="DecNumber">1'</span><span class="Identifier">u8</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;AQIDBAU=&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/base64.nim#L138" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/base64.nim#L138" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="encode,openArray[T]_2">
<dt><pre><span class="Keyword">proc</span> <a href="#encode%2CopenArray%5BT%5D_2"><span class="Identifier">encode</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a> <span class="Keyword">and</span> <span class="Keyword">not</span> <a href="system.html#byte"><span class="Identifier">byte</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">safe</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">&quot;use `byte` or `char` instead&quot;</span></span>.}</pre></dt>
<dd>
<div class="deprecation-message">
<b>Deprecated:</b> use `byte` or `char` instead
</div>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/base64.nim#L157" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/base64.nim#L157" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="encodeMime-procs-all">
<div id="encodeMime,string,string">
<dt><pre><span class="Keyword">proc</span> <a href="#encodeMime%2Cstring%2Cstring"><span class="Identifier">encodeMime</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">lineLen</span> <span class="Other">=</span> <span class="DecNumber">75</span><span class="Other">.</span><span class="Identifier">Positive</span><span class="Other">;</span> <span class="Identifier">newLine</span> <span class="Other">=</span> <span class="StringLit">&quot;\r\n&quot;</span><span class="Other">;</span> <span class="Identifier">safe</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Encodes <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt> into base64 representation as lines. Used in email MIME format, use <tt class="docutils literal"><span class="pre"><span class="Identifier">lineLen</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">newline</span></span></tt>.</p>
<p>This procedure encodes a string according to MIME spec.</p>
<p>If <tt class="docutils literal"><span class="pre"><span class="Identifier">safe</span></span></tt> is <tt class="docutils literal"><span class="pre"><span class="Identifier">true</span></span></tt> then it will encode using the URL-Safe and Filesystem-safe standard alphabet characters, which substitutes <tt class="docutils literal"><span class="pre"><span class="Operator">-</span></span></tt> instead of <tt class="docutils literal"><span class="pre"><span class="Operator">+</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">_</span></span></tt> instead of <tt class="docutils literal"><span class="pre"><span class="Operator">/</span></span></tt>.</p>
<ul class="simple"><li><a class="reference external" href="https://en.wikipedia.org/wiki/Base64#URL_applications">https://en.wikipedia.org/wiki/Base64#URL_applications</a></li>
<li><a class="reference external" href="https://tools.ietf.org/html/rfc4648#page-7">https://tools.ietf.org/html/rfc4648#page-7</a></li>
</ul>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#encode,openArray[T]">encode proc</a> for encoding an openArray</li>
<li><a class="reference external" href="#decode,string">decode proc</a> for decoding a string</li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">assert</span> <span class="Identifier">encodeMime</span><span class="Punctuation">(</span><span class="StringLit">&quot;Hello World&quot;</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="StringLit">&quot;</span><span class="EscapeSequence">\n</span><span class="StringLit">&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;SGVs</span><span class="EscapeSequence">\n</span><span class="StringLit">bG8g</span><span class="EscapeSequence">\n</span><span class="StringLit">V29y</span><span class="EscapeSequence">\n</span><span class="StringLit">bGQ=&quot;</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/base64.nim#L162" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/base64.nim#L162" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="initDecodeTable-procs-all">
<div id="initDecodeTable">
<dt><pre><span class="Keyword">proc</span> <a href="#initDecodeTable"><span class="Identifier">initDecodeTable</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#array"><span class="Identifier">array</span></a><span class="Other">[</span><span class="DecNumber">256</span><span class="Other">,</span> <a href="system.html#char"><span class="Identifier">char</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/base64.nim#L200" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/base64.nim#L200" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:07:29 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

12
base64.idx Normal file
View File

@@ -0,0 +1,12 @@
nimTitle base64 base64.html module std/base64 0
nim encode base64.html#encode,openArray[T] proc encode[T: byte | char](s: openArray[T]; safe = false): string 138
nim encode base64.html#encode,openArray[T]_2 proc encode[T: SomeInteger and not byte](s: openArray[T]; safe = false): string 157
nim encodeMime base64.html#encodeMime,string,string proc encodeMime(s: string; lineLen = 75.Positive; newLine = "\r\n"; safe = false): string 162
nim initDecodeTable base64.html#initDecodeTable proc initDecodeTable(): array[256, char] 200
nim decode base64.html#decode,string proc decode(s: string): string 216
heading Basic usage base64.html#basic-usage Basic usage 0
heading Encoding data base64.html#basic-usage-encoding-data Encoding data 0
heading Decoding data base64.html#basic-usage-decoding-data Decoding data 0
heading URL Safe Base64 base64.html#basic-usage-url-safe-base64 URL Safe Base64 0
heading See also base64.html#see-also See also 0
nimgrp encode base64.html#encode-procs-all proc 138

275
bcrypt.html Normal file
View File

@@ -0,0 +1,275 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>src/checksums/bcrypt</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">src/checksums/bcrypt</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#CostFactor" title="CostFactor = range[4 .. 31]">CostFactor</a></li>
<li><a class="reference" href="#Hash" title="Hash = distinct HashBytes">Hash</a></li>
<li><a class="reference" href="#Salt" title="Salt = object
costFactor*: CostFactor">Salt</a></li>
<li><a class="reference" href="#SaltedHash" title="SaltedHash = tuple[salt: Salt, hash: Hash]">SaltedHash</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">$
<li><a class="reference" href="#%24%2CHash" title="`$`(s: Hash): string">`$`(s: Hash): string</a></li>
<li><a class="reference" href="#%24%2CSalt" title="`$`(s: Salt): string">`$`(s: Salt): string</a></li>
<li><a class="reference" href="#%24%2CSaltedHash" title="`$`(s: SaltedHash): string">`$`(s: SaltedHash): string</a></li>
</ul>
<ul class="simple nested-toc-section">bcrypt
<li><a class="reference" href="#bcrypt%2CopenArray%5Bchar%5D%2CSalt" title="bcrypt(password: openArray[char]; salt: Salt): SaltedHash">bcrypt(password: openArray[char]; salt: Salt): SaltedHash</a></li>
</ul>
<ul class="simple nested-toc-section">generateSalt
<li><a class="reference" href="#generateSalt%2CCostFactor" title="generateSalt(cost: CostFactor): Salt">generateSalt(cost: CostFactor): Salt</a></li>
</ul>
<ul class="simple nested-toc-section">parseSalt
<li><a class="reference" href="#parseSalt%2Cstring" title="parseSalt(salt: string): Salt">parseSalt(salt: string): Salt</a></li>
</ul>
<ul class="simple nested-toc-section">verify
<li><a class="reference" href="#verify%2CopenArray%5Bchar%5D%2Cstring" title="verify(password: openArray[char]; knownGood: string): bool">verify(password: openArray[char]; knownGood: string): bool</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<div id="tocRoot"></div>
<p class="module-desc"><p><a class="reference external" href="https://en.wikipedia.org/wiki/Bcrypt">bcrypt</a> is a <a class="reference external" href="https://en.wikipedia.org/wiki/Blowfish_(cipher)">Blowfish</a>-based password hashing algorithm that is designed to be adaptively expensive to provide resistance against brute force based attacks and additionally includes a salt for lookup table resistance.</p>
<p>Although bcrypt has been around for a long time, dating back to 1999, for many projects it is still a reasonable choice due to its adjustable cost factor that can provide security against all but the most well funded attackers.</p>
<p>This module's design is based loosely on Python's <tt class="docutils literal"><span class="pre"><span class="Identifier">bcrypt</span></span></tt> module and supports generating the newer version <tt class="docutils literal"><span class="pre"><span class="DecNumber">2</span><span class="Identifier">b</span></span></tt> hashes as well as verifying the older <tt class="docutils literal"><span class="pre"><span class="DecNumber">2</span><span class="Identifier">a</span></span></tt> and the PHP equivalent of <tt class="docutils literal"><span class="pre"><span class="DecNumber">2</span><span class="Identifier">b</span></span></tt> called <tt class="docutils literal"><span class="pre"><span class="DecNumber">2</span><span class="Identifier">y</span></span></tt>.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">import</span> <span class="Identifier">src</span><span class="Operator">/</span><span class="Identifier">checksums</span><span class="Operator">/</span><span class="Identifier">bcrypt</span>
<span class="Comment"># Generate a salt with a specific cost factor and use it to hash a password.</span>
<span class="Keyword">let</span> <span class="Identifier">hashed</span> <span class="Operator">=</span> <span class="Identifier">bcrypt</span><span class="Punctuation">(</span><span class="StringLit">&quot;correct horse battery stape&quot;</span><span class="Punctuation">,</span> <span class="Identifier">generateSalt</span><span class="Punctuation">(</span><span class="DecNumber">8</span><span class="Punctuation">)</span><span class="Punctuation">)</span></pre>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">import</span> <span class="Identifier">src</span><span class="Operator">/</span><span class="Identifier">checksums</span><span class="Operator">/</span><span class="Identifier">bcrypt</span>
<span class="Comment"># Verify a password against a known good hash from i.e. a database.</span>
<span class="Keyword">let</span> <span class="Identifier">knownGood</span> <span class="Operator">=</span> <span class="StringLit">&quot;$2b$06$LzUyyYdKBoEy9V4NTvxDH.O11KQP30/Zyp5pQAQ.0Cy89WnkD5Jjy&quot;</span>
<span class="Identifier">assert</span> <span class="Identifier">verify</span><span class="Punctuation">(</span><span class="StringLit">&quot;correct horse battery staple&quot;</span><span class="Punctuation">,</span> <span class="Identifier">knownGood</span><span class="Punctuation">)</span></pre></p>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="CostFactor">
<dt><pre><a href="bcrypt.html#CostFactor"><span class="Identifier">CostFactor</span></a> <span class="Other">=</span> <span class="Identifier">range</span><span class="Other">[</span><span class="DecNumber">4</span> <span class="Operator">..</span> <span class="DecNumber">31</span><span class="Other">]</span></pre></dt>
<dd>
Adjustable cost factor. The value is a logarithm of 2, which means that a cost of 5 is twice as expensive as a cost of 4, and a cost of 16 is 2048 times more expensive than a cost of 5.
</dd>
</div>
<div id="Hash">
<dt><pre><a href="bcrypt.html#Hash"><span class="Identifier">Hash</span></a> <span class="Other">=</span> <span class="Keyword">distinct</span> <span class="Identifier">HashBytes</span></pre></dt>
<dd>
A 192 bit hash value produced by the <tt class="docutils literal"><span class="pre"><span class="Identifier">bcrypt</span></span></tt> function.
</dd>
</div>
<div id="Salt">
<dt><pre><a href="bcrypt.html#Salt"><span class="Identifier">Salt</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">costFactor</span><span class="Operator">*</span><span class="Other">:</span> <a href="bcrypt.html#CostFactor"><span class="Identifier">CostFactor</span></a></pre></dt>
<dd>
A random 128 bit salt used to provide security against rainbow table attacks that also includes the bcrypt version and cost factor.
</dd>
</div>
<div id="SaltedHash">
<dt><pre><a href="bcrypt.html#SaltedHash"><span class="Identifier">SaltedHash</span></a> <span class="Other">=</span> <span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">salt</span><span class="Other">:</span> <a href="bcrypt.html#Salt"><span class="Identifier">Salt</span></a><span class="Other">,</span> <span class="Identifier">hash</span><span class="Other">:</span> <a href="bcrypt.html#Hash"><span class="Identifier">Hash</span></a><span class="Other">]</span></pre></dt>
<dd>
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="$-procs-all">
<div id="$,Hash">
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CHash"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="bcrypt.html#Hash"><span class="Identifier">Hash</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Renders the given <tt class="docutils literal"><span class="pre"><span class="Identifier">Hash</span></span></tt> into the canonical bcrypt-type Base64 representation.
</dd>
</div>
<div id="$,Salt">
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CSalt"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="bcrypt.html#Salt"><span class="Identifier">Salt</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Renders the given <tt class="docutils literal"><span class="pre"><span class="Identifier">Salt</span></span></tt> into the canonical bcrypt-type Base64 representation along with its version and cost factor information.
</dd>
</div>
<div id="$,SaltedHash">
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CSaltedHash"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="bcrypt.html#SaltedHash"><span class="Identifier">SaltedHash</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Renders the given <tt class="docutils literal"><span class="pre"><span class="Identifier">SaltedHash</span></span></tt> into the canonical bcrypt-type Base64 representation resulting in the actual hash string to be stored.
</dd>
</div>
</div>
<div id="bcrypt-procs-all">
<div id="bcrypt,openArray[char],Salt">
<dt><pre><span class="Keyword">proc</span> <a href="#bcrypt%2CopenArray%5Bchar%5D%2CSalt"><span class="Identifier">bcrypt</span></a><span class="Other">(</span><span class="Identifier">password</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">char</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">salt</span><span class="Other">:</span> <a href="bcrypt.html#Salt"><span class="Identifier">Salt</span></a><span class="Other">)</span><span class="Other">:</span> <a href="bcrypt.html#SaltedHash"><span class="Identifier">SaltedHash</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Produces a <tt class="docutils literal"><span class="pre"><span class="Identifier">SaltedHash</span></span></tt> from the given password string and salt.</p>
<p>Be careful when accepting a salt from a source outside of your control as a malicious user could pass in salts with a very high cost factor, resulting in denial of service attack.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">let</span> <span class="Identifier">hashed</span> <span class="Operator">=</span> <span class="Identifier">bcrypt</span><span class="Punctuation">(</span><span class="StringLit">&quot;correct horse battery stape&quot;</span><span class="Punctuation">,</span> <span class="Identifier">generateSalt</span><span class="Punctuation">(</span><span class="DecNumber">8</span><span class="Punctuation">)</span><span class="Punctuation">)</span></pre>
</dd>
</div>
</div>
<div id="generateSalt-procs-all">
<div id="generateSalt,CostFactor">
<dt><pre><span class="Keyword">proc</span> <a href="#generateSalt%2CCostFactor"><span class="Identifier">generateSalt</span></a><span class="Other">(</span><span class="Identifier">cost</span><span class="Other">:</span> <a href="bcrypt.html#CostFactor"><span class="Identifier">CostFactor</span></a><span class="Other">)</span><span class="Other">:</span> <a href="bcrypt.html#Salt"><span class="Identifier">Salt</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Identifier">ResourceExhaustedError</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Generates a new, random salt with the provided <tt class="docutils literal"><span class="pre"><span class="Identifier">CostFactor</span></span></tt>. Only salts with subversion <tt class="docutils literal"><span class="pre"><span class="DecNumber">2</span><span class="Identifier">b</span></span></tt> are generated since it's the newest and default version of the reference bcrypt implementation.
</dd>
</div>
</div>
<div id="parseSalt-procs-all">
<div id="parseSalt,string">
<dt><pre><span class="Keyword">proc</span> <a href="#parseSalt%2Cstring"><span class="Identifier">parseSalt</span></a><span class="Other">(</span><span class="Identifier">salt</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <a href="bcrypt.html#Salt"><span class="Identifier">Salt</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Parses a <tt class="docutils literal"><span class="pre"><span class="Identifier">Salt</span></span></tt> from the given string (which may be a full bcrypt hash or only the preamble).</p>
<p>It accepts the <tt class="docutils literal"><span class="pre"><span class="DecNumber">2</span><span class="Identifier">a</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="DecNumber">2</span><span class="Identifier">b</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="DecNumber">2</span><span class="Identifier">y</span></span></tt> subversions.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Comment"># Parse full hash</span>
<span class="Keyword">let</span> <span class="Identifier">salt1</span> <span class="Operator">=</span> <span class="Identifier">parseSalt</span> <span class="StringLit">&quot;$2b$06$LzUyyYdKBoEy9V4NTvxDH.&quot;</span>
<span class="Comment"># Parse salt part</span>
<span class="Keyword">let</span> <span class="Identifier">salt2</span> <span class="Operator">=</span> <span class="Identifier">parseSalt</span> <span class="StringLit">&quot;$2b$06$LzUyyYdKBoEy9V4NTvxDH.PvwrAArbP0DUvDUFf8ChnJl6/79lh3C&quot;</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">salt1</span> <span class="Operator">==</span> <span class="StringLit">&quot;$2b$06$LzUyyYdKBoEy9V4NTvxDH.&quot;</span>
<span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">salt2</span> <span class="Operator">==</span> <span class="StringLit">&quot;$2b$06$LzUyyYdKBoEy9V4NTvxDH.&quot;</span></pre>
</dd>
</div>
</div>
<div id="verify-procs-all">
<div id="verify,openArray[char],string">
<dt><pre><span class="Keyword">proc</span> <a href="#verify%2CopenArray%5Bchar%5D%2Cstring"><span class="Identifier">verify</span></a><span class="Other">(</span><span class="Identifier">password</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">char</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">knownGood</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Verifies a given plaintext password against a hash from a known good source such as a database or other data storage.</p>
<p>Be careful when accepting a hash from a source outside of your control as a malicious user could pass salts with a very high cost factor, resulting in denial of service attack.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">let</span> <span class="Identifier">knownGood</span> <span class="Operator">=</span> <span class="StringLit">&quot;$2b$06$LzUyyYdKBoEy9V4NTvxDH.O11KQP30/Zyp5pQAQ.0Cy89WnkD5Jjy&quot;</span>
<span class="Identifier">assert</span> <span class="Identifier">verify</span><span class="Punctuation">(</span><span class="StringLit">&quot;correct horse battery staple&quot;</span><span class="Punctuation">,</span> <span class="Identifier">knownGood</span><span class="Punctuation">)</span></pre>
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:10 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

13
bcrypt.idx Normal file
View File

@@ -0,0 +1,13 @@
nimTitle bcrypt bcrypt.html module src/checksums/bcrypt 0
nim CostFactor bcrypt.html#CostFactor type CostFactor 191
nim Salt bcrypt.html#Salt object Salt 199
nim Hash bcrypt.html#Hash type Hash 206
nim SaltedHash bcrypt.html#SaltedHash tuple SaltedHash 209
nim `$` bcrypt.html#$,Salt proc `$`(s: Salt): string 301
nim `$` bcrypt.html#$,Hash proc `$`(s: Hash): string 306
nim `$` bcrypt.html#$,SaltedHash proc `$`(s: SaltedHash): string 310
nim parseSalt bcrypt.html#parseSalt,string proc parseSalt(salt: string): Salt 387
nim generateSalt bcrypt.html#generateSalt,CostFactor proc generateSalt(cost: CostFactor): Salt 425
nim bcrypt bcrypt.html#bcrypt,openArray[char],Salt proc bcrypt(password: openArray[char]; salt: Salt): SaltedHash 438
nim verify bcrypt.html#verify,openArray[char],string proc verify(password: openArray[char]; knownGood: string): bool 495
nimgrp $ bcrypt.html#$-procs-all proc 301

975
bitops.html Normal file
View File

@@ -0,0 +1,975 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/bitops</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/bitops</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#BitsRange" title="BitsRange[T] = range[0 .. sizeof(T) * 8 - 1]">BitsRange</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">bitnot
<li><a class="reference" href="#bitnot%2CT" title="bitnot[T: SomeInteger](x: T): T">bitnot[T: SomeInteger](x: T): T</a></li>
</ul>
<ul class="simple nested-toc-section">bitslice
<li><a class="reference" href="#bitslice%2CT%2CSlice%5Bint%5D" title="bitslice[T: SomeInteger](v: var T; slice: Slice[int])">bitslice[T: SomeInteger](v: var T; slice: Slice[int])</a></li>
</ul>
<ul class="simple nested-toc-section">bitsliced
<li><a class="reference" href="#bitsliced%2CT%2CSlice%5Bint%5D" title="bitsliced[T: SomeInteger](v: T; slice: Slice[int]): T">bitsliced[T: SomeInteger](v: T; slice: Slice[int]): T</a></li>
</ul>
<ul class="simple nested-toc-section">clearBit
<li><a class="reference" href="#clearBit%2CT%2CBitsRange%5BT%3A%20SomeInteger%5D" title="clearBit[T: SomeInteger](v: var T; bit: BitsRange[T])">clearBit[T: SomeInteger](v: var T; bit: BitsRange[T])</a></li>
</ul>
<ul class="simple nested-toc-section">clearMask
<li><a class="reference" href="#clearMask%2CT%2CT" title="clearMask[T: SomeInteger](v: var T; mask: T)">clearMask[T: SomeInteger](v: var T; mask: T)</a></li>
<li><a class="reference" href="#clearMask%2CT%2CSlice%5Bint%5D" title="clearMask[T: SomeInteger](v: var T; slice: Slice[int])">clearMask[T: SomeInteger](v: var T; slice: Slice[int])</a></li>
</ul>
<ul class="simple nested-toc-section">clearMasked
<li><a class="reference" href="#clearMasked%2CT%2CT" title="clearMasked[T: SomeInteger](v, mask: T): T">clearMasked[T: SomeInteger](v, mask: T): T</a></li>
<li><a class="reference" href="#clearMasked%2CT%2CSlice%5Bint%5D" title="clearMasked[T: SomeInteger](v: T; slice: Slice[int]): T">clearMasked[T: SomeInteger](v: T; slice: Slice[int]): T</a></li>
</ul>
<ul class="simple nested-toc-section">countLeadingZeroBits
<li><a class="reference" href="#countLeadingZeroBits%2CSomeInteger" title="countLeadingZeroBits(x: SomeInteger): int">countLeadingZeroBits(x: SomeInteger): int</a></li>
</ul>
<ul class="simple nested-toc-section">countSetBits
<li><a class="reference" href="#countSetBits%2CSomeInteger" title="countSetBits(x: SomeInteger): int">countSetBits(x: SomeInteger): int</a></li>
</ul>
<ul class="simple nested-toc-section">countTrailingZeroBits
<li><a class="reference" href="#countTrailingZeroBits%2CSomeInteger" title="countTrailingZeroBits(x: SomeInteger): int">countTrailingZeroBits(x: SomeInteger): int</a></li>
</ul>
<ul class="simple nested-toc-section">fastLog2
<li><a class="reference" href="#fastLog2%2CSomeInteger" title="fastLog2(x: SomeInteger): int">fastLog2(x: SomeInteger): int</a></li>
</ul>
<ul class="simple nested-toc-section">firstSetBit
<li><a class="reference" href="#firstSetBit%2CSomeInteger" title="firstSetBit(x: SomeInteger): int">firstSetBit(x: SomeInteger): int</a></li>
</ul>
<ul class="simple nested-toc-section">flipBit
<li><a class="reference" href="#flipBit%2CT%2CBitsRange%5BT%3A%20SomeInteger%5D" title="flipBit[T: SomeInteger](v: var T; bit: BitsRange[T])">flipBit[T: SomeInteger](v: var T; bit: BitsRange[T])</a></li>
</ul>
<ul class="simple nested-toc-section">flipMask
<li><a class="reference" href="#flipMask%2CT%2CT" title="flipMask[T: SomeInteger](v: var T; mask: T)">flipMask[T: SomeInteger](v: var T; mask: T)</a></li>
<li><a class="reference" href="#flipMask%2CT%2CSlice%5Bint%5D" title="flipMask[T: SomeInteger](v: var T; slice: Slice[int])">flipMask[T: SomeInteger](v: var T; slice: Slice[int])</a></li>
</ul>
<ul class="simple nested-toc-section">flipMasked
<li><a class="reference" href="#flipMasked%2CT%2CT" title="flipMasked[T: SomeInteger](v, mask: T): T">flipMasked[T: SomeInteger](v, mask: T): T</a></li>
<li><a class="reference" href="#flipMasked%2CT%2CSlice%5Bint%5D" title="flipMasked[T: SomeInteger](v: T; slice: Slice[int]): T">flipMasked[T: SomeInteger](v: T; slice: Slice[int]): T</a></li>
</ul>
<ul class="simple nested-toc-section">mask
<li><a class="reference" href="#mask%2CT%2CT" title="mask[T: SomeInteger](v: var T; mask: T)">mask[T: SomeInteger](v: var T; mask: T)</a></li>
<li><a class="reference" href="#mask%2CT%2CSlice%5Bint%5D" title="mask[T: SomeInteger](v: var T; slice: Slice[int])">mask[T: SomeInteger](v: var T; slice: Slice[int])</a></li>
</ul>
<ul class="simple nested-toc-section">masked
<li><a class="reference" href="#masked%2CT%2CT" title="masked[T: SomeInteger](v, mask: T): T">masked[T: SomeInteger](v, mask: T): T</a></li>
<li><a class="reference" href="#masked%2CT%2CSlice%5Bint%5D" title="masked[T: SomeInteger](v: T; slice: Slice[int]): T">masked[T: SomeInteger](v: T; slice: Slice[int]): T</a></li>
</ul>
<ul class="simple nested-toc-section">parityBits
<li><a class="reference" href="#parityBits%2CSomeInteger" title="parityBits(x: SomeInteger): int">parityBits(x: SomeInteger): int</a></li>
</ul>
<ul class="simple nested-toc-section">popcount
<li><a class="reference" href="#popcount%2CSomeInteger" title="popcount(x: SomeInteger): int">popcount(x: SomeInteger): int</a></li>
</ul>
<ul class="simple nested-toc-section">reverseBits
<li><a class="reference" href="#reverseBits%2CT" title="reverseBits[T: SomeUnsignedInt](x: T): T">reverseBits[T: SomeUnsignedInt](x: T): T</a></li>
</ul>
<ul class="simple nested-toc-section">rotateLeftBits
<li><a class="reference" href="#rotateLeftBits%2CT%2Crange%5B%5D" title="rotateLeftBits[T: SomeUnsignedInt](value: T; shift: range[0 .. (sizeof(T) * 8)]): T">rotateLeftBits[T: SomeUnsignedInt](value: T; shift: range[0 .. (sizeof(T) * 8)]): T</a></li>
</ul>
<ul class="simple nested-toc-section">rotateRightBits
<li><a class="reference" href="#rotateRightBits%2CT%2Crange%5B%5D" title="rotateRightBits[T: SomeUnsignedInt](value: T; shift: range[0 .. (sizeof(T) * 8)]): T">rotateRightBits[T: SomeUnsignedInt](value: T; shift: range[0 .. (sizeof(T) * 8)]): T</a></li>
</ul>
<ul class="simple nested-toc-section">setBit
<li><a class="reference" href="#setBit%2CT%2CBitsRange%5BT%3A%20SomeInteger%5D" title="setBit[T: SomeInteger](v: var T; bit: BitsRange[T])">setBit[T: SomeInteger](v: var T; bit: BitsRange[T])</a></li>
</ul>
<ul class="simple nested-toc-section">setMask
<li><a class="reference" href="#setMask%2CT%2CT" title="setMask[T: SomeInteger](v: var T; mask: T)">setMask[T: SomeInteger](v: var T; mask: T)</a></li>
<li><a class="reference" href="#setMask%2CT%2CSlice%5Bint%5D" title="setMask[T: SomeInteger](v: var T; slice: Slice[int])">setMask[T: SomeInteger](v: var T; slice: Slice[int])</a></li>
</ul>
<ul class="simple nested-toc-section">setMasked
<li><a class="reference" href="#setMasked%2CT%2CT" title="setMasked[T: SomeInteger](v, mask: T): T">setMasked[T: SomeInteger](v, mask: T): T</a></li>
<li><a class="reference" href="#setMasked%2CT%2CSlice%5Bint%5D" title="setMasked[T: SomeInteger](v: T; slice: Slice[int]): T">setMasked[T: SomeInteger](v: T; slice: Slice[int]): T</a></li>
</ul>
<ul class="simple nested-toc-section">testBit
<li><a class="reference" href="#testBit%2CT%2CBitsRange%5BT%3A%20SomeInteger%5D" title="testBit[T: SomeInteger](v: T; bit: BitsRange[T]): bool">testBit[T: SomeInteger](v: T; bit: BitsRange[T]): bool</a></li>
</ul>
<ul class="simple nested-toc-section">toMask
<li><a class="reference" href="#toMask%2CSlice%5Bint%5D" title="toMask[T: SomeInteger](slice: Slice[int]): T">toMask[T: SomeInteger](slice: Slice[int]): T</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#17" id="67">Macros</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">bitand
<li><a class="reference" href="#bitand.m%2CT%2CT%2Cvarargs%5BT%5D" title="bitand[T: SomeInteger](x, y: T; z: varargs[T]): T">bitand[T: SomeInteger](x, y: T; z: varargs[T]): T</a></li>
</ul>
<ul class="simple nested-toc-section">bitor
<li><a class="reference" href="#bitor.m%2CT%2CT%2Cvarargs%5BT%5D" title="bitor[T: SomeInteger](x, y: T; z: varargs[T]): T">bitor[T: SomeInteger](x, y: T; z: varargs[T]): T</a></li>
</ul>
<ul class="simple nested-toc-section">bitxor
<li><a class="reference" href="#bitxor.m%2CT%2CT%2Cvarargs%5BT%5D" title="bitxor[T: SomeInteger](x, y: T; z: varargs[T]): T">bitxor[T: SomeInteger](x, y: T; z: varargs[T]): T</a></li>
</ul>
<ul class="simple nested-toc-section">clearBits
<li><a class="reference" href="#clearBits.m%2Ctyped%2Cvarargs%5Btyped%5D" title="clearBits(v: typed; bits: varargs[typed]): untyped">clearBits(v: typed; bits: varargs[typed]): untyped</a></li>
</ul>
<ul class="simple nested-toc-section">flipBits
<li><a class="reference" href="#flipBits.m%2Ctyped%2Cvarargs%5Btyped%5D" title="flipBits(v: typed; bits: varargs[typed]): untyped">flipBits(v: typed; bits: varargs[typed]): untyped</a></li>
</ul>
<ul class="simple nested-toc-section">setBits
<li><a class="reference" href="#setBits.m%2Ctyped%2Cvarargs%5Btyped%5D" title="setBits(v: typed; bits: varargs[typed]): untyped">setBits(v: typed; bits: varargs[typed]): untyped</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"><p>This module implements a series of low level methods for bit manipulation.</p>
<p>By default, compiler intrinsics are used where possible to improve performance on supported compilers: <tt class="docutils literal"><span class="pre"><span class="Identifier">GCC</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">LLVM_GCC</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">CLANG</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">VCC</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">ICC</span></span></tt>.</p>
<p>The module will fallback to pure nim procs in case the backend is not supported. You can also use the flag <tt class="docutils literal"><span class="pre"><span class="Identifier">noIntrinsicsBitOpts</span></span></tt> to disable compiler intrinsics.</p>
<p>This module is also compatible with other backends: <tt class="docutils literal"><span class="pre"><span class="Identifier">JavaScript</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">NimScript</span></span></tt> as well as the <tt class="docutils literal"><span class="pre"><span class="Identifier">compiletime</span> <span class="Identifier">VM</span></span></tt>.</p>
<p>As a result of using optimized functions/intrinsics, some functions can return undefined results if the input is invalid. You can use the flag <tt class="docutils literal"><span class="pre"><span class="Identifier">noUndefinedBitOpts</span></span></tt> to force predictable behaviour for all input, causing a small performance hit.</p>
<p>At this time only <tt class="docutils literal"><span class="pre"><span class="Identifier">fastLog2</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">firstSetBit</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">countLeadingZeroBits</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">countTrailingZeroBits</span></span></tt> may return undefined and/or platform dependent values if given invalid input.</p>
</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="macros.html">macros</a>, <a class="reference external" href="since.html">since</a>, <a class="reference external" href="bitops_utils.html">bitops_utils</a>, <a class="reference external" href="countbits_impl.html">countbits_impl</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="BitsRange">
<dt><pre><a href="bitops.html#BitsRange"><span class="Identifier">BitsRange</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Other">=</span> <a href="system.html#range"><span class="Identifier">range</span></a><span class="Other">[</span><span class="DecNumber">0</span> <span class="Operator">..</span> <span class="Identifier">sizeof</span><span class="Other">(</span><span class="Identifier">T</span><span class="Other">)</span> <span class="Operator">*</span> <span class="DecNumber">8</span> <span class="Operator">-</span> <span class="DecNumber">1</span><span class="Other">]</span></pre></dt>
<dd>
A range with all bit positions for type <tt class="docutils literal"><span class="pre"><span class="Identifier">T</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L63" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L63" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="bitnot-procs-all">
<div id="bitnot,T">
<dt><pre><span class="Keyword">func</span> <a href="#bitnot%2CT"><span class="Identifier">bitnot</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">magic</span><span class="Other">:</span> <span class="StringLit">&quot;BitnotI&quot;</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Computes the <tt class="docutils literal"><span class="pre"><span class="Identifier">bitwise</span> <span class="Identifier">complement</span></span></tt> of the integer <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L32" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L32" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="bitslice-procs-all">
<div id="bitslice,T,Slice[int]">
<dt><pre><span class="Keyword">proc</span> <a href="#bitslice%2CT%2CSlice%5Bint%5D"><span class="Identifier">bitslice</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">slice</span><span class="Other">:</span> <a href="system.html#Slice"><span class="Identifier">Slice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">)</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
Mutates <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt> into an extracted (and shifted) slice of bits from <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">x</span> <span class="Operator">=</span> <span class="BinNumber">0b101110</span>
<span class="Identifier">x</span><span class="Operator">.</span><span class="Identifier">bitslice</span><span class="Punctuation">(</span><span class="DecNumber">2</span> <span class="Operator">..</span> <span class="DecNumber">4</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Identifier">x</span> <span class="Operator">==</span> <span class="BinNumber">0b011</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L84" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L84" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="bitsliced-procs-all">
<div id="bitsliced,T,Slice[int]">
<dt><pre><span class="Keyword">func</span> <a href="#bitsliced%2CT%2CSlice%5Bint%5D"><span class="Identifier">bitsliced</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">slice</span><span class="Other">:</span> <a href="system.html#Slice"><span class="Identifier">Slice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
Returns an extracted (and shifted) slice of bits from <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">doAssert</span> <span class="BinNumber">0b10111</span><span class="Operator">.</span><span class="Identifier">bitsliced</span><span class="Punctuation">(</span><span class="DecNumber">2</span> <span class="Operator">..</span> <span class="DecNumber">4</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="BinNumber">0b101</span>
<span class="Identifier">doAssert</span> <span class="BinNumber">0b11100</span><span class="Operator">.</span><span class="Identifier">bitsliced</span><span class="Punctuation">(</span><span class="DecNumber">0</span> <span class="Operator">..</span> <span class="DecNumber">2</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="BinNumber">0b100</span>
<span class="Identifier">doAssert</span> <span class="BinNumber">0b11100</span><span class="Operator">.</span><span class="Identifier">bitsliced</span><span class="Punctuation">(</span><span class="DecNumber">0</span> <span class="Operator">..&lt;</span> <span class="DecNumber">3</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="BinNumber">0b100</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L72" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L72" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="clearBit-procs-all">
<div id="clearBit,T,BitsRange[T: SomeInteger]">
<dt><pre><span class="Keyword">proc</span> <a href="#clearBit%2CT%2CBitsRange%5BT%3A%20SomeInteger%5D"><span class="Identifier">clearBit</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">bit</span><span class="Other">:</span> <a href="bitops.html#BitsRange"><span class="Identifier">BitsRange</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
Mutates <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with the bit at position <tt class="docutils literal"><span class="pre"><span class="Identifier">bit</span></span></tt> set to 0.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_0011'</span><span class="Identifier">u8</span>
<span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">clearBit</span><span class="Punctuation">(</span><span class="DecNumber">1'</span><span class="Identifier">u8</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="BinNumber">0b0000_0001'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L292" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L292" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="clearMask-procs-all">
<div id="clearMask,T,T">
<dt><pre><span class="Keyword">proc</span> <a href="#clearMask%2CT%2CT"><span class="Identifier">clearMask</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">mask</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<p>Mutates <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with all the <tt class="docutils literal"><span class="pre"><span class="DecNumber">1</span></span></tt> bits from <tt class="docutils literal"><span class="pre"><span class="Identifier">mask</span></span></tt> set to 0.</p>
<p>Effectively maps to a <a class="reference external" href="#bitand.m,T,T,varargs[T]">bitand</a> operation with an <em>inverted mask</em>.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_0011'</span><span class="Identifier">u8</span>
<span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">clearMask</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_1010'</span><span class="Identifier">u8</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="BinNumber">0b0000_0001'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L217" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L217" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="clearMask,T,Slice[int]">
<dt><pre><span class="Keyword">proc</span> <a href="#clearMask%2CT%2CSlice%5Bint%5D"><span class="Identifier">clearMask</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">slice</span><span class="Other">:</span> <a href="system.html#Slice"><span class="Identifier">Slice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">)</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<p>Mutates <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with all the <tt class="docutils literal"><span class="pre"><span class="DecNumber">1</span></span></tt> bits in the range of <tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span></span></tt> set to 0.</p>
<p>Effectively maps to a <a class="reference external" href="#bitand.m,T,T,varargs[T]">bitand</a> operation with an <em>inverted mask</em>.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_0011'</span><span class="Identifier">u8</span>
<span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">clearMask</span><span class="Punctuation">(</span><span class="DecNumber">1</span> <span class="Operator">..</span> <span class="DecNumber">3</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="BinNumber">0b0000_0001'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L229" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L229" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="clearMasked-procs-all">
<div id="clearMasked,T,T">
<dt><pre><span class="Keyword">func</span> <a href="#clearMasked%2CT%2CT"><span class="Identifier">clearMasked</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">,</span> <span class="Identifier">mask</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<p>Returns <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with all the <tt class="docutils literal"><span class="pre"><span class="DecNumber">1</span></span></tt> bits from <tt class="docutils literal"><span class="pre"><span class="Identifier">mask</span></span></tt> set to 0.</p>
<p>Effectively maps to a <a class="reference external" href="#bitand.m,T,T,varargs[T]">bitand</a> operation with an <em>inverted mask</em>.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">let</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_0011'</span><span class="Identifier">u8</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">clearMasked</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_1010'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="BinNumber">0b0000_0001'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L195" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L195" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="clearMasked,T,Slice[int]">
<dt><pre><span class="Keyword">func</span> <a href="#clearMasked%2CT%2CSlice%5Bint%5D"><span class="Identifier">clearMasked</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">slice</span><span class="Other">:</span> <a href="system.html#Slice"><span class="Identifier">Slice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<p>Returns <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with all the <tt class="docutils literal"><span class="pre"><span class="DecNumber">1</span></span></tt> bits in the range of <tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span></span></tt> set to 0.</p>
<p>Effectively maps to a <a class="reference external" href="#bitand.m,T,T,varargs[T]">bitand</a> operation with an <em>inverted mask</em>.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">let</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_0011'</span><span class="Identifier">u8</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">clearMasked</span><span class="Punctuation">(</span><span class="DecNumber">1</span> <span class="Operator">..</span> <span class="DecNumber">3</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="BinNumber">0b0000_0001'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L206" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L206" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="countLeadingZeroBits-procs-all">
<div id="countLeadingZeroBits,SomeInteger">
<dt><pre><span class="Keyword">func</span> <a href="#countLeadingZeroBits%2CSomeInteger"><span class="Identifier">countLeadingZeroBits</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<p>Returns the number of leading zero bits in an integer. If <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt> is zero, when <tt class="docutils literal"><span class="pre"><span class="Identifier">noUndefinedBitOpts</span></span></tt> is set, the result is 0, otherwise the result is undefined.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#countTrailingZeroBits,SomeInteger">countTrailingZeroBits proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">doAssert</span> <span class="Identifier">countLeadingZeroBits</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_0001'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">7</span>
<span class="Identifier">doAssert</span> <span class="Identifier">countLeadingZeroBits</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_0010'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">6</span>
<span class="Identifier">doAssert</span> <span class="Identifier">countLeadingZeroBits</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_0100'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">5</span>
<span class="Identifier">doAssert</span> <span class="Identifier">countLeadingZeroBits</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_1000'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">4</span>
<span class="Identifier">doAssert</span> <span class="Identifier">countLeadingZeroBits</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_1111'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">4</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L604" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L604" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="countSetBits-procs-all">
<div id="countSetBits,SomeInteger">
<dt><pre><span class="Keyword">func</span> <a href="#countSetBits%2CSomeInteger"><span class="Identifier">countSetBits</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
Counts the set bits in an integer (also called <span id="hamming-weight_1">Hamming weight</span>).
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">doAssert</span> <span class="Identifier">countSetBits</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_0011'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">2</span>
<span class="Identifier">doAssert</span> <span class="Identifier">countSetBits</span><span class="Punctuation">(</span><span class="BinNumber">0b1010_1010'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">4</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L488" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L488" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="countTrailingZeroBits-procs-all">
<div id="countTrailingZeroBits,SomeInteger">
<dt><pre><span class="Keyword">func</span> <a href="#countTrailingZeroBits%2CSomeInteger"><span class="Identifier">countTrailingZeroBits</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<p>Returns the number of trailing zeros in an integer. If <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt> is zero, when <tt class="docutils literal"><span class="pre"><span class="Identifier">noUndefinedBitOpts</span></span></tt> is set, the result is 0, otherwise the result is undefined.</p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="#countLeadingZeroBits,SomeInteger">countLeadingZeroBits proc</a></li>
</ul>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">doAssert</span> <span class="Identifier">countTrailingZeroBits</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_0001'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">0</span>
<span class="Identifier">doAssert</span> <span class="Identifier">countTrailingZeroBits</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_0010'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">1</span>
<span class="Identifier">doAssert</span> <span class="Identifier">countTrailingZeroBits</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_0100'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">2</span>
<span class="Identifier">doAssert</span> <span class="Identifier">countTrailingZeroBits</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_1000'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">3</span>
<span class="Identifier">doAssert</span> <span class="Identifier">countTrailingZeroBits</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_1111'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">0</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L632" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L632" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="fastLog2-procs-all">
<div id="fastLog2,SomeInteger">
<dt><pre><span class="Keyword">func</span> <a href="#fastLog2%2CSomeInteger"><span class="Identifier">fastLog2</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
Quickly find the log base 2 of an integer. If <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt> is zero, when <tt class="docutils literal"><span class="pre"><span class="Identifier">noUndefinedBitOpts</span></span></tt> is set, the result is -1, otherwise the result is undefined.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">doAssert</span> <span class="Identifier">fastLog2</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_0001'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">0</span>
<span class="Identifier">doAssert</span> <span class="Identifier">fastLog2</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_0010'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">1</span>
<span class="Identifier">doAssert</span> <span class="Identifier">fastLog2</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_0100'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">2</span>
<span class="Identifier">doAssert</span> <span class="Identifier">fastLog2</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_1000'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">3</span>
<span class="Identifier">doAssert</span> <span class="Identifier">fastLog2</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_1111'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">3</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L565" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L565" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="firstSetBit-procs-all">
<div id="firstSetBit,SomeInteger">
<dt><pre><span class="Keyword">func</span> <a href="#firstSetBit%2CSomeInteger"><span class="Identifier">firstSetBit</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
Returns the 1-based index of the least significant set bit of <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt>. If <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt> is zero, when <tt class="docutils literal"><span class="pre"><span class="Identifier">noUndefinedBitOpts</span></span></tt> is set, the result is 0, otherwise the result is undefined.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">doAssert</span> <span class="Identifier">firstSetBit</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_0001'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">1</span>
<span class="Identifier">doAssert</span> <span class="Identifier">firstSetBit</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_0010'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">2</span>
<span class="Identifier">doAssert</span> <span class="Identifier">firstSetBit</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_0100'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">3</span>
<span class="Identifier">doAssert</span> <span class="Identifier">firstSetBit</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_1000'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">4</span>
<span class="Identifier">doAssert</span> <span class="Identifier">firstSetBit</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_1111'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">1</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L522" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L522" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="flipBit-procs-all">
<div id="flipBit,T,BitsRange[T: SomeInteger]">
<dt><pre><span class="Keyword">proc</span> <a href="#flipBit%2CT%2CBitsRange%5BT%3A%20SomeInteger%5D"><span class="Identifier">flipBit</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">bit</span><span class="Other">:</span> <a href="bitops.html#BitsRange"><span class="Identifier">BitsRange</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
Mutates <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with the bit at position <tt class="docutils literal"><span class="pre"><span class="Identifier">bit</span></span></tt> flipped.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_0011'</span><span class="Identifier">u8</span>
<span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">flipBit</span><span class="Punctuation">(</span><span class="DecNumber">1'</span><span class="Identifier">u8</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="BinNumber">0b0000_0001'</span><span class="Identifier">u8</span>
<span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_0011'</span><span class="Identifier">u8</span>
<span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">flipBit</span><span class="Punctuation">(</span><span class="DecNumber">2'</span><span class="Identifier">u8</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="BinNumber">0b0000_0111'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L301" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L301" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="flipMask-procs-all">
<div id="flipMask,T,T">
<dt><pre><span class="Keyword">proc</span> <a href="#flipMask%2CT%2CT"><span class="Identifier">flipMask</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">mask</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<p>Mutates <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with all the <tt class="docutils literal"><span class="pre"><span class="DecNumber">1</span></span></tt> bits from <tt class="docutils literal"><span class="pre"><span class="Identifier">mask</span></span></tt> flipped.</p>
<p>Effectively maps to a <a class="reference external" href="#bitxor.m,T,T,varargs[T]">bitxor</a> operation.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_0011'</span><span class="Identifier">u8</span>
<span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">flipMask</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_1010'</span><span class="Identifier">u8</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="BinNumber">0b0000_1001'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L261" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L261" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="flipMask,T,Slice[int]">
<dt><pre><span class="Keyword">proc</span> <a href="#flipMask%2CT%2CSlice%5Bint%5D"><span class="Identifier">flipMask</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">slice</span><span class="Other">:</span> <a href="system.html#Slice"><span class="Identifier">Slice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">)</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<p>Mutates <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with all the <tt class="docutils literal"><span class="pre"><span class="DecNumber">1</span></span></tt> bits in the range of <tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span></span></tt> flipped.</p>
<p>Effectively maps to a <a class="reference external" href="#bitxor.m,T,T,varargs[T]">bitxor</a> operation.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_0011'</span><span class="Identifier">u8</span>
<span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">flipMask</span><span class="Punctuation">(</span><span class="DecNumber">1</span> <span class="Operator">..</span> <span class="DecNumber">3</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="BinNumber">0b0000_1101'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L272" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L272" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="flipMasked-procs-all">
<div id="flipMasked,T,T">
<dt><pre><span class="Keyword">func</span> <a href="#flipMasked%2CT%2CT"><span class="Identifier">flipMasked</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">,</span> <span class="Identifier">mask</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<p>Returns <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with all the <tt class="docutils literal"><span class="pre"><span class="DecNumber">1</span></span></tt> bits from <tt class="docutils literal"><span class="pre"><span class="Identifier">mask</span></span></tt> flipped.</p>
<p>Effectively maps to a <a class="reference external" href="#bitxor.m,T,T,varargs[T]">bitxor</a> operation.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">let</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_0011'</span><span class="Identifier">u8</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">flipMasked</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_1010'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="BinNumber">0b0000_1001'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L241" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L241" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="flipMasked,T,Slice[int]">
<dt><pre><span class="Keyword">func</span> <a href="#flipMasked%2CT%2CSlice%5Bint%5D"><span class="Identifier">flipMasked</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">slice</span><span class="Other">:</span> <a href="system.html#Slice"><span class="Identifier">Slice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<p>Returns <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with all the <tt class="docutils literal"><span class="pre"><span class="DecNumber">1</span></span></tt> bits in the range of <tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span></span></tt> flipped.</p>
<p>Effectively maps to a <a class="reference external" href="#bitxor.m,T,T,varargs[T]">bitxor</a> operation.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">let</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_0011'</span><span class="Identifier">u8</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">flipMasked</span><span class="Punctuation">(</span><span class="DecNumber">1</span> <span class="Operator">..</span> <span class="DecNumber">3</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="BinNumber">0b0000_1101'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L251" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L251" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="mask-procs-all">
<div id="mask,T,T">
<dt><pre><span class="Keyword">proc</span> <a href="#mask%2CT%2CT"><span class="Identifier">mask</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">mask</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<p>Mutates <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with only the <tt class="docutils literal"><span class="pre"><span class="DecNumber">1</span></span></tt> bits from <tt class="docutils literal"><span class="pre"><span class="Identifier">mask</span></span></tt> matching those of <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt> set to 1.</p>
<p>Effectively maps to a <a class="reference external" href="#bitand.m,T,T,varargs[T]">bitand</a> operation.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_0011'</span><span class="Identifier">u8</span>
<span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">mask</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_1010'</span><span class="Identifier">u8</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="BinNumber">0b0000_0010'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L129" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L129" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="mask,T,Slice[int]">
<dt><pre><span class="Keyword">proc</span> <a href="#mask%2CT%2CSlice%5Bint%5D"><span class="Identifier">mask</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">slice</span><span class="Other">:</span> <a href="system.html#Slice"><span class="Identifier">Slice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">)</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<p>Mutates <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with only the <tt class="docutils literal"><span class="pre"><span class="DecNumber">1</span></span></tt> bits in the range of <tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span></span></tt> matching those of <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt> set to 1.</p>
<p>Effectively maps to a <a class="reference external" href="#bitand.m,T,T,varargs[T]">bitand</a> operation.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_1011'</span><span class="Identifier">u8</span>
<span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">mask</span><span class="Punctuation">(</span><span class="DecNumber">1</span> <span class="Operator">..</span> <span class="DecNumber">3</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="BinNumber">0b0000_1010'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L141" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L141" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="masked-procs-all">
<div id="masked,T,T">
<dt><pre><span class="Keyword">proc</span> <a href="#masked%2CT%2CT"><span class="Identifier">masked</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">,</span> <span class="Identifier">mask</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<p>Returns <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with only the <tt class="docutils literal"><span class="pre"><span class="DecNumber">1</span></span></tt> bits from <tt class="docutils literal"><span class="pre"><span class="Identifier">mask</span></span></tt> matching those of <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt> set to 1.</p>
<p>Effectively maps to a <a class="reference external" href="#bitand.m,T,T,varargs[T]">bitand</a> operation.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">let</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_0011'</span><span class="Identifier">u8</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">masked</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_1010'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="BinNumber">0b0000_0010'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L107" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L107" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="masked,T,Slice[int]">
<dt><pre><span class="Keyword">func</span> <a href="#masked%2CT%2CSlice%5Bint%5D"><span class="Identifier">masked</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">slice</span><span class="Other">:</span> <a href="system.html#Slice"><span class="Identifier">Slice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<p>Returns <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with only the <tt class="docutils literal"><span class="pre"><span class="DecNumber">1</span></span></tt> bits in the range of <tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span></span></tt> matching those of <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt> set to 1.</p>
<p>Effectively maps to a <a class="reference external" href="#bitand.m,T,T,varargs[T]">bitand</a> operation.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">let</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_1011'</span><span class="Identifier">u8</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">masked</span><span class="Punctuation">(</span><span class="DecNumber">1</span> <span class="Operator">..</span> <span class="DecNumber">3</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="BinNumber">0b0000_1010'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L118" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L118" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="parityBits-procs-all">
<div id="parityBits,SomeInteger">
<dt><pre><span class="Keyword">func</span> <a href="#parityBits%2CSomeInteger"><span class="Identifier">parityBits</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
Calculate the bit parity in an integer. If the number of 1-bits is odd, the parity is 1, otherwise 0.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">doAssert</span> <span class="Identifier">parityBits</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_0000'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">0</span>
<span class="Identifier">doAssert</span> <span class="Identifier">parityBits</span><span class="Punctuation">(</span><span class="BinNumber">0b0101_0001'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">1</span>
<span class="Identifier">doAssert</span> <span class="Identifier">parityBits</span><span class="Punctuation">(</span><span class="BinNumber">0b0110_1001'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">0</span>
<span class="Identifier">doAssert</span> <span class="Identifier">parityBits</span><span class="Punctuation">(</span><span class="BinNumber">0b0111_1111'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">1</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L500" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L500" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="popcount-procs-all">
<div id="popcount,SomeInteger">
<dt><pre><span class="Keyword">func</span> <a href="#popcount%2CSomeInteger"><span class="Identifier">popcount</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
Alias for <a class="reference external" href="#countSetBits,SomeInteger">countSetBits</a> (Hamming weight).
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L496" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L496" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="reverseBits-procs-all">
<div id="reverseBits,T">
<dt><pre><span class="Keyword">func</span> <a href="#reverseBits%2CT"><span class="Identifier">reverseBits</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeUnsignedInt"><span class="Identifier">SomeUnsignedInt</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span></pre></dt>
<dd>
Return the bit reversal of x.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">doAssert</span> <span class="Identifier">reverseBits</span><span class="Punctuation">(</span><span class="BinNumber">0b10100100'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="BinNumber">0b00100101'</span><span class="Identifier">u8</span>
<span class="Identifier">doAssert</span> <span class="Identifier">reverseBits</span><span class="Punctuation">(</span><span class="HexNumber">0xdd'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="HexNumber">0xbb'</span><span class="Identifier">u8</span>
<span class="Identifier">doAssert</span> <span class="Identifier">reverseBits</span><span class="Punctuation">(</span><span class="HexNumber">0xddbb'</span><span class="Identifier">u16</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="HexNumber">0xddbb'</span><span class="Identifier">u16</span>
<span class="Identifier">doAssert</span> <span class="Identifier">reverseBits</span><span class="Punctuation">(</span><span class="HexNumber">0xdeadbeef'</span><span class="Identifier">u32</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="HexNumber">0xf77db57b'</span><span class="Identifier">u32</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L848" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L848" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="rotateLeftBits-procs-all">
<div id="rotateLeftBits,T,range[]">
<dt><pre><span class="Keyword">func</span> <a href="#rotateLeftBits%2CT%2Crange%5B%5D"><span class="Identifier">rotateLeftBits</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeUnsignedInt"><span class="Identifier">SomeUnsignedInt</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span>
<span class="Identifier">shift</span><span class="Other">:</span> <a href="system.html#range"><span class="Identifier">range</span></a><span class="Other">[</span><span class="DecNumber">0</span> <span class="Operator">..</span> <span class="Other">(</span><span class="Identifier">sizeof</span><span class="Other">(</span><span class="Identifier">T</span><span class="Other">)</span> <span class="Operator">*</span> <span class="DecNumber">8</span><span class="Other">)</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.
<span class="Identifier">inline</span>.}</pre></dt>
<dd>
Left-rotate bits in a <tt class="docutils literal"><span class="pre"><span class="Identifier">value</span></span></tt>.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">doAssert</span> <span class="Identifier">rotateLeftBits</span><span class="Punctuation">(</span><span class="BinNumber">0b0110_1001'</span><span class="Identifier">u8</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="BinNumber">0b1001_0110'</span><span class="Identifier">u8</span>
<span class="Identifier">doAssert</span> <span class="Identifier">rotateLeftBits</span><span class="Punctuation">(</span><span class="BinNumber">0b00111100_11000011'</span><span class="Identifier">u16</span><span class="Punctuation">,</span> <span class="DecNumber">8</span><span class="Punctuation">)</span> <span class="Operator">==</span>
<span class="BinNumber">0b11000011_00111100'</span><span class="Identifier">u16</span>
<span class="Identifier">doAssert</span> <span class="Identifier">rotateLeftBits</span><span class="Punctuation">(</span><span class="BinNumber">0b0000111111110000_1111000000001111'</span><span class="Identifier">u32</span><span class="Punctuation">,</span> <span class="DecNumber">16</span><span class="Punctuation">)</span> <span class="Operator">==</span>
<span class="BinNumber">0b1111000000001111_0000111111110000'</span><span class="Identifier">u32</span>
<span class="Identifier">doAssert</span> <span class="Identifier">rotateLeftBits</span><span class="Punctuation">(</span><span class="BinNumber">0b00000000111111111111111100000000_11111111000000000000000011111111'</span><span class="Identifier">u64</span><span class="Punctuation">,</span> <span class="DecNumber">32</span><span class="Punctuation">)</span> <span class="Operator">==</span>
<span class="BinNumber">0b11111111000000000000000011111111_00000000111111111111111100000000'</span><span class="Identifier">u64</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L785" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L785" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="rotateRightBits-procs-all">
<div id="rotateRightBits,T,range[]">
<dt><pre><span class="Keyword">func</span> <a href="#rotateRightBits%2CT%2Crange%5B%5D"><span class="Identifier">rotateRightBits</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeUnsignedInt"><span class="Identifier">SomeUnsignedInt</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span>
<span class="Identifier">shift</span><span class="Other">:</span> <a href="system.html#range"><span class="Identifier">range</span></a><span class="Other">[</span><span class="DecNumber">0</span> <span class="Operator">..</span> <span class="Other">(</span><span class="Identifier">sizeof</span><span class="Other">(</span><span class="Identifier">T</span><span class="Other">)</span> <span class="Operator">*</span> <span class="DecNumber">8</span><span class="Other">)</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
Right-rotate bits in a <tt class="docutils literal"><span class="pre"><span class="Identifier">value</span></span></tt>.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">doAssert</span> <span class="Identifier">rotateRightBits</span><span class="Punctuation">(</span><span class="BinNumber">0b0110_1001'</span><span class="Identifier">u8</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="BinNumber">0b1001_0110'</span><span class="Identifier">u8</span>
<span class="Identifier">doAssert</span> <span class="Identifier">rotateRightBits</span><span class="Punctuation">(</span><span class="BinNumber">0b00111100_11000011'</span><span class="Identifier">u16</span><span class="Punctuation">,</span> <span class="DecNumber">8</span><span class="Punctuation">)</span> <span class="Operator">==</span>
<span class="BinNumber">0b11000011_00111100'</span><span class="Identifier">u16</span>
<span class="Identifier">doAssert</span> <span class="Identifier">rotateRightBits</span><span class="Punctuation">(</span><span class="BinNumber">0b0000111111110000_1111000000001111'</span><span class="Identifier">u32</span><span class="Punctuation">,</span> <span class="DecNumber">16</span><span class="Punctuation">)</span> <span class="Operator">==</span>
<span class="BinNumber">0b1111000000001111_0000111111110000'</span><span class="Identifier">u32</span>
<span class="Identifier">doAssert</span> <span class="Identifier">rotateRightBits</span><span class="Punctuation">(</span><span class="BinNumber">0b00000000111111111111111100000000_11111111000000000000000011111111'</span><span class="Identifier">u64</span><span class="Punctuation">,</span> <span class="DecNumber">32</span><span class="Punctuation">)</span> <span class="Operator">==</span>
<span class="BinNumber">0b11111111000000000000000011111111_00000000111111111111111100000000'</span><span class="Identifier">u64</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L813" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L813" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="setBit-procs-all">
<div id="setBit,T,BitsRange[T: SomeInteger]">
<dt><pre><span class="Keyword">proc</span> <a href="#setBit%2CT%2CBitsRange%5BT%3A%20SomeInteger%5D"><span class="Identifier">setBit</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">bit</span><span class="Other">:</span> <a href="bitops.html#BitsRange"><span class="Identifier">BitsRange</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
Mutates <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with the bit at position <tt class="docutils literal"><span class="pre"><span class="Identifier">bit</span></span></tt> set to 1.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_0011'</span><span class="Identifier">u8</span>
<span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">setBit</span><span class="Punctuation">(</span><span class="DecNumber">5'</span><span class="Identifier">u8</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="BinNumber">0b0010_0011'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L283" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L283" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="setMask-procs-all">
<div id="setMask,T,T">
<dt><pre><span class="Keyword">proc</span> <a href="#setMask%2CT%2CT"><span class="Identifier">setMask</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">mask</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<p>Mutates <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with all the <tt class="docutils literal"><span class="pre"><span class="DecNumber">1</span></span></tt> bits from <tt class="docutils literal"><span class="pre"><span class="Identifier">mask</span></span></tt> set to 1.</p>
<p>Effectively maps to a <a class="reference external" href="#bitor.m,T,T,varargs[T]">bitor</a> operation.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_0011'</span><span class="Identifier">u8</span>
<span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">setMask</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_1010'</span><span class="Identifier">u8</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="BinNumber">0b0000_1011'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L173" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L173" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="setMask,T,Slice[int]">
<dt><pre><span class="Keyword">proc</span> <a href="#setMask%2CT%2CSlice%5Bint%5D"><span class="Identifier">setMask</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">slice</span><span class="Other">:</span> <a href="system.html#Slice"><span class="Identifier">Slice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">)</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<p>Mutates <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with all the <tt class="docutils literal"><span class="pre"><span class="DecNumber">1</span></span></tt> bits in the range of <tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span></span></tt> set to 1.</p>
<p>Effectively maps to a <a class="reference external" href="#bitor.m,T,T,varargs[T]">bitor</a> operation.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_0011'</span><span class="Identifier">u8</span>
<span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">setMask</span><span class="Punctuation">(</span><span class="DecNumber">2</span> <span class="Operator">..</span> <span class="DecNumber">3</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="BinNumber">0b0000_1111'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L184" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L184" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="setMasked-procs-all">
<div id="setMasked,T,T">
<dt><pre><span class="Keyword">func</span> <a href="#setMasked%2CT%2CT"><span class="Identifier">setMasked</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">,</span> <span class="Identifier">mask</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<p>Returns <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with all the <tt class="docutils literal"><span class="pre"><span class="DecNumber">1</span></span></tt> bits from <tt class="docutils literal"><span class="pre"><span class="Identifier">mask</span></span></tt> set to 1.</p>
<p>Effectively maps to a <a class="reference external" href="#bitor.m,T,T,varargs[T]">bitor</a> operation.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">let</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_0011'</span><span class="Identifier">u8</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">setMasked</span><span class="Punctuation">(</span><span class="BinNumber">0b0000_1010'</span><span class="Identifier">u8</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="BinNumber">0b0000_1011'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L153" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L153" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="setMasked,T,Slice[int]">
<dt><pre><span class="Keyword">func</span> <a href="#setMasked%2CT%2CSlice%5Bint%5D"><span class="Identifier">setMasked</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">slice</span><span class="Other">:</span> <a href="system.html#Slice"><span class="Identifier">Slice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<p>Returns <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with all the <tt class="docutils literal"><span class="pre"><span class="DecNumber">1</span></span></tt> bits in the range of <tt class="docutils literal"><span class="pre"><span class="Identifier">slice</span></span></tt> set to 1.</p>
<p>Effectively maps to a <a class="reference external" href="#bitor.m,T,T,varargs[T]">bitor</a> operation.</p>
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">let</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_0011'</span><span class="Identifier">u8</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">setMasked</span><span class="Punctuation">(</span><span class="DecNumber">2</span> <span class="Operator">..</span> <span class="DecNumber">3</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="BinNumber">0b0000_1111'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L163" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L163" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="testBit-procs-all">
<div id="testBit,T,BitsRange[T: SomeInteger]">
<dt><pre><span class="Keyword">proc</span> <a href="#testBit%2CT%2CBitsRange%5BT%3A%20SomeInteger%5D"><span class="Identifier">testBit</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">bit</span><span class="Other">:</span> <a href="bitops.html#BitsRange"><span class="Identifier">BitsRange</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
Returns true if the bit in <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt> at positions <tt class="docutils literal"><span class="pre"><span class="Identifier">bit</span></span></tt> is set to 1.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">let</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_1111'</span><span class="Identifier">u8</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">testBit</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Keyword">not</span> <span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">testBit</span><span class="Punctuation">(</span><span class="DecNumber">7</span><span class="Punctuation">)</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L351" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L351" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="toMask-procs-all">
<div id="toMask,Slice[int]">
<dt><pre><span class="Keyword">func</span> <a href="#toMask%2CSlice%5Bint%5D"><span class="Identifier">toMask</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">slice</span><span class="Other">:</span> <a href="system.html#Slice"><span class="Identifier">Slice</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
Creates a bitmask based on a slice of bits.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Identifier">doAssert</span> <span class="Identifier">toMask</span><span class="Punctuation">[</span><span class="Identifier">int32</span><span class="Punctuation">]</span><span class="Punctuation">(</span><span class="DecNumber">1</span> <span class="Operator">..</span> <span class="DecNumber">3</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="BinNumber">0b1110'i32</span>
<span class="Identifier">doAssert</span> <span class="Identifier">toMask</span><span class="Punctuation">[</span><span class="Identifier">int32</span><span class="Punctuation">]</span><span class="Punctuation">(</span><span class="DecNumber">0</span> <span class="Operator">..</span> <span class="DecNumber">3</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="BinNumber">0b1111'i32</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L96" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L96" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="17">
<h1><a class="toc-backref" href="#17">Macros</a></h1>
<dl class="item">
<div id="bitand-macros-all">
<div id="bitand.m,T,T,varargs[T]">
<dt><pre><span class="Keyword">macro</span> <a href="#bitand.m%2CT%2CT%2Cvarargs%5BT%5D"><span class="Identifier">bitand</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">z</span><span class="Other">:</span> <a href="system.html#varargs"><span class="Identifier">varargs</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span></pre></dt>
<dd>
Computes the <tt class="docutils literal"><span class="pre"><span class="Identifier">bitwise</span> <span class="Keyword">and</span></span></tt> of all arguments collectively.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L41" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L41" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="bitor-macros-all">
<div id="bitor.m,T,T,varargs[T]">
<dt><pre><span class="Keyword">macro</span> <a href="#bitor.m%2CT%2CT%2Cvarargs%5BT%5D"><span class="Identifier">bitor</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">z</span><span class="Other">:</span> <a href="system.html#varargs"><span class="Identifier">varargs</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span></pre></dt>
<dd>
Computes the <tt class="docutils literal"><span class="pre"><span class="Identifier">bitwise</span> <span class="Keyword">or</span></span></tt> of all arguments collectively.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L48" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L48" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="bitxor-macros-all">
<div id="bitxor.m,T,T,varargs[T]">
<dt><pre><span class="Keyword">macro</span> <a href="#bitxor.m%2CT%2CT%2Cvarargs%5BT%5D"><span class="Identifier">bitxor</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeInteger"><span class="Identifier">SomeInteger</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">z</span><span class="Other">:</span> <a href="system.html#varargs"><span class="Identifier">varargs</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span></pre></dt>
<dd>
Computes the <tt class="docutils literal"><span class="pre"><span class="Identifier">bitwise</span> <span class="Keyword">xor</span></span></tt> of all arguments collectively.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L55" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L55" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="clearBits-macros-all">
<div id="clearBits.m,typed,varargs[typed]">
<dt><pre><span class="Keyword">macro</span> <a href="#clearBits.m%2Ctyped%2Cvarargs%5Btyped%5D"><span class="Identifier">clearBits</span></a><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <a href="system.html#typed"><span class="Identifier">typed</span></a><span class="Other">;</span> <span class="Identifier">bits</span><span class="Other">:</span> <a href="system.html#varargs"><span class="Identifier">varargs</span></a><span class="Other">[</span><a href="system.html#typed"><span class="Identifier">typed</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#untyped"><span class="Identifier">untyped</span></a></pre></dt>
<dd>
Mutates <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with the bits at positions <tt class="docutils literal"><span class="pre"><span class="Identifier">bits</span></span></tt> set to 0.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b1111_1111'</span><span class="Identifier">u8</span>
<span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">clearBits</span><span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">7</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="BinNumber">0b0101_0101'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L326" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L326" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="flipBits-macros-all">
<div id="flipBits.m,typed,varargs[typed]">
<dt><pre><span class="Keyword">macro</span> <a href="#flipBits.m%2Ctyped%2Cvarargs%5Btyped%5D"><span class="Identifier">flipBits</span></a><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <a href="system.html#typed"><span class="Identifier">typed</span></a><span class="Other">;</span> <span class="Identifier">bits</span><span class="Other">:</span> <a href="system.html#varargs"><span class="Identifier">varargs</span></a><span class="Other">[</span><a href="system.html#typed"><span class="Identifier">typed</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#untyped"><span class="Identifier">untyped</span></a></pre></dt>
<dd>
Mutates <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with the bits at positions <tt class="docutils literal"><span class="pre"><span class="Identifier">bits</span></span></tt> set to 0.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_1111'</span><span class="Identifier">u8</span>
<span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">flipBits</span><span class="Punctuation">(</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">7</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="BinNumber">0b1010_0101'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L338" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L338" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="setBits-macros-all">
<div id="setBits.m,typed,varargs[typed]">
<dt><pre><span class="Keyword">macro</span> <a href="#setBits.m%2Ctyped%2Cvarargs%5Btyped%5D"><span class="Identifier">setBits</span></a><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <a href="system.html#typed"><span class="Identifier">typed</span></a><span class="Other">;</span> <span class="Identifier">bits</span><span class="Other">:</span> <a href="system.html#varargs"><span class="Identifier">varargs</span></a><span class="Other">[</span><a href="system.html#typed"><span class="Identifier">typed</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#untyped"><span class="Identifier">untyped</span></a></pre></dt>
<dd>
Mutates <tt class="docutils literal"><span class="pre"><span class="Identifier">v</span></span></tt>, with the bits at positions <tt class="docutils literal"><span class="pre"><span class="Identifier">bits</span></span></tt> set to 1.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Keyword">var</span> <span class="Identifier">v</span> <span class="Operator">=</span> <span class="BinNumber">0b0000_0011'</span><span class="Identifier">u8</span>
<span class="Identifier">v</span><span class="Operator">.</span><span class="Identifier">setBits</span><span class="Punctuation">(</span><span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">7</span><span class="Punctuation">)</span>
<span class="Identifier">doAssert</span> <span class="Identifier">v</span> <span class="Operator">==</span> <span class="BinNumber">0b1010_1011'</span><span class="Identifier">u8</span></pre>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/bitops.nim#L314" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/bitops.nim#L314" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:07:17 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

51
bitops.idx Normal file
View File

@@ -0,0 +1,51 @@
nimTitle bitops bitops.html module std/bitops 0
nim bitnot bitops.html#bitnot,T proc bitnot[T: SomeInteger](x: T): T 32
nim bitand bitops.html#bitand.m,T,T,varargs[T] macro bitand[T: SomeInteger](x, y: T; z: varargs[T]): T 41
nim bitor bitops.html#bitor.m,T,T,varargs[T] macro bitor[T: SomeInteger](x, y: T; z: varargs[T]): T 48
nim bitxor bitops.html#bitxor.m,T,T,varargs[T] macro bitxor[T: SomeInteger](x, y: T; z: varargs[T]): T 55
nim BitsRange bitops.html#BitsRange type BitsRange 63
nim bitsliced bitops.html#bitsliced,T,Slice[int] proc bitsliced[T: SomeInteger](v: T; slice: Slice[int]): T 72
nim bitslice bitops.html#bitslice,T,Slice[int] proc bitslice[T: SomeInteger](v: var T; slice: Slice[int]) 84
nim toMask bitops.html#toMask,Slice[int] proc toMask[T: SomeInteger](slice: Slice[int]): T 96
nim masked bitops.html#masked,T,T proc masked[T: SomeInteger](v, mask: T): T 107
nim masked bitops.html#masked,T,Slice[int] proc masked[T: SomeInteger](v: T; slice: Slice[int]): T 118
nim mask bitops.html#mask,T,T proc mask[T: SomeInteger](v: var T; mask: T) 129
nim mask bitops.html#mask,T,Slice[int] proc mask[T: SomeInteger](v: var T; slice: Slice[int]) 141
nim setMasked bitops.html#setMasked,T,T proc setMasked[T: SomeInteger](v, mask: T): T 153
nim setMasked bitops.html#setMasked,T,Slice[int] proc setMasked[T: SomeInteger](v: T; slice: Slice[int]): T 163
nim setMask bitops.html#setMask,T,T proc setMask[T: SomeInteger](v: var T; mask: T) 173
nim setMask bitops.html#setMask,T,Slice[int] proc setMask[T: SomeInteger](v: var T; slice: Slice[int]) 184
nim clearMasked bitops.html#clearMasked,T,T proc clearMasked[T: SomeInteger](v, mask: T): T 195
nim clearMasked bitops.html#clearMasked,T,Slice[int] proc clearMasked[T: SomeInteger](v: T; slice: Slice[int]): T 206
nim clearMask bitops.html#clearMask,T,T proc clearMask[T: SomeInteger](v: var T; mask: T) 217
nim clearMask bitops.html#clearMask,T,Slice[int] proc clearMask[T: SomeInteger](v: var T; slice: Slice[int]) 229
nim flipMasked bitops.html#flipMasked,T,T proc flipMasked[T: SomeInteger](v, mask: T): T 241
nim flipMasked bitops.html#flipMasked,T,Slice[int] proc flipMasked[T: SomeInteger](v: T; slice: Slice[int]): T 251
nim flipMask bitops.html#flipMask,T,T proc flipMask[T: SomeInteger](v: var T; mask: T) 261
nim flipMask bitops.html#flipMask,T,Slice[int] proc flipMask[T: SomeInteger](v: var T; slice: Slice[int]) 272
nim setBit bitops.html#setBit,T,BitsRange[T: SomeInteger] proc setBit[T: SomeInteger](v: var T; bit: BitsRange[T]) 283
nim clearBit bitops.html#clearBit,T,BitsRange[T: SomeInteger] proc clearBit[T: SomeInteger](v: var T; bit: BitsRange[T]) 292
nim flipBit bitops.html#flipBit,T,BitsRange[T: SomeInteger] proc flipBit[T: SomeInteger](v: var T; bit: BitsRange[T]) 301
nim setBits bitops.html#setBits.m,typed,varargs[typed] macro setBits(v: typed; bits: varargs[typed]): untyped 314
nim clearBits bitops.html#clearBits.m,typed,varargs[typed] macro clearBits(v: typed; bits: varargs[typed]): untyped 326
nim flipBits bitops.html#flipBits.m,typed,varargs[typed] macro flipBits(v: typed; bits: varargs[typed]): untyped 338
nim testBit bitops.html#testBit,T,BitsRange[T: SomeInteger] proc testBit[T: SomeInteger](v: T; bit: BitsRange[T]): bool 351
nim countSetBits bitops.html#countSetBits,SomeInteger proc countSetBits(x: SomeInteger): int 488
nim popcount bitops.html#popcount,SomeInteger proc popcount(x: SomeInteger): int 496
nim parityBits bitops.html#parityBits,SomeInteger proc parityBits(x: SomeInteger): int 500
nim firstSetBit bitops.html#firstSetBit,SomeInteger proc firstSetBit(x: SomeInteger): int 522
nim fastLog2 bitops.html#fastLog2,SomeInteger proc fastLog2(x: SomeInteger): int 565
nim countLeadingZeroBits bitops.html#countLeadingZeroBits,SomeInteger proc countLeadingZeroBits(x: SomeInteger): int 604
nim countTrailingZeroBits bitops.html#countTrailingZeroBits,SomeInteger proc countTrailingZeroBits(x: SomeInteger): int 632
nim rotateLeftBits bitops.html#rotateLeftBits,T,range[] proc rotateLeftBits[T: SomeUnsignedInt](value: T; shift: range[0 .. (sizeof(T) * 8)]): T 785
nim rotateRightBits bitops.html#rotateRightBits,T,range[] proc rotateRightBits[T: SomeUnsignedInt](value: T; shift: range[0 .. (sizeof(T) * 8)]): T 813
nim reverseBits bitops.html#reverseBits,T proc reverseBits[T: SomeUnsignedInt](x: T): T 848
idx Hamming weight bitops.html#hamming-weight_1 Module bitops 0
nimgrp flipmask bitops.html#flipMask-procs-all proc 261
nimgrp flipmasked bitops.html#flipMasked-procs-all proc 241
nimgrp masked bitops.html#masked-procs-all proc 107
nimgrp mask bitops.html#mask-procs-all proc 129
nimgrp clearmask bitops.html#clearMask-procs-all proc 217
nimgrp setmasked bitops.html#setMasked-procs-all proc 153
nimgrp clearmasked bitops.html#clearMasked-procs-all proc 195
nimgrp setmask bitops.html#setMask-procs-all proc 173

182
bitops_utils.html Normal file
View File

@@ -0,0 +1,182 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/private/bitops_utils</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/private/bitops_utils</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">castToUnsigned
<li><a class="reference" href="#castToUnsigned.t%2Cint" title="castToUnsigned(x: int): uint">castToUnsigned(x: int): uint</a></li>
<li><a class="reference" href="#castToUnsigned.t%2Cint8" title="castToUnsigned(x: int8): uint8">castToUnsigned(x: int8): uint8</a></li>
<li><a class="reference" href="#castToUnsigned.t%2Cint16" title="castToUnsigned(x: int16): uint16">castToUnsigned(x: int16): uint16</a></li>
<li><a class="reference" href="#castToUnsigned.t%2Cint32" title="castToUnsigned(x: int32): uint32">castToUnsigned(x: int32): uint32</a></li>
<li><a class="reference" href="#castToUnsigned.t%2Cint64" title="castToUnsigned(x: int64): uint64">castToUnsigned(x: int64): uint64</a></li>
<li><a class="reference" href="#castToUnsigned.t%2CT" title="castToUnsigned[T: SomeUnsignedInt](x: T): T">castToUnsigned[T: SomeUnsignedInt](x: T): T</a></li>
</ul>
<ul class="simple nested-toc-section">forwardImpl
<li><a class="reference" href="#forwardImpl.t%2C%2C" title="forwardImpl(impl, arg)">forwardImpl(impl, arg)</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/private/bitops_utils.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/private/bitops_utils.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="castToUnsigned-templates-all">
<div id="castToUnsigned.t,int">
<dt><pre><span class="Keyword">template</span> <a href="#castToUnsigned.t%2Cint"><span class="Identifier">castToUnsigned</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#uint"><span class="Identifier">uint</span></a></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/private/bitops_utils.nim#L21" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/private/bitops_utils.nim#L21" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="castToUnsigned.t,int8">
<dt><pre><span class="Keyword">template</span> <a href="#castToUnsigned.t%2Cint8"><span class="Identifier">castToUnsigned</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#int8"><span class="Identifier">int8</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#uint8"><span class="Identifier">uint8</span></a></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/private/bitops_utils.nim#L17" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/private/bitops_utils.nim#L17" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="castToUnsigned.t,int16">
<dt><pre><span class="Keyword">template</span> <a href="#castToUnsigned.t%2Cint16"><span class="Identifier">castToUnsigned</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#int16"><span class="Identifier">int16</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#uint16"><span class="Identifier">uint16</span></a></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/private/bitops_utils.nim#L18" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/private/bitops_utils.nim#L18" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="castToUnsigned.t,int32">
<dt><pre><span class="Keyword">template</span> <a href="#castToUnsigned.t%2Cint32"><span class="Identifier">castToUnsigned</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#int32"><span class="Identifier">int32</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#uint32"><span class="Identifier">uint32</span></a></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/private/bitops_utils.nim#L19" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/private/bitops_utils.nim#L19" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="castToUnsigned.t,int64">
<dt><pre><span class="Keyword">template</span> <a href="#castToUnsigned.t%2Cint64"><span class="Identifier">castToUnsigned</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#int64"><span class="Identifier">int64</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#uint64"><span class="Identifier">uint64</span></a></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/private/bitops_utils.nim#L20" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/private/bitops_utils.nim#L20" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="castToUnsigned.t,T">
<dt><pre><span class="Keyword">template</span> <a href="#castToUnsigned.t%2CT"><span class="Identifier">castToUnsigned</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="system.html#SomeUnsignedInt"><span class="Identifier">SomeUnsignedInt</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/private/bitops_utils.nim#L22" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/private/bitops_utils.nim#L22" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="forwardImpl-templates-all">
<div id="forwardImpl.t,,">
<dt><pre><span class="Keyword">template</span> <a href="#forwardImpl.t%2C%2C"><span class="Identifier">forwardImpl</span></a><span class="Other">(</span><span class="Identifier">impl</span><span class="Other">,</span> <span class="Identifier">arg</span><span class="Other">)</span> {.<span class="Identifier">dirty</span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/private/bitops_utils.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/private/bitops_utils.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:00 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

9
bitops_utils.idx Normal file
View File

@@ -0,0 +1,9 @@
nimTitle bitops_utils bitops_utils.html module std/private/bitops_utils 0
nim forwardImpl bitops_utils.html#forwardImpl.t,, template forwardImpl(impl, arg) 1
nim castToUnsigned bitops_utils.html#castToUnsigned.t,int8 template castToUnsigned(x: int8): uint8 17
nim castToUnsigned bitops_utils.html#castToUnsigned.t,int16 template castToUnsigned(x: int16): uint16 18
nim castToUnsigned bitops_utils.html#castToUnsigned.t,int32 template castToUnsigned(x: int32): uint32 19
nim castToUnsigned bitops_utils.html#castToUnsigned.t,int64 template castToUnsigned(x: int64): uint64 20
nim castToUnsigned bitops_utils.html#castToUnsigned.t,int template castToUnsigned(x: int): uint 21
nim castToUnsigned bitops_utils.html#castToUnsigned.t,T template castToUnsigned[T: SomeUnsignedInt](x: T): T 22
nimgrp casttounsigned bitops_utils.html#castToUnsigned-templates-all template 17

188
browsers.html Normal file
View File

@@ -0,0 +1,188 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/browsers</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/browsers</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#osOpenCmd" title="osOpenCmd = &quot;xdg-open&quot;">osOpenCmd</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">openDefaultBrowser
<li><a class="reference" href="#openDefaultBrowser" title="openDefaultBrowser()">openDefaultBrowser()</a></li>
<li><a class="reference" href="#openDefaultBrowser%2Cstring" title="openDefaultBrowser(url: string)">openDefaultBrowser(url: string)</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/browsers.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/browsers.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"><p>This module implements a simple proc for opening URLs with the user's default browser.</p>
<p>Unstable API.</p>
</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="since.html">since</a>, <a class="reference external" href="strutils.html">strutils</a>, <a class="reference external" href="assertions.html">assertions</a>, <a class="reference external" href="os.html">os</a>, <a class="reference external" href="osproc.html">osproc</a>
</dl>
</div>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="osOpenCmd">
<dt><pre><a href="browsers.html#osOpenCmd"><span class="Identifier">osOpenCmd</span></a> <span class="Other">=</span> <span class="StringLit">&quot;xdg-open&quot;</span></pre></dt>
<dd>
Alias for the operating system specific <em>&quot;open&quot;</em> command, <tt class="docutils literal"><span class="pre"><span class="StringLit">&quot;open&quot;</span></span></tt> on OSX, MacOS and Windows, <tt class="docutils literal"><span class="pre"><span class="StringLit">&quot;xdg-open&quot;</span></span></tt> on Linux, BSD, etc.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/browsers.nim#L32" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/browsers.nim#L32" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="openDefaultBrowser-procs-all">
<div id="openDefaultBrowser">
<dt><pre><span class="Keyword">proc</span> <a href="#openDefaultBrowser"><span class="Identifier">openDefaultBrowser</span></a><span class="Other">(</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">&quot;not implemented, please open with a specific url instead&quot;</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ExecIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<div class="deprecation-message">
<b>Deprecated:</b> not implemented, please open with a specific url instead
</div>
<p>Intends to open the user's default browser without any <tt class="docutils literal"><span class="pre"><span class="Identifier">url</span></span></tt> (blank page). This does not block. Intends to implement IETF RFC-6694 Section 3, (&quot;about:blank&quot; is reserved for a blank page).</p>
<p>Beware that this intended behavior is <strong>not</strong> implemented and considered not worthy to implement here.</p>
<p>The following describes the behavior of current implementation:</p>
<ul class="simple"><li>Under Windows, this will only cause a pop-up dialog
asking the assocated application with <tt class="docutils literal"><span class="pre"><span class="Identifier">about</span></span></tt>
(as Windows simply treats <tt class="docutils literal"><span class="pre"><span class="Identifier">about</span><span class="Punctuation">:</span></span></tt> as a protocol like <tt class="docutils literal"><span class="pre"><span class="Identifier">http</span></span></tt>).</li>
<li>Under Mac OS X the <tt class="docutils literal"><span class="pre"><span class="Identifier">open</span> <span class="StringLit">&quot;about:blank&quot;</span></span></tt> command is used.</li>
<li>Under Unix, it is checked if <tt class="docutils literal"><span class="pre"><span class="Identifier">xdg</span><span class="Operator">-</span><span class="Identifier">open</span></span></tt> exists and used
if it does and open the application assocated with <tt class="docutils literal"><span class="pre"><span class="Identifier">text</span><span class="Operator">/</span><span class="Identifier">html</span></span></tt> mime
(not <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span><span class="Operator">-</span><span class="Identifier">scheme</span><span class="Operator">-</span><span class="Identifier">handler</span><span class="Operator">/</span><span class="Identifier">http</span></span></tt>, so maybe html-viewer
other than your default browser is opened).
Otherwise the environment variable <tt class="docutils literal"><span class="pre"><span class="Identifier">BROWSER</span></span></tt> is used
to determine the default browser to use.</li>
</ul>
<p>This proc doesn't raise an exception on error, beware.</p>
<p><pre class="listing"><span class="Keyword">block</span><span class="Punctuation">:</span> <span class="Identifier">openDefaultBrowser</span><span class="Punctuation">(</span><span class="Punctuation">)</span></pre></p>
<p><strong>See also:</strong></p>
<ul class="simple"><li><a class="reference external" href="https://tools.ietf.org/html/rfc6694#section-3">https://tools.ietf.org/html/rfc6694#section-3</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/browsers.nim#L80" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/browsers.nim#L80" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="openDefaultBrowser,string">
<dt><pre><span class="Keyword">proc</span> <a href="#openDefaultBrowser%2Cstring"><span class="Identifier">openDefaultBrowser</span></a><span class="Other">(</span><span class="Identifier">url</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ExecIOEffect</span><span class="Other">,</span>
<span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Opens <tt class="docutils literal"><span class="pre"><span class="Identifier">url</span></span></tt> with the user's default browser. This does not block. The URL must not be empty string, to open on a blank page see <tt class="docutils literal"><span class="pre"><span class="Identifier">openDefaultBrowser</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt>.</p>
<p>Under Windows, <tt class="docutils literal"><span class="pre"><span class="Identifier">ShellExecute</span></span></tt> is used. Under Mac OS X the <tt class="docutils literal"><span class="pre"><span class="Identifier">open</span></span></tt> command is used. Under Unix, it is checked if <tt class="docutils literal"><span class="pre"><span class="Identifier">xdg</span><span class="Operator">-</span><span class="Identifier">open</span></span></tt> exists and used if it does. Otherwise the environment variable <tt class="docutils literal"><span class="pre"><span class="Identifier">BROWSER</span></span></tt> is used to determine the default browser to use.</p>
<p>This proc doesn't raise an exception on error, beware.</p>
<p><pre class="listing"><span class="Keyword">block</span><span class="Punctuation">:</span> <span class="Identifier">openDefaultBrowser</span><span class="Punctuation">(</span><span class="StringLit">&quot;https://nim-lang.org&quot;</span><span class="Punctuation">)</span></pre></p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/browsers.nim#L63" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/browsers.nim#L63" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:07:45 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

5
browsers.idx Normal file
View File

@@ -0,0 +1,5 @@
nimTitle browsers browsers.html module std/browsers 0
nim osOpenCmd browsers.html#osOpenCmd const osOpenCmd 32
nim openDefaultBrowser browsers.html#openDefaultBrowser,string proc openDefaultBrowser(url: string) 63
nim openDefaultBrowser browsers.html#openDefaultBrowser proc openDefaultBrowser() 80
nimgrp opendefaultbrowser browsers.html#openDefaultBrowser-procs-all proc 63

990
cgi.html Normal file
View File

@@ -0,0 +1,990 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/cgi</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/cgi</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#CgiError" title="CgiError = object of IOError">CgiError</a></li>
<li><a class="reference" href="#RequestMethod" title="RequestMethod = enum
methodNone, ## no REQUEST_METHOD environment variable
methodPost, ## query uses the POST method
methodGet ## query uses the GET method">RequestMethod</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">cgiError
<li><a class="reference" href="#cgiError%2Cstring" title="cgiError(msg: string)">cgiError(msg: string)</a></li>
</ul>
<ul class="simple nested-toc-section">existsCookie
<li><a class="reference" href="#existsCookie%2Cstring" title="existsCookie(name: string): bool">existsCookie(name: string): bool</a></li>
</ul>
<ul class="simple nested-toc-section">getContentLength
<li><a class="reference" href="#getContentLength" title="getContentLength(): string">getContentLength(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getContentType
<li><a class="reference" href="#getContentType" title="getContentType(): string">getContentType(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getCookie
<li><a class="reference" href="#getCookie%2Cstring" title="getCookie(name: string): string">getCookie(name: string): string</a></li>
</ul>
<ul class="simple nested-toc-section">getDocumentRoot
<li><a class="reference" href="#getDocumentRoot" title="getDocumentRoot(): string">getDocumentRoot(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getGatewayInterface
<li><a class="reference" href="#getGatewayInterface" title="getGatewayInterface(): string">getGatewayInterface(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getHttpAccept
<li><a class="reference" href="#getHttpAccept" title="getHttpAccept(): string">getHttpAccept(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getHttpAcceptCharset
<li><a class="reference" href="#getHttpAcceptCharset" title="getHttpAcceptCharset(): string">getHttpAcceptCharset(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getHttpAcceptEncoding
<li><a class="reference" href="#getHttpAcceptEncoding" title="getHttpAcceptEncoding(): string">getHttpAcceptEncoding(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getHttpAcceptLanguage
<li><a class="reference" href="#getHttpAcceptLanguage" title="getHttpAcceptLanguage(): string">getHttpAcceptLanguage(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getHttpConnection
<li><a class="reference" href="#getHttpConnection" title="getHttpConnection(): string">getHttpConnection(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getHttpCookie
<li><a class="reference" href="#getHttpCookie" title="getHttpCookie(): string">getHttpCookie(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getHttpHost
<li><a class="reference" href="#getHttpHost" title="getHttpHost(): string">getHttpHost(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getHttpReferer
<li><a class="reference" href="#getHttpReferer" title="getHttpReferer(): string">getHttpReferer(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getHttpUserAgent
<li><a class="reference" href="#getHttpUserAgent" title="getHttpUserAgent(): string">getHttpUserAgent(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getPathInfo
<li><a class="reference" href="#getPathInfo" title="getPathInfo(): string">getPathInfo(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getPathTranslated
<li><a class="reference" href="#getPathTranslated" title="getPathTranslated(): string">getPathTranslated(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getQueryString
<li><a class="reference" href="#getQueryString" title="getQueryString(): string">getQueryString(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getRemoteAddr
<li><a class="reference" href="#getRemoteAddr" title="getRemoteAddr(): string">getRemoteAddr(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getRemoteHost
<li><a class="reference" href="#getRemoteHost" title="getRemoteHost(): string">getRemoteHost(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getRemoteIdent
<li><a class="reference" href="#getRemoteIdent" title="getRemoteIdent(): string">getRemoteIdent(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getRemotePort
<li><a class="reference" href="#getRemotePort" title="getRemotePort(): string">getRemotePort(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getRemoteUser
<li><a class="reference" href="#getRemoteUser" title="getRemoteUser(): string">getRemoteUser(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getRequestMethod
<li><a class="reference" href="#getRequestMethod" title="getRequestMethod(): string">getRequestMethod(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getRequestURI
<li><a class="reference" href="#getRequestURI" title="getRequestURI(): string">getRequestURI(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getScriptFilename
<li><a class="reference" href="#getScriptFilename" title="getScriptFilename(): string">getScriptFilename(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getScriptName
<li><a class="reference" href="#getScriptName" title="getScriptName(): string">getScriptName(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getServerAddr
<li><a class="reference" href="#getServerAddr" title="getServerAddr(): string">getServerAddr(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getServerAdmin
<li><a class="reference" href="#getServerAdmin" title="getServerAdmin(): string">getServerAdmin(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getServerName
<li><a class="reference" href="#getServerName" title="getServerName(): string">getServerName(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getServerPort
<li><a class="reference" href="#getServerPort" title="getServerPort(): string">getServerPort(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getServerProtocol
<li><a class="reference" href="#getServerProtocol" title="getServerProtocol(): string">getServerProtocol(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getServerSignature
<li><a class="reference" href="#getServerSignature" title="getServerSignature(): string">getServerSignature(): string</a></li>
</ul>
<ul class="simple nested-toc-section">getServerSoftware
<li><a class="reference" href="#getServerSoftware" title="getServerSoftware(): string">getServerSoftware(): string</a></li>
</ul>
<ul class="simple nested-toc-section">readData
<li><a class="reference" href="#readData%2Cset%5BRequestMethod%5D" title="readData(allowedMethods: set[RequestMethod] = {methodNone, methodPost, methodGet}): StringTableRef">readData(allowedMethods: set[RequestMethod] = {methodNone, methodPost, methodGet}): StringTableRef</a></li>
<li><a class="reference" href="#readData%2Cstring" title="readData(data: string): StringTableRef">readData(data: string): StringTableRef</a></li>
</ul>
<ul class="simple nested-toc-section">setCookie
<li><a class="reference" href="#setCookie%2Cstring%2Cstring" title="setCookie(name, value: string)">setCookie(name, value: string)</a></li>
</ul>
<ul class="simple nested-toc-section">setStackTraceStdout
<li><a class="reference" href="#setStackTraceStdout" title="setStackTraceStdout()">setStackTraceStdout()</a></li>
</ul>
<ul class="simple nested-toc-section">setTestData
<li><a class="reference" href="#setTestData%2Cvarargs%5Bstring%5D" title="setTestData(keysvalues: varargs[string])">setTestData(keysvalues: varargs[string])</a></li>
</ul>
<ul class="simple nested-toc-section">validateData
<li><a class="reference" href="#validateData%2CStringTableRef%2Cvarargs%5Bstring%5D" title="validateData(data: StringTableRef; validKeys: varargs[string])">validateData(data: StringTableRef; validKeys: varargs[string])</a></li>
</ul>
<ul class="simple nested-toc-section">writeContentType
<li><a class="reference" href="#writeContentType" title="writeContentType()">writeContentType()</a></li>
</ul>
<ul class="simple nested-toc-section">writeErrorMessage
<li><a class="reference" href="#writeErrorMessage%2Cstring" title="writeErrorMessage(data: string)">writeErrorMessage(data: string)</a></li>
</ul>
<ul class="simple nested-toc-section">xmlEncode
<li><a class="reference" href="#xmlEncode%2Cstring" title="xmlEncode(s: string): string">xmlEncode(s: string): string</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#15" id="65">Iterators</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">decodeData
<li><a class="reference" href="#decodeData.i%2Cset%5BRequestMethod%5D" title="decodeData(allowedMethods: set[RequestMethod] = {methodNone, methodPost,
methodGet}): tuple[key, value: string]">decodeData(allowedMethods: set[RequestMethod] = {methodNone, methodPost,
methodGet}): tuple[key, value: string]</a></li>
<li><a class="reference" href="#decodeData.i%2Cstring" title="decodeData(data: string): tuple[key, value: string]">decodeData(data: string): tuple[key, value: string]</a></li>
</ul>
</ul>
</details>
</li>
<li>
<a class="reference reference-toplevel" href="#19" id="69">Exports</a>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"><p>This module implements helper procs for CGI applications. Example:</p>
<p><pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Punctuation">[</span><span class="Identifier">strtabs</span><span class="Punctuation">,</span> <span class="Identifier">cgi</span><span class="Punctuation">]</span>
<span class="Comment"># Fill the values when debugging:</span>
<span class="Keyword">when</span> <span class="Identifier">debug</span><span class="Punctuation">:</span>
<span class="Identifier">setTestData</span><span class="Punctuation">(</span><span class="StringLit">&quot;name&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;Klaus&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;password&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;123456&quot;</span><span class="Punctuation">)</span>
<span class="Comment"># read the data into `myData`</span>
<span class="Keyword">var</span> <span class="Identifier">myData</span> <span class="Operator">=</span> <span class="Identifier">readData</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Comment"># check that the data's variable names are &quot;name&quot; or &quot;password&quot;</span>
<span class="Identifier">validateData</span><span class="Punctuation">(</span><span class="Identifier">myData</span><span class="Punctuation">,</span> <span class="StringLit">&quot;name&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;password&quot;</span><span class="Punctuation">)</span>
<span class="Comment"># start generating content:</span>
<span class="Identifier">writeContentType</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Comment"># generate content:</span>
<span class="Identifier">write</span><span class="Punctuation">(</span><span class="Identifier">stdout</span><span class="Punctuation">,</span> <span class="StringLit">&quot;&lt;!DOCTYPE HTML PUBLIC </span><span class="EscapeSequence">\&quot;</span><span class="StringLit">-//W3C//DTD HTML 4.01//EN</span><span class="EscapeSequence">\&quot;</span><span class="StringLit">&gt;</span><span class="EscapeSequence">\n</span><span class="StringLit">&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">write</span><span class="Punctuation">(</span><span class="Identifier">stdout</span><span class="Punctuation">,</span> <span class="StringLit">&quot;&lt;html&gt;&lt;head&gt;&lt;title&gt;Test&lt;/title&gt;&lt;/head&gt;&lt;body&gt;</span><span class="EscapeSequence">\n</span><span class="StringLit">&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">writeLine</span><span class="Punctuation">(</span><span class="Identifier">stdout</span><span class="Punctuation">,</span> <span class="StringLit">&quot;your name: &quot;</span> <span class="Operator">&amp;</span> <span class="Identifier">myData</span><span class="Punctuation">[</span><span class="StringLit">&quot;name&quot;</span><span class="Punctuation">]</span><span class="Punctuation">)</span>
<span class="Identifier">writeLine</span><span class="Punctuation">(</span><span class="Identifier">stdout</span><span class="Punctuation">,</span> <span class="StringLit">&quot;your password: &quot;</span> <span class="Operator">&amp;</span> <span class="Identifier">myData</span><span class="Punctuation">[</span><span class="StringLit">&quot;password&quot;</span><span class="Punctuation">]</span><span class="Punctuation">)</span>
<span class="Identifier">writeLine</span><span class="Punctuation">(</span><span class="Identifier">stdout</span><span class="Punctuation">,</span> <span class="StringLit">&quot;&lt;/body&gt;&lt;/html&gt;&quot;</span><span class="Punctuation">)</span></pre></p>
</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="strutils.html">strutils</a>, <a class="reference external" href="os.html">os</a>, <a class="reference external" href="strtabs.html">strtabs</a>, <a class="reference external" href="cookies.html">cookies</a>, <a class="reference external" href="uri.html">uri</a>, <a class="reference external" href="syncio.html">syncio</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="CgiError">
<dt><pre><a href="cgi.html#CgiError"><span class="Identifier">CgiError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="exceptions.html#IOError"><span class="Identifier">IOError</span></a></pre></dt>
<dd>
Exception that is raised if a CGI error occurs.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L58" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L58" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="RequestMethod">
<dt><pre><a href="cgi.html#RequestMethod"><span class="Identifier">RequestMethod</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">methodNone</span><span class="Other">,</span> <span class="Comment">## no REQUEST_METHOD environment variable</span>
<span class="Identifier">methodPost</span><span class="Other">,</span> <span class="Comment">## query uses the POST method</span>
<span class="Identifier">methodGet</span> <span class="Comment">## query uses the GET method</span></pre></dt>
<dd>
The used request method.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L59" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L59" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="cgiError-procs-all">
<div id="cgiError,string">
<dt><pre><span class="Keyword">proc</span> <a href="#cgiError%2Cstring"><span class="Identifier">cgiError</span></a><span class="Other">(</span><span class="Identifier">msg</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span> {.<span class="Identifier">noreturn</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">CgiError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Raises a <tt class="docutils literal"><span class="pre"><span class="Identifier">CgiError</span></span></tt> exception with message <tt class="docutils literal"><span class="pre"><span class="Identifier">msg</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L64" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L64" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="existsCookie-procs-all">
<div id="existsCookie,string">
<dt><pre><span class="Keyword">proc</span> <a href="#existsCookie%2Cstring"><span class="Identifier">existsCookie</span></a><span class="Other">(</span><span class="Identifier">name</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Checks if a cookie of <tt class="docutils literal"><span class="pre"><span class="Identifier">name</span></span></tt> exists.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L317" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L317" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getContentLength-procs-all">
<div id="getContentLength">
<dt><pre><span class="Keyword">proc</span> <a href="#getContentLength"><span class="Identifier">getContentLength</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">CONTENT_LENGTH</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L125" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L125" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getContentType-procs-all">
<div id="getContentType">
<dt><pre><span class="Keyword">proc</span> <a href="#getContentType"><span class="Identifier">getContentType</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">CONTENT_TYPE</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L129" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L129" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getCookie-procs-all">
<div id="getCookie,string">
<dt><pre><span class="Keyword">proc</span> <a href="#getCookie%2Cstring"><span class="Identifier">getCookie</span></a><span class="Other">(</span><span class="Identifier">name</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Gets a cookie. If no cookie of <tt class="docutils literal"><span class="pre"><span class="Identifier">name</span></span></tt> exists, &quot;&quot; is returned.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L312" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L312" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getDocumentRoot-procs-all">
<div id="getDocumentRoot">
<dt><pre><span class="Keyword">proc</span> <a href="#getDocumentRoot"><span class="Identifier">getDocumentRoot</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">DOCUMENT_ROOT</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L133" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L133" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getGatewayInterface-procs-all">
<div id="getGatewayInterface">
<dt><pre><span class="Keyword">proc</span> <a href="#getGatewayInterface"><span class="Identifier">getGatewayInterface</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">GATEWAY_INTERFACE</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L137" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L137" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getHttpAccept-procs-all">
<div id="getHttpAccept">
<dt><pre><span class="Keyword">proc</span> <a href="#getHttpAccept"><span class="Identifier">getHttpAccept</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">HTTP_ACCEPT</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L141" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L141" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getHttpAcceptCharset-procs-all">
<div id="getHttpAcceptCharset">
<dt><pre><span class="Keyword">proc</span> <a href="#getHttpAcceptCharset"><span class="Identifier">getHttpAcceptCharset</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">HTTP_ACCEPT_CHARSET</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L145" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L145" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getHttpAcceptEncoding-procs-all">
<div id="getHttpAcceptEncoding">
<dt><pre><span class="Keyword">proc</span> <a href="#getHttpAcceptEncoding"><span class="Identifier">getHttpAcceptEncoding</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">HTTP_ACCEPT_ENCODING</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L149" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L149" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getHttpAcceptLanguage-procs-all">
<div id="getHttpAcceptLanguage">
<dt><pre><span class="Keyword">proc</span> <a href="#getHttpAcceptLanguage"><span class="Identifier">getHttpAcceptLanguage</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">HTTP_ACCEPT_LANGUAGE</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L153" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L153" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getHttpConnection-procs-all">
<div id="getHttpConnection">
<dt><pre><span class="Keyword">proc</span> <a href="#getHttpConnection"><span class="Identifier">getHttpConnection</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">HTTP_CONNECTION</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L157" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L157" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getHttpCookie-procs-all">
<div id="getHttpCookie">
<dt><pre><span class="Keyword">proc</span> <a href="#getHttpCookie"><span class="Identifier">getHttpCookie</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">HTTP_COOKIE</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L161" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L161" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getHttpHost-procs-all">
<div id="getHttpHost">
<dt><pre><span class="Keyword">proc</span> <a href="#getHttpHost"><span class="Identifier">getHttpHost</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">HTTP_HOST</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L165" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L165" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getHttpReferer-procs-all">
<div id="getHttpReferer">
<dt><pre><span class="Keyword">proc</span> <a href="#getHttpReferer"><span class="Identifier">getHttpReferer</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">HTTP_REFERER</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L169" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L169" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getHttpUserAgent-procs-all">
<div id="getHttpUserAgent">
<dt><pre><span class="Keyword">proc</span> <a href="#getHttpUserAgent"><span class="Identifier">getHttpUserAgent</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">HTTP_USER_AGENT</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L173" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L173" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getPathInfo-procs-all">
<div id="getPathInfo">
<dt><pre><span class="Keyword">proc</span> <a href="#getPathInfo"><span class="Identifier">getPathInfo</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">PATH_INFO</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L177" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L177" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getPathTranslated-procs-all">
<div id="getPathTranslated">
<dt><pre><span class="Keyword">proc</span> <a href="#getPathTranslated"><span class="Identifier">getPathTranslated</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">PATH_TRANSLATED</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L181" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L181" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getQueryString-procs-all">
<div id="getQueryString">
<dt><pre><span class="Keyword">proc</span> <a href="#getQueryString"><span class="Identifier">getQueryString</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">QUERY_STRING</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L185" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L185" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getRemoteAddr-procs-all">
<div id="getRemoteAddr">
<dt><pre><span class="Keyword">proc</span> <a href="#getRemoteAddr"><span class="Identifier">getRemoteAddr</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">REMOTE_ADDR</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L189" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L189" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getRemoteHost-procs-all">
<div id="getRemoteHost">
<dt><pre><span class="Keyword">proc</span> <a href="#getRemoteHost"><span class="Identifier">getRemoteHost</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">REMOTE_HOST</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L193" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L193" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getRemoteIdent-procs-all">
<div id="getRemoteIdent">
<dt><pre><span class="Keyword">proc</span> <a href="#getRemoteIdent"><span class="Identifier">getRemoteIdent</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">REMOTE_IDENT</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L197" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L197" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getRemotePort-procs-all">
<div id="getRemotePort">
<dt><pre><span class="Keyword">proc</span> <a href="#getRemotePort"><span class="Identifier">getRemotePort</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">REMOTE_PORT</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L201" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L201" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getRemoteUser-procs-all">
<div id="getRemoteUser">
<dt><pre><span class="Keyword">proc</span> <a href="#getRemoteUser"><span class="Identifier">getRemoteUser</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">REMOTE_USER</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L205" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L205" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getRequestMethod-procs-all">
<div id="getRequestMethod">
<dt><pre><span class="Keyword">proc</span> <a href="#getRequestMethod"><span class="Identifier">getRequestMethod</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">REQUEST_METHOD</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L209" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L209" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getRequestURI-procs-all">
<div id="getRequestURI">
<dt><pre><span class="Keyword">proc</span> <a href="#getRequestURI"><span class="Identifier">getRequestURI</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">REQUEST_URI</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L213" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L213" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getScriptFilename-procs-all">
<div id="getScriptFilename">
<dt><pre><span class="Keyword">proc</span> <a href="#getScriptFilename"><span class="Identifier">getScriptFilename</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">SCRIPT_FILENAME</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L217" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L217" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getScriptName-procs-all">
<div id="getScriptName">
<dt><pre><span class="Keyword">proc</span> <a href="#getScriptName"><span class="Identifier">getScriptName</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">SCRIPT_NAME</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L221" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L221" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getServerAddr-procs-all">
<div id="getServerAddr">
<dt><pre><span class="Keyword">proc</span> <a href="#getServerAddr"><span class="Identifier">getServerAddr</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">SERVER_ADDR</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L225" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L225" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getServerAdmin-procs-all">
<div id="getServerAdmin">
<dt><pre><span class="Keyword">proc</span> <a href="#getServerAdmin"><span class="Identifier">getServerAdmin</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">SERVER_ADMIN</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L229" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L229" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getServerName-procs-all">
<div id="getServerName">
<dt><pre><span class="Keyword">proc</span> <a href="#getServerName"><span class="Identifier">getServerName</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">SERVER_NAME</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L233" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L233" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getServerPort-procs-all">
<div id="getServerPort">
<dt><pre><span class="Keyword">proc</span> <a href="#getServerPort"><span class="Identifier">getServerPort</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">SERVER_PORT</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L237" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L237" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getServerProtocol-procs-all">
<div id="getServerProtocol">
<dt><pre><span class="Keyword">proc</span> <a href="#getServerProtocol"><span class="Identifier">getServerProtocol</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">SERVER_PROTOCOL</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L241" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L241" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getServerSignature-procs-all">
<div id="getServerSignature">
<dt><pre><span class="Keyword">proc</span> <a href="#getServerSignature"><span class="Identifier">getServerSignature</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">SERVER_SIGNATURE</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L245" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L245" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getServerSoftware-procs-all">
<div id="getServerSoftware">
<dt><pre><span class="Keyword">proc</span> <a href="#getServerSoftware"><span class="Identifier">getServerSoftware</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns contents of the <tt class="docutils literal"><span class="pre"><span class="Identifier">SERVER_SOFTWARE</span></span></tt> environment variable.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L249" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L249" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="readData-procs-all">
<div id="readData,set[RequestMethod]">
<dt><pre><span class="Keyword">proc</span> <a href="#readData%2Cset%5BRequestMethod%5D"><span class="Identifier">readData</span></a><span class="Other">(</span><span class="Identifier">allowedMethods</span><span class="Other">:</span> <a href="system.html#set"><span class="Identifier">set</span></a><span class="Other">[</span><a href="cgi.html#RequestMethod"><span class="Identifier">RequestMethod</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Identifier">methodNone</span><span class="Other">,</span> <span class="Identifier">methodPost</span><span class="Other">,</span>
<span class="Identifier">methodGet</span><span class="Other">}</span><span class="Other">)</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">CgiError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Reads CGI data. If the client does not use a method listed in the <tt class="docutils literal"><span class="pre"><span class="Identifier">allowedMethods</span></span></tt> set, a <tt class="docutils literal"><span class="pre"><span class="Identifier">CgiError</span></span></tt> exception is raised.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L104" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L104" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="readData,string">
<dt><pre><span class="Keyword">proc</span> <a href="#readData%2Cstring"><span class="Identifier">readData</span></a><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Reads CGI data from a string.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L112" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L112" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="setCookie-procs-all">
<div id="setCookie,string,string">
<dt><pre><span class="Keyword">proc</span> <a href="#setCookie%2Cstring%2Cstring"><span class="Identifier">setCookie</span></a><span class="Other">(</span><span class="Identifier">name</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Sets a cookie.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L305" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L305" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="setStackTraceStdout-procs-all">
<div id="setStackTraceStdout">
<dt><pre><span class="Keyword">proc</span> <a href="#setStackTraceStdout"><span class="Identifier">setStackTraceStdout</span></a><span class="Other">(</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Makes Nim output stacktraces to stdout, instead of server log.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L301" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L301" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="setTestData-procs-all">
<div id="setTestData,varargs[string]">
<dt><pre><span class="Keyword">proc</span> <a href="#setTestData%2Cvarargs%5Bstring%5D"><span class="Identifier">setTestData</span></a><span class="Other">(</span><span class="Identifier">keysvalues</span><span class="Other">:</span> <a href="system.html#varargs"><span class="Identifier">varargs</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Fills the appropriate environment variables to test your CGI application. This can only simulate the 'GET' request method. <tt class="docutils literal"><span class="pre"><span class="Identifier">keysvalues</span></span></tt> should provide embedded (name, value)-pairs. Example:</p>
<p><pre class="listing"><span class="Identifier">setTestData</span><span class="Punctuation">(</span><span class="StringLit">&quot;name&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;Hanz&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;password&quot;</span><span class="Punctuation">,</span> <span class="StringLit">&quot;12345&quot;</span><span class="Punctuation">)</span></pre></p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L253" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L253" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="validateData-procs-all">
<div id="validateData,StringTableRef,varargs[string]">
<dt><pre><span class="Keyword">proc</span> <a href="#validateData%2CStringTableRef%2Cvarargs%5Bstring%5D"><span class="Identifier">validateData</span></a><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <a href="strtabs.html#StringTableRef"><span class="Identifier">StringTableRef</span></a><span class="Other">;</span> <span class="Identifier">validKeys</span><span class="Other">:</span> <a href="system.html#varargs"><span class="Identifier">varargs</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">CgiError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Validates data; raises <tt class="docutils literal"><span class="pre"><span class="Identifier">CgiError</span></span></tt> if this fails. This checks that each variable name of the CGI <tt class="docutils literal"><span class="pre"><span class="Identifier">data</span></span></tt> occurs in the <tt class="docutils literal"><span class="pre"><span class="Identifier">validKeys</span></span></tt> array.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L118" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L118" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="writeContentType-procs-all">
<div id="writeContentType">
<dt><pre><span class="Keyword">proc</span> <a href="#writeContentType"><span class="Identifier">writeContentType</span></a><span class="Other">(</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Calls this before starting to send your HTML data to <tt class="docutils literal"><span class="pre"><span class="Identifier">stdout</span></span></tt>. This implements this part of the CGI protocol:</p>
<p><pre class="listing"><span class="Identifier">write</span><span class="Punctuation">(</span><span class="Identifier">stdout</span><span class="Punctuation">,</span> <span class="StringLit">&quot;Content-type: text/html</span><span class="EscapeSequence">\n</span><span class="EscapeSequence">\n</span><span class="StringLit">&quot;</span><span class="Punctuation">)</span></pre></p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L271" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L271" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="writeErrorMessage-procs-all">
<div id="writeErrorMessage,string">
<dt><pre><span class="Keyword">proc</span> <a href="#writeErrorMessage%2Cstring"><span class="Identifier">writeErrorMessage</span></a><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Tries to reset browser state and writes <tt class="docutils literal"><span class="pre"><span class="Identifier">data</span></span></tt> to stdout in &lt;plaintext&gt; tag.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L289" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L289" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="xmlEncode-procs-all">
<div id="xmlEncode,string">
<dt><pre><span class="Keyword">proc</span> <a href="#xmlEncode%2Cstring"><span class="Identifier">xmlEncode</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Encodes a value to be XML safe:<ul class="simple"><li><tt class="docutils literal"><span class="pre"><span class="StringLit">&quot;</span></span></tt> is replaced by <tt class="docutils literal"><span class="pre"><span class="Operator">&amp;</span><span class="Identifier">quot</span><span class="Punctuation">;</span></span></tt></li>
<li><tt class="docutils literal"><span class="pre"><span class="Operator">&lt;</span></span></tt> is replaced by <tt class="docutils literal"><span class="pre"><span class="Operator">&amp;</span><span class="Identifier">lt</span><span class="Punctuation">;</span></span></tt></li>
<li><tt class="docutils literal"><span class="pre"><span class="Operator">&gt;</span></span></tt> is replaced by <tt class="docutils literal"><span class="pre"><span class="Operator">&amp;</span><span class="Identifier">gt</span><span class="Punctuation">;</span></span></tt></li>
<li><tt class="docutils literal"><span class="pre"><span class="Operator">&amp;</span></span></tt> is replaced by <tt class="docutils literal"><span class="pre"><span class="Operator">&amp;</span><span class="Identifier">amp</span><span class="Punctuation">;</span></span></tt></li>
<li>every other character is carried over.</li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L47" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L47" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="15">
<h1><a class="toc-backref" href="#15">Iterators</a></h1>
<dl class="item">
<div id="decodeData-iterators-all">
<div id="decodeData.i,set[RequestMethod]">
<dt><pre><span class="Keyword">iterator</span> <a href="#decodeData.i%2Cset%5BRequestMethod%5D"><span class="Identifier">decodeData</span></a><span class="Other">(</span><span class="Identifier">allowedMethods</span><span class="Other">:</span> <a href="system.html#set"><span class="Identifier">set</span></a><span class="Other">[</span><a href="cgi.html#RequestMethod"><span class="Identifier">RequestMethod</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Identifier">methodNone</span><span class="Other">,</span>
<span class="Identifier">methodPost</span><span class="Other">,</span> <span class="Identifier">methodGet</span><span class="Other">}</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">key</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">CgiError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Reads and decodes CGI data and yields the (name, value) pairs the data consists of. If the client does not use a method listed in the <tt class="docutils literal"><span class="pre"><span class="Identifier">allowedMethods</span></span></tt> set, a <tt class="docutils literal"><span class="pre"><span class="Identifier">CgiError</span></span></tt> exception is raised.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L95" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L95" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="decodeData.i,string">
<dt><pre><span class="Keyword">iterator</span> <a href="#decodeData.i%2Cstring"><span class="Identifier">decodeData</span></a><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">key</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Reads and decodes CGI data and yields the (name, value) pairs the data consists of.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/cgi.nim#L89" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/cgi.nim#L89" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="19">
<h1><a class="toc-backref" href="#19">Exports</a></h1>
<dl class="item">
<a href="uri.html#encodeUrl,string"><span class="Identifier">encodeUrl</span></a>, <a href="uri.html#decodeUrl,string"><span class="Identifier">decodeUrl</span></a>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:07:34 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

54
cgi.idx Normal file
View File

@@ -0,0 +1,54 @@
nimTitle cgi cgi.html module std/cgi 0
nim xmlEncode cgi.html#xmlEncode,string proc xmlEncode(s: string): string 47
nim CgiError cgi.html#CgiError object CgiError 58
nim methodNone cgi.html#methodNone RequestMethod.methodNone 59
nim methodPost cgi.html#methodPost RequestMethod.methodPost 59
nim methodGet cgi.html#methodGet RequestMethod.methodGet 59
nim RequestMethod cgi.html#RequestMethod enum RequestMethod 59
nim cgiError cgi.html#cgiError,string proc cgiError(msg: string) 64
nim decodeData cgi.html#decodeData.i,string iterator decodeData(data: string): tuple[key, value: string] 89
nim decodeData cgi.html#decodeData.i,set[RequestMethod] iterator decodeData(allowedMethods: set[RequestMethod] = {methodNone, methodPost,\n methodGet}): tuple[key, value: string] 95
nim readData cgi.html#readData,set[RequestMethod] proc readData(allowedMethods: set[RequestMethod] = {methodNone, methodPost, methodGet}): StringTableRef 104
nim readData cgi.html#readData,string proc readData(data: string): StringTableRef 112
nim validateData cgi.html#validateData,StringTableRef,varargs[string] proc validateData(data: StringTableRef; validKeys: varargs[string]) 118
nim getContentLength cgi.html#getContentLength proc getContentLength(): string 125
nim getContentType cgi.html#getContentType proc getContentType(): string 129
nim getDocumentRoot cgi.html#getDocumentRoot proc getDocumentRoot(): string 133
nim getGatewayInterface cgi.html#getGatewayInterface proc getGatewayInterface(): string 137
nim getHttpAccept cgi.html#getHttpAccept proc getHttpAccept(): string 141
nim getHttpAcceptCharset cgi.html#getHttpAcceptCharset proc getHttpAcceptCharset(): string 145
nim getHttpAcceptEncoding cgi.html#getHttpAcceptEncoding proc getHttpAcceptEncoding(): string 149
nim getHttpAcceptLanguage cgi.html#getHttpAcceptLanguage proc getHttpAcceptLanguage(): string 153
nim getHttpConnection cgi.html#getHttpConnection proc getHttpConnection(): string 157
nim getHttpCookie cgi.html#getHttpCookie proc getHttpCookie(): string 161
nim getHttpHost cgi.html#getHttpHost proc getHttpHost(): string 165
nim getHttpReferer cgi.html#getHttpReferer proc getHttpReferer(): string 169
nim getHttpUserAgent cgi.html#getHttpUserAgent proc getHttpUserAgent(): string 173
nim getPathInfo cgi.html#getPathInfo proc getPathInfo(): string 177
nim getPathTranslated cgi.html#getPathTranslated proc getPathTranslated(): string 181
nim getQueryString cgi.html#getQueryString proc getQueryString(): string 185
nim getRemoteAddr cgi.html#getRemoteAddr proc getRemoteAddr(): string 189
nim getRemoteHost cgi.html#getRemoteHost proc getRemoteHost(): string 193
nim getRemoteIdent cgi.html#getRemoteIdent proc getRemoteIdent(): string 197
nim getRemotePort cgi.html#getRemotePort proc getRemotePort(): string 201
nim getRemoteUser cgi.html#getRemoteUser proc getRemoteUser(): string 205
nim getRequestMethod cgi.html#getRequestMethod proc getRequestMethod(): string 209
nim getRequestURI cgi.html#getRequestURI proc getRequestURI(): string 213
nim getScriptFilename cgi.html#getScriptFilename proc getScriptFilename(): string 217
nim getScriptName cgi.html#getScriptName proc getScriptName(): string 221
nim getServerAddr cgi.html#getServerAddr proc getServerAddr(): string 225
nim getServerAdmin cgi.html#getServerAdmin proc getServerAdmin(): string 229
nim getServerName cgi.html#getServerName proc getServerName(): string 233
nim getServerPort cgi.html#getServerPort proc getServerPort(): string 237
nim getServerProtocol cgi.html#getServerProtocol proc getServerProtocol(): string 241
nim getServerSignature cgi.html#getServerSignature proc getServerSignature(): string 245
nim getServerSoftware cgi.html#getServerSoftware proc getServerSoftware(): string 249
nim setTestData cgi.html#setTestData,varargs[string] proc setTestData(keysvalues: varargs[string]) 253
nim writeContentType cgi.html#writeContentType proc writeContentType() 271
nim writeErrorMessage cgi.html#writeErrorMessage,string proc writeErrorMessage(data: string) 289
nim setStackTraceStdout cgi.html#setStackTraceStdout proc setStackTraceStdout() 301
nim setCookie cgi.html#setCookie,string,string proc setCookie(name, value: string) 305
nim getCookie cgi.html#getCookie,string proc getCookie(name: string): string 312
nim existsCookie cgi.html#existsCookie,string proc existsCookie(name: string): bool 317
nimgrp readdata cgi.html#readData-procs-all proc 104
nimgrp decodedata cgi.html#decodeData-iterators-all iterator 89

144
chains.html Normal file
View File

@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/chains</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/chains</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">append
<li><a class="reference" href="#append.t%2C%2C" title="append(header, node)">append(header, node)</a></li>
</ul>
<ul class="simple nested-toc-section">prepend
<li><a class="reference" href="#prepend.t%2C%2C" title="prepend(header, node)">prepend(header, node)</a></li>
</ul>
<ul class="simple nested-toc-section">unlink
<li><a class="reference" href="#unlink.t%2C%2C" title="unlink(header, node)">unlink(header, node)</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/collections/chains.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/collections/chains.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">Template based implementation of singly and doubly linked lists. The involved types should have 'prev' or 'next' fields and the list header should have 'head' or 'tail' fields.</p>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="append-templates-all">
<div id="append.t,,">
<dt><pre><span class="Keyword">template</span> <a href="#append.t%2C%2C"><span class="Identifier">append</span></a><span class="Other">(</span><span class="Identifier">header</span><span class="Other">,</span> <span class="Identifier">node</span><span class="Other">)</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/collections/chains.nim#L25" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/collections/chains.nim#L25" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="prepend-templates-all">
<div id="prepend.t,,">
<dt><pre><span class="Keyword">template</span> <a href="#prepend.t%2C%2C"><span class="Identifier">prepend</span></a><span class="Other">(</span><span class="Identifier">header</span><span class="Other">,</span> <span class="Identifier">node</span><span class="Other">)</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/collections/chains.nim#L14" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/collections/chains.nim#L14" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="unlink-templates-all">
<div id="unlink.t,,">
<dt><pre><span class="Keyword">template</span> <a href="#unlink.t%2C%2C"><span class="Identifier">unlink</span></a><span class="Other">(</span><span class="Identifier">header</span><span class="Other">,</span> <span class="Identifier">node</span><span class="Other">)</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/collections/chains.nim#L36" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/collections/chains.nim#L36" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:07:46 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

4
chains.idx Normal file
View File

@@ -0,0 +1,4 @@
nimTitle chains chains.html module std/chains 0
nim prepend chains.html#prepend.t,, template prepend(header, node) 14
nim append chains.html#append.t,, template append(header, node) 25
nim unlink chains.html#unlink.t,, template unlink(header, node) 36

237
cmdline.html Normal file
View File

@@ -0,0 +1,237 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/cmdline</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/cmdline</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">commandLineParams
<li><a class="reference" href="#commandLineParams" title="commandLineParams(): seq[string]">commandLineParams(): seq[string]</a></li>
</ul>
<ul class="simple nested-toc-section">paramCount
<li><a class="reference" href="#paramCount" title="paramCount(): int">paramCount(): int</a></li>
</ul>
<ul class="simple nested-toc-section">paramStr
<li><a class="reference" href="#paramStr%2Cint" title="paramStr(i: int): string">paramStr(i: int): string</a></li>
</ul>
<ul class="simple nested-toc-section">parseCmdLine
<li><a class="reference" href="#parseCmdLine%2Cstring" title="parseCmdLine(c: string): seq[string]">parseCmdLine(c: string): seq[string]</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/cmdline.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/cmdline.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">This module contains system facilities for reading command line parameters.<strong>See also:</strong><ul class="simple"><li><a class="reference external" href="parseopt.html">parseopt module</a> for command-line parser beyond <a class="reference internal nimdoc" title="proc parseCmdLine(c: string): seq[string]" href="#parseCmdLine,string">parseCmdLine proc</a></li>
</ul>
</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="widestrs.html">widestrs</a>, <a class="reference external" href="posix.html">posix</a>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="commandLineParams-procs-all">
<div id="commandLineParams">
<dt><pre><span class="Keyword">proc</span> <a href="#commandLineParams"><span class="Identifier">commandLineParams</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadIOEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Convenience proc which returns the command line parameters.</p>
<p>This returns <strong>only</strong> the parameters. If you want to get the application executable filename, call <a class="reference external" href="os.html#getAppFilename">getAppFilename()</a>.</p>
<p><strong>Availability</strong>: On Posix there is no portable way to get the command line from a DLL and thus the proc isn't defined in this environment. You can test for its availability with <a class="reference external" href="system.html#declared,untyped">declared()</a>.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="parseopt.html">parseopt module</a></li>
<li><a class="reference internal nimdoc" title="proc parseCmdLine(c: string): seq[string]" href="#parseCmdLine,string">parseCmdLine proc</a></li>
<li><a class="reference internal nimdoc" title="proc paramCount(): int" href="#paramCount">paramCount proc</a></li>
<li><a class="reference internal nimdoc" title="proc paramStr(i: int): string" href="#paramStr,int">paramStr proc</a></li>
<li><a class="reference external" href="os.html#getAppFilename">getAppFilename proc</a></li>
</ul>
<p><strong>Examples:</strong></p>
<p><pre class="listing"><span class="Keyword">when</span> <span class="Identifier">declared</span><span class="Punctuation">(</span><span class="Identifier">commandLineParams</span><span class="Punctuation">)</span><span class="Punctuation">:</span>
<span class="Comment"># Use commandLineParams() here</span>
<span class="Keyword">else</span><span class="Punctuation">:</span>
<span class="Comment"># Do something else!</span></pre></p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/cmdline.nim#L279" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/cmdline.nim#L279" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="paramCount-procs-all">
<div id="paramCount">
<dt><pre><span class="Keyword">proc</span> <a href="#paramCount"><span class="Identifier">paramCount</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#ReadIOEffect"><span class="Identifier">ReadIOEffect</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Returns the number of <span id="command-line-arguments_1">command line arguments</span> given to the application.</p>
<p>Unlike <span id="argc_1">argc</span> in C, if your binary was called without parameters this will return zero. You can query each individual parameter with <a class="reference internal nimdoc" title="proc paramStr(i: int): string" href="#paramStr,int">paramStr proc</a> or retrieve all of them in one go with <a class="reference internal nimdoc" title="proc commandLineParams(): seq[string]" href="#commandLineParams">commandLineParams proc</a>.</p>
<p><strong>Availability</strong>: When generating a dynamic library (see <tt class="docutils literal"><span class="pre"><span class="Operator">--</span><span class="Identifier">app</span><span class="Punctuation">:</span><span class="Identifier">lib</span></span></tt>) on Posix this proc is not defined. Test for availability using <a class="reference external" href="system.html#declared,untyped">declared()</a>.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="parseopt.html">parseopt module</a></li>
<li><a class="reference internal nimdoc" title="proc parseCmdLine(c: string): seq[string]" href="#parseCmdLine,string">parseCmdLine proc</a></li>
<li><a class="reference internal nimdoc" title="proc paramStr(i: int): string" href="#paramStr,int">paramStr proc</a></li>
<li><a class="reference internal nimdoc" title="proc commandLineParams(): seq[string]" href="#commandLineParams">commandLineParams proc</a></li>
</ul>
<p><strong>Examples:</strong></p>
<p><pre class="listing"><span class="Keyword">when</span> <span class="Identifier">declared</span><span class="Punctuation">(</span><span class="Identifier">paramCount</span><span class="Punctuation">)</span><span class="Punctuation">:</span>
<span class="Comment"># Use paramCount() here</span>
<span class="Keyword">else</span><span class="Punctuation">:</span>
<span class="Comment"># Do something else!</span></pre></p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/cmdline.nim#L143" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/cmdline.nim#L143" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="paramStr-procs-all">
<div id="paramStr,int">
<dt><pre><span class="Keyword">proc</span> <a href="#paramStr%2Cint"><span class="Identifier">paramStr</span></a><span class="Other">(</span><span class="Identifier">i</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#ReadIOEffect"><span class="Identifier">ReadIOEffect</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Returns the <tt class="docutils literal"><span class="pre"><span class="Identifier">i</span></span></tt>-th <span id="command-line-argument_1">command line argument</span> given to the application.</p>
<p><tt class="docutils literal"><span class="pre"><span class="Identifier">i</span></span></tt> should be in the range <tt class="docutils literal"><span class="pre"><span class="FloatNumber">1.</span><span class="Operator">.</span><span class="Identifier">paramCount</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt>, the <tt class="docutils literal"><span class="pre"><span class="Identifier">IndexDefect</span></span></tt> exception will be raised for invalid values. Instead of iterating over <a class="reference internal nimdoc" title="proc paramCount(): int" href="#paramCount">paramCount()</a> with this proc you can call the convenience <a class="reference internal nimdoc" title="proc commandLineParams(): seq[string]" href="#commandLineParams">commandLineParams()</a>.</p>
<p>Similarly to <span id="argv_1">argv</span> in C, it is possible to call <tt class="docutils literal"><span class="pre"><span class="Identifier">paramStr</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">)</span></span></tt> but this will return OS specific contents (usually the name of the invoked executable). You should avoid this and call <a class="reference external" href="os.html#getAppFilename">getAppFilename()</a> instead.</p>
<p><strong>Availability</strong>: When generating a dynamic library (see <tt class="docutils literal"><span class="pre"><span class="Operator">--</span><span class="Identifier">app</span><span class="Punctuation">:</span><span class="Identifier">lib</span></span></tt>) on Posix this proc is not defined. Test for availability using <a class="reference external" href="system.html#declared,untyped">declared()</a>.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="parseopt.html">parseopt module</a></li>
<li><a class="reference internal nimdoc" title="proc parseCmdLine(c: string): seq[string]" href="#parseCmdLine,string">parseCmdLine proc</a></li>
<li><a class="reference internal nimdoc" title="proc paramCount(): int" href="#paramCount">paramCount proc</a></li>
<li><a class="reference internal nimdoc" title="proc commandLineParams(): seq[string]" href="#commandLineParams">commandLineParams proc</a></li>
<li><a class="reference external" href="os.html#getAppFilename">getAppFilename proc</a></li>
</ul>
<p><strong>Examples:</strong></p>
<p><pre class="listing"><span class="Keyword">when</span> <span class="Identifier">declared</span><span class="Punctuation">(</span><span class="Identifier">paramStr</span><span class="Punctuation">)</span><span class="Punctuation">:</span>
<span class="Comment"># Use paramStr() here</span>
<span class="Keyword">else</span><span class="Punctuation">:</span>
<span class="Comment"># Do something else!</span></pre></p>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/cmdline.nim#L171" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/cmdline.nim#L171" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="parseCmdLine-procs-all">
<div id="parseCmdLine,string">
<dt><pre><span class="Keyword">proc</span> <a href="#parseCmdLine%2Cstring"><span class="Identifier">parseCmdLine</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span> {.<span class="Identifier">noSideEffect</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span>
<span class="Identifier">extern</span><span class="Other">:</span> <span class="StringLit">&quot;nos$1&quot;</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Splits a <span id="command-line_1">command line</span> into several components.</p>
<p><strong>Note</strong>: This proc is only occasionally useful, better use the <a class="reference external" href="parseopt.html">parseopt module</a>.</p>
<p>On Windows, it uses the <a class="reference external" href="https://msdn.microsoft.com/en-us/library/17w5ykft.aspx">following parsing rules</a>:</p>
<ul class="simple"><li>Arguments are delimited by white space, which is either a space or a tab.</li>
<li>The caret character (^) is not recognized as an escape character or delimiter. The character is handled completely by the command-line parser in the operating system before being passed to the argv array in the program.</li>
<li>A string surrounded by double quotation marks (&quot;string&quot;) is interpreted as a single argument, regardless of white space contained within. A quoted string can be embedded in an argument.</li>
<li>A double quotation mark preceded by a backslash (&quot;) is interpreted as a literal double quotation mark character (&quot;).</li>
<li>Backslashes are interpreted literally, unless they immediately precede a double quotation mark.</li>
<li>If an even number of backslashes is followed by a double quotation mark, one backslash is placed in the argv array for every pair of backslashes, and the double quotation mark is interpreted as a string delimiter.</li>
<li>If an odd number of backslashes is followed by a double quotation mark, one backslash is placed in the argv array for every pair of backslashes, and the double quotation mark is &quot;escaped&quot; by the remaining backslash, causing a literal double quotation mark (&quot;) to be placed in argv.</li>
</ul>
<p>On Posix systems, it uses the following parsing rules: Components are separated by whitespace unless the whitespace occurs within <tt class="docutils literal"><span class="pre">&quot;</span></tt> or <tt class="docutils literal"><span class="pre">'</span></tt> quotes.</p>
<p>See also:</p>
<ul class="simple"><li><a class="reference external" href="parseopt.html">parseopt module</a></li>
<li><a class="reference internal nimdoc" title="proc paramCount(): int" href="#paramCount">paramCount proc</a></li>
<li><a class="reference internal nimdoc" title="proc paramStr(i: int): string" href="#paramStr,int">paramStr proc</a></li>
<li><a class="reference internal nimdoc" title="proc commandLineParams(): seq[string]" href="#commandLineParams">commandLineParams proc</a></li>
</ul>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/cmdline.nim#L44" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/cmdline.nim#L44" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:07:58 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

10
cmdline.idx Normal file
View File

@@ -0,0 +1,10 @@
nimTitle cmdline cmdline.html module std/cmdline 0
nim parseCmdLine cmdline.html#parseCmdLine,string proc parseCmdLine(c: string): seq[string] 44
nim paramCount cmdline.html#paramCount proc paramCount(): int 143
nim paramStr cmdline.html#paramStr,int proc paramStr(i: int): string 171
nim commandLineParams cmdline.html#commandLineParams proc commandLineParams(): seq[string] 279
idx command line argument cmdline.html#command-line-argument_1 Module cmdline 0
idx argv cmdline.html#argv_1 Module cmdline 0
idx command line arguments cmdline.html#command-line-arguments_1 Module cmdline 0
idx argc cmdline.html#argc_1 Module cmdline 0
idx command line cmdline.html#command-line_1 Module cmdline 0

2027
colors.html Normal file

File diff suppressed because it is too large Load Diff

160
colors.idx Normal file
View File

@@ -0,0 +1,160 @@
nimTitle colors colors.html module std/colors 0
nim Color colors.html#Color type Color 16
nim `==` colors.html#==,Color,Color proc `==`(a, b: Color): bool 18
nim `+` colors.html#+,Color,Color proc `+`(a, b: Color): Color 51
nim `-` colors.html#-,Color,Color proc `-`(a, b: Color): Color 65
nim extractRGB colors.html#extractRGB,Color proc extractRGB(a: Color): tuple[r, g, b: range[0 .. 255]] 79
nim intensity colors.html#intensity,Color,float proc intensity(a: Color; f: float): Color 99
nim mix colors.html#mix.t,Color,Color,untyped template mix(a, b: Color; fn: untyped): untyped 118
nim colAliceBlue colors.html#colAliceBlue const colAliceBlue 149
nim colAntiqueWhite colors.html#colAntiqueWhite const colAntiqueWhite 150
nim colAqua colors.html#colAqua const colAqua 151
nim colAquamarine colors.html#colAquamarine const colAquamarine 152
nim colAzure colors.html#colAzure const colAzure 153
nim colBeige colors.html#colBeige const colBeige 154
nim colBisque colors.html#colBisque const colBisque 155
nim colBlack colors.html#colBlack const colBlack 156
nim colBlanchedAlmond colors.html#colBlanchedAlmond const colBlanchedAlmond 157
nim colBlue colors.html#colBlue const colBlue 158
nim colBlueViolet colors.html#colBlueViolet const colBlueViolet 159
nim colBrown colors.html#colBrown const colBrown 160
nim colBurlyWood colors.html#colBurlyWood const colBurlyWood 161
nim colCadetBlue colors.html#colCadetBlue const colCadetBlue 162
nim colChartreuse colors.html#colChartreuse const colChartreuse 163
nim colChocolate colors.html#colChocolate const colChocolate 164
nim colCoral colors.html#colCoral const colCoral 165
nim colCornflowerBlue colors.html#colCornflowerBlue const colCornflowerBlue 166
nim colCornsilk colors.html#colCornsilk const colCornsilk 167
nim colCrimson colors.html#colCrimson const colCrimson 168
nim colCyan colors.html#colCyan const colCyan 169
nim colDarkBlue colors.html#colDarkBlue const colDarkBlue 170
nim colDarkCyan colors.html#colDarkCyan const colDarkCyan 171
nim colDarkGoldenRod colors.html#colDarkGoldenRod const colDarkGoldenRod 172
nim colDarkGray colors.html#colDarkGray const colDarkGray 173
nim colDarkGreen colors.html#colDarkGreen const colDarkGreen 174
nim colDarkGrey colors.html#colDarkGrey const colDarkGrey 175
nim colDarkKhaki colors.html#colDarkKhaki const colDarkKhaki 176
nim colDarkMagenta colors.html#colDarkMagenta const colDarkMagenta 177
nim colDarkOliveGreen colors.html#colDarkOliveGreen const colDarkOliveGreen 178
nim colDarkorange colors.html#colDarkorange const colDarkorange 179
nim colDarkOrchid colors.html#colDarkOrchid const colDarkOrchid 180
nim colDarkRed colors.html#colDarkRed const colDarkRed 181
nim colDarkSalmon colors.html#colDarkSalmon const colDarkSalmon 182
nim colDarkSeaGreen colors.html#colDarkSeaGreen const colDarkSeaGreen 183
nim colDarkSlateBlue colors.html#colDarkSlateBlue const colDarkSlateBlue 184
nim colDarkSlateGray colors.html#colDarkSlateGray const colDarkSlateGray 185
nim colDarkSlateGrey colors.html#colDarkSlateGrey const colDarkSlateGrey 186
nim colDarkTurquoise colors.html#colDarkTurquoise const colDarkTurquoise 187
nim colDarkViolet colors.html#colDarkViolet const colDarkViolet 188
nim colDeepPink colors.html#colDeepPink const colDeepPink 189
nim colDeepSkyBlue colors.html#colDeepSkyBlue const colDeepSkyBlue 190
nim colDimGray colors.html#colDimGray const colDimGray 191
nim colDimGrey colors.html#colDimGrey const colDimGrey 192
nim colDodgerBlue colors.html#colDodgerBlue const colDodgerBlue 193
nim colFireBrick colors.html#colFireBrick const colFireBrick 194
nim colFloralWhite colors.html#colFloralWhite const colFloralWhite 195
nim colForestGreen colors.html#colForestGreen const colForestGreen 196
nim colFuchsia colors.html#colFuchsia const colFuchsia 197
nim colGainsboro colors.html#colGainsboro const colGainsboro 198
nim colGhostWhite colors.html#colGhostWhite const colGhostWhite 199
nim colGold colors.html#colGold const colGold 200
nim colGoldenRod colors.html#colGoldenRod const colGoldenRod 201
nim colGray colors.html#colGray const colGray 202
nim colGreen colors.html#colGreen const colGreen 203
nim colGreenYellow colors.html#colGreenYellow const colGreenYellow 204
nim colGrey colors.html#colGrey const colGrey 205
nim colHoneyDew colors.html#colHoneyDew const colHoneyDew 206
nim colHotPink colors.html#colHotPink const colHotPink 207
nim colIndianRed colors.html#colIndianRed const colIndianRed 208
nim colIndigo colors.html#colIndigo const colIndigo 209
nim colIvory colors.html#colIvory const colIvory 210
nim colKhaki colors.html#colKhaki const colKhaki 211
nim colLavender colors.html#colLavender const colLavender 212
nim colLavenderBlush colors.html#colLavenderBlush const colLavenderBlush 213
nim colLawnGreen colors.html#colLawnGreen const colLawnGreen 214
nim colLemonChiffon colors.html#colLemonChiffon const colLemonChiffon 215
nim colLightBlue colors.html#colLightBlue const colLightBlue 216
nim colLightCoral colors.html#colLightCoral const colLightCoral 217
nim colLightCyan colors.html#colLightCyan const colLightCyan 218
nim colLightGoldenRodYellow colors.html#colLightGoldenRodYellow const colLightGoldenRodYellow 219
nim colLightGray colors.html#colLightGray const colLightGray 220
nim colLightGreen colors.html#colLightGreen const colLightGreen 221
nim colLightGrey colors.html#colLightGrey const colLightGrey 222
nim colLightPink colors.html#colLightPink const colLightPink 223
nim colLightSalmon colors.html#colLightSalmon const colLightSalmon 224
nim colLightSeaGreen colors.html#colLightSeaGreen const colLightSeaGreen 225
nim colLightSkyBlue colors.html#colLightSkyBlue const colLightSkyBlue 226
nim colLightSlateGray colors.html#colLightSlateGray const colLightSlateGray 227
nim colLightSlateGrey colors.html#colLightSlateGrey const colLightSlateGrey 228
nim colLightSteelBlue colors.html#colLightSteelBlue const colLightSteelBlue 229
nim colLightYellow colors.html#colLightYellow const colLightYellow 230
nim colLime colors.html#colLime const colLime 231
nim colLimeGreen colors.html#colLimeGreen const colLimeGreen 232
nim colLinen colors.html#colLinen const colLinen 233
nim colMagenta colors.html#colMagenta const colMagenta 234
nim colMaroon colors.html#colMaroon const colMaroon 235
nim colMediumAquaMarine colors.html#colMediumAquaMarine const colMediumAquaMarine 236
nim colMediumBlue colors.html#colMediumBlue const colMediumBlue 237
nim colMediumOrchid colors.html#colMediumOrchid const colMediumOrchid 238
nim colMediumPurple colors.html#colMediumPurple const colMediumPurple 239
nim colMediumSeaGreen colors.html#colMediumSeaGreen const colMediumSeaGreen 240
nim colMediumSlateBlue colors.html#colMediumSlateBlue const colMediumSlateBlue 241
nim colMediumSpringGreen colors.html#colMediumSpringGreen const colMediumSpringGreen 242
nim colMediumTurquoise colors.html#colMediumTurquoise const colMediumTurquoise 243
nim colMediumVioletRed colors.html#colMediumVioletRed const colMediumVioletRed 244
nim colMidnightBlue colors.html#colMidnightBlue const colMidnightBlue 245
nim colMintCream colors.html#colMintCream const colMintCream 246
nim colMistyRose colors.html#colMistyRose const colMistyRose 247
nim colMoccasin colors.html#colMoccasin const colMoccasin 248
nim colNavajoWhite colors.html#colNavajoWhite const colNavajoWhite 249
nim colNavy colors.html#colNavy const colNavy 250
nim colOldLace colors.html#colOldLace const colOldLace 251
nim colOlive colors.html#colOlive const colOlive 252
nim colOliveDrab colors.html#colOliveDrab const colOliveDrab 253
nim colOrange colors.html#colOrange const colOrange 254
nim colOrangeRed colors.html#colOrangeRed const colOrangeRed 255
nim colOrchid colors.html#colOrchid const colOrchid 256
nim colPaleGoldenRod colors.html#colPaleGoldenRod const colPaleGoldenRod 257
nim colPaleGreen colors.html#colPaleGreen const colPaleGreen 258
nim colPaleTurquoise colors.html#colPaleTurquoise const colPaleTurquoise 259
nim colPaleVioletRed colors.html#colPaleVioletRed const colPaleVioletRed 260
nim colPapayaWhip colors.html#colPapayaWhip const colPapayaWhip 261
nim colPeachPuff colors.html#colPeachPuff const colPeachPuff 262
nim colPeru colors.html#colPeru const colPeru 263
nim colPink colors.html#colPink const colPink 264
nim colPlum colors.html#colPlum const colPlum 265
nim colPowderBlue colors.html#colPowderBlue const colPowderBlue 266
nim colPurple colors.html#colPurple const colPurple 267
nim colRebeccaPurple colors.html#colRebeccaPurple const colRebeccaPurple 268
nim colRed colors.html#colRed const colRed 269
nim colRosyBrown colors.html#colRosyBrown const colRosyBrown 270
nim colRoyalBlue colors.html#colRoyalBlue const colRoyalBlue 271
nim colSaddleBrown colors.html#colSaddleBrown const colSaddleBrown 272
nim colSalmon colors.html#colSalmon const colSalmon 273
nim colSandyBrown colors.html#colSandyBrown const colSandyBrown 274
nim colSeaGreen colors.html#colSeaGreen const colSeaGreen 275
nim colSeaShell colors.html#colSeaShell const colSeaShell 276
nim colSienna colors.html#colSienna const colSienna 277
nim colSilver colors.html#colSilver const colSilver 278
nim colSkyBlue colors.html#colSkyBlue const colSkyBlue 279
nim colSlateBlue colors.html#colSlateBlue const colSlateBlue 280
nim colSlateGray colors.html#colSlateGray const colSlateGray 281
nim colSlateGrey colors.html#colSlateGrey const colSlateGrey 282
nim colSnow colors.html#colSnow const colSnow 283
nim colSpringGreen colors.html#colSpringGreen const colSpringGreen 284
nim colSteelBlue colors.html#colSteelBlue const colSteelBlue 285
nim colTan colors.html#colTan const colTan 286
nim colTeal colors.html#colTeal const colTeal 287
nim colThistle colors.html#colThistle const colThistle 288
nim colTomato colors.html#colTomato const colTomato 289
nim colTurquoise colors.html#colTurquoise const colTurquoise 290
nim colViolet colors.html#colViolet const colViolet 291
nim colWheat colors.html#colWheat const colWheat 292
nim colWhite colors.html#colWhite const colWhite 293
nim colWhiteSmoke colors.html#colWhiteSmoke const colWhiteSmoke 294
nim colYellow colors.html#colYellow const colYellow 295
nim colYellowGreen colors.html#colYellowGreen const colYellowGreen 296
nim `$` colors.html#$,Color proc `$`(c: Color): string 448
nim parseColor colors.html#parseColor,string proc parseColor(name: string): Color 458
nim isColor colors.html#isColor,string proc isColor(name: string): bool 480
nim rgb colors.html#rgb,range[],range[],range[] proc rgb(r, g, b: range[0 .. 255]): Color 501

219
compiler/aliasanalysis.html Normal file
View File

@@ -0,0 +1,219 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>aliasanalysis</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">aliasanalysis</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#AliasKind" title="AliasKind = enum
yes, no, maybe">AliasKind</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#PathKinds0" title="PathKinds0 = {nkDotExpr, nkCheckedFieldExpr, nkBracketExpr, nkDerefExpr,
nkHiddenDeref, nkAddr, nkHiddenAddr, nkObjDownConv, nkObjUpConv}">PathKinds0</a></li>
<li><a class="reference" href="#PathKinds1" title="PathKinds1 = {nkHiddenStdConv, nkHiddenSubConv}">PathKinds1</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">aliases
<li><a class="reference" href="#aliases%2CPNode%2CPNode" title="aliases(obj, field: PNode): AliasKind">aliases(obj, field: PNode): AliasKind</a></li>
</ul>
<ul class="simple nested-toc-section">isAnalysableFieldAccess
<li><a class="reference" href="#isAnalysableFieldAccess%2CPNode%2CPSym" title="isAnalysableFieldAccess(orig: PNode; owner: PSym): bool">isAnalysableFieldAccess(orig: PNode; owner: PSym): bool</a></li>
</ul>
<ul class="simple nested-toc-section">skipConvDfa
<li><a class="reference" href="#skipConvDfa%2CPNode" title="skipConvDfa(n: PNode): PNode">skipConvDfa(n: PNode): PNode</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/aliasanalysis.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/aliasanalysis.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="ast.html">ast</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="AliasKind">
<dt><pre><a href="aliasanalysis.html#AliasKind"><span class="Identifier">AliasKind</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">yes</span><span class="Other">,</span> <span class="Identifier">no</span><span class="Other">,</span> <span class="Identifier">maybe</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/aliasanalysis.nim#L56" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/aliasanalysis.nim#L56" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="PathKinds0">
<dt><pre><a href="aliasanalysis.html#PathKinds0"><span class="Identifier">PathKinds0</span></a> <span class="Other">=</span> <span class="Other">{</span><span class="DecNumber">nkDotExpr</span><span class="Other">,</span> <span class="DecNumber">nkCheckedFieldExpr</span><span class="Other">,</span> <span class="DecNumber">nkBracketExpr</span><span class="Other">,</span> <span class="DecNumber">nkDerefExpr</span><span class="Other">,</span>
<span class="DecNumber">nkHiddenDeref</span><span class="Other">,</span> <span class="DecNumber">nkAddr</span><span class="Other">,</span> <span class="DecNumber">nkHiddenAddr</span><span class="Other">,</span> <span class="DecNumber">nkObjDownConv</span><span class="Other">,</span> <span class="DecNumber">nkObjUpConv</span><span class="Other">}</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/aliasanalysis.nim#L7" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/aliasanalysis.nim#L7" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="PathKinds1">
<dt><pre><a href="aliasanalysis.html#PathKinds1"><span class="Identifier">PathKinds1</span></a> <span class="Other">=</span> <span class="Other">{</span><span class="DecNumber">nkHiddenStdConv</span><span class="Other">,</span> <span class="DecNumber">nkHiddenSubConv</span><span class="Other">}</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/aliasanalysis.nim#L11" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/aliasanalysis.nim#L11" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="aliases-procs-all">
<div id="aliases,PNode,PNode">
<dt><pre><span class="Keyword">proc</span> <a href="#aliases%2CPNode%2CPNode"><span class="Identifier">aliases</span></a><span class="Other">(</span><span class="Identifier">obj</span><span class="Other">,</span> <span class="Identifier">field</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="aliasanalysis.html#AliasKind"><span class="Identifier">AliasKind</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/aliasanalysis.nim#L59" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/aliasanalysis.nim#L59" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="isAnalysableFieldAccess-procs-all">
<div id="isAnalysableFieldAccess,PNode,PSym">
<dt><pre><span class="Keyword">proc</span> <a href="#isAnalysableFieldAccess%2CPNode%2CPSym"><span class="Identifier">isAnalysableFieldAccess</span></a><span class="Other">(</span><span class="Identifier">orig</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">;</span> <span class="Identifier">owner</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/aliasanalysis.nim#L23" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/aliasanalysis.nim#L23" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="skipConvDfa-procs-all">
<div id="skipConvDfa,PNode">
<dt><pre><span class="Keyword">proc</span> <a href="#skipConvDfa%2CPNode"><span class="Identifier">skipConvDfa</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/aliasanalysis.nim#L13" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/aliasanalysis.nim#L13" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:13 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

View File

@@ -0,0 +1,10 @@
nimTitle aliasanalysis aliasanalysis.html module aliasanalysis 0
nim PathKinds0 aliasanalysis.html#PathKinds0 const PathKinds0 7
nim PathKinds1 aliasanalysis.html#PathKinds1 const PathKinds1 11
nim skipConvDfa aliasanalysis.html#skipConvDfa,PNode proc skipConvDfa(n: PNode): PNode 13
nim isAnalysableFieldAccess aliasanalysis.html#isAnalysableFieldAccess,PNode,PSym proc isAnalysableFieldAccess(orig: PNode; owner: PSym): bool 23
nim yes aliasanalysis.html#yes AliasKind.yes 56
nim no aliasanalysis.html#no AliasKind.no 56
nim maybe aliasanalysis.html#maybe AliasKind.maybe 56
nim AliasKind aliasanalysis.html#AliasKind enum AliasKind 56
nim aliases aliasanalysis.html#aliases,PNode,PNode proc aliases(obj, field: PNode): AliasKind 59

166
compiler/aliases.html Normal file
View File

@@ -0,0 +1,166 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>aliases</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">aliases</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#TAnalysisResult" title="TAnalysisResult = enum
arNo, arMaybe, arYes">TAnalysisResult</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">isPartOf
<li><a class="reference" href="#isPartOf%2CPNode%2CPNode" title="isPartOf(a, b: PNode): TAnalysisResult">isPartOf(a, b: PNode): TAnalysisResult</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/aliases.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/aliases.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">Simple alias analysis for the HLO and the code generators.</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="ast.html">ast</a>, <a class="reference external" href="astalgo.html">astalgo</a>, <a class="reference external" href="types.html">types</a>, <a class="reference external" href="trees.html">trees</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="TAnalysisResult">
<dt><pre><a href="aliases.html#TAnalysisResult"><span class="Identifier">TAnalysisResult</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">arNo</span><span class="Other">,</span> <span class="Identifier">arMaybe</span><span class="Other">,</span> <span class="Identifier">arYes</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/aliases.nim#L21" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/aliases.nim#L21" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="isPartOf-procs-all">
<div id="isPartOf,PNode,PNode">
<dt><pre><span class="Keyword">proc</span> <a href="#isPartOf%2CPNode%2CPNode"><span class="Identifier">isPartOf</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="aliases.html#TAnalysisResult"><span class="Identifier">TAnalysisResult</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>checks if location <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt> can be part of location <tt class="docutils literal"><span class="pre"><span class="Identifier">b</span></span></tt>. We treat seqs and strings as pointers because the code gen often just passes them as such.</p>
<p>Note: <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt> can only be part of <tt class="docutils literal"><span class="pre"><span class="Identifier">b</span></span></tt>, if <tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt>'s type can be part of <tt class="docutils literal"><span class="pre"><span class="Identifier">b</span></span></tt>'s type. Since however type analysis is more expensive, we perform it only if necessary.</p>
<p>cases:</p>
<p>YES-cases:</p>
<p><pre class="listing"><span class="Identifier">x</span> <span class="Operator">&lt;|</span> <span class="Identifier">x</span> <span class="Comment"># for general trees</span>
<span class="Identifier">x</span><span class="Punctuation">[</span><span class="Punctuation">]</span> <span class="Operator">&lt;|</span> <span class="Identifier">x</span>
<span class="Identifier">x</span><span class="Punctuation">[</span><span class="Identifier">i</span><span class="Punctuation">]</span> <span class="Operator">&lt;|</span> <span class="Identifier">x</span>
<span class="Identifier">x</span><span class="Operator">.</span><span class="Identifier">f</span> <span class="Operator">&lt;|</span> <span class="Identifier">x</span></pre></p>
<p>NO-cases:</p>
<p><pre class="listing"><span class="Identifier">x</span> <span class="Operator">!&lt;|</span> <span class="Identifier">y</span> <span class="Comment"># depending on type and symbol kind</span>
<span class="Identifier">x</span><span class="Punctuation">[</span><span class="Identifier">constA</span><span class="Punctuation">]</span> <span class="Operator">!&lt;|</span> <span class="Identifier">x</span><span class="Punctuation">[</span><span class="Identifier">constB</span><span class="Punctuation">]</span>
<span class="Identifier">x</span><span class="Operator">.</span><span class="Identifier">f</span> <span class="Operator">!&lt;|</span> <span class="Identifier">x</span><span class="Operator">.</span><span class="Identifier">g</span>
<span class="Identifier">x</span><span class="Operator">.</span><span class="Identifier">f</span> <span class="Operator">!&lt;|</span> <span class="Identifier">y</span><span class="Operator">.</span><span class="Identifier">f</span> <span class="Identifier">iff</span> <span class="Identifier">x</span> <span class="Operator">!&lt;=</span> <span class="Identifier">y</span></pre></p>
<p>MAYBE-cases:</p>
<p><pre class="listing"><span class="Identifier">x</span><span class="Punctuation">[</span><span class="Punctuation">]</span> <span class="Operator">?&lt;|</span> <span class="Identifier">y</span><span class="Punctuation">[</span><span class="Punctuation">]</span> <span class="Identifier">iff</span> <span class="Identifier">compatible</span> <span class="Keyword">type</span>
<span class="Identifier">x</span><span class="Punctuation">[</span><span class="Punctuation">]</span> <span class="Operator">?&lt;|</span> <span class="Identifier">y</span> <span class="Identifier">depending</span> <span class="Identifier">on</span> <span class="Keyword">type</span></pre></p>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/aliases.nim#L73" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/aliases.nim#L73" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:14 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

6
compiler/aliases.idx Normal file
View File

@@ -0,0 +1,6 @@
nimTitle aliases aliases.html module aliases 0
nim arNo aliases.html#arNo TAnalysisResult.arNo 21
nim arMaybe aliases.html#arMaybe TAnalysisResult.arMaybe 21
nim arYes aliases.html#arYes TAnalysisResult.arYes 21
nim TAnalysisResult aliases.html#TAnalysisResult enum TAnalysisResult 21
nim isPartOf aliases.html#isPartOf,PNode,PNode proc isPartOf(a, b: PNode): TAnalysisResult 73

5737
compiler/ast.html Normal file

File diff suppressed because one or more lines are too long

921
compiler/ast.idx Normal file
View File

@@ -0,0 +1,921 @@
nimTitle ast ast.html module ast 0
nim ccNimCall ast.html#ccNimCall TCallingConvention.ccNimCall 27
nim ccStdCall ast.html#ccStdCall TCallingConvention.ccStdCall 27
nim ccCDecl ast.html#ccCDecl TCallingConvention.ccCDecl 27
nim ccSafeCall ast.html#ccSafeCall TCallingConvention.ccSafeCall 27
nim ccSysCall ast.html#ccSysCall TCallingConvention.ccSysCall 27
nim ccInline ast.html#ccInline TCallingConvention.ccInline 27
nim ccNoInline ast.html#ccNoInline TCallingConvention.ccNoInline 27
nim ccFastCall ast.html#ccFastCall TCallingConvention.ccFastCall 27
nim ccThisCall ast.html#ccThisCall TCallingConvention.ccThisCall 27
nim ccClosure ast.html#ccClosure TCallingConvention.ccClosure 27
nim ccNoConvention ast.html#ccNoConvention TCallingConvention.ccNoConvention 27
nim ccMember ast.html#ccMember TCallingConvention.ccMember 27
nim TCallingConvention ast.html#TCallingConvention enum TCallingConvention 27
nim TNodeKinds ast.html#TNodeKinds type TNodeKinds 41
nim sfUsed ast.html#sfUsed TSymFlag.sfUsed 44
nim sfExported ast.html#sfExported TSymFlag.sfExported 44
nim sfFromGeneric ast.html#sfFromGeneric TSymFlag.sfFromGeneric 44
nim sfGlobal ast.html#sfGlobal TSymFlag.sfGlobal 44
nim sfForward ast.html#sfForward TSymFlag.sfForward 44
nim sfWasForwarded ast.html#sfWasForwarded TSymFlag.sfWasForwarded 44
nim sfImportc ast.html#sfImportc TSymFlag.sfImportc 44
nim sfExportc ast.html#sfExportc TSymFlag.sfExportc 44
nim sfMangleCpp ast.html#sfMangleCpp TSymFlag.sfMangleCpp 44
nim sfVolatile ast.html#sfVolatile TSymFlag.sfVolatile 44
nim sfRegister ast.html#sfRegister TSymFlag.sfRegister 44
nim sfPure ast.html#sfPure TSymFlag.sfPure 44
nim sfNoSideEffect ast.html#sfNoSideEffect TSymFlag.sfNoSideEffect 44
nim sfSideEffect ast.html#sfSideEffect TSymFlag.sfSideEffect 44
nim sfMainModule ast.html#sfMainModule TSymFlag.sfMainModule 44
nim sfSystemModule ast.html#sfSystemModule TSymFlag.sfSystemModule 44
nim sfNoReturn ast.html#sfNoReturn TSymFlag.sfNoReturn 44
nim sfAddrTaken ast.html#sfAddrTaken TSymFlag.sfAddrTaken 44
nim sfCompilerProc ast.html#sfCompilerProc TSymFlag.sfCompilerProc 44
nim sfEscapes ast.html#sfEscapes TSymFlag.sfEscapes 44
nim sfDiscriminant ast.html#sfDiscriminant TSymFlag.sfDiscriminant 44
nim sfRequiresInit ast.html#sfRequiresInit TSymFlag.sfRequiresInit 44
nim sfDeprecated ast.html#sfDeprecated TSymFlag.sfDeprecated 44
nim sfExplain ast.html#sfExplain TSymFlag.sfExplain 44
nim sfError ast.html#sfError TSymFlag.sfError 44
nim sfShadowed ast.html#sfShadowed TSymFlag.sfShadowed 44
nim sfThread ast.html#sfThread TSymFlag.sfThread 44
nim sfCppNonPod ast.html#sfCppNonPod TSymFlag.sfCppNonPod 44
nim sfCompileTime ast.html#sfCompileTime TSymFlag.sfCompileTime 44
nim sfConstructor ast.html#sfConstructor TSymFlag.sfConstructor 44
nim sfDispatcher ast.html#sfDispatcher TSymFlag.sfDispatcher 44
nim sfBorrow ast.html#sfBorrow TSymFlag.sfBorrow 44
nim sfInfixCall ast.html#sfInfixCall TSymFlag.sfInfixCall 44
nim sfNamedParamCall ast.html#sfNamedParamCall TSymFlag.sfNamedParamCall 44
nim sfDiscardable ast.html#sfDiscardable TSymFlag.sfDiscardable 44
nim sfOverridden ast.html#sfOverridden TSymFlag.sfOverridden 44
nim sfCallsite ast.html#sfCallsite TSymFlag.sfCallsite 44
nim sfGenSym ast.html#sfGenSym TSymFlag.sfGenSym 44
nim sfNonReloadable ast.html#sfNonReloadable TSymFlag.sfNonReloadable 44
nim sfGeneratedOp ast.html#sfGeneratedOp TSymFlag.sfGeneratedOp 44
nim sfTemplateParam ast.html#sfTemplateParam TSymFlag.sfTemplateParam 44
nim sfCursor ast.html#sfCursor TSymFlag.sfCursor 44
nim sfInjectDestructors ast.html#sfInjectDestructors TSymFlag.sfInjectDestructors 44
nim sfNeverRaises ast.html#sfNeverRaises TSymFlag.sfNeverRaises 44
nim sfSystemRaisesDefect ast.html#sfSystemRaisesDefect TSymFlag.sfSystemRaisesDefect 44
nim sfUsedInFinallyOrExcept ast.html#sfUsedInFinallyOrExcept TSymFlag.sfUsedInFinallyOrExcept 44
nim sfSingleUsedTemp ast.html#sfSingleUsedTemp TSymFlag.sfSingleUsedTemp 44
nim sfNoalias ast.html#sfNoalias TSymFlag.sfNoalias 44
nim sfEffectsDelayed ast.html#sfEffectsDelayed TSymFlag.sfEffectsDelayed 44
nim sfGeneratedType ast.html#sfGeneratedType TSymFlag.sfGeneratedType 44
nim sfVirtual ast.html#sfVirtual TSymFlag.sfVirtual 44
nim sfByCopy ast.html#sfByCopy TSymFlag.sfByCopy 44
nim sfMember ast.html#sfMember TSymFlag.sfMember 44
nim sfCodegenDecl ast.html#sfCodegenDecl TSymFlag.sfCodegenDecl 44
nim sfWasGenSym ast.html#sfWasGenSym TSymFlag.sfWasGenSym 44
nim sfForceLift ast.html#sfForceLift TSymFlag.sfForceLift 44
nim sfDirty ast.html#sfDirty TSymFlag.sfDirty 44
nim sfCustomPragma ast.html#sfCustomPragma TSymFlag.sfCustomPragma 44
nim sfBase ast.html#sfBase TSymFlag.sfBase 44
nim sfGoto ast.html#sfGoto TSymFlag.sfGoto 44
nim sfAnon ast.html#sfAnon TSymFlag.sfAnon 44
nim sfAllUntyped ast.html#sfAllUntyped TSymFlag.sfAllUntyped 44
nim sfTemplateRedefinition ast.html#sfTemplateRedefinition TSymFlag.sfTemplateRedefinition 44
nim TSymFlag ast.html#TSymFlag enum TSymFlag 44
nim TSymFlags ast.html#TSymFlags type TSymFlags 143
nim sfNoInit ast.html#sfNoInit const sfNoInit 146
nim sfNoForward ast.html#sfNoForward const sfNoForward 148
nim sfReorder ast.html#sfReorder const sfReorder 150
nim sfCompileToCpp ast.html#sfCompileToCpp const sfCompileToCpp 153
nim sfCompileToObjc ast.html#sfCompileToObjc const sfCompileToObjc 154
nim sfExperimental ast.html#sfExperimental const sfExperimental 155
nim sfWrittenTo ast.html#sfWrittenTo const sfWrittenTo 156
nim sfCppMember ast.html#sfCppMember const sfCppMember 158
nim nkWhen ast.html#nkWhen const nkWhen 162
nim nkWhenExpr ast.html#nkWhenExpr const nkWhenExpr 163
nim nkEffectList ast.html#nkEffectList const nkEffectList 164
nim exceptionEffects ast.html#exceptionEffects const exceptionEffects 166
nim requiresEffects ast.html#requiresEffects const requiresEffects 167
nim ensuresEffects ast.html#ensuresEffects const ensuresEffects 168
nim tagEffects ast.html#tagEffects const tagEffects 169
nim pragmasEffects ast.html#pragmasEffects const pragmasEffects 170
nim forbiddenEffects ast.html#forbiddenEffects const forbiddenEffects 171
nim effectListLen ast.html#effectListLen const effectListLen 172
nim nkLastBlockStmts ast.html#nkLastBlockStmts const nkLastBlockStmts 173
nim tyNone ast.html#tyNone TTypeKind.tyNone 177
nim tyBool ast.html#tyBool TTypeKind.tyBool 177
nim tyChar ast.html#tyChar TTypeKind.tyChar 177
nim tyEmpty ast.html#tyEmpty TTypeKind.tyEmpty 177
nim tyAlias ast.html#tyAlias TTypeKind.tyAlias 177
nim tyNil ast.html#tyNil TTypeKind.tyNil 177
nim tyUntyped ast.html#tyUntyped TTypeKind.tyUntyped 177
nim tyTyped ast.html#tyTyped TTypeKind.tyTyped 177
nim tyTypeDesc ast.html#tyTypeDesc TTypeKind.tyTypeDesc 177
nim tyGenericInvocation ast.html#tyGenericInvocation TTypeKind.tyGenericInvocation 177
nim tyGenericBody ast.html#tyGenericBody TTypeKind.tyGenericBody 177
nim tyGenericInst ast.html#tyGenericInst TTypeKind.tyGenericInst 177
nim tyGenericParam ast.html#tyGenericParam TTypeKind.tyGenericParam 177
nim tyDistinct ast.html#tyDistinct TTypeKind.tyDistinct 177
nim tyEnum ast.html#tyEnum TTypeKind.tyEnum 177
nim tyOrdinal ast.html#tyOrdinal TTypeKind.tyOrdinal 177
nim tyArray ast.html#tyArray TTypeKind.tyArray 177
nim tyObject ast.html#tyObject TTypeKind.tyObject 177
nim tyTuple ast.html#tyTuple TTypeKind.tyTuple 177
nim tySet ast.html#tySet TTypeKind.tySet 177
nim tyRange ast.html#tyRange TTypeKind.tyRange 177
nim tyPtr ast.html#tyPtr TTypeKind.tyPtr 177
nim tyRef ast.html#tyRef TTypeKind.tyRef 177
nim tyVar ast.html#tyVar TTypeKind.tyVar 177
nim tySequence ast.html#tySequence TTypeKind.tySequence 177
nim tyProc ast.html#tyProc TTypeKind.tyProc 177
nim tyPointer ast.html#tyPointer TTypeKind.tyPointer 177
nim tyOpenArray ast.html#tyOpenArray TTypeKind.tyOpenArray 177
nim tyString ast.html#tyString TTypeKind.tyString 177
nim tyCstring ast.html#tyCstring TTypeKind.tyCstring 177
nim tyForward ast.html#tyForward TTypeKind.tyForward 177
nim tyInt ast.html#tyInt TTypeKind.tyInt 177
nim tyInt8 ast.html#tyInt8 TTypeKind.tyInt8 177
nim tyInt16 ast.html#tyInt16 TTypeKind.tyInt16 177
nim tyInt32 ast.html#tyInt32 TTypeKind.tyInt32 177
nim tyInt64 ast.html#tyInt64 TTypeKind.tyInt64 177
nim tyFloat ast.html#tyFloat TTypeKind.tyFloat 177
nim tyFloat32 ast.html#tyFloat32 TTypeKind.tyFloat32 177
nim tyFloat64 ast.html#tyFloat64 TTypeKind.tyFloat64 177
nim tyFloat128 ast.html#tyFloat128 TTypeKind.tyFloat128 177
nim tyUInt ast.html#tyUInt TTypeKind.tyUInt 177
nim tyUInt8 ast.html#tyUInt8 TTypeKind.tyUInt8 177
nim tyUInt16 ast.html#tyUInt16 TTypeKind.tyUInt16 177
nim tyUInt32 ast.html#tyUInt32 TTypeKind.tyUInt32 177
nim tyUInt64 ast.html#tyUInt64 TTypeKind.tyUInt64 177
nim tyOwned ast.html#tyOwned TTypeKind.tyOwned 177
nim tySink ast.html#tySink TTypeKind.tySink 177
nim tyLent ast.html#tyLent TTypeKind.tyLent 177
nim tyVarargs ast.html#tyVarargs TTypeKind.tyVarargs 177
nim tyUncheckedArray ast.html#tyUncheckedArray TTypeKind.tyUncheckedArray 177
nim tyError ast.html#tyError TTypeKind.tyError 177
nim tyBuiltInTypeClass ast.html#tyBuiltInTypeClass TTypeKind.tyBuiltInTypeClass 177
nim tyUserTypeClass ast.html#tyUserTypeClass TTypeKind.tyUserTypeClass 177
nim tyUserTypeClassInst ast.html#tyUserTypeClassInst TTypeKind.tyUserTypeClassInst 177
nim tyCompositeTypeClass ast.html#tyCompositeTypeClass TTypeKind.tyCompositeTypeClass 177
nim tyInferred ast.html#tyInferred TTypeKind.tyInferred 177
nim tyAnd ast.html#tyAnd TTypeKind.tyAnd 177
nim tyOr ast.html#tyOr TTypeKind.tyOr 177
nim tyNot ast.html#tyNot TTypeKind.tyNot 177
nim tyAnything ast.html#tyAnything TTypeKind.tyAnything 177
nim tyStatic ast.html#tyStatic TTypeKind.tyStatic 177
nim tyFromExpr ast.html#tyFromExpr TTypeKind.tyFromExpr 177
nim tyConcept ast.html#tyConcept TTypeKind.tyConcept 177
nim tyVoid ast.html#tyVoid TTypeKind.tyVoid 177
nim tyIterable ast.html#tyIterable TTypeKind.tyIterable 177
nim TTypeKind ast.html#TTypeKind enum TTypeKind 177
nim tyPureObject ast.html#tyPureObject const tyPureObject 278
nim GcTypeKinds ast.html#GcTypeKinds const GcTypeKinds 279
nim tyTypeClasses ast.html#tyTypeClasses const tyTypeClasses 281
nim tyMetaTypes ast.html#tyMetaTypes const tyMetaTypes 285
nim tyUserTypeClasses ast.html#tyUserTypeClasses const tyUserTypeClasses 286
nim abstractVarRange ast.html#abstractVarRange const abstractVarRange 288
nim abstractInst ast.html#abstractInst const abstractInst 290
nim TTypeKinds ast.html#TTypeKinds type TTypeKinds 294
nim nfNone ast.html#nfNone TNodeFlag.nfNone 296
nim nfBase2 ast.html#nfBase2 TNodeFlag.nfBase2 296
nim nfBase8 ast.html#nfBase8 TNodeFlag.nfBase8 296
nim nfBase16 ast.html#nfBase16 TNodeFlag.nfBase16 296
nim nfAllConst ast.html#nfAllConst TNodeFlag.nfAllConst 296
nim nfTransf ast.html#nfTransf TNodeFlag.nfTransf 296
nim nfNoRewrite ast.html#nfNoRewrite TNodeFlag.nfNoRewrite 296
nim nfSem ast.html#nfSem TNodeFlag.nfSem 296
nim nfLL ast.html#nfLL TNodeFlag.nfLL 296
nim nfDotField ast.html#nfDotField TNodeFlag.nfDotField 296
nim nfDotSetter ast.html#nfDotSetter TNodeFlag.nfDotSetter 296
nim nfExplicitCall ast.html#nfExplicitCall TNodeFlag.nfExplicitCall 296
nim nfExprCall ast.html#nfExprCall TNodeFlag.nfExprCall 296
nim nfIsRef ast.html#nfIsRef TNodeFlag.nfIsRef 296
nim nfIsPtr ast.html#nfIsPtr TNodeFlag.nfIsPtr 296
nim nfPreventCg ast.html#nfPreventCg TNodeFlag.nfPreventCg 296
nim nfBlockArg ast.html#nfBlockArg TNodeFlag.nfBlockArg 296
nim nfFromTemplate ast.html#nfFromTemplate TNodeFlag.nfFromTemplate 296
nim nfDefaultParam ast.html#nfDefaultParam TNodeFlag.nfDefaultParam 296
nim nfDefaultRefsParam ast.html#nfDefaultRefsParam TNodeFlag.nfDefaultRefsParam 296
nim nfExecuteOnReload ast.html#nfExecuteOnReload TNodeFlag.nfExecuteOnReload 296
nim nfLastRead ast.html#nfLastRead TNodeFlag.nfLastRead 296
nim nfFirstWrite ast.html#nfFirstWrite TNodeFlag.nfFirstWrite 296
nim nfHasComment ast.html#nfHasComment TNodeFlag.nfHasComment 296
nim nfSkipFieldChecking ast.html#nfSkipFieldChecking TNodeFlag.nfSkipFieldChecking 296
nim nfDisabledOpenSym ast.html#nfDisabledOpenSym TNodeFlag.nfDisabledOpenSym 296
nim TNodeFlag ast.html#TNodeFlag enum TNodeFlag 296
nim TNodeFlags ast.html#TNodeFlags type TNodeFlags 329
nim tfVarargs ast.html#tfVarargs TTypeFlag.tfVarargs 330
nim tfNoSideEffect ast.html#tfNoSideEffect TTypeFlag.tfNoSideEffect 330
nim tfFinal ast.html#tfFinal TTypeFlag.tfFinal 330
nim tfInheritable ast.html#tfInheritable TTypeFlag.tfInheritable 330
nim tfHasOwned ast.html#tfHasOwned TTypeFlag.tfHasOwned 330
nim tfEnumHasHoles ast.html#tfEnumHasHoles TTypeFlag.tfEnumHasHoles 330
nim tfShallow ast.html#tfShallow TTypeFlag.tfShallow 330
nim tfThread ast.html#tfThread TTypeFlag.tfThread 330
nim tfFromGeneric ast.html#tfFromGeneric TTypeFlag.tfFromGeneric 330
nim tfUnresolved ast.html#tfUnresolved TTypeFlag.tfUnresolved 330
nim tfResolved ast.html#tfResolved TTypeFlag.tfResolved 330
nim tfRetType ast.html#tfRetType TTypeFlag.tfRetType 330
nim tfCapturesEnv ast.html#tfCapturesEnv TTypeFlag.tfCapturesEnv 330
nim tfByCopy ast.html#tfByCopy TTypeFlag.tfByCopy 330
nim tfByRef ast.html#tfByRef TTypeFlag.tfByRef 330
nim tfIterator ast.html#tfIterator TTypeFlag.tfIterator 330
nim tfPartial ast.html#tfPartial TTypeFlag.tfPartial 330
nim tfNotNil ast.html#tfNotNil TTypeFlag.tfNotNil 330
nim tfRequiresInit ast.html#tfRequiresInit TTypeFlag.tfRequiresInit 330
nim tfNeedsFullInit ast.html#tfNeedsFullInit TTypeFlag.tfNeedsFullInit 330
nim tfVarIsPtr ast.html#tfVarIsPtr TTypeFlag.tfVarIsPtr 330
nim tfHasMeta ast.html#tfHasMeta TTypeFlag.tfHasMeta 330
nim tfHasGCedMem ast.html#tfHasGCedMem TTypeFlag.tfHasGCedMem 330
nim tfPacked ast.html#tfPacked TTypeFlag.tfPacked 330
nim tfHasStatic ast.html#tfHasStatic TTypeFlag.tfHasStatic 330
nim tfGenericTypeParam ast.html#tfGenericTypeParam TTypeFlag.tfGenericTypeParam 330
nim tfImplicitTypeParam ast.html#tfImplicitTypeParam TTypeFlag.tfImplicitTypeParam 330
nim tfInferrableStatic ast.html#tfInferrableStatic TTypeFlag.tfInferrableStatic 330
nim tfConceptMatchedTypeSym ast.html#tfConceptMatchedTypeSym TTypeFlag.tfConceptMatchedTypeSym 330
nim tfExplicit ast.html#tfExplicit TTypeFlag.tfExplicit 330
nim tfWildcard ast.html#tfWildcard TTypeFlag.tfWildcard 330
nim tfHasAsgn ast.html#tfHasAsgn TTypeFlag.tfHasAsgn 330
nim tfBorrowDot ast.html#tfBorrowDot TTypeFlag.tfBorrowDot 330
nim tfTriggersCompileTime ast.html#tfTriggersCompileTime TTypeFlag.tfTriggersCompileTime 330
nim tfRefsAnonObj ast.html#tfRefsAnonObj TTypeFlag.tfRefsAnonObj 330
nim tfCovariant ast.html#tfCovariant TTypeFlag.tfCovariant 330
nim tfWeakCovariant ast.html#tfWeakCovariant TTypeFlag.tfWeakCovariant 330
nim tfContravariant ast.html#tfContravariant TTypeFlag.tfContravariant 330
nim tfCheckedForDestructor ast.html#tfCheckedForDestructor TTypeFlag.tfCheckedForDestructor 330
nim tfAcyclic ast.html#tfAcyclic TTypeFlag.tfAcyclic 330
nim tfIncompleteStruct ast.html#tfIncompleteStruct TTypeFlag.tfIncompleteStruct 330
nim tfCompleteStruct ast.html#tfCompleteStruct TTypeFlag.tfCompleteStruct 330
nim tfExplicitCallConv ast.html#tfExplicitCallConv TTypeFlag.tfExplicitCallConv 330
nim tfIsConstructor ast.html#tfIsConstructor TTypeFlag.tfIsConstructor 330
nim tfEffectSystemWorkaround ast.html#tfEffectSystemWorkaround TTypeFlag.tfEffectSystemWorkaround 330
nim tfIsOutParam ast.html#tfIsOutParam TTypeFlag.tfIsOutParam 330
nim tfSendable ast.html#tfSendable TTypeFlag.tfSendable 330
nim tfImplicitStatic ast.html#tfImplicitStatic TTypeFlag.tfImplicitStatic 330
nim TTypeFlag ast.html#TTypeFlag enum TTypeFlag 330
nim TTypeFlags ast.html#TTypeFlags type TTypeFlags 403
nim skUnknown ast.html#skUnknown TSymKind.skUnknown 405
nim skConditional ast.html#skConditional TSymKind.skConditional 405
nim skDynLib ast.html#skDynLib TSymKind.skDynLib 405
nim skParam ast.html#skParam TSymKind.skParam 405
nim skGenericParam ast.html#skGenericParam TSymKind.skGenericParam 405
nim skTemp ast.html#skTemp TSymKind.skTemp 405
nim skModule ast.html#skModule TSymKind.skModule 405
nim skType ast.html#skType TSymKind.skType 405
nim skVar ast.html#skVar TSymKind.skVar 405
nim skLet ast.html#skLet TSymKind.skLet 405
nim skConst ast.html#skConst TSymKind.skConst 405
nim skResult ast.html#skResult TSymKind.skResult 405
nim skProc ast.html#skProc TSymKind.skProc 405
nim skFunc ast.html#skFunc TSymKind.skFunc 405
nim skMethod ast.html#skMethod TSymKind.skMethod 405
nim skIterator ast.html#skIterator TSymKind.skIterator 405
nim skConverter ast.html#skConverter TSymKind.skConverter 405
nim skMacro ast.html#skMacro TSymKind.skMacro 405
nim skTemplate ast.html#skTemplate TSymKind.skTemplate 405
nim skField ast.html#skField TSymKind.skField 405
nim skEnumField ast.html#skEnumField TSymKind.skEnumField 405
nim skForVar ast.html#skForVar TSymKind.skForVar 405
nim skLabel ast.html#skLabel TSymKind.skLabel 405
nim skStub ast.html#skStub TSymKind.skStub 405
nim skPackage ast.html#skPackage TSymKind.skPackage 405
nim TSymKind ast.html#TSymKind enum TSymKind 405
nim TSymKinds ast.html#TSymKinds type TSymKinds 437
nim routineKinds ast.html#routineKinds const routineKinds 440
nim ExportableSymKinds ast.html#ExportableSymKinds const ExportableSymKinds 442
nim tfUnion ast.html#tfUnion const tfUnion 444
nim tfGcSafe ast.html#tfGcSafe const tfGcSafe 445
nim tfObjHasKids ast.html#tfObjHasKids const tfObjHasKids 446
nim tfReturnsNew ast.html#tfReturnsNew const tfReturnsNew 447
nim tfNonConstExpr ast.html#tfNonConstExpr const tfNonConstExpr 448
nim tfGenericHasDestructor ast.html#tfGenericHasDestructor const tfGenericHasDestructor 450
nim skError ast.html#skError const skError 452
nim eqTypeFlags ast.html#eqTypeFlags var eqTypeFlags 455
nim mNone ast.html#mNone TMagic.mNone 461
nim mDefined ast.html#mDefined TMagic.mDefined 461
nim mDeclared ast.html#mDeclared TMagic.mDeclared 461
nim mDeclaredInScope ast.html#mDeclaredInScope TMagic.mDeclaredInScope 461
nim mCompiles ast.html#mCompiles TMagic.mCompiles 461
nim mArrGet ast.html#mArrGet TMagic.mArrGet 461
nim mArrPut ast.html#mArrPut TMagic.mArrPut 461
nim mAsgn ast.html#mAsgn TMagic.mAsgn 461
nim mLow ast.html#mLow TMagic.mLow 461
nim mHigh ast.html#mHigh TMagic.mHigh 461
nim mSizeOf ast.html#mSizeOf TMagic.mSizeOf 461
nim mAlignOf ast.html#mAlignOf TMagic.mAlignOf 461
nim mOffsetOf ast.html#mOffsetOf TMagic.mOffsetOf 461
nim mTypeTrait ast.html#mTypeTrait TMagic.mTypeTrait 461
nim mIs ast.html#mIs TMagic.mIs 461
nim mOf ast.html#mOf TMagic.mOf 461
nim mAddr ast.html#mAddr TMagic.mAddr 461
nim mType ast.html#mType TMagic.mType 461
nim mTypeOf ast.html#mTypeOf TMagic.mTypeOf 461
nim mPlugin ast.html#mPlugin TMagic.mPlugin 461
nim mEcho ast.html#mEcho TMagic.mEcho 461
nim mShallowCopy ast.html#mShallowCopy TMagic.mShallowCopy 461
nim mSlurp ast.html#mSlurp TMagic.mSlurp 461
nim mStaticExec ast.html#mStaticExec TMagic.mStaticExec 461
nim mStatic ast.html#mStatic TMagic.mStatic 461
nim mParseExprToAst ast.html#mParseExprToAst TMagic.mParseExprToAst 461
nim mParseStmtToAst ast.html#mParseStmtToAst TMagic.mParseStmtToAst 461
nim mExpandToAst ast.html#mExpandToAst TMagic.mExpandToAst 461
nim mQuoteAst ast.html#mQuoteAst TMagic.mQuoteAst 461
nim mInc ast.html#mInc TMagic.mInc 461
nim mDec ast.html#mDec TMagic.mDec 461
nim mOrd ast.html#mOrd TMagic.mOrd 461
nim mNew ast.html#mNew TMagic.mNew 461
nim mNewFinalize ast.html#mNewFinalize TMagic.mNewFinalize 461
nim mNewSeq ast.html#mNewSeq TMagic.mNewSeq 461
nim mNewSeqOfCap ast.html#mNewSeqOfCap TMagic.mNewSeqOfCap 461
nim mLengthOpenArray ast.html#mLengthOpenArray TMagic.mLengthOpenArray 461
nim mLengthStr ast.html#mLengthStr TMagic.mLengthStr 461
nim mLengthArray ast.html#mLengthArray TMagic.mLengthArray 461
nim mLengthSeq ast.html#mLengthSeq TMagic.mLengthSeq 461
nim mIncl ast.html#mIncl TMagic.mIncl 461
nim mExcl ast.html#mExcl TMagic.mExcl 461
nim mCard ast.html#mCard TMagic.mCard 461
nim mChr ast.html#mChr TMagic.mChr 461
nim mGCref ast.html#mGCref TMagic.mGCref 461
nim mGCunref ast.html#mGCunref TMagic.mGCunref 461
nim mAddI ast.html#mAddI TMagic.mAddI 461
nim mSubI ast.html#mSubI TMagic.mSubI 461
nim mMulI ast.html#mMulI TMagic.mMulI 461
nim mDivI ast.html#mDivI TMagic.mDivI 461
nim mModI ast.html#mModI TMagic.mModI 461
nim mSucc ast.html#mSucc TMagic.mSucc 461
nim mPred ast.html#mPred TMagic.mPred 461
nim mAddF64 ast.html#mAddF64 TMagic.mAddF64 461
nim mSubF64 ast.html#mSubF64 TMagic.mSubF64 461
nim mMulF64 ast.html#mMulF64 TMagic.mMulF64 461
nim mDivF64 ast.html#mDivF64 TMagic.mDivF64 461
nim mShrI ast.html#mShrI TMagic.mShrI 461
nim mShlI ast.html#mShlI TMagic.mShlI 461
nim mAshrI ast.html#mAshrI TMagic.mAshrI 461
nim mBitandI ast.html#mBitandI TMagic.mBitandI 461
nim mBitorI ast.html#mBitorI TMagic.mBitorI 461
nim mBitxorI ast.html#mBitxorI TMagic.mBitxorI 461
nim mMinI ast.html#mMinI TMagic.mMinI 461
nim mMaxI ast.html#mMaxI TMagic.mMaxI 461
nim mAddU ast.html#mAddU TMagic.mAddU 461
nim mSubU ast.html#mSubU TMagic.mSubU 461
nim mMulU ast.html#mMulU TMagic.mMulU 461
nim mDivU ast.html#mDivU TMagic.mDivU 461
nim mModU ast.html#mModU TMagic.mModU 461
nim mEqI ast.html#mEqI TMagic.mEqI 461
nim mLeI ast.html#mLeI TMagic.mLeI 461
nim mLtI ast.html#mLtI TMagic.mLtI 461
nim mEqF64 ast.html#mEqF64 TMagic.mEqF64 461
nim mLeF64 ast.html#mLeF64 TMagic.mLeF64 461
nim mLtF64 ast.html#mLtF64 TMagic.mLtF64 461
nim mLeU ast.html#mLeU TMagic.mLeU 461
nim mLtU ast.html#mLtU TMagic.mLtU 461
nim mEqEnum ast.html#mEqEnum TMagic.mEqEnum 461
nim mLeEnum ast.html#mLeEnum TMagic.mLeEnum 461
nim mLtEnum ast.html#mLtEnum TMagic.mLtEnum 461
nim mEqCh ast.html#mEqCh TMagic.mEqCh 461
nim mLeCh ast.html#mLeCh TMagic.mLeCh 461
nim mLtCh ast.html#mLtCh TMagic.mLtCh 461
nim mEqB ast.html#mEqB TMagic.mEqB 461
nim mLeB ast.html#mLeB TMagic.mLeB 461
nim mLtB ast.html#mLtB TMagic.mLtB 461
nim mEqRef ast.html#mEqRef TMagic.mEqRef 461
nim mLePtr ast.html#mLePtr TMagic.mLePtr 461
nim mLtPtr ast.html#mLtPtr TMagic.mLtPtr 461
nim mXor ast.html#mXor TMagic.mXor 461
nim mEqCString ast.html#mEqCString TMagic.mEqCString 461
nim mEqProc ast.html#mEqProc TMagic.mEqProc 461
nim mUnaryMinusI ast.html#mUnaryMinusI TMagic.mUnaryMinusI 461
nim mUnaryMinusI64 ast.html#mUnaryMinusI64 TMagic.mUnaryMinusI64 461
nim mAbsI ast.html#mAbsI TMagic.mAbsI 461
nim mNot ast.html#mNot TMagic.mNot 461
nim mUnaryPlusI ast.html#mUnaryPlusI TMagic.mUnaryPlusI 461
nim mBitnotI ast.html#mBitnotI TMagic.mBitnotI 461
nim mUnaryPlusF64 ast.html#mUnaryPlusF64 TMagic.mUnaryPlusF64 461
nim mUnaryMinusF64 ast.html#mUnaryMinusF64 TMagic.mUnaryMinusF64 461
nim mCharToStr ast.html#mCharToStr TMagic.mCharToStr 461
nim mBoolToStr ast.html#mBoolToStr TMagic.mBoolToStr 461
nim mCStrToStr ast.html#mCStrToStr TMagic.mCStrToStr 461
nim mStrToStr ast.html#mStrToStr TMagic.mStrToStr 461
nim mEnumToStr ast.html#mEnumToStr TMagic.mEnumToStr 461
nim mAnd ast.html#mAnd TMagic.mAnd 461
nim mOr ast.html#mOr TMagic.mOr 461
nim mImplies ast.html#mImplies TMagic.mImplies 461
nim mIff ast.html#mIff TMagic.mIff 461
nim mExists ast.html#mExists TMagic.mExists 461
nim mForall ast.html#mForall TMagic.mForall 461
nim mOld ast.html#mOld TMagic.mOld 461
nim mEqStr ast.html#mEqStr TMagic.mEqStr 461
nim mLeStr ast.html#mLeStr TMagic.mLeStr 461
nim mLtStr ast.html#mLtStr TMagic.mLtStr 461
nim mEqSet ast.html#mEqSet TMagic.mEqSet 461
nim mLeSet ast.html#mLeSet TMagic.mLeSet 461
nim mLtSet ast.html#mLtSet TMagic.mLtSet 461
nim mMulSet ast.html#mMulSet TMagic.mMulSet 461
nim mPlusSet ast.html#mPlusSet TMagic.mPlusSet 461
nim mMinusSet ast.html#mMinusSet TMagic.mMinusSet 461
nim mXorSet ast.html#mXorSet TMagic.mXorSet 461
nim mConStrStr ast.html#mConStrStr TMagic.mConStrStr 461
nim mSlice ast.html#mSlice TMagic.mSlice 461
nim mDotDot ast.html#mDotDot TMagic.mDotDot 461
nim mFields ast.html#mFields TMagic.mFields 461
nim mFieldPairs ast.html#mFieldPairs TMagic.mFieldPairs 461
nim mOmpParFor ast.html#mOmpParFor TMagic.mOmpParFor 461
nim mAppendStrCh ast.html#mAppendStrCh TMagic.mAppendStrCh 461
nim mAppendStrStr ast.html#mAppendStrStr TMagic.mAppendStrStr 461
nim mAppendSeqElem ast.html#mAppendSeqElem TMagic.mAppendSeqElem 461
nim mInSet ast.html#mInSet TMagic.mInSet 461
nim mRepr ast.html#mRepr TMagic.mRepr 461
nim mExit ast.html#mExit TMagic.mExit 461
nim mSetLengthStr ast.html#mSetLengthStr TMagic.mSetLengthStr 461
nim mSetLengthSeq ast.html#mSetLengthSeq TMagic.mSetLengthSeq 461
nim mSetLengthSeqUninit ast.html#mSetLengthSeqUninit TMagic.mSetLengthSeqUninit 461
nim mIsPartOf ast.html#mIsPartOf TMagic.mIsPartOf 461
nim mAstToStr ast.html#mAstToStr TMagic.mAstToStr 461
nim mParallel ast.html#mParallel TMagic.mParallel 461
nim mSwap ast.html#mSwap TMagic.mSwap 461
nim mIsNil ast.html#mIsNil TMagic.mIsNil 461
nim mArrToSeq ast.html#mArrToSeq TMagic.mArrToSeq 461
nim mOpenArrayToSeq ast.html#mOpenArrayToSeq TMagic.mOpenArrayToSeq 461
nim mNewString ast.html#mNewString TMagic.mNewString 461
nim mNewStringOfCap ast.html#mNewStringOfCap TMagic.mNewStringOfCap 461
nim mParseBiggestFloat ast.html#mParseBiggestFloat TMagic.mParseBiggestFloat 461
nim mMove ast.html#mMove TMagic.mMove 461
nim mEnsureMove ast.html#mEnsureMove TMagic.mEnsureMove 461
nim mWasMoved ast.html#mWasMoved TMagic.mWasMoved 461
nim mDup ast.html#mDup TMagic.mDup 461
nim mDestroy ast.html#mDestroy TMagic.mDestroy 461
nim mTrace ast.html#mTrace TMagic.mTrace 461
nim mDefault ast.html#mDefault TMagic.mDefault 461
nim mUnown ast.html#mUnown TMagic.mUnown 461
nim mFinished ast.html#mFinished TMagic.mFinished 461
nim mIsolate ast.html#mIsolate TMagic.mIsolate 461
nim mAccessEnv ast.html#mAccessEnv TMagic.mAccessEnv 461
nim mAccessTypeField ast.html#mAccessTypeField TMagic.mAccessTypeField 461
nim mArray ast.html#mArray TMagic.mArray 461
nim mOpenArray ast.html#mOpenArray TMagic.mOpenArray 461
nim mRange ast.html#mRange TMagic.mRange 461
nim mSet ast.html#mSet TMagic.mSet 461
nim mSeq ast.html#mSeq TMagic.mSeq 461
nim mVarargs ast.html#mVarargs TMagic.mVarargs 461
nim mRef ast.html#mRef TMagic.mRef 461
nim mPtr ast.html#mPtr TMagic.mPtr 461
nim mVar ast.html#mVar TMagic.mVar 461
nim mDistinct ast.html#mDistinct TMagic.mDistinct 461
nim mVoid ast.html#mVoid TMagic.mVoid 461
nim mTuple ast.html#mTuple TMagic.mTuple 461
nim mOrdinal ast.html#mOrdinal TMagic.mOrdinal 461
nim mIterableType ast.html#mIterableType TMagic.mIterableType 461
nim mInt ast.html#mInt TMagic.mInt 461
nim mInt8 ast.html#mInt8 TMagic.mInt8 461
nim mInt16 ast.html#mInt16 TMagic.mInt16 461
nim mInt32 ast.html#mInt32 TMagic.mInt32 461
nim mInt64 ast.html#mInt64 TMagic.mInt64 461
nim mUInt ast.html#mUInt TMagic.mUInt 461
nim mUInt8 ast.html#mUInt8 TMagic.mUInt8 461
nim mUInt16 ast.html#mUInt16 TMagic.mUInt16 461
nim mUInt32 ast.html#mUInt32 TMagic.mUInt32 461
nim mUInt64 ast.html#mUInt64 TMagic.mUInt64 461
nim mFloat ast.html#mFloat TMagic.mFloat 461
nim mFloat32 ast.html#mFloat32 TMagic.mFloat32 461
nim mFloat64 ast.html#mFloat64 TMagic.mFloat64 461
nim mFloat128 ast.html#mFloat128 TMagic.mFloat128 461
nim mBool ast.html#mBool TMagic.mBool 461
nim mChar ast.html#mChar TMagic.mChar 461
nim mString ast.html#mString TMagic.mString 461
nim mCstring ast.html#mCstring TMagic.mCstring 461
nim mPointer ast.html#mPointer TMagic.mPointer 461
nim mNil ast.html#mNil TMagic.mNil 461
nim mExpr ast.html#mExpr TMagic.mExpr 461
nim mStmt ast.html#mStmt TMagic.mStmt 461
nim mTypeDesc ast.html#mTypeDesc TMagic.mTypeDesc 461
nim mVoidType ast.html#mVoidType TMagic.mVoidType 461
nim mPNimrodNode ast.html#mPNimrodNode TMagic.mPNimrodNode 461
nim mSpawn ast.html#mSpawn TMagic.mSpawn 461
nim mDeepCopy ast.html#mDeepCopy TMagic.mDeepCopy 461
nim mIsMainModule ast.html#mIsMainModule TMagic.mIsMainModule 461
nim mCompileDate ast.html#mCompileDate TMagic.mCompileDate 461
nim mCompileTime ast.html#mCompileTime TMagic.mCompileTime 461
nim mProcCall ast.html#mProcCall TMagic.mProcCall 461
nim mCpuEndian ast.html#mCpuEndian TMagic.mCpuEndian 461
nim mHostOS ast.html#mHostOS TMagic.mHostOS 461
nim mHostCPU ast.html#mHostCPU TMagic.mHostCPU 461
nim mBuildOS ast.html#mBuildOS TMagic.mBuildOS 461
nim mBuildCPU ast.html#mBuildCPU TMagic.mBuildCPU 461
nim mAppType ast.html#mAppType TMagic.mAppType 461
nim mCompileOption ast.html#mCompileOption TMagic.mCompileOption 461
nim mCompileOptionArg ast.html#mCompileOptionArg TMagic.mCompileOptionArg 461
nim mNLen ast.html#mNLen TMagic.mNLen 461
nim mNChild ast.html#mNChild TMagic.mNChild 461
nim mNSetChild ast.html#mNSetChild TMagic.mNSetChild 461
nim mNAdd ast.html#mNAdd TMagic.mNAdd 461
nim mNAddMultiple ast.html#mNAddMultiple TMagic.mNAddMultiple 461
nim mNDel ast.html#mNDel TMagic.mNDel 461
nim mNKind ast.html#mNKind TMagic.mNKind 461
nim mNSymKind ast.html#mNSymKind TMagic.mNSymKind 461
nim mNccValue ast.html#mNccValue TMagic.mNccValue 461
nim mNccInc ast.html#mNccInc TMagic.mNccInc 461
nim mNcsAdd ast.html#mNcsAdd TMagic.mNcsAdd 461
nim mNcsIncl ast.html#mNcsIncl TMagic.mNcsIncl 461
nim mNcsLen ast.html#mNcsLen TMagic.mNcsLen 461
nim mNcsAt ast.html#mNcsAt TMagic.mNcsAt 461
nim mNctPut ast.html#mNctPut TMagic.mNctPut 461
nim mNctLen ast.html#mNctLen TMagic.mNctLen 461
nim mNctGet ast.html#mNctGet TMagic.mNctGet 461
nim mNctHasNext ast.html#mNctHasNext TMagic.mNctHasNext 461
nim mNctNext ast.html#mNctNext TMagic.mNctNext 461
nim mNIntVal ast.html#mNIntVal TMagic.mNIntVal 461
nim mNFloatVal ast.html#mNFloatVal TMagic.mNFloatVal 461
nim mNSymbol ast.html#mNSymbol TMagic.mNSymbol 461
nim mNIdent ast.html#mNIdent TMagic.mNIdent 461
nim mNGetType ast.html#mNGetType TMagic.mNGetType 461
nim mNStrVal ast.html#mNStrVal TMagic.mNStrVal 461
nim mNSetIntVal ast.html#mNSetIntVal TMagic.mNSetIntVal 461
nim mNSetFloatVal ast.html#mNSetFloatVal TMagic.mNSetFloatVal 461
nim mNSetSymbol ast.html#mNSetSymbol TMagic.mNSetSymbol 461
nim mNSetIdent ast.html#mNSetIdent TMagic.mNSetIdent 461
nim mNSetStrVal ast.html#mNSetStrVal TMagic.mNSetStrVal 461
nim mNLineInfo ast.html#mNLineInfo TMagic.mNLineInfo 461
nim mNNewNimNode ast.html#mNNewNimNode TMagic.mNNewNimNode 461
nim mNCopyNimNode ast.html#mNCopyNimNode TMagic.mNCopyNimNode 461
nim mNCopyNimTree ast.html#mNCopyNimTree TMagic.mNCopyNimTree 461
nim mStrToIdent ast.html#mStrToIdent TMagic.mStrToIdent 461
nim mNSigHash ast.html#mNSigHash TMagic.mNSigHash 461
nim mNSizeOf ast.html#mNSizeOf TMagic.mNSizeOf 461
nim mNBindSym ast.html#mNBindSym TMagic.mNBindSym 461
nim mNCallSite ast.html#mNCallSite TMagic.mNCallSite 461
nim mEqIdent ast.html#mEqIdent TMagic.mEqIdent 461
nim mEqNimrodNode ast.html#mEqNimrodNode TMagic.mEqNimrodNode 461
nim mSameNodeType ast.html#mSameNodeType TMagic.mSameNodeType 461
nim mGetImpl ast.html#mGetImpl TMagic.mGetImpl 461
nim mNGenSym ast.html#mNGenSym TMagic.mNGenSym 461
nim mNHint ast.html#mNHint TMagic.mNHint 461
nim mNWarning ast.html#mNWarning TMagic.mNWarning 461
nim mNError ast.html#mNError TMagic.mNError 461
nim mInstantiationInfo ast.html#mInstantiationInfo TMagic.mInstantiationInfo 461
nim mGetTypeInfo ast.html#mGetTypeInfo TMagic.mGetTypeInfo 461
nim mGetTypeInfoV2 ast.html#mGetTypeInfoV2 TMagic.mGetTypeInfoV2 461
nim mNimvm ast.html#mNimvm TMagic.mNimvm 461
nim mIntDefine ast.html#mIntDefine TMagic.mIntDefine 461
nim mStrDefine ast.html#mStrDefine TMagic.mStrDefine 461
nim mBoolDefine ast.html#mBoolDefine TMagic.mBoolDefine 461
nim mGenericDefine ast.html#mGenericDefine TMagic.mGenericDefine 461
nim mRunnableExamples ast.html#mRunnableExamples TMagic.mRunnableExamples 461
nim mException ast.html#mException TMagic.mException 461
nim mBuiltinType ast.html#mBuiltinType TMagic.mBuiltinType 461
nim mSymOwner ast.html#mSymOwner TMagic.mSymOwner 461
nim mUncheckedArray ast.html#mUncheckedArray TMagic.mUncheckedArray 461
nim mGetImplTransf ast.html#mGetImplTransf TMagic.mGetImplTransf 461
nim mSymIsInstantiationOf ast.html#mSymIsInstantiationOf TMagic.mSymIsInstantiationOf 461
nim mNodeId ast.html#mNodeId TMagic.mNodeId 461
nim mPrivateAccess ast.html#mPrivateAccess TMagic.mPrivateAccess 461
nim mZeroDefault ast.html#mZeroDefault TMagic.mZeroDefault 461
nim TMagic ast.html#TMagic enum TMagic 461
nim ctfeWhitelist ast.html#ctfeWhitelist const ctfeWhitelist 541
nim generatedMagics ast.html#generatedMagics const generatedMagics 569
nim ItemId ast.html#ItemId object ItemId 573
nim `$` ast.html#$,ItemId proc `$`(x: ItemId): string 577
nim `==` ast.html#==,ItemId,ItemId proc `==`(a, b: ItemId): bool 580
nim hash ast.html#hash,ItemId proc hash(x: ItemId): Hash 583
nim PNode ast.html#PNode type PNode 590
nim TNodeSeq ast.html#TNodeSeq type TNodeSeq 591
nim PType ast.html#PType type PType 592
nim PSym ast.html#PSym type PSym 593
nim TNode ast.html#TNode object TNode 594
nim TStrTable ast.html#TStrTable object TStrTable 616
nim locNone ast.html#locNone TLocKind.locNone 621
nim locTemp ast.html#locTemp TLocKind.locTemp 621
nim locLocalVar ast.html#locLocalVar TLocKind.locLocalVar 621
nim locGlobalVar ast.html#locGlobalVar TLocKind.locGlobalVar 621
nim locParam ast.html#locParam TLocKind.locParam 621
nim locField ast.html#locField TLocKind.locField 621
nim locExpr ast.html#locExpr TLocKind.locExpr 621
nim locProc ast.html#locProc TLocKind.locProc 621
nim locData ast.html#locData TLocKind.locData 621
nim locCall ast.html#locCall TLocKind.locCall 621
nim locOther ast.html#locOther TLocKind.locOther 621
nim TLocKind ast.html#TLocKind enum TLocKind 621
nim lfIndirect ast.html#lfIndirect TLocFlag.lfIndirect 633
nim lfNoDeepCopy ast.html#lfNoDeepCopy TLocFlag.lfNoDeepCopy 633
nim lfNoDecl ast.html#lfNoDecl TLocFlag.lfNoDecl 633
nim lfDynamicLib ast.html#lfDynamicLib TLocFlag.lfDynamicLib 633
nim lfExportLib ast.html#lfExportLib TLocFlag.lfExportLib 633
nim lfHeader ast.html#lfHeader TLocFlag.lfHeader 633
nim lfImportCompilerProc ast.html#lfImportCompilerProc TLocFlag.lfImportCompilerProc 633
nim lfSingleUse ast.html#lfSingleUse TLocFlag.lfSingleUse 633
nim lfEnforceDeref ast.html#lfEnforceDeref TLocFlag.lfEnforceDeref 633
nim lfPrepareForMutation ast.html#lfPrepareForMutation TLocFlag.lfPrepareForMutation 633
nim TLocFlag ast.html#TLocFlag enum TLocFlag 633
nim OnUnknown ast.html#OnUnknown TStorageLoc.OnUnknown 646
nim OnStatic ast.html#OnStatic TStorageLoc.OnStatic 646
nim OnStack ast.html#OnStack TStorageLoc.OnStack 646
nim OnHeap ast.html#OnHeap TStorageLoc.OnHeap 646
nim TStorageLoc ast.html#TStorageLoc enum TStorageLoc 646
nim TLocFlags ast.html#TLocFlags type TLocFlags 652
nim TLoc ast.html#TLoc object TLoc 653
nim libHeader ast.html#libHeader TLibKind.libHeader 662
nim libDynamic ast.html#libDynamic TLibKind.libDynamic 662
nim TLibKind ast.html#TLibKind enum TLibKind 662
nim TLib ast.html#TLib object TLib 665
nim CompilesId ast.html#CompilesId type CompilesId 674
nim TInstantiation ast.html#TInstantiation object TInstantiation 676
nim PInstantiation ast.html#PInstantiation type PInstantiation 684
nim TScope ast.html#TScope object TScope 686
nim PScope ast.html#PScope type PScope 693
nim PLib ast.html#PLib type PLib 695
nim TSym ast.html#TSym object TSym 696
nim TTypeSeq ast.html#TTypeSeq type TTypeSeq 755
nim attachedWasMoved ast.html#attachedWasMoved TTypeAttachedOp.attachedWasMoved 757
nim attachedDestructor ast.html#attachedDestructor TTypeAttachedOp.attachedDestructor 757
nim attachedAsgn ast.html#attachedAsgn TTypeAttachedOp.attachedAsgn 757
nim attachedDup ast.html#attachedDup TTypeAttachedOp.attachedDup 757
nim attachedSink ast.html#attachedSink TTypeAttachedOp.attachedSink 757
nim attachedTrace ast.html#attachedTrace TTypeAttachedOp.attachedTrace 757
nim attachedDeepCopy ast.html#attachedDeepCopy TTypeAttachedOp.attachedDeepCopy 757
nim TTypeAttachedOp ast.html#TTypeAttachedOp enum TTypeAttachedOp 757
nim TType ast.html#TType object TType 766
nim TPair ast.html#TPair object TPair 798
nim TPairSeq ast.html#TPairSeq type TPairSeq 801
nim TIdPair ast.html#TIdPair object TIdPair 803
nim TIdPairSeq ast.html#TIdPairSeq type TIdPairSeq 807
nim TIdTable ast.html#TIdTable object TIdTable 808
nim TNodePair ast.html#TNodePair object TNodePair 812
nim TNodePairSeq ast.html#TNodePairSeq type TNodePairSeq 817
nim TNodeTable ast.html#TNodeTable object TNodeTable 818
nim TObjectSeq ast.html#TObjectSeq type TObjectSeq 824
nim TObjectSet ast.html#TObjectSet object TObjectSet 825
nim impUnknown ast.html#impUnknown TImplication.impUnknown 829
nim impNo ast.html#impNo TImplication.impNo 829
nim impYes ast.html#impYes TImplication.impYes 829
nim TImplication ast.html#TImplication enum TImplication 829
nim typ ast.html#typ.t,PNode template typ(n: PNode): PType 834
nim owner ast.html#owner proc owner(s: PSym | PType): PSym 837
nim setOwner ast.html#setOwner,,PSym proc setOwner(s: PSym | PType; owner: PSym) 840
nim setUseIc ast.html#setUseIc,bool proc setUseIc(useIc: bool) 851
nim comment ast.html#comment,PNode proc comment(n: PNode): string 853
nim comment= ast.html#comment=,PNode,string proc comment=(n: PNode; a: string) 860
nim OverloadableSyms ast.html#OverloadableSyms const OverloadableSyms 880
nim GenericTypes ast.html#GenericTypes const GenericTypes 883
nim StructuralEquivTypes ast.html#StructuralEquivTypes const StructuralEquivTypes 886
nim ConcreteTypes ast.html#ConcreteTypes const ConcreteTypes 890
nim IntegralTypes ast.html#IntegralTypes const IntegralTypes 897
nim ConstantDataTypes ast.html#ConstantDataTypes const ConstantDataTypes 899
nim NilableTypes ast.html#NilableTypes const NilableTypes 901
nim PtrLikeKinds ast.html#PtrLikeKinds const PtrLikeKinds 903
nim PersistentNodeFlags ast.html#PersistentNodeFlags const PersistentNodeFlags 904
nim namePos ast.html#namePos const namePos 911
nim patternPos ast.html#patternPos const patternPos 912
nim genericParamsPos ast.html#genericParamsPos const genericParamsPos 913
nim paramsPos ast.html#paramsPos const paramsPos 914
nim pragmasPos ast.html#pragmasPos const pragmasPos 915
nim miscPos ast.html#miscPos const miscPos 916
nim bodyPos ast.html#bodyPos const bodyPos 917
nim resultPos ast.html#resultPos const resultPos 918
nim dispatcherPos ast.html#dispatcherPos const dispatcherPos 919
nim nfAllFieldsSet ast.html#nfAllFieldsSet const nfAllFieldsSet 921
nim nkIdentKinds ast.html#nkIdentKinds const nkIdentKinds 923
nim nkPragmaCallKinds ast.html#nkPragmaCallKinds const nkPragmaCallKinds 926
nim nkLiterals ast.html#nkLiterals const nkLiterals 927
nim nkFloatLiterals ast.html#nkFloatLiterals const nkFloatLiterals 928
nim nkLambdaKinds ast.html#nkLambdaKinds const nkLambdaKinds 929
nim declarativeDefs ast.html#declarativeDefs const declarativeDefs 930
nim routineDefs ast.html#routineDefs const routineDefs 931
nim procDefs ast.html#procDefs const procDefs 932
nim callableDefs ast.html#callableDefs const callableDefs 933
nim nkSymChoices ast.html#nkSymChoices const nkSymChoices 935
nim nkStrKinds ast.html#nkStrKinds const nkStrKinds 936
nim skLocalVars ast.html#skLocalVars const skLocalVars 938
nim skProcKinds ast.html#skProcKinds const skProcKinds 939
nim defaultOffset ast.html#defaultOffset const defaultOffset 944
nim getPIdent ast.html#getPIdent,PNode proc getPIdent(a: PNode): PIdent 946
nim toId ast.html#toId.t,ItemId template toId(a: ItemId): int 957
nim id ast.html#id.t template id(a: PType | PSym): int 961
nim IdGenerator ast.html#IdGenerator type IdGenerator 964
nim PackageModuleId ast.html#PackageModuleId const PackageModuleId 972
nim idGeneratorFromModule ast.html#idGeneratorFromModule,PSym proc idGeneratorFromModule(m: PSym): IdGenerator 974
nim idGeneratorForPackage ast.html#idGeneratorForPackage,int32 proc idGeneratorForPackage(nextIdWillBe: int32): IdGenerator 978
nim nextTypeId ast.html#nextTypeId,IdGenerator proc nextTypeId(x: IdGenerator): ItemId 986
nim ggDebug ast.html#ggDebug var ggDebug 1004
nim isCallExpr ast.html#isCallExpr,PNode proc isCallExpr(n: PNode): bool 1006
nim discardSons ast.html#discardSons,PNode proc discardSons(father: PNode) 1009
nim len ast.html#len,PNode proc len(n: PNode): int 1011
nim safeLen ast.html#safeLen,PNode proc safeLen(n: PNode): int 1014
nim safeArrLen ast.html#safeArrLen,PNode proc safeArrLen(n: PNode): int 1019
nim add ast.html#add,PNode,PNode proc add(father, son: PNode) 1025
nim addAllowNil ast.html#addAllowNil,PNode,PNode proc addAllowNil(father, son: PNode) 1029
nim `[]` ast.html#[].t,PNode,int template `[]`(n: PNode; i: int): PNode 1032
nim `[]=` ast.html#[]=.t,PNode,int,PNode template `[]=`(n: PNode; i: int; x: PNode) 1033
nim `[]` ast.html#[].t,PNode,BackwardsIndex template `[]`(n: PNode; i: BackwardsIndex): PNode 1035
nim `[]=` ast.html#[]=.t,PNode,BackwardsIndex,PNode template `[]=`(n: PNode; i: BackwardsIndex; x: PNode) 1036
nim add ast.html#add,PType,PType proc add(father, son: PType) 1038
nim addAllowNil ast.html#addAllowNil,PType,PType proc addAllowNil(father, son: PType) 1042
nim `[]` ast.html#[].t,PType,int template `[]`(n: PType; i: int): PType 1045
nim `[]=` ast.html#[]=.t,PType,int,PType template `[]=`(n: PType; i: int; x: PType) 1046
nim `[]` ast.html#[].t,PType,BackwardsIndex template `[]`(n: PType; i: BackwardsIndex): PType 1048
nim `[]=` ast.html#[]=.t,PType,BackwardsIndex,PType template `[]=`(n: PType; i: BackwardsIndex; x: PType) 1049
nim getDeclPragma ast.html#getDeclPragma,PNode proc getDeclPragma(n: PNode): PNode 1051
nim extractPragma ast.html#extractPragma,PSym proc extractPragma(s: PSym): PNode 1085
nim skipPragmaExpr ast.html#skipPragmaExpr,PNode proc skipPragmaExpr(n: PNode): PNode 1105
nim setInfoRecursive ast.html#setInfoRecursive,PNode,TLineInfo proc setInfoRecursive(n: PNode; info: TLineInfo) 1113
nim newNode ast.html#newNode,TNodeKind proc newNode(kind: TNodeKind): PNode 1141
nim newNodeI ast.html#newNodeI,TNodeKind,TLineInfo proc newNodeI(kind: TNodeKind; info: TLineInfo): PNode 1146
nim newNodeI ast.html#newNodeI,TNodeKind,TLineInfo,int proc newNodeI(kind: TNodeKind; info: TLineInfo; children: int): PNode 1151
nim newNodeIT ast.html#newNodeIT,TNodeKind,TLineInfo,PType proc newNodeIT(kind: TNodeKind; info: TLineInfo; typ: PType): PNode 1158
nim newNode ast.html#newNode,TNodeKind,TLineInfo proc newNode(kind: TNodeKind; info: TLineInfo): PNode 1164
nim newAtom ast.html#newAtom,PIdent,TLineInfo proc newAtom(ident: PIdent; info: TLineInfo): PNode 1169
nim newAtom ast.html#newAtom,TNodeKind,BiggestInt,TLineInfo proc newAtom(kind: TNodeKind; intVal: BiggestInt; info: TLineInfo): PNode 1173
nim newAtom ast.html#newAtom,TNodeKind,BiggestFloat,TLineInfo proc newAtom(kind: TNodeKind; floatVal: BiggestFloat; info: TLineInfo): PNode 1177
nim newAtom ast.html#newAtom,TNodeKind,sinkstring,TLineInfo proc newAtom(kind: TNodeKind; strVal: sink string; info: TLineInfo): PNode 1181
nim newTree ast.html#newTree,TNodeKind,TLineInfo,varargs[PNode] proc newTree(kind: TNodeKind; info: TLineInfo; children: varargs[PNode]): PNode 1185
nim newTree ast.html#newTree,TNodeKind,varargs[PNode] proc newTree(kind: TNodeKind; children: varargs[PNode]): PNode 1191
nim newTreeI ast.html#newTreeI,TNodeKind,TLineInfo,varargs[PNode] proc newTreeI(kind: TNodeKind; info: TLineInfo; children: varargs[PNode]): PNode 1197
nim newTreeIT ast.html#newTreeIT,TNodeKind,TLineInfo,PType,varargs[PNode] proc newTreeIT(kind: TNodeKind; info: TLineInfo; typ: PType; children: varargs[PNode]): PNode 1203
nim previouslyInferred ast.html#previouslyInferred.t,PType template previouslyInferred(t: PType): PType 1209
nim newSym ast.html#newSym,TSymKind,PIdent,IdGenerator,PSym,TLineInfo,TOptions proc newSym(symKind: TSymKind; name: PIdent; idgen: IdGenerator; owner: PSym;\n info: TLineInfo; options: TOptions = {}): PSym 1221
nim astdef ast.html#astdef,PSym proc astdef(s: PSym): PNode 1236
nim isMetaType ast.html#isMetaType,PType proc isMetaType(t: PType): bool 1243
nim isUnresolvedStatic ast.html#isUnresolvedStatic,PType proc isUnresolvedStatic(t: PType): bool 1248
nim linkTo ast.html#linkTo,PType,PSym proc linkTo(t: PType; s: PSym): PType 1251
nim linkTo ast.html#linkTo,PSym,PType proc linkTo(s: PSym; t: PType): PSym 1256
nim fileIdx ast.html#fileIdx.t,PSym template fileIdx(c: PSym): FileIndex 1261
nim filename ast.html#filename.t,PSym template filename(c: PSym): string 1265
nim appendToModule ast.html#appendToModule,PSym,PNode proc appendToModule(m: PSym; n: PNode) 1269
nim GrowthFactor ast.html#GrowthFactor const GrowthFactor 1280
nim StartSize ast.html#StartSize const StartSize 1281
nim copyStrTable ast.html#copyStrTable,TStrTable,TStrTable proc copyStrTable(dest: var TStrTable; src: TStrTable) 1283
nim copyIdTable ast.html#copyIdTable,TIdTable[T],TIdTable[T] proc copyIdTable[T](dest: var TIdTable[T]; src: TIdTable[T]) 1288
nim copyObjectSet ast.html#copyObjectSet,TObjectSet,TObjectSet proc copyObjectSet(dest: var TObjectSet; src: TObjectSet) 1293
nim withInfo ast.html#withInfo,PNode,TLineInfo proc withInfo(n: PNode; info: TLineInfo): PNode 1301
nim newIdentNode ast.html#newIdentNode,PIdent,TLineInfo proc newIdentNode(ident: PIdent; info: TLineInfo): PNode 1305
nim newSymNode ast.html#newSymNode,PSym proc newSymNode(sym: PSym): PNode 1310
nim newSymNode ast.html#newSymNode,PSym,TLineInfo proc newSymNode(sym: PSym; info: TLineInfo): PNode 1316
nim newOpenSym ast.html#newOpenSym,PNode proc newOpenSym(n: PNode): PNode 1322
nim newIntNode ast.html#newIntNode,TNodeKind,BiggestInt proc newIntNode(kind: TNodeKind; intVal: BiggestInt): PNode 1325
nim newIntNode ast.html#newIntNode,TNodeKind,Int128 proc newIntNode(kind: TNodeKind; intVal: Int128): PNode 1329
nim lastSon ast.html#lastSon,PNode proc lastSon(n: PNode): PNode 1333
nim setLastSon ast.html#setLastSon.t,PNode,PNode template setLastSon(n: PNode; s: PNode) 1334
nim firstSon ast.html#firstSon.t,PNode template firstSon(n: PNode): PNode 1336
nim secondSon ast.html#secondSon.t,PNode template secondSon(n: PNode): PNode 1337
nim hasSon ast.html#hasSon.t,PNode template hasSon(n: PNode): bool 1339
nim has2Sons ast.html#has2Sons.t,PNode template has2Sons(n: PNode): bool 1340
nim replaceFirstSon ast.html#replaceFirstSon,PNode,PNode proc replaceFirstSon(n, newson: PNode) 1342
nim replaceSon ast.html#replaceSon,PNode,int,PNode proc replaceSon(n: PNode; i: int; newson: PNode) 1345
nim last ast.html#last,PType proc last(n: PType): PType 1348
nim elementType ast.html#elementType,PType proc elementType(n: PType): PType 1350
nim skipModifier ast.html#skipModifier,PType proc skipModifier(n: PType): PType 1351
nim indexType ast.html#indexType,PType proc indexType(n: PType): PType 1353
nim baseClass ast.html#baseClass,PType proc baseClass(n: PType): PType 1354
nim base ast.html#base,PType proc base(t: PType): PType 1356
nim returnType ast.html#returnType,PType proc returnType(n: PType): PType 1359
nim setReturnType ast.html#setReturnType,PType,PType proc setReturnType(n, r: PType) 1360
nim setIndexType ast.html#setIndexType,PType,PType proc setIndexType(n, idx: PType) 1361
nim firstParamType ast.html#firstParamType,PType proc firstParamType(n: PType): PType 1363
nim firstGenericParam ast.html#firstGenericParam,PType proc firstGenericParam(n: PType): PType 1364
nim typeBodyImpl ast.html#typeBodyImpl,PType proc typeBodyImpl(n: PType): PType 1366
nim genericHead ast.html#genericHead,PType proc genericHead(n: PType): PType 1368
nim skipTypes ast.html#skipTypes,PType,TTypeKinds proc skipTypes(t: PType; kinds: TTypeKinds): PType 1370
nim newIntTypeNode ast.html#newIntTypeNode,BiggestInt,PType proc newIntTypeNode(intVal: BiggestInt; typ: PType): PNode 1378
nim newIntTypeNode ast.html#newIntTypeNode,Int128,PType proc newIntTypeNode(intVal: Int128; typ: PType): PNode 1401
nim newFloatNode ast.html#newFloatNode,TNodeKind,BiggestFloat proc newFloatNode(kind: TNodeKind; floatVal: BiggestFloat): PNode 1405
nim newStrNode ast.html#newStrNode,TNodeKind,string proc newStrNode(kind: TNodeKind; strVal: string): PNode 1409
nim newStrNode ast.html#newStrNode,string,TLineInfo proc newStrNode(strVal: string; info: TLineInfo): PNode 1413
nim newProcNode ast.html#newProcNode,TNodeKind,TLineInfo,PNode,PNode,PNode,PNode,PNode,PNode,PNode proc newProcNode(kind: TNodeKind; info: TLineInfo; body: PNode;\n params, name, pattern, genericParams, pragmas, exceptions: PNode): PNode 1417
nim AttachedOpToStr ast.html#AttachedOpToStr const AttachedOpToStr 1426
nim `$` ast.html#$,PSym proc `$`(s: PSym): string 1429
nim len ast.html#len,PType proc len(n: PType): int 1443
nim sameTupleLengths ast.html#sameTupleLengths,PType,PType proc sameTupleLengths(a, b: PType): bool 1446
nim tupleTypePairs ast.html#tupleTypePairs.i,PType,PType iterator tupleTypePairs(a, b: PType): (int, PType, PType) 1449
nim underspecifiedPairs ast.html#underspecifiedPairs.i,PType,PType,int,int iterator underspecifiedPairs(a, b: PType; start = 0; without = 0): (PType, PType) 1453
nim signatureLen ast.html#signatureLen,PType proc signatureLen(t: PType): int 1458
nim paramsLen ast.html#paramsLen,PType proc paramsLen(t: PType): int 1461
nim genericParamsLen ast.html#genericParamsLen,PType proc genericParamsLen(t: PType): int 1464
nim genericInvocationParamsLen ast.html#genericInvocationParamsLen,PType proc genericInvocationParamsLen(t: PType): int 1468
nim kidsLen ast.html#kidsLen,PType proc kidsLen(t: PType): int 1472
nim genericParamHasConstraints ast.html#genericParamHasConstraints,PType proc genericParamHasConstraints(t: PType): bool 1475
nim hasElementType ast.html#hasElementType,PType proc hasElementType(t: PType): bool 1477
nim isEmptyTupleType ast.html#isEmptyTupleType,PType proc isEmptyTupleType(t: PType): bool 1478
nim isSingletonTupleType ast.html#isSingletonTupleType,PType proc isSingletonTupleType(t: PType): bool 1479
nim genericConstraint ast.html#genericConstraint,PType proc genericConstraint(t: PType): PType 1481
nim genericInstParams ast.html#genericInstParams.i,PType iterator genericInstParams(t: PType): (bool, PType) 1483
nim genericInstParamPairs ast.html#genericInstParamPairs.i,PType,PType iterator genericInstParamPairs(a, b: PType): (int, PType, PType) 1487
nim genericInvocationParams ast.html#genericInvocationParams.i,PType iterator genericInvocationParams(t: PType): (bool, PType) 1491
nim genericInvocationAndBodyElements ast.html#genericInvocationAndBodyElements.i,PType,PType iterator genericInvocationAndBodyElements(a, b: PType): (PType, PType) 1495
nim genericInvocationParamPairs ast.html#genericInvocationParamPairs.i,PType,PType iterator genericInvocationParamPairs(a, b: PType): (bool, PType, PType) 1499
nim genericBodyParams ast.html#genericBodyParams.i,PType iterator genericBodyParams(t: PType): (int, PType) 1506
nim userTypeClassInstParams ast.html#userTypeClassInstParams.i,PType iterator userTypeClassInstParams(t: PType): (bool, PType) 1510
nim ikids ast.html#ikids.i,PType iterator ikids(t: PType): (int, PType) 1514
nim FirstParamAt ast.html#FirstParamAt const FirstParamAt 1518
nim FirstGenericParamAt ast.html#FirstGenericParamAt const FirstGenericParamAt 1519
nim paramTypes ast.html#paramTypes.i,PType iterator paramTypes(t: PType): (int, PType) 1521
nim paramTypePairs ast.html#paramTypePairs.i,PType,PType iterator paramTypePairs(a, b: PType): (PType, PType) 1524
nim paramTypeToNodeIndex ast.html#paramTypeToNodeIndex.t,int template paramTypeToNodeIndex(x: int): int 1527
nim kids ast.html#kids.i,PType iterator kids(t: PType): PType 1529
nim signature ast.html#signature.i,PType iterator signature(t: PType): PType 1532
nim newType ast.html#newType,TTypeKind,IdGenerator,PSym,sinkPType proc newType(kind: TTypeKind; idgen: IdGenerator; owner: PSym; son: sink PType = nil): PType 1536
nim setSons ast.html#setSons,PType,sinkseq[PType] proc setSons(dest: PType; sons: sink seq[PType]) 1547
nim setSon ast.html#setSon,PType,sinkPType proc setSon(dest: PType; son: sink PType) 1548
nim setSonsLen ast.html#setSonsLen,PType,int proc setSonsLen(dest: PType; len: int) 1549
nim newSons ast.html#newSons,PNode,int proc newSons(father: PNode; length: int) 1558
nim newSons ast.html#newSons,PType,int proc newSons(father: PType; length: int) 1561
nim truncateInferredTypeCandidates ast.html#truncateInferredTypeCandidates,PType proc truncateInferredTypeCandidates(t: PType) 1564
nim assignType ast.html#assignType,PType,PType proc assignType(dest, src: PType) 1569
nim copyType ast.html#copyType,PType,IdGenerator,PSym proc copyType(t: PType; idgen: IdGenerator; owner: PSym): PType 1587
nim exactReplica ast.html#exactReplica,PType proc exactReplica(t: PType): PType 1592
nim copySym ast.html#copySym,PSym,IdGenerator proc copySym(s: PSym; idgen: IdGenerator): PSym 1599
nim createModuleAlias ast.html#createModuleAlias,PSym,IdGenerator,PIdent,TLineInfo,TOptions proc createModuleAlias(s: PSym; idgen: IdGenerator; newIdent: PIdent;\n info: TLineInfo; options: TOptions): PSym 1615
nim initStrTable ast.html#initStrTable proc initStrTable(): TStrTable 1627
nim initIdTable ast.html#initIdTable proc initIdTable[T](): TIdTable[T] 1631
nim resetIdTable ast.html#resetIdTable,TIdTable[T] proc resetIdTable[T](x: var TIdTable[T]) 1635
nim initObjectSet ast.html#initObjectSet proc initObjectSet(): TObjectSet 1641
nim initNodeTable ast.html#initNodeTable proc initNodeTable(ignoreTypes = false): TNodeTable 1645
nim skipTypes ast.html#skipTypes,PType,TTypeKinds,int proc skipTypes(t: PType; kinds: TTypeKinds; maxIters: int): PType 1649
nim skipTypesOrNil ast.html#skipTypesOrNil,PType,TTypeKinds proc skipTypesOrNil(t: PType; kinds: TTypeKinds): PType 1657
nim isGCedMem ast.html#isGCedMem,PType proc isGCedMem(t: PType): bool 1664
nim propagateToOwner ast.html#propagateToOwner,PType,PType proc propagateToOwner(owner, elem: PType; propagateHasAsgn = true) 1668
nim rawAddSon ast.html#rawAddSon,PType,PType proc rawAddSon(father, son: PType; propagateHasAsgn = true) 1693
nim addSonNilAllowed ast.html#addSonNilAllowed,PNode,PNode proc addSonNilAllowed(father, son: PNode) 1697
nim delSon ast.html#delSon,PNode,int proc delSon(father: PNode; idx: int) 1700
nim copyNode ast.html#copyNode,PNode proc copyNode(src: PNode): PNode 1705
nim transitionSonsKind ast.html#transitionSonsKind,PNode,range[] proc transitionSonsKind(n: PNode; kind: range[nkComesFrom .. nkTupleConstr]) 1734
nim transitionIntKind ast.html#transitionIntKind,PNode,range[] proc transitionIntKind(n: PNode; kind: range[nkCharLit .. nkUInt64Lit]) 1738
nim transitionIntToFloatKind ast.html#transitionIntToFloatKind,PNode,range[] proc transitionIntToFloatKind(n: PNode; kind: range[nkFloatLit .. nkFloat128Lit]) 1742
nim transitionNoneToSym ast.html#transitionNoneToSym,PNode proc transitionNoneToSym(n: PNode) 1746
nim transitionSymKindCommon ast.html#transitionSymKindCommon.t,TSymKind template transitionSymKindCommon(k: TSymKind) 1749
nim transitionGenericParamToType ast.html#transitionGenericParamToType,PSym proc transitionGenericParamToType(s: PSym) 1760
nim transitionRoutineSymKind ast.html#transitionRoutineSymKind,PSym,range[] proc transitionRoutineSymKind(s: PSym; kind: range[skProc .. skTemplate]) 1763
nim transitionToLet ast.html#transitionToLet,PSym proc transitionToLet(s: PSym) 1768
nim shallowCopy ast.html#shallowCopy,PNode proc shallowCopy(src: PNode): PNode 1794
nim copyTree ast.html#copyTree,PNode proc copyTree(src: PNode): PNode 1799
nim copyTreeWithoutNode ast.html#copyTreeWithoutNode,PNode,PNode proc copyTreeWithoutNode(src, skippedNode: PNode): PNode 1806
nim hasSonWith ast.html#hasSonWith,PNode,TNodeKind proc hasSonWith(n: PNode; kind: TNodeKind): bool 1813
nim hasNilSon ast.html#hasNilSon,PNode proc hasNilSon(n: PNode): bool 1819
nim containsNode ast.html#containsNode,PNode,TNodeKinds proc containsNode(n: PNode; kinds: TNodeKinds): bool 1827
nim hasSubnodeWith ast.html#hasSubnodeWith,PNode,TNodeKind proc hasSubnodeWith(n: PNode; kind: TNodeKind): bool 1836
nim getInt ast.html#getInt,PNode proc getInt(a: PNode): Int128 1845
nim getInt64 ast.html#getInt64,PNode proc getInt64(a: PNode): int64 1858
nim getFloat ast.html#getFloat,PNode proc getFloat(a: PNode): BiggestFloat 1865
nim getStr ast.html#getStr,PNode proc getStr(a: PNode): string 1876
nim getStrOrChar ast.html#getStrOrChar,PNode proc getStrOrChar(a: PNode): string 1888
nim isGenericParams ast.html#isGenericParams,PNode proc isGenericParams(n: PNode): bool 1898
nim isGenericRoutine ast.html#isGenericRoutine,PNode proc isGenericRoutine(n: PNode): bool 1902
nim isGenericRoutineStrict ast.html#isGenericRoutineStrict,PSym proc isGenericRoutineStrict(s: PSym): bool 1905
nim isGenericRoutine ast.html#isGenericRoutine,PSym proc isGenericRoutine(s: PSym): bool 1911
nim skipGenericOwner ast.html#skipGenericOwner,PSym proc skipGenericOwner(s: PSym): PSym 1925
nim originatingModule ast.html#originatingModule,PSym proc originatingModule(s: PSym): PSym 1936
nim isRoutine ast.html#isRoutine,PSym proc isRoutine(s: PSym): bool 1940
nim isCompileTimeProc ast.html#isCompileTimeProc,PSym proc isCompileTimeProc(s: PSym): bool 1943
nim hasPattern ast.html#hasPattern,PSym proc hasPattern(s: PSym): bool 1947
nim items ast.html#items.i,PNode iterator items(n: PNode): PNode 1950
nim pairs ast.html#pairs.i,PNode iterator pairs(n: PNode): tuple[i: int, n: PNode] 1953
nim isAtom ast.html#isAtom,PNode proc isAtom(n: PNode): bool 1956
nim isEmptyType ast.html#isEmptyType,PType proc isEmptyType(t: PType): bool 1959
nim makeStmtList ast.html#makeStmtList,PNode proc makeStmtList(n: PNode): PNode 1963
nim skipStmtList ast.html#skipStmtList,PNode proc skipStmtList(n: PNode): PNode 1970
nim toVar ast.html#toVar,PType,TTypeKind,IdGenerator proc toVar(typ: PType; kind: TTypeKind; idgen: IdGenerator): PType 1978
nim toRef ast.html#toRef,PType,IdGenerator proc toRef(typ: PType; idgen: IdGenerator): PType 1985
nim toObject ast.html#toObject,PType proc toObject(typ: PType): PType 1992
nim toObjectFromRefPtrGeneric ast.html#toObjectFromRefPtrGeneric,PType proc toObjectFromRefPtrGeneric(typ: PType): PType 2000
nim isImportedException ast.html#isImportedException,PType,ConfigRef proc isImportedException(t: PType; conf: ConfigRef): bool 2020
nim isInfixAs ast.html#isInfixAs,PNode proc isInfixAs(n: PNode): bool 2029
nim skipColon ast.html#skipColon,PNode proc skipColon(n: PNode): PNode 2032
nim findUnresolvedStatic ast.html#findUnresolvedStatic,PNode proc findUnresolvedStatic(n: PNode): PNode 2037
nim hasDestructor ast.html#hasDestructor.t,PType template hasDestructor(t: PType): bool 2058
nim incompleteType ast.html#incompleteType.t,PType template incompleteType(t: PType): bool 2060
nim typeCompleted ast.html#typeCompleted.t,PSym template typeCompleted(s: PSym) 2063
nim detailedInfo ast.html#detailedInfo.t,PSym template detailedInfo(sym: PSym): string 2066
nim isInlineIterator ast.html#isInlineIterator,PType proc isInlineIterator(typ: PType): bool 2069
nim isIterator ast.html#isIterator,PType proc isIterator(typ: PType): bool 2072
nim isClosureIterator ast.html#isClosureIterator,PType proc isClosureIterator(typ: PType): bool 2075
nim isClosure ast.html#isClosure,PType proc isClosure(typ: PType): bool 2078
nim isNimcall ast.html#isNimcall,PSym proc isNimcall(s: PSym): bool 2081
nim isExplicitCallConv ast.html#isExplicitCallConv,PSym proc isExplicitCallConv(s: PSym): bool 2084
nim isSinkParam ast.html#isSinkParam,PSym proc isSinkParam(s: PSym): bool 2087
nim isSinkType ast.html#isSinkType,PType proc isSinkType(t: PType): bool 2090
nim newProcType ast.html#newProcType,TLineInfo,IdGenerator,PSym proc newProcType(info: TLineInfo; idgen: IdGenerator; owner: PSym): PType 2093
nim addParam ast.html#addParam,PType,PSym proc addParam(procType: PType; param: PSym) 2102
nim canRaiseConservative ast.html#canRaiseConservative,PNode proc canRaiseConservative(fn: PNode): bool 2110
nim canRaise ast.html#canRaise,PNode proc canRaise(fn: PNode): bool 2116
nim toHumanStr ast.html#toHumanStr,TSymKind proc toHumanStr(kind: TSymKind): string 2139
nim toHumanStr ast.html#toHumanStr,TTypeKind proc toHumanStr(kind: TTypeKind): string 2143
nim skipHiddenAddr ast.html#skipHiddenAddr,PNode proc skipHiddenAddr(n: PNode): PNode 2147
nim isNewStyleConcept ast.html#isNewStyleConcept,PNode proc isNewStyleConcept(n: PNode): bool 2150
nim isOutParam ast.html#isOutParam,PType proc isOutParam(t: PType): bool 2154
nim nodesToIgnoreSet ast.html#nodesToIgnoreSet const nodesToIgnoreSet 2157
nim isTrue ast.html#isTrue,PNode proc isTrue(n: PNode): bool 2164
nim TypeMapping ast.html#TypeMapping type TypeMapping 2169
nim SymMapping ast.html#SymMapping type SymMapping 2170
nim initSymMapping ast.html#initSymMapping.t template initSymMapping(): SymMapping 2172
nim initTypeMapping ast.html#initTypeMapping.t template initTypeMapping(): TypeMapping 2173
nimgrp newnodei ast.html#newNodeI-procs-all proc 1146
nimgrp newstrnode ast.html#newStrNode-procs-all proc 1409
nimgrp addallownil ast.html#addAllowNil-procs-all proc 1029
nimgrp isgenericroutine ast.html#isGenericRoutine-procs-all proc 1902
nimgrp newnode ast.html#newNode-procs-all proc 1141
nimgrp newsons ast.html#newSons-procs-all proc 1558
nimgrp newsymnode ast.html#newSymNode-procs-all proc 1310
nimgrp newintnode ast.html#newIntNode-procs-all proc 1325
nimgrp newinttypenode ast.html#newIntTypeNode-procs-all proc 1378
nimgrp skiptypes ast.html#skipTypes-procs-all proc 1370
nimgrp len ast.html#len-procs-all proc 1011
nimgrp newtree ast.html#newTree-procs-all proc 1185
nimgrp add ast.html#add-procs-all proc 1025
nimgrp tohumanstr ast.html#toHumanStr-procs-all proc 2139
nimgrp linkto ast.html#linkTo-procs-all proc 1251
nimgrp $ ast.html#$-procs-all proc 577
nimgrp newatom ast.html#newAtom-procs-all proc 1169
nimgrp []= ast.html#[]=-templates-all template 1033
nimgrp [] ast.html#[]-templates-all template 1032

1023
compiler/astalgo.html Normal file

File diff suppressed because it is too large Load Diff

53
compiler/astalgo.idx Normal file
View File

@@ -0,0 +1,53 @@
nimTitle astalgo astalgo.html module astalgo 0
nim hashNode astalgo.html#hashNode,RootRef proc hashNode(p: RootRef): Hash 26
nim debug astalgo.html#debug,PSym,ConfigRef proc debug(n: PSym; conf: ConfigRef = nil) 30
nim debug astalgo.html#debug,PType,ConfigRef proc debug(n: PType; conf: ConfigRef = nil) 31
nim debug astalgo.html#debug,PNode,ConfigRef proc debug(n: PNode; conf: ConfigRef = nil) 32
nim debug astalgo.html#debug.t template debug(x: PSym | PType | PNode) 34
nim debug astalgo.html#debug.t,auto template debug(x: auto) 42
nim mdbg astalgo.html#mdbg.t template mdbg(): bool 45
nim lookupInRecord astalgo.html#lookupInRecord,PNode,PIdent proc lookupInRecord(n: PNode; field: PIdent): PSym 70
nim mustRehash astalgo.html#mustRehash,int,int proc mustRehash(length, counter: int): bool 71
nim nextTry astalgo.html#nextTry,Hash,Hash proc nextTry(h, maxHash: Hash): Hash 72
nim InvalidKey astalgo.html#InvalidKey const InvalidKey 76
nim TIIPair astalgo.html#TIIPair object TIIPair 79
nim TIIPairSeq astalgo.html#TIIPairSeq type TIIPairSeq 82
nim TIITable astalgo.html#TIITable object TIITable 83
nim initIITable astalgo.html#initIITable,TIITable proc initIITable(x: var TIITable) 88
nim iiTableGet astalgo.html#iiTableGet,TIITable,int proc iiTableGet(t: TIITable; key: int): int 89
nim iiTablePut astalgo.html#iiTablePut,TIITable,int,int proc iiTablePut(t: var TIITable; key, val: int) 90
nim skipConvCastAndClosure astalgo.html#skipConvCastAndClosure,PNode proc skipConvCastAndClosure(n: PNode): PNode 94
nim sameValue astalgo.html#sameValue,PNode,PNode proc sameValue(a, b: PNode): bool 105
nim leValue astalgo.html#leValue,PNode,PNode proc leValue(a, b: PNode): bool 119
nim weakLeValue astalgo.html#weakLeValue,PNode,PNode proc weakLeValue(a, b: PNode): TImplication 134
nim getModule astalgo.html#getModule,PSym proc getModule(s: PSym): PSym 161
nim fromSystem astalgo.html#fromSystem,PSym proc fromSystem(op: PSym): bool 166
nim getSymFromList astalgo.html#getSymFromList,PNode,PIdent,int proc getSymFromList(list: PNode; ident: PIdent; start: int = 0): PSym 167
nim getNamedParamFromList astalgo.html#getNamedParamFromList,PNode,PIdent proc getNamedParamFromList(list: PNode; ident: PIdent): PSym 202
nim objectSetContains astalgo.html#objectSetContains,TObjectSet,RootRef proc objectSetContains(t: TObjectSet; obj: RootRef): bool 493
nim objectSetIncl astalgo.html#objectSetIncl,TObjectSet,RootRef proc objectSetIncl(t: var TObjectSet; obj: RootRef) 517
nim objectSetContainsOrIncl astalgo.html#objectSetContainsOrIncl,TObjectSet,RootRef proc objectSetContainsOrIncl(t: var TObjectSet; obj: RootRef): bool 522
nim strTableContains astalgo.html#strTableContains,TStrTable,PSym proc strTableContains(t: TStrTable; n: PSym): bool 540
nim symTabReplace astalgo.html#symTabReplace,TStrTable,PSym,PSym proc symTabReplace(t: var TStrTable; prevSym: PSym; newSym: PSym) 569
nim strTableAdd astalgo.html#strTableAdd,TStrTable,PSym proc strTableAdd(t: var TStrTable; n: PSym) 579
nim strTableInclReportConflict astalgo.html#strTableInclReportConflict,TStrTable,PSym proc strTableInclReportConflict(t: var TStrTable; n: PSym; onConflictKeepOld = false): PSym 584
nim strTableIncl astalgo.html#strTableIncl,TStrTable,PSym proc strTableIncl(t: var TStrTable; n: PSym; onConflictKeepOld = false): bool 617
nim strTableGet astalgo.html#strTableGet,TStrTable,PIdent proc strTableGet(t: TStrTable; name: PIdent): PSym 621
nim TIdentIter astalgo.html#TIdentIter object TIdentIter 631
nim nextIdentIter astalgo.html#nextIdentIter,TIdentIter,TStrTable proc nextIdentIter(ti: var TIdentIter; tab: TStrTable): PSym 635
nim initIdentIter astalgo.html#initIdentIter,TIdentIter,TStrTable,PIdent proc initIdentIter(ti: var TIdentIter; tab: TStrTable; s: PIdent): PSym 653
nim nextIdentExcluding astalgo.html#nextIdentExcluding,TIdentIter,TStrTable,IntSet proc nextIdentExcluding(ti: var TIdentIter; tab: TStrTable; excluding: IntSet): PSym 659
nim firstIdentExcluding astalgo.html#firstIdentExcluding,TIdentIter,TStrTable,PIdent,IntSet proc firstIdentExcluding(ti: var TIdentIter; tab: TStrTable; s: PIdent;\n excluding: IntSet): PSym 675
nim TTabIter astalgo.html#TTabIter object TTabIter 683
nim nextIter astalgo.html#nextIter,TTabIter,TStrTable proc nextIter(ti: var TTabIter; tab: TStrTable): PSym 686
nim initTabIter astalgo.html#initTabIter,TTabIter,TStrTable proc initTabIter(ti: var TTabIter; tab: TStrTable): PSym 702
nim items astalgo.html#items.i,TStrTable iterator items(tab: TStrTable): PSym 709
nim getOrDefault astalgo.html#getOrDefault,TIdTable[T],ItemId proc getOrDefault[T](t: TIdTable[T]; key: ItemId): T 734
nim idTableGet astalgo.html#idTableGet.t,TIdTable[T], template idTableGet[T](t: TIdTable[T]; key: PType | PSym): T 739
nim `[]=` astalgo.html#[]=,TIdTable[T],ItemId,T proc `[]=`[T](t: var TIdTable[T]; key: ItemId; val: T) 753
nim idTablePut astalgo.html#idTablePut.t,TIdTable[T],,T template idTablePut[T](t: var TIdTable[T]; key: PType | PSym; val: T) 772
nim idTablePairs astalgo.html#idTablePairs.i,TIdTable[T] iterator idTablePairs[T](t: TIdTable[T]): tuple[key: ItemId, val: T] 775
nim listSymbolNames astalgo.html#listSymbolNames,openArray[PSym] proc listSymbolNames(symbols: openArray[PSym]): string 825
nim isDiscriminantField astalgo.html#isDiscriminantField,PNode proc isDiscriminantField(n: PNode): bool 832
nimgrp debug astalgo.html#debug-procs-all proc 30
nimgrp debug astalgo.html#debug-templates-all template 34

252
compiler/astmsgs.html Normal file
View File

@@ -0,0 +1,252 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>astmsgs</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">astmsgs</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">addDeclaredLoc
<li><a class="reference" href="#addDeclaredLoc%2Cstring%2CConfigRef%2CPSym" title="addDeclaredLoc(result: var string; conf: ConfigRef; sym: PSym)">addDeclaredLoc(result: var string; conf: ConfigRef; sym: PSym)</a></li>
<li><a class="reference" href="#addDeclaredLoc%2Cstring%2CConfigRef%2CPType" title="addDeclaredLoc(result: var string; conf: ConfigRef; typ: PType)">addDeclaredLoc(result: var string; conf: ConfigRef; typ: PType)</a></li>
</ul>
<ul class="simple nested-toc-section">addDeclaredLocMaybe
<li><a class="reference" href="#addDeclaredLocMaybe%2Cstring%2CConfigRef%2CPSym" title="addDeclaredLocMaybe(result: var string; conf: ConfigRef; sym: PSym)">addDeclaredLocMaybe(result: var string; conf: ConfigRef; sym: PSym)</a></li>
<li><a class="reference" href="#addDeclaredLocMaybe%2Cstring%2CConfigRef%2CPType" title="addDeclaredLocMaybe(result: var string; conf: ConfigRef; typ: PType)">addDeclaredLocMaybe(result: var string; conf: ConfigRef; typ: PType)</a></li>
</ul>
<ul class="simple nested-toc-section">addTypeNodeDeclaredLoc
<li><a class="reference" href="#addTypeNodeDeclaredLoc%2Cstring%2CConfigRef%2CPType" title="addTypeNodeDeclaredLoc(result: var string; conf: ConfigRef; typ: PType)">addTypeNodeDeclaredLoc(result: var string; conf: ConfigRef; typ: PType)</a></li>
</ul>
<ul class="simple nested-toc-section">genFieldDefect
<li><a class="reference" href="#genFieldDefect%2CConfigRef%2Cstring%2CPSym" title="genFieldDefect(conf: ConfigRef; field: string; disc: PSym): string">genFieldDefect(conf: ConfigRef; field: string; disc: PSym): string</a></li>
</ul>
<ul class="simple nested-toc-section">typSym
<li><a class="reference" href="#typSym%2CPType" title="typSym(t: PType): PSym">typSym(t: PType): PSym</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">quoteExpr
<li><a class="reference" href="#quoteExpr.t%2Cstring" title="quoteExpr(a: string): untyped">quoteExpr(a: string): untyped</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astmsgs.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astmsgs.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="options.html">options</a>, <a class="reference external" href="ast.html">ast</a>, <a class="reference external" href="msgs.html">msgs</a>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="addDeclaredLoc-procs-all">
<div id="addDeclaredLoc,string,ConfigRef,PSym">
<dt><pre><span class="Keyword">proc</span> <a href="#addDeclaredLoc%2Cstring%2CConfigRef%2CPSym"><span class="Identifier">addDeclaredLoc</span></a><span class="Other">(</span><span class="Identifier">result</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">sym</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astmsgs.nim#L10" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astmsgs.nim#L10" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="addDeclaredLoc,string,ConfigRef,PType">
<dt><pre><span class="Keyword">proc</span> <a href="#addDeclaredLoc%2Cstring%2CConfigRef%2CPType"><span class="Identifier">addDeclaredLoc</span></a><span class="Other">(</span><span class="Identifier">result</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">typ</span><span class="Other">:</span> <a href="ast.html#PType"><span class="Identifier">PType</span></a><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astmsgs.nim#L17" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astmsgs.nim#L17" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="addDeclaredLocMaybe-procs-all">
<div id="addDeclaredLocMaybe,string,ConfigRef,PSym">
<dt><pre><span class="Keyword">proc</span> <a href="#addDeclaredLocMaybe%2Cstring%2CConfigRef%2CPSym"><span class="Identifier">addDeclaredLocMaybe</span></a><span class="Other">(</span><span class="Identifier">result</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">sym</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astmsgs.nim#L13" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astmsgs.nim#L13" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="addDeclaredLocMaybe,string,ConfigRef,PType">
<dt><pre><span class="Keyword">proc</span> <a href="#addDeclaredLocMaybe%2Cstring%2CConfigRef%2CPType"><span class="Identifier">addDeclaredLocMaybe</span></a><span class="Other">(</span><span class="Identifier">result</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">typ</span><span class="Other">:</span> <a href="ast.html#PType"><span class="Identifier">PType</span></a><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astmsgs.nim#L33" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astmsgs.nim#L33" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="addTypeNodeDeclaredLoc-procs-all">
<div id="addTypeNodeDeclaredLoc,string,ConfigRef,PType">
<dt><pre><span class="Keyword">proc</span> <a href="#addTypeNodeDeclaredLoc%2Cstring%2CConfigRef%2CPType"><span class="Identifier">addTypeNodeDeclaredLoc</span></a><span class="Other">(</span><span class="Identifier">result</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">typ</span><span class="Other">:</span> <a href="ast.html#PType"><span class="Identifier">PType</span></a><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astmsgs.nim#L27" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astmsgs.nim#L27" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="genFieldDefect-procs-all">
<div id="genFieldDefect,ConfigRef,string,PSym">
<dt><pre><span class="Keyword">proc</span> <a href="#genFieldDefect%2CConfigRef%2Cstring%2CPSym"><span class="Identifier">genFieldDefect</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">disc</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astmsgs.nim#L40" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astmsgs.nim#L40" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="typSym-procs-all">
<div id="typSym,PType">
<dt><pre><span class="Keyword">proc</span> <a href="#typSym%2CPType"><span class="Identifier">typSym</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="ast.html#PType"><span class="Identifier">PType</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astmsgs.nim#L5" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astmsgs.nim#L5" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="quoteExpr-templates-all">
<div id="quoteExpr.t,string">
<dt><pre><span class="Keyword">template</span> <a href="#quoteExpr.t%2Cstring"><span class="Identifier">quoteExpr</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
<dd>
can be used for quoting expressions in error msgs.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astmsgs.nim#L36" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astmsgs.nim#L36" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:13 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

11
compiler/astmsgs.idx Normal file
View File

@@ -0,0 +1,11 @@
nimTitle astmsgs astmsgs.html module astmsgs 0
nim typSym astmsgs.html#typSym,PType proc typSym(t: PType): PSym 5
nim addDeclaredLoc astmsgs.html#addDeclaredLoc,string,ConfigRef,PSym proc addDeclaredLoc(result: var string; conf: ConfigRef; sym: PSym) 10
nim addDeclaredLocMaybe astmsgs.html#addDeclaredLocMaybe,string,ConfigRef,PSym proc addDeclaredLocMaybe(result: var string; conf: ConfigRef; sym: PSym) 13
nim addDeclaredLoc astmsgs.html#addDeclaredLoc,string,ConfigRef,PType proc addDeclaredLoc(result: var string; conf: ConfigRef; typ: PType) 17
nim addTypeNodeDeclaredLoc astmsgs.html#addTypeNodeDeclaredLoc,string,ConfigRef,PType proc addTypeNodeDeclaredLoc(result: var string; conf: ConfigRef; typ: PType) 27
nim addDeclaredLocMaybe astmsgs.html#addDeclaredLocMaybe,string,ConfigRef,PType proc addDeclaredLocMaybe(result: var string; conf: ConfigRef; typ: PType) 33
nim quoteExpr astmsgs.html#quoteExpr.t,string template quoteExpr(a: string): untyped 36
nim genFieldDefect astmsgs.html#genFieldDefect,ConfigRef,string,PSym proc genFieldDefect(conf: ConfigRef; field: string; disc: PSym): string 40
nimgrp adddeclaredloc astmsgs.html#addDeclaredLoc-procs-all proc 10
nimgrp adddeclaredlocmaybe astmsgs.html#addDeclaredLocMaybe-procs-all proc 13

194
compiler/astyaml.html Normal file
View File

@@ -0,0 +1,194 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>astyaml</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">astyaml</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">addYamlString
<li><a class="reference" href="#addYamlString%2Cstring%2Cstring" title="addYamlString(res: var string; s: string)">addYamlString(res: var string; s: string)</a></li>
</ul>
<ul class="simple nested-toc-section">lineInfoToStr
<li><a class="reference" href="#lineInfoToStr%2CConfigRef%2CTLineInfo" title="lineInfoToStr(conf: ConfigRef; info: TLineInfo): string">lineInfoToStr(conf: ConfigRef; info: TLineInfo): string</a></li>
</ul>
<ul class="simple nested-toc-section">symToYaml
<li><a class="reference" href="#symToYaml%2CConfigRef%2CPSym%2Cint%2Cint" title="symToYaml(conf: ConfigRef; n: PSym; indent: int = 0; maxRecDepth: int = -1): string">symToYaml(conf: ConfigRef; n: PSym; indent: int = 0; maxRecDepth: int = -1): string</a></li>
</ul>
<ul class="simple nested-toc-section">treeToYaml
<li><a class="reference" href="#treeToYaml%2CConfigRef%2CPNode%2Cint%2Cint" title="treeToYaml(conf: ConfigRef; n: PNode; indent: int = 0; maxRecDepth: int = -1): string">treeToYaml(conf: ConfigRef; n: PNode; indent: int = 0; maxRecDepth: int = -1): string</a></li>
</ul>
<ul class="simple nested-toc-section">typeToYaml
<li><a class="reference" href="#typeToYaml%2CConfigRef%2CPType%2Cint%2Cint" title="typeToYaml(conf: ConfigRef; n: PType; indent: int = 0; maxRecDepth: int = -1): string">typeToYaml(conf: ConfigRef; n: PType; indent: int = 0; maxRecDepth: int = -1): string</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astyaml.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astyaml.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="ast.html">ast</a>, <a class="reference external" href="lineinfos.html">lineinfos</a>, <a class="reference external" href="msgs.html">msgs</a>, <a class="reference external" href="options.html">options</a>, <a class="reference external" href="rodutils.html">rodutils</a>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="addYamlString-procs-all">
<div id="addYamlString,string,string">
<dt><pre><span class="Keyword">proc</span> <a href="#addYamlString%2Cstring%2Cstring"><span class="Identifier">addYamlString</span></a><span class="Other">(</span><span class="Identifier">res</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">s</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astyaml.nim#L15" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astyaml.nim#L15" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="lineInfoToStr-procs-all">
<div id="lineInfoToStr,ConfigRef,TLineInfo">
<dt><pre><span class="Keyword">proc</span> <a href="#lineInfoToStr%2CConfigRef%2CTLineInfo"><span class="Identifier">lineInfoToStr</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">info</span><span class="Other">:</span> <a href="lineinfos.html#TLineInfo"><span class="Identifier">TLineInfo</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astyaml.nim#L43" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astyaml.nim#L43" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="symToYaml-procs-all">
<div id="symToYaml,ConfigRef,PSym,int,int">
<dt><pre><span class="Keyword">proc</span> <a href="#symToYaml%2CConfigRef%2CPSym%2Cint%2Cint"><span class="Identifier">symToYaml</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span> <span class="Identifier">indent</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">;</span> <span class="Identifier">maxRecDepth</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="DecNumber">-1</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astyaml.nim#L151" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astyaml.nim#L151" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="treeToYaml-procs-all">
<div id="treeToYaml,ConfigRef,PNode,int,int">
<dt><pre><span class="Keyword">proc</span> <a href="#treeToYaml%2CConfigRef%2CPNode%2Cint%2Cint"><span class="Identifier">treeToYaml</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">;</span> <span class="Identifier">indent</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">;</span>
<span class="Identifier">maxRecDepth</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="DecNumber">-1</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astyaml.nim#L141" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astyaml.nim#L141" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="typeToYaml-procs-all">
<div id="typeToYaml,ConfigRef,PType,int,int">
<dt><pre><span class="Keyword">proc</span> <a href="#typeToYaml%2CConfigRef%2CPType%2Cint%2Cint"><span class="Identifier">typeToYaml</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="ast.html#PType"><span class="Identifier">PType</span></a><span class="Other">;</span> <span class="Identifier">indent</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">;</span>
<span class="Identifier">maxRecDepth</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="DecNumber">-1</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astyaml.nim#L146" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astyaml.nim#L146" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:12 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

6
compiler/astyaml.idx Normal file
View File

@@ -0,0 +1,6 @@
nimTitle astyaml astyaml.html module astyaml 0
nim addYamlString astyaml.html#addYamlString,string,string proc addYamlString(res: var string; s: string) 15
nim lineInfoToStr astyaml.html#lineInfoToStr,ConfigRef,TLineInfo proc lineInfoToStr(conf: ConfigRef; info: TLineInfo): string 43
nim treeToYaml astyaml.html#treeToYaml,ConfigRef,PNode,int,int proc treeToYaml(conf: ConfigRef; n: PNode; indent: int = 0; maxRecDepth: int = -1): string 141
nim typeToYaml astyaml.html#typeToYaml,ConfigRef,PType,int,int proc typeToYaml(conf: ConfigRef; n: PType; indent: int = 0; maxRecDepth: int = -1): string 146
nim symToYaml astyaml.html#symToYaml,ConfigRef,PSym,int,int proc symToYaml(conf: ConfigRef; n: PSym; indent: int = 0; maxRecDepth: int = -1): string 151

353
compiler/bitsets.html Normal file
View File

@@ -0,0 +1,353 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>bitsets</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">bitsets</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#TBitSet" title="TBitSet = seq[ElemType]">TBitSet</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#ElemSize" title="ElemSize = 8">ElemSize</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">bitSetCard
<li><a class="reference" href="#bitSetCard%2CTBitSet" title="bitSetCard(x: TBitSet): BiggestInt">bitSetCard(x: TBitSet): BiggestInt</a></li>
</ul>
<ul class="simple nested-toc-section">bitSetContains
<li><a class="reference" href="#bitSetContains%2CTBitSet%2CTBitSet" title="bitSetContains(x, y: TBitSet): bool">bitSetContains(x, y: TBitSet): bool</a></li>
</ul>
<ul class="simple nested-toc-section">bitSetDiff
<li><a class="reference" href="#bitSetDiff%2CTBitSet%2CTBitSet" title="bitSetDiff(x: var TBitSet; y: TBitSet)">bitSetDiff(x: var TBitSet; y: TBitSet)</a></li>
</ul>
<ul class="simple nested-toc-section">bitSetEquals
<li><a class="reference" href="#bitSetEquals%2CTBitSet%2CTBitSet" title="bitSetEquals(x, y: TBitSet): bool">bitSetEquals(x, y: TBitSet): bool</a></li>
</ul>
<ul class="simple nested-toc-section">bitSetExcl
<li><a class="reference" href="#bitSetExcl%2CTBitSet%2CBiggestInt" title="bitSetExcl(x: var TBitSet; elem: BiggestInt)">bitSetExcl(x: var TBitSet; elem: BiggestInt)</a></li>
</ul>
<ul class="simple nested-toc-section">bitSetIn
<li><a class="reference" href="#bitSetIn%2CTBitSet%2CBiggestInt" title="bitSetIn(x: TBitSet; e: BiggestInt): bool">bitSetIn(x: TBitSet; e: BiggestInt): bool</a></li>
</ul>
<ul class="simple nested-toc-section">bitSetIncl
<li><a class="reference" href="#bitSetIncl%2CTBitSet%2CBiggestInt" title="bitSetIncl(x: var TBitSet; elem: BiggestInt)">bitSetIncl(x: var TBitSet; elem: BiggestInt)</a></li>
</ul>
<ul class="simple nested-toc-section">bitSetInit
<li><a class="reference" href="#bitSetInit%2CTBitSet%2Cint" title="bitSetInit(b: var TBitSet; length: int)">bitSetInit(b: var TBitSet; length: int)</a></li>
</ul>
<ul class="simple nested-toc-section">bitSetIntersect
<li><a class="reference" href="#bitSetIntersect%2CTBitSet%2CTBitSet" title="bitSetIntersect(x: var TBitSet; y: TBitSet)">bitSetIntersect(x: var TBitSet; y: TBitSet)</a></li>
</ul>
<ul class="simple nested-toc-section">bitSetSymDiff
<li><a class="reference" href="#bitSetSymDiff%2CTBitSet%2CTBitSet" title="bitSetSymDiff(x: var TBitSet; y: TBitSet)">bitSetSymDiff(x: var TBitSet; y: TBitSet)</a></li>
</ul>
<ul class="simple nested-toc-section">bitSetToWord
<li><a class="reference" href="#bitSetToWord%2CTBitSet%2Cint" title="bitSetToWord(s: TBitSet; size: int): BiggestUInt">bitSetToWord(s: TBitSet; size: int): BiggestUInt</a></li>
</ul>
<ul class="simple nested-toc-section">bitSetUnion
<li><a class="reference" href="#bitSetUnion%2CTBitSet%2CTBitSet" title="bitSetUnion(x: var TBitSet; y: TBitSet)">bitSetUnion(x: var TBitSet; y: TBitSet)</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/bitsets.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/bitsets.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="TBitSet">
<dt><pre><a href="bitsets.html#TBitSet"><span class="Identifier">TBitSet</span></a> <span class="Other">=</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">ElemType</span><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/bitsets.nim#L18" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/bitsets.nim#L18" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="ElemSize">
<dt><pre><a href="bitsets.html#ElemSize"><span class="Identifier">ElemSize</span></a> <span class="Other">=</span> <span class="DecNumber">8</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/bitsets.nim#L22" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/bitsets.nim#L22" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="bitSetCard-procs-all">
<div id="bitSetCard,TBitSet">
<dt><pre><span class="Keyword">proc</span> <a href="#bitSetCard%2CTBitSet"><span class="Identifier">bitSetCard</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="bitsets.html#TBitSet"><span class="Identifier">TBitSet</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">BiggestInt</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/bitsets.nim#L89" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/bitsets.nim#L89" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="bitSetContains-procs-all">
<div id="bitSetContains,TBitSet,TBitSet">
<dt><pre><span class="Keyword">proc</span> <a href="#bitSetContains%2CTBitSet%2CTBitSet"><span class="Identifier">bitSetContains</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <a href="bitsets.html#TBitSet"><span class="Identifier">TBitSet</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/bitsets.nim#L62" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/bitsets.nim#L62" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="bitSetDiff-procs-all">
<div id="bitSetDiff,TBitSet,TBitSet">
<dt><pre><span class="Keyword">proc</span> <a href="#bitSetDiff%2CTBitSet%2CTBitSet"><span class="Identifier">bitSetDiff</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="bitsets.html#TBitSet"><span class="Identifier">TBitSet</span></a><span class="Other">;</span> <span class="Identifier">y</span><span class="Other">:</span> <a href="bitsets.html#TBitSet"><span class="Identifier">TBitSet</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/bitsets.nim#L47" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/bitsets.nim#L47" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="bitSetEquals-procs-all">
<div id="bitSetEquals,TBitSet,TBitSet">
<dt><pre><span class="Keyword">proc</span> <a href="#bitSetEquals%2CTBitSet%2CTBitSet"><span class="Identifier">bitSetEquals</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <a href="bitsets.html#TBitSet"><span class="Identifier">TBitSet</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/bitsets.nim#L56" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/bitsets.nim#L56" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="bitSetExcl-procs-all">
<div id="bitSetExcl,TBitSet,BiggestInt">
<dt><pre><span class="Keyword">proc</span> <a href="#bitSetExcl%2CTBitSet%2CBiggestInt"><span class="Identifier">bitSetExcl</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="bitsets.html#TBitSet"><span class="Identifier">TBitSet</span></a><span class="Other">;</span> <span class="Identifier">elem</span><span class="Other">:</span> <span class="Identifier">BiggestInt</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/bitsets.nim#L37" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/bitsets.nim#L37" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="bitSetIn-procs-all">
<div id="bitSetIn,TBitSet,BiggestInt">
<dt><pre><span class="Keyword">proc</span> <a href="#bitSetIn%2CTBitSet%2CBiggestInt"><span class="Identifier">bitSetIn</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="bitsets.html#TBitSet"><span class="Identifier">TBitSet</span></a><span class="Other">;</span> <span class="Identifier">e</span><span class="Other">:</span> <span class="Identifier">BiggestInt</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/bitsets.nim#L29" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/bitsets.nim#L29" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="bitSetIncl-procs-all">
<div id="bitSetIncl,TBitSet,BiggestInt">
<dt><pre><span class="Keyword">proc</span> <a href="#bitSetIncl%2CTBitSet%2CBiggestInt"><span class="Identifier">bitSetIncl</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="bitsets.html#TBitSet"><span class="Identifier">TBitSet</span></a><span class="Other">;</span> <span class="Identifier">elem</span><span class="Other">:</span> <span class="Identifier">BiggestInt</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/bitsets.nim#L32" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/bitsets.nim#L32" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="bitSetInit-procs-all">
<div id="bitSetInit,TBitSet,int">
<dt><pre><span class="Keyword">proc</span> <a href="#bitSetInit%2CTBitSet%2Cint"><span class="Identifier">bitSetInit</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="bitsets.html#TBitSet"><span class="Identifier">TBitSet</span></a><span class="Other">;</span> <span class="Identifier">length</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/bitsets.nim#L41" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/bitsets.nim#L41" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="bitSetIntersect-procs-all">
<div id="bitSetIntersect,TBitSet,TBitSet">
<dt><pre><span class="Keyword">proc</span> <a href="#bitSetIntersect%2CTBitSet%2CTBitSet"><span class="Identifier">bitSetIntersect</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="bitsets.html#TBitSet"><span class="Identifier">TBitSet</span></a><span class="Other">;</span> <span class="Identifier">y</span><span class="Other">:</span> <a href="bitsets.html#TBitSet"><span class="Identifier">TBitSet</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/bitsets.nim#L53" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/bitsets.nim#L53" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="bitSetSymDiff-procs-all">
<div id="bitSetSymDiff,TBitSet,TBitSet">
<dt><pre><span class="Keyword">proc</span> <a href="#bitSetSymDiff%2CTBitSet%2CTBitSet"><span class="Identifier">bitSetSymDiff</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="bitsets.html#TBitSet"><span class="Identifier">TBitSet</span></a><span class="Other">;</span> <span class="Identifier">y</span><span class="Other">:</span> <a href="bitsets.html#TBitSet"><span class="Identifier">TBitSet</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/bitsets.nim#L50" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/bitsets.nim#L50" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="bitSetToWord-procs-all">
<div id="bitSetToWord,TBitSet,int">
<dt><pre><span class="Keyword">proc</span> <a href="#bitSetToWord%2CTBitSet%2Cint"><span class="Identifier">bitSetToWord</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="bitsets.html#TBitSet"><span class="Identifier">TBitSet</span></a><span class="Other">;</span> <span class="Identifier">size</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">BiggestUInt</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/bitsets.nim#L94" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/bitsets.nim#L94" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="bitSetUnion-procs-all">
<div id="bitSetUnion,TBitSet,TBitSet">
<dt><pre><span class="Keyword">proc</span> <a href="#bitSetUnion%2CTBitSet%2CTBitSet"><span class="Identifier">bitSetUnion</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="bitsets.html#TBitSet"><span class="Identifier">TBitSet</span></a><span class="Other">;</span> <span class="Identifier">y</span><span class="Other">:</span> <a href="bitsets.html#TBitSet"><span class="Identifier">TBitSet</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/bitsets.nim#L44" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/bitsets.nim#L44" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:13 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

15
compiler/bitsets.idx Normal file
View File

@@ -0,0 +1,15 @@
nimTitle bitsets bitsets.html module bitsets 0
nim TBitSet bitsets.html#TBitSet type TBitSet 18
nim ElemSize bitsets.html#ElemSize const ElemSize 22
nim bitSetIn bitsets.html#bitSetIn,TBitSet,BiggestInt proc bitSetIn(x: TBitSet; e: BiggestInt): bool 29
nim bitSetIncl bitsets.html#bitSetIncl,TBitSet,BiggestInt proc bitSetIncl(x: var TBitSet; elem: BiggestInt) 32
nim bitSetExcl bitsets.html#bitSetExcl,TBitSet,BiggestInt proc bitSetExcl(x: var TBitSet; elem: BiggestInt) 37
nim bitSetInit bitsets.html#bitSetInit,TBitSet,int proc bitSetInit(b: var TBitSet; length: int) 41
nim bitSetUnion bitsets.html#bitSetUnion,TBitSet,TBitSet proc bitSetUnion(x: var TBitSet; y: TBitSet) 44
nim bitSetDiff bitsets.html#bitSetDiff,TBitSet,TBitSet proc bitSetDiff(x: var TBitSet; y: TBitSet) 47
nim bitSetSymDiff bitsets.html#bitSetSymDiff,TBitSet,TBitSet proc bitSetSymDiff(x: var TBitSet; y: TBitSet) 50
nim bitSetIntersect bitsets.html#bitSetIntersect,TBitSet,TBitSet proc bitSetIntersect(x: var TBitSet; y: TBitSet) 53
nim bitSetEquals bitsets.html#bitSetEquals,TBitSet,TBitSet proc bitSetEquals(x, y: TBitSet): bool 56
nim bitSetContains bitsets.html#bitSetContains,TBitSet,TBitSet proc bitSetContains(x, y: TBitSet): bool 62
nim bitSetCard bitsets.html#bitSetCard,TBitSet proc bitSetCard(x: TBitSet): BiggestInt 89
nim bitSetToWord bitsets.html#bitSetToWord,TBitSet,int proc bitSetToWord(s: TBitSet; size: int): BiggestUInt 94

268
compiler/btrees.html Normal file
View File

@@ -0,0 +1,268 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>btrees</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">btrees</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#BTree" title="BTree[Key; Val] = object">BTree</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">add
<li><a class="reference" href="#add%2CBTree%5BKey%2CVal%5D%2CKey%2CVal" title="add[Key, Val](b: var BTree[Key, Val]; key: Key; val: Val)">add[Key, Val](b: var BTree[Key, Val]; key: Key; val: Val)</a></li>
</ul>
<ul class="simple nested-toc-section">contains
<li><a class="reference" href="#contains%2CBTree%5BKey%2CVal%5D%2CKey" title="contains[Key, Val](b: BTree[Key, Val]; key: Key): bool">contains[Key, Val](b: BTree[Key, Val]; key: Key): bool</a></li>
</ul>
<ul class="simple nested-toc-section">getOrDefault
<li><a class="reference" href="#getOrDefault%2CBTree%5BKey%2CVal%5D%2CKey" title="getOrDefault[Key, Val](b: BTree[Key, Val]; key: Key): Val">getOrDefault[Key, Val](b: BTree[Key, Val]; key: Key): Val</a></li>
</ul>
<ul class="simple nested-toc-section">hasNext
<li><a class="reference" href="#hasNext%2CBTree%5BKey%2CVal%5D%2Cint" title="hasNext[Key, Val](b: BTree[Key, Val]; index: int): bool">hasNext[Key, Val](b: BTree[Key, Val]; index: int): bool</a></li>
</ul>
<ul class="simple nested-toc-section">initBTree
<li><a class="reference" href="#initBTree" title="initBTree[Key, Val](): BTree[Key, Val]">initBTree[Key, Val](): BTree[Key, Val]</a></li>
</ul>
<ul class="simple nested-toc-section">len
<li><a class="reference" href="#len%2CBTree%5BKey%2CVal%5D" title="len[Key, Val](b: BTree[Key, Val]): int">len[Key, Val](b: BTree[Key, Val]): int</a></li>
</ul>
<ul class="simple nested-toc-section">next
<li><a class="reference" href="#next%2CBTree%5BKey%2CVal%5D%2Cint" title="next[Key, Val](b: BTree[Key, Val]; index: int): (Key, Val, int)">next[Key, Val](b: BTree[Key, Val]; index: int): (Key, Val, int)</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#15" id="65">Iterators</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">pairs
<li><a class="reference" href="#pairs.i%2CBTree%5BKey%2CVal%5D" title="pairs[Key, Val](b: BTree[Key, Val]): (Key, Val)">pairs[Key, Val](b: BTree[Key, Val]): (Key, Val)</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/btrees.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/btrees.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">BTree implementation with few features, but good enough for the Nim compiler's needs.</p>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="BTree">
<dt><pre><a href="btrees.html#BTree"><span class="Identifier">BTree</span></a><span class="Other">[</span><span class="Identifier">Key</span><span class="Other">;</span> <span class="Identifier">Val</span><span class="Other">]</span> <span class="Other">=</span> <span class="Keyword">object</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/btrees.nim#L30" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/btrees.nim#L30" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="add-procs-all">
<div id="add,BTree[Key,Val],Key,Val">
<dt><pre><span class="Keyword">proc</span> <a href="#add%2CBTree%5BKey%2CVal%5D%2CKey%2CVal"><span class="Identifier">add</span></a><span class="Other">[</span><span class="Identifier">Key</span><span class="Other">,</span> <span class="Identifier">Val</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="btrees.html#BTree"><span class="Identifier">BTree</span></a><span class="Other">[</span><span class="Identifier">Key</span><span class="Other">,</span> <span class="Identifier">Val</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <span class="Identifier">Key</span><span class="Other">;</span> <span class="Identifier">val</span><span class="Other">:</span> <span class="Identifier">Val</span><span class="Other">)</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/btrees.nim#L121" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/btrees.nim#L121" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="contains-procs-all">
<div id="contains,BTree[Key,Val],Key">
<dt><pre><span class="Keyword">proc</span> <a href="#contains%2CBTree%5BKey%2CVal%5D%2CKey"><span class="Identifier">contains</span></a><span class="Other">[</span><span class="Identifier">Key</span><span class="Other">,</span> <span class="Identifier">Val</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="btrees.html#BTree"><span class="Identifier">BTree</span></a><span class="Other">[</span><span class="Identifier">Key</span><span class="Other">,</span> <span class="Identifier">Val</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <span class="Identifier">Key</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/btrees.nim#L52" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/btrees.nim#L52" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getOrDefault-procs-all">
<div id="getOrDefault,BTree[Key,Val],Key">
<dt><pre><span class="Keyword">proc</span> <a href="#getOrDefault%2CBTree%5BKey%2CVal%5D%2CKey"><span class="Identifier">getOrDefault</span></a><span class="Other">[</span><span class="Identifier">Key</span><span class="Other">,</span> <span class="Identifier">Val</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="btrees.html#BTree"><span class="Identifier">BTree</span></a><span class="Other">[</span><span class="Identifier">Key</span><span class="Other">,</span> <span class="Identifier">Val</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <span class="Identifier">Key</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Val</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/btrees.nim#L40" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/btrees.nim#L40" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="hasNext-procs-all">
<div id="hasNext,BTree[Key,Val],int">
<dt><pre><span class="Keyword">proc</span> <a href="#hasNext%2CBTree%5BKey%2CVal%5D%2Cint"><span class="Identifier">hasNext</span></a><span class="Other">[</span><span class="Identifier">Key</span><span class="Other">,</span> <span class="Identifier">Val</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="btrees.html#BTree"><span class="Identifier">BTree</span></a><span class="Other">[</span><span class="Identifier">Key</span><span class="Other">,</span> <span class="Identifier">Val</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">index</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/btrees.nim#L148" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/btrees.nim#L148" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="initBTree-procs-all">
<div id="initBTree">
<dt><pre><span class="Keyword">proc</span> <a href="#initBTree"><span class="Identifier">initBTree</span></a><span class="Other">[</span><span class="Identifier">Key</span><span class="Other">,</span> <span class="Identifier">Val</span><span class="Other">]</span><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="btrees.html#BTree"><span class="Identifier">BTree</span></a><span class="Other">[</span><span class="Identifier">Key</span><span class="Other">,</span> <span class="Identifier">Val</span><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/btrees.nim#L34" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/btrees.nim#L34" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="len-procs-all">
<div id="len,BTree[Key,Val]">
<dt><pre><span class="Keyword">proc</span> <a href="#len%2CBTree%5BKey%2CVal%5D"><span class="Identifier">len</span></a><span class="Other">[</span><span class="Identifier">Key</span><span class="Other">,</span> <span class="Identifier">Val</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="btrees.html#BTree"><span class="Identifier">BTree</span></a><span class="Other">[</span><span class="Identifier">Key</span><span class="Other">,</span> <span class="Identifier">Val</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span class="Identifier">inline</span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/btrees.nim#L180" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/btrees.nim#L180" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="next-procs-all">
<div id="next,BTree[Key,Val],int">
<dt><pre><span class="Keyword">proc</span> <a href="#next%2CBTree%5BKey%2CVal%5D%2Cint"><span class="Identifier">next</span></a><span class="Other">[</span><span class="Identifier">Key</span><span class="Other">,</span> <span class="Identifier">Val</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="btrees.html#BTree"><span class="Identifier">BTree</span></a><span class="Other">[</span><span class="Identifier">Key</span><span class="Other">,</span> <span class="Identifier">Val</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">index</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Other">(</span><span class="Identifier">Key</span><span class="Other">,</span> <span class="Identifier">Val</span><span class="Other">,</span> <span class="Identifier">int</span><span class="Other">)</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/btrees.nim#L158" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/btrees.nim#L158" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="15">
<h1><a class="toc-backref" href="#15">Iterators</a></h1>
<dl class="item">
<div id="pairs-iterators-all">
<div id="pairs.i,BTree[Key,Val]">
<dt><pre><span class="Keyword">iterator</span> <a href="#pairs.i%2CBTree%5BKey%2CVal%5D"><span class="Identifier">pairs</span></a><span class="Other">[</span><span class="Identifier">Key</span><span class="Other">,</span> <span class="Identifier">Val</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="btrees.html#BTree"><span class="Identifier">BTree</span></a><span class="Other">[</span><span class="Identifier">Key</span><span class="Other">,</span> <span class="Identifier">Val</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Other">(</span><span class="Identifier">Key</span><span class="Other">,</span> <span class="Identifier">Val</span><span class="Other">)</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/btrees.nim#L173" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/btrees.nim#L173" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:12 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

10
compiler/btrees.idx Normal file
View File

@@ -0,0 +1,10 @@
nimTitle btrees btrees.html module btrees 0
nim BTree btrees.html#BTree object BTree 30
nim initBTree btrees.html#initBTree proc initBTree[Key, Val](): BTree[Key, Val] 34
nim getOrDefault btrees.html#getOrDefault,BTree[Key,Val],Key proc getOrDefault[Key, Val](b: BTree[Key, Val]; key: Key): Val 40
nim contains btrees.html#contains,BTree[Key,Val],Key proc contains[Key, Val](b: BTree[Key, Val]; key: Key): bool 52
nim add btrees.html#add,BTree[Key,Val],Key,Val proc add[Key, Val](b: var BTree[Key, Val]; key: Key; val: Val) 121
nim hasNext btrees.html#hasNext,BTree[Key,Val],int proc hasNext[Key, Val](b: BTree[Key, Val]; index: int): bool 148
nim next btrees.html#next,BTree[Key,Val],int proc next[Key, Val](b: BTree[Key, Val]; index: int): (Key, Val, int) 158
nim pairs btrees.html#pairs.i,BTree[Key,Val] iterator pairs[Key, Val](b: BTree[Key, Val]): (Key, Val) 173
nim len btrees.html#len,BTree[Key,Val] proc len[Key, Val](b: BTree[Key, Val]): int 180

1002
compiler/cbuilderbase.html Normal file

File diff suppressed because it is too large Load Diff

73
compiler/cbuilderbase.idx Normal file
View File

@@ -0,0 +1,73 @@
nimTitle cbuilderbase cbuilderbase.html module cbuilderbase 0
nim Snippet cbuilderbase.html#Snippet type Snippet 4
nim Builder cbuilderbase.html#Builder object Builder 5
nim newBuilder cbuilderbase.html#newBuilder.t,string template newBuilder(s: string): Builder 9
nim extract cbuilderbase.html#extract,Builder proc extract(builder: Builder): Snippet 12
nim add cbuilderbase.html#add,Builder,string proc add(builder: var Builder; s: string) 15
nim add cbuilderbase.html#add,Builder,char proc add(builder: var Builder; s: char) 18
nim addNewline cbuilderbase.html#addNewline,Builder proc addNewline(builder: var Builder) 21
nim addLineEnd cbuilderbase.html#addLineEnd,Builder,string proc addLineEnd(builder: var Builder; s: string) 26
nim addLineEndIndent cbuilderbase.html#addLineEndIndent,Builder,string proc addLineEndIndent(builder: var Builder; s: string) 30
nim addDedent cbuilderbase.html#addDedent,Builder,string proc addDedent(builder: var Builder; s: string) 35
nim addLineEndDedent cbuilderbase.html#addLineEndDedent,Builder,string proc addLineEndDedent(builder: var Builder; s: string) 41
nim addLineComment cbuilderbase.html#addLineComment,Builder,string proc addLineComment(builder: var Builder; comment: string) 45
nim addIntValue cbuilderbase.html#addIntValue,Builder,int proc addIntValue(builder: var Builder; val: int) 51
nim addIntValue cbuilderbase.html#addIntValue,Builder,int64 proc addIntValue(builder: var Builder; val: int64) 54
nim addIntValue cbuilderbase.html#addIntValue,Builder,uint64 proc addIntValue(builder: var Builder; val: uint64) 57
nim addIntValue cbuilderbase.html#addIntValue,Builder,Int128 proc addIntValue(builder: var Builder; val: Int128) 60
nim cIntValue cbuilderbase.html#cIntValue.t,int template cIntValue(val: int): Snippet 63
nim cIntValue cbuilderbase.html#cIntValue.t,int64 template cIntValue(val: int64): Snippet 64
nim cIntValue cbuilderbase.html#cIntValue.t,uint64 template cIntValue(val: uint64): Snippet 65
nim cIntValue cbuilderbase.html#cIntValue.t,Int128 template cIntValue(val: Int128): Snippet 66
nim cUintValue cbuilderbase.html#cUintValue.t,uint template cUintValue(val: uint): Snippet 68
nim addFloatValue cbuilderbase.html#addFloatValue,Builder,float proc addFloatValue(builder: var Builder; val: float) 72
nim cFloatValue cbuilderbase.html#cFloatValue.t,float template cFloatValue(val: float): Snippet 75
nim addInt64Literal cbuilderbase.html#addInt64Literal,Builder,BiggestInt proc addInt64Literal(result: var Builder; i: BiggestInt) 77
nim addUint64Literal cbuilderbase.html#addUint64Literal,Builder,uint64 proc addUint64Literal(result: var Builder; i: uint64) 83
nim addIntLiteral cbuilderbase.html#addIntLiteral,Builder,BiggestInt proc addIntLiteral(result: var Builder; i: BiggestInt) 86
nim addIntLiteral cbuilderbase.html#addIntLiteral,Builder,Int128 proc addIntLiteral(result: var Builder; i: Int128) 97
nim cInt64Literal cbuilderbase.html#cInt64Literal,BiggestInt proc cInt64Literal(i: BiggestInt): Snippet 100
nim cUint64Literal cbuilderbase.html#cUint64Literal,uint64 proc cUint64Literal(i: uint64): Snippet 106
nim cIntLiteral cbuilderbase.html#cIntLiteral,BiggestInt proc cIntLiteral(i: BiggestInt): Snippet 109
nim cIntLiteral cbuilderbase.html#cIntLiteral,Int128 proc cIntLiteral(i: Int128): Snippet 120
nim NimInt cbuilderbase.html#NimInt const NimInt 124
nim NimInt8 cbuilderbase.html#NimInt8 const NimInt8 125
nim NimInt16 cbuilderbase.html#NimInt16 const NimInt16 126
nim NimInt32 cbuilderbase.html#NimInt32 const NimInt32 127
nim NimInt64 cbuilderbase.html#NimInt64 const NimInt64 128
nim CInt cbuilderbase.html#CInt const CInt 129
nim NimUint cbuilderbase.html#NimUint const NimUint 130
nim NimUint8 cbuilderbase.html#NimUint8 const NimUint8 131
nim NimUint16 cbuilderbase.html#NimUint16 const NimUint16 132
nim NimUint32 cbuilderbase.html#NimUint32 const NimUint32 133
nim NimUint64 cbuilderbase.html#NimUint64 const NimUint64 134
nim NimFloat cbuilderbase.html#NimFloat const NimFloat 135
nim NimFloat32 cbuilderbase.html#NimFloat32 const NimFloat32 136
nim NimFloat64 cbuilderbase.html#NimFloat64 const NimFloat64 137
nim NimFloat128 cbuilderbase.html#NimFloat128 const NimFloat128 138
nim NimNan cbuilderbase.html#NimNan const NimNan 139
nim NimInf cbuilderbase.html#NimInf const NimInf 140
nim NimBool cbuilderbase.html#NimBool const NimBool 141
nim NimTrue cbuilderbase.html#NimTrue const NimTrue 142
nim NimFalse cbuilderbase.html#NimFalse const NimFalse 143
nim NimChar cbuilderbase.html#NimChar const NimChar 144
nim CChar cbuilderbase.html#CChar const CChar 145
nim NimCstring cbuilderbase.html#NimCstring const NimCstring 146
nim NimNil cbuilderbase.html#NimNil const NimNil 147
nim CNil cbuilderbase.html#CNil const CNil 148
nim NimStrlitFlag cbuilderbase.html#NimStrlitFlag const NimStrlitFlag 149
nim CVoid cbuilderbase.html#CVoid const CVoid 150
nim CPointer cbuilderbase.html#CPointer const CPointer 151
nim CConstPointer cbuilderbase.html#CConstPointer const CConstPointer 152
nim cIntType cbuilderbase.html#cIntType,BiggestInt proc cIntType(bits: BiggestInt): Snippet 154
nim cUintType cbuilderbase.html#cUintType,BiggestInt proc cUintType(bits: BiggestInt): Snippet 157
nim WaitingIf cbuilderbase.html#WaitingIf IfBuilderState.WaitingIf 161
nim WaitingElseIf cbuilderbase.html#WaitingElseIf IfBuilderState.WaitingElseIf 161
nim InBlock cbuilderbase.html#InBlock IfBuilderState.InBlock 161
nim IfBuilderState cbuilderbase.html#IfBuilderState enum IfBuilderState 161
nim IfBuilder cbuilderbase.html#IfBuilder object IfBuilder 163
nimgrp cintliteral cbuilderbase.html#cIntLiteral-procs-all proc 109
nimgrp addintvalue cbuilderbase.html#addIntValue-procs-all proc 51
nimgrp addintliteral cbuilderbase.html#addIntLiteral-procs-all proc 86
nimgrp add cbuilderbase.html#add-procs-all proc 15
nimgrp cintvalue cbuilderbase.html#cIntValue-templates-all template 63

278
compiler/ccgutils.html Normal file
View File

@@ -0,0 +1,278 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ccgutils</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">ccgutils</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">ccgIntroducedPtr
<li><a class="reference" href="#ccgIntroducedPtr%2CConfigRef%2CPSym%2CPType" title="ccgIntroducedPtr(conf: ConfigRef; s: PSym; retType: PType): bool">ccgIntroducedPtr(conf: ConfigRef; s: PSym; retType: PType): bool</a></li>
</ul>
<ul class="simple nested-toc-section">encodeName
<li><a class="reference" href="#encodeName%2Cstring" title="encodeName(name: string): string">encodeName(name: string): string</a></li>
</ul>
<ul class="simple nested-toc-section">encodeSym
<li><a class="reference" href="#encodeSym%2CBModule%2CPSym%2Cbool%2Cstring" title="encodeSym(m: BModule; s: PSym; makeUnique: bool = false; extra: string = &quot;&quot;): string">encodeSym(m: BModule; s: PSym; makeUnique: bool = false; extra: string = &quot;&quot;): string</a></li>
</ul>
<ul class="simple nested-toc-section">encodeType
<li><a class="reference" href="#encodeType%2CBModule%2CPType%2Cstring" title="encodeType(m: BModule; t: PType; staticLists: var string): string">encodeType(m: BModule; t: PType; staticLists: var string): string</a></li>
</ul>
<ul class="simple nested-toc-section">getPragmaStmt
<li><a class="reference" href="#getPragmaStmt%2CPNode%2CTSpecialWord" title="getPragmaStmt(n: PNode; w: TSpecialWord): PNode">getPragmaStmt(n: PNode; w: TSpecialWord): PNode</a></li>
</ul>
<ul class="simple nested-toc-section">hashString
<li><a class="reference" href="#hashString%2CConfigRef%2Cstring" title="hashString(conf: ConfigRef; s: string): BiggestInt">hashString(conf: ConfigRef; s: string): BiggestInt</a></li>
</ul>
<ul class="simple nested-toc-section">makeSingleLineCString
<li><a class="reference" href="#makeSingleLineCString%2Cstring" title="makeSingleLineCString(s: string): string">makeSingleLineCString(s: string): string</a></li>
</ul>
<ul class="simple nested-toc-section">stmtsContainPragma
<li><a class="reference" href="#stmtsContainPragma%2CPNode%2CTSpecialWord" title="stmtsContainPragma(n: PNode; w: TSpecialWord): bool">stmtsContainPragma(n: PNode; w: TSpecialWord): bool</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">getUniqueType
<li><a class="reference" href="#getUniqueType.t%2CPType" title="getUniqueType(key: PType): PType">getUniqueType(key: PType): PType</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ccgutils.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ccgutils.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="ast.html">ast</a>, <a class="reference external" href="types.html">types</a>, <a class="reference external" href="msgs.html">msgs</a>, <a class="reference external" href="wordrecg.html">wordrecg</a>, <a class="reference external" href="platform.html">platform</a>, <a class="reference external" href="trees.html">trees</a>, <a class="reference external" href="options.html">options</a>, <a class="reference external" href="cgendata.html">cgendata</a>, <a class="reference external" href="mangleutils.html">mangleutils</a>, <a class="reference external" href="renderer.html">renderer</a>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="ccgIntroducedPtr-procs-all">
<div id="ccgIntroducedPtr,ConfigRef,PSym,PType">
<dt><pre><span class="Keyword">proc</span> <a href="#ccgIntroducedPtr%2CConfigRef%2CPSym%2CPType"><span class="Identifier">ccgIntroducedPtr</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">s</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span> <span class="Identifier">retType</span><span class="Other">:</span> <a href="ast.html#PType"><span class="Identifier">PType</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ccgutils.nim#L79" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ccgutils.nim#L79" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="encodeName-procs-all">
<div id="encodeName,string">
<dt><pre><span class="Keyword">proc</span> <a href="#encodeName%2Cstring"><span class="Identifier">encodeName</span></a><span class="Other">(</span><span class="Identifier">name</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ccgutils.nim#L109" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ccgutils.nim#L109" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="encodeSym-procs-all">
<div id="encodeSym,BModule,PSym,bool,string">
<dt><pre><span class="Keyword">proc</span> <a href="#encodeSym%2CBModule%2CPSym%2Cbool%2Cstring"><span class="Identifier">encodeSym</span></a><span class="Other">(</span><span class="Identifier">m</span><span class="Other">:</span> <a href="cgendata.html#BModule"><span class="Identifier">BModule</span></a><span class="Other">;</span> <span class="Identifier">s</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span> <span class="Identifier">makeUnique</span><span class="Other">:</span> <span class="Identifier">bool</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">;</span> <span class="Identifier">extra</span><span class="Other">:</span> <span class="Identifier">string</span> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ccgutils.nim#L120" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ccgutils.nim#L120" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="encodeType-procs-all">
<div id="encodeType,BModule,PType,string">
<dt><pre><span class="Keyword">proc</span> <a href="#encodeType%2CBModule%2CPType%2Cstring"><span class="Identifier">encodeType</span></a><span class="Other">(</span><span class="Identifier">m</span><span class="Other">:</span> <a href="cgendata.html#BModule"><span class="Identifier">BModule</span></a><span class="Other">;</span> <span class="Identifier">t</span><span class="Other">:</span> <a href="ast.html#PType"><span class="Identifier">PType</span></a><span class="Other">;</span> <span class="Identifier">staticLists</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ccgutils.nim#L127" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ccgutils.nim#L127" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getPragmaStmt-procs-all">
<div id="getPragmaStmt,PNode,TSpecialWord">
<dt><pre><span class="Keyword">proc</span> <a href="#getPragmaStmt%2CPNode%2CTSpecialWord"><span class="Identifier">getPragmaStmt</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">;</span> <span class="Identifier">w</span><span class="Other">:</span> <a href="wordrecg.html#TSpecialWord"><span class="Identifier">TSpecialWord</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ccgutils.nim#L21" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ccgutils.nim#L21" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="hashString-procs-all">
<div id="hashString,ConfigRef,string">
<dt><pre><span class="Keyword">proc</span> <a href="#hashString%2CConfigRef%2Cstring"><span class="Identifier">hashString</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">s</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">BiggestInt</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ccgutils.nim#L38" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ccgutils.nim#L38" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="makeSingleLineCString-procs-all">
<div id="makeSingleLineCString,string">
<dt><pre><span class="Keyword">proc</span> <a href="#makeSingleLineCString%2Cstring"><span class="Identifier">makeSingleLineCString</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ccgutils.nim#L65" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ccgutils.nim#L65" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="stmtsContainPragma-procs-all">
<div id="stmtsContainPragma,PNode,TSpecialWord">
<dt><pre><span class="Keyword">proc</span> <a href="#stmtsContainPragma%2CPNode%2CTSpecialWord"><span class="Identifier">stmtsContainPragma</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">;</span> <span class="Identifier">w</span><span class="Other">:</span> <a href="wordrecg.html#TSpecialWord"><span class="Identifier">TSpecialWord</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ccgutils.nim#L35" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ccgutils.nim#L35" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="getUniqueType-templates-all">
<div id="getUniqueType.t,PType">
<dt><pre><span class="Keyword">template</span> <a href="#getUniqueType.t%2CPType"><span class="Identifier">getUniqueType</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="ast.html#PType"><span class="Identifier">PType</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ast.html#PType"><span class="Identifier">PType</span></a></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ccgutils.nim#L63" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ccgutils.nim#L63" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:13 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

10
compiler/ccgutils.idx Normal file
View File

@@ -0,0 +1,10 @@
nimTitle ccgutils ccgutils.html module ccgutils 0
nim getPragmaStmt ccgutils.html#getPragmaStmt,PNode,TSpecialWord proc getPragmaStmt(n: PNode; w: TSpecialWord): PNode 21
nim stmtsContainPragma ccgutils.html#stmtsContainPragma,PNode,TSpecialWord proc stmtsContainPragma(n: PNode; w: TSpecialWord): bool 35
nim hashString ccgutils.html#hashString,ConfigRef,string proc hashString(conf: ConfigRef; s: string): BiggestInt 38
nim getUniqueType ccgutils.html#getUniqueType.t,PType template getUniqueType(key: PType): PType 63
nim makeSingleLineCString ccgutils.html#makeSingleLineCString,string proc makeSingleLineCString(s: string): string 65
nim ccgIntroducedPtr ccgutils.html#ccgIntroducedPtr,ConfigRef,PSym,PType proc ccgIntroducedPtr(conf: ConfigRef; s: PSym; retType: PType): bool 79
nim encodeName ccgutils.html#encodeName,string proc encodeName(name: string): string 109
nim encodeSym ccgutils.html#encodeSym,BModule,PSym,bool,string proc encodeSym(m: BModule; s: PSym; makeUnique: bool = false; extra: string = ""): string 120
nim encodeType ccgutils.html#encodeType,BModule,PType,string proc encodeType(m: BModule; t: PType; staticLists: var string): string 127

345
compiler/cgen.html Normal file
View File

@@ -0,0 +1,345 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>cgen</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">cgen</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">cgenWriteModules
<li><a class="reference" href="#cgenWriteModules%2CRootRef%2CConfigRef" title="cgenWriteModules(backend: RootRef; config: ConfigRef)">cgenWriteModules(backend: RootRef; config: ConfigRef)</a></li>
</ul>
<ul class="simple nested-toc-section">fillObjectFields
<li><a class="reference" href="#fillObjectFields%2CBModule%2CPType" title="fillObjectFields(m: BModule; typ: PType)">fillObjectFields(m: BModule; typ: PType)</a></li>
</ul>
<ul class="simple nested-toc-section">finalCodegenActions
<li><a class="reference" href="#finalCodegenActions%2CModuleGraph%2CBModule%2CPNode" title="finalCodegenActions(graph: ModuleGraph; m: BModule; n: PNode)">finalCodegenActions(graph: ModuleGraph; m: BModule; n: PNode)</a></li>
</ul>
<ul class="simple nested-toc-section">genProcAux
<li><a class="reference" href="#genProcAux%2CBModule%2CPSym" title="genProcAux(m: BModule; prc: PSym)">genProcAux(m: BModule; prc: PSym)</a></li>
</ul>
<ul class="simple nested-toc-section">genTopLevelStmt
<li><a class="reference" href="#genTopLevelStmt%2CBModule%2CPNode" title="genTopLevelStmt(m: BModule; n: PNode)">genTopLevelStmt(m: BModule; n: PNode)</a></li>
</ul>
<ul class="simple nested-toc-section">genTypeInfo
<li><a class="reference" href="#genTypeInfo%2CConfigRef%2CBModule%2CPType%2CTLineInfo" title="genTypeInfo(config: ConfigRef; m: BModule; t: PType; info: TLineInfo): Rope">genTypeInfo(config: ConfigRef; m: BModule; t: PType; info: TLineInfo): Rope</a></li>
</ul>
<ul class="simple nested-toc-section">multiFormat
<li><a class="reference" href="#multiFormat%2Cstring%2CstaticopenArray%5Bchar%5D%2CopenArray%5Bseq%5Bstring%5D%5D" title="multiFormat(frmt: var string; chars: static openArray[char];
args: openArray[seq[string]])">multiFormat(frmt: var string; chars: static openArray[char];
args: openArray[seq[string]])</a></li>
</ul>
<ul class="simple nested-toc-section">newModule
<li><a class="reference" href="#newModule%2CBModuleList%2CPSym%2CConfigRef" title="newModule(g: BModuleList; module: PSym; conf: ConfigRef): BModule">newModule(g: BModuleList; module: PSym; conf: ConfigRef): BModule</a></li>
</ul>
<ul class="simple nested-toc-section">registerInitProcs
<li><a class="reference" href="#registerInitProcs%2CBModuleList%2CPSym%2Cset%5BModuleBackendFlag%5D" title="registerInitProcs(g: BModuleList; m: PSym; flags: set[ModuleBackendFlag])">registerInitProcs(g: BModuleList; m: PSym; flags: set[ModuleBackendFlag])</a></li>
</ul>
<ul class="simple nested-toc-section">setupCgen
<li><a class="reference" href="#setupCgen%2CModuleGraph%2CPSym%2CIdGenerator" title="setupCgen(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext">setupCgen(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext</a></li>
</ul>
<ul class="simple nested-toc-section">whichInitProcs
<li><a class="reference" href="#whichInitProcs%2CBModule" title="whichInitProcs(m: BModule): set[ModuleBackendFlag]">whichInitProcs(m: BModule): set[ModuleBackendFlag]</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">cgDeclFrmt
<li><a class="reference" href="#cgDeclFrmt.t%2CPSym" title="cgDeclFrmt(s: PSym): string">cgDeclFrmt(s: PSym): string</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgen.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgen.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">This module implements the C code generator.This include file contains the logic to produce constant string and seq literals. The code here is responsible that <tt class="docutils literal"><span class="pre">const x = [&quot;a&quot;, &quot;b&quot;]</span></tt> works without hidden runtime creation code. The price is that seqs and strings are not purely a library implementation.Generates traversal procs for the C backend.Code specialization instead of the old, incredibly slow 'genericReset' implementation.Thread var support for architectures that lack native support for thread local storage.</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="ast.html">ast</a>, <a class="reference external" href="astalgo.html">astalgo</a>, <a class="reference external" href="trees.html">trees</a>, <a class="reference external" href="platform.html">platform</a>, <a class="reference external" href="magicsys.html">magicsys</a>, <a class="reference external" href="extccomp.html">extccomp</a>, <a class="reference external" href="options.html">options</a>, <a class="reference external" href="nversion.html">nversion</a>, <a class="reference external" href="nimsets.html">nimsets</a>, <a class="reference external" href="msgs.html">msgs</a>, <a class="reference external" href="bitsets.html">bitsets</a>, <a class="reference external" href="idents.html">idents</a>, <a class="reference external" href="types.html">types</a>, <a class="reference external" href="ccgutils.html">ccgutils</a>, <a class="reference external" href="ropes.html">ropes</a>, <a class="reference external" href="wordrecg.html">wordrecg</a>, <a class="reference external" href="treetab.html">treetab</a>, <a class="reference external" href="cgmeth.html">cgmeth</a>, <a class="reference external" href="rodutils.html">rodutils</a>, <a class="reference external" href="renderer.html">renderer</a>, <a class="reference external" href="cgendata.html">cgendata</a>, <a class="reference external" href="aliases.html">aliases</a>, <a class="reference external" href="lowerings.html">lowerings</a>, <a class="reference external" href="lineinfos.html">lineinfos</a>, <a class="reference external" href="pathutils.html">pathutils</a>, <a class="reference external" href="transf.html">transf</a>, <a class="reference external" href="injectdestructors.html">injectdestructors</a>, <a class="reference external" href="astmsgs.html">astmsgs</a>, <a class="reference external" href="modulepaths.html">modulepaths</a>, <a class="reference external" href="pushpoppragmas.html">pushpoppragmas</a>, <a class="reference external" href="mangleutils.html">mangleutils</a>, <a class="reference external" href="cbuilderbase.html">cbuilderbase</a>, <a class="reference external" href="expanddefaults.html">expanddefaults</a>, <a class="reference external" href="pipelineutils.html">pipelineutils</a>, <a class="reference external" href="spawn.html">spawn</a>, <a class="reference external" href="semparallel.html">semparallel</a>, <a class="reference external" href="ic/ic.html">ic/ic</a>, <a class="reference external" href="sighashes.html">sighashes</a>, <a class="reference external" href="modulegraphs.html">modulegraphs</a>, <a class="reference external" href="aliasanalysis.html">aliasanalysis</a>, <a class="reference external" href="parampatterns.html">parampatterns</a>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="cgenWriteModules-procs-all">
<div id="cgenWriteModules,RootRef,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#cgenWriteModules%2CRootRef%2CConfigRef"><span class="Identifier">cgenWriteModules</span></a><span class="Other">(</span><span class="Identifier">backend</span><span class="Other">:</span> <span class="Identifier">RootRef</span><span class="Other">;</span> <span class="Identifier">config</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span>
<span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span>
<span class="Identifier">TimeEffect</span><span class="Other">,</span> <span class="Identifier">WriteDirEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgen.nim#L2618" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgen.nim#L2618" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="fillObjectFields-procs-all">
<div id="fillObjectFields,BModule,PType">
<dt><pre><span class="Keyword">proc</span> <a href="#fillObjectFields%2CBModule%2CPType"><span class="Identifier">fillObjectFields</span></a><span class="Other">(</span><span class="Identifier">m</span><span class="Other">:</span> <a href="cgendata.html#BModule"><span class="Identifier">BModule</span></a><span class="Other">;</span> <span class="Identifier">typ</span><span class="Other">:</span> <a href="ast.html#PType"><span class="Identifier">PType</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span>
<span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span>
<span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ccgtypes.nim#L757" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ccgtypes.nim#L757" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="finalCodegenActions-procs-all">
<div id="finalCodegenActions,ModuleGraph,BModule,PNode">
<dt><pre><span class="Keyword">proc</span> <a href="#finalCodegenActions%2CModuleGraph%2CBModule%2CPNode"><span class="Identifier">finalCodegenActions</span></a><span class="Other">(</span><span class="Identifier">graph</span><span class="Other">:</span> <a href="modulegraphs.html#ModuleGraph"><span class="Identifier">ModuleGraph</span></a><span class="Other">;</span> <span class="Identifier">m</span><span class="Other">:</span> <a href="cgendata.html#BModule"><span class="Identifier">BModule</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span>
<span class="Identifier">TimeEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Also called from IC.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgen.nim#L2538" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgen.nim#L2538" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="genProcAux-procs-all">
<div id="genProcAux,BModule,PSym">
<dt><pre><span class="Keyword">proc</span> <a href="#genProcAux%2CBModule%2CPSym"><span class="Identifier">genProcAux</span></a><span class="Other">(</span><span class="Identifier">m</span><span class="Other">:</span> <a href="cgendata.html#BModule"><span class="Identifier">BModule</span></a><span class="Other">;</span> <span class="Identifier">prc</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span>
<span class="Identifier">ERecoverableError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span>
<span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">TimeEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgen.nim#L1278" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgen.nim#L1278" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="genTopLevelStmt-procs-all">
<div id="genTopLevelStmt,BModule,PNode">
<dt><pre><span class="Keyword">proc</span> <a href="#genTopLevelStmt%2CBModule%2CPNode"><span class="Identifier">genTopLevelStmt</span></a><span class="Other">(</span><span class="Identifier">m</span><span class="Other">:</span> <a href="cgendata.html#BModule"><span class="Identifier">BModule</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span>
<span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span>
<span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">TimeEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Also called from <tt class="docutils literal"><span class="pre"><span class="Identifier">ic</span><span class="Operator">/</span><span class="Identifier">cbackend</span><span class="Operator">.</span><span class="Identifier">nim</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgen.nim#L2442" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgen.nim#L2442" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="genTypeInfo-procs-all">
<div id="genTypeInfo,ConfigRef,BModule,PType,TLineInfo">
<dt><pre><span class="Keyword">proc</span> <a href="#genTypeInfo%2CConfigRef%2CBModule%2CPType%2CTLineInfo"><span class="Identifier">genTypeInfo</span></a><span class="Other">(</span><span class="Identifier">config</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">m</span><span class="Other">:</span> <a href="cgendata.html#BModule"><span class="Identifier">BModule</span></a><span class="Other">;</span> <span class="Identifier">t</span><span class="Other">:</span> <a href="ast.html#PType"><span class="Identifier">PType</span></a><span class="Other">;</span> <span class="Identifier">info</span><span class="Other">:</span> <a href="lineinfos.html#TLineInfo"><span class="Identifier">TLineInfo</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ropes.html#Rope"><span class="Identifier">Rope</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ccgtypes.nim#L2040" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ccgtypes.nim#L2040" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="multiFormat-procs-all">
<div id="multiFormat,string,staticopenArray[char],openArray[seq[string]]">
<dt><pre><span class="Keyword">proc</span> <a href="#multiFormat%2Cstring%2CstaticopenArray%5Bchar%5D%2CopenArray%5Bseq%5Bstring%5D%5D"><span class="Identifier">multiFormat</span></a><span class="Other">(</span><span class="Identifier">frmt</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">chars</span><span class="Other">:</span> <span class="Identifier">static</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">char</span><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">args</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ccgtypes.nim#L474" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ccgtypes.nim#L474" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newModule-procs-all">
<div id="newModule,BModuleList,PSym,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#newModule%2CBModuleList%2CPSym%2CConfigRef"><span class="Identifier">newModule</span></a><span class="Other">(</span><span class="Identifier">g</span><span class="Other">:</span> <a href="cgendata.html#BModuleList"><span class="Identifier">BModuleList</span></a><span class="Other">;</span> <span class="Identifier">module</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span> <span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span><span class="Other">:</span> <a href="cgendata.html#BModule"><span class="Identifier">BModule</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgen.nim#L2345" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgen.nim#L2345" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="registerInitProcs-procs-all">
<div id="registerInitProcs,BModuleList,PSym,set[ModuleBackendFlag]">
<dt><pre><span class="Keyword">proc</span> <a href="#registerInitProcs%2CBModuleList%2CPSym%2Cset%5BModuleBackendFlag%5D"><span class="Identifier">registerInitProcs</span></a><span class="Other">(</span><span class="Identifier">g</span><span class="Other">:</span> <a href="cgendata.html#BModuleList"><span class="Identifier">BModuleList</span></a><span class="Other">;</span> <span class="Identifier">m</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span> <span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="ic/ic.html#ModuleBackendFlag"><span class="Identifier">ModuleBackendFlag</span></a><span class="Other">]</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Called from the IC backend.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgen.nim#L1887" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgen.nim#L1887" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="setupCgen-procs-all">
<div id="setupCgen,ModuleGraph,PSym,IdGenerator">
<dt><pre><span class="Keyword">proc</span> <a href="#setupCgen%2CModuleGraph%2CPSym%2CIdGenerator"><span class="Identifier">setupCgen</span></a><span class="Other">(</span><span class="Identifier">graph</span><span class="Other">:</span> <a href="modulegraphs.html#ModuleGraph"><span class="Identifier">ModuleGraph</span></a><span class="Other">;</span> <span class="Identifier">module</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span> <span class="Identifier">idgen</span><span class="Other">:</span> <a href="ast.html#IdGenerator"><span class="Identifier">IdGenerator</span></a><span class="Other">)</span><span class="Other">:</span> <a href="modulegraphs.html#PPassContext"><span class="Identifier">PPassContext</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">WriteDirEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgen.nim#L2358" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgen.nim#L2358" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="whichInitProcs-procs-all">
<div id="whichInitProcs,BModule">
<dt><pre><span class="Keyword">proc</span> <a href="#whichInitProcs%2CBModule"><span class="Identifier">whichInitProcs</span></a><span class="Other">(</span><span class="Identifier">m</span><span class="Other">:</span> <a href="cgendata.html#BModule"><span class="Identifier">BModule</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="ic/ic.html#ModuleBackendFlag"><span class="Identifier">ModuleBackendFlag</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgen.nim#L1907" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgen.nim#L1907" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="cgDeclFrmt-templates-all">
<div id="cgDeclFrmt.t,PSym">
<dt><pre><span class="Keyword">template</span> <a href="#cgDeclFrmt.t%2CPSym"><span class="Identifier">cgDeclFrmt</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cbuilderdecls.nim#L437" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cbuilderdecls.nim#L437" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:15 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

13
compiler/cgen.idx Normal file
View File

@@ -0,0 +1,13 @@
nimTitle cgen cgen.html module cgen 0
nim cgDeclFrmt cgen.html#cgDeclFrmt.t,PSym template cgDeclFrmt(s: PSym): string 437
nim multiFormat cgen.html#multiFormat,string,staticopenArray[char],openArray[seq[string]] proc multiFormat(frmt: var string; chars: static openArray[char];\n args: openArray[seq[string]]) 474
nim fillObjectFields cgen.html#fillObjectFields,BModule,PType proc fillObjectFields(m: BModule; typ: PType) 757
nim genTypeInfo cgen.html#genTypeInfo,ConfigRef,BModule,PType,TLineInfo proc genTypeInfo(config: ConfigRef; m: BModule; t: PType; info: TLineInfo): Rope 2040
nim genProcAux cgen.html#genProcAux,BModule,PSym proc genProcAux(m: BModule; prc: PSym) 1278
nim registerInitProcs cgen.html#registerInitProcs,BModuleList,PSym,set[ModuleBackendFlag] proc registerInitProcs(g: BModuleList; m: PSym; flags: set[ModuleBackendFlag]) 1887
nim whichInitProcs cgen.html#whichInitProcs,BModule proc whichInitProcs(m: BModule): set[ModuleBackendFlag] 1907
nim newModule cgen.html#newModule,BModuleList,PSym,ConfigRef proc newModule(g: BModuleList; module: PSym; conf: ConfigRef): BModule 2345
nim setupCgen cgen.html#setupCgen,ModuleGraph,PSym,IdGenerator proc setupCgen(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext 2358
nim genTopLevelStmt cgen.html#genTopLevelStmt,BModule,PNode proc genTopLevelStmt(m: BModule; n: PNode) 2442
nim finalCodegenActions cgen.html#finalCodegenActions,ModuleGraph,BModule,PNode proc finalCodegenActions(graph: ModuleGraph; m: BModule; n: PNode) 2538
nim cgenWriteModules cgen.html#cgenWriteModules,RootRef,ConfigRef proc cgenWriteModules(backend: RootRef; config: ConfigRef) 2618

547
compiler/cgendata.html Normal file
View File

@@ -0,0 +1,547 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>cgendata</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">cgendata</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#BModule" title="BModule = ref TCGen">BModule</a></li>
<li><a class="reference" href="#BModuleList" title="BModuleList = ref object of RootObj
mainModProcs*, mainModInit*, otherModsInit*, mainDatInit*: Builder
mapping*: Rope
modules*: seq[BModule]
modulesClosed*: seq[BModule]
forwardedProcs*: seq[PSym]
generatedHeader*: BModule
typeInfoMarker*: TypeCacheWithOwner
typeInfoMarkerV2*: TypeCacheWithOwner
config*: ConfigRef
graph*: ModuleGraph
strVersion*, seqVersion*: int
nimtv*: Builder
nimtvDeps*: seq[PType]
nimtvDeclared*: IntSet
mangledPrcs*: HashSet[string]">BModuleList</a></li>
<li><a class="reference" href="#BProc" title="BProc = ref TCProc">BProc</a></li>
<li><a class="reference" href="#CodegenFlag" title="CodegenFlag = enum
preventStackTrace, usesThreadVars, frameDeclared, isHeaderFile,
includesStringh, objHasKidsValid, useAliveDataFromDce">CodegenFlag</a></li>
<li><a class="reference" href="#TBlock" title="TBlock = object
id*: int
label*: Rope
sections*: TCProcSections
isLoop*: bool
nestedTryStmts*: int16
nestedExceptStmts*: int16
frameLen*: int16">TBlock</a></li>
<li><a class="reference" href="#TCFileSection" title="TCFileSection = enum
cfsHeaders, cfsFrameDefines, cfsForwardTypes, cfsTypes, cfsSeqTypes,
cfsTypeInfo, cfsProcHeaders, cfsStrData, cfsData, cfsVars, cfsProcs,
cfsInitProc, cfsDatInitProc, cfsTypeInit1, cfsTypeInit3, cfsDynLibInit">TCFileSection</a></li>
<li><a class="reference" href="#TCFileSections" title="TCFileSections = array[TCFileSection, Builder]">TCFileSections</a></li>
<li><a class="reference" href="#TCProcFlag" title="TCProcFlag = enum
beforeRetNeeded, threadVarAccessed, hasCurFramePointer, noSafePoints,
nimErrorFlagAccessed, nimErrorFlagDeclared, nimErrorFlagDisabled">TCProcFlag</a></li>
<li><a class="reference" href="#TCProcSection" title="TCProcSection = enum
cpsLocals, cpsInit, cpsStmts">TCProcSection</a></li>
<li><a class="reference" href="#TCProcSections" title="TCProcSections = array[TCProcSection, Builder]">TCProcSections</a></li>
<li><a class="reference" href="#TCTypeKind" title="TCTypeKind = enum
ctVoid, ctChar, ctBool, ctInt, ctInt8, ctInt16, ctInt32, ctInt64, ctFloat,
ctFloat32, ctFloat64, ctFloat128, ctUInt, ctUInt8, ctUInt16, ctUInt32,
ctUInt64, ctArray, ctPtrToArray, ctStruct, ctPtr, ctNimStr, ctNimSeq, ctProc,
ctCString">TCTypeKind</a></li>
<li><a class="reference" href="#TLabel" title="TLabel = Rope">TLabel</a></li>
<li><a class="reference" href="#TTypeSeq" title="TTypeSeq = seq[PType]">TTypeSeq</a></li>
<li><a class="reference" href="#TypeCache" title="TypeCache = Table[SigHash, Rope]">TypeCache</a></li>
<li><a class="reference" href="#TypeCacheWithOwner" title="TypeCacheWithOwner = Table[SigHash, tuple[str: Rope, owner: int32]]">TypeCacheWithOwner</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">includeHeader
<li><a class="reference" href="#includeHeader%2CBModule%2Cstring" title="includeHeader(this: BModule; header: string)">includeHeader(this: BModule; header: string)</a></li>
</ul>
<ul class="simple nested-toc-section">initBlock
<li><a class="reference" href="#initBlock" title="initBlock(): TBlock">initBlock(): TBlock</a></li>
</ul>
<ul class="simple nested-toc-section">newModuleList
<li><a class="reference" href="#newModuleList%2CModuleGraph" title="newModuleList(g: ModuleGraph): BModuleList">newModuleList(g: ModuleGraph): BModuleList</a></li>
</ul>
<ul class="simple nested-toc-section">newProc
<li><a class="reference" href="#newProc%2CPSym%2CBModule" title="newProc(prc: PSym; module: BModule): BProc">newProc(prc: PSym; module: BModule): BProc</a></li>
</ul>
<ul class="simple nested-toc-section">procSec
<li><a class="reference" href="#procSec%2CBProc%2CTCProcSection" title="procSec(p: BProc; s: TCProcSection): var Builder">procSec(p: BProc; s: TCProcSection): var Builder</a></li>
</ul>
<ul class="simple nested-toc-section">s
<li><a class="reference" href="#s%2CBProc%2CTCProcSection" title="s(p: BProc; s: TCProcSection): var Builder">s(p: BProc; s: TCProcSection): var Builder</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#15" id="65">Iterators</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">cgenModules
<li><a class="reference" href="#cgenModules.i%2CBModuleList" title="cgenModules(g: BModuleList): BModule">cgenModules(g: BModuleList): BModule</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">config
<li><a class="reference" href="#config.t%2CBModule" title="config(m: BModule): ConfigRef">config(m: BModule): ConfigRef</a></li>
<li><a class="reference" href="#config.t%2CBProc" title="config(p: BProc): ConfigRef">config(p: BProc): ConfigRef</a></li>
</ul>
<ul class="simple nested-toc-section">vccAndC
<li><a class="reference" href="#vccAndC.t%2CBProc" title="vccAndC(p: BProc): bool">vccAndC(p: BProc): bool</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">This module contains the data structures for the C code generation phase.</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="ast.html">ast</a>, <a class="reference external" href="ropes.html">ropes</a>, <a class="reference external" href="options.html">options</a>, <a class="reference external" href="lineinfos.html">lineinfos</a>, <a class="reference external" href="pathutils.html">pathutils</a>, <a class="reference external" href="modulegraphs.html">modulegraphs</a>, <a class="reference external" href="cbuilderbase.html">cbuilderbase</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="BModule">
<dt><pre><a href="cgendata.html#BModule"><span class="Identifier">BModule</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Identifier">TCGen</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L52" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L52" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="BModuleList">
<dt><pre><a href="cgendata.html#BModuleList"><span class="Identifier">BModuleList</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootObj</span>
<span class="Identifier">mainModProcs</span><span class="Operator">*</span><span class="Other">,</span> <span class="Identifier">mainModInit</span><span class="Operator">*</span><span class="Other">,</span> <span class="Identifier">otherModsInit</span><span class="Operator">*</span><span class="Other">,</span> <span class="Identifier">mainDatInit</span><span class="Operator">*</span><span class="Other">:</span> <a href="cbuilderbase.html#Builder"><span class="Identifier">Builder</span></a>
<span class="Identifier">mapping</span><span class="Operator">*</span><span class="Other">:</span> <a href="ropes.html#Rope"><span class="Identifier">Rope</span></a>
<span class="Identifier">modules</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="cgendata.html#BModule"><span class="Identifier">BModule</span></a><span class="Other">]</span>
<span class="Identifier">modulesClosed</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="cgendata.html#BModule"><span class="Identifier">BModule</span></a><span class="Other">]</span>
<span class="Identifier">forwardedProcs</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">]</span>
<span class="Identifier">generatedHeader</span><span class="Operator">*</span><span class="Other">:</span> <a href="cgendata.html#BModule"><span class="Identifier">BModule</span></a>
<span class="Identifier">typeInfoMarker</span><span class="Operator">*</span><span class="Other">:</span> <a href="cgendata.html#TypeCacheWithOwner"><span class="Identifier">TypeCacheWithOwner</span></a>
<span class="Identifier">typeInfoMarkerV2</span><span class="Operator">*</span><span class="Other">:</span> <a href="cgendata.html#TypeCacheWithOwner"><span class="Identifier">TypeCacheWithOwner</span></a>
<span class="Identifier">config</span><span class="Operator">*</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a>
<span class="Identifier">graph</span><span class="Operator">*</span><span class="Other">:</span> <a href="modulegraphs.html#ModuleGraph"><span class="Identifier">ModuleGraph</span></a>
<span class="Identifier">strVersion</span><span class="Operator">*</span><span class="Other">,</span> <span class="Identifier">seqVersion</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span>
<span class="Identifier">nimtv</span><span class="Operator">*</span><span class="Other">:</span> <a href="cbuilderbase.html#Builder"><span class="Identifier">Builder</span></a>
<span class="Identifier">nimtvDeps</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="ast.html#PType"><span class="Identifier">PType</span></a><span class="Other">]</span>
<span class="Identifier">nimtvDeclared</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">IntSet</span>
<span class="Identifier">mangledPrcs</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">HashSet</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L117" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L117" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="BProc">
<dt><pre><a href="cgendata.html#BProc"><span class="Identifier">BProc</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Identifier">TCProc</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L53" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L53" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="CodegenFlag">
<dt><pre><a href="cgendata.html#CodegenFlag"><span class="Identifier">CodegenFlag</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">preventStackTrace</span><span class="Other">,</span> <span class="Identifier">usesThreadVars</span><span class="Other">,</span> <span class="Identifier">frameDeclared</span><span class="Other">,</span> <span class="Identifier">isHeaderFile</span><span class="Other">,</span>
<span class="Identifier">includesStringh</span><span class="Other">,</span> <span class="Identifier">objHasKidsValid</span><span class="Other">,</span> <span class="Identifier">useAliveDataFromDce</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L106" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L106" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="TBlock">
<dt><pre><a href="cgendata.html#TBlock"><span class="Identifier">TBlock</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">id</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span>
<span class="Identifier">label</span><span class="Operator">*</span><span class="Other">:</span> <a href="ropes.html#Rope"><span class="Identifier">Rope</span></a>
<span class="Identifier">sections</span><span class="Operator">*</span><span class="Other">:</span> <a href="cgendata.html#TCProcSections"><span class="Identifier">TCProcSections</span></a>
<span class="Identifier">isLoop</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">bool</span>
<span class="Identifier">nestedTryStmts</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int16</span>
<span class="Identifier">nestedExceptStmts</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int16</span>
<span class="Identifier">frameLen</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int16</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L54" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L54" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="TCFileSection">
<dt><pre><a href="cgendata.html#TCFileSection"><span class="Identifier">TCFileSection</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">cfsHeaders</span><span class="Other">,</span> <span class="Identifier">cfsFrameDefines</span><span class="Other">,</span> <span class="Identifier">cfsForwardTypes</span><span class="Other">,</span> <span class="Identifier">cfsTypes</span><span class="Other">,</span> <span class="Identifier">cfsSeqTypes</span><span class="Other">,</span>
<span class="Identifier">cfsTypeInfo</span><span class="Other">,</span> <span class="Identifier">cfsProcHeaders</span><span class="Other">,</span> <span class="Identifier">cfsStrData</span><span class="Other">,</span> <span class="Identifier">cfsData</span><span class="Other">,</span> <span class="Identifier">cfsVars</span><span class="Other">,</span> <span class="Identifier">cfsProcs</span><span class="Other">,</span>
<span class="Identifier">cfsInitProc</span><span class="Other">,</span> <span class="Identifier">cfsDatInitProc</span><span class="Other">,</span> <span class="Identifier">cfsTypeInit1</span><span class="Other">,</span> <span class="Identifier">cfsTypeInit3</span><span class="Other">,</span> <span class="Identifier">cfsDynLibInit</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L20" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L20" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="TCFileSections">
<dt><pre><a href="cgendata.html#TCFileSections"><span class="Identifier">TCFileSections</span></a> <span class="Other">=</span> <span class="Identifier">array</span><span class="Other">[</span><span class="Identifier">TCFileSection</span><span class="Other">,</span> <a href="cbuilderbase.html#Builder"><span class="Identifier">Builder</span></a><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L46" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L46" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="TCProcFlag">
<dt><pre><a href="cgendata.html#TCProcFlag"><span class="Identifier">TCProcFlag</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">beforeRetNeeded</span><span class="Other">,</span> <span class="Identifier">threadVarAccessed</span><span class="Other">,</span> <span class="Identifier">hasCurFramePointer</span><span class="Other">,</span> <span class="Identifier">noSafePoints</span><span class="Other">,</span>
<span class="Identifier">nimErrorFlagAccessed</span><span class="Other">,</span> <span class="Identifier">nimErrorFlagDeclared</span><span class="Other">,</span> <span class="Identifier">nimErrorFlagDisabled</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L64" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L64" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="TCProcSection">
<dt><pre><a href="cgendata.html#TCProcSection"><span class="Identifier">TCProcSection</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">cpsLocals</span><span class="Other">,</span> <span class="Identifier">cpsInit</span><span class="Other">,</span> <span class="Identifier">cpsStmts</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L47" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L47" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="TCProcSections">
<dt><pre><a href="cgendata.html#TCProcSections"><span class="Identifier">TCProcSections</span></a> <span class="Other">=</span> <span class="Identifier">array</span><span class="Other">[</span><span class="Identifier">TCProcSection</span><span class="Other">,</span> <a href="cbuilderbase.html#Builder"><span class="Identifier">Builder</span></a><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L51" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L51" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="TCTypeKind">
<dt><pre><a href="cgendata.html#TCTypeKind"><span class="Identifier">TCTypeKind</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">ctVoid</span><span class="Other">,</span> <span class="Identifier">ctChar</span><span class="Other">,</span> <span class="Identifier">ctBool</span><span class="Other">,</span> <span class="Identifier">ctInt</span><span class="Other">,</span> <span class="Identifier">ctInt8</span><span class="Other">,</span> <span class="Identifier">ctInt16</span><span class="Other">,</span> <span class="Identifier">ctInt32</span><span class="Other">,</span> <span class="Identifier">ctInt64</span><span class="Other">,</span> <span class="Identifier">ctFloat</span><span class="Other">,</span>
<span class="Identifier">ctFloat32</span><span class="Other">,</span> <span class="Identifier">ctFloat64</span><span class="Other">,</span> <span class="Identifier">ctFloat128</span><span class="Other">,</span> <span class="Identifier">ctUInt</span><span class="Other">,</span> <span class="Identifier">ctUInt8</span><span class="Other">,</span> <span class="Identifier">ctUInt16</span><span class="Other">,</span> <span class="Identifier">ctUInt32</span><span class="Other">,</span>
<span class="Identifier">ctUInt64</span><span class="Other">,</span> <span class="Identifier">ctArray</span><span class="Other">,</span> <span class="Identifier">ctPtrToArray</span><span class="Other">,</span> <span class="Identifier">ctStruct</span><span class="Other">,</span> <span class="Identifier">ctPtr</span><span class="Other">,</span> <span class="Identifier">ctNimStr</span><span class="Other">,</span> <span class="Identifier">ctNimSeq</span><span class="Other">,</span> <span class="Identifier">ctProc</span><span class="Other">,</span>
<span class="Identifier">ctCString</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L39" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L39" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="TLabel">
<dt><pre><a href="cgendata.html#TLabel"><span class="Identifier">TLabel</span></a> <span class="Other">=</span> <a href="ropes.html#Rope"><span class="Identifier">Rope</span></a></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L19" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L19" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="TTypeSeq">
<dt><pre><a href="cgendata.html#TTypeSeq"><span class="Identifier">TTypeSeq</span></a> <span class="Other">=</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="ast.html#PType"><span class="Identifier">PType</span></a><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L102" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L102" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="TypeCache">
<dt><pre><a href="cgendata.html#TypeCache"><span class="Identifier">TypeCache</span></a> <span class="Other">=</span> <span class="Identifier">Table</span><span class="Other">[</span><a href="modulegraphs.html#SigHash"><span class="Identifier">SigHash</span></a><span class="Other">,</span> <a href="ropes.html#Rope"><span class="Identifier">Rope</span></a><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L103" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L103" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="TypeCacheWithOwner">
<dt><pre><a href="cgendata.html#TypeCacheWithOwner"><span class="Identifier">TypeCacheWithOwner</span></a> <span class="Other">=</span> <span class="Identifier">Table</span><span class="Other">[</span><a href="modulegraphs.html#SigHash"><span class="Identifier">SigHash</span></a><span class="Other">,</span> <span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">str</span><span class="Other">:</span> <a href="ropes.html#Rope"><span class="Identifier">Rope</span></a><span class="Other">,</span> <span class="Identifier">owner</span><span class="Other">:</span> <span class="Identifier">int32</span><span class="Other">]</span><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L104" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L104" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="includeHeader-procs-all">
<div id="includeHeader,BModule,string">
<dt><pre><span class="Keyword">proc</span> <a href="#includeHeader%2CBModule%2Cstring"><span class="Identifier">includeHeader</span></a><span class="Other">(</span><span class="Identifier">this</span><span class="Other">:</span> <a href="cgendata.html#BModule"><span class="Identifier">BModule</span></a><span class="Other">;</span> <span class="Identifier">header</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L181" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L181" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="initBlock-procs-all">
<div id="initBlock">
<dt><pre><span class="Keyword">proc</span> <a href="#initBlock"><span class="Identifier">initBlock</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="cgendata.html#TBlock"><span class="Identifier">TBlock</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L193" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L193" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newModuleList-procs-all">
<div id="newModuleList,ModuleGraph">
<dt><pre><span class="Keyword">proc</span> <a href="#newModuleList%2CModuleGraph"><span class="Identifier">newModuleList</span></a><span class="Other">(</span><span class="Identifier">g</span><span class="Other">:</span> <a href="modulegraphs.html#ModuleGraph"><span class="Identifier">ModuleGraph</span></a><span class="Other">)</span><span class="Other">:</span> <a href="cgendata.html#BModuleList"><span class="Identifier">BModuleList</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L211" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L211" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newProc-procs-all">
<div id="newProc,PSym,BModule">
<dt><pre><span class="Keyword">proc</span> <a href="#newProc%2CPSym%2CBModule"><span class="Identifier">newProc</span></a><span class="Other">(</span><span class="Identifier">prc</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span> <span class="Identifier">module</span><span class="Other">:</span> <a href="cgendata.html#BModule"><span class="Identifier">BModule</span></a><span class="Other">)</span><span class="Other">:</span> <a href="cgendata.html#BProc"><span class="Identifier">BProc</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L198" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L198" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="procSec-procs-all">
<div id="procSec,BProc,TCProcSection">
<dt><pre><span class="Keyword">proc</span> <a href="#procSec%2CBProc%2CTCProcSection"><span class="Identifier">procSec</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="cgendata.html#BProc"><span class="Identifier">BProc</span></a><span class="Other">;</span> <span class="Identifier">s</span><span class="Other">:</span> <a href="cgendata.html#TCProcSection"><span class="Identifier">TCProcSection</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="cbuilderbase.html#Builder"><span class="Identifier">Builder</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L189" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L189" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="s-procs-all">
<div id="s,BProc,TCProcSection">
<dt><pre><span class="Keyword">proc</span> <a href="#s%2CBProc%2CTCProcSection"><span class="Identifier">s</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="cgendata.html#BProc"><span class="Identifier">BProc</span></a><span class="Other">;</span> <span class="Identifier">s</span><span class="Other">:</span> <a href="cgendata.html#TCProcSection"><span class="Identifier">TCProcSection</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="cbuilderbase.html#Builder"><span class="Identifier">Builder</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L185" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L185" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="15">
<h1><a class="toc-backref" href="#15">Iterators</a></h1>
<dl class="item">
<div id="cgenModules-iterators-all">
<div id="cgenModules.i,BModuleList">
<dt><pre><span class="Keyword">iterator</span> <a href="#cgenModules.i%2CBModuleList"><span class="Identifier">cgenModules</span></a><span class="Other">(</span><span class="Identifier">g</span><span class="Other">:</span> <a href="cgendata.html#BModuleList"><span class="Identifier">BModuleList</span></a><span class="Other">)</span><span class="Other">:</span> <a href="cgendata.html#BModule"><span class="Identifier">BModule</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L215" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L215" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="config-templates-all">
<div id="config.t,BModule">
<dt><pre><span class="Keyword">template</span> <a href="#config.t%2CBModule"><span class="Identifier">config</span></a><span class="Other">(</span><span class="Identifier">m</span><span class="Other">:</span> <a href="cgendata.html#BModule"><span class="Identifier">BModule</span></a><span class="Other">)</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L177" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L177" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="config.t,BProc">
<dt><pre><span class="Keyword">template</span> <a href="#config.t%2CBProc"><span class="Identifier">config</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="cgendata.html#BProc"><span class="Identifier">BProc</span></a><span class="Other">)</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L178" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L178" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="vccAndC-templates-all">
<div id="vccAndC.t,BProc">
<dt><pre><span class="Keyword">template</span> <a href="#vccAndC.t%2CBProc"><span class="Identifier">vccAndC</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="cgendata.html#BProc"><span class="Identifier">BProc</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgendata.nim#L179" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L179" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:13 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

85
compiler/cgendata.idx Normal file
View File

@@ -0,0 +1,85 @@
nimTitle cgendata cgendata.html module cgendata 0
nim TLabel cgendata.html#TLabel type TLabel 19
nim cfsHeaders cgendata.html#cfsHeaders TCFileSection.cfsHeaders 20
nim cfsFrameDefines cgendata.html#cfsFrameDefines TCFileSection.cfsFrameDefines 20
nim cfsForwardTypes cgendata.html#cfsForwardTypes TCFileSection.cfsForwardTypes 20
nim cfsTypes cgendata.html#cfsTypes TCFileSection.cfsTypes 20
nim cfsSeqTypes cgendata.html#cfsSeqTypes TCFileSection.cfsSeqTypes 20
nim cfsTypeInfo cgendata.html#cfsTypeInfo TCFileSection.cfsTypeInfo 20
nim cfsProcHeaders cgendata.html#cfsProcHeaders TCFileSection.cfsProcHeaders 20
nim cfsStrData cgendata.html#cfsStrData TCFileSection.cfsStrData 20
nim cfsData cgendata.html#cfsData TCFileSection.cfsData 20
nim cfsVars cgendata.html#cfsVars TCFileSection.cfsVars 20
nim cfsProcs cgendata.html#cfsProcs TCFileSection.cfsProcs 20
nim cfsInitProc cgendata.html#cfsInitProc TCFileSection.cfsInitProc 20
nim cfsDatInitProc cgendata.html#cfsDatInitProc TCFileSection.cfsDatInitProc 20
nim cfsTypeInit1 cgendata.html#cfsTypeInit1 TCFileSection.cfsTypeInit1 20
nim cfsTypeInit3 cgendata.html#cfsTypeInit3 TCFileSection.cfsTypeInit3 20
nim cfsDynLibInit cgendata.html#cfsDynLibInit TCFileSection.cfsDynLibInit 20
nim TCFileSection cgendata.html#TCFileSection enum TCFileSection 20
nim ctVoid cgendata.html#ctVoid TCTypeKind.ctVoid 39
nim ctChar cgendata.html#ctChar TCTypeKind.ctChar 39
nim ctBool cgendata.html#ctBool TCTypeKind.ctBool 39
nim ctInt cgendata.html#ctInt TCTypeKind.ctInt 39
nim ctInt8 cgendata.html#ctInt8 TCTypeKind.ctInt8 39
nim ctInt16 cgendata.html#ctInt16 TCTypeKind.ctInt16 39
nim ctInt32 cgendata.html#ctInt32 TCTypeKind.ctInt32 39
nim ctInt64 cgendata.html#ctInt64 TCTypeKind.ctInt64 39
nim ctFloat cgendata.html#ctFloat TCTypeKind.ctFloat 39
nim ctFloat32 cgendata.html#ctFloat32 TCTypeKind.ctFloat32 39
nim ctFloat64 cgendata.html#ctFloat64 TCTypeKind.ctFloat64 39
nim ctFloat128 cgendata.html#ctFloat128 TCTypeKind.ctFloat128 39
nim ctUInt cgendata.html#ctUInt TCTypeKind.ctUInt 39
nim ctUInt8 cgendata.html#ctUInt8 TCTypeKind.ctUInt8 39
nim ctUInt16 cgendata.html#ctUInt16 TCTypeKind.ctUInt16 39
nim ctUInt32 cgendata.html#ctUInt32 TCTypeKind.ctUInt32 39
nim ctUInt64 cgendata.html#ctUInt64 TCTypeKind.ctUInt64 39
nim ctArray cgendata.html#ctArray TCTypeKind.ctArray 39
nim ctPtrToArray cgendata.html#ctPtrToArray TCTypeKind.ctPtrToArray 39
nim ctStruct cgendata.html#ctStruct TCTypeKind.ctStruct 39
nim ctPtr cgendata.html#ctPtr TCTypeKind.ctPtr 39
nim ctNimStr cgendata.html#ctNimStr TCTypeKind.ctNimStr 39
nim ctNimSeq cgendata.html#ctNimSeq TCTypeKind.ctNimSeq 39
nim ctProc cgendata.html#ctProc TCTypeKind.ctProc 39
nim ctCString cgendata.html#ctCString TCTypeKind.ctCString 39
nim TCTypeKind cgendata.html#TCTypeKind enum TCTypeKind 39
nim TCFileSections cgendata.html#TCFileSections type TCFileSections 46
nim cpsLocals cgendata.html#cpsLocals TCProcSection.cpsLocals 47
nim cpsInit cgendata.html#cpsInit TCProcSection.cpsInit 47
nim cpsStmts cgendata.html#cpsStmts TCProcSection.cpsStmts 47
nim TCProcSection cgendata.html#TCProcSection enum TCProcSection 47
nim TCProcSections cgendata.html#TCProcSections type TCProcSections 51
nim BModule cgendata.html#BModule type BModule 52
nim BProc cgendata.html#BProc type BProc 53
nim TBlock cgendata.html#TBlock object TBlock 54
nim beforeRetNeeded cgendata.html#beforeRetNeeded TCProcFlag.beforeRetNeeded 64
nim threadVarAccessed cgendata.html#threadVarAccessed TCProcFlag.threadVarAccessed 64
nim hasCurFramePointer cgendata.html#hasCurFramePointer TCProcFlag.hasCurFramePointer 64
nim noSafePoints cgendata.html#noSafePoints TCProcFlag.noSafePoints 64
nim nimErrorFlagAccessed cgendata.html#nimErrorFlagAccessed TCProcFlag.nimErrorFlagAccessed 64
nim nimErrorFlagDeclared cgendata.html#nimErrorFlagDeclared TCProcFlag.nimErrorFlagDeclared 64
nim nimErrorFlagDisabled cgendata.html#nimErrorFlagDisabled TCProcFlag.nimErrorFlagDisabled 64
nim TCProcFlag cgendata.html#TCProcFlag enum TCProcFlag 64
nim TTypeSeq cgendata.html#TTypeSeq type TTypeSeq 102
nim TypeCache cgendata.html#TypeCache type TypeCache 103
nim TypeCacheWithOwner cgendata.html#TypeCacheWithOwner type TypeCacheWithOwner 104
nim preventStackTrace cgendata.html#preventStackTrace CodegenFlag.preventStackTrace 106
nim usesThreadVars cgendata.html#usesThreadVars CodegenFlag.usesThreadVars 106
nim frameDeclared cgendata.html#frameDeclared CodegenFlag.frameDeclared 106
nim isHeaderFile cgendata.html#isHeaderFile CodegenFlag.isHeaderFile 106
nim includesStringh cgendata.html#includesStringh CodegenFlag.includesStringh 106
nim objHasKidsValid cgendata.html#objHasKidsValid CodegenFlag.objHasKidsValid 106
nim useAliveDataFromDce cgendata.html#useAliveDataFromDce CodegenFlag.useAliveDataFromDce 106
nim CodegenFlag cgendata.html#CodegenFlag enum CodegenFlag 106
nim BModuleList cgendata.html#BModuleList type BModuleList 117
nim config cgendata.html#config.t,BModule template config(m: BModule): ConfigRef 177
nim config cgendata.html#config.t,BProc template config(p: BProc): ConfigRef 178
nim vccAndC cgendata.html#vccAndC.t,BProc template vccAndC(p: BProc): bool 179
nim includeHeader cgendata.html#includeHeader,BModule,string proc includeHeader(this: BModule; header: string) 181
nim s cgendata.html#s,BProc,TCProcSection proc s(p: BProc; s: TCProcSection): var Builder 185
nim procSec cgendata.html#procSec,BProc,TCProcSection proc procSec(p: BProc; s: TCProcSection): var Builder 189
nim initBlock cgendata.html#initBlock proc initBlock(): TBlock 193
nim newProc cgendata.html#newProc,PSym,BModule proc newProc(prc: PSym; module: BModule): BProc 198
nim newModuleList cgendata.html#newModuleList,ModuleGraph proc newModuleList(g: ModuleGraph): BModuleList 211
nim cgenModules cgendata.html#cgenModules.i,BModuleList iterator cgenModules(g: BModuleList): BModule 215
nimgrp config cgendata.html#config-templates-all template 177

238
compiler/cgmeth.html Normal file
View File

@@ -0,0 +1,238 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>cgmeth</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">cgmeth</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">generateIfMethodDispatchers
<li><a class="reference" href="#generateIfMethodDispatchers%2CModuleGraph%2CIdGenerator" title="generateIfMethodDispatchers(g: ModuleGraph; idgen: IdGenerator)">generateIfMethodDispatchers(g: ModuleGraph; idgen: IdGenerator)</a></li>
</ul>
<ul class="simple nested-toc-section">genIfDispatcher
<li><a class="reference" href="#genIfDispatcher%2CModuleGraph%2Cseq%5BPSym%5D%2CIntSet%2CIdGenerator" title="genIfDispatcher(g: ModuleGraph; methods: seq[PSym]; relevantCols: IntSet;
idgen: IdGenerator): PSym">genIfDispatcher(g: ModuleGraph; methods: seq[PSym]; relevantCols: IntSet;
idgen: IdGenerator): PSym</a></li>
</ul>
<ul class="simple nested-toc-section">getDispatcher
<li><a class="reference" href="#getDispatcher%2CPSym" title="getDispatcher(s: PSym): PSym">getDispatcher(s: PSym): PSym</a></li>
</ul>
<ul class="simple nested-toc-section">methodCall
<li><a class="reference" href="#methodCall%2CPNode%2CConfigRef" title="methodCall(n: PNode; conf: ConfigRef): PNode">methodCall(n: PNode; conf: ConfigRef): PNode</a></li>
</ul>
<ul class="simple nested-toc-section">methodDef
<li><a class="reference" href="#methodDef%2CModuleGraph%2CIdGenerator%2CPSym" title="methodDef(g: ModuleGraph; idgen: IdGenerator; s: PSym)">methodDef(g: ModuleGraph; idgen: IdGenerator; s: PSym)</a></li>
</ul>
<ul class="simple nested-toc-section">relevantCol
<li><a class="reference" href="#relevantCol%2Cseq%5BPSym%5D%2Cint" title="relevantCol(methods: seq[PSym]; col: int): bool">relevantCol(methods: seq[PSym]; col: int): bool</a></li>
</ul>
<ul class="simple nested-toc-section">sortBucket
<li><a class="reference" href="#sortBucket%2Cseq%5BPSym%5D%2CIntSet" title="sortBucket(a: var seq[PSym]; relevantCols: IntSet)">sortBucket(a: var seq[PSym]; relevantCols: IntSet)</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgmeth.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgmeth.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">This module implements code generation for methods.</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="options.html">options</a>, <a class="reference external" href="ast.html">ast</a>, <a class="reference external" href="msgs.html">msgs</a>, <a class="reference external" href="idents.html">idents</a>, <a class="reference external" href="renderer.html">renderer</a>, <a class="reference external" href="types.html">types</a>, <a class="reference external" href="magicsys.html">magicsys</a>, <a class="reference external" href="sempass2.html">sempass2</a>, <a class="reference external" href="modulegraphs.html">modulegraphs</a>, <a class="reference external" href="lineinfos.html">lineinfos</a>, <a class="reference external" href="astalgo.html">astalgo</a>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="generateIfMethodDispatchers-procs-all">
<div id="generateIfMethodDispatchers,ModuleGraph,IdGenerator">
<dt><pre><span class="Keyword">proc</span> <a href="#generateIfMethodDispatchers%2CModuleGraph%2CIdGenerator"><span class="Identifier">generateIfMethodDispatchers</span></a><span class="Other">(</span><span class="Identifier">g</span><span class="Other">:</span> <a href="modulegraphs.html#ModuleGraph"><span class="Identifier">ModuleGraph</span></a><span class="Other">;</span> <span class="Identifier">idgen</span><span class="Other">:</span> <a href="ast.html#IdGenerator"><span class="Identifier">IdGenerator</span></a><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgmeth.nim#L299" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgmeth.nim#L299" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="genIfDispatcher-procs-all">
<div id="genIfDispatcher,ModuleGraph,seq[PSym],IntSet,IdGenerator">
<dt><pre><span class="Keyword">proc</span> <a href="#genIfDispatcher%2CModuleGraph%2Cseq%5BPSym%5D%2CIntSet%2CIdGenerator"><span class="Identifier">genIfDispatcher</span></a><span class="Other">(</span><span class="Identifier">g</span><span class="Other">:</span> <a href="modulegraphs.html#ModuleGraph"><span class="Identifier">ModuleGraph</span></a><span class="Other">;</span> <span class="Identifier">methods</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">relevantCols</span><span class="Other">:</span> <span class="Identifier">IntSet</span><span class="Other">;</span>
<span class="Identifier">idgen</span><span class="Other">:</span> <a href="ast.html#IdGenerator"><span class="Identifier">IdGenerator</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgmeth.nim#L240" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgmeth.nim#L240" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getDispatcher-procs-all">
<div id="getDispatcher,PSym">
<dt><pre><span class="Keyword">proc</span> <a href="#getDispatcher%2CPSym"><span class="Identifier">getDispatcher</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
can return nil if is has no dispatcher.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgmeth.nim#L45" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgmeth.nim#L45" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="methodCall-procs-all">
<div id="methodCall,PNode,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#methodCall%2CPNode%2CConfigRef"><span class="Identifier">methodCall</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">;</span> <span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgmeth.nim#L53" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgmeth.nim#L53" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="methodDef-procs-all">
<div id="methodDef,ModuleGraph,IdGenerator,PSym">
<dt><pre><span class="Keyword">proc</span> <a href="#methodDef%2CModuleGraph%2CIdGenerator%2CPSym"><span class="Identifier">methodDef</span></a><span class="Other">(</span><span class="Identifier">g</span><span class="Other">:</span> <a href="modulegraphs.html#ModuleGraph"><span class="Identifier">ModuleGraph</span></a><span class="Other">;</span> <span class="Identifier">idgen</span><span class="Other">:</span> <a href="ast.html#IdGenerator"><span class="Identifier">IdGenerator</span></a><span class="Other">;</span> <span class="Identifier">s</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgmeth.nim#L160" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgmeth.nim#L160" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="relevantCol-procs-all">
<div id="relevantCol,seq[PSym],int">
<dt><pre><span class="Keyword">proc</span> <a href="#relevantCol%2Cseq%5BPSym%5D%2Cint"><span class="Identifier">relevantCol</span></a><span class="Other">(</span><span class="Identifier">methods</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">col</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgmeth.nim#L201" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgmeth.nim#L201" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="sortBucket-procs-all">
<div id="sortBucket,seq[PSym],IntSet">
<dt><pre><span class="Keyword">proc</span> <a href="#sortBucket%2Cseq%5BPSym%5D%2CIntSet"><span class="Identifier">sortBucket</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">relevantCols</span><span class="Other">:</span> <span class="Identifier">IntSet</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgmeth.nim#L221" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgmeth.nim#L221" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:14 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

8
compiler/cgmeth.idx Normal file
View File

@@ -0,0 +1,8 @@
nimTitle cgmeth cgmeth.html module cgmeth 0
nim getDispatcher cgmeth.html#getDispatcher,PSym proc getDispatcher(s: PSym): PSym 45
nim methodCall cgmeth.html#methodCall,PNode,ConfigRef proc methodCall(n: PNode; conf: ConfigRef): PNode 53
nim methodDef cgmeth.html#methodDef,ModuleGraph,IdGenerator,PSym proc methodDef(g: ModuleGraph; idgen: IdGenerator; s: PSym) 160
nim relevantCol cgmeth.html#relevantCol,seq[PSym],int proc relevantCol(methods: seq[PSym]; col: int): bool 201
nim sortBucket cgmeth.html#sortBucket,seq[PSym],IntSet proc sortBucket(a: var seq[PSym]; relevantCols: IntSet) 221
nim genIfDispatcher cgmeth.html#genIfDispatcher,ModuleGraph,seq[PSym],IntSet,IdGenerator proc genIfDispatcher(g: ModuleGraph; methods: seq[PSym]; relevantCols: IntSet;\n idgen: IdGenerator): PSym 240
nim generateIfMethodDispatchers cgmeth.html#generateIfMethodDispatchers,ModuleGraph,IdGenerator proc generateIfMethodDispatchers(g: ModuleGraph; idgen: IdGenerator) 299

123
compiler/closureiters.html Normal file
View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>closureiters</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">closureiters</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">transformClosureIterator
<li><a class="reference" href="#transformClosureIterator%2CModuleGraph%2CIdGenerator%2CPSym%2CPNode" title="transformClosureIterator(g: ModuleGraph; idgen: IdGenerator; fn: PSym; n: PNode): PNode">transformClosureIterator(g: ModuleGraph; idgen: IdGenerator; fn: PSym; n: PNode): PNode</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/closureiters.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/closureiters.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="ast.html">ast</a>, <a class="reference external" href="msgs.html">msgs</a>, <a class="reference external" href="idents.html">idents</a>, <a class="reference external" href="renderer.html">renderer</a>, <a class="reference external" href="magicsys.html">magicsys</a>, <a class="reference external" href="lowerings.html">lowerings</a>, <a class="reference external" href="lambdalifting.html">lambdalifting</a>, <a class="reference external" href="modulegraphs.html">modulegraphs</a>, <a class="reference external" href="lineinfos.html">lineinfos</a>, <a class="reference external" href="options.html">options</a>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="transformClosureIterator-procs-all">
<div id="transformClosureIterator,ModuleGraph,IdGenerator,PSym,PNode">
<dt><pre><span class="Keyword">proc</span> <a href="#transformClosureIterator%2CModuleGraph%2CIdGenerator%2CPSym%2CPNode"><span class="Identifier">transformClosureIterator</span></a><span class="Other">(</span><span class="Identifier">g</span><span class="Other">:</span> <a href="modulegraphs.html#ModuleGraph"><span class="Identifier">ModuleGraph</span></a><span class="Other">;</span> <span class="Identifier">idgen</span><span class="Other">:</span> <a href="ast.html#IdGenerator"><span class="Identifier">IdGenerator</span></a><span class="Other">;</span> <span class="Identifier">fn</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span>
<span class="Identifier">n</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/closureiters.nim#L1463" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/closureiters.nim#L1463" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:14 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

View File

@@ -0,0 +1,2 @@
nimTitle closureiters closureiters.html module closureiters 0
nim transformClosureIterator closureiters.html#transformClosureIterator,ModuleGraph,IdGenerator,PSym,PNode proc transformClosureIterator(g: ModuleGraph; idgen: IdGenerator; fn: PSym; n: PNode): PNode 1463

256
compiler/cmdlinehelper.html Normal file
View File

@@ -0,0 +1,256 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>cmdlinehelper</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">cmdlinehelper</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#NimProg" title="NimProg = ref object
suggestMode*: bool
supportsStdinFile*: bool
processCmdLine*: proc (pass: TCmdLinePass; cmd: string; config: ConfigRef)">NimProg</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">addCmdPrefix
<li><a class="reference" href="#addCmdPrefix%2Cstring%2CCmdLineKind" title="addCmdPrefix(result: var string; kind: CmdLineKind)">addCmdPrefix(result: var string; kind: CmdLineKind)</a></li>
</ul>
<ul class="simple nested-toc-section">initDefinesProg
<li><a class="reference" href="#initDefinesProg%2CNimProg%2CConfigRef%2Cstring" title="initDefinesProg(self: NimProg; conf: ConfigRef; name: string)">initDefinesProg(self: NimProg; conf: ConfigRef; name: string)</a></li>
</ul>
<ul class="simple nested-toc-section">loadConfigsAndProcessCmdLine
<li><a class="reference" href="#loadConfigsAndProcessCmdLine%2CNimProg%2CIdentCache%2CConfigRef%2CModuleGraph" title="loadConfigsAndProcessCmdLine(self: NimProg; cache: IdentCache; conf: ConfigRef;
graph: ModuleGraph): bool">loadConfigsAndProcessCmdLine(self: NimProg; cache: IdentCache; conf: ConfigRef;
graph: ModuleGraph): bool</a></li>
</ul>
<ul class="simple nested-toc-section">loadConfigsAndRunMainCommand
<li><a class="reference" href="#loadConfigsAndRunMainCommand%2CNimProg%2CIdentCache%2CConfigRef%2CModuleGraph" title="loadConfigsAndRunMainCommand(self: NimProg; cache: IdentCache; conf: ConfigRef;
graph: ModuleGraph): bool">loadConfigsAndRunMainCommand(self: NimProg; cache: IdentCache; conf: ConfigRef;
graph: ModuleGraph): bool</a></li>
</ul>
<ul class="simple nested-toc-section">prependCurDir
<li><a class="reference" href="#prependCurDir%2CAbsoluteFile" title="prependCurDir(f: AbsoluteFile): AbsoluteFile">prependCurDir(f: AbsoluteFile): AbsoluteFile</a></li>
</ul>
<ul class="simple nested-toc-section">processCmdLineAndProjectPath
<li><a class="reference" href="#processCmdLineAndProjectPath%2CNimProg%2CConfigRef" title="processCmdLineAndProjectPath(self: NimProg; conf: ConfigRef)">processCmdLineAndProjectPath(self: NimProg; conf: ConfigRef)</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cmdlinehelper.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cmdlinehelper.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">Helpers for binaries that use compiler passes, e.g.: nim, nimsuggest</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="options.html">options</a>, <a class="reference external" href="idents.html">idents</a>, <a class="reference external" href="nimconf.html">nimconf</a>, <a class="reference external" href="extccomp.html">extccomp</a>, <a class="reference external" href="commands.html">commands</a>, <a class="reference external" href="msgs.html">msgs</a>, <a class="reference external" href="lineinfos.html">lineinfos</a>, <a class="reference external" href="modulegraphs.html">modulegraphs</a>, <a class="reference external" href="condsyms.html">condsyms</a>, <a class="reference external" href="pathutils.html">pathutils</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="NimProg">
<dt><pre><a href="cmdlinehelper.html#NimProg"><span class="Identifier">NimProg</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span>
<span class="Identifier">suggestMode</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">bool</span>
<span class="Identifier">supportsStdinFile</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">bool</span>
<span class="Identifier">processCmdLine</span><span class="Operator">*</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">pass</span><span class="Other">:</span> <a href="commands.html#TCmdLinePass"><span class="Identifier">TCmdLinePass</span></a><span class="Other">;</span> <span class="Identifier">cmd</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">config</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cmdlinehelper.nim#L33" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cmdlinehelper.nim#L33" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="addCmdPrefix-procs-all">
<div id="addCmdPrefix,string,CmdLineKind">
<dt><pre><span class="Keyword">proc</span> <a href="#addCmdPrefix%2Cstring%2CCmdLineKind"><span class="Identifier">addCmdPrefix</span></a><span class="Other">(</span><span class="Identifier">result</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">kind</span><span class="Other">:</span> <span class="Identifier">CmdLineKind</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cmdlinehelper.nim#L25" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cmdlinehelper.nim#L25" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="initDefinesProg-procs-all">
<div id="initDefinesProg,NimProg,ConfigRef,string">
<dt><pre><span class="Keyword">proc</span> <a href="#initDefinesProg%2CNimProg%2CConfigRef%2Cstring"><span class="Identifier">initDefinesProg</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="cmdlinehelper.html#NimProg"><span class="Identifier">NimProg</span></a><span class="Other">;</span> <span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">name</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cmdlinehelper.nim#L38" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cmdlinehelper.nim#L38" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="loadConfigsAndProcessCmdLine-procs-all">
<div id="loadConfigsAndProcessCmdLine,NimProg,IdentCache,ConfigRef,ModuleGraph">
<dt><pre><span class="Keyword">proc</span> <a href="#loadConfigsAndProcessCmdLine%2CNimProg%2CIdentCache%2CConfigRef%2CModuleGraph"><span class="Identifier">loadConfigsAndProcessCmdLine</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="cmdlinehelper.html#NimProg"><span class="Identifier">NimProg</span></a><span class="Other">;</span> <span class="Identifier">cache</span><span class="Other">:</span> <a href="idents.html#IdentCache"><span class="Identifier">IdentCache</span></a><span class="Other">;</span>
<span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">graph</span><span class="Other">:</span> <a href="modulegraphs.html#ModuleGraph"><span class="Identifier">ModuleGraph</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span>
<span class="Identifier">EOFError</span><span class="Other">,</span> <span class="Identifier">ESuggestDone</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">WriteEnvEffect</span><span class="Other">,</span>
<span class="Identifier">WriteDirEffect</span><span class="Other">,</span> <span class="Identifier">TimeEffect</span><span class="Other">,</span> <span class="Identifier">ExecIOEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cmdlinehelper.nim#L53" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cmdlinehelper.nim#L53" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="loadConfigsAndRunMainCommand-procs-all">
<div id="loadConfigsAndRunMainCommand,NimProg,IdentCache,ConfigRef,ModuleGraph">
<dt><pre><span class="Keyword">proc</span> <a href="#loadConfigsAndRunMainCommand%2CNimProg%2CIdentCache%2CConfigRef%2CModuleGraph"><span class="Identifier">loadConfigsAndRunMainCommand</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="cmdlinehelper.html#NimProg"><span class="Identifier">NimProg</span></a><span class="Other">;</span> <span class="Identifier">cache</span><span class="Other">:</span> <a href="idents.html#IdentCache"><span class="Identifier">IdentCache</span></a><span class="Other">;</span>
<span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">graph</span><span class="Other">:</span> <a href="modulegraphs.html#ModuleGraph"><span class="Identifier">ModuleGraph</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span>
<span class="Identifier">EOFError</span><span class="Other">,</span> <span class="Identifier">ESuggestDone</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">WriteEnvEffect</span><span class="Other">,</span>
<span class="Identifier">WriteDirEffect</span><span class="Other">,</span> <span class="Identifier">TimeEffect</span><span class="Other">,</span> <span class="Identifier">ExecIOEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Alias for loadConfigsAndProcessCmdLine, here for backwards compatibility
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cmdlinehelper.nim#L83" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cmdlinehelper.nim#L83" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="prependCurDir-procs-all">
<div id="prependCurDir,AbsoluteFile">
<dt><pre><span class="Keyword">proc</span> <a href="#prependCurDir%2CAbsoluteFile"><span class="Identifier">prependCurDir</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="pathutils.html#AbsoluteFile"><span class="Identifier">AbsoluteFile</span></a><span class="Other">)</span><span class="Other">:</span> <a href="pathutils.html#AbsoluteFile"><span class="Identifier">AbsoluteFile</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cmdlinehelper.nim#L18" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cmdlinehelper.nim#L18" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="processCmdLineAndProjectPath-procs-all">
<div id="processCmdLineAndProjectPath,NimProg,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#processCmdLineAndProjectPath%2CNimProg%2CConfigRef"><span class="Identifier">processCmdLineAndProjectPath</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="cmdlinehelper.html#NimProg"><span class="Identifier">NimProg</span></a><span class="Other">;</span> <span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cmdlinehelper.nim#L42" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cmdlinehelper.nim#L42" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:18 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

View File

@@ -0,0 +1,8 @@
nimTitle cmdlinehelper cmdlinehelper.html module cmdlinehelper 0
nim prependCurDir cmdlinehelper.html#prependCurDir,AbsoluteFile proc prependCurDir(f: AbsoluteFile): AbsoluteFile 18
nim addCmdPrefix cmdlinehelper.html#addCmdPrefix,string,CmdLineKind proc addCmdPrefix(result: var string; kind: CmdLineKind) 25
nim NimProg cmdlinehelper.html#NimProg type NimProg 33
nim initDefinesProg cmdlinehelper.html#initDefinesProg,NimProg,ConfigRef,string proc initDefinesProg(self: NimProg; conf: ConfigRef; name: string) 38
nim processCmdLineAndProjectPath cmdlinehelper.html#processCmdLineAndProjectPath,NimProg,ConfigRef proc processCmdLineAndProjectPath(self: NimProg; conf: ConfigRef) 42
nim loadConfigsAndProcessCmdLine cmdlinehelper.html#loadConfigsAndProcessCmdLine,NimProg,IdentCache,ConfigRef,ModuleGraph proc loadConfigsAndProcessCmdLine(self: NimProg; cache: IdentCache; conf: ConfigRef;\n graph: ModuleGraph): bool 53
nim loadConfigsAndRunMainCommand cmdlinehelper.html#loadConfigsAndRunMainCommand,NimProg,IdentCache,ConfigRef,ModuleGraph proc loadConfigsAndRunMainCommand(self: NimProg; cache: IdentCache; conf: ConfigRef;\n graph: ModuleGraph): bool 83

417
compiler/commands.html Normal file
View File

@@ -0,0 +1,417 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>commands</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">commands</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#TCmdLinePass" title="TCmdLinePass = enum
passCmd1, passCmd2, passPP">TCmdLinePass</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">handleCmdInput
<li><a class="reference" href="#handleCmdInput%2CConfigRef" title="handleCmdInput(conf: ConfigRef)">handleCmdInput(conf: ConfigRef)</a></li>
</ul>
<ul class="simple nested-toc-section">handleStdinInput
<li><a class="reference" href="#handleStdinInput%2CConfigRef" title="handleStdinInput(conf: ConfigRef)">handleStdinInput(conf: ConfigRef)</a></li>
</ul>
<ul class="simple nested-toc-section">initOrcDefines
<li><a class="reference" href="#initOrcDefines%2CConfigRef" title="initOrcDefines(conf: ConfigRef)">initOrcDefines(conf: ConfigRef)</a></li>
</ul>
<ul class="simple nested-toc-section">parseCommand
<li><a class="reference" href="#parseCommand%2Cstring" title="parseCommand(command: string): Command">parseCommand(command: string): Command</a></li>
</ul>
<ul class="simple nested-toc-section">processArgument
<li><a class="reference" href="#processArgument%2CTCmdLinePass%2COptParser%2Cint%2CConfigRef" title="processArgument(pass: TCmdLinePass; p: OptParser; argsCount: var int;
config: ConfigRef): bool">processArgument(pass: TCmdLinePass; p: OptParser; argsCount: var int;
config: ConfigRef): bool</a></li>
</ul>
<ul class="simple nested-toc-section">processCommand
<li><a class="reference" href="#processCommand%2Cstring%2CTCmdLinePass%2CConfigRef" title="processCommand(switch: string; pass: TCmdLinePass; config: ConfigRef)">processCommand(switch: string; pass: TCmdLinePass; config: ConfigRef)</a></li>
</ul>
<ul class="simple nested-toc-section">processSpecificNote
<li><a class="reference" href="#processSpecificNote%2Cstring%2CTSpecialWord%2CTCmdLinePass%2CTLineInfo%2Cstring%2CConfigRef" title="processSpecificNote(arg: string; state: TSpecialWord; pass: TCmdLinePass;
info: TLineInfo; orig: string; conf: ConfigRef)">processSpecificNote(arg: string; state: TSpecialWord; pass: TCmdLinePass;
info: TLineInfo; orig: string; conf: ConfigRef)</a></li>
</ul>
<ul class="simple nested-toc-section">processSwitch
<li><a class="reference" href="#processSwitch%2CTCmdLinePass%2COptParser%2CConfigRef" title="processSwitch(pass: TCmdLinePass; p: OptParser; config: ConfigRef)">processSwitch(pass: TCmdLinePass; p: OptParser; config: ConfigRef)</a></li>
<li><a class="reference" href="#processSwitch%2Cstring%2Cstring%2CTCmdLinePass%2CTLineInfo%2CConfigRef" title="processSwitch(switch, arg: string; pass: TCmdLinePass; info: TLineInfo;
conf: ConfigRef)">processSwitch(switch, arg: string; pass: TCmdLinePass; info: TLineInfo;
conf: ConfigRef)</a></li>
</ul>
<ul class="simple nested-toc-section">setCmd
<li><a class="reference" href="#setCmd%2CConfigRef%2CCommand" title="setCmd(conf: ConfigRef; cmd: Command)">setCmd(conf: ConfigRef; cmd: Command)</a></li>
</ul>
<ul class="simple nested-toc-section">setCommandEarly
<li><a class="reference" href="#setCommandEarly%2CConfigRef%2Cstring" title="setCommandEarly(conf: ConfigRef; command: string)">setCommandEarly(conf: ConfigRef; command: string)</a></li>
</ul>
<ul class="simple nested-toc-section">testCompileOption
<li><a class="reference" href="#testCompileOption%2CConfigRef%2Cstring%2CTLineInfo" title="testCompileOption(conf: ConfigRef; switch: string; info: TLineInfo): bool">testCompileOption(conf: ConfigRef; switch: string; info: TLineInfo): bool</a></li>
</ul>
<ul class="simple nested-toc-section">testCompileOptionArg
<li><a class="reference" href="#testCompileOptionArg%2CConfigRef%2Cstring%2Cstring%2CTLineInfo" title="testCompileOptionArg(conf: ConfigRef; switch, arg: string; info: TLineInfo): bool">testCompileOptionArg(conf: ConfigRef; switch, arg: string; info: TLineInfo): bool</a></li>
</ul>
<ul class="simple nested-toc-section">unregisterArcOrc
<li><a class="reference" href="#unregisterArcOrc%2CConfigRef" title="unregisterArcOrc(conf: ConfigRef)">unregisterArcOrc(conf: ConfigRef)</a></li>
</ul>
<ul class="simple nested-toc-section">writeCommandLineUsage
<li><a class="reference" href="#writeCommandLineUsage%2CConfigRef" title="writeCommandLineUsage(conf: ConfigRef)">writeCommandLineUsage(conf: ConfigRef)</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/commands.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="msgs.html">msgs</a>, <a class="reference external" href="options.html">options</a>, <a class="reference external" href="nversion.html">nversion</a>, <a class="reference external" href="condsyms.html">condsyms</a>, <a class="reference external" href="extccomp.html">extccomp</a>, <a class="reference external" href="platform.html">platform</a>, <a class="reference external" href="wordrecg.html">wordrecg</a>, <a class="reference external" href="nimblecmd.html">nimblecmd</a>, <a class="reference external" href="lineinfos.html">lineinfos</a>, <a class="reference external" href="pathutils.html">pathutils</a>, <a class="reference external" href="ast.html">ast</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="TCmdLinePass">
<dt><pre><a href="commands.html#TCmdLinePass"><span class="Identifier">TCmdLinePass</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">passCmd1</span><span class="Other">,</span> <span class="Identifier">passCmd2</span><span class="Other">,</span> <span class="Identifier">passPP</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/commands.nim#L44" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L44" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="handleCmdInput-procs-all">
<div id="handleCmdInput,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#handleCmdInput%2CConfigRef"><span class="Identifier">handleCmdInput</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/commands.nim#L466" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L466" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="handleStdinInput-procs-all">
<div id="handleStdinInput,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#handleStdinInput%2CConfigRef"><span class="Identifier">handleStdinInput</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/commands.nim#L461" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L461" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="initOrcDefines-procs-all">
<div id="initOrcDefines,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#initOrcDefines%2CConfigRef"><span class="Identifier">initOrcDefines</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/commands.nim#L541" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L541" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="parseCommand-procs-all">
<div id="parseCommand,string">
<dt><pre><span class="Keyword">proc</span> <a href="#parseCommand%2Cstring"><span class="Identifier">parseCommand</span></a><span class="Other">(</span><span class="Identifier">command</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <a href="options.html#Command"><span class="Identifier">Command</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/commands.nim#L470" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L470" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="processArgument-procs-all">
<div id="processArgument,TCmdLinePass,OptParser,int,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#processArgument%2CTCmdLinePass%2COptParser%2Cint%2CConfigRef"><span class="Identifier">processArgument</span></a><span class="Other">(</span><span class="Identifier">pass</span><span class="Other">:</span> <a href="commands.html#TCmdLinePass"><span class="Identifier">TCmdLinePass</span></a><span class="Other">;</span> <span class="Identifier">p</span><span class="Other">:</span> <span class="Identifier">OptParser</span><span class="Other">;</span> <span class="Identifier">argsCount</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">int</span><span class="Other">;</span>
<span class="Identifier">config</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/commands.nim#L1184" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L1184" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="processCommand-procs-all">
<div id="processCommand,string,TCmdLinePass,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#processCommand%2Cstring%2CTCmdLinePass%2CConfigRef"><span class="Identifier">processCommand</span></a><span class="Other">(</span><span class="Identifier">switch</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">pass</span><span class="Other">:</span> <a href="commands.html#TCmdLinePass"><span class="Identifier">TCmdLinePass</span></a><span class="Other">;</span> <span class="Identifier">config</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span>
<span class="Identifier">EOFError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span>
<span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">WriteDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/commands.nim#L1167" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L1167" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="processSpecificNote-procs-all">
<div id="processSpecificNote,string,TSpecialWord,TCmdLinePass,TLineInfo,string,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#processSpecificNote%2Cstring%2CTSpecialWord%2CTCmdLinePass%2CTLineInfo%2Cstring%2CConfigRef"><span class="Identifier">processSpecificNote</span></a><span class="Other">(</span><span class="Identifier">arg</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">state</span><span class="Other">:</span> <a href="wordrecg.html#TSpecialWord"><span class="Identifier">TSpecialWord</span></a><span class="Other">;</span> <span class="Identifier">pass</span><span class="Other">:</span> <a href="commands.html#TCmdLinePass"><span class="Identifier">TCmdLinePass</span></a><span class="Other">;</span>
<span class="Identifier">info</span><span class="Other">:</span> <a href="lineinfos.html#TLineInfo"><span class="Identifier">TLineInfo</span></a><span class="Other">;</span> <span class="Identifier">orig</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/commands.nim#L185" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L185" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="processSwitch-procs-all">
<div id="processSwitch,TCmdLinePass,OptParser,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#processSwitch%2CTCmdLinePass%2COptParser%2CConfigRef"><span class="Identifier">processSwitch</span></a><span class="Other">(</span><span class="Identifier">pass</span><span class="Other">:</span> <a href="commands.html#TCmdLinePass"><span class="Identifier">TCmdLinePass</span></a><span class="Other">;</span> <span class="Identifier">p</span><span class="Other">:</span> <span class="Identifier">OptParser</span><span class="Other">;</span> <span class="Identifier">config</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span>
<span class="Identifier">EOFError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span>
<span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">WriteDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/commands.nim#L1173" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L1173" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="processSwitch,string,string,TCmdLinePass,TLineInfo,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#processSwitch%2Cstring%2Cstring%2CTCmdLinePass%2CTLineInfo%2CConfigRef"><span class="Identifier">processSwitch</span></a><span class="Other">(</span><span class="Identifier">switch</span><span class="Other">,</span> <span class="Identifier">arg</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">pass</span><span class="Other">:</span> <a href="commands.html#TCmdLinePass"><span class="Identifier">TCmdLinePass</span></a><span class="Other">;</span> <span class="Identifier">info</span><span class="Other">:</span> <a href="lineinfos.html#TLineInfo"><span class="Identifier">TLineInfo</span></a><span class="Other">;</span>
<span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span>
<span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">EOFError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span>
<span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span>
<span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span>
<span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span>
<span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">WriteDirEffect</span><span class="Other">,</span>
<span class="Identifier">WriteEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/commands.nim#L631" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L631" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="setCmd-procs-all">
<div id="setCmd,ConfigRef,Command">
<dt><pre><span class="Keyword">proc</span> <a href="#setCmd%2CConfigRef%2CCommand"><span class="Identifier">setCmd</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">cmd</span><span class="Other">:</span> <a href="options.html#Command"><span class="Identifier">Command</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
sets cmd, backend so subsequent flags can query it (e.g. so --gc:arc can be ignored for backendJs)
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/commands.nim#L502" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L502" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="setCommandEarly-procs-all">
<div id="setCommandEarly,ConfigRef,string">
<dt><pre><span class="Keyword">proc</span> <a href="#setCommandEarly%2CConfigRef%2Cstring"><span class="Identifier">setCommandEarly</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">command</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/commands.nim#L514" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L514" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="testCompileOption-procs-all">
<div id="testCompileOption,ConfigRef,string,TLineInfo">
<dt><pre><span class="Keyword">proc</span> <a href="#testCompileOption%2CConfigRef%2Cstring%2CTLineInfo"><span class="Identifier">testCompileOption</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">switch</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">info</span><span class="Other">:</span> <a href="lineinfos.html#TLineInfo"><span class="Identifier">TLineInfo</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/commands.nim#L318" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L318" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="testCompileOptionArg-procs-all">
<div id="testCompileOptionArg,ConfigRef,string,string,TLineInfo">
<dt><pre><span class="Keyword">proc</span> <a href="#testCompileOptionArg%2CConfigRef%2Cstring%2Cstring%2CTLineInfo"><span class="Identifier">testCompileOptionArg</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">switch</span><span class="Other">,</span> <span class="Identifier">arg</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">info</span><span class="Other">:</span> <a href="lineinfos.html#TLineInfo"><span class="Identifier">TLineInfo</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span>
<span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span>
<span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/commands.nim#L260" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L260" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="unregisterArcOrc-procs-all">
<div id="unregisterArcOrc,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#unregisterArcOrc%2CConfigRef"><span class="Identifier">unregisterArcOrc</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/commands.nim#L562" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L562" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="writeCommandLineUsage-procs-all">
<div id="writeCommandLineUsage,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#writeCommandLineUsage%2CConfigRef"><span class="Identifier">writeCommandLineUsage</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/commands.nim#L110" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L110" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:12 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

21
compiler/commands.idx Normal file
View File

@@ -0,0 +1,21 @@
nimTitle commands commands.html module commands 0
nim passCmd1 commands.html#passCmd1 TCmdLinePass.passCmd1 44
nim passCmd2 commands.html#passCmd2 TCmdLinePass.passCmd2 44
nim passPP commands.html#passPP TCmdLinePass.passPP 44
nim TCmdLinePass commands.html#TCmdLinePass enum TCmdLinePass 44
nim writeCommandLineUsage commands.html#writeCommandLineUsage,ConfigRef proc writeCommandLineUsage(conf: ConfigRef) 110
nim processSpecificNote commands.html#processSpecificNote,string,TSpecialWord,TCmdLinePass,TLineInfo,string,ConfigRef proc processSpecificNote(arg: string; state: TSpecialWord; pass: TCmdLinePass;\n info: TLineInfo; orig: string; conf: ConfigRef) 185
nim testCompileOptionArg commands.html#testCompileOptionArg,ConfigRef,string,string,TLineInfo proc testCompileOptionArg(conf: ConfigRef; switch, arg: string; info: TLineInfo): bool 260
nim testCompileOption commands.html#testCompileOption,ConfigRef,string,TLineInfo proc testCompileOption(conf: ConfigRef; switch: string; info: TLineInfo): bool 318
nim handleStdinInput commands.html#handleStdinInput,ConfigRef proc handleStdinInput(conf: ConfigRef) 461
nim handleCmdInput commands.html#handleCmdInput,ConfigRef proc handleCmdInput(conf: ConfigRef) 466
nim parseCommand commands.html#parseCommand,string proc parseCommand(command: string): Command 470
nim setCmd commands.html#setCmd,ConfigRef,Command proc setCmd(conf: ConfigRef; cmd: Command) 502
nim setCommandEarly commands.html#setCommandEarly,ConfigRef,string proc setCommandEarly(conf: ConfigRef; command: string) 514
nim initOrcDefines commands.html#initOrcDefines,ConfigRef proc initOrcDefines(conf: ConfigRef) 541
nim unregisterArcOrc commands.html#unregisterArcOrc,ConfigRef proc unregisterArcOrc(conf: ConfigRef) 562
nim processSwitch commands.html#processSwitch,string,string,TCmdLinePass,TLineInfo,ConfigRef proc processSwitch(switch, arg: string; pass: TCmdLinePass; info: TLineInfo;\n conf: ConfigRef) 631
nim processCommand commands.html#processCommand,string,TCmdLinePass,ConfigRef proc processCommand(switch: string; pass: TCmdLinePass; config: ConfigRef) 1167
nim processSwitch commands.html#processSwitch,TCmdLinePass,OptParser,ConfigRef proc processSwitch(pass: TCmdLinePass; p: OptParser; config: ConfigRef) 1173
nim processArgument commands.html#processArgument,TCmdLinePass,OptParser,int,ConfigRef proc processArgument(pass: TCmdLinePass; p: OptParser; argsCount: var int;\n config: ConfigRef): bool 1184
nimgrp processswitch commands.html#processSwitch-procs-all proc 631

192
compiler/concepts.html Normal file
View File

@@ -0,0 +1,192 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>concepts</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">concepts</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li><a class="reference" id="code-dealing-with-concept-declarations_toc" href="#code-dealing-with-concept-declarations">Code dealing with Concept declarations</a></li>
<li><a class="reference" id="concept-matching_toc" href="#concept-matching">Concept matching</a></li>
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#MatchFlags" title="MatchFlags = enum
mfDontBind, mfCheckGeneric">MatchFlags</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">conceptBody
<li><a class="reference" href="#conceptBody%2CPType" title="conceptBody(n: PType): PNode">conceptBody(n: PType): PNode</a></li>
</ul>
<ul class="simple nested-toc-section">conceptMatch
<li><a class="reference" href="#conceptMatch%2CPContext%2CPType%2CPType%2CLayeredIdTableObj%2CPType%2Cset%5BMatchFlags%5D" title="conceptMatch(c: PContext; concpt, arg: PType; bindings: var LayeredIdTable;
invocation: PType; flags: set[MatchFlags] = {}): bool">conceptMatch(c: PContext; concpt, arg: PType; bindings: var LayeredIdTable;
invocation: PType; flags: set[MatchFlags] = {}): bool</a></li>
</ul>
<ul class="simple nested-toc-section">semConceptDeclaration
<li><a class="reference" href="#semConceptDeclaration%2CPContext%2CPNode" title="semConceptDeclaration(c: PContext; n: PNode): PNode">semConceptDeclaration(c: PContext; n: PNode): PNode</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/concepts.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/concepts.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">New styled concepts for Nim. See <a class="reference external" href="https://github.com/nim-lang/RFCs/issues/168">https://github.com/nim-lang/RFCs/issues/168</a> for details. Note this is a first implementation and only the &quot;Concept matching&quot; section has been implemented.
<h1><a class="toc-backref" id="code-dealing-with-concept-declarations" href="#code-dealing-with-concept-declarations">Code dealing with Concept declarations</a></h1>
<h1><a class="toc-backref" id="concept-matching" href="#concept-matching">Concept matching</a></h1></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="ast.html">ast</a>, <a class="reference external" href="astalgo.html">astalgo</a>, <a class="reference external" href="semdata.html">semdata</a>, <a class="reference external" href="lookups.html">lookups</a>, <a class="reference external" href="lineinfos.html">lineinfos</a>, <a class="reference external" href="idents.html">idents</a>, <a class="reference external" href="msgs.html">msgs</a>, <a class="reference external" href="renderer.html">renderer</a>, <a class="reference external" href="types.html">types</a>, <a class="reference external" href="layeredtable.html">layeredtable</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="MatchFlags">
<dt><pre><a href="concepts.html#MatchFlags"><span class="Identifier">MatchFlags</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">mfDontBind</span><span class="Other">,</span> <span class="Identifier">mfCheckGeneric</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/concepts.nim#L73" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/concepts.nim#L73" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="conceptBody-procs-all">
<div id="conceptBody,PType">
<dt><pre><span class="Keyword">proc</span> <a href="#conceptBody%2CPType"><span class="Identifier">conceptBody</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="ast.html#PType"><span class="Identifier">PType</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/concepts.nim#L153" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/concepts.nim#L153" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="conceptMatch-procs-all">
<div id="conceptMatch,PContext,PType,PType,LayeredIdTableObj,PType,set[MatchFlags]">
<dt><pre><span class="Keyword">proc</span> <a href="#conceptMatch%2CPContext%2CPType%2CPType%2CLayeredIdTableObj%2CPType%2Cset%5BMatchFlags%5D"><span class="Identifier">conceptMatch</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="semdata.html#PContext"><span class="Identifier">PContext</span></a><span class="Other">;</span> <span class="Identifier">concpt</span><span class="Other">,</span> <span class="Identifier">arg</span><span class="Other">:</span> <a href="ast.html#PType"><span class="Identifier">PType</span></a><span class="Other">;</span> <span class="Identifier">bindings</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="layeredtable.html#LayeredIdTable"><span class="Identifier">LayeredIdTable</span></a><span class="Other">;</span>
<span class="Identifier">invocation</span><span class="Other">:</span> <a href="ast.html#PType"><span class="Identifier">PType</span></a><span class="Other">;</span> <span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="concepts.html#MatchFlags"><span class="Identifier">MatchFlags</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Entry point from sigmatch. 'concpt' is the concept we try to match (here still a PType but we extract its AST via 'concpt.n.lastSon'). 'arg' is the type that might fulfill the concept's requirements. If so, we return true and fill the 'bindings' with pairs of (typeVar, instance) pairs. ('typeVar' is usually simply written as a generic 'T'.) 'invocation' can be nil for atomic concepts. For non-atomic concepts, it contains the <tt class="docutils literal"><span class="pre"><span class="Identifier">C</span><span class="Punctuation">[</span><span class="Identifier">S</span><span class="Punctuation">,</span> <span class="Identifier">T</span><span class="Punctuation">]</span></span></tt> parent type that we look for. We need this because we need to store bindings for 'S' and 'T' inside 'bindings' on a successful match. It is very important that we do not add any bindings at all on an unsuccessful match!
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/concepts.nim#L578" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/concepts.nim#L578" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="semConceptDeclaration-procs-all">
<div id="semConceptDeclaration,PContext,PNode">
<dt><pre><span class="Keyword">proc</span> <a href="#semConceptDeclaration%2CPContext%2CPNode"><span class="Identifier">semConceptDeclaration</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="semdata.html#PContext"><span class="Identifier">PContext</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Semantic checking for the concept declaration. Runs when we process the concept itself, not its matching process.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/concepts.nim#L58" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/concepts.nim#L58" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:13 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

9
compiler/concepts.idx Normal file
View File

@@ -0,0 +1,9 @@
nimTitle concepts concepts.html module concepts 0
nim semConceptDeclaration concepts.html#semConceptDeclaration,PContext,PNode proc semConceptDeclaration(c: PContext; n: PNode): PNode 58
nim mfDontBind concepts.html#mfDontBind MatchFlags.mfDontBind 73
nim mfCheckGeneric concepts.html#mfCheckGeneric MatchFlags.mfCheckGeneric 73
nim MatchFlags concepts.html#MatchFlags enum MatchFlags 73
nim conceptBody concepts.html#conceptBody,PType proc conceptBody(n: PType): PNode 153
nim conceptMatch concepts.html#conceptMatch,PContext,PType,PType,LayeredIdTableObj,PType,set[MatchFlags] proc conceptMatch(c: PContext; concpt, arg: PType; bindings: var LayeredIdTable;\n invocation: PType; flags: set[MatchFlags] = {}): bool 578
heading Code dealing with Concept declarations concepts.html#code-dealing-with-concept-declarations Code dealing with Concept declarations 0
heading Concept matching concepts.html#concept-matching Concept matching 0

205
compiler/condsyms.html Normal file
View File

@@ -0,0 +1,205 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>condsyms</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">condsyms</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">countDefinedSymbols
<li><a class="reference" href="#countDefinedSymbols%2CStringTableRef" title="countDefinedSymbols(symbols: StringTableRef): int">countDefinedSymbols(symbols: StringTableRef): int</a></li>
</ul>
<ul class="simple nested-toc-section">defineSymbol
<li><a class="reference" href="#defineSymbol%2CStringTableRef%2Cstring%2Cstring" title="defineSymbol(symbols: StringTableRef; symbol: string; value: string = &quot;true&quot;)">defineSymbol(symbols: StringTableRef; symbol: string; value: string = &quot;true&quot;)</a></li>
</ul>
<ul class="simple nested-toc-section">initDefines
<li><a class="reference" href="#initDefines%2CStringTableRef" title="initDefines(symbols: StringTableRef)">initDefines(symbols: StringTableRef)</a></li>
</ul>
<ul class="simple nested-toc-section">undefSymbol
<li><a class="reference" href="#undefSymbol%2CStringTableRef%2Cstring" title="undefSymbol(symbols: StringTableRef; symbol: string)">undefSymbol(symbols: StringTableRef; symbol: string)</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#15" id="65">Iterators</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">definedSymbolNames
<li><a class="reference" href="#definedSymbolNames.i%2CStringTableRef" title="definedSymbolNames(symbols: StringTableRef): string">definedSymbolNames(symbols: StringTableRef): string</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/condsyms.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/condsyms.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="options.html">options</a>, <a class="reference external" href="lineinfos.html">lineinfos</a>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="countDefinedSymbols-procs-all">
<div id="countDefinedSymbols,StringTableRef">
<dt><pre><span class="Keyword">proc</span> <a href="#countDefinedSymbols%2CStringTableRef"><span class="Identifier">countDefinedSymbols</span></a><span class="Other">(</span><span class="Identifier">symbols</span><span class="Other">:</span> <span class="Identifier">StringTableRef</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/condsyms.nim#L31" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/condsyms.nim#L31" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="defineSymbol-procs-all">
<div id="defineSymbol,StringTableRef,string,string">
<dt><pre><span class="Keyword">proc</span> <a href="#defineSymbol%2CStringTableRef%2Cstring%2Cstring"><span class="Identifier">defineSymbol</span></a><span class="Other">(</span><span class="Identifier">symbols</span><span class="Other">:</span> <span class="Identifier">StringTableRef</span><span class="Other">;</span> <span class="Identifier">symbol</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span>
<span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">string</span> <span class="Other">=</span> <span class="StringLit">&quot;true&quot;</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/condsyms.nim#L18" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/condsyms.nim#L18" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="initDefines-procs-all">
<div id="initDefines,StringTableRef">
<dt><pre><span class="Keyword">proc</span> <a href="#initDefines%2CStringTableRef"><span class="Identifier">initDefines</span></a><span class="Other">(</span><span class="Identifier">symbols</span><span class="Other">:</span> <span class="Identifier">StringTableRef</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/condsyms.nim#L34" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/condsyms.nim#L34" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="undefSymbol-procs-all">
<div id="undefSymbol,StringTableRef,string">
<dt><pre><span class="Keyword">proc</span> <a href="#undefSymbol%2CStringTableRef%2Cstring"><span class="Identifier">undefSymbol</span></a><span class="Other">(</span><span class="Identifier">symbols</span><span class="Other">:</span> <span class="Identifier">StringTableRef</span><span class="Other">;</span> <span class="Identifier">symbol</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/condsyms.nim#L21" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/condsyms.nim#L21" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="15">
<h1><a class="toc-backref" href="#15">Iterators</a></h1>
<dl class="item">
<div id="definedSymbolNames-iterators-all">
<div id="definedSymbolNames.i,StringTableRef">
<dt><pre><span class="Keyword">iterator</span> <a href="#definedSymbolNames.i%2CStringTableRef"><span class="Identifier">definedSymbolNames</span></a><span class="Other">(</span><span class="Identifier">symbols</span><span class="Other">:</span> <span class="Identifier">StringTableRef</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/condsyms.nim#L27" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/condsyms.nim#L27" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:12 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

6
compiler/condsyms.idx Normal file
View File

@@ -0,0 +1,6 @@
nimTitle condsyms condsyms.html module condsyms 0
nim defineSymbol condsyms.html#defineSymbol,StringTableRef,string,string proc defineSymbol(symbols: StringTableRef; symbol: string; value: string = "true") 18
nim undefSymbol condsyms.html#undefSymbol,StringTableRef,string proc undefSymbol(symbols: StringTableRef; symbol: string) 21
nim definedSymbolNames condsyms.html#definedSymbolNames.i,StringTableRef iterator definedSymbolNames(symbols: StringTableRef): string 27
nim countDefinedSymbols condsyms.html#countDefinedSymbols,StringTableRef proc countDefinedSymbols(symbols: StringTableRef): int 31
nim initDefines condsyms.html#initDefines,StringTableRef proc initDefines(symbols: StringTableRef) 34

156
compiler/depends.html Normal file
View File

@@ -0,0 +1,156 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>depends</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">depends</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">addDotDependency
<li><a class="reference" href="#addDotDependency%2CPPassContext%2CPNode" title="addDotDependency(c: PPassContext; n: PNode): PNode">addDotDependency(c: PPassContext; n: PNode): PNode</a></li>
</ul>
<ul class="simple nested-toc-section">generateDot
<li><a class="reference" href="#generateDot%2CModuleGraph%2CAbsoluteFile" title="generateDot(graph: ModuleGraph; project: AbsoluteFile)">generateDot(graph: ModuleGraph; project: AbsoluteFile)</a></li>
</ul>
<ul class="simple nested-toc-section">setupDependPass
<li><a class="reference" href="#setupDependPass%2CModuleGraph%2CPSym%2CIdGenerator" title="setupDependPass(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext">setupDependPass(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/depends.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/depends.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="options.html">options</a>, <a class="reference external" href="ast.html">ast</a>, <a class="reference external" href="ropes.html">ropes</a>, <a class="reference external" href="pathutils.html">pathutils</a>, <a class="reference external" href="msgs.html">msgs</a>, <a class="reference external" href="lineinfos.html">lineinfos</a>, <a class="reference external" href="modulegraphs.html">modulegraphs</a>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="addDotDependency-procs-all">
<div id="addDotDependency,PPassContext,PNode">
<dt><pre><span class="Keyword">proc</span> <a href="#addDotDependency%2CPPassContext%2CPNode"><span class="Identifier">addDotDependency</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="modulegraphs.html#PPassContext"><span class="Identifier">PPassContext</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/depends.nim#L86" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/depends.nim#L86" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="generateDot-procs-all">
<div id="generateDot,ModuleGraph,AbsoluteFile">
<dt><pre><span class="Keyword">proc</span> <a href="#generateDot%2CModuleGraph%2CAbsoluteFile"><span class="Identifier">generateDot</span></a><span class="Other">(</span><span class="Identifier">graph</span><span class="Other">:</span> <a href="modulegraphs.html#ModuleGraph"><span class="Identifier">ModuleGraph</span></a><span class="Other">;</span> <span class="Identifier">project</span><span class="Other">:</span> <a href="pathutils.html#AbsoluteFile"><span class="Identifier">AbsoluteFile</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/depends.nim#L101" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/depends.nim#L101" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="setupDependPass-procs-all">
<div id="setupDependPass,ModuleGraph,PSym,IdGenerator">
<dt><pre><span class="Keyword">proc</span> <a href="#setupDependPass%2CModuleGraph%2CPSym%2CIdGenerator"><span class="Identifier">setupDependPass</span></a><span class="Other">(</span><span class="Identifier">graph</span><span class="Other">:</span> <a href="modulegraphs.html#ModuleGraph"><span class="Identifier">ModuleGraph</span></a><span class="Other">;</span> <span class="Identifier">module</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span> <span class="Identifier">idgen</span><span class="Other">:</span> <a href="ast.html#IdGenerator"><span class="Identifier">IdGenerator</span></a><span class="Other">)</span><span class="Other">:</span> <a href="modulegraphs.html#PPassContext"><span class="Identifier">PPassContext</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/depends.nim#L107" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/depends.nim#L107" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:17 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

4
compiler/depends.idx Normal file
View File

@@ -0,0 +1,4 @@
nimTitle depends depends.html module depends 0
nim addDotDependency depends.html#addDotDependency,PPassContext,PNode proc addDotDependency(c: PPassContext; n: PNode): PNode 86
nim generateDot depends.html#generateDot,ModuleGraph,AbsoluteFile proc generateDot(graph: ModuleGraph; project: AbsoluteFile) 101
nim setupDependPass depends.html#setupDependPass,ModuleGraph,PSym,IdGenerator proc setupDependPass(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext 107

203
compiler/dfa.html Normal file
View File

@@ -0,0 +1,203 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>dfa</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">dfa</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#ControlFlowGraph" title="ControlFlowGraph = seq[Instr]">ControlFlowGraph</a></li>
<li><a class="reference" href="#Instr" title="Instr = object
case kind*: InstrKind
of goto, fork, loop:
dest*: int
of def, use:
n*: PNode">Instr</a></li>
<li><a class="reference" href="#InstrKind" title="InstrKind = enum
goto, loop, fork, def, use">InstrKind</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">constructCfg
<li><a class="reference" href="#constructCfg%2CPSym%2CPNode%2CPSym" title="constructCfg(s: PSym; body: PNode; root: PSym): ControlFlowGraph">constructCfg(s: PSym; body: PNode; root: PSym): ControlFlowGraph</a></li>
</ul>
<ul class="simple nested-toc-section">echoCfg
<li><a class="reference" href="#echoCfg%2CControlFlowGraph%2Cint%2Cint" title="echoCfg(c: ControlFlowGraph; start = 0; last = -1)">echoCfg(c: ControlFlowGraph; start = 0; last = -1)</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/dfa.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/dfa.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"><p>Data flow analysis for Nim. We transform the AST into a linear list of instructions first to make this easier to handle: There are only 3 different branching instructions: 'goto X' is an unconditional goto, 'fork X' is a conditional goto (either the next instruction or 'X' can be taken), 'loop X' is the only jump that jumps back.</p>
<p>Exhaustive case statements are translated so that the last branch is transformed into an 'else' branch. <tt class="docutils literal"><span class="pre">return</span></tt> and <tt class="docutils literal"><span class="pre">break</span></tt> are all covered by 'goto'.</p>
<p>The data structures and algorithms used here are inspired by &quot;A GraphFree Approach to DataFlow Analysis&quot; by Markus Mohnen. <a class="reference external" href="https://link.springer.com/content/pdf/10.1007/3-540-45937-5_6.pdf">https://link.springer.com/content/pdf/10.1007/3-540-45937-5_6.pdf</a></p>
</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="ast.html">ast</a>, <a class="reference external" href="lineinfos.html">lineinfos</a>, <a class="reference external" href="renderer.html">renderer</a>, <a class="reference external" href="aliasanalysis.html">aliasanalysis</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="ControlFlowGraph">
<dt><pre><a href="dfa.html#ControlFlowGraph"><span class="Identifier">ControlFlowGraph</span></a> <span class="Other">=</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="dfa.html#Instr"><span class="Identifier">Instr</span></a><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/dfa.nim#L41" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/dfa.nim#L41" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="Instr">
<dt><pre><a href="dfa.html#Instr"><span class="Identifier">Instr</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Keyword">case</span> <span class="Identifier">kind</span><span class="Operator">*</span><span class="Other">:</span> <a href="dfa.html#InstrKind"><span class="Identifier">InstrKind</span></a>
<span class="Keyword">of</span> <span class="Identifier">goto</span><span class="Other">,</span> <span class="Identifier">fork</span><span class="Other">,</span> <span class="Identifier">loop</span><span class="Other">:</span>
<span class="Identifier">dest</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span>
<span class="Keyword">of</span> <span class="Identifier">def</span><span class="Other">,</span> <span class="Identifier">use</span><span class="Other">:</span>
<span class="Identifier">n</span><span class="Operator">*</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/dfa.nim#L35" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/dfa.nim#L35" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="InstrKind">
<dt><pre><a href="dfa.html#InstrKind"><span class="Identifier">InstrKind</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">goto</span><span class="Other">,</span> <span class="Identifier">loop</span><span class="Other">,</span> <span class="Identifier">fork</span><span class="Other">,</span> <span class="Identifier">def</span><span class="Other">,</span> <span class="Identifier">use</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/dfa.nim#L33" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/dfa.nim#L33" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="constructCfg-procs-all">
<div id="constructCfg,PSym,PNode,PSym">
<dt><pre><span class="Keyword">proc</span> <a href="#constructCfg%2CPSym%2CPNode%2CPSym"><span class="Identifier">constructCfg</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span> <span class="Identifier">body</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">;</span> <span class="Identifier">root</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">)</span><span class="Other">:</span> <a href="dfa.html#ControlFlowGraph"><span class="Identifier">ControlFlowGraph</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
constructs a control flow graph for <tt class="docutils literal"><span class="pre">body</span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/dfa.nim#L479" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/dfa.nim#L479" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="echoCfg-procs-all">
<div id="echoCfg,ControlFlowGraph,int,int">
<dt><pre><span class="Keyword">proc</span> <a href="#echoCfg%2CControlFlowGraph%2Cint%2Cint"><span class="Identifier">echoCfg</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="dfa.html#ControlFlowGraph"><span class="Identifier">ControlFlowGraph</span></a><span class="Other">;</span> <span class="Identifier">start</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">;</span> <span class="Identifier">last</span> <span class="Other">=</span> <span class="DecNumber">-1</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<div class="deprecation-message">
<b>Deprecated</b>
</div>
echos the ControlFlowGraph for debugging purposes.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/dfa.nim#L88" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/dfa.nim#L88" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:14 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

11
compiler/dfa.idx Normal file
View File

@@ -0,0 +1,11 @@
nimTitle dfa dfa.html module dfa 0
nim goto dfa.html#goto InstrKind.goto 33
nim loop dfa.html#loop InstrKind.loop 33
nim fork dfa.html#fork InstrKind.fork 33
nim def dfa.html#def InstrKind.def 33
nim use dfa.html#use InstrKind.use 33
nim InstrKind dfa.html#InstrKind enum InstrKind 33
nim Instr dfa.html#Instr object Instr 35
nim ControlFlowGraph dfa.html#ControlFlowGraph type ControlFlowGraph 41
nim echoCfg dfa.html#echoCfg,ControlFlowGraph,int,int proc echoCfg(c: ControlFlowGraph; start = 0; last = -1) 88
nim constructCfg dfa.html#constructCfg,PSym,PNode,PSym proc constructCfg(s: PSym; body: PNode; root: PSym): ControlFlowGraph 479

495
compiler/docgen.html Normal file
View File

@@ -0,0 +1,495 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>docgen</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">docgen</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#PDoc" title="PDoc = ref TDocumentor">PDoc</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">commandBuildIndex
<li><a class="reference" href="#commandBuildIndex%2CConfigRef%2Cstring" title="commandBuildIndex(conf: ConfigRef; dir: string; outFile = RelativeFile&quot;&quot;)">commandBuildIndex(conf: ConfigRef; dir: string; outFile = RelativeFile&quot;&quot;)</a></li>
</ul>
<ul class="simple nested-toc-section">commandBuildIndexJson
<li><a class="reference" href="#commandBuildIndexJson%2CConfigRef%2Cstring" title="commandBuildIndexJson(conf: ConfigRef; dir: string; outFile = RelativeFile&quot;&quot;)">commandBuildIndexJson(conf: ConfigRef; dir: string; outFile = RelativeFile&quot;&quot;)</a></li>
</ul>
<ul class="simple nested-toc-section">commandDoc
<li><a class="reference" href="#commandDoc%2CIdentCache%2CConfigRef" title="commandDoc(cache: IdentCache; conf: ConfigRef)">commandDoc(cache: IdentCache; conf: ConfigRef)</a></li>
</ul>
<ul class="simple nested-toc-section">commandJson
<li><a class="reference" href="#commandJson%2CIdentCache%2CConfigRef" title="commandJson(cache: IdentCache; conf: ConfigRef)">commandJson(cache: IdentCache; conf: ConfigRef)</a></li>
</ul>
<ul class="simple nested-toc-section">commandRst2Html
<li><a class="reference" href="#commandRst2Html%2CIdentCache%2CConfigRef" title="commandRst2Html(cache: IdentCache; conf: ConfigRef; preferMarkdown = false)">commandRst2Html(cache: IdentCache; conf: ConfigRef; preferMarkdown = false)</a></li>
</ul>
<ul class="simple nested-toc-section">commandRst2TeX
<li><a class="reference" href="#commandRst2TeX%2CIdentCache%2CConfigRef" title="commandRst2TeX(cache: IdentCache; conf: ConfigRef; preferMarkdown = false)">commandRst2TeX(cache: IdentCache; conf: ConfigRef; preferMarkdown = false)</a></li>
</ul>
<ul class="simple nested-toc-section">commandTags
<li><a class="reference" href="#commandTags%2CIdentCache%2CConfigRef" title="commandTags(cache: IdentCache; conf: ConfigRef)">commandTags(cache: IdentCache; conf: ConfigRef)</a></li>
</ul>
<ul class="simple nested-toc-section">documentRaises
<li><a class="reference" href="#documentRaises%2CIdentCache%2CPNode" title="documentRaises(cache: IdentCache; n: PNode)">documentRaises(cache: IdentCache; n: PNode)</a></li>
</ul>
<ul class="simple nested-toc-section">finishGenerateDoc
<li><a class="reference" href="#finishGenerateDoc%2CPDoc" title="finishGenerateDoc(d: var PDoc)">finishGenerateDoc(d: var PDoc)</a></li>
</ul>
<ul class="simple nested-toc-section">generateDoc
<li><a class="reference" href="#generateDoc%2CPDoc%2CPNode%2CPNode%2CConfigRef%2CDocFlags" title="generateDoc(d: PDoc; n, orig: PNode; config: ConfigRef;
docFlags: DocFlags = kDefault)">generateDoc(d: PDoc; n, orig: PNode; config: ConfigRef;
docFlags: DocFlags = kDefault)</a></li>
</ul>
<ul class="simple nested-toc-section">generateIndex
<li><a class="reference" href="#generateIndex%2CPDoc" title="generateIndex(d: PDoc)">generateIndex(d: PDoc)</a></li>
</ul>
<ul class="simple nested-toc-section">generateJson
<li><a class="reference" href="#generateJson%2CPDoc%2CPNode%2CConfigRef%2Cbool" title="generateJson(d: PDoc; n: PNode; config: ConfigRef; includeComments: bool = true)">generateJson(d: PDoc; n: PNode; config: ConfigRef; includeComments: bool = true)</a></li>
</ul>
<ul class="simple nested-toc-section">generateTags
<li><a class="reference" href="#generateTags%2CPDoc%2CPNode%2Cstring" title="generateTags(d: PDoc; n: PNode; r: var string)">generateTags(d: PDoc; n: PNode; r: var string)</a></li>
</ul>
<ul class="simple nested-toc-section">handleDocOutputOptions
<li><a class="reference" href="#handleDocOutputOptions%2CConfigRef" title="handleDocOutputOptions(conf: ConfigRef)">handleDocOutputOptions(conf: ConfigRef)</a></li>
</ul>
<ul class="simple nested-toc-section">newDocumentor
<li><a class="reference" href="#newDocumentor%2CAbsoluteFile%2CIdentCache%2CConfigRef%2Cstring%2CPSym" title="newDocumentor(filename: AbsoluteFile; cache: IdentCache; conf: ConfigRef;
outExt: string = HtmlExt; module: PSym = nil;
standaloneDoc = false; preferMarkdown = true; hasToc = true): PDoc">newDocumentor(filename: AbsoluteFile; cache: IdentCache; conf: ConfigRef;
outExt: string = HtmlExt; module: PSym = nil;
standaloneDoc = false; preferMarkdown = true; hasToc = true): PDoc</a></li>
</ul>
<ul class="simple nested-toc-section">presentationPath
<li><a class="reference" href="#presentationPath%2CConfigRef%2CAbsoluteFile" title="presentationPath(conf: ConfigRef; file: AbsoluteFile): RelativeFile">presentationPath(conf: ConfigRef; file: AbsoluteFile): RelativeFile</a></li>
</ul>
<ul class="simple nested-toc-section">writeOutput
<li><a class="reference" href="#writeOutput%2CPDoc" title="writeOutput(d: PDoc; useWarning = false; groupedToc = false)">writeOutput(d: PDoc; useWarning = false; groupedToc = false)</a></li>
</ul>
<ul class="simple nested-toc-section">writeOutputJson
<li><a class="reference" href="#writeOutputJson%2CPDoc" title="writeOutputJson(d: PDoc; useWarning = false)">writeOutputJson(d: PDoc; useWarning = false)</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">This is the Nim documentation generator. Cross-references are generated by knowing how the anchors are going to be named.<p>For corresponding users' documentation see <a class="reference external" href="../docgen.html">Nim DocGen Tools Guide</a>.</p>
</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="ast.html">ast</a>, <a class="reference external" href="options.html">options</a>, <a class="reference external" href="msgs.html">msgs</a>, <a class="reference external" href="idents.html">idents</a>, <a class="reference external" href="wordrecg.html">wordrecg</a>, <a class="reference external" href="syntaxes.html">syntaxes</a>, <a class="reference external" href="renderer.html">renderer</a>, <a class="reference external" href="lexer.html">lexer</a>, <a class="reference external" href="trees.html">trees</a>, <a class="reference external" href="types.html">types</a>, <a class="reference external" href="typesrenderer.html">typesrenderer</a>, <a class="reference external" href="astalgo.html">astalgo</a>, <a class="reference external" href="lineinfos.html">lineinfos</a>, <a class="reference external" href="pathutils.html">pathutils</a>, <a class="reference external" href="nimpaths.html">nimpaths</a>, <a class="reference external" href="renderverbatim.html">renderverbatim</a>, <a class="reference external" href="packages.html">packages</a>, <a class="reference external" href="nodejs.html">nodejs</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="PDoc">
<dt><pre><a href="docgen.html#PDoc"><span class="Identifier">PDoc</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Identifier">TDocumentor</span></pre></dt>
<dd>
Alias to type less.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen.nim#L111" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen.nim#L111" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="commandBuildIndex-procs-all">
<div id="commandBuildIndex,ConfigRef,string">
<dt><pre><span class="Keyword">proc</span> <a href="#commandBuildIndex%2CConfigRef%2Cstring"><span class="Identifier">commandBuildIndex</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">dir</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">outFile</span> <span class="Other">=</span> <a href="pathutils.html#RelativeFile"><span class="Identifier">RelativeFile</span></a><span class="StringLit">&quot;&quot;</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span>
<span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">,</span>
<span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">TimeEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen.nim#L1927" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen.nim#L1927" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="commandBuildIndexJson-procs-all">
<div id="commandBuildIndexJson,ConfigRef,string">
<dt><pre><span class="Keyword">proc</span> <a href="#commandBuildIndexJson%2CConfigRef%2Cstring"><span class="Identifier">commandBuildIndexJson</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">dir</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span>
<span class="Identifier">outFile</span> <span class="Other">=</span> <a href="pathutils.html#RelativeFile"><span class="Identifier">RelativeFile</span></a><span class="StringLit">&quot;&quot;</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">,</span>
<span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span>
<span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen.nim#L1950" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen.nim#L1950" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="commandDoc-procs-all">
<div id="commandDoc,IdentCache,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#commandDoc%2CIdentCache%2CConfigRef"><span class="Identifier">commandDoc</span></a><span class="Other">(</span><span class="Identifier">cache</span><span class="Other">:</span> <a href="idents.html#IdentCache"><span class="Identifier">IdentCache</span></a><span class="Other">;</span> <span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">,</span>
<span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span>
<span class="Identifier">WriteDirEffect</span><span class="Other">,</span> <span class="Identifier">ExecIOEffect</span><span class="Other">,</span> <span class="Identifier">TimeEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
implementation of deprecated <tt class="docutils literal"><span class="pre">doc0</span></tt> command (without semantic checking)
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen.nim#L1840" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen.nim#L1840" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="commandJson-procs-all">
<div id="commandJson,IdentCache,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#commandJson%2CIdentCache%2CConfigRef"><span class="Identifier">commandJson</span></a><span class="Other">(</span><span class="Identifier">cache</span><span class="Other">:</span> <a href="idents.html#IdentCache"><span class="Identifier">IdentCache</span></a><span class="Other">;</span> <span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span>
<span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span>
<span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span>
<span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">WriteDirEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
implementation of a deprecated jsondoc0 command
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen.nim#L1876" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen.nim#L1876" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="commandRst2Html-procs-all">
<div id="commandRst2Html,IdentCache,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#commandRst2Html%2CIdentCache%2CConfigRef"><span class="Identifier">commandRst2Html</span></a><span class="Other">(</span><span class="Identifier">cache</span><span class="Other">:</span> <a href="idents.html#IdentCache"><span class="Identifier">IdentCache</span></a><span class="Other">;</span> <span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">preferMarkdown</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">WriteDirEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span>
<span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">ExecIOEffect</span><span class="Other">,</span> <span class="Identifier">TimeEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen.nim#L1868" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen.nim#L1868" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="commandRst2TeX-procs-all">
<div id="commandRst2TeX,IdentCache,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#commandRst2TeX%2CIdentCache%2CConfigRef"><span class="Identifier">commandRst2TeX</span></a><span class="Other">(</span><span class="Identifier">cache</span><span class="Other">:</span> <a href="idents.html#IdentCache"><span class="Identifier">IdentCache</span></a><span class="Other">;</span> <span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">preferMarkdown</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">WriteDirEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span>
<span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">ExecIOEffect</span><span class="Other">,</span> <span class="Identifier">TimeEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen.nim#L1872" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen.nim#L1872" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="commandTags-procs-all">
<div id="commandTags,IdentCache,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#commandTags%2CIdentCache%2CConfigRef"><span class="Identifier">commandTags</span></a><span class="Other">(</span><span class="Identifier">cache</span><span class="Other">:</span> <a href="idents.html#IdentCache"><span class="Identifier">IdentCache</span></a><span class="Other">;</span> <span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span>
<span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span>
<span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span>
<span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">WriteDirEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen.nim#L1903" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen.nim#L1903" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="documentRaises-procs-all">
<div id="documentRaises,IdentCache,PNode">
<dt><pre><span class="Keyword">proc</span> <a href="#documentRaises%2CIdentCache%2CPNode"><span class="Identifier">documentRaises</span></a><span class="Other">(</span><span class="Identifier">cache</span><span class="Other">:</span> <a href="idents.html#IdentCache"><span class="Identifier">IdentCache</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen.nim#L1345" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen.nim#L1345" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="finishGenerateDoc-procs-all">
<div id="finishGenerateDoc,PDoc">
<dt><pre><span class="Keyword">proc</span> <a href="#finishGenerateDoc%2CPDoc"><span class="Identifier">finishGenerateDoc</span></a><span class="Other">(</span><span class="Identifier">d</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="docgen.html#PDoc"><span class="Identifier">PDoc</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Perform 2nd RST pass for resolution of links/footnotes/headings...
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen.nim#L1453" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen.nim#L1453" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="generateDoc-procs-all">
<div id="generateDoc,PDoc,PNode,PNode,ConfigRef,DocFlags">
<dt><pre><span class="Keyword">proc</span> <a href="#generateDoc%2CPDoc%2CPNode%2CPNode%2CConfigRef%2CDocFlags"><span class="Identifier">generateDoc</span></a><span class="Other">(</span><span class="Identifier">d</span><span class="Other">:</span> <a href="docgen.html#PDoc"><span class="Identifier">PDoc</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">,</span> <span class="Identifier">orig</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">;</span> <span class="Identifier">config</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span>
<span class="Identifier">docFlags</span><span class="Other">:</span> <span class="Identifier">DocFlags</span> <span class="Other">=</span> <span class="Identifier">kDefault</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span>
<span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span>
<span class="Identifier">WriteDirEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Goes through nim nodes recursively and collects doc comments. Main function for <tt class="docutils literal"><span class="pre option">doc</span></tt> command, which is implemented in <tt class="docutils literal"><span class="pre">docgen2.nim</span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen.nim#L1365" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen.nim#L1365" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="generateIndex-procs-all">
<div id="generateIndex,PDoc">
<dt><pre><span class="Keyword">proc</span> <a href="#generateIndex%2CPDoc"><span class="Identifier">generateIndex</span></a><span class="Other">(</span><span class="Identifier">d</span><span class="Other">:</span> <a href="docgen.html#PDoc"><span class="Identifier">PDoc</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span>
<span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span>
<span class="Identifier">WriteDirEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen.nim#L1766" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen.nim#L1766" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="generateJson-procs-all">
<div id="generateJson,PDoc,PNode,ConfigRef,bool">
<dt><pre><span class="Keyword">proc</span> <a href="#generateJson%2CPDoc%2CPNode%2CConfigRef%2Cbool"><span class="Identifier">generateJson</span></a><span class="Other">(</span><span class="Identifier">d</span><span class="Other">:</span> <a href="docgen.html#PDoc"><span class="Identifier">PDoc</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">;</span> <span class="Identifier">config</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span>
<span class="Identifier">includeComments</span><span class="Other">:</span> <span class="Identifier">bool</span> <span class="Other">=</span> <span class="Identifier">true</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span>
<span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span>
<span class="Identifier">WriteDirEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen.nim#L1569" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen.nim#L1569" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="generateTags-procs-all">
<div id="generateTags,PDoc,PNode,string">
<dt><pre><span class="Keyword">proc</span> <a href="#generateTags%2CPDoc%2CPNode%2Cstring"><span class="Identifier">generateTags</span></a><span class="Other">(</span><span class="Identifier">d</span><span class="Other">:</span> <a href="docgen.html#PDoc"><span class="Identifier">PDoc</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">;</span> <span class="Identifier">r</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">string</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen.nim#L1614" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen.nim#L1614" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="handleDocOutputOptions-procs-all">
<div id="handleDocOutputOptions,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#handleDocOutputOptions%2CConfigRef"><span class="Identifier">handleDocOutputOptions</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen.nim#L1833" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen.nim#L1833" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newDocumentor-procs-all">
<div id="newDocumentor,AbsoluteFile,IdentCache,ConfigRef,string,PSym">
<dt><pre><span class="Keyword">proc</span> <a href="#newDocumentor%2CAbsoluteFile%2CIdentCache%2CConfigRef%2Cstring%2CPSym"><span class="Identifier">newDocumentor</span></a><span class="Other">(</span><span class="Identifier">filename</span><span class="Other">:</span> <a href="pathutils.html#AbsoluteFile"><span class="Identifier">AbsoluteFile</span></a><span class="Other">;</span> <span class="Identifier">cache</span><span class="Other">:</span> <a href="idents.html#IdentCache"><span class="Identifier">IdentCache</span></a><span class="Other">;</span> <span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span>
<span class="Identifier">outExt</span><span class="Other">:</span> <span class="Identifier">string</span> <span class="Other">=</span> <span class="Identifier">HtmlExt</span><span class="Other">;</span> <span class="Identifier">module</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
<span class="Identifier">standaloneDoc</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">;</span> <span class="Identifier">preferMarkdown</span> <span class="Other">=</span> <span class="Identifier">true</span><span class="Other">;</span> <span class="Identifier">hasToc</span> <span class="Other">=</span> <span class="Identifier">true</span><span class="Other">)</span><span class="Other">:</span> <a href="docgen.html#PDoc"><span class="Identifier">PDoc</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">WriteDirEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span>
<span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen.nim#L324" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen.nim#L324" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="presentationPath-procs-all">
<div id="presentationPath,ConfigRef,AbsoluteFile">
<dt><pre><span class="Keyword">proc</span> <a href="#presentationPath%2CConfigRef%2CAbsoluteFile"><span class="Identifier">presentationPath</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">file</span><span class="Other">:</span> <a href="pathutils.html#AbsoluteFile"><span class="Identifier">AbsoluteFile</span></a><span class="Other">)</span><span class="Other">:</span> <a href="pathutils.html#RelativeFile"><span class="Identifier">RelativeFile</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
returns a relative file that will be appended to outDir
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen.nim#L178" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen.nim#L178" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="writeOutput-procs-all">
<div id="writeOutput,PDoc">
<dt><pre><span class="Keyword">proc</span> <a href="#writeOutput%2CPDoc"><span class="Identifier">writeOutput</span></a><span class="Other">(</span><span class="Identifier">d</span><span class="Other">:</span> <a href="docgen.html#PDoc"><span class="Identifier">PDoc</span></a><span class="Other">;</span> <span class="Identifier">useWarning</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">;</span> <span class="Identifier">groupedToc</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span>
<span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span>
<span class="Identifier">WriteDirEffect</span><span class="Other">,</span> <span class="Identifier">ExecIOEffect</span><span class="Other">,</span> <span class="Identifier">TimeEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen.nim#L1778" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen.nim#L1778" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="writeOutputJson-procs-all">
<div id="writeOutputJson,PDoc">
<dt><pre><span class="Keyword">proc</span> <a href="#writeOutputJson%2CPDoc"><span class="Identifier">writeOutputJson</span></a><span class="Other">(</span><span class="Identifier">d</span><span class="Other">:</span> <a href="docgen.html#PDoc"><span class="Identifier">PDoc</span></a><span class="Other">;</span> <span class="Identifier">useWarning</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">,</span>
<span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">ExecIOEffect</span><span class="Other">,</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteDirEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen.nim#L1809" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen.nim#L1809" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:17 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

20
compiler/docgen.idx Normal file
View File

@@ -0,0 +1,20 @@
nimTitle docgen docgen.html module docgen 0
nim PDoc docgen.html#PDoc type PDoc 111
nim presentationPath docgen.html#presentationPath,ConfigRef,AbsoluteFile proc presentationPath(conf: ConfigRef; file: AbsoluteFile): RelativeFile 178
nim newDocumentor docgen.html#newDocumentor,AbsoluteFile,IdentCache,ConfigRef,string,PSym proc newDocumentor(filename: AbsoluteFile; cache: IdentCache; conf: ConfigRef;\n outExt: string = HtmlExt; module: PSym = nil;\n standaloneDoc = false; preferMarkdown = true; hasToc = true): PDoc 324
nim documentRaises docgen.html#documentRaises,IdentCache,PNode proc documentRaises(cache: IdentCache; n: PNode) 1345
nim generateDoc docgen.html#generateDoc,PDoc,PNode,PNode,ConfigRef,DocFlags proc generateDoc(d: PDoc; n, orig: PNode; config: ConfigRef;\n docFlags: DocFlags = kDefault) 1365
nim finishGenerateDoc docgen.html#finishGenerateDoc,PDoc proc finishGenerateDoc(d: var PDoc) 1453
nim generateJson docgen.html#generateJson,PDoc,PNode,ConfigRef,bool proc generateJson(d: PDoc; n: PNode; config: ConfigRef; includeComments: bool = true) 1569
nim generateTags docgen.html#generateTags,PDoc,PNode,string proc generateTags(d: PDoc; n: PNode; r: var string) 1614
nim generateIndex docgen.html#generateIndex,PDoc proc generateIndex(d: PDoc) 1766
nim writeOutput docgen.html#writeOutput,PDoc proc writeOutput(d: PDoc; useWarning = false; groupedToc = false) 1778
nim writeOutputJson docgen.html#writeOutputJson,PDoc proc writeOutputJson(d: PDoc; useWarning = false) 1809
nim handleDocOutputOptions docgen.html#handleDocOutputOptions,ConfigRef proc handleDocOutputOptions(conf: ConfigRef) 1833
nim commandDoc docgen.html#commandDoc,IdentCache,ConfigRef proc commandDoc(cache: IdentCache; conf: ConfigRef) 1840
nim commandRst2Html docgen.html#commandRst2Html,IdentCache,ConfigRef proc commandRst2Html(cache: IdentCache; conf: ConfigRef; preferMarkdown = false) 1868
nim commandRst2TeX docgen.html#commandRst2TeX,IdentCache,ConfigRef proc commandRst2TeX(cache: IdentCache; conf: ConfigRef; preferMarkdown = false) 1872
nim commandJson docgen.html#commandJson,IdentCache,ConfigRef proc commandJson(cache: IdentCache; conf: ConfigRef) 1876
nim commandTags docgen.html#commandTags,IdentCache,ConfigRef proc commandTags(cache: IdentCache; conf: ConfigRef) 1903
nim commandBuildIndex docgen.html#commandBuildIndex,ConfigRef,string proc commandBuildIndex(conf: ConfigRef; dir: string; outFile = RelativeFile"") 1927
nim commandBuildIndexJson docgen.html#commandBuildIndexJson,ConfigRef,string proc commandBuildIndexJson(conf: ConfigRef; dir: string; outFile = RelativeFile"") 1950

244
compiler/docgen2.html Normal file
View File

@@ -0,0 +1,244 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>docgen2</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">docgen2</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">closeDoc
<li><a class="reference" href="#closeDoc%2CModuleGraph%2CPPassContext%2CPNode" title="closeDoc(graph: ModuleGraph; p: PPassContext; n: PNode): PNode">closeDoc(graph: ModuleGraph; p: PPassContext; n: PNode): PNode</a></li>
</ul>
<ul class="simple nested-toc-section">closeJson
<li><a class="reference" href="#closeJson%2CModuleGraph%2CPPassContext%2CPNode" title="closeJson(graph: ModuleGraph; p: PPassContext; n: PNode): PNode">closeJson(graph: ModuleGraph; p: PPassContext; n: PNode): PNode</a></li>
</ul>
<ul class="simple nested-toc-section">openHtml
<li><a class="reference" href="#openHtml%2CModuleGraph%2CPSym%2CIdGenerator" title="openHtml(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext">openHtml(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext</a></li>
</ul>
<ul class="simple nested-toc-section">openJson
<li><a class="reference" href="#openJson%2CModuleGraph%2CPSym%2CIdGenerator" title="openJson(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext">openJson(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext</a></li>
</ul>
<ul class="simple nested-toc-section">openTex
<li><a class="reference" href="#openTex%2CModuleGraph%2CPSym%2CIdGenerator" title="openTex(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext">openTex(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext</a></li>
</ul>
<ul class="simple nested-toc-section">processNode
<li><a class="reference" href="#processNode%2CPPassContext%2CPNode" title="processNode(c: PPassContext; n: PNode): PNode">processNode(c: PPassContext; n: PNode): PNode</a></li>
</ul>
<ul class="simple nested-toc-section">processNodeJson
<li><a class="reference" href="#processNodeJson%2CPPassContext%2CPNode" title="processNodeJson(c: PPassContext; n: PNode): PNode">processNodeJson(c: PPassContext; n: PNode): PNode</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen2.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen2.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="options.html">options</a>, <a class="reference external" href="ast.html">ast</a>, <a class="reference external" href="msgs.html">msgs</a>, <a class="reference external" href="docgen.html">docgen</a>, <a class="reference external" href="lineinfos.html">lineinfos</a>, <a class="reference external" href="pathutils.html">pathutils</a>, <a class="reference external" href="packages.html">packages</a>, <a class="reference external" href="modulegraphs.html">modulegraphs</a>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="closeDoc-procs-all">
<div id="closeDoc,ModuleGraph,PPassContext,PNode">
<dt><pre><span class="Keyword">proc</span> <a href="#closeDoc%2CModuleGraph%2CPPassContext%2CPNode"><span class="Identifier">closeDoc</span></a><span class="Other">(</span><span class="Identifier">graph</span><span class="Other">:</span> <a href="modulegraphs.html#ModuleGraph"><span class="Identifier">ModuleGraph</span></a><span class="Other">;</span> <span class="Identifier">p</span><span class="Other">:</span> <a href="modulegraphs.html#PPassContext"><span class="Identifier">PPassContext</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span>
<span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span>
<span class="Identifier">WriteDirEffect</span><span class="Other">,</span> <span class="Identifier">ExecIOEffect</span><span class="Other">,</span> <span class="Identifier">TimeEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen2.nim#L41" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen2.nim#L41" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="closeJson-procs-all">
<div id="closeJson,ModuleGraph,PPassContext,PNode">
<dt><pre><span class="Keyword">proc</span> <a href="#closeJson%2CModuleGraph%2CPPassContext%2CPNode"><span class="Identifier">closeJson</span></a><span class="Other">(</span><span class="Identifier">graph</span><span class="Other">:</span> <a href="modulegraphs.html#ModuleGraph"><span class="Identifier">ModuleGraph</span></a><span class="Other">;</span> <span class="Identifier">p</span><span class="Other">:</span> <a href="modulegraphs.html#PPassContext"><span class="Identifier">PPassContext</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span>
<span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span>
<span class="Identifier">ExecIOEffect</span><span class="Other">,</span> <span class="Identifier">WriteDirEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen2.nim#L46" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen2.nim#L46" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="openHtml-procs-all">
<div id="openHtml,ModuleGraph,PSym,IdGenerator">
<dt><pre><span class="Keyword">proc</span> <a href="#openHtml%2CModuleGraph%2CPSym%2CIdGenerator"><span class="Identifier">openHtml</span></a><span class="Other">(</span><span class="Identifier">graph</span><span class="Other">:</span> <a href="modulegraphs.html#ModuleGraph"><span class="Identifier">ModuleGraph</span></a><span class="Other">;</span> <span class="Identifier">module</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span> <span class="Identifier">idgen</span><span class="Other">:</span> <a href="ast.html#IdGenerator"><span class="Identifier">IdGenerator</span></a><span class="Other">)</span><span class="Other">:</span> <a href="modulegraphs.html#PPassContext"><span class="Identifier">PPassContext</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">WriteDirEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span>
<span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen2.nim#L73" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen2.nim#L73" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="openJson-procs-all">
<div id="openJson,ModuleGraph,PSym,IdGenerator">
<dt><pre><span class="Keyword">proc</span> <a href="#openJson%2CModuleGraph%2CPSym%2CIdGenerator"><span class="Identifier">openJson</span></a><span class="Other">(</span><span class="Identifier">graph</span><span class="Other">:</span> <a href="modulegraphs.html#ModuleGraph"><span class="Identifier">ModuleGraph</span></a><span class="Other">;</span> <span class="Identifier">module</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span> <span class="Identifier">idgen</span><span class="Other">:</span> <a href="ast.html#IdGenerator"><span class="Identifier">IdGenerator</span></a><span class="Other">)</span><span class="Other">:</span> <a href="modulegraphs.html#PPassContext"><span class="Identifier">PPassContext</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">WriteDirEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span>
<span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen2.nim#L79" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen2.nim#L79" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="openTex-procs-all">
<div id="openTex,ModuleGraph,PSym,IdGenerator">
<dt><pre><span class="Keyword">proc</span> <a href="#openTex%2CModuleGraph%2CPSym%2CIdGenerator"><span class="Identifier">openTex</span></a><span class="Other">(</span><span class="Identifier">graph</span><span class="Other">:</span> <a href="modulegraphs.html#ModuleGraph"><span class="Identifier">ModuleGraph</span></a><span class="Other">;</span> <span class="Identifier">module</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span> <span class="Identifier">idgen</span><span class="Other">:</span> <a href="ast.html#IdGenerator"><span class="Identifier">IdGenerator</span></a><span class="Other">)</span><span class="Other">:</span> <a href="modulegraphs.html#PPassContext"><span class="Identifier">PPassContext</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">WriteDirEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span>
<span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen2.nim#L76" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen2.nim#L76" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="processNode-procs-all">
<div id="processNode,PPassContext,PNode">
<dt><pre><span class="Keyword">proc</span> <a href="#processNode%2CPPassContext%2CPNode"><span class="Identifier">processNode</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="modulegraphs.html#PPassContext"><span class="Identifier">PPassContext</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span>
<span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span>
<span class="Identifier">WriteDirEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen2.nim#L51" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen2.nim#L51" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="processNodeJson-procs-all">
<div id="processNodeJson,PPassContext,PNode">
<dt><pre><span class="Keyword">proc</span> <a href="#processNodeJson%2CPPassContext%2CPNode"><span class="Identifier">processNodeJson</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="modulegraphs.html#PPassContext"><span class="Identifier">PPassContext</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ast.html#PNode"><span class="Identifier">PNode</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span>
<span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span>
<span class="Identifier">WriteDirEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/docgen2.nim#L57" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/docgen2.nim#L57" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:17 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

8
compiler/docgen2.idx Normal file
View File

@@ -0,0 +1,8 @@
nimTitle docgen2 docgen2.html module docgen2 0
nim closeDoc docgen2.html#closeDoc,ModuleGraph,PPassContext,PNode proc closeDoc(graph: ModuleGraph; p: PPassContext; n: PNode): PNode 41
nim closeJson docgen2.html#closeJson,ModuleGraph,PPassContext,PNode proc closeJson(graph: ModuleGraph; p: PPassContext; n: PNode): PNode 46
nim processNode docgen2.html#processNode,PPassContext,PNode proc processNode(c: PPassContext; n: PNode): PNode 51
nim processNodeJson docgen2.html#processNodeJson,PPassContext,PNode proc processNodeJson(c: PPassContext; n: PNode): PNode 57
nim openHtml docgen2.html#openHtml,ModuleGraph,PSym,IdGenerator proc openHtml(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext 73
nim openTex docgen2.html#openTex,ModuleGraph,PSym,IdGenerator proc openTex(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext 76
nim openJson docgen2.html#openJson,ModuleGraph,PSym,IdGenerator proc openJson(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext 79

1718
compiler/dochack.js Normal file

File diff suppressed because it is too large Load Diff

146
compiler/enumtostr.html Normal file
View File

@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>enumtostr</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">enumtostr</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">genCaseObjDiscMapping
<li><a class="reference" href="#genCaseObjDiscMapping%2CPType%2CPSym%2CTLineInfo%2CModuleGraph%2CIdGenerator" title="genCaseObjDiscMapping(t: PType; field: PSym; info: TLineInfo; g: ModuleGraph;
idgen: IdGenerator): PSym">genCaseObjDiscMapping(t: PType; field: PSym; info: TLineInfo; g: ModuleGraph;
idgen: IdGenerator): PSym</a></li>
</ul>
<ul class="simple nested-toc-section">genEnumToStrProc
<li><a class="reference" href="#genEnumToStrProc%2CPType%2CTLineInfo%2CModuleGraph%2CIdGenerator" title="genEnumToStrProc(t: PType; info: TLineInfo; g: ModuleGraph; idgen: IdGenerator): PSym">genEnumToStrProc(t: PType; info: TLineInfo; g: ModuleGraph; idgen: IdGenerator): PSym</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/enumtostr.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/enumtostr.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="ast.html">ast</a>, <a class="reference external" href="idents.html">idents</a>, <a class="reference external" href="lineinfos.html">lineinfos</a>, <a class="reference external" href="modulegraphs.html">modulegraphs</a>, <a class="reference external" href="magicsys.html">magicsys</a>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="genCaseObjDiscMapping-procs-all">
<div id="genCaseObjDiscMapping,PType,PSym,TLineInfo,ModuleGraph,IdGenerator">
<dt><pre><span class="Keyword">proc</span> <a href="#genCaseObjDiscMapping%2CPType%2CPSym%2CTLineInfo%2CModuleGraph%2CIdGenerator"><span class="Identifier">genCaseObjDiscMapping</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="ast.html#PType"><span class="Identifier">PType</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span> <span class="Identifier">info</span><span class="Other">:</span> <a href="lineinfos.html#TLineInfo"><span class="Identifier">TLineInfo</span></a><span class="Other">;</span>
<span class="Identifier">g</span><span class="Other">:</span> <a href="modulegraphs.html#ModuleGraph"><span class="Identifier">ModuleGraph</span></a><span class="Other">;</span> <span class="Identifier">idgen</span><span class="Other">:</span> <a href="ast.html#IdGenerator"><span class="Identifier">IdGenerator</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/enumtostr.nim#L74" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/enumtostr.nim#L74" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="genEnumToStrProc-procs-all">
<div id="genEnumToStrProc,PType,TLineInfo,ModuleGraph,IdGenerator">
<dt><pre><span class="Keyword">proc</span> <a href="#genEnumToStrProc%2CPType%2CTLineInfo%2CModuleGraph%2CIdGenerator"><span class="Identifier">genEnumToStrProc</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="ast.html#PType"><span class="Identifier">PType</span></a><span class="Other">;</span> <span class="Identifier">info</span><span class="Other">:</span> <a href="lineinfos.html#TLineInfo"><span class="Identifier">TLineInfo</span></a><span class="Other">;</span> <span class="Identifier">g</span><span class="Other">:</span> <a href="modulegraphs.html#ModuleGraph"><span class="Identifier">ModuleGraph</span></a><span class="Other">;</span>
<span class="Identifier">idgen</span><span class="Other">:</span> <a href="ast.html#IdGenerator"><span class="Identifier">IdGenerator</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ast.html#PSym"><span class="Identifier">PSym</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/enumtostr.nim#L8" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/enumtostr.nim#L8" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-10-31 16:08:16 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More