Deploy to GitHub pages

This commit is contained in:
github-actions[bot]
2025-12-21 06:47:53 +00:00
committed by GitHub
commit c726543cc5
884 changed files with 353261 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-12-21 06:47:02 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-12-21 06:46:20 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-12-21 06:47:22 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-12-21 06:47:24 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#L42" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/assertions.nim#L42" 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#L35" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/assertions.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="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#L58" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/assertions.nim#L58" 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#L72" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/assertions.nim#L72" 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#L95" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/assertions.nim#L95" 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#L78" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/assertions.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-12-21 06:47:16 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) 35
nim failedAssertImpl assertions.html#failedAssertImpl,string proc failedAssertImpl(msg: string) 42
nim assert assertions.html#assert.t,untyped,string template assert(cond: untyped; msg = "") 58
nim doAssert assertions.html#doAssert.t,untyped,string template doAssert(cond: untyped; msg = "") 72
nim onFailedAssert assertions.html#onFailedAssert.t,untyped,untyped template onFailedAssert(msg, code: untyped): untyped 78
nim doAssertRaises assertions.html#doAssertRaises.t,typedesc,untyped template doAssertRaises(exception: typedesc; code: untyped) 95

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-12-21 06:47:01 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-12-21 06:47:08 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-12-21 06:47:39 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-12-21 06:47:05 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-12-21 06:47:32 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-12-21 06:47:02 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-12-21 06:47:01 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-12-21 06:46:47 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-12-21 06:46:32 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-12-21 06:47:11 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-12-21 06:46:20 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-12-21 06:47:08 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-12-21 06:47:41 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-12-21 06:47:06 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-12-21 06:47:25 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-12-21 06:47:12 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-12-21 06:47:07 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-12-21 06:47:15 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-12-21 06:47:19 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

221
compiler/aliasanalysis.html Normal file
View File

@@ -0,0 +1,221 @@
<?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="astdef.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="astdef.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">;</span> <span class="Identifier">owner</span><span class="Other">:</span> <a href="astdef.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="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="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="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/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="astdef.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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-12-21 06:47:46 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="astdef.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">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="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="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>
<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-12-21 06:47:47 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

5207
compiler/ast.html Normal file

File diff suppressed because one or more lines are too long

309
compiler/ast.idx Normal file
View File

@@ -0,0 +1,309 @@
nimTitle ast ast.html module ast 0
nim program ast.html#program var program 33
nim setupProgram ast.html#setupProgram,ConfigRef,IdentCache proc setupProgram(config: ConfigRef; cache: IdentCache) 35
nim loadSymCallback ast.html#loadSymCallback,PSym proc loadSymCallback(s: PSym) 49
nim loadTypeCallback ast.html#loadTypeCallback,PType proc loadTypeCallback(t: PType) 52
nim ensureMutable ast.html#ensureMutable,PSym proc ensureMutable(s: PSym) 55
nim ensureMutable ast.html#ensureMutable,PType proc ensureMutable(t: PType) 59
nim backendEnsureMutable ast.html#backendEnsureMutable,PSym proc backendEnsureMutable(s: PSym) 63
nim backendEnsureMutable ast.html#backendEnsureMutable,PType proc backendEnsureMutable(t: PType) 68
nim owner ast.html#owner,PSym proc owner(s: PSym): PSym 73
nim owner ast.html#owner,PType proc owner(s: PType): PSym 77
nim setOwner ast.html#setOwner,PSym,PSym proc setOwner(s: PSym; owner: PSym) 81
nim setOwner ast.html#setOwner,PType,PSym proc setOwner(s: PType; owner: PSym) 86
nim kind ast.html#kind,PSym proc kind(s: PSym): TSymKind 91
nim kind= ast.html#kind=,PSym,TSymKind proc kind=(s: PSym; val: TSymKind) 95
nim gcUnsafetyReason ast.html#gcUnsafetyReason,PSym proc gcUnsafetyReason(s: PSym): PSym 100
nim gcUnsafetyReason= ast.html#gcUnsafetyReason=,PSym,PSym proc gcUnsafetyReason=(s: PSym; val: PSym) 104
nim transformedBody ast.html#transformedBody,PSym proc transformedBody(s: PSym): PNode 109
nim transformedBody= ast.html#transformedBody=,PSym,PNode proc transformedBody=(s: PSym; val: PNode) 113
nim guard ast.html#guard,PSym proc guard(s: PSym): PSym 119
nim guard= ast.html#guard=,PSym,PSym proc guard=(s: PSym; val: PSym) 123
nim bitsize ast.html#bitsize,PSym proc bitsize(s: PSym): int 128
nim bitsize= ast.html#bitsize=,PSym,int proc bitsize=(s: PSym; val: int) 132
nim alignment ast.html#alignment,PSym proc alignment(s: PSym): int 137
nim alignment= ast.html#alignment=,PSym,int proc alignment=(s: PSym; val: int) 141
nim magic ast.html#magic,PSym proc magic(s: PSym): TMagic 146
nim magic= ast.html#magic=,PSym,TMagic proc magic=(s: PSym; val: TMagic) 150
nim typ ast.html#typ,PSym proc typ(s: PSym): PType 155
nim typ= ast.html#typ=,PSym,PType proc typ=(s: PSym; val: PType) 159
nim info ast.html#info,PSym proc info(s: PSym): TLineInfo 164
nim info= ast.html#info=,PSym,TLineInfo proc info=(s: PSym; val: TLineInfo) 168
nim flags ast.html#flags,PSym proc flags(s: PSym): TSymFlags 192
nim flags= ast.html#flags=,PSym,TSymFlags proc flags=(s: PSym; val: TSymFlags) 196
nim ast ast.html#ast,PSym proc ast(s: PSym): PNode 201
nim ast= ast.html#ast=,PSym,PNode proc ast=(s: PSym; val: PNode) 205
nim options ast.html#options,PSym proc options(s: PSym): TOptions 210
nim options= ast.html#options=,PSym,TOptions proc options=(s: PSym; val: TOptions) 214
nim position ast.html#position,PSym proc position(s: PSym): int 219
nim position= ast.html#position=,PSym,int proc position=(s: PSym; val: int) 223
nim offset ast.html#offset,PSym proc offset(s: PSym): int32 228
nim offset= ast.html#offset=,PSym,int32 proc offset=(s: PSym; val: int32) 232
nim loc ast.html#loc,PSym proc loc(s: PSym): TLoc 237
nim loc= ast.html#loc=,PSym,TLoc proc loc=(s: PSym; val: TLoc) 241
nim annex ast.html#annex,PSym proc annex(s: PSym): PLib 246
nim annex= ast.html#annex=,PSym,PLib proc annex=(s: PSym; val: PLib) 250
nim constraint ast.html#constraint,PSym proc constraint(s: PSym): PNode 265
nim constraint= ast.html#constraint=,PSym,PNode proc constraint=(s: PSym; val: PNode) 269
nim instantiatedFrom ast.html#instantiatedFrom,PSym proc instantiatedFrom(s: PSym): PSym 274
nim instantiatedFrom= ast.html#instantiatedFrom=,PSym,PSym proc instantiatedFrom=(s: PSym; val: PSym) 278
nim setSnippet ast.html#setSnippet,PSym,sinkstring proc setSnippet(s: PSym; val: sink string) 283
nim incl ast.html#incl,PSym,TSymFlag proc incl(s: PSym; flag: TSymFlag) 288
nim incl ast.html#incl,PSym,set[TSymFlag] proc incl(s: PSym; flags: set[TSymFlag]) 293
nim incl ast.html#incl,PSym,TLocFlag proc incl(s: PSym; flag: TLocFlag) 298
nim excl ast.html#excl,PSym,TSymFlag proc excl(s: PSym; flag: TSymFlag) 304
nim callConv ast.html#callConv,PType proc callConv(t: PType): TCallingConvention 320
nim callConv= ast.html#callConv=,PType,TCallingConvention proc callConv=(t: PType; val: TCallingConvention) 324
nim flags ast.html#flags,PType proc flags(t: PType): TTypeFlags 329
nim flags= ast.html#flags=,PType,TTypeFlags proc flags=(t: PType; val: TTypeFlags) 333
nim sons ast.html#sons,PType proc sons(t: PType): var TTypeSeq 338
nim sons= ast.html#sons=,PType,sinkTTypeSeq proc sons=(t: PType; val: sink TTypeSeq) 342
nim n ast.html#n,PType proc n(t: PType): PNode 347
nim n= ast.html#n=,PType,PNode proc n=(t: PType; val: PNode) 351
nim sym ast.html#sym,PType proc sym(t: PType): PSym 356
nim sym= ast.html#sym=,PType,PSym proc sym=(t: PType; val: PSym) 360
nim size ast.html#size,PType proc size(t: PType): BiggestInt 365
nim size= ast.html#size=,PType,BiggestInt proc size=(t: PType; val: BiggestInt) 369
nim align ast.html#align,PType proc align(t: PType): int16 373
nim align= ast.html#align=,PType,int16 proc align=(t: PType; val: int16) 377
nim paddingAtEnd ast.html#paddingAtEnd,PType proc paddingAtEnd(t: PType): int16 381
nim paddingAtEnd= ast.html#paddingAtEnd=,PType,int16 proc paddingAtEnd=(t: PType; val: int16) 385
nim loc ast.html#loc,PType proc loc(t: PType): TLoc 389
nim loc= ast.html#loc=,PType,TLoc proc loc=(t: PType; val: TLoc) 393
nim typeInst ast.html#typeInst,PType proc typeInst(t: PType): PType 398
nim typeInst= ast.html#typeInst=,PType,PType proc typeInst=(t: PType; val: PType) 402
nim incl ast.html#incl,PType,TTypeFlag proc incl(t: PType; flag: TTypeFlag) 407
nim incl ast.html#incl,PType,set[TTypeFlag] proc incl(t: PType; flags: set[TTypeFlag]) 412
nim excl ast.html#excl,PType,TTypeFlag proc excl(t: PType; flag: TTypeFlag) 417
nim excl ast.html#excl,PType,set[TTypeFlag] proc excl(t: PType; flags: set[TTypeFlag]) 422
nim typ ast.html#typ,PNode proc typ(n: PNode): PType 427
nim typ= ast.html#typ=,PNode,sinkPType proc typ=(n: PNode; val: sink PType) 432
nim setUseIc ast.html#setUseIc,bool proc setUseIc(useIc: bool) 445
nim comment ast.html#comment,PNode proc comment(n: PNode): string 447
nim comment= ast.html#comment=,PNode,string proc comment=(n: PNode; a: string) 454
nim getPIdent ast.html#getPIdent,PNode proc getPIdent(a: PNode): PIdent 473
nim toId ast.html#toId.t,ItemId template toId(a: ItemId): int 484
nim id ast.html#id.t template id(a: PType | PSym): int 488
nim IdGenerator ast.html#IdGenerator type IdGenerator 491
nim PackageModuleId ast.html#PackageModuleId const PackageModuleId 499
nim idGeneratorFromModule ast.html#idGeneratorFromModule,PSym proc idGeneratorFromModule(m: PSym): IdGenerator 501
nim idGeneratorForPackage ast.html#idGeneratorForPackage,int32 proc idGeneratorForPackage(nextIdWillBe: int32): IdGenerator 505
nim nextTypeId ast.html#nextTypeId,IdGenerator proc nextTypeId(x: IdGenerator): ItemId 513
nim ggDebug ast.html#ggDebug var ggDebug 531
nim isCallExpr ast.html#isCallExpr,PNode proc isCallExpr(n: PNode): bool 533
nim discardSons ast.html#discardSons,PNode proc discardSons(father: PNode) 536
nim safeArrLen ast.html#safeArrLen,PNode proc safeArrLen(n: PNode): int 538
nim add ast.html#add,PNode,PNode proc add(father, son: PNode) 544
nim addAllowNil ast.html#addAllowNil,PNode,PNode proc addAllowNil(father, son: PNode) 548
nim add ast.html#add,PType,PType proc add(father, son: PType) 551
nim addAllowNil ast.html#addAllowNil,PType,PType proc addAllowNil(father, son: PType) 555
nim `[]` ast.html#[].t,PType,int template `[]`(n: PType; i: int): PType 558
nim `[]=` ast.html#[]=.t,PType,int,PType template `[]=`(n: PType; i: int; x: PType) 561
nim `[]` ast.html#[].t,PType,BackwardsIndex template `[]`(n: PType; i: BackwardsIndex): PType 565
nim `[]=` ast.html#[]=.t,PType,BackwardsIndex,PType template `[]=`(n: PType; i: BackwardsIndex; x: PType) 568
nim getDeclPragma ast.html#getDeclPragma,PNode proc getDeclPragma(n: PNode): PNode 572
nim extractPragma ast.html#extractPragma,PSym proc extractPragma(s: PSym): PNode 606
nim skipPragmaExpr ast.html#skipPragmaExpr,PNode proc skipPragmaExpr(n: PNode): PNode 628
nim setInfoRecursive ast.html#setInfoRecursive,PNode,TLineInfo proc setInfoRecursive(n: PNode; info: TLineInfo) 636
nim newAtom ast.html#newAtom,PIdent,TLineInfo proc newAtom(ident: PIdent; info: TLineInfo): PNode 642
nim newAtom ast.html#newAtom,TNodeKind,BiggestInt,TLineInfo proc newAtom(kind: TNodeKind; intVal: BiggestInt; info: TLineInfo): PNode 646
nim newAtom ast.html#newAtom,TNodeKind,BiggestFloat,TLineInfo proc newAtom(kind: TNodeKind; floatVal: BiggestFloat; info: TLineInfo): PNode 650
nim newAtom ast.html#newAtom,TNodeKind,sinkstring,TLineInfo proc newAtom(kind: TNodeKind; strVal: sink string; info: TLineInfo): PNode 654
nim newTree ast.html#newTree,TNodeKind,TLineInfo,varargs[PNode] proc newTree(kind: TNodeKind; info: TLineInfo; children: varargs[PNode]): PNode 658
nim newTree ast.html#newTree,TNodeKind,varargs[PNode] proc newTree(kind: TNodeKind; children: varargs[PNode]): PNode 664
nim newTreeI ast.html#newTreeI,TNodeKind,TLineInfo,varargs[PNode] proc newTreeI(kind: TNodeKind; info: TLineInfo; children: varargs[PNode]): PNode 670
nim newTreeIT ast.html#newTreeIT,TNodeKind,TLineInfo,PType,varargs[PNode] proc newTreeIT(kind: TNodeKind; info: TLineInfo; typ: PType; children: varargs[PNode]): PNode 676
nim previouslyInferred ast.html#previouslyInferred.t,PType template previouslyInferred(t: PType): PType 682
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 694
nim astdef ast.html#astdef,PSym proc astdef(s: PSym): PNode 709
nim isMetaType ast.html#isMetaType,PType proc isMetaType(t: PType): bool 717
nim isUnresolvedStatic ast.html#isUnresolvedStatic,PType proc isUnresolvedStatic(t: PType): bool 722
nim linkTo ast.html#linkTo,PType,PSym proc linkTo(t: PType; s: PSym): PType 725
nim linkTo ast.html#linkTo,PSym,PType proc linkTo(s: PSym; t: PType): PSym 730
nim fileIdx ast.html#fileIdx.t,PSym template fileIdx(c: PSym): FileIndex 735
nim filename ast.html#filename.t,PSym template filename(c: PSym): string 739
nim appendToModule ast.html#appendToModule,PSym,PNode proc appendToModule(m: PSym; n: PNode) 743
nim copyStrTable ast.html#copyStrTable,TStrTable,TStrTable proc copyStrTable(dest: var TStrTable; src: TStrTable) 752
nim copyIdTable ast.html#copyIdTable,TIdTable[T],TIdTable[T] proc copyIdTable[T](dest: var TIdTable[T]; src: TIdTable[T]) 757
nim copyObjectSet ast.html#copyObjectSet,TObjectSet,TObjectSet proc copyObjectSet(dest: var TObjectSet; src: TObjectSet) 762
nim withInfo ast.html#withInfo,PNode,TLineInfo proc withInfo(n: PNode; info: TLineInfo): PNode 770
nim newSymNode ast.html#newSymNode,PSym proc newSymNode(sym: PSym): PNode 775
nim newOpenSym ast.html#newOpenSym,PNode proc newOpenSym(n: PNode): PNode 781
nim newIntNode ast.html#newIntNode,TNodeKind,BiggestInt proc newIntNode(kind: TNodeKind; intVal: BiggestInt): PNode 784
nim newIntNode ast.html#newIntNode,TNodeKind,Int128 proc newIntNode(kind: TNodeKind; intVal: Int128): PNode 788
nim lastSon ast.html#lastSon,PNode proc lastSon(n: PNode): PNode 792
nim setLastSon ast.html#setLastSon.t,PNode,PNode template setLastSon(n: PNode; s: PNode) 793
nim firstSon ast.html#firstSon.t,PNode template firstSon(n: PNode): PNode 795
nim secondSon ast.html#secondSon.t,PNode template secondSon(n: PNode): PNode 796
nim hasSon ast.html#hasSon.t,PNode template hasSon(n: PNode): bool 798
nim has2Sons ast.html#has2Sons.t,PNode template has2Sons(n: PNode): bool 799
nim replaceFirstSon ast.html#replaceFirstSon,PNode,PNode proc replaceFirstSon(n, newson: PNode) 801
nim replaceSon ast.html#replaceSon,PNode,int,PNode proc replaceSon(n: PNode; i: int; newson: PNode) 804
nim last ast.html#last,PType proc last(n: PType): PType 807
nim elementType ast.html#elementType,PType proc elementType(n: PType): PType 811
nim skipModifier ast.html#skipModifier,PType proc skipModifier(n: PType): PType 815
nim indexType ast.html#indexType,PType proc indexType(n: PType): PType 819
nim baseClass ast.html#baseClass,PType proc baseClass(n: PType): PType 823
nim base ast.html#base,PType proc base(t: PType): PType 827
nim returnType ast.html#returnType,PType proc returnType(n: PType): PType 831
nim setReturnType ast.html#setReturnType,PType,PType proc setReturnType(n, r: PType) 835
nim setIndexType ast.html#setIndexType,PType,PType proc setIndexType(n, idx: PType) 839
nim firstParamType ast.html#firstParamType,PType proc firstParamType(n: PType): PType 843
nim firstGenericParam ast.html#firstGenericParam,PType proc firstGenericParam(n: PType): PType 847
nim typeBodyImpl ast.html#typeBodyImpl,PType proc typeBodyImpl(n: PType): PType 851
nim genericHead ast.html#genericHead,PType proc genericHead(n: PType): PType 855
nim skipTypes ast.html#skipTypes,PType,TTypeKinds proc skipTypes(t: PType; kinds: TTypeKinds): PType 859
nim newIntTypeNode ast.html#newIntTypeNode,BiggestInt,PType proc newIntTypeNode(intVal: BiggestInt; typ: PType): PNode 867
nim newIntTypeNode ast.html#newIntTypeNode,Int128,PType proc newIntTypeNode(intVal: Int128; typ: PType): PNode 890
nim newFloatNode ast.html#newFloatNode,TNodeKind,BiggestFloat proc newFloatNode(kind: TNodeKind; floatVal: BiggestFloat): PNode 894
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 898
nim AttachedOpToStr ast.html#AttachedOpToStr const AttachedOpToStr 907
nim `$` ast.html#$,PSym proc `$`(s: PSym): string 910
nim len ast.html#len,PType proc len(n: PType): int 916
nim sameTupleLengths ast.html#sameTupleLengths,PType,PType proc sameTupleLengths(a, b: PType): bool 919
nim tupleTypePairs ast.html#tupleTypePairs.i,PType,PType iterator tupleTypePairs(a, b: PType): (int, PType, PType) 922
nim underspecifiedPairs ast.html#underspecifiedPairs.i,PType,PType,int,int iterator underspecifiedPairs(a, b: PType; start = 0; without = 0): (PType, PType) 926
nim signatureLen ast.html#signatureLen,PType proc signatureLen(t: PType): int 931
nim paramsLen ast.html#paramsLen,PType proc paramsLen(t: PType): int 934
nim genericParamsLen ast.html#genericParamsLen,PType proc genericParamsLen(t: PType): int 937
nim genericInvocationParamsLen ast.html#genericInvocationParamsLen,PType proc genericInvocationParamsLen(t: PType): int 941
nim kidsLen ast.html#kidsLen,PType proc kidsLen(t: PType): int 945
nim genericParamHasConstraints ast.html#genericParamHasConstraints,PType proc genericParamHasConstraints(t: PType): bool 948
nim hasElementType ast.html#hasElementType,PType proc hasElementType(t: PType): bool 950
nim isEmptyTupleType ast.html#isEmptyTupleType,PType proc isEmptyTupleType(t: PType): bool 951
nim isSingletonTupleType ast.html#isSingletonTupleType,PType proc isSingletonTupleType(t: PType): bool 952
nim genericConstraint ast.html#genericConstraint,PType proc genericConstraint(t: PType): PType 954
nim genericInstParams ast.html#genericInstParams.i,PType iterator genericInstParams(t: PType): (bool, PType) 956
nim genericInstParamPairs ast.html#genericInstParamPairs.i,PType,PType iterator genericInstParamPairs(a, b: PType): (int, PType, PType) 960
nim genericInvocationParams ast.html#genericInvocationParams.i,PType iterator genericInvocationParams(t: PType): (bool, PType) 964
nim genericInvocationAndBodyElements ast.html#genericInvocationAndBodyElements.i,PType,PType iterator genericInvocationAndBodyElements(a, b: PType): (PType, PType) 968
nim genericInvocationParamPairs ast.html#genericInvocationParamPairs.i,PType,PType iterator genericInvocationParamPairs(a, b: PType): (bool, PType, PType) 972
nim genericBodyParams ast.html#genericBodyParams.i,PType iterator genericBodyParams(t: PType): (int, PType) 979
nim userTypeClassInstParams ast.html#userTypeClassInstParams.i,PType iterator userTypeClassInstParams(t: PType): (bool, PType) 983
nim ikids ast.html#ikids.i,PType iterator ikids(t: PType): (int, PType) 987
nim FirstParamAt ast.html#FirstParamAt const FirstParamAt 991
nim FirstGenericParamAt ast.html#FirstGenericParamAt const FirstGenericParamAt 992
nim paramTypes ast.html#paramTypes.i,PType iterator paramTypes(t: PType): (int, PType) 994
nim paramTypePairs ast.html#paramTypePairs.i,PType,PType iterator paramTypePairs(a, b: PType): (PType, PType) 997
nim paramTypeToNodeIndex ast.html#paramTypeToNodeIndex.t,int template paramTypeToNodeIndex(x: int): int 1000
nim kids ast.html#kids.i,PType iterator kids(t: PType): PType 1002
nim signature ast.html#signature.i,PType iterator signature(t: PType): PType 1005
nim newType ast.html#newType,TTypeKind,IdGenerator,PSym,sinkPType proc newType(kind: TTypeKind; idgen: IdGenerator; owner: PSym; son: sink PType = nil): PType 1009
nim setSons ast.html#setSons,PType,sinkseq[PType] proc setSons(dest: PType; sons: sink seq[PType]) 1021
nim setSon ast.html#setSon,PType,sinkPType proc setSon(dest: PType; son: sink PType) 1022
nim setSonsLen ast.html#setSonsLen,PType,int proc setSonsLen(dest: PType; len: int) 1023
nim newSons ast.html#newSons,PNode,int proc newSons(father: PNode; length: int) 1033
nim newSons ast.html#newSons,PType,int proc newSons(father: PType; length: int) 1036
nim truncateInferredTypeCandidates ast.html#truncateInferredTypeCandidates,PType proc truncateInferredTypeCandidates(t: PType) 1039
nim assignType ast.html#assignType,PType,PType proc assignType(dest, src: PType) 1044
nim copyType ast.html#copyType,PType,IdGenerator,PSym proc copyType(t: PType; idgen: IdGenerator; owner: PSym): PType 1064
nim exactReplica ast.html#exactReplica,PType proc exactReplica(t: PType): PType 1069
nim copySym ast.html#copySym,PSym,IdGenerator proc copySym(s: PSym; idgen: IdGenerator): PSym 1076
nim createModuleAlias ast.html#createModuleAlias,PSym,IdGenerator,PIdent,TLineInfo,TOptions proc createModuleAlias(s: PSym; idgen: IdGenerator; newIdent: PIdent;\n info: TLineInfo; options: TOptions): PSym 1092
nim initStrTable ast.html#initStrTable proc initStrTable(): TStrTable 1104
nim initIdTable ast.html#initIdTable proc initIdTable[T](): TIdTable[T] 1108
nim resetIdTable ast.html#resetIdTable,TIdTable[T] proc resetIdTable[T](x: var TIdTable[T]) 1112
nim initObjectSet ast.html#initObjectSet proc initObjectSet(): TObjectSet 1118
nim initNodeTable ast.html#initNodeTable proc initNodeTable(ignoreTypes = false): TNodeTable 1122
nim skipTypes ast.html#skipTypes,PType,TTypeKinds,int proc skipTypes(t: PType; kinds: TTypeKinds; maxIters: int): PType 1126
nim skipTypesOrNil ast.html#skipTypesOrNil,PType,TTypeKinds proc skipTypesOrNil(t: PType; kinds: TTypeKinds): PType 1134
nim isGCedMem ast.html#isGCedMem,PType proc isGCedMem(t: PType): bool 1141
nim propagateToOwner ast.html#propagateToOwner,PType,PType proc propagateToOwner(owner, elem: PType; propagateHasAsgn = true) 1145
nim rawAddSon ast.html#rawAddSon,PType,PType proc rawAddSon(father, son: PType; propagateHasAsgn = true) 1170
nim addSonNilAllowed ast.html#addSonNilAllowed,PNode,PNode proc addSonNilAllowed(father, son: PNode) 1175
nim delSon ast.html#delSon,PNode,int proc delSon(father: PNode; idx: int) 1178
nim copyNode ast.html#copyNode,PNode proc copyNode(src: PNode): PNode 1183
nim transitionSonsKind ast.html#transitionSonsKind,PNode,range[] proc transitionSonsKind(n: PNode; kind: range[nkComesFrom .. nkTupleConstr]) 1212
nim transitionIntKind ast.html#transitionIntKind,PNode,range[] proc transitionIntKind(n: PNode; kind: range[nkCharLit .. nkUInt64Lit]) 1216
nim transitionIntToFloatKind ast.html#transitionIntToFloatKind,PNode,range[] proc transitionIntToFloatKind(n: PNode; kind: range[nkFloatLit .. nkFloat128Lit]) 1220
nim transitionNoneToSym ast.html#transitionNoneToSym,PNode proc transitionNoneToSym(n: PNode) 1224
nim transitionSymKindCommon ast.html#transitionSymKindCommon.t,TSymKind template transitionSymKindCommon(k: TSymKind) 1227
nim transitionGenericParamToType ast.html#transitionGenericParamToType,PSym proc transitionGenericParamToType(s: PSym) 1238
nim transitionRoutineSymKind ast.html#transitionRoutineSymKind,PSym,range[] proc transitionRoutineSymKind(s: PSym; kind: range[skProc .. skTemplate]) 1241
nim transitionToLet ast.html#transitionToLet,PSym proc transitionToLet(s: PSym) 1246
nim shallowCopy ast.html#shallowCopy,PNode proc shallowCopy(src: PNode): PNode 1272
nim copyTree ast.html#copyTree,PNode proc copyTree(src: PNode): PNode 1277
nim copyTreeWithoutNode ast.html#copyTreeWithoutNode,PNode,PNode proc copyTreeWithoutNode(src, skippedNode: PNode): PNode 1284
nim hasSonWith ast.html#hasSonWith,PNode,TNodeKind proc hasSonWith(n: PNode; kind: TNodeKind): bool 1291
nim hasNilSon ast.html#hasNilSon,PNode proc hasNilSon(n: PNode): bool 1297
nim containsNode ast.html#containsNode,PNode,TNodeKinds proc containsNode(n: PNode; kinds: TNodeKinds): bool 1305
nim hasSubnodeWith ast.html#hasSubnodeWith,PNode,TNodeKind proc hasSubnodeWith(n: PNode; kind: TNodeKind): bool 1314
nim getInt ast.html#getInt,PNode proc getInt(a: PNode): Int128 1323
nim getInt64 ast.html#getInt64,PNode proc getInt64(a: PNode): int64 1336
nim getFloat ast.html#getFloat,PNode proc getFloat(a: PNode): BiggestFloat 1343
nim getStr ast.html#getStr,PNode proc getStr(a: PNode): string 1354
nim getStrOrChar ast.html#getStrOrChar,PNode proc getStrOrChar(a: PNode): string 1366
nim isGenericParams ast.html#isGenericParams,PNode proc isGenericParams(n: PNode): bool 1376
nim isGenericRoutine ast.html#isGenericRoutine,PNode proc isGenericRoutine(n: PNode): bool 1380
nim isGenericRoutineStrict ast.html#isGenericRoutineStrict,PSym proc isGenericRoutineStrict(s: PSym): bool 1383
nim isGenericRoutine ast.html#isGenericRoutine,PSym proc isGenericRoutine(s: PSym): bool 1389
nim skipGenericOwner ast.html#skipGenericOwner,PSym proc skipGenericOwner(s: PSym): PSym 1403
nim originatingModule ast.html#originatingModule,PSym proc originatingModule(s: PSym): PSym 1414
nim isRoutine ast.html#isRoutine,PSym proc isRoutine(s: PSym): bool 1418
nim isCompileTimeProc ast.html#isCompileTimeProc,PSym proc isCompileTimeProc(s: PSym): bool 1421
nim hasPattern ast.html#hasPattern,PSym proc hasPattern(s: PSym): bool 1425
nim pairs ast.html#pairs.i,PNode iterator pairs(n: PNode): tuple[i: int, n: PNode] 1428
nim isAtom ast.html#isAtom,PNode proc isAtom(n: PNode): bool 1431
nim isEmptyType ast.html#isEmptyType,PType proc isEmptyType(t: PType): bool 1434
nim makeStmtList ast.html#makeStmtList,PNode proc makeStmtList(n: PNode): PNode 1438
nim skipStmtList ast.html#skipStmtList,PNode proc skipStmtList(n: PNode): PNode 1445
nim toVar ast.html#toVar,PType,TTypeKind,IdGenerator proc toVar(typ: PType; kind: TTypeKind; idgen: IdGenerator): PType 1453
nim toRef ast.html#toRef,PType,IdGenerator proc toRef(typ: PType; idgen: IdGenerator): PType 1460
nim toObject ast.html#toObject,PType proc toObject(typ: PType): PType 1467
nim toObjectFromRefPtrGeneric ast.html#toObjectFromRefPtrGeneric,PType proc toObjectFromRefPtrGeneric(typ: PType): PType 1475
nim isImportedException ast.html#isImportedException,PType,ConfigRef proc isImportedException(t: PType; conf: ConfigRef): bool 1495
nim isInfixAs ast.html#isInfixAs,PNode proc isInfixAs(n: PNode): bool 1504
nim skipColon ast.html#skipColon,PNode proc skipColon(n: PNode): PNode 1507
nim findUnresolvedStatic ast.html#findUnresolvedStatic,PNode proc findUnresolvedStatic(n: PNode): PNode 1512
nim hasDestructor ast.html#hasDestructor.t,PType template hasDestructor(t: PType): bool 1533
nim incompleteType ast.html#incompleteType.t,PType template incompleteType(t: PType): bool 1535
nim typeCompleted ast.html#typeCompleted.t,PSym template typeCompleted(s: PSym) 1538
nim detailedInfo ast.html#detailedInfo.t,PSym template detailedInfo(sym: PSym): string 1541
nim isInlineIterator ast.html#isInlineIterator,PType proc isInlineIterator(typ: PType): bool 1544
nim isIterator ast.html#isIterator,PType proc isIterator(typ: PType): bool 1547
nim isClosureIterator ast.html#isClosureIterator,PType proc isClosureIterator(typ: PType): bool 1550
nim isClosure ast.html#isClosure,PType proc isClosure(typ: PType): bool 1553
nim isNimcall ast.html#isNimcall,PSym proc isNimcall(s: PSym): bool 1556
nim isExplicitCallConv ast.html#isExplicitCallConv,PSym proc isExplicitCallConv(s: PSym): bool 1559
nim isSinkParam ast.html#isSinkParam,PSym proc isSinkParam(s: PSym): bool 1562
nim isSinkType ast.html#isSinkType,PType proc isSinkType(t: PType): bool 1565
nim newProcType ast.html#newProcType,TLineInfo,IdGenerator,PSym proc newProcType(info: TLineInfo; idgen: IdGenerator; owner: PSym): PType 1568
nim addParam ast.html#addParam,PType,PSym proc addParam(procType: PType; param: PSym) 1577
nim canRaiseConservative ast.html#canRaiseConservative,PNode proc canRaiseConservative(fn: PNode): bool 1585
nim canRaise ast.html#canRaise,PNode proc canRaise(fn: PNode): bool 1591
nim toHumanStr ast.html#toHumanStr,TSymKind proc toHumanStr(kind: TSymKind): string 1614
nim toHumanStr ast.html#toHumanStr,TTypeKind proc toHumanStr(kind: TTypeKind): string 1618
nim skipHiddenAddr ast.html#skipHiddenAddr,PNode proc skipHiddenAddr(n: PNode): PNode 1622
nim isNewStyleConcept ast.html#isNewStyleConcept,PNode proc isNewStyleConcept(n: PNode): bool 1625
nim isOutParam ast.html#isOutParam,PType proc isOutParam(t: PType): bool 1629
nim nodesToIgnoreSet ast.html#nodesToIgnoreSet const nodesToIgnoreSet 1632
nim isTrue ast.html#isTrue,PNode proc isTrue(n: PNode): bool 1639
nim TypeMapping ast.html#TypeMapping type TypeMapping 1644
nim SymMapping ast.html#SymMapping type SymMapping 1645
nim initSymMapping ast.html#initSymMapping.t template initSymMapping(): SymMapping 1647
nim initTypeMapping ast.html#initTypeMapping.t template initTypeMapping(): TypeMapping 1648
nimgrp addallownil ast.html#addAllowNil-procs-all proc 548
nimgrp isgenericroutine ast.html#isGenericRoutine-procs-all proc 1380
nimgrp newintnode ast.html#newIntNode-procs-all proc 784
nimgrp newinttypenode ast.html#newIntTypeNode-procs-all proc 867
nimgrp loc ast.html#loc-procs-all proc 237
nimgrp newtree ast.html#newTree-procs-all proc 658
nimgrp add ast.html#add-procs-all proc 544
nimgrp tohumanstr ast.html#toHumanStr-procs-all proc 1614
nimgrp linkto ast.html#linkTo-procs-all proc 725
nimgrp newatom ast.html#newAtom-procs-all proc 642
nimgrp newsons ast.html#newSons-procs-all proc 1033
nimgrp owner ast.html#owner-procs-all proc 73
nimgrp skiptypes ast.html#skipTypes-procs-all proc 859
nimgrp setowner ast.html#setOwner-procs-all proc 81
nimgrp ensuremutable ast.html#ensureMutable-procs-all proc 55
nimgrp excl ast.html#excl-procs-all proc 304
nimgrp loc= ast.html#loc=-procs-all proc 241
nimgrp backendensuremutable ast.html#backendEnsureMutable-procs-all proc 63
nimgrp flags= ast.html#flags=-procs-all proc 196
nimgrp typ ast.html#typ-procs-all proc 155
nimgrp incl ast.html#incl-procs-all proc 288
nimgrp flags ast.html#flags-procs-all proc 192
nimgrp typ= ast.html#typ=-procs-all proc 159
nimgrp []= ast.html#[]=-templates-all template 561
nimgrp [] ast.html#[]-templates-all template 558

467
compiler/ast2nif.html Normal file
View File

@@ -0,0 +1,467 @@
<?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>ast2nif</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">ast2nif</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="#DecodeContext" title="DecodeContext = object">DecodeContext</a></li>
<li><a class="reference" href="#ParsedSymName" title="ParsedSymName = object
name*: string
module*: string
count*: int">ParsedSymName</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">createDecodeContext
<li><a class="reference" href="#createDecodeContext%2CConfigRef%2CIdentCache" title="createDecodeContext(config: ConfigRef; cache: IdentCache): DecodeContext">createDecodeContext(config: ConfigRef; cache: IdentCache): DecodeContext</a></li>
</ul>
<ul class="simple nested-toc-section">firstSon
<li><a class="reference" href="#firstSon%2CCursor" title="firstSon(n: Cursor): Cursor">firstSon(n: Cursor): Cursor</a></li>
</ul>
<ul class="simple nested-toc-section">isStub
<li><a class="reference" href="#isStub%2CPSym" title="isStub(s: PSym): bool">isStub(s: PSym): bool</a></li>
<li><a class="reference" href="#isStub%2CPType" title="isStub(t: PType): bool">isStub(t: PType): bool</a></li>
</ul>
<ul class="simple nested-toc-section">loadNifModule
<li><a class="reference" href="#loadNifModule%2CDecodeContext%2CFileIndex%2CTStrTable%2CTStrTable%2Cseq%5BLogEntry%5D%2Cbool" title="loadNifModule(c: var DecodeContext; f: FileIndex;
interf, interfHidden: var TStrTable; logOps: var seq[LogEntry];
loadFullAst: bool = false): PNode">loadNifModule(c: var DecodeContext; f: FileIndex;
interf, interfHidden: var TStrTable; logOps: var seq[LogEntry];
loadFullAst: bool = false): PNode</a></li>
</ul>
<ul class="simple nested-toc-section">loadSym
<li><a class="reference" href="#loadSym%2CDecodeContext%2CPSym" title="loadSym(c: var DecodeContext; s: PSym)">loadSym(c: var DecodeContext; s: PSym)</a></li>
</ul>
<ul class="simple nested-toc-section">loadType
<li><a class="reference" href="#loadType%2CDecodeContext%2CPType" title="loadType(c: var DecodeContext; t: PType)">loadType(c: var DecodeContext; t: PType)</a></li>
</ul>
<ul class="simple nested-toc-section">parseSymName
<li><a class="reference" href="#parseSymName%2Cstring" title="parseSymName(s: string): ParsedSymName">parseSymName(s: string): ParsedSymName</a></li>
</ul>
<ul class="simple nested-toc-section">resolveHookSym
<li><a class="reference" href="#resolveHookSym%2CDecodeContext%2C" title="resolveHookSym(c: var DecodeContext; symId: nifstreams.SymId): PSym">resolveHookSym(c: var DecodeContext; symId: nifstreams.SymId): PSym</a></li>
</ul>
<ul class="simple nested-toc-section">toClassSymId
<li><a class="reference" href="#toClassSymId%2CConfigRef%2CItemId" title="toClassSymId(config: ConfigRef; typeId: ItemId): nifstreams.SymId">toClassSymId(config: ConfigRef; typeId: ItemId): nifstreams.SymId</a></li>
</ul>
<ul class="simple nested-toc-section">toConverterIndexEntry
<li><a class="reference" href="#toConverterIndexEntry%2CConfigRef%2CPSym" title="toConverterIndexEntry(config: ConfigRef; converterSym: PSym): (nifstreams.SymId,
nifstreams.SymId)">toConverterIndexEntry(config: ConfigRef; converterSym: PSym): (nifstreams.SymId,
nifstreams.SymId)</a></li>
</ul>
<ul class="simple nested-toc-section">toHookIndexEntry
<li><a class="reference" href="#toHookIndexEntry%2CConfigRef%2CItemId%2CPSym" title="toHookIndexEntry(config: ConfigRef; typeId: ItemId; hookSym: PSym): HookIndexEntry">toHookIndexEntry(config: ConfigRef; typeId: ItemId; hookSym: PSym): HookIndexEntry</a></li>
</ul>
<ul class="simple nested-toc-section">toMethodIndexEntry
<li><a class="reference" href="#toMethodIndexEntry%2CConfigRef%2CPSym%2Cstring" title="toMethodIndexEntry(config: ConfigRef; methodSym: PSym; signature: string): MethodIndexEntry">toMethodIndexEntry(config: ConfigRef; methodSym: PSym; signature: string): MethodIndexEntry</a></li>
</ul>
<ul class="simple nested-toc-section">toNifFilename
<li><a class="reference" href="#toNifFilename%2CConfigRef%2CFileIndex" title="toNifFilename(conf: ConfigRef; f: FileIndex): string">toNifFilename(conf: ConfigRef; f: FileIndex): string</a></li>
</ul>
<ul class="simple nested-toc-section">toNifIndexFilename
<li><a class="reference" href="#toNifIndexFilename%2CConfigRef%2CFileIndex" title="toNifIndexFilename(conf: ConfigRef; f: FileIndex): string">toNifIndexFilename(conf: ConfigRef; f: FileIndex): string</a></li>
</ul>
<ul class="simple nested-toc-section">tryResolveCompilerProc
<li><a class="reference" href="#tryResolveCompilerProc%2CDecodeContext%2Cstring%2CFileIndex" title="tryResolveCompilerProc(c: var DecodeContext; name: string;
moduleFileIdx: FileIndex): PSym">tryResolveCompilerProc(c: var DecodeContext; name: string;
moduleFileIdx: FileIndex): PSym</a></li>
</ul>
<ul class="simple nested-toc-section">writeNifModule
<li><a class="reference" href="#writeNifModule%2CConfigRef%2Cint32%2CPNode%2Cseq%5BLogEntry%5D%2Cseq%5BPNode%5D" title="writeNifModule(config: ConfigRef; thisModule: int32; n: PNode;
opsLog: seq[LogEntry]; replayActions: seq[PNode] = @[])">writeNifModule(config: ConfigRef; thisModule: int32; n: PNode;
opsLog: seq[LogEntry]; replayActions: seq[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/ast2nif.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">AST to NIF bridge.</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="astdef.html">astdef</a>, <a class="reference external" href="idents.html">idents</a>, <a class="reference external" href="msgs.html">msgs</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="typekeys.html">typekeys</a>, <a class="reference external" href="ic/enum2nif.html">ic/enum2nif</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="DecodeContext">
<dt><pre><a href="ast2nif.html#DecodeContext"><span class="Identifier">DecodeContext</span></a> <span class="Other">=</span> <span class="Keyword">object</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L801" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L801" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="ParsedSymName">
<dt><pre><a href="ast2nif.html#ParsedSymName"><span class="Identifier">ParsedSymName</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">name</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">string</span>
<span class="Identifier">module</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">string</span>
<span class="Identifier">count</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L194" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L194" 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="createDecodeContext-procs-all">
<div id="createDecodeContext,ConfigRef,IdentCache">
<dt><pre><span class="Keyword">proc</span> <a href="#createDecodeContext%2CConfigRef%2CIdentCache"><span class="Identifier">createDecodeContext</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">cache</span><span class="Other">:</span> <a href="idents.html#IdentCache"><span class="Identifier">IdentCache</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ast2nif.html#DecodeContext"><span class="Identifier">DecodeContext</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>
Supposed to be a global variable
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L809" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L809" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="firstSon-procs-all">
<div id="firstSon,Cursor">
<dt><pre><span class="Keyword">proc</span> <a href="#firstSon%2CCursor"><span class="Identifier">firstSon</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <span class="Identifier">Cursor</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Cursor</span> {.<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/ast2nif.nim#L767" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L767" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="isStub-procs-all">
<div id="isStub,PSym">
<dt><pre><span class="Keyword">proc</span> <a href="#isStub%2CPSym"><span class="Identifier">isStub</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<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/ast2nif.nim#L963" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L963" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="isStub,PType">
<dt><pre><span class="Keyword">proc</span> <a href="#isStub%2CPType"><span class="Identifier">isStub</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="astdef.html#PType"><span class="Identifier">PType</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<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/ast2nif.nim#L962" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L962" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="loadNifModule-procs-all">
<div id="loadNifModule,DecodeContext,FileIndex,TStrTable,TStrTable,seq[LogEntry],bool">
<dt><pre><span class="Keyword">proc</span> <a href="#loadNifModule%2CDecodeContext%2CFileIndex%2CTStrTable%2CTStrTable%2Cseq%5BLogEntry%5D%2Cbool"><span class="Identifier">loadNifModule</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ast2nif.html#DecodeContext"><span class="Identifier">DecodeContext</span></a><span class="Other">;</span> <span class="Identifier">f</span><span class="Other">:</span> <a href="lineinfos.html#FileIndex"><span class="Identifier">FileIndex</span></a><span class="Other">;</span>
<span class="Identifier">interf</span><span class="Other">,</span> <span class="Identifier">interfHidden</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="astdef.html#TStrTable"><span class="Identifier">TStrTable</span></a><span class="Other">;</span>
<span class="Identifier">logOps</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="astdef.html#LogEntry"><span class="Identifier">LogEntry</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">loadFullAst</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="Other">:</span> <a href="astdef.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">OSError</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="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="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/ast2nif.nim#L1558" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L1558" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="loadSym-procs-all">
<div id="loadSym,DecodeContext,PSym">
<dt><pre><span class="Keyword">proc</span> <a href="#loadSym%2CDecodeContext%2CPSym"><span class="Identifier">loadSym</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ast2nif.html#DecodeContext"><span class="Identifier">DecodeContext</span></a><span class="Other">;</span> <span class="Identifier">s</span><span class="Other">:</span> <a href="astdef.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">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="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="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/ast2nif.nim#L1124" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L1124" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="loadType-procs-all">
<div id="loadType,DecodeContext,PType">
<dt><pre><span class="Keyword">proc</span> <a href="#loadType%2CDecodeContext%2CPType"><span class="Identifier">loadType</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ast2nif.html#DecodeContext"><span class="Identifier">DecodeContext</span></a><span class="Other">;</span> <span class="Identifier">t</span><span class="Other">:</span> <a href="astdef.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">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="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="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/ast2nif.nim#L1034" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L1034" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="parseSymName-procs-all">
<div id="parseSymName,string">
<dt><pre><span class="Keyword">proc</span> <a href="#parseSymName%2Cstring"><span class="Identifier">parseSymName</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> <a href="ast2nif.html#ParsedSymName"><span class="Identifier">ParsedSymName</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/ast2nif.nim#L199" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L199" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="resolveHookSym-procs-all">
<div id="resolveHookSym,DecodeContext,">
<dt><pre><span class="Keyword">proc</span> <a href="#resolveHookSym%2CDecodeContext%2C"><span class="Identifier">resolveHookSym</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ast2nif.html#DecodeContext"><span class="Identifier">DecodeContext</span></a><span class="Other">;</span> <span class="Identifier">symId</span><span class="Other">:</span> <span class="Identifier">nifstreams</span><span class="Other">.</span><span class="Identifier">SymId</span><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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">OSError</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">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>
Resolves a hook SymId to PSym. Hook symbols are often private (generated =destroy, =wasMoved, etc.)
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L1438" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L1438" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="toClassSymId-procs-all">
<div id="toClassSymId,ConfigRef,ItemId">
<dt><pre><span class="Keyword">proc</span> <a href="#toClassSymId%2CConfigRef%2CItemId"><span class="Identifier">toClassSymId</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">typeId</span><span class="Other">:</span> <a href="astdef.html#ItemId"><span class="Identifier">ItemId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">nifstreams</span><span class="Other">.</span><span class="Identifier">SymId</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="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Converts a type ItemId to its SymId for the class index.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L67" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L67" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="toConverterIndexEntry-procs-all">
<div id="toConverterIndexEntry,ConfigRef,PSym">
<dt><pre><span class="Keyword">proc</span> <a href="#toConverterIndexEntry%2CConfigRef%2CPSym"><span class="Identifier">toConverterIndexEntry</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">converterSym</span><span class="Other">:</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Other">(</span>
<span class="Identifier">nifstreams</span><span class="Other">.</span><span class="Identifier">SymId</span><span class="Other">,</span> <span class="Identifier">nifstreams</span><span class="Other">.</span><span class="Identifier">SymId</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="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>
Converts a converter symbol to an index entry (destType, converterSym). Returns the destination type's SymId and the converter's SymId.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L44" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L44" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="toHookIndexEntry-procs-all">
<div id="toHookIndexEntry,ConfigRef,ItemId,PSym">
<dt><pre><span class="Keyword">proc</span> <a href="#toHookIndexEntry%2CConfigRef%2CItemId%2CPSym"><span class="Identifier">toHookIndexEntry</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">typeId</span><span class="Other">:</span> <a href="astdef.html#ItemId"><span class="Identifier">ItemId</span></a><span class="Other">;</span> <span class="Identifier">hookSym</span><span class="Other">:</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">HookIndexEntry</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="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Converts a type ItemId and hook symbol to a HookIndexEntry for the NIF index.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L33" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L33" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="toMethodIndexEntry-procs-all">
<div id="toMethodIndexEntry,ConfigRef,PSym,string">
<dt><pre><span class="Keyword">proc</span> <a href="#toMethodIndexEntry%2CConfigRef%2CPSym%2Cstring"><span class="Identifier">toMethodIndexEntry</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">methodSym</span><span class="Other">:</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span> <span class="Identifier">signature</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">MethodIndexEntry</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="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Converts a method symbol to a MethodIndexEntry.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L59" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L59" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="toNifFilename-procs-all">
<div id="toNifFilename,ConfigRef,FileIndex">
<dt><pre><span class="Keyword">proc</span> <a href="#toNifFilename%2CConfigRef%2CFileIndex"><span class="Identifier">toNifFilename</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">f</span><span class="Other">:</span> <a href="lineinfos.html#FileIndex"><span class="Identifier">FileIndex</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">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="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/ast2nif.nim#L1404" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L1404" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="toNifIndexFilename-procs-all">
<div id="toNifIndexFilename,ConfigRef,FileIndex">
<dt><pre><span class="Keyword">proc</span> <a href="#toNifIndexFilename%2CConfigRef%2CFileIndex"><span class="Identifier">toNifIndexFilename</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">f</span><span class="Other">:</span> <a href="lineinfos.html#FileIndex"><span class="Identifier">FileIndex</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">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="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/ast2nif.nim#L1408" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L1408" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="tryResolveCompilerProc-procs-all">
<div id="tryResolveCompilerProc,DecodeContext,string,FileIndex">
<dt><pre><span class="Keyword">proc</span> <a href="#tryResolveCompilerProc%2CDecodeContext%2Cstring%2CFileIndex"><span class="Identifier">tryResolveCompilerProc</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ast2nif.html#DecodeContext"><span class="Identifier">DecodeContext</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="Identifier">moduleFileIdx</span><span class="Other">:</span> <a href="lineinfos.html#FileIndex"><span class="Identifier">FileIndex</span></a><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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">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">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">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>
Tries to resolve a compiler proc from a module by checking the NIF index. Returns nil if the symbol doesn't exist.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L1444" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L1444" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="writeNifModule-procs-all">
<div id="writeNifModule,ConfigRef,int32,PNode,seq[LogEntry],seq[PNode]">
<dt><pre><span class="Keyword">proc</span> <a href="#writeNifModule%2CConfigRef%2Cint32%2CPNode%2Cseq%5BLogEntry%5D%2Cseq%5BPNode%5D"><span class="Identifier">writeNifModule</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">thisModule</span><span class="Other">:</span> <span class="Identifier">int32</span><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="astdef.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">;</span>
<span class="Identifier">opsLog</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="astdef.html#LogEntry"><span class="Identifier">LogEntry</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">replayActions</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="astdef.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Operator">@</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">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">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="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">WriteDirEffect</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="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/ast2nif.nim#L689" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L689" 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-12-21 06:47:44 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

21
compiler/ast2nif.idx Normal file
View File

@@ -0,0 +1,21 @@
nimTitle ast2nif ast2nif.html module ast2nif 0
nim toHookIndexEntry ast2nif.html#toHookIndexEntry,ConfigRef,ItemId,PSym proc toHookIndexEntry(config: ConfigRef; typeId: ItemId; hookSym: PSym): HookIndexEntry 33
nim toConverterIndexEntry ast2nif.html#toConverterIndexEntry,ConfigRef,PSym proc toConverterIndexEntry(config: ConfigRef; converterSym: PSym): (nifstreams.SymId,\n nifstreams.SymId) 44
nim toMethodIndexEntry ast2nif.html#toMethodIndexEntry,ConfigRef,PSym,string proc toMethodIndexEntry(config: ConfigRef; methodSym: PSym; signature: string): MethodIndexEntry 59
nim toClassSymId ast2nif.html#toClassSymId,ConfigRef,ItemId proc toClassSymId(config: ConfigRef; typeId: ItemId): nifstreams.SymId 67
nim ParsedSymName ast2nif.html#ParsedSymName object ParsedSymName 194
nim parseSymName ast2nif.html#parseSymName,string proc parseSymName(s: string): ParsedSymName 199
nim writeNifModule ast2nif.html#writeNifModule,ConfigRef,int32,PNode,seq[LogEntry],seq[PNode] proc writeNifModule(config: ConfigRef; thisModule: int32; n: PNode;\n opsLog: seq[LogEntry]; replayActions: seq[PNode] = @[]) 689
nim firstSon ast2nif.html#firstSon,Cursor proc firstSon(n: Cursor): Cursor 767
nim DecodeContext ast2nif.html#DecodeContext object DecodeContext 801
nim createDecodeContext ast2nif.html#createDecodeContext,ConfigRef,IdentCache proc createDecodeContext(config: ConfigRef; cache: IdentCache): DecodeContext 809
nim isStub ast2nif.html#isStub,PType proc isStub(t: PType): bool 962
nim isStub ast2nif.html#isStub,PSym proc isStub(s: PSym): bool 963
nim loadType ast2nif.html#loadType,DecodeContext,PType proc loadType(c: var DecodeContext; t: PType) 1034
nim loadSym ast2nif.html#loadSym,DecodeContext,PSym proc loadSym(c: var DecodeContext; s: PSym) 1124
nim toNifFilename ast2nif.html#toNifFilename,ConfigRef,FileIndex proc toNifFilename(conf: ConfigRef; f: FileIndex): string 1404
nim toNifIndexFilename ast2nif.html#toNifIndexFilename,ConfigRef,FileIndex proc toNifIndexFilename(conf: ConfigRef; f: FileIndex): string 1408
nim resolveHookSym ast2nif.html#resolveHookSym,DecodeContext, proc resolveHookSym(c: var DecodeContext; symId: nifstreams.SymId): PSym 1438
nim tryResolveCompilerProc ast2nif.html#tryResolveCompilerProc,DecodeContext,string,FileIndex proc tryResolveCompilerProc(c: var DecodeContext; name: string;\n moduleFileIdx: FileIndex): PSym 1444
nim loadNifModule ast2nif.html#loadNifModule,DecodeContext,FileIndex,TStrTable,TStrTable,seq[LogEntry],bool proc loadNifModule(c: var DecodeContext; f: FileIndex;\n interf, interfHidden: var TStrTable; logOps: var seq[LogEntry];\n loadFullAst: bool = false): PNode 1558
nimgrp isstub ast2nif.html#isStub-procs-all proc 962

894
compiler/astalgo.html Normal file
View File

@@ -0,0 +1,894 @@
<?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>astalgo</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">astalgo</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="#TIdentIter" title="TIdentIter = object
h*: Hash
name*: PIdent">TIdentIter</a></li>
<li><a class="reference" href="#TIIPair" title="TIIPair {.final.} = object
key*, val*: int">TIIPair</a></li>
<li><a class="reference" href="#TIIPairSeq" title="TIIPairSeq = seq[TIIPair]">TIIPairSeq</a></li>
<li><a class="reference" href="#TIITable" title="TIITable {.final.} = object
counter*: int
data*: TIIPairSeq">TIITable</a></li>
<li><a class="reference" href="#TTabIter" title="TTabIter = object">TTabIter</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="#InvalidKey" title="InvalidKey = -9223372036854775808">InvalidKey</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="#%5B%5D%3D%2CTIdTable%5BT%5D%2CItemId%2CT" title="`[]=`[T](t: var TIdTable[T]; key: ItemId; val: T)">`[]=`[T](t: var TIdTable[T]; key: ItemId; val: T)</a></li>
</ul>
<ul class="simple nested-toc-section">debug
<li><a class="reference" href="#debug%2CPNode%2CConfigRef" title="debug(n: PNode; conf: ConfigRef = nil)">debug(n: PNode; conf: ConfigRef = nil)</a></li>
<li><a class="reference" href="#debug%2CPSym%2CConfigRef" title="debug(n: PSym; conf: ConfigRef = nil)">debug(n: PSym; conf: ConfigRef = nil)</a></li>
<li><a class="reference" href="#debug%2CPType%2CConfigRef" title="debug(n: PType; conf: ConfigRef = nil)">debug(n: PType; conf: ConfigRef = nil)</a></li>
</ul>
<ul class="simple nested-toc-section">firstIdentExcluding
<li><a class="reference" href="#firstIdentExcluding%2CTIdentIter%2CTStrTable%2CPIdent%2CIntSet" title="firstIdentExcluding(ti: var TIdentIter; tab: TStrTable; s: PIdent;
excluding: IntSet): PSym">firstIdentExcluding(ti: var TIdentIter; tab: TStrTable; s: PIdent;
excluding: IntSet): PSym</a></li>
</ul>
<ul class="simple nested-toc-section">fromSystem
<li><a class="reference" href="#fromSystem%2CPSym" title="fromSystem(op: PSym): bool">fromSystem(op: PSym): bool</a></li>
</ul>
<ul class="simple nested-toc-section">getModule
<li><a class="reference" href="#getModule%2CPSym" title="getModule(s: PSym): PSym">getModule(s: PSym): PSym</a></li>
</ul>
<ul class="simple nested-toc-section">getNamedParamFromList
<li><a class="reference" href="#getNamedParamFromList%2CPNode%2CPIdent" title="getNamedParamFromList(list: PNode; ident: PIdent): PSym">getNamedParamFromList(list: PNode; ident: PIdent): PSym</a></li>
</ul>
<ul class="simple nested-toc-section">getOrDefault
<li><a class="reference" href="#getOrDefault%2CTIdTable%5BT%5D%2CItemId" title="getOrDefault[T](t: TIdTable[T]; key: ItemId): T">getOrDefault[T](t: TIdTable[T]; key: ItemId): T</a></li>
</ul>
<ul class="simple nested-toc-section">getSymFromList
<li><a class="reference" href="#getSymFromList%2CPNode%2CPIdent%2Cint" title="getSymFromList(list: PNode; ident: PIdent; start: int = 0): PSym">getSymFromList(list: PNode; ident: PIdent; start: int = 0): PSym</a></li>
</ul>
<ul class="simple nested-toc-section">hashNode
<li><a class="reference" href="#hashNode%2CRootRef" title="hashNode(p: RootRef): Hash">hashNode(p: RootRef): Hash</a></li>
</ul>
<ul class="simple nested-toc-section">iiTableGet
<li><a class="reference" href="#iiTableGet%2CTIITable%2Cint" title="iiTableGet(t: TIITable; key: int): int">iiTableGet(t: TIITable; key: int): int</a></li>
</ul>
<ul class="simple nested-toc-section">iiTablePut
<li><a class="reference" href="#iiTablePut%2CTIITable%2Cint%2Cint" title="iiTablePut(t: var TIITable; key, val: int)">iiTablePut(t: var TIITable; key, val: int)</a></li>
</ul>
<ul class="simple nested-toc-section">initIdentIter
<li><a class="reference" href="#initIdentIter%2CTIdentIter%2CTStrTable%2CPIdent" title="initIdentIter(ti: var TIdentIter; tab: TStrTable; s: PIdent): PSym">initIdentIter(ti: var TIdentIter; tab: TStrTable; s: PIdent): PSym</a></li>
</ul>
<ul class="simple nested-toc-section">initIITable
<li><a class="reference" href="#initIITable%2CTIITable" title="initIITable(x: var TIITable)">initIITable(x: var TIITable)</a></li>
</ul>
<ul class="simple nested-toc-section">initTabIter
<li><a class="reference" href="#initTabIter%2CTTabIter%2CTStrTable" title="initTabIter(ti: var TTabIter; tab: TStrTable): PSym">initTabIter(ti: var TTabIter; tab: TStrTable): PSym</a></li>
</ul>
<ul class="simple nested-toc-section">isDiscriminantField
<li><a class="reference" href="#isDiscriminantField%2CPNode" title="isDiscriminantField(n: PNode): bool">isDiscriminantField(n: PNode): bool</a></li>
</ul>
<ul class="simple nested-toc-section">leValue
<li><a class="reference" href="#leValue%2CPNode%2CPNode" title="leValue(a, b: PNode): bool">leValue(a, b: PNode): bool</a></li>
</ul>
<ul class="simple nested-toc-section">listSymbolNames
<li><a class="reference" href="#listSymbolNames%2CopenArray%5BPSym%5D" title="listSymbolNames(symbols: openArray[PSym]): string">listSymbolNames(symbols: openArray[PSym]): string</a></li>
</ul>
<ul class="simple nested-toc-section">lookupInRecord
<li><a class="reference" href="#lookupInRecord%2CPNode%2CPIdent" title="lookupInRecord(n: PNode; field: PIdent): PSym">lookupInRecord(n: PNode; field: PIdent): PSym</a></li>
</ul>
<ul class="simple nested-toc-section">nextIdentExcluding
<li><a class="reference" href="#nextIdentExcluding%2CTIdentIter%2CTStrTable%2CIntSet" title="nextIdentExcluding(ti: var TIdentIter; tab: TStrTable; excluding: IntSet): PSym">nextIdentExcluding(ti: var TIdentIter; tab: TStrTable; excluding: IntSet): PSym</a></li>
</ul>
<ul class="simple nested-toc-section">nextIdentIter
<li><a class="reference" href="#nextIdentIter%2CTIdentIter%2CTStrTable" title="nextIdentIter(ti: var TIdentIter; tab: TStrTable): PSym">nextIdentIter(ti: var TIdentIter; tab: TStrTable): PSym</a></li>
</ul>
<ul class="simple nested-toc-section">nextIter
<li><a class="reference" href="#nextIter%2CTTabIter%2CTStrTable" title="nextIter(ti: var TTabIter; tab: TStrTable): PSym">nextIter(ti: var TTabIter; tab: TStrTable): PSym</a></li>
</ul>
<ul class="simple nested-toc-section">objectSetContains
<li><a class="reference" href="#objectSetContains%2CTObjectSet%2CRootRef" title="objectSetContains(t: TObjectSet; obj: RootRef): bool">objectSetContains(t: TObjectSet; obj: RootRef): bool</a></li>
</ul>
<ul class="simple nested-toc-section">objectSetContainsOrIncl
<li><a class="reference" href="#objectSetContainsOrIncl%2CTObjectSet%2CRootRef" title="objectSetContainsOrIncl(t: var TObjectSet; obj: RootRef): bool">objectSetContainsOrIncl(t: var TObjectSet; obj: RootRef): bool</a></li>
</ul>
<ul class="simple nested-toc-section">objectSetIncl
<li><a class="reference" href="#objectSetIncl%2CTObjectSet%2CRootRef" title="objectSetIncl(t: var TObjectSet; obj: RootRef)">objectSetIncl(t: var TObjectSet; obj: RootRef)</a></li>
</ul>
<ul class="simple nested-toc-section">sameValue
<li><a class="reference" href="#sameValue%2CPNode%2CPNode" title="sameValue(a, b: PNode): bool">sameValue(a, b: PNode): bool</a></li>
</ul>
<ul class="simple nested-toc-section">skipConvCastAndClosure
<li><a class="reference" href="#skipConvCastAndClosure%2CPNode" title="skipConvCastAndClosure(n: PNode): PNode">skipConvCastAndClosure(n: PNode): PNode</a></li>
</ul>
<ul class="simple nested-toc-section">weakLeValue
<li><a class="reference" href="#weakLeValue%2CPNode%2CPNode" title="weakLeValue(a, b: PNode): TImplication">weakLeValue(a, b: PNode): TImplication</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">idTablePairs
<li><a class="reference" href="#idTablePairs.i%2CTIdTable%5BT%5D" title="idTablePairs[T](t: TIdTable[T]): tuple[key: ItemId, val: T]">idTablePairs[T](t: TIdTable[T]): tuple[key: ItemId, val: T]</a></li>
</ul>
<ul class="simple nested-toc-section">items
<li><a class="reference" href="#items.i%2CTStrTable" title="items(tab: TStrTable): PSym">items(tab: TStrTable): 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">debug
<li><a class="reference" href="#debug.t%2Cauto" title="debug(x: auto)">debug(x: auto)</a></li>
<li><a class="reference" href="#debug.t" title="debug(x: PSym | PType | PNode)">debug(x: PSym | PType | PNode)</a></li>
</ul>
<ul class="simple nested-toc-section">idTableGet
<li><a class="reference" href="#idTableGet.t%2CTIdTable%5BT%5D%2C" title="idTableGet[T](t: TIdTable[T]; key: PType | PSym): T">idTableGet[T](t: TIdTable[T]; key: PType | PSym): T</a></li>
</ul>
<ul class="simple nested-toc-section">idTablePut
<li><a class="reference" href="#idTablePut.t%2CTIdTable%5BT%5D%2C%2CT" title="idTablePut[T](t: var TIdTable[T]; key: PType | PSym; val: T)">idTablePut[T](t: var TIdTable[T]; key: PType | PSym; val: T)</a></li>
</ul>
<ul class="simple nested-toc-section">mdbg
<li><a class="reference" href="#mdbg.t" title="mdbg(): bool">mdbg(): bool</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/compiler/astalgo.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.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="astyaml.html">astyaml</a>, <a class="reference external" href="options.html">options</a>, <a class="reference external" href="lineinfos.html">lineinfos</a>, <a class="reference external" href="idents.html">idents</a>, <a class="reference external" href="rodutils.html">rodutils</a>, <a class="reference external" href="msgs.html">msgs</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="TIdentIter">
<dt><pre><a href="astalgo.html#TIdentIter"><span class="Identifier">TIdentIter</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">h</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">Hash</span>
<span class="Identifier">name</span><span class="Operator">*</span><span class="Other">:</span> <a href="idents.html#PIdent"><span class="Identifier">PIdent</span></a></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astalgo.nim#L530" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L530" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="TIIPair">
<dt><pre><a href="astalgo.html#TIIPair"><span class="Identifier">TIIPair</span></a> {.<span class="Identifier">final</span>.} <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">key</span><span class="Operator">*</span><span class="Other">,</span> <span class="Identifier">val</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astalgo.nim#L77" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L77" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="TIIPairSeq">
<dt><pre><a href="astalgo.html#TIIPairSeq"><span class="Identifier">TIIPairSeq</span></a> <span class="Other">=</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="astalgo.html#TIIPair"><span class="Identifier">TIIPair</span></a><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astalgo.nim#L80" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L80" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="TIITable">
<dt><pre><a href="astalgo.html#TIITable"><span class="Identifier">TIITable</span></a> {.<span class="Identifier">final</span>.} <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">counter</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span>
<span class="Identifier">data</span><span class="Operator">*</span><span class="Other">:</span> <a href="astalgo.html#TIIPairSeq"><span class="Identifier">TIIPairSeq</span></a></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astalgo.nim#L81" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L81" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="TTabIter">
<dt><pre><a href="astalgo.html#TTabIter"><span class="Identifier">TTabIter</span></a> <span class="Other">=</span> <span class="Keyword">object</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astalgo.nim#L582" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L582" 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="InvalidKey">
<dt><pre><a href="astalgo.html#InvalidKey"><span class="Identifier">InvalidKey</span></a> <span class="Other">=</span> <span class="DecNumber">-9223372036854775808</span></pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astalgo.nim#L74" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L74" 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="[]=,TIdTable[T],ItemId,T">
<dt><pre><span class="Keyword">proc</span> <a href="#%5B%5D%3D%2CTIdTable%5BT%5D%2CItemId%2CT"><span class="Identifier">`[]=`</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="astdef.html#TIdTable"><span class="Identifier">TIdTable</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> <a href="astdef.html#ItemId"><span class="Identifier">ItemId</span></a><span class="Other">;</span> <span class="Identifier">val</span><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/compiler/astalgo.nim#L652" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L652" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="debug-procs-all">
<div id="debug,PNode,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#debug%2CPNode%2CConfigRef"><span class="Identifier">debug</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="astdef.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="Keyword">nil</span><span class="Other">)</span> {.<span class="Identifier">exportc</span><span class="Other">:</span> <span class="StringLit">&quot;debugNode&quot;</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">KeyError</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="Identifier">WriteIOEffect</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>
<div class="deprecation-message">
<b>Deprecated</b>
</div>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astalgo.nim#L32" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L32" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="debug,PSym,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#debug%2CPSym%2CConfigRef"><span class="Identifier">debug</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="astdef.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="Keyword">nil</span><span class="Other">)</span> {.<span class="Identifier">exportc</span><span class="Other">:</span> <span class="StringLit">&quot;debugSym&quot;</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">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="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="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>
<div class="deprecation-message">
<b>Deprecated</b>
</div>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astalgo.nim#L30" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L30" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="debug,PType,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#debug%2CPType%2CConfigRef"><span class="Identifier">debug</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="astdef.html#PType"><span class="Identifier">PType</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="Keyword">nil</span><span class="Other">)</span> {.<span class="Identifier">exportc</span><span class="Other">:</span> <span class="StringLit">&quot;debugType&quot;</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">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="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="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>
<div class="deprecation-message">
<b>Deprecated</b>
</div>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astalgo.nim#L31" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L31" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="firstIdentExcluding-procs-all">
<div id="firstIdentExcluding,TIdentIter,TStrTable,PIdent,IntSet">
<dt><pre><span class="Keyword">proc</span> <a href="#firstIdentExcluding%2CTIdentIter%2CTStrTable%2CPIdent%2CIntSet"><span class="Identifier">firstIdentExcluding</span></a><span class="Other">(</span><span class="Identifier">ti</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="astalgo.html#TIdentIter"><span class="Identifier">TIdentIter</span></a><span class="Other">;</span> <span class="Identifier">tab</span><span class="Other">:</span> <a href="astdef.html#TStrTable"><span class="Identifier">TStrTable</span></a><span class="Other">;</span> <span class="Identifier">s</span><span class="Other">:</span> <a href="idents.html#PIdent"><span class="Identifier">PIdent</span></a><span class="Other">;</span>
<span class="Identifier">excluding</span><span class="Other">:</span> <span class="Identifier">IntSet</span><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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/astalgo.nim#L574" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L574" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="fromSystem-procs-all">
<div id="fromSystem,PSym">
<dt><pre><span class="Keyword">proc</span> <a href="#fromSystem%2CPSym"><span class="Identifier">fromSystem</span></a><span class="Other">(</span><span class="Identifier">op</span><span class="Other">:</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<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="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="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="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/astalgo.nim#L164" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L164" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getModule-procs-all">
<div id="getModule,PSym">
<dt><pre><span class="Keyword">proc</span> <a href="#getModule%2CPSym"><span class="Identifier">getModule</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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">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="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="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/astalgo.nim#L159" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L159" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getNamedParamFromList-procs-all">
<div id="getNamedParamFromList,PNode,PIdent">
<dt><pre><span class="Keyword">proc</span> <a href="#getNamedParamFromList%2CPNode%2CPIdent"><span class="Identifier">getNamedParamFromList</span></a><span class="Other">(</span><span class="Identifier">list</span><span class="Other">:</span> <a href="astdef.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">;</span> <span class="Identifier">ident</span><span class="Other">:</span> <a href="idents.html#PIdent"><span class="Identifier">PIdent</span></a><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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>
<p>Named parameters are special because a named parameter can be gensym'ed and then they have '`&lt;number&gt;' suffix that we need to ignore, see compiler / evaltempl.nim, snippet:</p>
<p><pre class="listing"><span class="Identifier">result</span><span class="Operator">.</span><span class="Identifier">add</span> <span class="Identifier">newIdentNode</span><span class="Punctuation">(</span><span class="Identifier">getIdent</span><span class="Punctuation">(</span><span class="Identifier">c</span><span class="Operator">.</span><span class="Identifier">ic</span><span class="Punctuation">,</span> <span class="Identifier">x</span><span class="Operator">.</span><span class="Identifier">name</span><span class="Operator">.</span><span class="Identifier">s</span> <span class="Operator">&amp;</span> <span class="StringLit">&quot;</span><span class="EscapeSequence">\`</span><span class="StringLit">gensym&quot;</span> <span class="Operator">&amp;</span> <span class="Operator">$</span><span class="Identifier">x</span><span class="Operator">.</span><span class="Identifier">id</span><span class="Punctuation">)</span><span class="Punctuation">,</span>
<span class="Keyword">if</span> <span class="Identifier">c</span><span class="Operator">.</span><span class="Identifier">instLines</span><span class="Punctuation">:</span> <span class="Identifier">actual</span><span class="Operator">.</span><span class="Identifier">info</span> <span class="Keyword">else</span><span class="Punctuation">:</span> <span class="Identifier">templ</span><span class="Operator">.</span><span class="Identifier">info</span><span class="Punctuation">)</span></pre></p>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astalgo.nim#L200" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L200" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getOrDefault-procs-all">
<div id="getOrDefault,TIdTable[T],ItemId">
<dt><pre><span class="Keyword">proc</span> <a href="#getOrDefault%2CTIdTable%5BT%5D%2CItemId"><span class="Identifier">getOrDefault</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="astdef.html#TIdTable"><span class="Identifier">TIdTable</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> <a href="astdef.html#ItemId"><span class="Identifier">ItemId</span></a><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/compiler/astalgo.nim#L633" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L633" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getSymFromList-procs-all">
<div id="getSymFromList,PNode,PIdent,int">
<dt><pre><span class="Keyword">proc</span> <a href="#getSymFromList%2CPNode%2CPIdent%2Cint"><span class="Identifier">getSymFromList</span></a><span class="Other">(</span><span class="Identifier">list</span><span class="Other">:</span> <a href="astdef.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">;</span> <span class="Identifier">ident</span><span class="Other">:</span> <a href="idents.html#PIdent"><span class="Identifier">PIdent</span></a><span class="Other">;</span> <span class="Identifier">start</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="Other">:</span> <a href="astdef.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/astalgo.nim#L165" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L165" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="hashNode-procs-all">
<div id="hashNode,RootRef">
<dt><pre><span class="Keyword">proc</span> <a href="#hashNode%2CRootRef"><span class="Identifier">hashNode</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <span class="Identifier">RootRef</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Hash</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/astalgo.nim#L26" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L26" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="iiTableGet-procs-all">
<div id="iiTableGet,TIITable,int">
<dt><pre><span class="Keyword">proc</span> <a href="#iiTableGet%2CTIITable%2Cint"><span class="Identifier">iiTableGet</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="astalgo.html#TIITable"><span class="Identifier">TIITable</span></a><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <span class="Identifier">int</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/astalgo.nim#L87" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L87" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="iiTablePut-procs-all">
<div id="iiTablePut,TIITable,int,int">
<dt><pre><span class="Keyword">proc</span> <a href="#iiTablePut%2CTIITable%2Cint%2Cint"><span class="Identifier">iiTablePut</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="astalgo.html#TIITable"><span class="Identifier">TIITable</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="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/astalgo.nim#L88" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L88" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="initIdentIter-procs-all">
<div id="initIdentIter,TIdentIter,TStrTable,PIdent">
<dt><pre><span class="Keyword">proc</span> <a href="#initIdentIter%2CTIdentIter%2CTStrTable%2CPIdent"><span class="Identifier">initIdentIter</span></a><span class="Other">(</span><span class="Identifier">ti</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="astalgo.html#TIdentIter"><span class="Identifier">TIdentIter</span></a><span class="Other">;</span> <span class="Identifier">tab</span><span class="Other">:</span> <a href="astdef.html#TStrTable"><span class="Identifier">TStrTable</span></a><span class="Other">;</span> <span class="Identifier">s</span><span class="Other">:</span> <a href="idents.html#PIdent"><span class="Identifier">PIdent</span></a><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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/astalgo.nim#L552" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L552" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="initIITable-procs-all">
<div id="initIITable,TIITable">
<dt><pre><span class="Keyword">proc</span> <a href="#initIITable%2CTIITable"><span class="Identifier">initIITable</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="astalgo.html#TIITable"><span class="Identifier">TIITable</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/astalgo.nim#L86" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L86" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="initTabIter-procs-all">
<div id="initTabIter,TTabIter,TStrTable">
<dt><pre><span class="Keyword">proc</span> <a href="#initTabIter%2CTTabIter%2CTStrTable"><span class="Identifier">initTabIter</span></a><span class="Other">(</span><span class="Identifier">ti</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="astalgo.html#TTabIter"><span class="Identifier">TTabIter</span></a><span class="Other">;</span> <span class="Identifier">tab</span><span class="Other">:</span> <a href="astdef.html#TStrTable"><span class="Identifier">TStrTable</span></a><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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/astalgo.nim#L601" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L601" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="isDiscriminantField-procs-all">
<div id="isDiscriminantField,PNode">
<dt><pre><span class="Keyword">proc</span> <a href="#isDiscriminantField%2CPNode"><span class="Identifier">isDiscriminantField</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="astdef.html#PNode"><span class="Identifier">PNode</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">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="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="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/astalgo.nim#L731" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L731" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="leValue-procs-all">
<div id="leValue,PNode,PNode">
<dt><pre><span class="Keyword">proc</span> <a href="#leValue%2CPNode%2CPNode"><span class="Identifier">leValue</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="astdef.html#PNode"><span class="Identifier">PNode</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">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="Other">]</span><span 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/astalgo.nim#L117" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L117" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="listSymbolNames-procs-all">
<div id="listSymbolNames,openArray[PSym]">
<dt><pre><span class="Keyword">proc</span> <a href="#listSymbolNames%2CopenArray%5BPSym%5D"><span class="Identifier">listSymbolNames</span></a><span class="Other">(</span><span class="Identifier">symbols</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><a href="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">]</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/astalgo.nim#L724" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L724" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="lookupInRecord-procs-all">
<div id="lookupInRecord,PNode,PIdent">
<dt><pre><span class="Keyword">proc</span> <a href="#lookupInRecord%2CPNode%2CPIdent"><span class="Identifier">lookupInRecord</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="astdef.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <a href="idents.html#PIdent"><span class="Identifier">PIdent</span></a><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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/astalgo.nim#L70" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L70" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="nextIdentExcluding-procs-all">
<div id="nextIdentExcluding,TIdentIter,TStrTable,IntSet">
<dt><pre><span class="Keyword">proc</span> <a href="#nextIdentExcluding%2CTIdentIter%2CTStrTable%2CIntSet"><span class="Identifier">nextIdentExcluding</span></a><span class="Other">(</span><span class="Identifier">ti</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="astalgo.html#TIdentIter"><span class="Identifier">TIdentIter</span></a><span class="Other">;</span> <span class="Identifier">tab</span><span class="Other">:</span> <a href="astdef.html#TStrTable"><span class="Identifier">TStrTable</span></a><span class="Other">;</span> <span class="Identifier">excluding</span><span class="Other">:</span> <span class="Identifier">IntSet</span><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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/astalgo.nim#L558" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L558" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="nextIdentIter-procs-all">
<div id="nextIdentIter,TIdentIter,TStrTable">
<dt><pre><span class="Keyword">proc</span> <a href="#nextIdentIter%2CTIdentIter%2CTStrTable"><span class="Identifier">nextIdentIter</span></a><span class="Other">(</span><span class="Identifier">ti</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="astalgo.html#TIdentIter"><span class="Identifier">TIdentIter</span></a><span class="Other">;</span> <span class="Identifier">tab</span><span class="Other">:</span> <a href="astdef.html#TStrTable"><span class="Identifier">TStrTable</span></a><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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/astalgo.nim#L534" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L534" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="nextIter-procs-all">
<div id="nextIter,TTabIter,TStrTable">
<dt><pre><span class="Keyword">proc</span> <a href="#nextIter%2CTTabIter%2CTStrTable"><span class="Identifier">nextIter</span></a><span class="Other">(</span><span class="Identifier">ti</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="astalgo.html#TTabIter"><span class="Identifier">TTabIter</span></a><span class="Other">;</span> <span class="Identifier">tab</span><span class="Other">:</span> <a href="astdef.html#TStrTable"><span class="Identifier">TStrTable</span></a><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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/astalgo.nim#L585" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L585" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="objectSetContains-procs-all">
<div id="objectSetContains,TObjectSet,RootRef">
<dt><pre><span class="Keyword">proc</span> <a href="#objectSetContains%2CTObjectSet%2CRootRef"><span class="Identifier">objectSetContains</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="astdef.html#TObjectSet"><span class="Identifier">TObjectSet</span></a><span class="Other">;</span> <span class="Identifier">obj</span><span class="Other">:</span> <span class="Identifier">RootRef</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/astalgo.nim#L481" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L481" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="objectSetContainsOrIncl-procs-all">
<div id="objectSetContainsOrIncl,TObjectSet,RootRef">
<dt><pre><span class="Keyword">proc</span> <a href="#objectSetContainsOrIncl%2CTObjectSet%2CRootRef"><span class="Identifier">objectSetContainsOrIncl</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="astdef.html#TObjectSet"><span class="Identifier">TObjectSet</span></a><span class="Other">;</span> <span class="Identifier">obj</span><span class="Other">:</span> <span class="Identifier">RootRef</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/astalgo.nim#L510" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L510" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="objectSetIncl-procs-all">
<div id="objectSetIncl,TObjectSet,RootRef">
<dt><pre><span class="Keyword">proc</span> <a href="#objectSetIncl%2CTObjectSet%2CRootRef"><span class="Identifier">objectSetIncl</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="astdef.html#TObjectSet"><span class="Identifier">TObjectSet</span></a><span class="Other">;</span> <span class="Identifier">obj</span><span class="Other">:</span> <span class="Identifier">RootRef</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/astalgo.nim#L505" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L505" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="sameValue-procs-all">
<div id="sameValue,PNode,PNode">
<dt><pre><span class="Keyword">proc</span> <a href="#sameValue%2CPNode%2CPNode"><span class="Identifier">sameValue</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="astdef.html#PNode"><span class="Identifier">PNode</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">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="Other">]</span><span 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/astalgo.nim#L103" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L103" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="skipConvCastAndClosure-procs-all">
<div id="skipConvCastAndClosure,PNode">
<dt><pre><span class="Keyword">proc</span> <a href="#skipConvCastAndClosure%2CPNode"><span class="Identifier">skipConvCastAndClosure</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="astdef.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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/astalgo.nim#L92" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L92" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="weakLeValue-procs-all">
<div id="weakLeValue,PNode,PNode">
<dt><pre><span class="Keyword">proc</span> <a href="#weakLeValue%2CPNode%2CPNode"><span class="Identifier">weakLeValue</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="astdef.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="astdef.html#TImplication"><span class="Identifier">TImplication</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">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="Other">]</span><span 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/astalgo.nim#L132" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L132" 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="idTablePairs-iterators-all">
<div id="idTablePairs.i,TIdTable[T]">
<dt><pre><span class="Keyword">iterator</span> <a href="#idTablePairs.i%2CTIdTable%5BT%5D"><span class="Identifier">idTablePairs</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="astdef.html#TIdTable"><span class="Identifier">TIdTable</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">tuple</span><span class="Other">[</span><span class="Identifier">key</span><span class="Other">:</span> <a href="astdef.html#ItemId"><span class="Identifier">ItemId</span></a><span class="Other">,</span> <span class="Identifier">val</span><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/compiler/astalgo.nim#L674" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L674" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="items-iterators-all">
<div id="items.i,TStrTable">
<dt><pre><span class="Keyword">iterator</span> <a href="#items.i%2CTStrTable"><span class="Identifier">items</span></a><span class="Other">(</span><span class="Identifier">tab</span><span class="Other">:</span> <a href="astdef.html#TStrTable"><span class="Identifier">TStrTable</span></a><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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/astalgo.nim#L608" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L608" 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="debug-templates-all">
<div id="debug.t,auto">
<dt><pre><span class="Keyword">template</span> <a href="#debug.t%2Cauto"><span class="Identifier">debug</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Identifier">auto</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span></span>.}</pre></dt>
<dd>
<div class="deprecation-message">
<b>Deprecated</b>
</div>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astalgo.nim#L42" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L42" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="debug.t">
<dt><pre><span class="Keyword">template</span> <a href="#debug.t"><span class="Identifier">debug</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a> <span class="Operator">|</span> <a href="astdef.html#PType"><span class="Identifier">PType</span></a> <span class="Operator">|</span> <a href="astdef.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">deprecated</span></span>.}</pre></dt>
<dd>
<div class="deprecation-message">
<b>Deprecated</b>
</div>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astalgo.nim#L34" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L34" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="idTableGet-templates-all">
<div id="idTableGet.t,TIdTable[T],">
<dt><pre><span class="Keyword">template</span> <a href="#idTableGet.t%2CTIdTable%5BT%5D%2C"><span class="Identifier">idTableGet</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="astdef.html#TIdTable"><span class="Identifier">TIdTable</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> <a href="astdef.html#PType"><span class="Identifier">PType</span></a> <span class="Operator">|</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a><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/compiler/astalgo.nim#L638" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L638" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="idTablePut-templates-all">
<div id="idTablePut.t,TIdTable[T],,T">
<dt><pre><span class="Keyword">template</span> <a href="#idTablePut.t%2CTIdTable%5BT%5D%2C%2CT"><span class="Identifier">idTablePut</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="astdef.html#TIdTable"><span class="Identifier">TIdTable</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> <a href="astdef.html#PType"><span class="Identifier">PType</span></a> <span class="Operator">|</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span> <span class="Identifier">val</span><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/compiler/astalgo.nim#L671" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L671" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="mdbg-templates-all">
<div id="mdbg.t">
<dt><pre><span class="Keyword">template</span> <a href="#mdbg.t"><span class="Identifier">mdbg</span></a><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">deprecated</span></span>.}</pre></dt>
<dd>
<div class="deprecation-message">
<b>Deprecated</b>
</div>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/astalgo.nim#L45" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/astalgo.nim#L45" 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="astyaml.html#treeToYaml,ConfigRef,PNode,int,int"><span class="Identifier">treeToYaml</span></a>, <a href="astyaml.html#typeToYaml,ConfigRef,PType,int,int"><span class="Identifier">typeToYaml</span></a>, <a href="astyaml.html#symToYaml,ConfigRef,PSym,int,int"><span class="Identifier">symToYaml</span></a>, <a href="astyaml.html#lineInfoToStr,ConfigRef,TLineInfo"><span class="Identifier">lineInfoToStr</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-12-21 06:47:45 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

45
compiler/astalgo.idx Normal file
View File

@@ -0,0 +1,45 @@
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 InvalidKey astalgo.html#InvalidKey const InvalidKey 74
nim TIIPair astalgo.html#TIIPair object TIIPair 77
nim TIIPairSeq astalgo.html#TIIPairSeq type TIIPairSeq 80
nim TIITable astalgo.html#TIITable object TIITable 81
nim initIITable astalgo.html#initIITable,TIITable proc initIITable(x: var TIITable) 86
nim iiTableGet astalgo.html#iiTableGet,TIITable,int proc iiTableGet(t: TIITable; key: int): int 87
nim iiTablePut astalgo.html#iiTablePut,TIITable,int,int proc iiTablePut(t: var TIITable; key, val: int) 88
nim skipConvCastAndClosure astalgo.html#skipConvCastAndClosure,PNode proc skipConvCastAndClosure(n: PNode): PNode 92
nim sameValue astalgo.html#sameValue,PNode,PNode proc sameValue(a, b: PNode): bool 103
nim leValue astalgo.html#leValue,PNode,PNode proc leValue(a, b: PNode): bool 117
nim weakLeValue astalgo.html#weakLeValue,PNode,PNode proc weakLeValue(a, b: PNode): TImplication 132
nim getModule astalgo.html#getModule,PSym proc getModule(s: PSym): PSym 159
nim fromSystem astalgo.html#fromSystem,PSym proc fromSystem(op: PSym): bool 164
nim getSymFromList astalgo.html#getSymFromList,PNode,PIdent,int proc getSymFromList(list: PNode; ident: PIdent; start: int = 0): PSym 165
nim getNamedParamFromList astalgo.html#getNamedParamFromList,PNode,PIdent proc getNamedParamFromList(list: PNode; ident: PIdent): PSym 200
nim objectSetContains astalgo.html#objectSetContains,TObjectSet,RootRef proc objectSetContains(t: TObjectSet; obj: RootRef): bool 481
nim objectSetIncl astalgo.html#objectSetIncl,TObjectSet,RootRef proc objectSetIncl(t: var TObjectSet; obj: RootRef) 505
nim objectSetContainsOrIncl astalgo.html#objectSetContainsOrIncl,TObjectSet,RootRef proc objectSetContainsOrIncl(t: var TObjectSet; obj: RootRef): bool 510
nim TIdentIter astalgo.html#TIdentIter object TIdentIter 530
nim nextIdentIter astalgo.html#nextIdentIter,TIdentIter,TStrTable proc nextIdentIter(ti: var TIdentIter; tab: TStrTable): PSym 534
nim initIdentIter astalgo.html#initIdentIter,TIdentIter,TStrTable,PIdent proc initIdentIter(ti: var TIdentIter; tab: TStrTable; s: PIdent): PSym 552
nim nextIdentExcluding astalgo.html#nextIdentExcluding,TIdentIter,TStrTable,IntSet proc nextIdentExcluding(ti: var TIdentIter; tab: TStrTable; excluding: IntSet): PSym 558
nim firstIdentExcluding astalgo.html#firstIdentExcluding,TIdentIter,TStrTable,PIdent,IntSet proc firstIdentExcluding(ti: var TIdentIter; tab: TStrTable; s: PIdent;\n excluding: IntSet): PSym 574
nim TTabIter astalgo.html#TTabIter object TTabIter 582
nim nextIter astalgo.html#nextIter,TTabIter,TStrTable proc nextIter(ti: var TTabIter; tab: TStrTable): PSym 585
nim initTabIter astalgo.html#initTabIter,TTabIter,TStrTable proc initTabIter(ti: var TTabIter; tab: TStrTable): PSym 601
nim items astalgo.html#items.i,TStrTable iterator items(tab: TStrTable): PSym 608
nim getOrDefault astalgo.html#getOrDefault,TIdTable[T],ItemId proc getOrDefault[T](t: TIdTable[T]; key: ItemId): T 633
nim idTableGet astalgo.html#idTableGet.t,TIdTable[T], template idTableGet[T](t: TIdTable[T]; key: PType | PSym): T 638
nim `[]=` astalgo.html#[]=,TIdTable[T],ItemId,T proc `[]=`[T](t: var TIdTable[T]; key: ItemId; val: T) 652
nim idTablePut astalgo.html#idTablePut.t,TIdTable[T],,T template idTablePut[T](t: var TIdTable[T]; key: PType | PSym; val: T) 671
nim idTablePairs astalgo.html#idTablePairs.i,TIdTable[T] iterator idTablePairs[T](t: TIdTable[T]): tuple[key: ItemId, val: T] 674
nim listSymbolNames astalgo.html#listSymbolNames,openArray[PSym] proc listSymbolNames(symbols: openArray[PSym]): string 724
nim isDiscriminantField astalgo.html#isDiscriminantField,PNode proc isDiscriminantField(n: PNode): bool 731
nimgrp debug astalgo.html#debug-procs-all proc 30
nimgrp debug astalgo.html#debug-templates-all template 34

2522
compiler/astdef.html Normal file

File diff suppressed because one or more lines are too long

725
compiler/astdef.idx Normal file
View File

@@ -0,0 +1,725 @@
nimTitle astdef astdef.html module astdef 0
nim ccNimCall astdef.html#ccNimCall TCallingConvention.ccNimCall 25
nim ccStdCall astdef.html#ccStdCall TCallingConvention.ccStdCall 25
nim ccCDecl astdef.html#ccCDecl TCallingConvention.ccCDecl 25
nim ccSafeCall astdef.html#ccSafeCall TCallingConvention.ccSafeCall 25
nim ccSysCall astdef.html#ccSysCall TCallingConvention.ccSysCall 25
nim ccInline astdef.html#ccInline TCallingConvention.ccInline 25
nim ccNoInline astdef.html#ccNoInline TCallingConvention.ccNoInline 25
nim ccFastCall astdef.html#ccFastCall TCallingConvention.ccFastCall 25
nim ccThisCall astdef.html#ccThisCall TCallingConvention.ccThisCall 25
nim ccClosure astdef.html#ccClosure TCallingConvention.ccClosure 25
nim ccNoConvention astdef.html#ccNoConvention TCallingConvention.ccNoConvention 25
nim ccMember astdef.html#ccMember TCallingConvention.ccMember 25
nim TCallingConvention astdef.html#TCallingConvention enum TCallingConvention 25
nim TNodeKinds astdef.html#TNodeKinds type TNodeKinds 39
nim sfUsed astdef.html#sfUsed TSymFlag.sfUsed 42
nim sfExported astdef.html#sfExported TSymFlag.sfExported 42
nim sfFromGeneric astdef.html#sfFromGeneric TSymFlag.sfFromGeneric 42
nim sfGlobal astdef.html#sfGlobal TSymFlag.sfGlobal 42
nim sfForward astdef.html#sfForward TSymFlag.sfForward 42
nim sfWasForwarded astdef.html#sfWasForwarded TSymFlag.sfWasForwarded 42
nim sfImportc astdef.html#sfImportc TSymFlag.sfImportc 42
nim sfExportc astdef.html#sfExportc TSymFlag.sfExportc 42
nim sfMangleCpp astdef.html#sfMangleCpp TSymFlag.sfMangleCpp 42
nim sfVolatile astdef.html#sfVolatile TSymFlag.sfVolatile 42
nim sfRegister astdef.html#sfRegister TSymFlag.sfRegister 42
nim sfPure astdef.html#sfPure TSymFlag.sfPure 42
nim sfNoSideEffect astdef.html#sfNoSideEffect TSymFlag.sfNoSideEffect 42
nim sfSideEffect astdef.html#sfSideEffect TSymFlag.sfSideEffect 42
nim sfMainModule astdef.html#sfMainModule TSymFlag.sfMainModule 42
nim sfSystemModule astdef.html#sfSystemModule TSymFlag.sfSystemModule 42
nim sfNoReturn astdef.html#sfNoReturn TSymFlag.sfNoReturn 42
nim sfAddrTaken astdef.html#sfAddrTaken TSymFlag.sfAddrTaken 42
nim sfCompilerProc astdef.html#sfCompilerProc TSymFlag.sfCompilerProc 42
nim sfEscapes astdef.html#sfEscapes TSymFlag.sfEscapes 42
nim sfDiscriminant astdef.html#sfDiscriminant TSymFlag.sfDiscriminant 42
nim sfRequiresInit astdef.html#sfRequiresInit TSymFlag.sfRequiresInit 42
nim sfDeprecated astdef.html#sfDeprecated TSymFlag.sfDeprecated 42
nim sfExplain astdef.html#sfExplain TSymFlag.sfExplain 42
nim sfError astdef.html#sfError TSymFlag.sfError 42
nim sfShadowed astdef.html#sfShadowed TSymFlag.sfShadowed 42
nim sfThread astdef.html#sfThread TSymFlag.sfThread 42
nim sfCppNonPod astdef.html#sfCppNonPod TSymFlag.sfCppNonPod 42
nim sfCompileTime astdef.html#sfCompileTime TSymFlag.sfCompileTime 42
nim sfConstructor astdef.html#sfConstructor TSymFlag.sfConstructor 42
nim sfDispatcher astdef.html#sfDispatcher TSymFlag.sfDispatcher 42
nim sfBorrow astdef.html#sfBorrow TSymFlag.sfBorrow 42
nim sfInfixCall astdef.html#sfInfixCall TSymFlag.sfInfixCall 42
nim sfNamedParamCall astdef.html#sfNamedParamCall TSymFlag.sfNamedParamCall 42
nim sfDiscardable astdef.html#sfDiscardable TSymFlag.sfDiscardable 42
nim sfOverridden astdef.html#sfOverridden TSymFlag.sfOverridden 42
nim sfCallsite astdef.html#sfCallsite TSymFlag.sfCallsite 42
nim sfGenSym astdef.html#sfGenSym TSymFlag.sfGenSym 42
nim sfNonReloadable astdef.html#sfNonReloadable TSymFlag.sfNonReloadable 42
nim sfGeneratedOp astdef.html#sfGeneratedOp TSymFlag.sfGeneratedOp 42
nim sfTemplateParam astdef.html#sfTemplateParam TSymFlag.sfTemplateParam 42
nim sfCursor astdef.html#sfCursor TSymFlag.sfCursor 42
nim sfInjectDestructors astdef.html#sfInjectDestructors TSymFlag.sfInjectDestructors 42
nim sfNeverRaises astdef.html#sfNeverRaises TSymFlag.sfNeverRaises 42
nim sfSystemRaisesDefect astdef.html#sfSystemRaisesDefect TSymFlag.sfSystemRaisesDefect 42
nim sfUsedInFinallyOrExcept astdef.html#sfUsedInFinallyOrExcept TSymFlag.sfUsedInFinallyOrExcept 42
nim sfSingleUsedTemp astdef.html#sfSingleUsedTemp TSymFlag.sfSingleUsedTemp 42
nim sfNoalias astdef.html#sfNoalias TSymFlag.sfNoalias 42
nim sfEffectsDelayed astdef.html#sfEffectsDelayed TSymFlag.sfEffectsDelayed 42
nim sfGeneratedType astdef.html#sfGeneratedType TSymFlag.sfGeneratedType 42
nim sfVirtual astdef.html#sfVirtual TSymFlag.sfVirtual 42
nim sfByCopy astdef.html#sfByCopy TSymFlag.sfByCopy 42
nim sfMember astdef.html#sfMember TSymFlag.sfMember 42
nim sfCodegenDecl astdef.html#sfCodegenDecl TSymFlag.sfCodegenDecl 42
nim sfWasGenSym astdef.html#sfWasGenSym TSymFlag.sfWasGenSym 42
nim sfForceLift astdef.html#sfForceLift TSymFlag.sfForceLift 42
nim sfDirty astdef.html#sfDirty TSymFlag.sfDirty 42
nim sfCustomPragma astdef.html#sfCustomPragma TSymFlag.sfCustomPragma 42
nim sfBase astdef.html#sfBase TSymFlag.sfBase 42
nim sfGoto astdef.html#sfGoto TSymFlag.sfGoto 42
nim sfAnon astdef.html#sfAnon TSymFlag.sfAnon 42
nim sfAllUntyped astdef.html#sfAllUntyped TSymFlag.sfAllUntyped 42
nim sfTemplateRedefinition astdef.html#sfTemplateRedefinition TSymFlag.sfTemplateRedefinition 42
nim TSymFlag astdef.html#TSymFlag enum TSymFlag 42
nim TSymFlags astdef.html#TSymFlags type TSymFlags 141
nim sfNoInit astdef.html#sfNoInit const sfNoInit 144
nim sfNoForward astdef.html#sfNoForward const sfNoForward 146
nim sfReorder astdef.html#sfReorder const sfReorder 148
nim sfCompileToCpp astdef.html#sfCompileToCpp const sfCompileToCpp 151
nim sfCompileToObjc astdef.html#sfCompileToObjc const sfCompileToObjc 152
nim sfExperimental astdef.html#sfExperimental const sfExperimental 153
nim sfWrittenTo astdef.html#sfWrittenTo const sfWrittenTo 154
nim sfCppMember astdef.html#sfCppMember const sfCppMember 156
nim nkWhen astdef.html#nkWhen const nkWhen 160
nim nkWhenExpr astdef.html#nkWhenExpr const nkWhenExpr 161
nim nkEffectList astdef.html#nkEffectList const nkEffectList 162
nim exceptionEffects astdef.html#exceptionEffects const exceptionEffects 164
nim requiresEffects astdef.html#requiresEffects const requiresEffects 165
nim ensuresEffects astdef.html#ensuresEffects const ensuresEffects 166
nim tagEffects astdef.html#tagEffects const tagEffects 167
nim pragmasEffects astdef.html#pragmasEffects const pragmasEffects 168
nim forbiddenEffects astdef.html#forbiddenEffects const forbiddenEffects 169
nim effectListLen astdef.html#effectListLen const effectListLen 170
nim nkLastBlockStmts astdef.html#nkLastBlockStmts const nkLastBlockStmts 171
nim tyNone astdef.html#tyNone TTypeKind.tyNone 175
nim tyBool astdef.html#tyBool TTypeKind.tyBool 175
nim tyChar astdef.html#tyChar TTypeKind.tyChar 175
nim tyEmpty astdef.html#tyEmpty TTypeKind.tyEmpty 175
nim tyAlias astdef.html#tyAlias TTypeKind.tyAlias 175
nim tyNil astdef.html#tyNil TTypeKind.tyNil 175
nim tyUntyped astdef.html#tyUntyped TTypeKind.tyUntyped 175
nim tyTyped astdef.html#tyTyped TTypeKind.tyTyped 175
nim tyTypeDesc astdef.html#tyTypeDesc TTypeKind.tyTypeDesc 175
nim tyGenericInvocation astdef.html#tyGenericInvocation TTypeKind.tyGenericInvocation 175
nim tyGenericBody astdef.html#tyGenericBody TTypeKind.tyGenericBody 175
nim tyGenericInst astdef.html#tyGenericInst TTypeKind.tyGenericInst 175
nim tyGenericParam astdef.html#tyGenericParam TTypeKind.tyGenericParam 175
nim tyDistinct astdef.html#tyDistinct TTypeKind.tyDistinct 175
nim tyEnum astdef.html#tyEnum TTypeKind.tyEnum 175
nim tyOrdinal astdef.html#tyOrdinal TTypeKind.tyOrdinal 175
nim tyArray astdef.html#tyArray TTypeKind.tyArray 175
nim tyObject astdef.html#tyObject TTypeKind.tyObject 175
nim tyTuple astdef.html#tyTuple TTypeKind.tyTuple 175
nim tySet astdef.html#tySet TTypeKind.tySet 175
nim tyRange astdef.html#tyRange TTypeKind.tyRange 175
nim tyPtr astdef.html#tyPtr TTypeKind.tyPtr 175
nim tyRef astdef.html#tyRef TTypeKind.tyRef 175
nim tyVar astdef.html#tyVar TTypeKind.tyVar 175
nim tySequence astdef.html#tySequence TTypeKind.tySequence 175
nim tyProc astdef.html#tyProc TTypeKind.tyProc 175
nim tyPointer astdef.html#tyPointer TTypeKind.tyPointer 175
nim tyOpenArray astdef.html#tyOpenArray TTypeKind.tyOpenArray 175
nim tyString astdef.html#tyString TTypeKind.tyString 175
nim tyCstring astdef.html#tyCstring TTypeKind.tyCstring 175
nim tyForward astdef.html#tyForward TTypeKind.tyForward 175
nim tyInt astdef.html#tyInt TTypeKind.tyInt 175
nim tyInt8 astdef.html#tyInt8 TTypeKind.tyInt8 175
nim tyInt16 astdef.html#tyInt16 TTypeKind.tyInt16 175
nim tyInt32 astdef.html#tyInt32 TTypeKind.tyInt32 175
nim tyInt64 astdef.html#tyInt64 TTypeKind.tyInt64 175
nim tyFloat astdef.html#tyFloat TTypeKind.tyFloat 175
nim tyFloat32 astdef.html#tyFloat32 TTypeKind.tyFloat32 175
nim tyFloat64 astdef.html#tyFloat64 TTypeKind.tyFloat64 175
nim tyFloat128 astdef.html#tyFloat128 TTypeKind.tyFloat128 175
nim tyUInt astdef.html#tyUInt TTypeKind.tyUInt 175
nim tyUInt8 astdef.html#tyUInt8 TTypeKind.tyUInt8 175
nim tyUInt16 astdef.html#tyUInt16 TTypeKind.tyUInt16 175
nim tyUInt32 astdef.html#tyUInt32 TTypeKind.tyUInt32 175
nim tyUInt64 astdef.html#tyUInt64 TTypeKind.tyUInt64 175
nim tyOwned astdef.html#tyOwned TTypeKind.tyOwned 175
nim tySink astdef.html#tySink TTypeKind.tySink 175
nim tyLent astdef.html#tyLent TTypeKind.tyLent 175
nim tyVarargs astdef.html#tyVarargs TTypeKind.tyVarargs 175
nim tyUncheckedArray astdef.html#tyUncheckedArray TTypeKind.tyUncheckedArray 175
nim tyError astdef.html#tyError TTypeKind.tyError 175
nim tyBuiltInTypeClass astdef.html#tyBuiltInTypeClass TTypeKind.tyBuiltInTypeClass 175
nim tyUserTypeClass astdef.html#tyUserTypeClass TTypeKind.tyUserTypeClass 175
nim tyUserTypeClassInst astdef.html#tyUserTypeClassInst TTypeKind.tyUserTypeClassInst 175
nim tyCompositeTypeClass astdef.html#tyCompositeTypeClass TTypeKind.tyCompositeTypeClass 175
nim tyInferred astdef.html#tyInferred TTypeKind.tyInferred 175
nim tyAnd astdef.html#tyAnd TTypeKind.tyAnd 175
nim tyOr astdef.html#tyOr TTypeKind.tyOr 175
nim tyNot astdef.html#tyNot TTypeKind.tyNot 175
nim tyAnything astdef.html#tyAnything TTypeKind.tyAnything 175
nim tyStatic astdef.html#tyStatic TTypeKind.tyStatic 175
nim tyFromExpr astdef.html#tyFromExpr TTypeKind.tyFromExpr 175
nim tyConcept astdef.html#tyConcept TTypeKind.tyConcept 175
nim tyVoid astdef.html#tyVoid TTypeKind.tyVoid 175
nim tyIterable astdef.html#tyIterable TTypeKind.tyIterable 175
nim TTypeKind astdef.html#TTypeKind enum TTypeKind 175
nim tyPureObject astdef.html#tyPureObject const tyPureObject 276
nim GcTypeKinds astdef.html#GcTypeKinds const GcTypeKinds 277
nim tyTypeClasses astdef.html#tyTypeClasses const tyTypeClasses 279
nim tyMetaTypes astdef.html#tyMetaTypes const tyMetaTypes 283
nim tyUserTypeClasses astdef.html#tyUserTypeClasses const tyUserTypeClasses 284
nim abstractVarRange astdef.html#abstractVarRange const abstractVarRange 286
nim abstractInst astdef.html#abstractInst const abstractInst 288
nim TTypeKinds astdef.html#TTypeKinds type TTypeKinds 292
nim nfNone astdef.html#nfNone TNodeFlag.nfNone 294
nim nfBase2 astdef.html#nfBase2 TNodeFlag.nfBase2 294
nim nfBase8 astdef.html#nfBase8 TNodeFlag.nfBase8 294
nim nfBase16 astdef.html#nfBase16 TNodeFlag.nfBase16 294
nim nfAllConst astdef.html#nfAllConst TNodeFlag.nfAllConst 294
nim nfTransf astdef.html#nfTransf TNodeFlag.nfTransf 294
nim nfNoRewrite astdef.html#nfNoRewrite TNodeFlag.nfNoRewrite 294
nim nfSem astdef.html#nfSem TNodeFlag.nfSem 294
nim nfLL astdef.html#nfLL TNodeFlag.nfLL 294
nim nfDotField astdef.html#nfDotField TNodeFlag.nfDotField 294
nim nfDotSetter astdef.html#nfDotSetter TNodeFlag.nfDotSetter 294
nim nfExplicitCall astdef.html#nfExplicitCall TNodeFlag.nfExplicitCall 294
nim nfExprCall astdef.html#nfExprCall TNodeFlag.nfExprCall 294
nim nfIsRef astdef.html#nfIsRef TNodeFlag.nfIsRef 294
nim nfIsPtr astdef.html#nfIsPtr TNodeFlag.nfIsPtr 294
nim nfPreventCg astdef.html#nfPreventCg TNodeFlag.nfPreventCg 294
nim nfBlockArg astdef.html#nfBlockArg TNodeFlag.nfBlockArg 294
nim nfFromTemplate astdef.html#nfFromTemplate TNodeFlag.nfFromTemplate 294
nim nfDefaultParam astdef.html#nfDefaultParam TNodeFlag.nfDefaultParam 294
nim nfDefaultRefsParam astdef.html#nfDefaultRefsParam TNodeFlag.nfDefaultRefsParam 294
nim nfExecuteOnReload astdef.html#nfExecuteOnReload TNodeFlag.nfExecuteOnReload 294
nim nfLastRead astdef.html#nfLastRead TNodeFlag.nfLastRead 294
nim nfFirstWrite astdef.html#nfFirstWrite TNodeFlag.nfFirstWrite 294
nim nfHasComment astdef.html#nfHasComment TNodeFlag.nfHasComment 294
nim nfSkipFieldChecking astdef.html#nfSkipFieldChecking TNodeFlag.nfSkipFieldChecking 294
nim nfDisabledOpenSym astdef.html#nfDisabledOpenSym TNodeFlag.nfDisabledOpenSym 294
nim nfLazyType astdef.html#nfLazyType TNodeFlag.nfLazyType 294
nim TNodeFlag astdef.html#TNodeFlag enum TNodeFlag 294
nim TNodeFlags astdef.html#TNodeFlags type TNodeFlags 328
nim tfVarargs astdef.html#tfVarargs TTypeFlag.tfVarargs 329
nim tfNoSideEffect astdef.html#tfNoSideEffect TTypeFlag.tfNoSideEffect 329
nim tfFinal astdef.html#tfFinal TTypeFlag.tfFinal 329
nim tfInheritable astdef.html#tfInheritable TTypeFlag.tfInheritable 329
nim tfHasOwned astdef.html#tfHasOwned TTypeFlag.tfHasOwned 329
nim tfEnumHasHoles astdef.html#tfEnumHasHoles TTypeFlag.tfEnumHasHoles 329
nim tfShallow astdef.html#tfShallow TTypeFlag.tfShallow 329
nim tfThread astdef.html#tfThread TTypeFlag.tfThread 329
nim tfFromGeneric astdef.html#tfFromGeneric TTypeFlag.tfFromGeneric 329
nim tfUnresolved astdef.html#tfUnresolved TTypeFlag.tfUnresolved 329
nim tfResolved astdef.html#tfResolved TTypeFlag.tfResolved 329
nim tfRetType astdef.html#tfRetType TTypeFlag.tfRetType 329
nim tfCapturesEnv astdef.html#tfCapturesEnv TTypeFlag.tfCapturesEnv 329
nim tfByCopy astdef.html#tfByCopy TTypeFlag.tfByCopy 329
nim tfByRef astdef.html#tfByRef TTypeFlag.tfByRef 329
nim tfIterator astdef.html#tfIterator TTypeFlag.tfIterator 329
nim tfPartial astdef.html#tfPartial TTypeFlag.tfPartial 329
nim tfNotNil astdef.html#tfNotNil TTypeFlag.tfNotNil 329
nim tfRequiresInit astdef.html#tfRequiresInit TTypeFlag.tfRequiresInit 329
nim tfNeedsFullInit astdef.html#tfNeedsFullInit TTypeFlag.tfNeedsFullInit 329
nim tfVarIsPtr astdef.html#tfVarIsPtr TTypeFlag.tfVarIsPtr 329
nim tfHasMeta astdef.html#tfHasMeta TTypeFlag.tfHasMeta 329
nim tfHasGCedMem astdef.html#tfHasGCedMem TTypeFlag.tfHasGCedMem 329
nim tfPacked astdef.html#tfPacked TTypeFlag.tfPacked 329
nim tfHasStatic astdef.html#tfHasStatic TTypeFlag.tfHasStatic 329
nim tfGenericTypeParam astdef.html#tfGenericTypeParam TTypeFlag.tfGenericTypeParam 329
nim tfImplicitTypeParam astdef.html#tfImplicitTypeParam TTypeFlag.tfImplicitTypeParam 329
nim tfInferrableStatic astdef.html#tfInferrableStatic TTypeFlag.tfInferrableStatic 329
nim tfConceptMatchedTypeSym astdef.html#tfConceptMatchedTypeSym TTypeFlag.tfConceptMatchedTypeSym 329
nim tfExplicit astdef.html#tfExplicit TTypeFlag.tfExplicit 329
nim tfWildcard astdef.html#tfWildcard TTypeFlag.tfWildcard 329
nim tfHasAsgn astdef.html#tfHasAsgn TTypeFlag.tfHasAsgn 329
nim tfBorrowDot astdef.html#tfBorrowDot TTypeFlag.tfBorrowDot 329
nim tfTriggersCompileTime astdef.html#tfTriggersCompileTime TTypeFlag.tfTriggersCompileTime 329
nim tfRefsAnonObj astdef.html#tfRefsAnonObj TTypeFlag.tfRefsAnonObj 329
nim tfCovariant astdef.html#tfCovariant TTypeFlag.tfCovariant 329
nim tfWeakCovariant astdef.html#tfWeakCovariant TTypeFlag.tfWeakCovariant 329
nim tfContravariant astdef.html#tfContravariant TTypeFlag.tfContravariant 329
nim tfCheckedForDestructor astdef.html#tfCheckedForDestructor TTypeFlag.tfCheckedForDestructor 329
nim tfAcyclic astdef.html#tfAcyclic TTypeFlag.tfAcyclic 329
nim tfIncompleteStruct astdef.html#tfIncompleteStruct TTypeFlag.tfIncompleteStruct 329
nim tfCompleteStruct astdef.html#tfCompleteStruct TTypeFlag.tfCompleteStruct 329
nim tfExplicitCallConv astdef.html#tfExplicitCallConv TTypeFlag.tfExplicitCallConv 329
nim tfIsConstructor astdef.html#tfIsConstructor TTypeFlag.tfIsConstructor 329
nim tfEffectSystemWorkaround astdef.html#tfEffectSystemWorkaround TTypeFlag.tfEffectSystemWorkaround 329
nim tfIsOutParam astdef.html#tfIsOutParam TTypeFlag.tfIsOutParam 329
nim tfSendable astdef.html#tfSendable TTypeFlag.tfSendable 329
nim tfImplicitStatic astdef.html#tfImplicitStatic TTypeFlag.tfImplicitStatic 329
nim TTypeFlag astdef.html#TTypeFlag enum TTypeFlag 329
nim TTypeFlags astdef.html#TTypeFlags type TTypeFlags 402
nim skUnknown astdef.html#skUnknown TSymKind.skUnknown 404
nim skConditional astdef.html#skConditional TSymKind.skConditional 404
nim skDynLib astdef.html#skDynLib TSymKind.skDynLib 404
nim skParam astdef.html#skParam TSymKind.skParam 404
nim skGenericParam astdef.html#skGenericParam TSymKind.skGenericParam 404
nim skTemp astdef.html#skTemp TSymKind.skTemp 404
nim skModule astdef.html#skModule TSymKind.skModule 404
nim skType astdef.html#skType TSymKind.skType 404
nim skVar astdef.html#skVar TSymKind.skVar 404
nim skLet astdef.html#skLet TSymKind.skLet 404
nim skConst astdef.html#skConst TSymKind.skConst 404
nim skResult astdef.html#skResult TSymKind.skResult 404
nim skProc astdef.html#skProc TSymKind.skProc 404
nim skFunc astdef.html#skFunc TSymKind.skFunc 404
nim skMethod astdef.html#skMethod TSymKind.skMethod 404
nim skIterator astdef.html#skIterator TSymKind.skIterator 404
nim skConverter astdef.html#skConverter TSymKind.skConverter 404
nim skMacro astdef.html#skMacro TSymKind.skMacro 404
nim skTemplate astdef.html#skTemplate TSymKind.skTemplate 404
nim skField astdef.html#skField TSymKind.skField 404
nim skEnumField astdef.html#skEnumField TSymKind.skEnumField 404
nim skForVar astdef.html#skForVar TSymKind.skForVar 404
nim skLabel astdef.html#skLabel TSymKind.skLabel 404
nim skStub astdef.html#skStub TSymKind.skStub 404
nim skPackage astdef.html#skPackage TSymKind.skPackage 404
nim TSymKind astdef.html#TSymKind enum TSymKind 404
nim TSymKinds astdef.html#TSymKinds type TSymKinds 436
nim routineKinds astdef.html#routineKinds const routineKinds 439
nim ExportableSymKinds astdef.html#ExportableSymKinds const ExportableSymKinds 441
nim tfUnion astdef.html#tfUnion const tfUnion 443
nim tfGcSafe astdef.html#tfGcSafe const tfGcSafe 444
nim tfObjHasKids astdef.html#tfObjHasKids const tfObjHasKids 445
nim tfReturnsNew astdef.html#tfReturnsNew const tfReturnsNew 446
nim tfNonConstExpr astdef.html#tfNonConstExpr const tfNonConstExpr 447
nim tfGenericHasDestructor astdef.html#tfGenericHasDestructor const tfGenericHasDestructor 449
nim skError astdef.html#skError const skError 451
nim eqTypeFlags astdef.html#eqTypeFlags var eqTypeFlags 454
nim mNone astdef.html#mNone TMagic.mNone 460
nim mDefined astdef.html#mDefined TMagic.mDefined 460
nim mDeclared astdef.html#mDeclared TMagic.mDeclared 460
nim mDeclaredInScope astdef.html#mDeclaredInScope TMagic.mDeclaredInScope 460
nim mCompiles astdef.html#mCompiles TMagic.mCompiles 460
nim mArrGet astdef.html#mArrGet TMagic.mArrGet 460
nim mArrPut astdef.html#mArrPut TMagic.mArrPut 460
nim mAsgn astdef.html#mAsgn TMagic.mAsgn 460
nim mLow astdef.html#mLow TMagic.mLow 460
nim mHigh astdef.html#mHigh TMagic.mHigh 460
nim mSizeOf astdef.html#mSizeOf TMagic.mSizeOf 460
nim mAlignOf astdef.html#mAlignOf TMagic.mAlignOf 460
nim mOffsetOf astdef.html#mOffsetOf TMagic.mOffsetOf 460
nim mTypeTrait astdef.html#mTypeTrait TMagic.mTypeTrait 460
nim mIs astdef.html#mIs TMagic.mIs 460
nim mOf astdef.html#mOf TMagic.mOf 460
nim mAddr astdef.html#mAddr TMagic.mAddr 460
nim mType astdef.html#mType TMagic.mType 460
nim mTypeOf astdef.html#mTypeOf TMagic.mTypeOf 460
nim mPlugin astdef.html#mPlugin TMagic.mPlugin 460
nim mEcho astdef.html#mEcho TMagic.mEcho 460
nim mShallowCopy astdef.html#mShallowCopy TMagic.mShallowCopy 460
nim mSlurp astdef.html#mSlurp TMagic.mSlurp 460
nim mStaticExec astdef.html#mStaticExec TMagic.mStaticExec 460
nim mStatic astdef.html#mStatic TMagic.mStatic 460
nim mParseExprToAst astdef.html#mParseExprToAst TMagic.mParseExprToAst 460
nim mParseStmtToAst astdef.html#mParseStmtToAst TMagic.mParseStmtToAst 460
nim mExpandToAst astdef.html#mExpandToAst TMagic.mExpandToAst 460
nim mQuoteAst astdef.html#mQuoteAst TMagic.mQuoteAst 460
nim mInc astdef.html#mInc TMagic.mInc 460
nim mDec astdef.html#mDec TMagic.mDec 460
nim mOrd astdef.html#mOrd TMagic.mOrd 460
nim mNew astdef.html#mNew TMagic.mNew 460
nim mNewFinalize astdef.html#mNewFinalize TMagic.mNewFinalize 460
nim mNewSeq astdef.html#mNewSeq TMagic.mNewSeq 460
nim mNewSeqOfCap astdef.html#mNewSeqOfCap TMagic.mNewSeqOfCap 460
nim mLengthOpenArray astdef.html#mLengthOpenArray TMagic.mLengthOpenArray 460
nim mLengthStr astdef.html#mLengthStr TMagic.mLengthStr 460
nim mLengthArray astdef.html#mLengthArray TMagic.mLengthArray 460
nim mLengthSeq astdef.html#mLengthSeq TMagic.mLengthSeq 460
nim mIncl astdef.html#mIncl TMagic.mIncl 460
nim mExcl astdef.html#mExcl TMagic.mExcl 460
nim mCard astdef.html#mCard TMagic.mCard 460
nim mChr astdef.html#mChr TMagic.mChr 460
nim mGCref astdef.html#mGCref TMagic.mGCref 460
nim mGCunref astdef.html#mGCunref TMagic.mGCunref 460
nim mAddI astdef.html#mAddI TMagic.mAddI 460
nim mSubI astdef.html#mSubI TMagic.mSubI 460
nim mMulI astdef.html#mMulI TMagic.mMulI 460
nim mDivI astdef.html#mDivI TMagic.mDivI 460
nim mModI astdef.html#mModI TMagic.mModI 460
nim mSucc astdef.html#mSucc TMagic.mSucc 460
nim mPred astdef.html#mPred TMagic.mPred 460
nim mAddF64 astdef.html#mAddF64 TMagic.mAddF64 460
nim mSubF64 astdef.html#mSubF64 TMagic.mSubF64 460
nim mMulF64 astdef.html#mMulF64 TMagic.mMulF64 460
nim mDivF64 astdef.html#mDivF64 TMagic.mDivF64 460
nim mShrI astdef.html#mShrI TMagic.mShrI 460
nim mShlI astdef.html#mShlI TMagic.mShlI 460
nim mAshrI astdef.html#mAshrI TMagic.mAshrI 460
nim mBitandI astdef.html#mBitandI TMagic.mBitandI 460
nim mBitorI astdef.html#mBitorI TMagic.mBitorI 460
nim mBitxorI astdef.html#mBitxorI TMagic.mBitxorI 460
nim mMinI astdef.html#mMinI TMagic.mMinI 460
nim mMaxI astdef.html#mMaxI TMagic.mMaxI 460
nim mAddU astdef.html#mAddU TMagic.mAddU 460
nim mSubU astdef.html#mSubU TMagic.mSubU 460
nim mMulU astdef.html#mMulU TMagic.mMulU 460
nim mDivU astdef.html#mDivU TMagic.mDivU 460
nim mModU astdef.html#mModU TMagic.mModU 460
nim mEqI astdef.html#mEqI TMagic.mEqI 460
nim mLeI astdef.html#mLeI TMagic.mLeI 460
nim mLtI astdef.html#mLtI TMagic.mLtI 460
nim mEqF64 astdef.html#mEqF64 TMagic.mEqF64 460
nim mLeF64 astdef.html#mLeF64 TMagic.mLeF64 460
nim mLtF64 astdef.html#mLtF64 TMagic.mLtF64 460
nim mLeU astdef.html#mLeU TMagic.mLeU 460
nim mLtU astdef.html#mLtU TMagic.mLtU 460
nim mEqEnum astdef.html#mEqEnum TMagic.mEqEnum 460
nim mLeEnum astdef.html#mLeEnum TMagic.mLeEnum 460
nim mLtEnum astdef.html#mLtEnum TMagic.mLtEnum 460
nim mEqCh astdef.html#mEqCh TMagic.mEqCh 460
nim mLeCh astdef.html#mLeCh TMagic.mLeCh 460
nim mLtCh astdef.html#mLtCh TMagic.mLtCh 460
nim mEqB astdef.html#mEqB TMagic.mEqB 460
nim mLeB astdef.html#mLeB TMagic.mLeB 460
nim mLtB astdef.html#mLtB TMagic.mLtB 460
nim mEqRef astdef.html#mEqRef TMagic.mEqRef 460
nim mLePtr astdef.html#mLePtr TMagic.mLePtr 460
nim mLtPtr astdef.html#mLtPtr TMagic.mLtPtr 460
nim mXor astdef.html#mXor TMagic.mXor 460
nim mEqCString astdef.html#mEqCString TMagic.mEqCString 460
nim mEqProc astdef.html#mEqProc TMagic.mEqProc 460
nim mUnaryMinusI astdef.html#mUnaryMinusI TMagic.mUnaryMinusI 460
nim mUnaryMinusI64 astdef.html#mUnaryMinusI64 TMagic.mUnaryMinusI64 460
nim mAbsI astdef.html#mAbsI TMagic.mAbsI 460
nim mNot astdef.html#mNot TMagic.mNot 460
nim mUnaryPlusI astdef.html#mUnaryPlusI TMagic.mUnaryPlusI 460
nim mBitnotI astdef.html#mBitnotI TMagic.mBitnotI 460
nim mUnaryPlusF64 astdef.html#mUnaryPlusF64 TMagic.mUnaryPlusF64 460
nim mUnaryMinusF64 astdef.html#mUnaryMinusF64 TMagic.mUnaryMinusF64 460
nim mCharToStr astdef.html#mCharToStr TMagic.mCharToStr 460
nim mBoolToStr astdef.html#mBoolToStr TMagic.mBoolToStr 460
nim mCStrToStr astdef.html#mCStrToStr TMagic.mCStrToStr 460
nim mStrToStr astdef.html#mStrToStr TMagic.mStrToStr 460
nim mEnumToStr astdef.html#mEnumToStr TMagic.mEnumToStr 460
nim mAnd astdef.html#mAnd TMagic.mAnd 460
nim mOr astdef.html#mOr TMagic.mOr 460
nim mImplies astdef.html#mImplies TMagic.mImplies 460
nim mIff astdef.html#mIff TMagic.mIff 460
nim mExists astdef.html#mExists TMagic.mExists 460
nim mForall astdef.html#mForall TMagic.mForall 460
nim mOld astdef.html#mOld TMagic.mOld 460
nim mEqStr astdef.html#mEqStr TMagic.mEqStr 460
nim mLeStr astdef.html#mLeStr TMagic.mLeStr 460
nim mLtStr astdef.html#mLtStr TMagic.mLtStr 460
nim mEqSet astdef.html#mEqSet TMagic.mEqSet 460
nim mLeSet astdef.html#mLeSet TMagic.mLeSet 460
nim mLtSet astdef.html#mLtSet TMagic.mLtSet 460
nim mMulSet astdef.html#mMulSet TMagic.mMulSet 460
nim mPlusSet astdef.html#mPlusSet TMagic.mPlusSet 460
nim mMinusSet astdef.html#mMinusSet TMagic.mMinusSet 460
nim mXorSet astdef.html#mXorSet TMagic.mXorSet 460
nim mConStrStr astdef.html#mConStrStr TMagic.mConStrStr 460
nim mSlice astdef.html#mSlice TMagic.mSlice 460
nim mDotDot astdef.html#mDotDot TMagic.mDotDot 460
nim mFields astdef.html#mFields TMagic.mFields 460
nim mFieldPairs astdef.html#mFieldPairs TMagic.mFieldPairs 460
nim mOmpParFor astdef.html#mOmpParFor TMagic.mOmpParFor 460
nim mAppendStrCh astdef.html#mAppendStrCh TMagic.mAppendStrCh 460
nim mAppendStrStr astdef.html#mAppendStrStr TMagic.mAppendStrStr 460
nim mAppendSeqElem astdef.html#mAppendSeqElem TMagic.mAppendSeqElem 460
nim mInSet astdef.html#mInSet TMagic.mInSet 460
nim mRepr astdef.html#mRepr TMagic.mRepr 460
nim mExit astdef.html#mExit TMagic.mExit 460
nim mSetLengthStr astdef.html#mSetLengthStr TMagic.mSetLengthStr 460
nim mSetLengthSeq astdef.html#mSetLengthSeq TMagic.mSetLengthSeq 460
nim mSetLengthSeqUninit astdef.html#mSetLengthSeqUninit TMagic.mSetLengthSeqUninit 460
nim mIsPartOf astdef.html#mIsPartOf TMagic.mIsPartOf 460
nim mAstToStr astdef.html#mAstToStr TMagic.mAstToStr 460
nim mParallel astdef.html#mParallel TMagic.mParallel 460
nim mSwap astdef.html#mSwap TMagic.mSwap 460
nim mIsNil astdef.html#mIsNil TMagic.mIsNil 460
nim mArrToSeq astdef.html#mArrToSeq TMagic.mArrToSeq 460
nim mOpenArrayToSeq astdef.html#mOpenArrayToSeq TMagic.mOpenArrayToSeq 460
nim mNewString astdef.html#mNewString TMagic.mNewString 460
nim mNewStringOfCap astdef.html#mNewStringOfCap TMagic.mNewStringOfCap 460
nim mParseBiggestFloat astdef.html#mParseBiggestFloat TMagic.mParseBiggestFloat 460
nim mMove astdef.html#mMove TMagic.mMove 460
nim mEnsureMove astdef.html#mEnsureMove TMagic.mEnsureMove 460
nim mWasMoved astdef.html#mWasMoved TMagic.mWasMoved 460
nim mDup astdef.html#mDup TMagic.mDup 460
nim mDestroy astdef.html#mDestroy TMagic.mDestroy 460
nim mTrace astdef.html#mTrace TMagic.mTrace 460
nim mDefault astdef.html#mDefault TMagic.mDefault 460
nim mUnown astdef.html#mUnown TMagic.mUnown 460
nim mFinished astdef.html#mFinished TMagic.mFinished 460
nim mIsolate astdef.html#mIsolate TMagic.mIsolate 460
nim mAccessEnv astdef.html#mAccessEnv TMagic.mAccessEnv 460
nim mAccessTypeField astdef.html#mAccessTypeField TMagic.mAccessTypeField 460
nim mArray astdef.html#mArray TMagic.mArray 460
nim mOpenArray astdef.html#mOpenArray TMagic.mOpenArray 460
nim mRange astdef.html#mRange TMagic.mRange 460
nim mSet astdef.html#mSet TMagic.mSet 460
nim mSeq astdef.html#mSeq TMagic.mSeq 460
nim mVarargs astdef.html#mVarargs TMagic.mVarargs 460
nim mRef astdef.html#mRef TMagic.mRef 460
nim mPtr astdef.html#mPtr TMagic.mPtr 460
nim mVar astdef.html#mVar TMagic.mVar 460
nim mDistinct astdef.html#mDistinct TMagic.mDistinct 460
nim mVoid astdef.html#mVoid TMagic.mVoid 460
nim mTuple astdef.html#mTuple TMagic.mTuple 460
nim mOrdinal astdef.html#mOrdinal TMagic.mOrdinal 460
nim mIterableType astdef.html#mIterableType TMagic.mIterableType 460
nim mInt astdef.html#mInt TMagic.mInt 460
nim mInt8 astdef.html#mInt8 TMagic.mInt8 460
nim mInt16 astdef.html#mInt16 TMagic.mInt16 460
nim mInt32 astdef.html#mInt32 TMagic.mInt32 460
nim mInt64 astdef.html#mInt64 TMagic.mInt64 460
nim mUInt astdef.html#mUInt TMagic.mUInt 460
nim mUInt8 astdef.html#mUInt8 TMagic.mUInt8 460
nim mUInt16 astdef.html#mUInt16 TMagic.mUInt16 460
nim mUInt32 astdef.html#mUInt32 TMagic.mUInt32 460
nim mUInt64 astdef.html#mUInt64 TMagic.mUInt64 460
nim mFloat astdef.html#mFloat TMagic.mFloat 460
nim mFloat32 astdef.html#mFloat32 TMagic.mFloat32 460
nim mFloat64 astdef.html#mFloat64 TMagic.mFloat64 460
nim mFloat128 astdef.html#mFloat128 TMagic.mFloat128 460
nim mBool astdef.html#mBool TMagic.mBool 460
nim mChar astdef.html#mChar TMagic.mChar 460
nim mString astdef.html#mString TMagic.mString 460
nim mCstring astdef.html#mCstring TMagic.mCstring 460
nim mPointer astdef.html#mPointer TMagic.mPointer 460
nim mNil astdef.html#mNil TMagic.mNil 460
nim mExpr astdef.html#mExpr TMagic.mExpr 460
nim mStmt astdef.html#mStmt TMagic.mStmt 460
nim mTypeDesc astdef.html#mTypeDesc TMagic.mTypeDesc 460
nim mVoidType astdef.html#mVoidType TMagic.mVoidType 460
nim mPNimrodNode astdef.html#mPNimrodNode TMagic.mPNimrodNode 460
nim mSpawn astdef.html#mSpawn TMagic.mSpawn 460
nim mDeepCopy astdef.html#mDeepCopy TMagic.mDeepCopy 460
nim mIsMainModule astdef.html#mIsMainModule TMagic.mIsMainModule 460
nim mCompileDate astdef.html#mCompileDate TMagic.mCompileDate 460
nim mCompileTime astdef.html#mCompileTime TMagic.mCompileTime 460
nim mProcCall astdef.html#mProcCall TMagic.mProcCall 460
nim mCpuEndian astdef.html#mCpuEndian TMagic.mCpuEndian 460
nim mHostOS astdef.html#mHostOS TMagic.mHostOS 460
nim mHostCPU astdef.html#mHostCPU TMagic.mHostCPU 460
nim mBuildOS astdef.html#mBuildOS TMagic.mBuildOS 460
nim mBuildCPU astdef.html#mBuildCPU TMagic.mBuildCPU 460
nim mAppType astdef.html#mAppType TMagic.mAppType 460
nim mCompileOption astdef.html#mCompileOption TMagic.mCompileOption 460
nim mCompileOptionArg astdef.html#mCompileOptionArg TMagic.mCompileOptionArg 460
nim mNLen astdef.html#mNLen TMagic.mNLen 460
nim mNChild astdef.html#mNChild TMagic.mNChild 460
nim mNSetChild astdef.html#mNSetChild TMagic.mNSetChild 460
nim mNAdd astdef.html#mNAdd TMagic.mNAdd 460
nim mNAddMultiple astdef.html#mNAddMultiple TMagic.mNAddMultiple 460
nim mNDel astdef.html#mNDel TMagic.mNDel 460
nim mNKind astdef.html#mNKind TMagic.mNKind 460
nim mNSymKind astdef.html#mNSymKind TMagic.mNSymKind 460
nim mNccValue astdef.html#mNccValue TMagic.mNccValue 460
nim mNccInc astdef.html#mNccInc TMagic.mNccInc 460
nim mNcsAdd astdef.html#mNcsAdd TMagic.mNcsAdd 460
nim mNcsIncl astdef.html#mNcsIncl TMagic.mNcsIncl 460
nim mNcsLen astdef.html#mNcsLen TMagic.mNcsLen 460
nim mNcsAt astdef.html#mNcsAt TMagic.mNcsAt 460
nim mNctPut astdef.html#mNctPut TMagic.mNctPut 460
nim mNctLen astdef.html#mNctLen TMagic.mNctLen 460
nim mNctGet astdef.html#mNctGet TMagic.mNctGet 460
nim mNctHasNext astdef.html#mNctHasNext TMagic.mNctHasNext 460
nim mNctNext astdef.html#mNctNext TMagic.mNctNext 460
nim mNIntVal astdef.html#mNIntVal TMagic.mNIntVal 460
nim mNFloatVal astdef.html#mNFloatVal TMagic.mNFloatVal 460
nim mNSymbol astdef.html#mNSymbol TMagic.mNSymbol 460
nim mNIdent astdef.html#mNIdent TMagic.mNIdent 460
nim mNGetType astdef.html#mNGetType TMagic.mNGetType 460
nim mNStrVal astdef.html#mNStrVal TMagic.mNStrVal 460
nim mNSetIntVal astdef.html#mNSetIntVal TMagic.mNSetIntVal 460
nim mNSetFloatVal astdef.html#mNSetFloatVal TMagic.mNSetFloatVal 460
nim mNSetSymbol astdef.html#mNSetSymbol TMagic.mNSetSymbol 460
nim mNSetIdent astdef.html#mNSetIdent TMagic.mNSetIdent 460
nim mNSetStrVal astdef.html#mNSetStrVal TMagic.mNSetStrVal 460
nim mNLineInfo astdef.html#mNLineInfo TMagic.mNLineInfo 460
nim mNNewNimNode astdef.html#mNNewNimNode TMagic.mNNewNimNode 460
nim mNCopyNimNode astdef.html#mNCopyNimNode TMagic.mNCopyNimNode 460
nim mNCopyNimTree astdef.html#mNCopyNimTree TMagic.mNCopyNimTree 460
nim mStrToIdent astdef.html#mStrToIdent TMagic.mStrToIdent 460
nim mNSigHash astdef.html#mNSigHash TMagic.mNSigHash 460
nim mNSizeOf astdef.html#mNSizeOf TMagic.mNSizeOf 460
nim mNBindSym astdef.html#mNBindSym TMagic.mNBindSym 460
nim mNCallSite astdef.html#mNCallSite TMagic.mNCallSite 460
nim mEqIdent astdef.html#mEqIdent TMagic.mEqIdent 460
nim mEqNimrodNode astdef.html#mEqNimrodNode TMagic.mEqNimrodNode 460
nim mSameNodeType astdef.html#mSameNodeType TMagic.mSameNodeType 460
nim mGetImpl astdef.html#mGetImpl TMagic.mGetImpl 460
nim mNGenSym astdef.html#mNGenSym TMagic.mNGenSym 460
nim mNHint astdef.html#mNHint TMagic.mNHint 460
nim mNWarning astdef.html#mNWarning TMagic.mNWarning 460
nim mNError astdef.html#mNError TMagic.mNError 460
nim mInstantiationInfo astdef.html#mInstantiationInfo TMagic.mInstantiationInfo 460
nim mGetTypeInfo astdef.html#mGetTypeInfo TMagic.mGetTypeInfo 460
nim mGetTypeInfoV2 astdef.html#mGetTypeInfoV2 TMagic.mGetTypeInfoV2 460
nim mNimvm astdef.html#mNimvm TMagic.mNimvm 460
nim mIntDefine astdef.html#mIntDefine TMagic.mIntDefine 460
nim mStrDefine astdef.html#mStrDefine TMagic.mStrDefine 460
nim mBoolDefine astdef.html#mBoolDefine TMagic.mBoolDefine 460
nim mGenericDefine astdef.html#mGenericDefine TMagic.mGenericDefine 460
nim mRunnableExamples astdef.html#mRunnableExamples TMagic.mRunnableExamples 460
nim mException astdef.html#mException TMagic.mException 460
nim mBuiltinType astdef.html#mBuiltinType TMagic.mBuiltinType 460
nim mSymOwner astdef.html#mSymOwner TMagic.mSymOwner 460
nim mUncheckedArray astdef.html#mUncheckedArray TMagic.mUncheckedArray 460
nim mGetImplTransf astdef.html#mGetImplTransf TMagic.mGetImplTransf 460
nim mSymIsInstantiationOf astdef.html#mSymIsInstantiationOf TMagic.mSymIsInstantiationOf 460
nim mNodeId astdef.html#mNodeId TMagic.mNodeId 460
nim mPrivateAccess astdef.html#mPrivateAccess TMagic.mPrivateAccess 460
nim mZeroDefault astdef.html#mZeroDefault TMagic.mZeroDefault 460
nim TMagic astdef.html#TMagic enum TMagic 460
nim ctfeWhitelist astdef.html#ctfeWhitelist const ctfeWhitelist 540
nim generatedMagics astdef.html#generatedMagics const generatedMagics 568
nim ItemId astdef.html#ItemId object ItemId 572
nim `$` astdef.html#$,ItemId proc `$`(x: ItemId): string 576
nim `==` astdef.html#==,ItemId,ItemId proc `==`(a, b: ItemId): bool 579
nim hash astdef.html#hash,ItemId proc hash(x: ItemId): Hash 582
nim PNode astdef.html#PNode type PNode 589
nim TNodeSeq astdef.html#TNodeSeq type TNodeSeq 590
nim PType astdef.html#PType type PType 591
nim PSym astdef.html#PSym type PSym 592
nim TNode astdef.html#TNode object TNode 593
nim TStrTable astdef.html#TStrTable object TStrTable 615
nim locNone astdef.html#locNone TLocKind.locNone 620
nim locTemp astdef.html#locTemp TLocKind.locTemp 620
nim locLocalVar astdef.html#locLocalVar TLocKind.locLocalVar 620
nim locGlobalVar astdef.html#locGlobalVar TLocKind.locGlobalVar 620
nim locParam astdef.html#locParam TLocKind.locParam 620
nim locField astdef.html#locField TLocKind.locField 620
nim locExpr astdef.html#locExpr TLocKind.locExpr 620
nim locProc astdef.html#locProc TLocKind.locProc 620
nim locData astdef.html#locData TLocKind.locData 620
nim locCall astdef.html#locCall TLocKind.locCall 620
nim locOther astdef.html#locOther TLocKind.locOther 620
nim TLocKind astdef.html#TLocKind enum TLocKind 620
nim lfIndirect astdef.html#lfIndirect TLocFlag.lfIndirect 632
nim lfNoDeepCopy astdef.html#lfNoDeepCopy TLocFlag.lfNoDeepCopy 632
nim lfNoDecl astdef.html#lfNoDecl TLocFlag.lfNoDecl 632
nim lfDynamicLib astdef.html#lfDynamicLib TLocFlag.lfDynamicLib 632
nim lfExportLib astdef.html#lfExportLib TLocFlag.lfExportLib 632
nim lfHeader astdef.html#lfHeader TLocFlag.lfHeader 632
nim lfImportCompilerProc astdef.html#lfImportCompilerProc TLocFlag.lfImportCompilerProc 632
nim lfSingleUse astdef.html#lfSingleUse TLocFlag.lfSingleUse 632
nim lfEnforceDeref astdef.html#lfEnforceDeref TLocFlag.lfEnforceDeref 632
nim lfPrepareForMutation astdef.html#lfPrepareForMutation TLocFlag.lfPrepareForMutation 632
nim TLocFlag astdef.html#TLocFlag enum TLocFlag 632
nim OnUnknown astdef.html#OnUnknown TStorageLoc.OnUnknown 645
nim OnStatic astdef.html#OnStatic TStorageLoc.OnStatic 645
nim OnStack astdef.html#OnStack TStorageLoc.OnStack 645
nim OnHeap astdef.html#OnHeap TStorageLoc.OnHeap 645
nim TStorageLoc astdef.html#TStorageLoc enum TStorageLoc 645
nim TLocFlags astdef.html#TLocFlags type TLocFlags 651
nim TLoc astdef.html#TLoc object TLoc 652
nim libHeader astdef.html#libHeader TLibKind.libHeader 661
nim libDynamic astdef.html#libDynamic TLibKind.libDynamic 661
nim TLibKind astdef.html#TLibKind enum TLibKind 661
nim TLib astdef.html#TLib object TLib 664
nim CompilesId astdef.html#CompilesId type CompilesId 673
nim TInstantiation astdef.html#TInstantiation object TInstantiation 675
nim PInstantiation astdef.html#PInstantiation type PInstantiation 683
nim TScope astdef.html#TScope object TScope 685
nim PScope astdef.html#PScope type PScope 692
nim Complete astdef.html#Complete ItemState.Complete 694
nim Partial astdef.html#Partial ItemState.Partial 694
nim Sealed astdef.html#Sealed ItemState.Sealed 694
nim ItemState astdef.html#ItemState enum ItemState 694
nim PLib astdef.html#PLib type PLib 699
nim TSym astdef.html#TSym object TSym 700
nim TTypeSeq astdef.html#TTypeSeq type TTypeSeq 760
nim attachedWasMoved astdef.html#attachedWasMoved TTypeAttachedOp.attachedWasMoved 762
nim attachedDestructor astdef.html#attachedDestructor TTypeAttachedOp.attachedDestructor 762
nim attachedAsgn astdef.html#attachedAsgn TTypeAttachedOp.attachedAsgn 762
nim attachedDup astdef.html#attachedDup TTypeAttachedOp.attachedDup 762
nim attachedSink astdef.html#attachedSink TTypeAttachedOp.attachedSink 762
nim attachedTrace astdef.html#attachedTrace TTypeAttachedOp.attachedTrace 762
nim attachedDeepCopy astdef.html#attachedDeepCopy TTypeAttachedOp.attachedDeepCopy 762
nim TTypeAttachedOp astdef.html#TTypeAttachedOp enum TTypeAttachedOp 762
nim TType astdef.html#TType object TType 771
nim TPair astdef.html#TPair object TPair 804
nim TPairSeq astdef.html#TPairSeq type TPairSeq 807
nim TIdPair astdef.html#TIdPair object TIdPair 809
nim TIdPairSeq astdef.html#TIdPairSeq type TIdPairSeq 813
nim TIdTable astdef.html#TIdTable object TIdTable 814
nim TNodePair astdef.html#TNodePair object TNodePair 818
nim TNodePairSeq astdef.html#TNodePairSeq type TNodePairSeq 823
nim TNodeTable astdef.html#TNodeTable object TNodeTable 824
nim TObjectSeq astdef.html#TObjectSeq type TObjectSeq 830
nim TObjectSet astdef.html#TObjectSet object TObjectSet 831
nim impUnknown astdef.html#impUnknown TImplication.impUnknown 835
nim impNo astdef.html#impNo TImplication.impNo 835
nim impYes astdef.html#impYes TImplication.impYes 835
nim TImplication astdef.html#TImplication enum TImplication 835
nim OverloadableSyms astdef.html#OverloadableSyms const OverloadableSyms 840
nim GenericTypes astdef.html#GenericTypes const GenericTypes 843
nim StructuralEquivTypes astdef.html#StructuralEquivTypes const StructuralEquivTypes 846
nim ConcreteTypes astdef.html#ConcreteTypes const ConcreteTypes 850
nim IntegralTypes astdef.html#IntegralTypes const IntegralTypes 857
nim ConstantDataTypes astdef.html#ConstantDataTypes const ConstantDataTypes 859
nim NilableTypes astdef.html#NilableTypes const NilableTypes 861
nim PtrLikeKinds astdef.html#PtrLikeKinds const PtrLikeKinds 863
nim PersistentNodeFlags astdef.html#PersistentNodeFlags const PersistentNodeFlags 864
nim namePos astdef.html#namePos const namePos 871
nim patternPos astdef.html#patternPos const patternPos 872
nim genericParamsPos astdef.html#genericParamsPos const genericParamsPos 873
nim paramsPos astdef.html#paramsPos const paramsPos 874
nim pragmasPos astdef.html#pragmasPos const pragmasPos 875
nim miscPos astdef.html#miscPos const miscPos 876
nim bodyPos astdef.html#bodyPos const bodyPos 877
nim resultPos astdef.html#resultPos const resultPos 878
nim dispatcherPos astdef.html#dispatcherPos const dispatcherPos 879
nim nfAllFieldsSet astdef.html#nfAllFieldsSet const nfAllFieldsSet 881
nim nkIdentKinds astdef.html#nkIdentKinds const nkIdentKinds 883
nim nkPragmaCallKinds astdef.html#nkPragmaCallKinds const nkPragmaCallKinds 886
nim nkLiterals astdef.html#nkLiterals const nkLiterals 887
nim nkFloatLiterals astdef.html#nkFloatLiterals const nkFloatLiterals 888
nim nkLambdaKinds astdef.html#nkLambdaKinds const nkLambdaKinds 889
nim declarativeDefs astdef.html#declarativeDefs const declarativeDefs 890
nim routineDefs astdef.html#routineDefs const routineDefs 891
nim procDefs astdef.html#procDefs const procDefs 892
nim callableDefs astdef.html#callableDefs const callableDefs 893
nim nkSymChoices astdef.html#nkSymChoices const nkSymChoices 895
nim nkStrKinds astdef.html#nkStrKinds const nkStrKinds 896
nim skLocalVars astdef.html#skLocalVars const skLocalVars 898
nim skProcKinds astdef.html#skProcKinds const skProcKinds 899
nim defaultSize astdef.html#defaultSize const defaultSize 902
nim defaultAlignment astdef.html#defaultAlignment const defaultAlignment 903
nim defaultOffset astdef.html#defaultOffset const defaultOffset 904
nim len astdef.html#len,PNode proc len(n: PNode): int 907
nim safeLen astdef.html#safeLen,PNode proc safeLen(n: PNode): int 910
nim `[]` astdef.html#[].t,PNode,int template `[]`(n: PNode; i: int): PNode 915
nim `[]=` astdef.html#[]=.t,PNode,int,PNode template `[]=`(n: PNode; i: int; x: PNode) 916
nim `[]` astdef.html#[].t,PNode,BackwardsIndex template `[]`(n: PNode; i: BackwardsIndex): PNode 918
nim `[]=` astdef.html#[]=.t,PNode,BackwardsIndex,PNode template `[]=`(n: PNode; i: BackwardsIndex; x: PNode) 919
nim items astdef.html#items.i,PNode iterator items(n: PNode): PNode 921
nim newNode astdef.html#newNode,TNodeKind proc newNode(kind: TNodeKind): PNode 946
nim newNodeI astdef.html#newNodeI,TNodeKind,TLineInfo proc newNodeI(kind: TNodeKind; info: TLineInfo): PNode 951
nim newNodeI astdef.html#newNodeI,TNodeKind,TLineInfo,int proc newNodeI(kind: TNodeKind; info: TLineInfo; children: int): PNode 956
nim newNodeIT astdef.html#newNodeIT,TNodeKind,TLineInfo,PType proc newNodeIT(kind: TNodeKind; info: TLineInfo; typ: PType): PNode 963
nim newNode astdef.html#newNode,TNodeKind,TLineInfo proc newNode(kind: TNodeKind; info: TLineInfo): PNode 969
nim newIdentNode astdef.html#newIdentNode,PIdent,TLineInfo proc newIdentNode(ident: PIdent; info: TLineInfo): PNode 974
nim newSymNode astdef.html#newSymNode,PSym,TLineInfo proc newSymNode(sym: PSym; info: TLineInfo): PNode 979
nim newStrNode astdef.html#newStrNode,TNodeKind,string proc newStrNode(kind: TNodeKind; strVal: string): PNode 985
nim newStrNode astdef.html#newStrNode,string,TLineInfo proc newStrNode(strVal: string; info: TLineInfo): PNode 989
nim HookEntry astdef.html#HookEntry LogEntryKind.HookEntry 998
nim ConverterEntry astdef.html#ConverterEntry LogEntryKind.ConverterEntry 998
nim MethodEntry astdef.html#MethodEntry LogEntryKind.MethodEntry 998
nim EnumToStrEntry astdef.html#EnumToStrEntry LogEntryKind.EnumToStrEntry 998
nim GenericInstEntry astdef.html#GenericInstEntry LogEntryKind.GenericInstEntry 998
nim LogEntryKind astdef.html#LogEntryKind enum LogEntryKind 998
nim LogEntry astdef.html#LogEntry object LogEntry 1000
nim forcePartial astdef.html#forcePartial,PSym proc forcePartial(s: PSym) 1009
nim forcePartial astdef.html#forcePartial,PType proc forcePartial(t: PType) 1043
nim GrowthFactor astdef.html#GrowthFactor const GrowthFactor 1061
nim StartSize astdef.html#StartSize const StartSize 1062
nim nextTry astdef.html#nextTry,Hash,Hash proc nextTry(h, maxHash: Hash): Hash 1064
nim mustRehash astdef.html#mustRehash,int,int proc mustRehash(length, counter: int): bool 1070
nim strTableContains astdef.html#strTableContains,TStrTable,PSym proc strTableContains(t: TStrTable; n: PSym): bool 1074
nim symTabReplace astdef.html#symTabReplace,TStrTable,PSym,PSym proc symTabReplace(t: var TStrTable; prevSym: PSym; newSym: PSym) 1103
nim strTableAdd astdef.html#strTableAdd,TStrTable,PSym proc strTableAdd(t: var TStrTable; n: PSym) 1113
nim strTableInclReportConflict astdef.html#strTableInclReportConflict,TStrTable,PSym proc strTableInclReportConflict(t: var TStrTable; n: PSym; onConflictKeepOld = false): PSym 1118
nim strTableIncl astdef.html#strTableIncl,TStrTable,PSym proc strTableIncl(t: var TStrTable; n: PSym; onConflictKeepOld = false): bool 1151
nim strTableGet astdef.html#strTableGet,TStrTable,PIdent proc strTableGet(t: TStrTable; name: PIdent): PSym 1155
nimgrp newnodei astdef.html#newNodeI-procs-all proc 951
nimgrp newstrnode astdef.html#newStrNode-procs-all proc 985
nimgrp newnode astdef.html#newNode-procs-all proc 946
nimgrp forcepartial astdef.html#forcePartial-procs-all proc 1009
nimgrp []= astdef.html#[]=-templates-all template 916
nimgrp [] astdef.html#[]-templates-all template 915

260
compiler/astmsgs.html Normal file
View File

@@ -0,0 +1,260 @@
<?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="astdef.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">OSError</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="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="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/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="astdef.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">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="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="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/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="astdef.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">OSError</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="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="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/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="astdef.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">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="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="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/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="astdef.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">OSError</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="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="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/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="astdef.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">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="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="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/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="astdef.html#PType"><span class="Identifier">PType</span></a><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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">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="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="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/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-12-21 06:47:45 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

200
compiler/astyaml.html Normal file
View File

@@ -0,0 +1,200 @@
<?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="astdef.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="Identifier">OSError</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="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="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/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="astdef.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="Identifier">OSError</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="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="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/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="astdef.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="Identifier">OSError</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="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="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/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-12-21 06:47:45 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-12-21 06:47:45 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-12-21 06:47:45 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

282
compiler/ccgutils.html Normal file
View File

@@ -0,0 +1,282 @@
<?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="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span> <span class="Identifier">retType</span><span class="Other">:</span> <a href="astdef.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">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="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="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/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="astdef.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="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="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="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/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="astdef.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">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="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="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/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="astdef.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="astdef.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="astdef.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="astdef.html#PType"><span class="Identifier">PType</span></a><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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-12-21 06:47:45 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

349
compiler/cgen.html Normal file
View File

@@ -0,0 +1,349 @@
<?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">genProcLvl3
<li><a class="reference" href="#genProcLvl3%2CBModule%2CPSym" title="genProcLvl3(m: BModule; prc: PSym)">genProcLvl3(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%2CIdGenerator" title="newModule(g: BModuleList; module: PSym; conf: ConfigRef; idgen: IdGenerator): BModule">newModule(g: BModuleList; module: PSym; conf: ConfigRef; idgen: IdGenerator): 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="modulegraphs.html">modulegraphs</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="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">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="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="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="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#L2664" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgen.nim#L2664" 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="astdef.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#L766" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ccgtypes.nim#L766" 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="astdef.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">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="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="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="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#L2584" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgen.nim#L2584" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="genProcLvl3-procs-all">
<div id="genProcLvl3,BModule,PSym">
<dt><pre><span class="Keyword">proc</span> <a href="#genProcLvl3%2CBModule%2CPSym"><span class="Identifier">genProcLvl3</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="astdef.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">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="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="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="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#L1299" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgen.nim#L1299" 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="astdef.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">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="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="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="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#L2482" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgen.nim#L2482" 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="astdef.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">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="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="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/ccgtypes.nim#L2057" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ccgtypes.nim#L2057" 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#L479" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ccgtypes.nim#L479" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newModule-procs-all">
<div id="newModule,BModuleList,PSym,ConfigRef,IdGenerator">
<dt><pre><span class="Keyword">proc</span> <a href="#newModule%2CBModuleList%2CPSym%2CConfigRef%2CIdGenerator"><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="astdef.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="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="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="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="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="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/cgen.nim#L64" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgen.nim#L64" 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="astdef.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="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="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="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>
Called from the IC backend.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/cgen.nim#L1923" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgen.nim#L1923" 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="astdef.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">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="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="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="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#L2396" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgen.nim#L2396" 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#L1943" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgen.nim#L1943" 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="astdef.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-12-21 06:47:49 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 newModule cgen.html#newModule,BModuleList,PSym,ConfigRef,IdGenerator proc newModule(g: BModuleList; module: PSym; conf: ConfigRef; idgen: IdGenerator): BModule 64
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]]) 479
nim fillObjectFields cgen.html#fillObjectFields,BModule,PType proc fillObjectFields(m: BModule; typ: PType) 766
nim genTypeInfo cgen.html#genTypeInfo,ConfigRef,BModule,PType,TLineInfo proc genTypeInfo(config: ConfigRef; m: BModule; t: PType; info: TLineInfo): Rope 2057
nim genProcLvl3 cgen.html#genProcLvl3,BModule,PSym proc genProcLvl3(m: BModule; prc: PSym) 1299
nim registerInitProcs cgen.html#registerInitProcs,BModuleList,PSym,set[ModuleBackendFlag] proc registerInitProcs(g: BModuleList; m: PSym; flags: set[ModuleBackendFlag]) 1923
nim whichInitProcs cgen.html#whichInitProcs,BModule proc whichInitProcs(m: BModule): set[ModuleBackendFlag] 1943
nim setupCgen cgen.html#setupCgen,ModuleGraph,PSym,IdGenerator proc setupCgen(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext 2396
nim genTopLevelStmt cgen.html#genTopLevelStmt,BModule,PNode proc genTopLevelStmt(m: BModule; n: PNode) 2482
nim finalCodegenActions cgen.html#finalCodegenActions,ModuleGraph,BModule,PNode proc finalCodegenActions(graph: ModuleGraph; m: BModule; n: PNode) 2584
nim cgenWriteModules cgen.html#cgenWriteModules,RootRef,ConfigRef proc cgenWriteModules(backend: RootRef; config: ConfigRef) 2664

567
compiler/cgendata.html Normal file
View File

@@ -0,0 +1,567 @@
<?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">delayedCodegen
<li><a class="reference" href="#delayedCodegen%2CBModule" title="delayedCodegen(m: BModule): bool">delayedCodegen(m: BModule): bool</a></li>
</ul>
<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="astdef.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="astdef.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="astdef.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="delayedCodegen-procs-all">
<div id="delayedCodegen,BModule">
<dt><pre><span class="Keyword">proc</span> <a href="#delayedCodegen%2CBModule"><span class="Identifier">delayedCodegen</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">bool</span> {.<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#L182" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L182" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<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#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>
<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#L197" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L197" 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#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>
<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="astdef.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="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="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="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/cgendata.nim#L202" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L202" 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#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="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#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>
</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#L219" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L219" 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#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 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#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>
<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#L180" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/cgendata.nim#L180" 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-12-21 06:47:45 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

86
compiler/cgendata.idx Normal file
View File

@@ -0,0 +1,86 @@
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 178
nim config cgendata.html#config.t,BProc template config(p: BProc): ConfigRef 179
nim vccAndC cgendata.html#vccAndC.t,BProc template vccAndC(p: BProc): bool 180
nim delayedCodegen cgendata.html#delayedCodegen,BModule proc delayedCodegen(m: BModule): bool 182
nim includeHeader cgendata.html#includeHeader,BModule,string proc includeHeader(this: BModule; header: string) 185
nim s cgendata.html#s,BProc,TCProcSection proc s(p: BProc; s: TCProcSection): var Builder 189
nim procSec cgendata.html#procSec,BProc,TCProcSection proc procSec(p: BProc; s: TCProcSection): var Builder 193
nim initBlock cgendata.html#initBlock proc initBlock(): TBlock 197
nim newProc cgendata.html#newProc,PSym,BModule proc newProc(prc: PSym; module: BModule): BProc 202
nim newModuleList cgendata.html#newModuleList,ModuleGraph proc newModuleList(g: ModuleGraph): BModuleList 215
nim cgenModules cgendata.html#cgenModules.i,BModuleList iterator cgenModules(g: BModuleList): BModule 219
nimgrp config cgendata.html#config-templates-all template 178

242
compiler/cgmeth.html Normal file
View File

@@ -0,0 +1,242 @@
<?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">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="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="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/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="astdef.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="astdef.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">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="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="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/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="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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">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="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="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>
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="astdef.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="astdef.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">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="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="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/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="astdef.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">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="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="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/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="astdef.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="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="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="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/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="astdef.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="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="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="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/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-12-21 06:47:47 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

122
compiler/closureiters.html Normal file
View File

@@ -0,0 +1,122 @@
<?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="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span>
<span class="Identifier">n</span><span class="Other">:</span> <a href="astdef.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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">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="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="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/closureiters.nim#L1462" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/closureiters.nim#L1462" 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-12-21 06:47:47 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 1462

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-12-21 06:47:52 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#L467" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L467" 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#L462" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L462" 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#L549" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L549" 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#L471" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L471" 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#L1210" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L1210" 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#L1193" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L1193" 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#L1199" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L1199" 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#L639" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L639" 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#L505" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L505" 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#L522" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L522" 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#L570" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/commands.nim#L570" 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-12-21 06:47:44 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) 462
nim handleCmdInput commands.html#handleCmdInput,ConfigRef proc handleCmdInput(conf: ConfigRef) 467
nim parseCommand commands.html#parseCommand,string proc parseCommand(command: string): Command 471
nim setCmd commands.html#setCmd,ConfigRef,Command proc setCmd(conf: ConfigRef; cmd: Command) 505
nim setCommandEarly commands.html#setCommandEarly,ConfigRef,string proc setCommandEarly(conf: ConfigRef; command: string) 522
nim initOrcDefines commands.html#initOrcDefines,ConfigRef proc initOrcDefines(conf: ConfigRef) 549
nim unregisterArcOrc commands.html#unregisterArcOrc,ConfigRef proc unregisterArcOrc(conf: ConfigRef) 570
nim processSwitch commands.html#processSwitch,string,string,TCmdLinePass,TLineInfo,ConfigRef proc processSwitch(switch, arg: string; pass: TCmdLinePass; info: TLineInfo;\n conf: ConfigRef) 639
nim processCommand commands.html#processCommand,string,TCmdLinePass,ConfigRef proc processCommand(switch: string; pass: TCmdLinePass; config: ConfigRef) 1193
nim processSwitch commands.html#processSwitch,TCmdLinePass,OptParser,ConfigRef proc processSwitch(pass: TCmdLinePass; p: OptParser; config: ConfigRef) 1199
nim processArgument commands.html#processArgument,TCmdLinePass,OptParser,int,ConfigRef proc processArgument(pass: TCmdLinePass; p: OptParser; argsCount: var int;\n config: ConfigRef): bool 1210
nimgrp processswitch commands.html#processSwitch-procs-all proc 639

195
compiler/concepts.html Normal file
View File

@@ -0,0 +1,195 @@
<?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="astdef.html#PType"><span class="Identifier">PType</span></a><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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">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="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="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/concepts.nim#L155" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/concepts.nim#L155" 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="astdef.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="astdef.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">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="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="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>
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#L622" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/concepts.nim#L622" 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="astdef.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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">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="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="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>
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-12-21 06:47:46 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 155
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 622
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-12-21 06:47:43 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

158
compiler/depends.html Normal file
View File

@@ -0,0 +1,158 @@
<?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="astdef.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="astdef.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">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="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="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/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="astdef.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-12-21 06:47:51 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

122
compiler/deps.html Normal file
View File

@@ -0,0 +1,122 @@
<?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>deps</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">deps</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">commandDeps
<li><a class="reference" href="#commandDeps%2CConfigRef" title="commandDeps(conf: ConfigRef)">commandDeps(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/deps.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/deps.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">Generate a .build.nif file for nifmake from a Nim project. This enables incremental and parallel compilation using the <tt class="docutils literal"><span class="pre"><span class="Identifier">m</span></span></tt> switch.</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="msgs.html">msgs</a>, <a class="reference external" href="pathutils.html">pathutils</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="commandDeps-procs-all">
<div id="commandDeps,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#commandDeps%2CConfigRef"><span class="Identifier">commandDeps</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">ReadDirEffect</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">RootEffect</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="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Main entry point for <tt class="docutils literal"><span class="pre"><span class="Identifier">nim</span> <span class="Identifier">deps</span></span></tt>
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/deps.nim#L302" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/deps.nim#L302" 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-12-21 06:47:52 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>

2
compiler/deps.idx Normal file
View File

@@ -0,0 +1,2 @@
nimTitle deps deps.html module deps 0
nim commandDeps deps.html#commandDeps,ConfigRef proc commandDeps(conf: ConfigRef) 302

205
compiler/dfa.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>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="astdef.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="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span> <span class="Identifier">body</span><span class="Other">:</span> <a href="astdef.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">;</span> <span class="Identifier">root</span><span class="Other">:</span> <a href="astdef.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="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="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="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>
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-12-21 06:47:47 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

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