mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 05:50:30 +00:00
version0.7.10
This commit is contained in:
@@ -14,4 +14,5 @@ web
|
||||
misc
|
||||
lib/base/devel
|
||||
lib/base/devel/*
|
||||
|
||||
lib/devel
|
||||
lib/devel/*
|
||||
|
||||
@@ -1,297 +1,278 @@
|
||||
# This is the config file for the documentation generator.
|
||||
# (c) 2009 Andreas Rumpf
|
||||
# Feel free to edit the templates as you need.
|
||||
|
||||
split.item.toc = "20"
|
||||
# too long entries in the table of contents wrap around
|
||||
# after this number of characters
|
||||
|
||||
doc.section = """
|
||||
<div class="section" id="$sectionID">
|
||||
<h1><a class="toc-backref" href="#$sectionTitleID">$sectionTitle</a></h1>
|
||||
<dl class="item">
|
||||
$content
|
||||
</dl></div>
|
||||
"""
|
||||
|
||||
doc.section.toc = """
|
||||
<li>
|
||||
<a class="reference" href="#$sectionID" id="$sectionTitleID">$sectionTitle</a>
|
||||
<ul class="simple">
|
||||
$content
|
||||
</ul>
|
||||
</li>
|
||||
"""
|
||||
|
||||
doc.item = """
|
||||
<dt id="$itemID"><pre>$header</pre></dt>
|
||||
<dd>
|
||||
$desc
|
||||
</dd>
|
||||
"""
|
||||
|
||||
doc.item.toc = """
|
||||
<li><a class="reference" href="#$itemID">$name</a></li>
|
||||
"""
|
||||
|
||||
doc.toc = """
|
||||
<div class="navigation">
|
||||
<p class="topic-title first">Navigation</p>
|
||||
<ul class="simple">
|
||||
$content
|
||||
</ul>
|
||||
</div>"""
|
||||
|
||||
doc.body_toc = """
|
||||
$tableofcontents
|
||||
<div class="content">
|
||||
$moduledesc
|
||||
$content
|
||||
</div>
|
||||
"""
|
||||
|
||||
doc.body_no_toc = """
|
||||
$moduledesc
|
||||
$content
|
||||
"""
|
||||
|
||||
doc.file = """<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!-- This file is generated by Nimrod. -->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>$title</title>
|
||||
<style type="text/css">
|
||||
|
||||
span.DecNumber {color: blue}
|
||||
span.BinNumber {color: blue}
|
||||
span.HexNumber {color: blue}
|
||||
span.OctNumber {color: blue}
|
||||
span.FloatNumber {color: blue}
|
||||
span.Identifier {color: black}
|
||||
span.Keyword {font-weight: bold}
|
||||
span.StringLit {color: blue}
|
||||
span.LongStringLit {color: blue}
|
||||
span.CharLit {color: blue}
|
||||
span.EscapeSequence {color: black}
|
||||
span.Operator {color: black}
|
||||
span.Punctation {color: black}
|
||||
span.Comment, span.LongComment {font-style:italic; color: green}
|
||||
span.RegularExpression {color: pink}
|
||||
span.TagStart {color: yellow}
|
||||
span.TagEnd {color: yellow}
|
||||
span.Key {color: blue}
|
||||
span.Value {color: black}
|
||||
span.RawData {color: blue}
|
||||
span.Assembler {color: blue}
|
||||
span.Preprocessor {color: yellow}
|
||||
span.Directive {color: yellow}
|
||||
span.Command, span.Rule, span.Hyperlink, span.Label, span.Reference,
|
||||
span.Other {color: black}
|
||||
|
||||
div.navigation {
|
||||
float: left;
|
||||
width: 27%; //25em;
|
||||
margin: 0; padding: 0; /*
|
||||
border: 1px dashed gold; */
|
||||
outline: 3px outset #7F7F7F; //#99ff99; //gold;
|
||||
background-color: #7F7F7F;
|
||||
}
|
||||
|
||||
div.navigation ul {list-style-type: none;}
|
||||
div.navigation ul li a, div.navigation ul li a:visited {
|
||||
font-weight: bold;
|
||||
color: #FFFFFF; // #CC0000;
|
||||
text-decoration: none;
|
||||
}
|
||||
div.navigation ul li a:hover {
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
/*outline: 2px outset #7F7F7F;*/
|
||||
color: gold;
|
||||
/* background-color: #FFFFFF; // #1A1A1A; // #779977;*/
|
||||
}
|
||||
|
||||
div.content {
|
||||
margin-left: 27%; // 25em;
|
||||
padding: 0 1em;
|
||||
/*border: 1px dashed #1A1A1A;*/
|
||||
min-width: 16em;
|
||||
}
|
||||
|
||||
dl.item dd, dl.item dd p {
|
||||
margin-top:3px;
|
||||
}
|
||||
dl.item dd pre {
|
||||
margin-left: 15pt;
|
||||
border: 0px;
|
||||
}
|
||||
dl.item dt, dl.item dt pre {
|
||||
margin: 20pt 0 0 0;
|
||||
}
|
||||
|
||||
pre, span.tok {
|
||||
background-color:#F9F9F9;
|
||||
border:1px dotted #2F6FAB;
|
||||
color:black;
|
||||
# This is the config file for the documentation generator.
|
||||
# (c) 2009 Andreas Rumpf
|
||||
# Feel free to edit the templates as you need.
|
||||
|
||||
split.item.toc = "20"
|
||||
# too long entries in the table of contents wrap around
|
||||
# after this number of characters
|
||||
|
||||
doc.section = """
|
||||
<div class="section" id="$sectionID">
|
||||
<h1><a class="toc-backref" href="#$sectionTitleID">$sectionTitle</a></h1>
|
||||
<dl class="item">
|
||||
$content
|
||||
</dl></div>
|
||||
"""
|
||||
|
||||
doc.section.toc = """
|
||||
<li>
|
||||
<a class="reference" href="#$sectionID" id="$sectionTitleID">$sectionTitle</a>
|
||||
<ul class="simple">
|
||||
$content
|
||||
</ul>
|
||||
</li>
|
||||
"""
|
||||
|
||||
doc.item = """
|
||||
<dt id="$itemID"><pre>$header</pre></dt>
|
||||
<dd>
|
||||
$desc
|
||||
</dd>
|
||||
"""
|
||||
|
||||
doc.item.toc = """
|
||||
<li><a class="reference" href="#$itemID">$name</a></li>
|
||||
"""
|
||||
|
||||
doc.toc = """
|
||||
<div class="navigation" id="navigation">
|
||||
<p class="topic-title first">Navigation</p>
|
||||
<ul class="simple">
|
||||
$content
|
||||
</ul>
|
||||
</div>"""
|
||||
|
||||
doc.body_toc = """
|
||||
$tableofcontents
|
||||
<div class="content" id="content">
|
||||
$moduledesc
|
||||
$content
|
||||
</div>
|
||||
"""
|
||||
|
||||
doc.body_no_toc = """
|
||||
$moduledesc
|
||||
$content
|
||||
"""
|
||||
|
||||
doc.file = """<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!-- This file is generated by Nimrod. -->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>$title</title>
|
||||
<style type="text/css">
|
||||
|
||||
span.DecNumber {color: blue}
|
||||
span.BinNumber {color: blue}
|
||||
span.HexNumber {color: blue}
|
||||
span.OctNumber {color: blue}
|
||||
span.FloatNumber {color: blue}
|
||||
span.Identifier {color: black}
|
||||
span.Keyword {font-weight: bold}
|
||||
span.StringLit {color: blue}
|
||||
span.LongStringLit {color: blue}
|
||||
span.CharLit {color: blue}
|
||||
span.EscapeSequence {color: black}
|
||||
span.Operator {color: black}
|
||||
span.Punctation {color: black}
|
||||
span.Comment, span.LongComment {font-style:italic; color: green}
|
||||
span.RegularExpression {color: pink}
|
||||
span.TagStart {color: yellow}
|
||||
span.TagEnd {color: yellow}
|
||||
span.Key {color: blue}
|
||||
span.Value {color: black}
|
||||
span.RawData {color: blue}
|
||||
span.Assembler {color: blue}
|
||||
span.Preprocessor {color: yellow}
|
||||
span.Directive {color: yellow}
|
||||
span.Command, span.Rule, span.Hyperlink, span.Label, span.Reference,
|
||||
span.Other {color: black}
|
||||
|
||||
div.navigation {
|
||||
float: left;
|
||||
width: 30%;
|
||||
margin: 0; padding: 0;
|
||||
border: 3px outset #7F7F7F;
|
||||
background-color: #7F7F7F;
|
||||
-moz-border-radius-bottomleft:5px;
|
||||
-moz-border-radius-bottomright:5px;
|
||||
-moz-border-radius-topleft:5px;
|
||||
-moz-border-radius-topright:5px;
|
||||
}
|
||||
|
||||
div.navigation ul {
|
||||
list-style-type: none;
|
||||
padding-left: 1em;
|
||||
}
|
||||
div.navigation ul li a, div.navigation ul li a:visited {
|
||||
font-weight: bold;
|
||||
color: #FFFFFF;
|
||||
text-decoration: none;
|
||||
}
|
||||
div.navigation ul li a:hover {
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
color: gold;
|
||||
}
|
||||
|
||||
div.content {
|
||||
margin-left: 30%;
|
||||
padding: 0 1em;
|
||||
border-left: 4em;
|
||||
}
|
||||
|
||||
dl.item dd, dl.item dd p {
|
||||
margin-top:3px;
|
||||
}
|
||||
dl.item dd pre {
|
||||
margin-left: 15pt;
|
||||
border: 0px;
|
||||
}
|
||||
dl.item dt, dl.item dt pre {
|
||||
margin: 20pt 0 0 0;
|
||||
}
|
||||
|
||||
pre, span.tok {
|
||||
background-color:#F9F9F9;
|
||||
border:1px dotted #2F6FAB;
|
||||
color:black;
|
||||
}
|
||||
|
||||
span.red {
|
||||
color: #A80000;
|
||||
}
|
||||
|
||||
/*
|
||||
:Author: David Goodger
|
||||
:Contact: goodger@python.org
|
||||
:Date: Date: 2006-05-21 22:44:42 +0200 (Sun, 21 May 2006)
|
||||
:Revision: Revision: 4564
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
|
||||
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
/* used to remove borders from tables and images */
|
||||
.borderless, table.borderless td, table.borderless th { border: 0 }
|
||||
|
||||
table.borderless td, table.borderless th {
|
||||
/* Override padding for "table.docutils td" with "! important".
|
||||
The right padding separates the table cells. */
|
||||
padding: 0 0.5em 0 0 ! important }
|
||||
|
||||
.first { margin-top: 0 ! important }
|
||||
.last, .with-subtitle { margin-bottom: 0 ! important }
|
||||
.hidden { display: none }
|
||||
a.toc-backref { text-decoration: none ; color: black }
|
||||
blockquote.epigraph { margin: 2em 5em ; }
|
||||
dl.docutils dd { margin-bottom: 0.5em }
|
||||
div.abstract { margin: 2em 5em }
|
||||
div.abstract p.topic-title { font-weight: bold ; text-align: center }
|
||||
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||
div.hint, div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ; border: medium outset ; padding: 1em }
|
||||
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||
div.important p.admonition-title, div.note p.admonition-title,
|
||||
div.tip p.admonition-title { font-weight: bold ; font-family: sans-serif }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title { color: red ; font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||
compound paragraphs.
|
||||
div.compound .compound-first, div.compound .compound-middle {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.compound .compound-last, div.compound .compound-middle {
|
||||
margin-top: 0.5em }
|
||||
*/
|
||||
|
||||
div.dedication { margin: 2em 5em ; text-align: center ; font-style: italic }
|
||||
div.dedication p.topic-title { font-weight: bold ; font-style: normal }
|
||||
div.figure { margin-left: 2em ; margin-right: 2em }
|
||||
div.footer, div.header { clear: both; font-size: smaller }
|
||||
div.line-block { display: block ; margin-top: 1em ; margin-bottom: 1em }
|
||||
div.line-block div.line-block { margin-top: 0 ; margin-bottom: 0 ;
|
||||
margin-left: 1.5em }
|
||||
div.sidebar { margin-left: 1em ; border: medium outset ;
|
||||
padding: 1em ; background-color: #ffffee ; width: 40% ; float: right ;
|
||||
clear: right }
|
||||
|
||||
div.sidebar p.rubric { font-family: sans-serif ; font-size: medium }
|
||||
div.system-messages { margin: 5em }
|
||||
div.system-messages h1 { color: red }
|
||||
div.system-message { border: medium outset ; padding: 1em }
|
||||
div.system-message p.system-message-title { color: red ; font-weight: bold }
|
||||
div.topic { margin: 2em;}
|
||||
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||
margin-top: 0.4em }
|
||||
h1.title { text-align: center }
|
||||
h2.subtitle { text-align: center }
|
||||
hr.docutils { width: 75% }
|
||||
img.align-left { clear: left }
|
||||
img.align-right { clear: right }
|
||||
ol.simple, ul.simple { margin-bottom: 1em }
|
||||
ol.arabic { list-style: decimal }
|
||||
ol.loweralpha { list-style: lower-alpha }
|
||||
ol.upperalpha { list-style: upper-alpha }
|
||||
ol.lowerroman { list-style: lower-roman }
|
||||
ol.upperroman { list-style: upper-roman }
|
||||
p.attribution { text-align: right ; margin-left: 50% }
|
||||
p.caption { font-style: italic }
|
||||
p.credits { font-style: italic ; font-size: smaller }
|
||||
p.label { white-space: nowrap }
|
||||
p.rubric { font-weight:bold;font-size:larger;color:maroon;text-align:center}
|
||||
p.sidebar-title {font-family: sans-serif ;font-weight: bold ;font-size: larger }
|
||||
p.sidebar-subtitle {font-family: sans-serif ; font-weight: bold }
|
||||
p.topic-title { font-weight: bold }
|
||||
pre.address { margin-bottom: 0;margin-top:0;font-family:serif;font-size:100% }
|
||||
pre.literal-block, pre.doctest-block {margin-left: 2em ;margin-right: 2em }
|
||||
span.classifier {font-family: sans-serif;font-style: oblique }
|
||||
span.classifier-delimiter {font-family: sans-serif;font-weight: bold }
|
||||
span.interpreted {font-family: sans-serif }
|
||||
span.option {white-space: nowrap }
|
||||
span.pre {white-space: pre }
|
||||
span.problematic {color: red }
|
||||
span.section-subtitle {
|
||||
/* font-size relative to parent (h1..h6 element) */
|
||||
font-size: 80% }
|
||||
|
||||
table.citation { border-left: solid 1px gray; margin-left: 1px }
|
||||
table.docinfo {margin: 2em 4em }
|
||||
table.docutils {margin-top: 0.5em;margin-bottom: 0.5em }
|
||||
table.footnote {border-left: solid 1px black;margin-left: 1px }
|
||||
|
||||
table.docutils td, table.docutils th,
|
||||
table.docinfo td, table.docinfo th {padding-left: 0.5em;padding-right: 0.5em;
|
||||
vertical-align: top}
|
||||
|
||||
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||
font-weight: bold;text-align: left;white-space: nowrap;padding-left: 0 }
|
||||
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {font-size: 100% }
|
||||
ul.auto-toc { list-style-type: none }
|
||||
/*a.reference { color: #E00000; font-weight:bold;}
|
||||
a.reference:hover {color: #E00000;background-color: #ffff00;display: margin;
|
||||
font-weight:bold;}*/
|
||||
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
function toggleElem(id) {
|
||||
var e = document.getElementById(id);
|
||||
e.style.display = e.style.display == 'none' ? 'block' : 'none';
|
||||
}
|
||||
|
||||
var gOpen = 'none'
|
||||
function toggleAll() {
|
||||
gOpen = gOpen == 'none' ? 'block' : 'none';
|
||||
var i = 1
|
||||
while (1) {
|
||||
var e = document.getElementById("m"+i)
|
||||
if (!e) break;
|
||||
e.style.display = gOpen
|
||||
i++;
|
||||
}
|
||||
document.getElementById('toggleButton').value =
|
||||
gOpen == 'none' ? 'Show Details' : 'Hide Details';
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="documentId">
|
||||
<h1 class="title">$title</h1>
|
||||
$content
|
||||
<small>Generated: $date $time UTC</small>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
:Author: David Goodger
|
||||
:Contact: goodger@python.org
|
||||
:Date: Date: 2006-05-21 22:44:42 +0200 (Sun, 21 May 2006)
|
||||
:Revision: Revision: 4564
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
|
||||
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
/* used to remove borders from tables and images */
|
||||
.borderless, table.borderless td, table.borderless th { border: 0 }
|
||||
|
||||
table.borderless td, table.borderless th {
|
||||
/* Override padding for "table.docutils td" with "! important".
|
||||
The right padding separates the table cells. */
|
||||
padding: 0 0.5em 0 0 ! important }
|
||||
|
||||
.first { margin-top: 0 ! important }
|
||||
.last, .with-subtitle { margin-bottom: 0 ! important }
|
||||
.hidden { display: none }
|
||||
a.toc-backref { text-decoration: none ; color: black }
|
||||
blockquote.epigraph { margin: 2em 5em ; }
|
||||
dl.docutils dd { margin-bottom: 0.5em }
|
||||
div.abstract { margin: 2em 5em }
|
||||
div.abstract p.topic-title { font-weight: bold ; text-align: center }
|
||||
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||
div.hint, div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ; border: medium outset ; padding: 1em }
|
||||
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||
div.important p.admonition-title, div.note p.admonition-title,
|
||||
div.tip p.admonition-title { font-weight: bold ; font-family: sans-serif }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title { color: red ; font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||
compound paragraphs.
|
||||
div.compound .compound-first, div.compound .compound-middle {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.compound .compound-last, div.compound .compound-middle {
|
||||
margin-top: 0.5em }
|
||||
*/
|
||||
|
||||
div.dedication { margin: 2em 5em ; text-align: center ; font-style: italic }
|
||||
div.dedication p.topic-title { font-weight: bold ; font-style: normal }
|
||||
div.figure { margin-left: 2em ; margin-right: 2em }
|
||||
div.footer, div.header { clear: both; font-size: smaller }
|
||||
div.line-block { display: block ; margin-top: 1em ; margin-bottom: 1em }
|
||||
div.line-block div.line-block { margin-top: 0 ; margin-bottom: 0 ;
|
||||
margin-left: 1.5em }
|
||||
div.sidebar { margin-left: 1em ; border: medium outset ;
|
||||
padding: 1em ; background-color: #ffffee ; /*width: 40% ;*/ float: right ;
|
||||
clear: right }
|
||||
|
||||
div.sidebar p.rubric { font-family: sans-serif ; font-size: medium }
|
||||
div.system-messages { margin: 5em }
|
||||
div.system-messages h1 { color: red }
|
||||
div.system-message { border: medium outset ; padding: 1em }
|
||||
div.system-message p.system-message-title { color: red ; font-weight: bold }
|
||||
div.topic { margin: 2em;}
|
||||
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||
margin-top: 0.4em }
|
||||
h1.title { text-align: center }
|
||||
h2.subtitle { text-align: center }
|
||||
/* hr.docutils { width: 75% } */
|
||||
img.align-left { clear: left }
|
||||
img.align-right { clear: right }
|
||||
ol.simple, ul.simple { margin-bottom: 1em }
|
||||
ol.arabic { list-style: decimal }
|
||||
ol.loweralpha { list-style: lower-alpha }
|
||||
ol.upperalpha { list-style: upper-alpha }
|
||||
ol.lowerroman { list-style: lower-roman }
|
||||
ol.upperroman { list-style: upper-roman }
|
||||
p.attribution { text-align: right ; margin-left: 50% }
|
||||
p.caption { font-style: italic }
|
||||
p.credits { font-style: italic ; font-size: smaller }
|
||||
p.label { white-space: nowrap }
|
||||
p.rubric { font-weight:bold;font-size:larger;color:maroon;text-align:center}
|
||||
p.sidebar-title {font-family: sans-serif ;font-weight: bold ;font-size: larger }
|
||||
p.sidebar-subtitle {font-family: sans-serif ; font-weight: bold }
|
||||
p.topic-title { font-weight: bold }
|
||||
pre.address { margin-bottom: 0;margin-top:0;font-family:serif;font-size:100% }
|
||||
pre.literal-block, pre.doctest-block {margin-left: 2em ;margin-right: 2em }
|
||||
span.classifier {font-family: sans-serif;font-style: oblique }
|
||||
span.classifier-delimiter {font-family: sans-serif;font-weight: bold }
|
||||
span.interpreted {font-family: sans-serif }
|
||||
span.option {white-space: nowrap }
|
||||
span.pre {white-space: pre }
|
||||
span.problematic {color: red }
|
||||
span.section-subtitle {
|
||||
/* font-size relative to parent (h1..h6 element) */
|
||||
font-size: 80% }
|
||||
|
||||
table.citation { border-left: solid 1px gray; margin-left: 1px }
|
||||
table.docinfo {margin: 2em 4em }
|
||||
table.docutils {margin-top: 0.5em;margin-bottom: 0.5em }
|
||||
table.footnote {border-left: solid 1px black;margin-left: 1px }
|
||||
|
||||
table.docutils td, table.docutils th,
|
||||
table.docinfo td, table.docinfo th {padding-left: 0.5em;padding-right: 0.5em;
|
||||
vertical-align: top}
|
||||
|
||||
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||
font-weight: bold;text-align: left;white-space: nowrap;padding-left: 0 }
|
||||
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {font-size: 100% }
|
||||
ul.auto-toc { list-style-type: none }
|
||||
/*a.reference { color: #E00000; font-weight:bold;}
|
||||
a.reference:hover {color: #E00000;background-color: #ffff00;display: margin;
|
||||
font-weight:bold;}*/
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="documentId">
|
||||
<h1 class="title">$title</h1>
|
||||
$content
|
||||
<small>Generated: $date $time UTC</small>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
|
||||
@@ -8,18 +8,21 @@
|
||||
# Environment variables cannot be used in the options, however!
|
||||
|
||||
cc = gcc
|
||||
lib="$nimrod/lib"
|
||||
path="$lib/base"
|
||||
path="$lib/base/gtk"
|
||||
path="$lib/base/cairo"
|
||||
path="$lib/base/x11"
|
||||
path="$lib/base/sdl"
|
||||
path="$lib/base/opengl"
|
||||
path="$lib/base/zip"
|
||||
#lib="" # default can be overridden here
|
||||
path="$lib/pure"
|
||||
path="$lib/impure"
|
||||
path="$lib/wrappers"
|
||||
path="$lib/wrappers/cairo"
|
||||
path="$lib/wrappers/gtk"
|
||||
path="$lib/wrappers/lua"
|
||||
path="$lib/wrappers/opengl"
|
||||
path="$lib/wrappers/pcre"
|
||||
path="$lib/wrappers/sdl"
|
||||
path="$lib/wrappers/x11"
|
||||
path="$lib/wrappers/zip"
|
||||
path="$lib/windows"
|
||||
path="$lib/posix"
|
||||
path="$lib/ecmas"
|
||||
path="$lib/extra"
|
||||
|
||||
@if release:
|
||||
obj_checks:off
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#
|
||||
#
|
||||
# The Nimrod Compiler
|
||||
# (c) Copyright 2008 Andreas Rumpf
|
||||
# (c) Copyright 2009 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
# distribution, for details about the copyright.
|
||||
#
|
||||
|
||||
{
|
||||
'SymFlag': [ # already 26 flags!
|
||||
'SymFlag': [ # already 28 flags!
|
||||
'sfUsed', # read access of sym (for warnings) or simply used
|
||||
'sfStar', # symbol has * visibility
|
||||
'sfMinus', # symbol has - visibility
|
||||
@@ -42,6 +42,7 @@
|
||||
'sfThreadVar', # variable is a thread variable
|
||||
'sfMerge', # proc can be merged with itself
|
||||
'sfDeadCodeElim', # dead code elimination for the module is turned on
|
||||
'sfBorrow' # proc is borrowed
|
||||
],
|
||||
|
||||
'TypeFlag': [
|
||||
@@ -58,8 +59,9 @@
|
||||
'tyGeneric',
|
||||
'tyGenericInst', # instantiated generic type
|
||||
'tyGenericParam',
|
||||
'tyAbstract', # abstract type
|
||||
'tyEnum',
|
||||
'tyAnyEnum',
|
||||
'tyOrdinal',
|
||||
'tyArray',
|
||||
'tyObject',
|
||||
'tyTuple',
|
||||
@@ -233,6 +235,7 @@
|
||||
'nkRefTy',
|
||||
'nkPtrTy',
|
||||
'nkVarTy',
|
||||
'nkAbstractTy', # abstract type
|
||||
'nkProcTy',
|
||||
'nkEnumTy',
|
||||
'nkEnumFieldDef', # `ident = expr` in an enumeration
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
addr and as asm
|
||||
abstract addr and as asm
|
||||
block break
|
||||
case cast const continue converter
|
||||
discard div
|
||||
@@ -14,6 +14,6 @@ raise ref return
|
||||
shl shr
|
||||
template try tuple type
|
||||
var
|
||||
when where while with without
|
||||
when while with without
|
||||
xor
|
||||
yield
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
'High',
|
||||
'SizeOf',
|
||||
'Is',
|
||||
'Echo',
|
||||
'Succ',
|
||||
'Pred',
|
||||
'Inc',
|
||||
@@ -167,7 +168,6 @@
|
||||
'AppendSeqSeq',
|
||||
'InRange',
|
||||
'InSet',
|
||||
'Asgn',
|
||||
'Repr',
|
||||
'Exit',
|
||||
'SetLengthStr',
|
||||
@@ -186,6 +186,7 @@
|
||||
'Range',
|
||||
'Set',
|
||||
'Seq',
|
||||
'Ordinal',
|
||||
'Int',
|
||||
'Int8',
|
||||
'Int16',
|
||||
@@ -199,7 +200,6 @@
|
||||
'String',
|
||||
'Cstring',
|
||||
'Pointer',
|
||||
'AnyEnum',
|
||||
'EmptySet',
|
||||
'IntSetBaseType',
|
||||
'Nil',
|
||||
|
||||
@@ -172,10 +172,9 @@
|
||||
{'errXCannotBeInParamDecl': '$1 cannot be declared in parameter declaration'},
|
||||
{'errPragmaOnlyInHeaderOfProc':
|
||||
'pragmas are only in the header of a proc allowed'},
|
||||
{'errImportedProcCannotHaveImpl':
|
||||
'an imported proc cannot have an implementation'},
|
||||
{'errImplOfXNotAllowed': "implementation of '$1' is not allowed here"},
|
||||
{'errImplOfXNotAllowed': "implementation of '$1' is not allowed"},
|
||||
{'errImplOfXexpected': "implementation of '$1' expected"},
|
||||
{'errNoSymbolToBorrowFromFound': "no symbol to borrow from found"},
|
||||
{'errDiscardValue': 'value returned by statement has to be discarded'},
|
||||
{'errInvalidDiscard': 'statement returns no value that can be discarded'},
|
||||
{'errUnknownPrecedence':
|
||||
|
||||
@@ -155,7 +155,7 @@ colonAndEquals ::= [':' typeDesc] '=' expr
|
||||
constDecl ::= symbol ['*'] [pragma] colonAndEquals [COMMENT | IND COMMENT]
|
||||
| COMMENT
|
||||
constSection ::= 'const' indPush constDecl (SAD constDecl)* DED indPop
|
||||
typeDef ::= typeDesc | objectDef | enumDef
|
||||
typeDef ::= typeDesc | objectDef | enumDef | 'abstract' typeDesc
|
||||
|
||||
objectField ::= symbol ['*'] [pragma]
|
||||
objectIdentPart ::=
|
||||
|
||||
13
doc/lib.txt
13
doc/lib.txt
@@ -48,6 +48,9 @@ Pure libraries
|
||||
* `times <times.html>`_
|
||||
The ``times`` module contains basic support for working with time.
|
||||
|
||||
* `dynlib <dynlib.html>`_
|
||||
This module implements the ability to access symbols from shared libraries.
|
||||
|
||||
* `parseopt <parseopt.html>`_
|
||||
The ``parseopt`` module implements a command line option parser. This
|
||||
supports long and short command options with optional values and command line
|
||||
@@ -202,9 +205,13 @@ not contained in the distribution. You can then find them on the website.
|
||||
Part of the wrapper for Lua.
|
||||
* `lauxlib <lauxlib.html>`_
|
||||
Part of the wrapper for Lua.
|
||||
* `odbcsql <odbcsql.nim>`_
|
||||
interface to the ODBC driver.
|
||||
* `zlib <zlib.nim>`_
|
||||
* `tcl <tcl.html>`_
|
||||
Wrapper for the TCL programming language.
|
||||
* `python <python.html>`_
|
||||
Wrapper for the Python programming language.
|
||||
* `odbcsql <odbcsql.html>`_
|
||||
interface to the ODBC driver.
|
||||
* `zlib <zlib.html>`_
|
||||
Wrapper for the zlib library.
|
||||
* `sdl <sdl.html>`_
|
||||
Part of the wrapper for SDL.
|
||||
|
||||
@@ -1649,7 +1649,7 @@ possible within a single ``type`` section.
|
||||
Generics
|
||||
~~~~~~~~
|
||||
|
||||
`Version 0.7.8: Generic types like in the example do not work.`:red:
|
||||
`Version 0.7.10: Generic types like in the example do not work.`:red:
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
750
doc/theindex.txt
750
doc/theindex.txt
File diff suppressed because it is too large
Load Diff
@@ -396,7 +396,7 @@ is not executed (if an exception occurs).
|
||||
Generics
|
||||
========
|
||||
|
||||
`Version 0.7.8: Complex generic types like in the example do not work.`:red:
|
||||
`Version 0.7.10: Complex generic types like in the example do not work.`:red:
|
||||
|
||||
`Generics`:idx: are Nimrod's means to parametrize procs, iterators or types
|
||||
with `type parameters`:idx:. They are most useful for efficient type safe
|
||||
|
||||
@@ -30,6 +30,10 @@ manually. An alternative is to create a symbolic link in ``/usr/bin``::
|
||||
|
||||
[sudo] ln -s $your_install_dir/bin/nimrod /usr/bin/nimrod
|
||||
|
||||
From version 0.7.10 onwards ``install.sh`` and ``deinstall.sh`` scripts are
|
||||
provided for distributing the files over the UNIX hierarchy. However, this
|
||||
makes updating your Nimrod installation more cumbersome.
|
||||
|
||||
|
||||
Installation on the Macintosh
|
||||
-----------------------------
|
||||
|
||||
24
koch.py
24
koch.py
@@ -12,7 +12,7 @@ from pycompab import *
|
||||
|
||||
# --------------------- constants ----------------------------------------
|
||||
|
||||
NIMROD_VERSION = '0.7.8'
|
||||
NIMROD_VERSION = '0.7.10'
|
||||
# This string contains Nimrod's version. It is the only place
|
||||
# where the version needs to be updated. The rest is done by
|
||||
# the build process automatically. It is replaced **everywhere**!
|
||||
@@ -244,9 +244,9 @@ def MakeExecutable(file):
|
||||
os.chmod(file, 493)
|
||||
|
||||
class Changed:
|
||||
""" Returns a Changed object. This object evals to true if one of the
|
||||
given files has changed, false otherwise in a boolean context. You have
|
||||
to call the object's success() method if the building has been a success.
|
||||
""" Returns a Changed object. check() returns true iff one of the
|
||||
given files has changed. You have to call the object's success()
|
||||
method if the build has been a success.
|
||||
|
||||
Example:
|
||||
|
||||
@@ -342,7 +342,7 @@ def cmd_nim():
|
||||
CogRule("wordrecg", "nim/wordrecg.pas", "data/keywords.txt")
|
||||
CogRule("commands", "nim/commands.pas",
|
||||
"data/basicopt.txt data/advopt.txt")
|
||||
CogRule("macros", "lib/macros.nim", "koch.py data/ast.yml")
|
||||
CogRule("macros", "lib/pure/macros.nim", "koch.py data/ast.yml")
|
||||
c = Changed("nim", Glob("nim/*.pas"), EXPLAIN)
|
||||
if c.check() or force:
|
||||
Exec(FPC_CMD)
|
||||
@@ -353,8 +353,7 @@ def cmd_nim():
|
||||
|
||||
def cmd_rod(options):
|
||||
prereqs = Glob("lib/*.nim") + Glob("rod/*.nim") + [
|
||||
"lib/nimbase.h", "lib/dlmalloc.c", "lib/dlmalloc.h",
|
||||
"config/nimrod.cfg"]
|
||||
"lib/nimbase.h", "config/nimrod.cfg"]
|
||||
c = Changed("rod", prereqs, EXPLAIN)
|
||||
if c.check() or cmd_nim() or force:
|
||||
buildRod(options)
|
||||
@@ -386,7 +385,7 @@ Possible Commands:
|
||||
rodsrc generates Nimrod version from Pascal version
|
||||
web generates the website
|
||||
profile profile the Nimrod compiler
|
||||
csource build the C sources for installation
|
||||
csource [options] build the C sources for installation
|
||||
zip build the installation ZIP package
|
||||
inno build the Inno Setup installer
|
||||
""", NIMROD_VERSION + ' ' * (44-len(NIMROD_VERSION)), sys.version)
|
||||
@@ -423,13 +422,14 @@ def main(args):
|
||||
elif cmd == "profile": cmd_profile()
|
||||
elif cmd == "zip": cmd_zip()
|
||||
elif cmd == "inno": cmd_inno()
|
||||
elif cmd == "csource": cmd_csource()
|
||||
elif cmd == "csource": cmd_csource(join(args[i+1:]))
|
||||
elif cmd == "install": cmd_install() # for backwards compability
|
||||
else: Error("illegal command: " + cmd)
|
||||
|
||||
def cmd_csource():
|
||||
Exec(Subs("nimrod cc -r tools/niminst --var:version=$1 csource rod/nimrod",
|
||||
NIMROD_VERSION))
|
||||
def cmd_csource(args):
|
||||
Exec(Subs(
|
||||
"nimrod cc $2 -r tools/niminst --var:version=$1 csource rod/nimrod $2",
|
||||
NIMROD_VERSION, args))
|
||||
|
||||
def cmd_zip():
|
||||
Exec(Subs("nimrod cc -r tools/niminst --var:version=$1 zip rod/nimrod",
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
; This contains the CPU-dependant variants of some routines.
|
||||
; (C) 2005 Andreas Rumpf
|
||||
; This code was inspired by the Freepascal compiler's sources
|
||||
; All routines here have the _cdecl calling convention because
|
||||
; that is the only convention any C compiler supports.
|
||||
|
||||
\python{
|
||||
import os
|
||||
|
||||
def c(name):
|
||||
if os.name == 'posix':
|
||||
return name
|
||||
else:
|
||||
return "_" + name
|
||||
|
||||
def arg:
|
||||
if os.name == 'posix':
|
||||
return 'rdi'
|
||||
else:
|
||||
return 'rcx' # on win64 uses its own calling convention; this sucks!
|
||||
}
|
||||
|
||||
segment code
|
||||
|
||||
global \c{cpu_inc_locked}
|
||||
global \c{cpu_dec_locked}
|
||||
|
||||
\c{cpu_dec_locked}:
|
||||
lock
|
||||
dec [\arg]
|
||||
setz al
|
||||
ret
|
||||
|
||||
\c{cpu_inc_locked}:
|
||||
lock
|
||||
inc [\arg]
|
||||
setz al
|
||||
ret
|
||||
2716
lib/atomic.h
2716
lib/atomic.h
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,11 +0,0 @@
|
||||
# Container library for Nimrod
|
||||
|
||||
# Data structures for now:
|
||||
# TTable, TSet, TList
|
||||
# Algorithms: Trees, hashing,
|
||||
|
||||
TTable[key, val, [Algorithm]]
|
||||
|
||||
macro TTable(n: typeexpr): typeexpr =
|
||||
|
||||
|
||||
5076
lib/dlmalloc.c
5076
lib/dlmalloc.c
File diff suppressed because it is too large
Load Diff
1143
lib/dlmalloc.h
1143
lib/dlmalloc.h
File diff suppressed because it is too large
Load Diff
169
lib/generics.nim
169
lib/generics.nim
@@ -1,169 +0,0 @@
|
||||
#
|
||||
#
|
||||
# Nimrod's Runtime Library
|
||||
# (c) Copyright 2008 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
# distribution, for details about the copyright.
|
||||
#
|
||||
|
||||
## This module contains basic abstract data types.
|
||||
|
||||
type
|
||||
TListItem[T] = object
|
||||
next, prev: ref TListItem[T]
|
||||
data: T
|
||||
|
||||
TList*[T] = ref TListItem[T]
|
||||
# TIndex*[T] = object
|
||||
|
||||
#proc succ*[T](i: TIndex[T]): TIndex[T] =
|
||||
# result = i.next
|
||||
|
||||
#proc pred*[T](i: TIndex[T]): TIndex[T] =
|
||||
# result = i.prev
|
||||
|
||||
#proc getIndex*[T](c: TList[T]): TIndex[TList[T]] =
|
||||
# return c
|
||||
|
||||
proc init*[T](c: var TList[T]) {.inline.} =
|
||||
c = nil
|
||||
|
||||
iterator items*[T](c: TList[T]): var T {.inline.} =
|
||||
var it = c
|
||||
while it != nil:
|
||||
yield it.data
|
||||
it = it.next
|
||||
|
||||
proc add*[T](c: var TList[T], item: T) {.inline.} =
|
||||
var it: ref TListItem[T]
|
||||
new(it)
|
||||
it.data = item
|
||||
it.prev = c.prev
|
||||
it.next = c.next
|
||||
c = it
|
||||
|
||||
proc incl*[T](c: var TList[T], item: T) =
|
||||
for i in items(c):
|
||||
if i == item: return
|
||||
add(c, item)
|
||||
|
||||
proc excl*[T](c: var TList[T], item: T) =
|
||||
var it: TList[T] = c
|
||||
while it != nil:
|
||||
if it.data == item:
|
||||
# remove from list
|
||||
it = it.next
|
||||
|
||||
proc del*[T](c: var TList[T], item: T) {.inline.} = excl(c, item)
|
||||
|
||||
proc hash*(p: pointer): int {.inline.} =
|
||||
# Returns the hash value of a pointer. This is very fast.
|
||||
return cast[TAddress](p) shr 3
|
||||
|
||||
proc hash*(x: int): int {.inline.} = return x
|
||||
proc hash*(x: char): int {.inline.} = return ord(x)
|
||||
proc hash*(x: bool): int {.inline.} = return ord(x)
|
||||
|
||||
proc hash*(s: string): int =
|
||||
# The generic hash table implementation work on a type `T` that has a hash
|
||||
# proc. Predefined for string, pointers, int, char, bool.
|
||||
var h = 0
|
||||
for i in 0..s.len-1:
|
||||
h = h +% Ord(s[i])
|
||||
h = h +% h shl 10
|
||||
h = h xor (h shr 6)
|
||||
h = h +% h shl 3
|
||||
h = h xor (h shr 11)
|
||||
h = h +% h shl 15
|
||||
result = h
|
||||
|
||||
proc isNil*(x: int): bool {.inline.} = return x == low(int)
|
||||
proc nilValue*(x: int): int {.inline.} = return low(int)
|
||||
proc nilValue*(x: pointer): pointer {.inline.} = return nil
|
||||
proc nilValue*(x: string): string {.inline.} = return nil
|
||||
proc nilValue*[T](x: seq[T]): seq[T] {.inline.} = return nil
|
||||
proc nilValue*(x: float): float {.inline.} = return NaN
|
||||
|
||||
proc mustRehash(len, counter: int): bool =
|
||||
assert(len > counter)
|
||||
result = (len * 2 < counter * 3) or (len-counter < 4)
|
||||
|
||||
proc nextTry(h, maxHash: int): int {.inline.} =
|
||||
return ((5*%h) +% 1) and maxHash
|
||||
|
||||
type
|
||||
TPair*[TKey, TValue] = tuple[key: TKey, val: TValue]
|
||||
TTable*[TKey, TValue] =
|
||||
object of TObject ## A table which stores (key, value)
|
||||
## pairs. The used algorithm is hashing.
|
||||
d: seq[TPair[TKey, TValue]]
|
||||
counter: natural
|
||||
|
||||
const
|
||||
growthFactor = 2 # must be power of two
|
||||
|
||||
proc init*[TKey, TValue](t: var TTable[TKey, TValue], capacity: natural = 32) =
|
||||
newSeq(t.d, capacity)
|
||||
|
||||
proc len*[TKey, TValue](t: TTable[TKey, TValue]): natural = return t.counter
|
||||
|
||||
iterator pairs*[TKey,TValue](t: TTable[TKey,TValue]): TPair[TKey, TValue] =
|
||||
for i in 0..t.d.len-1:
|
||||
if not isNil(t.d[i].key):
|
||||
yield (t.d[i].key, t.d[i].val)
|
||||
|
||||
proc TableRawGet[TKey, TValue](t: TTable[TKey, TValue], key: TKey): int =
|
||||
var h = hash(key) and high(t.d)
|
||||
while not isNil(t.d[h].key):
|
||||
if t.d[h].key == key: return h
|
||||
h = nextTry(h, high(t.d))
|
||||
return -1
|
||||
|
||||
proc `[]`*[TKey, TValue](t: TTable[TKey, TValue], key: TKey): TValue =
|
||||
var index = TableRawGet(t, key)
|
||||
return if index >= 0: t.d[index].val else: nilValue(t.d[0].val)
|
||||
|
||||
proc TableRawInsert[TKey, TValue](data: var seq[TPair[TKey, TValue]],
|
||||
key: TKey, val: TValue) =
|
||||
var h = hash(key) and high(data)
|
||||
while not isNil(data[h].key):
|
||||
assert(data[h].key != key)
|
||||
h = nextTry(h, high(data))
|
||||
assert(isNil(data[h].key))
|
||||
data[h].key = key
|
||||
data[h].val = val
|
||||
|
||||
proc TableEnlarge[TKey, TValue](t: var TTable[TKey, TValue]) =
|
||||
var n: seq[TPair[TKey,TValue]]
|
||||
newSeq(n, len(t.d) * growthFactor)
|
||||
for i in 0..high(t.d):
|
||||
if not isNil(t.d[i].key):
|
||||
TableRawInsert(n, t.d[i].key, t.d[i].val)
|
||||
swap(t.d, n)
|
||||
|
||||
proc `[]=`*[TKey, TValue](t: var TTable[TKey, TValue], key: TKey, val: TValue) =
|
||||
var index = TableRawGet(t, key)
|
||||
if index >= 0:
|
||||
t.d[index].val = val
|
||||
else:
|
||||
if mustRehash(len(t.d), t.counter): TableEnlarge(t)
|
||||
TableRawInsert(t.d, key, val)
|
||||
inc(t.counter)
|
||||
|
||||
proc add*[TKey, TValue](t: var TTable[TKey, TValue], key: TKey, val: TValue) =
|
||||
if mustRehash(len(t.d), t.counter): TableEnlarge(t)
|
||||
TableRawInsert(t.d, key, val)
|
||||
inc(t.counter)
|
||||
|
||||
proc test =
|
||||
var
|
||||
t: TTable[string, int]
|
||||
init(t)
|
||||
t["key1"] = 1
|
||||
t["key2"] = 2
|
||||
t["key3"] = 3
|
||||
for key, val in pairs(t):
|
||||
echo(key & " = " & $val)
|
||||
|
||||
test()
|
||||
@@ -1,70 +0,0 @@
|
||||
; This contains the CPU-dependant variants of some routines.
|
||||
; (C) 2005 Andreas Rumpf
|
||||
; This code was inspired by the Freepascal compiler's sources
|
||||
; All routines here have the _cdecl calling convention because
|
||||
; that is the only convention any C compiler supports.
|
||||
|
||||
\python{
|
||||
# as usual I use my own preprocessor :-)
|
||||
import os
|
||||
|
||||
def c(name):
|
||||
if os.name == 'posix':
|
||||
return name
|
||||
else:
|
||||
return "_" + name
|
||||
}
|
||||
|
||||
segment code
|
||||
|
||||
global \c{cpu_inc_locked}
|
||||
global \c{cpu_dec_locked}
|
||||
global \c{cpu_lock}
|
||||
global \c{cpu_unlock}
|
||||
|
||||
\c{cpu_dec_locked}:
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
mov eax,[ebp+8] ; first parameter to function
|
||||
lock dec dword [eax]
|
||||
setz al
|
||||
mov esp,ebp
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
\c{cpu_inc_locked}:
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
mov eax,[ebp+8] ; first parameter to function
|
||||
lock inc dword [eax]
|
||||
mov esp,ebp
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
; This code uses the highest bit of the RC to indicate that the RC is
|
||||
; locked (spinlock).
|
||||
\c{cpu_lock}
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
mov eax, [ebp+8] ; first parameter to function
|
||||
mov edx, [eax] ; load RC
|
||||
or edx, 0x80000000 ; set highest bit
|
||||
spin:
|
||||
xchg [eax], edx ; atomic instruction!
|
||||
pause ; wait a few cycles
|
||||
and edx, 0x80000000 ; mask highest bit
|
||||
jnz spin
|
||||
mov esp, ebp
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
\c{cpu_unlock}
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
mov eax, [ebp+8] ; first parameter to function
|
||||
mov edx, [eax] ; load RC
|
||||
and edx, 0x7FFFFFFF ; unset highest bit
|
||||
xchg [eax], edx ; atomic instruction!
|
||||
mov esp, ebp
|
||||
pop ebp
|
||||
ret
|
||||
@@ -1,71 +0,0 @@
|
||||
#
|
||||
#
|
||||
# Nimrod's Runtime Library
|
||||
# (c) Copyright 2006 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
# distribution, for details about the copyright.
|
||||
#
|
||||
|
||||
# 64 bit integers for platforms that don't have those
|
||||
|
||||
type
|
||||
IInt64 = tuple[lo, hi: int32]
|
||||
|
||||
proc cmpI64(x, y: IInt64): int32 {.compilerproc.} =
|
||||
result = x.hi -% y.hi
|
||||
if result == 0: result = x.lo -% y.lo
|
||||
|
||||
proc addI64(x, y: IInt64): IInt64 {.compilerproc.} =
|
||||
result = x
|
||||
result.lo = result.lo +% y.lo
|
||||
result.hi = result.hi +% y.hi
|
||||
if y.lo > 0 and result.lo < y.lo:
|
||||
inc(result.hi)
|
||||
elif y.lo < 0 and result.lo > y.lo:
|
||||
dec(result.hi)
|
||||
|
||||
proc subI64(x, y: IInt64): IInt64 {.compilerproc.} =
|
||||
result = x
|
||||
result.lo = result.lo -% y.lo
|
||||
result.hi = result.hi -% y.hi
|
||||
if y.lo > 0 and result.lo < y.lo:
|
||||
inc(result.hi)
|
||||
elif y.lo < 0 and result.lo > y.lo:
|
||||
dec(result.hi)
|
||||
|
||||
proc mulI64(x, y: IInt64): IInt64 {.compilerproc.} =
|
||||
result.lo = x.lo *% y.lo
|
||||
result.hi = y.hi *% y.hi
|
||||
if y.lo > 0 and result.lo < y.lo:
|
||||
inc(result.hi)
|
||||
elif y.lo < 0 and result.lo > y.lo:
|
||||
dec(result.hi)
|
||||
|
||||
proc divI64(x, y: IInt64): IInt64 {.compilerproc.} =
|
||||
# XXX: to implement
|
||||
|
||||
proc modI64(x, y: IInt64): IInt64 {.compilerproc.} =
|
||||
# XXX: to implement
|
||||
|
||||
proc bitandI64(x, y: IInt64): IInt64 {.compilerproc.} =
|
||||
result.hi = x.hi and y.hi
|
||||
result.lo = x.lo and y.lo
|
||||
|
||||
proc bitorI64(x, y: IInt64): IInt64 {.compilerproc.} =
|
||||
result.hi = x.hi or y.hi
|
||||
result.lo = x.lo or y.lo
|
||||
|
||||
proc bitxorI64(x, y: IInt64): IInt64 {.compilerproc.} =
|
||||
result.hi = x.hi xor y.hi
|
||||
result.lo = x.lo xor y.lo
|
||||
|
||||
proc bitnotI64(x: IInt64): IInt64 {.compilerproc.} =
|
||||
result.lo = not x.lo
|
||||
result.hi = not x.hi
|
||||
|
||||
proc shlI64(x, y: IInt64): IInt64 {.compilerproc.} =
|
||||
# XXX: to implement
|
||||
|
||||
proc shrI64(x, y: IInt64): IInt64 {.compilerproc.} =
|
||||
# XXX: to implement
|
||||
@@ -1,18 +0,0 @@
|
||||
#
|
||||
#
|
||||
# Nimrod's Runtime Library
|
||||
# (c) Copyright 2008 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
# distribution, for details about the copyright.
|
||||
#
|
||||
|
||||
# Simple platform dependant lock implementation
|
||||
|
||||
type
|
||||
TSimpleLock = pointer
|
||||
|
||||
proc initLock(s: TSimpleLock)
|
||||
proc deinitLock(s: TSimpleLock)
|
||||
proc lock(s: TSimpleLock)
|
||||
proc unlock(s: TSimpleLock)
|
||||
@@ -1,824 +0,0 @@
|
||||
# Posix detect program
|
||||
# (c) 2009 Andreas Rumpf
|
||||
|
||||
# This program produces a C program that produces a Nimrod include file.
|
||||
# The Nimrod include file lists the values of each POSIX constant.
|
||||
# This is needed because POSIX is brain-dead: It only cares for C, any other
|
||||
# language is ignored. It would have been easier had they specified the
|
||||
# concrete values of the constants. Sigh.
|
||||
|
||||
import os, strutils
|
||||
|
||||
const
|
||||
cc = "gcc -o $1 $1.c"
|
||||
|
||||
cfile = """
|
||||
/* Generated by detect.nim */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
$1
|
||||
|
||||
int main() {
|
||||
FILE* f;
|
||||
f = fopen("$3_$4_consts.nim", "w+");
|
||||
fputs("# Generated by detect.nim\nconst\n", f);
|
||||
$2
|
||||
fclose(f);
|
||||
}
|
||||
"""
|
||||
|
||||
type
|
||||
TTypeKind = enum
|
||||
cint, cshort, clong, cstring, pointer
|
||||
|
||||
var
|
||||
hd = ""
|
||||
tl = ""
|
||||
|
||||
proc myExec(cmd: string): bool =
|
||||
return executeShellCommand(cmd) == 0
|
||||
|
||||
proc header(s: string): bool =
|
||||
const testh = "testh"
|
||||
var f: TFile
|
||||
if openFile(f, appendFileExt(testh, "c"), fmWrite):
|
||||
f.write("#include $1\n" % s)
|
||||
f.write("int main() { return 0; }\n")
|
||||
closeFile(f)
|
||||
result = myExec(cc % testh)
|
||||
removeFile(appendFileExt(testh, "c"))
|
||||
if result:
|
||||
addf(hd, "#include $1\n", s)
|
||||
echo("Found: ", s)
|
||||
else:
|
||||
echo("Not found: ", s)
|
||||
|
||||
proc main =
|
||||
const gen = "genconsts"
|
||||
var f: TFile
|
||||
if openFile(f, appendFileExt(gen, "c"), fmWrite):
|
||||
f.write(cfile % [hd, tl, system.hostOS, system.hostCPU])
|
||||
closeFile(f)
|
||||
if not myExec(cc % gen): quit(1)
|
||||
if not myExec("./" & gen): quit(1)
|
||||
removeFile(appendFileExt(gen, "c"))
|
||||
echo("Success")
|
||||
|
||||
proc v(name: string, typ: TTypeKind=cint) =
|
||||
var n = if name[0] == '_': copy(name, 1) else: name
|
||||
var t = $typ
|
||||
case typ
|
||||
of pointer:
|
||||
addf(tl,
|
||||
"#ifdef $3\n fprintf(f, \" $1* = cast[$2](%p)\\n\", $3);\n#endif\n",
|
||||
n, t, name)
|
||||
|
||||
of cstring:
|
||||
addf(tl,
|
||||
"#ifdef $3\n fprintf(f, \" $1* = $2(\\\"%s\\\")\\n\", $3);\n#endif\n",
|
||||
n, t, name)
|
||||
of clong:
|
||||
addf(tl,
|
||||
"#ifdef $3\n fprintf(f, \" $1* = $2(%ld)\\n\", $3);\n#endif\n",
|
||||
n, t, name)
|
||||
else:
|
||||
addf(tl,
|
||||
"#ifdef $3\n fprintf(f, \" $1* = $2(%d)\\n\", $3);\n#endif\n",
|
||||
n, t, name)
|
||||
|
||||
if header("<aio.h>"):
|
||||
v("AIO_ALLDONE")
|
||||
v("AIO_CANCELED")
|
||||
v("AIO_NOTCANCELED")
|
||||
v("LIO_NOP")
|
||||
v("LIO_NOWAIT")
|
||||
v("LIO_READ")
|
||||
v("LIO_WAIT")
|
||||
v("LIO_WRITE")
|
||||
|
||||
if header("<dlfcn.h>"):
|
||||
v("RTLD_LAZY")
|
||||
v("RTLD_NOW")
|
||||
v("RTLD_GLOBAL")
|
||||
v("RTLD_LOCAL")
|
||||
|
||||
if header("<errno.h>"):
|
||||
v("E2BIG")
|
||||
v("EACCES")
|
||||
v("EADDRINUSE")
|
||||
v("EADDRNOTAVAIL")
|
||||
v("EAFNOSUPPORT")
|
||||
v("EAGAIN")
|
||||
v("EALREADY")
|
||||
v("EBADF")
|
||||
v("EBADMSG")
|
||||
v("EBUSY")
|
||||
v("ECANCELED")
|
||||
v("ECHILD")
|
||||
v("ECONNABORTED")
|
||||
v("ECONNREFUSED")
|
||||
v("ECONNRESET")
|
||||
v("EDEADLK")
|
||||
v("EDESTADDRREQ")
|
||||
v("EDOM")
|
||||
v("EDQUOT")
|
||||
v("EEXIST")
|
||||
v("EFAULT")
|
||||
v("EFBIG")
|
||||
v("EHOSTUNREACH")
|
||||
v("EIDRM")
|
||||
v("EILSEQ")
|
||||
v("EINPROGRESS")
|
||||
v("EINTR")
|
||||
v("EINVAL")
|
||||
v("EIO")
|
||||
v("EISCONN")
|
||||
v("EISDIR")
|
||||
v("ELOOP")
|
||||
v("EMFILE")
|
||||
v("EMLINK")
|
||||
v("EMSGSIZE")
|
||||
v("EMULTIHOP")
|
||||
v("ENAMETOOLONG")
|
||||
v("ENETDOWN")
|
||||
v("ENETRESET")
|
||||
v("ENETUNREACH")
|
||||
v("ENFILE")
|
||||
v("ENOBUFS")
|
||||
v("ENODATA")
|
||||
v("ENODEV")
|
||||
v("ENOENT")
|
||||
v("ENOEXEC")
|
||||
v("ENOLCK")
|
||||
v("ENOLINK")
|
||||
v("ENOMEM")
|
||||
v("ENOMSG")
|
||||
v("ENOPROTOOPT")
|
||||
v("ENOSPC")
|
||||
v("ENOSR")
|
||||
v("ENOSTR")
|
||||
v("ENOSYS")
|
||||
v("ENOTCONN")
|
||||
v("ENOTDIR")
|
||||
v("ENOTEMPTY")
|
||||
v("ENOTSOCK")
|
||||
v("ENOTSUP")
|
||||
v("ENOTTY")
|
||||
v("ENXIO")
|
||||
v("EOPNOTSUPP")
|
||||
v("EOVERFLOW")
|
||||
v("EPERM")
|
||||
v("EPIPE")
|
||||
v("EPROTO")
|
||||
v("EPROTONOSUPPORT")
|
||||
v("EPROTOTYPE")
|
||||
v("ERANGE")
|
||||
v("EROFS")
|
||||
v("ESPIPE")
|
||||
v("ESRCH")
|
||||
v("ESTALE")
|
||||
v("ETIME")
|
||||
v("ETIMEDOUT")
|
||||
v("ETXTBSY")
|
||||
v("EWOULDBLOCK")
|
||||
v("EXDEV")
|
||||
|
||||
if header("<fcntl.h>"):
|
||||
v("F_DUPFD")
|
||||
v("F_GETFD")
|
||||
v("F_SETFD")
|
||||
v("F_GETFL")
|
||||
v("F_SETFL")
|
||||
v("F_GETLK")
|
||||
v("F_SETLK")
|
||||
v("F_SETLKW")
|
||||
v("F_GETOWN")
|
||||
v("F_SETOWN")
|
||||
v("FD_CLOEXEC")
|
||||
v("F_RDLCK")
|
||||
v("F_UNLCK")
|
||||
v("F_WRLCK")
|
||||
v("O_CREAT")
|
||||
v("O_EXCL")
|
||||
v("O_NOCTTY")
|
||||
v("O_TRUNC")
|
||||
v("O_APPEND")
|
||||
v("O_DSYNC")
|
||||
v("O_NONBLOCK")
|
||||
v("O_RSYNC")
|
||||
v("O_SYNC")
|
||||
v("O_ACCMODE")
|
||||
v("O_RDONLY")
|
||||
v("O_RDWR")
|
||||
v("O_WRONLY")
|
||||
v("POSIX_FADV_NORMAL")
|
||||
v("POSIX_FADV_SEQUENTIAL")
|
||||
v("POSIX_FADV_RANDOM")
|
||||
v("POSIX_FADV_WILLNEED")
|
||||
v("POSIX_FADV_DONTNEED")
|
||||
v("POSIX_FADV_NOREUSE")
|
||||
|
||||
if header("<fenv.h>"):
|
||||
v("FE_DIVBYZERO")
|
||||
v("FE_INEXACT")
|
||||
v("FE_INVALID")
|
||||
v("FE_OVERFLOW")
|
||||
v("FE_UNDERFLOW")
|
||||
v("FE_ALL_EXCEPT")
|
||||
v("FE_DOWNWARD")
|
||||
v("FE_TONEAREST")
|
||||
v("FE_TOWARDZERO")
|
||||
v("FE_UPWARD")
|
||||
v("FE_DFL_ENV", pointer)
|
||||
|
||||
if header("<fmtmsg.h>"):
|
||||
v("MM_HARD")
|
||||
v("MM_SOFT")
|
||||
v("MM_FIRM")
|
||||
v("MM_APPL")
|
||||
v("MM_UTIL")
|
||||
v("MM_OPSYS")
|
||||
v("MM_RECOVER")
|
||||
v("MM_NRECOV")
|
||||
v("MM_HALT")
|
||||
v("MM_ERROR")
|
||||
v("MM_WARNING")
|
||||
v("MM_INFO")
|
||||
v("MM_NOSEV")
|
||||
v("MM_PRINT")
|
||||
v("MM_CONSOLE")
|
||||
v("MM_OK")
|
||||
v("MM_NOTOK")
|
||||
v("MM_NOMSG")
|
||||
v("MM_NOCON")
|
||||
|
||||
if header("<fnmatch.h>"):
|
||||
v("FNM_NOMATCH")
|
||||
v("FNM_PATHNAME")
|
||||
v("FNM_PERIOD")
|
||||
v("FNM_NOESCAPE")
|
||||
v("FNM_NOSYS")
|
||||
|
||||
if header("<ftw.h>"):
|
||||
v("FTW_F")
|
||||
v("FTW_D")
|
||||
v("FTW_DNR")
|
||||
v("FTW_DP")
|
||||
v("FTW_NS")
|
||||
v("FTW_SL")
|
||||
v("FTW_SLN")
|
||||
v("FTW_PHYS")
|
||||
v("FTW_MOUNT")
|
||||
v("FTW_DEPTH")
|
||||
v("FTW_CHDIR")
|
||||
|
||||
if header("<glob.h>"):
|
||||
v("GLOB_APPEND")
|
||||
v("GLOB_DOOFFS")
|
||||
v("GLOB_ERR")
|
||||
v("GLOB_MARK")
|
||||
v("GLOB_NOCHECK")
|
||||
v("GLOB_NOESCAPE")
|
||||
v("GLOB_NOSORT")
|
||||
v("GLOB_ABORTED")
|
||||
v("GLOB_NOMATCH")
|
||||
v("GLOB_NOSPACE")
|
||||
v("GLOB_NOSYS")
|
||||
|
||||
if header("<langinfo.h>"):
|
||||
v("CODESET")
|
||||
v("D_T_FMT")
|
||||
v("D_FMT")
|
||||
v("T_FMT")
|
||||
v("T_FMT_AMPM")
|
||||
v("AM_STR")
|
||||
v("PM_STR")
|
||||
v("DAY_1")
|
||||
v("DAY_2")
|
||||
v("DAY_3")
|
||||
v("DAY_4")
|
||||
v("DAY_5")
|
||||
v("DAY_6")
|
||||
v("DAY_7")
|
||||
v("ABDAY_1")
|
||||
v("ABDAY_2")
|
||||
v("ABDAY_3")
|
||||
v("ABDAY_4")
|
||||
v("ABDAY_5")
|
||||
v("ABDAY_6")
|
||||
v("ABDAY_7")
|
||||
v("MON_1")
|
||||
v("MON_2")
|
||||
v("MON_3")
|
||||
v("MON_4")
|
||||
v("MON_5")
|
||||
v("MON_6")
|
||||
v("MON_7")
|
||||
v("MON_8")
|
||||
v("MON_9")
|
||||
v("MON_10")
|
||||
v("MON_11")
|
||||
v("MON_12")
|
||||
v("ABMON_1")
|
||||
v("ABMON_2")
|
||||
v("ABMON_3")
|
||||
v("ABMON_4")
|
||||
v("ABMON_5")
|
||||
v("ABMON_6")
|
||||
v("ABMON_7")
|
||||
v("ABMON_8")
|
||||
v("ABMON_9")
|
||||
v("ABMON_10")
|
||||
v("ABMON_11")
|
||||
v("ABMON_12")
|
||||
v("ERA")
|
||||
v("ERA_D_FMT")
|
||||
v("ERA_D_T_FMT")
|
||||
v("ERA_T_FMT")
|
||||
v("ALT_DIGITS")
|
||||
v("RADIXCHAR")
|
||||
v("THOUSEP")
|
||||
v("YESEXPR")
|
||||
v("NOEXPR")
|
||||
v("CRNCYSTR")
|
||||
|
||||
if header("<locale.h>"):
|
||||
v("LC_ALL") #{.importc, header: .}: cint
|
||||
v("LC_COLLATE") #{.importc, header: "<locale.h>".}: cint
|
||||
v("LC_CTYPE") #{.importc, header: "<locale.h>".}: cint
|
||||
v("LC_MESSAGES") #{.importc, header: "<locale.h>".}: cint
|
||||
v("LC_MONETARY") #{.importc, header: "<locale.h>".}: cint
|
||||
v("LC_NUMERIC") #{.importc, header: "<locale.h>".}: cint
|
||||
v("LC_TIME") #{.importc, header: "<locale.h>".}: cint
|
||||
|
||||
if header("<pthread.h>"):
|
||||
v("PTHREAD_BARRIER_SERIAL_THREAD")
|
||||
v("PTHREAD_CANCEL_ASYNCHRONOUS")
|
||||
v("PTHREAD_CANCEL_ENABLE")
|
||||
v("PTHREAD_CANCEL_DEFERRED")
|
||||
v("PTHREAD_CANCEL_DISABLE")
|
||||
#v("PTHREAD_CANCELED")
|
||||
#v("PTHREAD_COND_INITIALIZER")
|
||||
v("PTHREAD_CREATE_DETACHED")
|
||||
v("PTHREAD_CREATE_JOINABLE")
|
||||
v("PTHREAD_EXPLICIT_SCHED")
|
||||
v("PTHREAD_INHERIT_SCHED")
|
||||
v("PTHREAD_MUTEX_DEFAULT")
|
||||
v("PTHREAD_MUTEX_ERRORCHECK")
|
||||
#v("PTHREAD_MUTEX_INITIALIZER")
|
||||
v("PTHREAD_MUTEX_NORMAL")
|
||||
v("PTHREAD_MUTEX_RECURSIVE") #{.importc, header: "<pthread.h>".}: cint
|
||||
v("PTHREAD_ONCE_INIT") #{.importc, header: "<pthread.h>".}: cint
|
||||
v("PTHREAD_PRIO_INHERIT") #{.importc, header: "<pthread.h>".}: cint
|
||||
v("PTHREAD_PRIO_NONE") #{.importc, header: "<pthread.h>".}: cint
|
||||
v("PTHREAD_PRIO_PROTECT") #{.importc, header: "<pthread.h>".}: cint
|
||||
v("PTHREAD_PROCESS_SHARED") #{.importc, header: "<pthread.h>".}: cint
|
||||
v("PTHREAD_PROCESS_PRIVATE") #{.importc, header: "<pthread.h>".}: cint
|
||||
v("PTHREAD_SCOPE_PROCESS") #{.importc, header: "<pthread.h>".}: cint
|
||||
v("PTHREAD_SCOPE_SYSTEM") #{.importc, header: "<pthread.h>".}: cint
|
||||
|
||||
if header("<unistd.h>"):
|
||||
v("_POSIX_ASYNC_IO")
|
||||
v("_POSIX_PRIO_IO")
|
||||
v("_POSIX_SYNC_IO")
|
||||
v("F_OK")
|
||||
v("R_OK")
|
||||
v("W_OK")
|
||||
v("X_OK")
|
||||
|
||||
v("_CS_PATH")
|
||||
v("_CS_POSIX_V6_ILP32_OFF32_CFLAGS")
|
||||
v("_CS_POSIX_V6_ILP32_OFF32_LDFLAGS")
|
||||
v("_CS_POSIX_V6_ILP32_OFF32_LIBS")
|
||||
v("_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS")
|
||||
v("_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS")
|
||||
v("_CS_POSIX_V6_ILP32_OFFBIG_LIBS")
|
||||
v("_CS_POSIX_V6_LP64_OFF64_CFLAGS")
|
||||
v("_CS_POSIX_V6_LP64_OFF64_LDFLAGS")
|
||||
v("_CS_POSIX_V6_LP64_OFF64_LIBS")
|
||||
v("_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS")
|
||||
v("_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS")
|
||||
v("_CS_POSIX_V6_LPBIG_OFFBIG_LIBS")
|
||||
v("_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS")
|
||||
|
||||
v("F_LOCK")
|
||||
v("F_TEST") #{.importc: "F_TEST", header: "<unistd.h>".}: cint
|
||||
v("F_TLOCK") #{.importc: "F_TLOCK", header: "<unistd.h>".}: cint
|
||||
v("F_ULOCK") #{.importc: "F_ULOCK", header: "<unistd.h>".}: cint
|
||||
v("_PC_2_SYMLINKS") #{.importc: "_PC_2_SYMLINKS", header: "<unistd.h>".}: cint
|
||||
v("_PC_ALLOC_SIZE_MIN")
|
||||
v("_PC_ASYNC_IO") #{.importc: "_PC_ASYNC_IO", header: "<unistd.h>".}: cint
|
||||
v("_PC_CHOWN_RESTRICTED")
|
||||
v("_PC_FILESIZEBITS") #{.importc: "_PC_FILESIZEBITS", header: "<unistd.h>".}: cint
|
||||
v("_PC_LINK_MAX") #{.importc: "_PC_LINK_MAX", header: "<unistd.h>".}: cint
|
||||
v("_PC_MAX_CANON") #{.importc: "_PC_MAX_CANON", header: "<unistd.h>".}: cint
|
||||
v("_PC_MAX_INPUT") #{.importc: "_PC_MAX_INPUT", header: "<unistd.h>".}: cint
|
||||
v("_PC_NAME_MAX") #{.importc: "_PC_NAME_MAX", header: "<unistd.h>".}: cint
|
||||
v("_PC_NO_TRUNC") #{.importc: "_PC_NO_TRUNC", header: "<unistd.h>".}: cint
|
||||
v("_PC_PATH_MAX") #{.importc: "_PC_PATH_MAX", header: "<unistd.h>".}: cint
|
||||
v("_PC_PIPE_BUF") #{.importc: "_PC_PIPE_BUF", header: "<unistd.h>".}: cint
|
||||
v("_PC_PRIO_IO") #{.importc: "_PC_PRIO_IO", header: "<unistd.h>".}: cint
|
||||
v("_PC_REC_INCR_XFER_SIZE")
|
||||
v("_PC_REC_MIN_XFER_SIZE")
|
||||
v("_PC_REC_XFER_ALIGN")
|
||||
v("_PC_SYMLINK_MAX") #{.importc: "_PC_SYMLINK_MAX", header: "<unistd.h>".}: cint
|
||||
v("_PC_SYNC_IO") #{.importc: "_PC_SYNC_IO", header: "<unistd.h>".}: cint
|
||||
v("_PC_VDISABLE") #{.importc: "_PC_VDISABLE", header: "<unistd.h>".}: cint
|
||||
v("_SC_2_C_BIND") #{.importc: "_SC_2_C_BIND", header: "<unistd.h>".}: cint
|
||||
v("_SC_2_C_DEV") #{.importc: "_SC_2_C_DEV", header: "<unistd.h>".}: cint
|
||||
v("_SC_2_CHAR_TERM") #{.importc: "_SC_2_CHAR_TERM", header: "<unistd.h>".}: cint
|
||||
v("_SC_2_FORT_DEV") #{.importc: "_SC_2_FORT_DEV", header: "<unistd.h>".}: cint
|
||||
v("_SC_2_FORT_RUN") #{.importc: "_SC_2_FORT_RUN", header: "<unistd.h>".}: cint
|
||||
v("_SC_2_LOCALEDEF") #{.importc: "_SC_2_LOCALEDEF", header: "<unistd.h>".}: cint
|
||||
v("_SC_2_PBS") #{.importc: "_SC_2_PBS", header: "<unistd.h>".}: cint
|
||||
v("_SC_2_PBS_ACCOUNTING")
|
||||
v("_SC_2_PBS_CHECKPOINT")
|
||||
v("_SC_2_PBS_LOCATE") #{.importc: "_SC_2_PBS_LOCATE", header: "<unistd.h>".}: cint
|
||||
v("_SC_2_PBS_MESSAGE") #{.importc: "_SC_2_PBS_MESSAGE", header: "<unistd.h>".}: cint
|
||||
v("_SC_2_PBS_TRACK") #{.importc: "_SC_2_PBS_TRACK", header: "<unistd.h>".}: cint
|
||||
v("_SC_2_SW_DEV") #{.importc: "_SC_2_SW_DEV", header: "<unistd.h>".}: cint
|
||||
v("_SC_2_UPE") #{.importc: "_SC_2_UPE", header: "<unistd.h>".}: cint
|
||||
v("_SC_2_VERSION") #{.importc: "_SC_2_VERSION", header: "<unistd.h>".}: cint
|
||||
v("_SC_ADVISORY_INFO") #{.importc: "_SC_ADVISORY_INFO", header: "<unistd.h>".}: cint
|
||||
v("_SC_AIO_LISTIO_MAX")
|
||||
v("_SC_AIO_MAX") #{.importc: "_SC_AIO_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_AIO_PRIO_DELTA_MAX")
|
||||
v("_SC_ARG_MAX") #{.importc: "_SC_ARG_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_ASYNCHRONOUS_IO")
|
||||
v("_SC_ATEXIT_MAX") #{.importc: "_SC_ATEXIT_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_BARRIERS") #{.importc: "_SC_BARRIERS", header: "<unistd.h>".}: cint
|
||||
v("_SC_BC_BASE_MAX") #{.importc: "_SC_BC_BASE_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_BC_DIM_MAX") #{.importc: "_SC_BC_DIM_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_BC_SCALE_MAX") #{.importc: "_SC_BC_SCALE_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_BC_STRING_MAX") #{.importc: "_SC_BC_STRING_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_CHILD_MAX") #{.importc: "_SC_CHILD_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_CLK_TCK") #{.importc: "_SC_CLK_TCK", header: "<unistd.h>".}: cint
|
||||
v("_SC_CLOCK_SELECTION")
|
||||
v("_SC_COLL_WEIGHTS_MAX")
|
||||
v("_SC_CPUTIME") #{.importc: "_SC_CPUTIME", header: "<unistd.h>".}: cint
|
||||
v("_SC_DELAYTIMER_MAX")
|
||||
v("_SC_EXPR_NEST_MAX") #{.importc: "_SC_EXPR_NEST_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_FSYNC") #{.importc: "_SC_FSYNC", header: "<unistd.h>".}: cint
|
||||
v("_SC_GETGR_R_SIZE_MAX")
|
||||
v("_SC_GETPW_R_SIZE_MAX")
|
||||
v("_SC_HOST_NAME_MAX") #{.importc: "_SC_HOST_NAME_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_IOV_MAX") #{.importc: "_SC_IOV_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_IPV6") #{.importc: "_SC_IPV6", header: "<unistd.h>".}: cint
|
||||
v("_SC_JOB_CONTROL") #{.importc: "_SC_JOB_CONTROL", header: "<unistd.h>".}: cint
|
||||
v("_SC_LINE_MAX") #{.importc: "_SC_LINE_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_LOGIN_NAME_MAX")
|
||||
v("_SC_MAPPED_FILES") #{.importc: "_SC_MAPPED_FILES", header: "<unistd.h>".}: cint
|
||||
v("_SC_MEMLOCK") #{.importc: "_SC_MEMLOCK", header: "<unistd.h>".}: cint
|
||||
v("_SC_MEMLOCK_RANGE") #{.importc: "_SC_MEMLOCK_RANGE", header: "<unistd.h>".}: cint
|
||||
v("_SC_MEMORY_PROTECTION")
|
||||
v("_SC_MESSAGE_PASSING")
|
||||
v("_SC_MONOTONIC_CLOCK")
|
||||
v("_SC_MQ_OPEN_MAX") #{.importc: "_SC_MQ_OPEN_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_MQ_PRIO_MAX") #{.importc: "_SC_MQ_PRIO_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_NGROUPS_MAX") #{.importc: "_SC_NGROUPS_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_OPEN_MAX") #{.importc: "_SC_OPEN_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_PAGE_SIZE") #{.importc: "_SC_PAGE_SIZE", header: "<unistd.h>".}: cint
|
||||
v("_SC_PRIORITIZED_IO")
|
||||
v("_SC_PRIORITY_SCHEDULING")
|
||||
v("_SC_RAW_SOCKETS") #{.importc: "_SC_RAW_SOCKETS", header: "<unistd.h>".}: cint
|
||||
v("_SC_RE_DUP_MAX") #{.importc: "_SC_RE_DUP_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_READER_WRITER_LOCKS")
|
||||
v("_SC_REALTIME_SIGNALS")
|
||||
v("_SC_REGEXP") #{.importc: "_SC_REGEXP", header: "<unistd.h>".}: cint
|
||||
v("_SC_RTSIG_MAX") #{.importc: "_SC_RTSIG_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_SAVED_IDS") #{.importc: "_SC_SAVED_IDS", header: "<unistd.h>".}: cint
|
||||
v("_SC_SEM_NSEMS_MAX") #{.importc: "_SC_SEM_NSEMS_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_SEM_VALUE_MAX") #{.importc: "_SC_SEM_VALUE_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_SEMAPHORES") #{.importc: "_SC_SEMAPHORES", header: "<unistd.h>".}: cint
|
||||
v("_SC_SHARED_MEMORY_OBJECTS")
|
||||
v("_SC_SHELL") #{.importc: "_SC_SHELL", header: "<unistd.h>".}: cint
|
||||
v("_SC_SIGQUEUE_MAX") #{.importc: "_SC_SIGQUEUE_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_SPAWN") #{.importc: "_SC_SPAWN", header: "<unistd.h>".}: cint
|
||||
v("_SC_SPIN_LOCKS") #{.importc: "_SC_SPIN_LOCKS", header: "<unistd.h>".}: cint
|
||||
v("_SC_SPORADIC_SERVER")
|
||||
v("_SC_SS_REPL_MAX") #{.importc: "_SC_SS_REPL_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_STREAM_MAX") #{.importc: "_SC_STREAM_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_SYMLOOP_MAX") #{.importc: "_SC_SYMLOOP_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_SYNCHRONIZED_IO")
|
||||
v("_SC_THREAD_ATTR_STACKADDR")
|
||||
v("_SC_THREAD_ATTR_STACKSIZE")
|
||||
v("_SC_THREAD_CPUTIME")
|
||||
v("_SC_THREAD_DESTRUCTOR_ITERATIONS")
|
||||
v("_SC_THREAD_KEYS_MAX")
|
||||
v("_SC_THREAD_PRIO_INHERIT")
|
||||
v("_SC_THREAD_PRIO_PROTECT")
|
||||
v("_SC_THREAD_PRIORITY_SCHEDULING")
|
||||
v("_SC_THREAD_PROCESS_SHARED")
|
||||
v("_SC_THREAD_SAFE_FUNCTIONS")
|
||||
v("_SC_THREAD_SPORADIC_SERVER")
|
||||
v("_SC_THREAD_STACK_MIN")
|
||||
v("_SC_THREAD_THREADS_MAX")
|
||||
v("_SC_THREADS") #{.importc: "_SC_THREADS", header: "<unistd.h>".}: cint
|
||||
v("_SC_TIMEOUTS") #{.importc: "_SC_TIMEOUTS", header: "<unistd.h>".}: cint
|
||||
v("_SC_TIMER_MAX") #{.importc: "_SC_TIMER_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_TIMERS") #{.importc: "_SC_TIMERS", header: "<unistd.h>".}: cint
|
||||
v("_SC_TRACE") #{.importc: "_SC_TRACE", header: "<unistd.h>".}: cint
|
||||
v("_SC_TRACE_EVENT_FILTER")
|
||||
v("_SC_TRACE_EVENT_NAME_MAX")
|
||||
v("_SC_TRACE_INHERIT") #{.importc: "_SC_TRACE_INHERIT", header: "<unistd.h>".}: cint
|
||||
v("_SC_TRACE_LOG") #{.importc: "_SC_TRACE_LOG", header: "<unistd.h>".}: cint
|
||||
v("_SC_TRACE_NAME_MAX")
|
||||
v("_SC_TRACE_SYS_MAX") #{.importc: "_SC_TRACE_SYS_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_TRACE_USER_EVENT_MAX")
|
||||
v("_SC_TTY_NAME_MAX") #{.importc: "_SC_TTY_NAME_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_TYPED_MEMORY_OBJECTS")
|
||||
v("_SC_TZNAME_MAX") #{.importc: "_SC_TZNAME_MAX", header: "<unistd.h>".}: cint
|
||||
v("_SC_V6_ILP32_OFF32")
|
||||
v("_SC_V6_ILP32_OFFBIG")
|
||||
v("_SC_V6_LP64_OFF64") #{.importc: "_SC_V6_LP64_OFF64", header: "<unistd.h>".}: cint
|
||||
v("_SC_V6_LPBIG_OFFBIG")
|
||||
v("_SC_VERSION") #{.importc: "_SC_VERSION", header: "<unistd.h>".}: cint
|
||||
v("_SC_XBS5_ILP32_OFF32")
|
||||
v("_SC_XBS5_ILP32_OFFBIG")
|
||||
v("_SC_XBS5_LP64_OFF64")
|
||||
v("_SC_XBS5_LPBIG_OFFBIG")
|
||||
v("_SC_XOPEN_CRYPT") #{.importc: "_SC_XOPEN_CRYPT", header: "<unistd.h>".}: cint
|
||||
v("_SC_XOPEN_ENH_I18N")
|
||||
v("_SC_XOPEN_LEGACY") #{.importc: "_SC_XOPEN_LEGACY", header: "<unistd.h>".}: cint
|
||||
v("_SC_XOPEN_REALTIME")
|
||||
v("_SC_XOPEN_REALTIME_THREADS")
|
||||
v("_SC_XOPEN_SHM") #{.importc: "_SC_XOPEN_SHM", header: "<unistd.h>".}: cint
|
||||
v("_SC_XOPEN_STREAMS") #{.importc: "_SC_XOPEN_STREAMS", header: "<unistd.h>".}: cint
|
||||
v("_SC_XOPEN_UNIX") #{.importc: "_SC_XOPEN_UNIX", header: "<unistd.h>".}: cint
|
||||
v("_SC_XOPEN_VERSION") #{.importc: "_SC_XOPEN_VERSION", header: "<unistd.h>".}: cint
|
||||
|
||||
v("SEEK_SET") #{.importc, header: "<unistd.h>".}: cint
|
||||
v("SEEK_CUR") #{.importc, header: "<unistd.h>".}: cint
|
||||
v("SEEK_END") #{.importc, header: "<unistd.h>".}: cint
|
||||
|
||||
|
||||
if header("<semaphore.h>"):
|
||||
v("SEM_FAILED", pointer)
|
||||
|
||||
if header("<sys/ipc.h>"):
|
||||
v("IPC_CREAT") #{.importc, header: .}: cint
|
||||
v("IPC_EXCL") #{.importc, header: "<sys/ipc.h>".}: cint
|
||||
v("IPC_NOWAIT") #{.importc, header: "<sys/ipc.h>".}: cint
|
||||
v("IPC_PRIVATE") #{.importc, header: "<sys/ipc.h>".}: cint
|
||||
v("IPC_RMID") #{.importc, header: "<sys/ipc.h>".}: cint
|
||||
v("IPC_SET") #{.importc, header: "<sys/ipc.h>".}: cint
|
||||
v("IPC_STAT") #{.importc, header: "<sys/ipc.h>".}: cint
|
||||
|
||||
if header("<sys/stat.h>"):
|
||||
v("S_IFMT") #{.importc, header: .}: cint
|
||||
v("S_IFBLK") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_IFCHR") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_IFIFO") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_IFREG") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_IFDIR") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_IFLNK") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_IFSOCK") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_IRWXU") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_IRUSR") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_IWUSR") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_IXUSR") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_IRWXG") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_IRGRP") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_IWGRP") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_IXGRP") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_IRWXO") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_IROTH") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_IWOTH") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_IXOTH") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_ISUID") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_ISGID") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
v("S_ISVTX") #{.importc, header: "<sys/stat.h>".}: cint
|
||||
|
||||
if header("<sys/statvfs.h>"):
|
||||
v("ST_RDONLY") #{.importc, header: .}: cint
|
||||
v("ST_NOSUID") #{.importc, header: "<sys/statvfs.h>".}: cint
|
||||
|
||||
if header("<sys/mman.h>"):
|
||||
v("PROT_READ") #{.importc, header: .}: cint
|
||||
v("PROT_WRITE") #{.importc, header: "<sys/mman.h>".}: cint
|
||||
v("PROT_EXEC") #{.importc, header: "<sys/mman.h>".}: cint
|
||||
v("PROT_NONE") #{.importc, header: "<sys/mman.h>".}: cint
|
||||
v("MAP_SHARED") #{.importc, header: "<sys/mman.h>".}: cint
|
||||
v("MAP_PRIVATE") #{.importc, header: "<sys/mman.h>".}: cint
|
||||
v("MAP_FIXED") #{.importc, header: "<sys/mman.h>".}: cint
|
||||
v("MS_ASYNC") #{.importc, header: "<sys/mman.h>".}: cint
|
||||
v("MS_SYNC") #{.importc, header: "<sys/mman.h>".}: cint
|
||||
v("MS_INVALIDATE") #{.importc, header: "<sys/mman.h>".}: cint
|
||||
v("MCL_CURRENT") #{.importc, header: "<sys/mman.h>".}: cint
|
||||
v("MCL_FUTURE") #{.importc, header: "<sys/mman.h>".}: cint
|
||||
|
||||
v("MAP_FAILED", pointer)
|
||||
v("POSIX_MADV_NORMAL") #{.importc, header: "<sys/mman.h>".}: cint
|
||||
v("POSIX_MADV_SEQUENTIAL") #{.importc, header: "<sys/mman.h>".}: cint
|
||||
v("POSIX_MADV_RANDOM") #{.importc, header: "<sys/mman.h>".}: cint
|
||||
v("POSIX_MADV_WILLNEED") #{.importc, header: "<sys/mman.h>".}: cint
|
||||
v("POSIX_MADV_DONTNEED") #{.importc, header: "<sys/mman.h>".}: cint
|
||||
v("POSIX_TYPED_MEM_ALLOCATE") #{.importc, header: "<sys/mman.h>".}: cint
|
||||
v("POSIX_TYPED_MEM_ALLOCATE_CONTIG") #{.importc, header: "<sys/mman.h>".}: cint
|
||||
v("POSIX_TYPED_MEM_MAP_ALLOCATABLE") #{.importc, header: "<sys/mman.h>".}: cint
|
||||
|
||||
if header("<time.h>"):
|
||||
v("CLOCKS_PER_SEC", clong)
|
||||
v("CLOCK_PROCESS_CPUTIME_ID")
|
||||
v("CLOCK_THREAD_CPUTIME_ID")
|
||||
v("CLOCK_REALTIME")
|
||||
v("TIMER_ABSTIME")
|
||||
v("CLOCK_MONOTONIC")
|
||||
|
||||
if header("<sys/wait.h>"):
|
||||
v("WNOHANG") #{.importc, header: .}: cint
|
||||
v("WUNTRACED") #{.importc, header: "<sys/wait.h>".}: cint
|
||||
#v("WEXITSTATUS")
|
||||
#v("WIFCONTINUED")
|
||||
#v("WIFEXITED")
|
||||
#v("WIFSIGNALED")
|
||||
#v("WIFSTOPPED")
|
||||
#v("WSTOPSIG")
|
||||
#v("WTERMSIG")
|
||||
v("WEXITED") #{.importc, header: "<sys/wait.h>".}: cint
|
||||
v("WSTOPPED") #{.importc, header: "<sys/wait.h>".}: cint
|
||||
v("WCONTINUED") #{.importc, header: "<sys/wait.h>".}: cint
|
||||
v("WNOWAIT") #{.importc, header: "<sys/wait.h>".}: cint
|
||||
v("P_ALL") #{.importc, header: "<sys/wait.h>".}: cint
|
||||
v("P_PID") #{.importc, header: "<sys/wait.h>".}: cint
|
||||
v("P_PGID") #{.importc, header: "<sys/wait.h>".}: cint
|
||||
|
||||
if header("<signal.h>"):
|
||||
v("SIGEV_NONE") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGEV_SIGNAL") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGEV_THREAD") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGABRT") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGALRM") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGBUS") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGCHLD") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGCONT") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGFPE") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGHUP") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGILL") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGINT") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGKILL") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGPIPE") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGQUIT") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGSEGV") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGSTOP") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGTERM") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGTSTP") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGTTIN") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGTTOU") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGUSR1") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGUSR2") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGPOLL") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGPROF") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGSYS") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGTRAP") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGURG") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGVTALRM") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGXCPU") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGXFSZ") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SA_NOCLDSTOP") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIG_BLOCK") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIG_UNBLOCK") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIG_SETMASK") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SA_ONSTACK") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SA_RESETHAND") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SA_RESTART") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SA_SIGINFO") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SA_NOCLDWAIT") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SA_NODEFER") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SS_ONSTACK") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SS_DISABLE") #{.importc, header: "<signal.h>".}: cint
|
||||
v("MINSIGSTKSZ") #{.importc, header: "<signal.h>".}: cint
|
||||
v("SIGSTKSZ") #{.importc, header: "<signal.h>".}: cint
|
||||
|
||||
if header("<nl_types.h>"):
|
||||
v("NL_SETD") #{.importc, header: .}: cint
|
||||
v("NL_CAT_LOCALE") #{.importc, header: "<nl_types.h>".}: cint
|
||||
|
||||
if header("<sched.h>"):
|
||||
v("SCHED_FIFO")
|
||||
v("SCHED_RR")
|
||||
v("SCHED_SPORADIC")
|
||||
v("SCHED_OTHER")
|
||||
|
||||
if header("<sys/select.h>"):
|
||||
v("FD_SETSIZE")
|
||||
|
||||
if header("<net/if.h>"):
|
||||
v("IF_NAMESIZE")
|
||||
|
||||
if header("<sys/socket.h>"):
|
||||
v("SCM_RIGHTS") #{.importc, header: .}: cint
|
||||
v("SOCK_DGRAM") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SOCK_RAW") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SOCK_SEQPACKET") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SOCK_STREAM") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SOL_SOCKET") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SO_ACCEPTCONN") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SO_BROADCAST") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SO_DEBUG") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SO_DONTROUTE") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SO_ERROR") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SO_KEEPALIVE") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SO_LINGER") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SO_OOBINLINE") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SO_RCVBUF") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SO_RCVLOWAT") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SO_RCVTIMEO") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SO_REUSEADDR") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SO_SNDBUF") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SO_SNDLOWAT") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SO_SNDTIMEO") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SO_TYPE") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SOMAXCONN") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("MSG_CTRUNC") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("MSG_DONTROUTE") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("MSG_EOR") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("MSG_OOB") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("MSG_PEEK") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("MSG_TRUNC") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("MSG_WAITALL") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("AF_INET") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("AF_INET6") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("AF_UNIX") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("AF_UNSPEC") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SHUT_RD") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SHUT_RDWR") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
v("SHUT_WR") #{.importc, header: "<sys/socket.h>".}: cint
|
||||
|
||||
if header("<netinet/in.h>"):
|
||||
v("IPPROTO_IP") #{.importc, header: .}: cint
|
||||
v("IPPROTO_IPV6") #{.importc, header: "<netinet/in.h>".}: cint
|
||||
v("IPPROTO_ICMP") #{.importc, header: "<netinet/in.h>".}: cint
|
||||
v("IPPROTO_RAW") #{.importc, header: "<netinet/in.h>".}: cint
|
||||
v("IPPROTO_TCP") #{.importc, header: "<netinet/in.h>".}: cint
|
||||
v("IPPROTO_UDP") #{.importc, header: "<netinet/in.h>".}: cint
|
||||
v("INADDR_ANY") #{.importc, header: "<netinet/in.h>".}: TinAddrScalar
|
||||
v("INADDR_BROADCAST") #{.importc, header: "<netinet/in.h>".}: TinAddrScalar
|
||||
v("INET_ADDRSTRLEN") #{.importc, header: "<netinet/in.h>".}: cint
|
||||
|
||||
v("IPV6_JOIN_GROUP") #{.importc, header: "<netinet/in.h>".}: cint
|
||||
v("IPV6_LEAVE_GROUP") #{.importc, header: "<netinet/in.h>".}: cint
|
||||
v("IPV6_MULTICAST_HOPS") #{.importc, header: "<netinet/in.h>".}: cint
|
||||
v("IPV6_MULTICAST_IF") #{.importc, header: "<netinet/in.h>".}: cint
|
||||
v("IPV6_MULTICAST_LOOP") #{.importc, header: "<netinet/in.h>".}: cint
|
||||
v("IPV6_UNICAST_HOPS") #{.importc, header: "<netinet/in.h>".}: cint
|
||||
v("IPV6_V6ONLY") #{.importc, header: "<netinet/in.h>".}: cint
|
||||
|
||||
v("TCP_NODELAY") #{.importc, header: "<netinet/tcp.h>".}: cint
|
||||
|
||||
if header("<netdb.h>"):
|
||||
v("IPPORT_RESERVED")
|
||||
|
||||
v("HOST_NOT_FOUND")
|
||||
v("NO_DATA")
|
||||
v("NO_RECOVERY")
|
||||
v("TRY_AGAIN")
|
||||
|
||||
v("AI_PASSIVE")
|
||||
v("AI_CANONNAME")
|
||||
v("AI_NUMERICHOST")
|
||||
v("AI_NUMERICSERV")
|
||||
v("AI_V4MAPPED")
|
||||
v("AI_ALL")
|
||||
v("AI_ADDRCONFIG")
|
||||
|
||||
v("NI_NOFQDN")
|
||||
v("NI_NUMERICHOST")
|
||||
v("NI_NAMEREQD")
|
||||
v("NI_NUMERICSERV")
|
||||
v("NI_NUMERICSCOPE")
|
||||
v("NI_DGRAM")
|
||||
v("EAI_AGAIN")
|
||||
v("EAI_BADFLAGS")
|
||||
v("EAI_FAIL")
|
||||
v("EAI_FAMILY")
|
||||
v("EAI_MEMORY")
|
||||
v("EAI_NONAME")
|
||||
v("EAI_SERVICE")
|
||||
v("EAI_SOCKTYPE")
|
||||
v("EAI_SYSTEM")
|
||||
v("EAI_OVERFLOW")
|
||||
|
||||
if header("<poll.h>"):
|
||||
v("POLLIN", cshort)
|
||||
v("POLLRDNORM", cshort)
|
||||
v("POLLRDBAND", cshort)
|
||||
v("POLLPRI", cshort)
|
||||
v("POLLOUT", cshort)
|
||||
v("POLLWRNORM", cshort)
|
||||
v("POLLWRBAND", cshort)
|
||||
v("POLLERR", cshort)
|
||||
v("POLLHUP", cshort)
|
||||
v("POLLNVAL", cshort)
|
||||
|
||||
if header("<spawn.h>"):
|
||||
v("POSIX_SPAWN_RESETIDS")
|
||||
v("POSIX_SPAWN_SETPGROUP")
|
||||
v("POSIX_SPAWN_SETSCHEDPARAM")
|
||||
v("POSIX_SPAWN_SETSCHEDULER")
|
||||
v("POSIX_SPAWN_SETSIGDEF")
|
||||
v("POSIX_SPAWN_SETSIGMASK")
|
||||
|
||||
main()
|
||||
|
||||
@@ -1,620 +0,0 @@
|
||||
# Generated by detect.nim
|
||||
const
|
||||
AIO_ALLDONE* = cint(2)
|
||||
AIO_CANCELED* = cint(0)
|
||||
AIO_NOTCANCELED* = cint(1)
|
||||
LIO_NOP* = cint(2)
|
||||
LIO_NOWAIT* = cint(1)
|
||||
LIO_READ* = cint(0)
|
||||
LIO_WAIT* = cint(0)
|
||||
LIO_WRITE* = cint(1)
|
||||
RTLD_LAZY* = cint(1)
|
||||
RTLD_NOW* = cint(2)
|
||||
RTLD_GLOBAL* = cint(256)
|
||||
RTLD_LOCAL* = cint(0)
|
||||
E2BIG* = cint(7)
|
||||
EACCES* = cint(13)
|
||||
EADDRINUSE* = cint(98)
|
||||
EADDRNOTAVAIL* = cint(99)
|
||||
EAFNOSUPPORT* = cint(97)
|
||||
EAGAIN* = cint(11)
|
||||
EALREADY* = cint(114)
|
||||
EBADF* = cint(9)
|
||||
EBADMSG* = cint(74)
|
||||
EBUSY* = cint(16)
|
||||
ECANCELED* = cint(125)
|
||||
ECHILD* = cint(10)
|
||||
ECONNABORTED* = cint(103)
|
||||
ECONNREFUSED* = cint(111)
|
||||
ECONNRESET* = cint(104)
|
||||
EDEADLK* = cint(35)
|
||||
EDESTADDRREQ* = cint(89)
|
||||
EDOM* = cint(33)
|
||||
EDQUOT* = cint(122)
|
||||
EEXIST* = cint(17)
|
||||
EFAULT* = cint(14)
|
||||
EFBIG* = cint(27)
|
||||
EHOSTUNREACH* = cint(113)
|
||||
EIDRM* = cint(43)
|
||||
EILSEQ* = cint(84)
|
||||
EINPROGRESS* = cint(115)
|
||||
EINTR* = cint(4)
|
||||
EINVAL* = cint(22)
|
||||
EIO* = cint(5)
|
||||
EISCONN* = cint(106)
|
||||
EISDIR* = cint(21)
|
||||
ELOOP* = cint(40)
|
||||
EMFILE* = cint(24)
|
||||
EMLINK* = cint(31)
|
||||
EMSGSIZE* = cint(90)
|
||||
EMULTIHOP* = cint(72)
|
||||
ENAMETOOLONG* = cint(36)
|
||||
ENETDOWN* = cint(100)
|
||||
ENETRESET* = cint(102)
|
||||
ENETUNREACH* = cint(101)
|
||||
ENFILE* = cint(23)
|
||||
ENOBUFS* = cint(105)
|
||||
ENODATA* = cint(61)
|
||||
ENODEV* = cint(19)
|
||||
ENOENT* = cint(2)
|
||||
ENOEXEC* = cint(8)
|
||||
ENOLCK* = cint(37)
|
||||
ENOLINK* = cint(67)
|
||||
ENOMEM* = cint(12)
|
||||
ENOMSG* = cint(42)
|
||||
ENOPROTOOPT* = cint(92)
|
||||
ENOSPC* = cint(28)
|
||||
ENOSR* = cint(63)
|
||||
ENOSTR* = cint(60)
|
||||
ENOSYS* = cint(38)
|
||||
ENOTCONN* = cint(107)
|
||||
ENOTDIR* = cint(20)
|
||||
ENOTEMPTY* = cint(39)
|
||||
ENOTSOCK* = cint(88)
|
||||
ENOTSUP* = cint(95)
|
||||
ENOTTY* = cint(25)
|
||||
ENXIO* = cint(6)
|
||||
EOPNOTSUPP* = cint(95)
|
||||
EOVERFLOW* = cint(75)
|
||||
EPERM* = cint(1)
|
||||
EPIPE* = cint(32)
|
||||
EPROTO* = cint(71)
|
||||
EPROTONOSUPPORT* = cint(93)
|
||||
EPROTOTYPE* = cint(91)
|
||||
ERANGE* = cint(34)
|
||||
EROFS* = cint(30)
|
||||
ESPIPE* = cint(29)
|
||||
ESRCH* = cint(3)
|
||||
ESTALE* = cint(116)
|
||||
ETIME* = cint(62)
|
||||
ETIMEDOUT* = cint(110)
|
||||
ETXTBSY* = cint(26)
|
||||
EWOULDBLOCK* = cint(11)
|
||||
EXDEV* = cint(18)
|
||||
F_DUPFD* = cint(0)
|
||||
F_GETFD* = cint(1)
|
||||
F_SETFD* = cint(2)
|
||||
F_GETFL* = cint(3)
|
||||
F_SETFL* = cint(4)
|
||||
F_GETLK* = cint(5)
|
||||
F_SETLK* = cint(6)
|
||||
F_SETLKW* = cint(7)
|
||||
F_GETOWN* = cint(9)
|
||||
F_SETOWN* = cint(8)
|
||||
FD_CLOEXEC* = cint(1)
|
||||
F_RDLCK* = cint(0)
|
||||
F_UNLCK* = cint(2)
|
||||
F_WRLCK* = cint(1)
|
||||
O_CREAT* = cint(64)
|
||||
O_EXCL* = cint(128)
|
||||
O_NOCTTY* = cint(256)
|
||||
O_TRUNC* = cint(512)
|
||||
O_APPEND* = cint(1024)
|
||||
O_DSYNC* = cint(4096)
|
||||
O_NONBLOCK* = cint(2048)
|
||||
O_RSYNC* = cint(4096)
|
||||
O_SYNC* = cint(4096)
|
||||
O_ACCMODE* = cint(3)
|
||||
O_RDONLY* = cint(0)
|
||||
O_RDWR* = cint(2)
|
||||
O_WRONLY* = cint(1)
|
||||
POSIX_FADV_NORMAL* = cint(0)
|
||||
POSIX_FADV_SEQUENTIAL* = cint(2)
|
||||
POSIX_FADV_RANDOM* = cint(1)
|
||||
POSIX_FADV_WILLNEED* = cint(3)
|
||||
POSIX_FADV_DONTNEED* = cint(4)
|
||||
POSIX_FADV_NOREUSE* = cint(5)
|
||||
FE_DIVBYZERO* = cint(4)
|
||||
FE_INEXACT* = cint(32)
|
||||
FE_INVALID* = cint(1)
|
||||
FE_OVERFLOW* = cint(8)
|
||||
FE_UNDERFLOW* = cint(16)
|
||||
FE_ALL_EXCEPT* = cint(61)
|
||||
FE_DOWNWARD* = cint(1024)
|
||||
FE_TONEAREST* = cint(0)
|
||||
FE_TOWARDZERO* = cint(3072)
|
||||
FE_UPWARD* = cint(2048)
|
||||
FE_DFL_ENV* = cast[pointer](0xffffffffffffffff)
|
||||
MM_HARD* = cint(1)
|
||||
MM_SOFT* = cint(2)
|
||||
MM_FIRM* = cint(4)
|
||||
MM_APPL* = cint(8)
|
||||
MM_UTIL* = cint(16)
|
||||
MM_OPSYS* = cint(32)
|
||||
MM_RECOVER* = cint(64)
|
||||
MM_NRECOV* = cint(128)
|
||||
MM_HALT* = cint(1)
|
||||
MM_ERROR* = cint(2)
|
||||
MM_WARNING* = cint(3)
|
||||
MM_INFO* = cint(4)
|
||||
MM_NOSEV* = cint(0)
|
||||
MM_PRINT* = cint(256)
|
||||
MM_CONSOLE* = cint(512)
|
||||
MM_OK* = cint(0)
|
||||
MM_NOTOK* = cint(-1)
|
||||
MM_NOMSG* = cint(1)
|
||||
MM_NOCON* = cint(4)
|
||||
FNM_NOMATCH* = cint(1)
|
||||
FNM_PATHNAME* = cint(1)
|
||||
FNM_PERIOD* = cint(4)
|
||||
FNM_NOESCAPE* = cint(2)
|
||||
FTW_F* = cint(0)
|
||||
FTW_D* = cint(1)
|
||||
FTW_DNR* = cint(2)
|
||||
FTW_NS* = cint(3)
|
||||
FTW_SL* = cint(4)
|
||||
GLOB_APPEND* = cint(32)
|
||||
GLOB_DOOFFS* = cint(8)
|
||||
GLOB_ERR* = cint(1)
|
||||
GLOB_MARK* = cint(2)
|
||||
GLOB_NOCHECK* = cint(16)
|
||||
GLOB_NOESCAPE* = cint(64)
|
||||
GLOB_NOSORT* = cint(4)
|
||||
GLOB_ABORTED* = cint(2)
|
||||
GLOB_NOMATCH* = cint(3)
|
||||
GLOB_NOSPACE* = cint(1)
|
||||
GLOB_NOSYS* = cint(4)
|
||||
CODESET* = cint(14)
|
||||
D_T_FMT* = cint(131112)
|
||||
D_FMT* = cint(131113)
|
||||
T_FMT* = cint(131114)
|
||||
T_FMT_AMPM* = cint(131115)
|
||||
AM_STR* = cint(131110)
|
||||
PM_STR* = cint(131111)
|
||||
DAY_1* = cint(131079)
|
||||
DAY_2* = cint(131080)
|
||||
DAY_3* = cint(131081)
|
||||
DAY_4* = cint(131082)
|
||||
DAY_5* = cint(131083)
|
||||
DAY_6* = cint(131084)
|
||||
DAY_7* = cint(131085)
|
||||
ABDAY_1* = cint(131072)
|
||||
ABDAY_2* = cint(131073)
|
||||
ABDAY_3* = cint(131074)
|
||||
ABDAY_4* = cint(131075)
|
||||
ABDAY_5* = cint(131076)
|
||||
ABDAY_6* = cint(131077)
|
||||
ABDAY_7* = cint(131078)
|
||||
MON_1* = cint(131098)
|
||||
MON_2* = cint(131099)
|
||||
MON_3* = cint(131100)
|
||||
MON_4* = cint(131101)
|
||||
MON_5* = cint(131102)
|
||||
MON_6* = cint(131103)
|
||||
MON_7* = cint(131104)
|
||||
MON_8* = cint(131105)
|
||||
MON_9* = cint(131106)
|
||||
MON_10* = cint(131107)
|
||||
MON_11* = cint(131108)
|
||||
MON_12* = cint(131109)
|
||||
ABMON_1* = cint(131086)
|
||||
ABMON_2* = cint(131087)
|
||||
ABMON_3* = cint(131088)
|
||||
ABMON_4* = cint(131089)
|
||||
ABMON_5* = cint(131090)
|
||||
ABMON_6* = cint(131091)
|
||||
ABMON_7* = cint(131092)
|
||||
ABMON_8* = cint(131093)
|
||||
ABMON_9* = cint(131094)
|
||||
ABMON_10* = cint(131095)
|
||||
ABMON_11* = cint(131096)
|
||||
ABMON_12* = cint(131097)
|
||||
ERA* = cint(131116)
|
||||
ERA_D_FMT* = cint(131118)
|
||||
ERA_D_T_FMT* = cint(131120)
|
||||
ERA_T_FMT* = cint(131121)
|
||||
ALT_DIGITS* = cint(131119)
|
||||
RADIXCHAR* = cint(65536)
|
||||
THOUSEP* = cint(65537)
|
||||
YESEXPR* = cint(327680)
|
||||
NOEXPR* = cint(327681)
|
||||
CRNCYSTR* = cint(262159)
|
||||
LC_ALL* = cint(6)
|
||||
LC_COLLATE* = cint(3)
|
||||
LC_CTYPE* = cint(0)
|
||||
LC_MESSAGES* = cint(5)
|
||||
LC_MONETARY* = cint(4)
|
||||
LC_NUMERIC* = cint(1)
|
||||
LC_TIME* = cint(2)
|
||||
PTHREAD_BARRIER_SERIAL_THREAD* = cint(-1)
|
||||
PTHREAD_CANCEL_ASYNCHRONOUS* = cint(1)
|
||||
PTHREAD_CANCEL_ENABLE* = cint(0)
|
||||
PTHREAD_CANCEL_DEFERRED* = cint(0)
|
||||
PTHREAD_CANCEL_DISABLE* = cint(1)
|
||||
PTHREAD_CREATE_DETACHED* = cint(1)
|
||||
PTHREAD_CREATE_JOINABLE* = cint(0)
|
||||
PTHREAD_EXPLICIT_SCHED* = cint(1)
|
||||
PTHREAD_INHERIT_SCHED* = cint(0)
|
||||
PTHREAD_ONCE_INIT* = cint(0)
|
||||
PTHREAD_PROCESS_SHARED* = cint(1)
|
||||
PTHREAD_PROCESS_PRIVATE* = cint(0)
|
||||
PTHREAD_SCOPE_PROCESS* = cint(1)
|
||||
PTHREAD_SCOPE_SYSTEM* = cint(0)
|
||||
POSIX_ASYNC_IO* = cint(1)
|
||||
F_OK* = cint(0)
|
||||
R_OK* = cint(4)
|
||||
W_OK* = cint(2)
|
||||
X_OK* = cint(1)
|
||||
CS_PATH* = cint(0)
|
||||
CS_POSIX_V6_ILP32_OFF32_CFLAGS* = cint(1116)
|
||||
CS_POSIX_V6_ILP32_OFF32_LDFLAGS* = cint(1117)
|
||||
CS_POSIX_V6_ILP32_OFF32_LIBS* = cint(1118)
|
||||
CS_POSIX_V6_ILP32_OFFBIG_CFLAGS* = cint(1120)
|
||||
CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS* = cint(1121)
|
||||
CS_POSIX_V6_ILP32_OFFBIG_LIBS* = cint(1122)
|
||||
CS_POSIX_V6_LP64_OFF64_CFLAGS* = cint(1124)
|
||||
CS_POSIX_V6_LP64_OFF64_LDFLAGS* = cint(1125)
|
||||
CS_POSIX_V6_LP64_OFF64_LIBS* = cint(1126)
|
||||
CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS* = cint(1128)
|
||||
CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS* = cint(1129)
|
||||
CS_POSIX_V6_LPBIG_OFFBIG_LIBS* = cint(1130)
|
||||
CS_POSIX_V6_WIDTH_RESTRICTED_ENVS* = cint(1)
|
||||
F_LOCK* = cint(1)
|
||||
F_TEST* = cint(3)
|
||||
F_TLOCK* = cint(2)
|
||||
F_ULOCK* = cint(0)
|
||||
PC_2_SYMLINKS* = cint(20)
|
||||
PC_ALLOC_SIZE_MIN* = cint(18)
|
||||
PC_ASYNC_IO* = cint(10)
|
||||
PC_CHOWN_RESTRICTED* = cint(6)
|
||||
PC_FILESIZEBITS* = cint(13)
|
||||
PC_LINK_MAX* = cint(0)
|
||||
PC_MAX_CANON* = cint(1)
|
||||
PC_MAX_INPUT* = cint(2)
|
||||
PC_NAME_MAX* = cint(3)
|
||||
PC_NO_TRUNC* = cint(7)
|
||||
PC_PATH_MAX* = cint(4)
|
||||
PC_PIPE_BUF* = cint(5)
|
||||
PC_PRIO_IO* = cint(11)
|
||||
PC_REC_INCR_XFER_SIZE* = cint(14)
|
||||
PC_REC_MIN_XFER_SIZE* = cint(16)
|
||||
PC_REC_XFER_ALIGN* = cint(17)
|
||||
PC_SYMLINK_MAX* = cint(19)
|
||||
PC_SYNC_IO* = cint(9)
|
||||
PC_VDISABLE* = cint(8)
|
||||
SC_2_C_BIND* = cint(47)
|
||||
SC_2_C_DEV* = cint(48)
|
||||
SC_2_CHAR_TERM* = cint(95)
|
||||
SC_2_FORT_DEV* = cint(49)
|
||||
SC_2_FORT_RUN* = cint(50)
|
||||
SC_2_LOCALEDEF* = cint(52)
|
||||
SC_2_PBS* = cint(168)
|
||||
SC_2_PBS_ACCOUNTING* = cint(169)
|
||||
SC_2_PBS_CHECKPOINT* = cint(175)
|
||||
SC_2_PBS_LOCATE* = cint(170)
|
||||
SC_2_PBS_MESSAGE* = cint(171)
|
||||
SC_2_PBS_TRACK* = cint(172)
|
||||
SC_2_SW_DEV* = cint(51)
|
||||
SC_2_UPE* = cint(97)
|
||||
SC_2_VERSION* = cint(46)
|
||||
SC_ADVISORY_INFO* = cint(132)
|
||||
SC_AIO_LISTIO_MAX* = cint(23)
|
||||
SC_AIO_MAX* = cint(24)
|
||||
SC_AIO_PRIO_DELTA_MAX* = cint(25)
|
||||
SC_ARG_MAX* = cint(0)
|
||||
SC_ASYNCHRONOUS_IO* = cint(12)
|
||||
SC_ATEXIT_MAX* = cint(87)
|
||||
SC_BARRIERS* = cint(133)
|
||||
SC_BC_BASE_MAX* = cint(36)
|
||||
SC_BC_DIM_MAX* = cint(37)
|
||||
SC_BC_SCALE_MAX* = cint(38)
|
||||
SC_BC_STRING_MAX* = cint(39)
|
||||
SC_CHILD_MAX* = cint(1)
|
||||
SC_CLK_TCK* = cint(2)
|
||||
SC_CLOCK_SELECTION* = cint(137)
|
||||
SC_COLL_WEIGHTS_MAX* = cint(40)
|
||||
SC_CPUTIME* = cint(138)
|
||||
SC_DELAYTIMER_MAX* = cint(26)
|
||||
SC_EXPR_NEST_MAX* = cint(42)
|
||||
SC_FSYNC* = cint(15)
|
||||
SC_GETGR_R_SIZE_MAX* = cint(69)
|
||||
SC_GETPW_R_SIZE_MAX* = cint(70)
|
||||
SC_HOST_NAME_MAX* = cint(180)
|
||||
SC_IOV_MAX* = cint(60)
|
||||
SC_IPV6* = cint(235)
|
||||
SC_JOB_CONTROL* = cint(7)
|
||||
SC_LINE_MAX* = cint(43)
|
||||
SC_LOGIN_NAME_MAX* = cint(71)
|
||||
SC_MAPPED_FILES* = cint(16)
|
||||
SC_MEMLOCK* = cint(17)
|
||||
SC_MEMLOCK_RANGE* = cint(18)
|
||||
SC_MEMORY_PROTECTION* = cint(19)
|
||||
SC_MESSAGE_PASSING* = cint(20)
|
||||
SC_MONOTONIC_CLOCK* = cint(149)
|
||||
SC_MQ_OPEN_MAX* = cint(27)
|
||||
SC_MQ_PRIO_MAX* = cint(28)
|
||||
SC_NGROUPS_MAX* = cint(3)
|
||||
SC_OPEN_MAX* = cint(4)
|
||||
SC_PAGE_SIZE* = cint(30)
|
||||
SC_PRIORITIZED_IO* = cint(13)
|
||||
SC_PRIORITY_SCHEDULING* = cint(10)
|
||||
SC_RAW_SOCKETS* = cint(236)
|
||||
SC_RE_DUP_MAX* = cint(44)
|
||||
SC_READER_WRITER_LOCKS* = cint(153)
|
||||
SC_REALTIME_SIGNALS* = cint(9)
|
||||
SC_REGEXP* = cint(155)
|
||||
SC_RTSIG_MAX* = cint(31)
|
||||
SC_SAVED_IDS* = cint(8)
|
||||
SC_SEM_NSEMS_MAX* = cint(32)
|
||||
SC_SEM_VALUE_MAX* = cint(33)
|
||||
SC_SEMAPHORES* = cint(21)
|
||||
SC_SHARED_MEMORY_OBJECTS* = cint(22)
|
||||
SC_SHELL* = cint(157)
|
||||
SC_SIGQUEUE_MAX* = cint(34)
|
||||
SC_SPAWN* = cint(159)
|
||||
SC_SPIN_LOCKS* = cint(154)
|
||||
SC_SPORADIC_SERVER* = cint(160)
|
||||
SC_STREAM_MAX* = cint(5)
|
||||
SC_SYMLOOP_MAX* = cint(173)
|
||||
SC_SYNCHRONIZED_IO* = cint(14)
|
||||
SC_THREAD_ATTR_STACKADDR* = cint(77)
|
||||
SC_THREAD_ATTR_STACKSIZE* = cint(78)
|
||||
SC_THREAD_CPUTIME* = cint(139)
|
||||
SC_THREAD_DESTRUCTOR_ITERATIONS* = cint(73)
|
||||
SC_THREAD_KEYS_MAX* = cint(74)
|
||||
SC_THREAD_PRIO_INHERIT* = cint(80)
|
||||
SC_THREAD_PRIO_PROTECT* = cint(81)
|
||||
SC_THREAD_PRIORITY_SCHEDULING* = cint(79)
|
||||
SC_THREAD_PROCESS_SHARED* = cint(82)
|
||||
SC_THREAD_SAFE_FUNCTIONS* = cint(68)
|
||||
SC_THREAD_SPORADIC_SERVER* = cint(161)
|
||||
SC_THREAD_STACK_MIN* = cint(75)
|
||||
SC_THREAD_THREADS_MAX* = cint(76)
|
||||
SC_THREADS* = cint(67)
|
||||
SC_TIMEOUTS* = cint(164)
|
||||
SC_TIMER_MAX* = cint(35)
|
||||
SC_TIMERS* = cint(11)
|
||||
SC_TRACE* = cint(181)
|
||||
SC_TRACE_EVENT_FILTER* = cint(182)
|
||||
SC_TRACE_INHERIT* = cint(183)
|
||||
SC_TRACE_LOG* = cint(184)
|
||||
SC_TTY_NAME_MAX* = cint(72)
|
||||
SC_TYPED_MEMORY_OBJECTS* = cint(165)
|
||||
SC_TZNAME_MAX* = cint(6)
|
||||
SC_V6_ILP32_OFF32* = cint(176)
|
||||
SC_V6_ILP32_OFFBIG* = cint(177)
|
||||
SC_V6_LP64_OFF64* = cint(178)
|
||||
SC_V6_LPBIG_OFFBIG* = cint(179)
|
||||
SC_VERSION* = cint(29)
|
||||
SC_XBS5_ILP32_OFF32* = cint(125)
|
||||
SC_XBS5_ILP32_OFFBIG* = cint(126)
|
||||
SC_XBS5_LP64_OFF64* = cint(127)
|
||||
SC_XBS5_LPBIG_OFFBIG* = cint(128)
|
||||
SC_XOPEN_CRYPT* = cint(92)
|
||||
SC_XOPEN_ENH_I18N* = cint(93)
|
||||
SC_XOPEN_LEGACY* = cint(129)
|
||||
SC_XOPEN_REALTIME* = cint(130)
|
||||
SC_XOPEN_REALTIME_THREADS* = cint(131)
|
||||
SC_XOPEN_SHM* = cint(94)
|
||||
SC_XOPEN_UNIX* = cint(91)
|
||||
SC_XOPEN_VERSION* = cint(89)
|
||||
SEEK_SET* = cint(0)
|
||||
SEEK_CUR* = cint(1)
|
||||
SEEK_END* = cint(2)
|
||||
SEM_FAILED* = cast[pointer]((nil))
|
||||
IPC_CREAT* = cint(512)
|
||||
IPC_EXCL* = cint(1024)
|
||||
IPC_NOWAIT* = cint(2048)
|
||||
IPC_PRIVATE* = cint(0)
|
||||
IPC_RMID* = cint(0)
|
||||
IPC_SET* = cint(1)
|
||||
IPC_STAT* = cint(2)
|
||||
S_IFMT* = cint(61440)
|
||||
S_IFBLK* = cint(24576)
|
||||
S_IFCHR* = cint(8192)
|
||||
S_IFIFO* = cint(4096)
|
||||
S_IFREG* = cint(32768)
|
||||
S_IFDIR* = cint(16384)
|
||||
S_IFLNK* = cint(40960)
|
||||
S_IFSOCK* = cint(49152)
|
||||
S_IRWXU* = cint(448)
|
||||
S_IRUSR* = cint(256)
|
||||
S_IWUSR* = cint(128)
|
||||
S_IXUSR* = cint(64)
|
||||
S_IRWXG* = cint(56)
|
||||
S_IRGRP* = cint(32)
|
||||
S_IWGRP* = cint(16)
|
||||
S_IXGRP* = cint(8)
|
||||
S_IRWXO* = cint(7)
|
||||
S_IROTH* = cint(4)
|
||||
S_IWOTH* = cint(2)
|
||||
S_IXOTH* = cint(1)
|
||||
S_ISUID* = cint(2048)
|
||||
S_ISGID* = cint(1024)
|
||||
S_ISVTX* = cint(512)
|
||||
ST_RDONLY* = cint(1)
|
||||
ST_NOSUID* = cint(2)
|
||||
PROT_READ* = cint(1)
|
||||
PROT_WRITE* = cint(2)
|
||||
PROT_EXEC* = cint(4)
|
||||
PROT_NONE* = cint(0)
|
||||
MAP_SHARED* = cint(1)
|
||||
MAP_PRIVATE* = cint(2)
|
||||
MAP_FIXED* = cint(16)
|
||||
MS_ASYNC* = cint(1)
|
||||
MS_SYNC* = cint(4)
|
||||
MS_INVALIDATE* = cint(2)
|
||||
MCL_CURRENT* = cint(1)
|
||||
MCL_FUTURE* = cint(2)
|
||||
MAP_FAILED* = cast[pointer](0xffffffffffffffff)
|
||||
POSIX_MADV_NORMAL* = cint(0)
|
||||
POSIX_MADV_SEQUENTIAL* = cint(2)
|
||||
POSIX_MADV_RANDOM* = cint(1)
|
||||
POSIX_MADV_WILLNEED* = cint(3)
|
||||
POSIX_MADV_DONTNEED* = cint(4)
|
||||
CLOCKS_PER_SEC* = clong(1000000)
|
||||
CLOCK_PROCESS_CPUTIME_ID* = cint(2)
|
||||
CLOCK_THREAD_CPUTIME_ID* = cint(3)
|
||||
CLOCK_REALTIME* = cint(0)
|
||||
TIMER_ABSTIME* = cint(1)
|
||||
CLOCK_MONOTONIC* = cint(1)
|
||||
WNOHANG* = cint(1)
|
||||
WUNTRACED* = cint(2)
|
||||
WEXITED* = cint(4)
|
||||
WSTOPPED* = cint(2)
|
||||
WCONTINUED* = cint(8)
|
||||
WNOWAIT* = cint(16777216)
|
||||
SIGEV_NONE* = cint(1)
|
||||
SIGEV_SIGNAL* = cint(0)
|
||||
SIGEV_THREAD* = cint(2)
|
||||
SIGABRT* = cint(6)
|
||||
SIGALRM* = cint(14)
|
||||
SIGBUS* = cint(7)
|
||||
SIGCHLD* = cint(17)
|
||||
SIGCONT* = cint(18)
|
||||
SIGFPE* = cint(8)
|
||||
SIGHUP* = cint(1)
|
||||
SIGILL* = cint(4)
|
||||
SIGINT* = cint(2)
|
||||
SIGKILL* = cint(9)
|
||||
SIGPIPE* = cint(13)
|
||||
SIGQUIT* = cint(3)
|
||||
SIGSEGV* = cint(11)
|
||||
SIGSTOP* = cint(19)
|
||||
SIGTERM* = cint(15)
|
||||
SIGTSTP* = cint(20)
|
||||
SIGTTIN* = cint(21)
|
||||
SIGTTOU* = cint(22)
|
||||
SIGUSR1* = cint(10)
|
||||
SIGUSR2* = cint(12)
|
||||
SIGPOLL* = cint(29)
|
||||
SIGPROF* = cint(27)
|
||||
SIGSYS* = cint(31)
|
||||
SIGTRAP* = cint(5)
|
||||
SIGURG* = cint(23)
|
||||
SIGVTALRM* = cint(26)
|
||||
SIGXCPU* = cint(24)
|
||||
SIGXFSZ* = cint(25)
|
||||
SA_NOCLDSTOP* = cint(1)
|
||||
SIG_BLOCK* = cint(0)
|
||||
SIG_UNBLOCK* = cint(1)
|
||||
SIG_SETMASK* = cint(2)
|
||||
SA_ONSTACK* = cint(134217728)
|
||||
SA_RESETHAND* = cint(-2147483648)
|
||||
SA_RESTART* = cint(268435456)
|
||||
SA_SIGINFO* = cint(4)
|
||||
SA_NOCLDWAIT* = cint(2)
|
||||
SA_NODEFER* = cint(1073741824)
|
||||
SS_ONSTACK* = cint(1)
|
||||
SS_DISABLE* = cint(2)
|
||||
MINSIGSTKSZ* = cint(2048)
|
||||
SIGSTKSZ* = cint(8192)
|
||||
NL_SETD* = cint(1)
|
||||
NL_CAT_LOCALE* = cint(1)
|
||||
SCHED_FIFO* = cint(1)
|
||||
SCHED_RR* = cint(2)
|
||||
SCHED_OTHER* = cint(0)
|
||||
FD_SETSIZE* = cint(1024)
|
||||
IF_NAMESIZE* = cint(16)
|
||||
SCM_RIGHTS* = cint(1)
|
||||
SOCK_DGRAM* = cint(2)
|
||||
SOCK_RAW* = cint(3)
|
||||
SOCK_SEQPACKET* = cint(5)
|
||||
SOCK_STREAM* = cint(1)
|
||||
SOL_SOCKET* = cint(1)
|
||||
SO_ACCEPTCONN* = cint(30)
|
||||
SO_BROADCAST* = cint(6)
|
||||
SO_DEBUG* = cint(1)
|
||||
SO_DONTROUTE* = cint(5)
|
||||
SO_ERROR* = cint(4)
|
||||
SO_KEEPALIVE* = cint(9)
|
||||
SO_LINGER* = cint(13)
|
||||
SO_OOBINLINE* = cint(10)
|
||||
SO_RCVBUF* = cint(8)
|
||||
SO_RCVLOWAT* = cint(18)
|
||||
SO_RCVTIMEO* = cint(20)
|
||||
SO_REUSEADDR* = cint(2)
|
||||
SO_SNDBUF* = cint(7)
|
||||
SO_SNDLOWAT* = cint(19)
|
||||
SO_SNDTIMEO* = cint(21)
|
||||
SO_TYPE* = cint(3)
|
||||
SOMAXCONN* = cint(128)
|
||||
MSG_CTRUNC* = cint(8)
|
||||
MSG_DONTROUTE* = cint(4)
|
||||
MSG_EOR* = cint(128)
|
||||
MSG_OOB* = cint(1)
|
||||
MSG_PEEK* = cint(2)
|
||||
MSG_TRUNC* = cint(32)
|
||||
MSG_WAITALL* = cint(256)
|
||||
AF_INET* = cint(2)
|
||||
AF_INET6* = cint(10)
|
||||
AF_UNIX* = cint(1)
|
||||
AF_UNSPEC* = cint(0)
|
||||
SHUT_RD* = cint(0)
|
||||
SHUT_RDWR* = cint(2)
|
||||
SHUT_WR* = cint(1)
|
||||
IPPROTO_IP* = cint(0)
|
||||
IPPROTO_IPV6* = cint(41)
|
||||
IPPROTO_ICMP* = cint(1)
|
||||
IPPROTO_RAW* = cint(255)
|
||||
IPPROTO_TCP* = cint(6)
|
||||
IPPROTO_UDP* = cint(17)
|
||||
INADDR_ANY* = cint(0)
|
||||
INADDR_BROADCAST* = cint(-1)
|
||||
INET_ADDRSTRLEN* = cint(16)
|
||||
IPV6_JOIN_GROUP* = cint(20)
|
||||
IPV6_LEAVE_GROUP* = cint(21)
|
||||
IPV6_MULTICAST_HOPS* = cint(18)
|
||||
IPV6_MULTICAST_IF* = cint(17)
|
||||
IPV6_MULTICAST_LOOP* = cint(19)
|
||||
IPV6_UNICAST_HOPS* = cint(16)
|
||||
IPV6_V6ONLY* = cint(26)
|
||||
IPPORT_RESERVED* = cint(1024)
|
||||
HOST_NOT_FOUND* = cint(1)
|
||||
NO_DATA* = cint(4)
|
||||
NO_RECOVERY* = cint(3)
|
||||
TRY_AGAIN* = cint(2)
|
||||
AI_PASSIVE* = cint(1)
|
||||
AI_CANONNAME* = cint(2)
|
||||
AI_NUMERICHOST* = cint(4)
|
||||
AI_NUMERICSERV* = cint(1024)
|
||||
AI_V4MAPPED* = cint(8)
|
||||
AI_ALL* = cint(16)
|
||||
AI_ADDRCONFIG* = cint(32)
|
||||
NI_NOFQDN* = cint(4)
|
||||
NI_NUMERICHOST* = cint(1)
|
||||
NI_NAMEREQD* = cint(8)
|
||||
NI_NUMERICSERV* = cint(2)
|
||||
NI_DGRAM* = cint(16)
|
||||
EAI_AGAIN* = cint(-3)
|
||||
EAI_BADFLAGS* = cint(-1)
|
||||
EAI_FAIL* = cint(-4)
|
||||
EAI_FAMILY* = cint(-6)
|
||||
EAI_MEMORY* = cint(-10)
|
||||
EAI_NONAME* = cint(-2)
|
||||
EAI_SERVICE* = cint(-8)
|
||||
EAI_SOCKTYPE* = cint(-7)
|
||||
EAI_SYSTEM* = cint(-11)
|
||||
EAI_OVERFLOW* = cint(-12)
|
||||
POLLIN* = cshort(1)
|
||||
POLLPRI* = cshort(2)
|
||||
POLLOUT* = cshort(4)
|
||||
POLLERR* = cshort(8)
|
||||
POLLHUP* = cshort(16)
|
||||
POLLNVAL* = cshort(32)
|
||||
POSIX_SPAWN_RESETIDS* = cint(1)
|
||||
POSIX_SPAWN_SETPGROUP* = cint(2)
|
||||
POSIX_SPAWN_SETSCHEDPARAM* = cint(16)
|
||||
POSIX_SPAWN_SETSCHEDULER* = cint(32)
|
||||
POSIX_SPAWN_SETSIGDEF* = cint(4)
|
||||
POSIX_SPAWN_SETSIGMASK* = cint(8)
|
||||
@@ -1,620 +0,0 @@
|
||||
# Generated by detect.nim
|
||||
const
|
||||
AIO_ALLDONE* = cint(2)
|
||||
AIO_CANCELED* = cint(0)
|
||||
AIO_NOTCANCELED* = cint(1)
|
||||
LIO_NOP* = cint(2)
|
||||
LIO_NOWAIT* = cint(1)
|
||||
LIO_READ* = cint(0)
|
||||
LIO_WAIT* = cint(0)
|
||||
LIO_WRITE* = cint(1)
|
||||
RTLD_LAZY* = cint(1)
|
||||
RTLD_NOW* = cint(2)
|
||||
RTLD_GLOBAL* = cint(256)
|
||||
RTLD_LOCAL* = cint(0)
|
||||
E2BIG* = cint(7)
|
||||
EACCES* = cint(13)
|
||||
EADDRINUSE* = cint(98)
|
||||
EADDRNOTAVAIL* = cint(99)
|
||||
EAFNOSUPPORT* = cint(97)
|
||||
EAGAIN* = cint(11)
|
||||
EALREADY* = cint(114)
|
||||
EBADF* = cint(9)
|
||||
EBADMSG* = cint(74)
|
||||
EBUSY* = cint(16)
|
||||
ECANCELED* = cint(125)
|
||||
ECHILD* = cint(10)
|
||||
ECONNABORTED* = cint(103)
|
||||
ECONNREFUSED* = cint(111)
|
||||
ECONNRESET* = cint(104)
|
||||
EDEADLK* = cint(35)
|
||||
EDESTADDRREQ* = cint(89)
|
||||
EDOM* = cint(33)
|
||||
EDQUOT* = cint(122)
|
||||
EEXIST* = cint(17)
|
||||
EFAULT* = cint(14)
|
||||
EFBIG* = cint(27)
|
||||
EHOSTUNREACH* = cint(113)
|
||||
EIDRM* = cint(43)
|
||||
EILSEQ* = cint(84)
|
||||
EINPROGRESS* = cint(115)
|
||||
EINTR* = cint(4)
|
||||
EINVAL* = cint(22)
|
||||
EIO* = cint(5)
|
||||
EISCONN* = cint(106)
|
||||
EISDIR* = cint(21)
|
||||
ELOOP* = cint(40)
|
||||
EMFILE* = cint(24)
|
||||
EMLINK* = cint(31)
|
||||
EMSGSIZE* = cint(90)
|
||||
EMULTIHOP* = cint(72)
|
||||
ENAMETOOLONG* = cint(36)
|
||||
ENETDOWN* = cint(100)
|
||||
ENETRESET* = cint(102)
|
||||
ENETUNREACH* = cint(101)
|
||||
ENFILE* = cint(23)
|
||||
ENOBUFS* = cint(105)
|
||||
ENODATA* = cint(61)
|
||||
ENODEV* = cint(19)
|
||||
ENOENT* = cint(2)
|
||||
ENOEXEC* = cint(8)
|
||||
ENOLCK* = cint(37)
|
||||
ENOLINK* = cint(67)
|
||||
ENOMEM* = cint(12)
|
||||
ENOMSG* = cint(42)
|
||||
ENOPROTOOPT* = cint(92)
|
||||
ENOSPC* = cint(28)
|
||||
ENOSR* = cint(63)
|
||||
ENOSTR* = cint(60)
|
||||
ENOSYS* = cint(38)
|
||||
ENOTCONN* = cint(107)
|
||||
ENOTDIR* = cint(20)
|
||||
ENOTEMPTY* = cint(39)
|
||||
ENOTSOCK* = cint(88)
|
||||
ENOTSUP* = cint(95)
|
||||
ENOTTY* = cint(25)
|
||||
ENXIO* = cint(6)
|
||||
EOPNOTSUPP* = cint(95)
|
||||
EOVERFLOW* = cint(75)
|
||||
EPERM* = cint(1)
|
||||
EPIPE* = cint(32)
|
||||
EPROTO* = cint(71)
|
||||
EPROTONOSUPPORT* = cint(93)
|
||||
EPROTOTYPE* = cint(91)
|
||||
ERANGE* = cint(34)
|
||||
EROFS* = cint(30)
|
||||
ESPIPE* = cint(29)
|
||||
ESRCH* = cint(3)
|
||||
ESTALE* = cint(116)
|
||||
ETIME* = cint(62)
|
||||
ETIMEDOUT* = cint(110)
|
||||
ETXTBSY* = cint(26)
|
||||
EWOULDBLOCK* = cint(11)
|
||||
EXDEV* = cint(18)
|
||||
F_DUPFD* = cint(0)
|
||||
F_GETFD* = cint(1)
|
||||
F_SETFD* = cint(2)
|
||||
F_GETFL* = cint(3)
|
||||
F_SETFL* = cint(4)
|
||||
F_GETLK* = cint(5)
|
||||
F_SETLK* = cint(6)
|
||||
F_SETLKW* = cint(7)
|
||||
F_GETOWN* = cint(9)
|
||||
F_SETOWN* = cint(8)
|
||||
FD_CLOEXEC* = cint(1)
|
||||
F_RDLCK* = cint(0)
|
||||
F_UNLCK* = cint(2)
|
||||
F_WRLCK* = cint(1)
|
||||
O_CREAT* = cint(64)
|
||||
O_EXCL* = cint(128)
|
||||
O_NOCTTY* = cint(256)
|
||||
O_TRUNC* = cint(512)
|
||||
O_APPEND* = cint(1024)
|
||||
O_DSYNC* = cint(4096)
|
||||
O_NONBLOCK* = cint(2048)
|
||||
O_RSYNC* = cint(4096)
|
||||
O_SYNC* = cint(4096)
|
||||
O_ACCMODE* = cint(3)
|
||||
O_RDONLY* = cint(0)
|
||||
O_RDWR* = cint(2)
|
||||
O_WRONLY* = cint(1)
|
||||
POSIX_FADV_NORMAL* = cint(0)
|
||||
POSIX_FADV_SEQUENTIAL* = cint(2)
|
||||
POSIX_FADV_RANDOM* = cint(1)
|
||||
POSIX_FADV_WILLNEED* = cint(3)
|
||||
POSIX_FADV_DONTNEED* = cint(4)
|
||||
POSIX_FADV_NOREUSE* = cint(5)
|
||||
FE_DIVBYZERO* = cint(4)
|
||||
FE_INEXACT* = cint(32)
|
||||
FE_INVALID* = cint(1)
|
||||
FE_OVERFLOW* = cint(8)
|
||||
FE_UNDERFLOW* = cint(16)
|
||||
FE_ALL_EXCEPT* = cint(61)
|
||||
FE_DOWNWARD* = cint(1024)
|
||||
FE_TONEAREST* = cint(0)
|
||||
FE_TOWARDZERO* = cint(3072)
|
||||
FE_UPWARD* = cint(2048)
|
||||
FE_DFL_ENV* = cast[pointer](0xffffffffffffffff)
|
||||
MM_HARD* = cint(1)
|
||||
MM_SOFT* = cint(2)
|
||||
MM_FIRM* = cint(4)
|
||||
MM_APPL* = cint(8)
|
||||
MM_UTIL* = cint(16)
|
||||
MM_OPSYS* = cint(32)
|
||||
MM_RECOVER* = cint(64)
|
||||
MM_NRECOV* = cint(128)
|
||||
MM_HALT* = cint(1)
|
||||
MM_ERROR* = cint(2)
|
||||
MM_WARNING* = cint(3)
|
||||
MM_INFO* = cint(4)
|
||||
MM_NOSEV* = cint(0)
|
||||
MM_PRINT* = cint(256)
|
||||
MM_CONSOLE* = cint(512)
|
||||
MM_OK* = cint(0)
|
||||
MM_NOTOK* = cint(-1)
|
||||
MM_NOMSG* = cint(1)
|
||||
MM_NOCON* = cint(4)
|
||||
FNM_NOMATCH* = cint(1)
|
||||
FNM_PATHNAME* = cint(1)
|
||||
FNM_PERIOD* = cint(4)
|
||||
FNM_NOESCAPE* = cint(2)
|
||||
FTW_F* = cint(0)
|
||||
FTW_D* = cint(1)
|
||||
FTW_DNR* = cint(2)
|
||||
FTW_NS* = cint(3)
|
||||
FTW_SL* = cint(4)
|
||||
GLOB_APPEND* = cint(32)
|
||||
GLOB_DOOFFS* = cint(8)
|
||||
GLOB_ERR* = cint(1)
|
||||
GLOB_MARK* = cint(2)
|
||||
GLOB_NOCHECK* = cint(16)
|
||||
GLOB_NOESCAPE* = cint(64)
|
||||
GLOB_NOSORT* = cint(4)
|
||||
GLOB_ABORTED* = cint(2)
|
||||
GLOB_NOMATCH* = cint(3)
|
||||
GLOB_NOSPACE* = cint(1)
|
||||
GLOB_NOSYS* = cint(4)
|
||||
CODESET* = cint(14)
|
||||
D_T_FMT* = cint(131112)
|
||||
D_FMT* = cint(131113)
|
||||
T_FMT* = cint(131114)
|
||||
T_FMT_AMPM* = cint(131115)
|
||||
AM_STR* = cint(131110)
|
||||
PM_STR* = cint(131111)
|
||||
DAY_1* = cint(131079)
|
||||
DAY_2* = cint(131080)
|
||||
DAY_3* = cint(131081)
|
||||
DAY_4* = cint(131082)
|
||||
DAY_5* = cint(131083)
|
||||
DAY_6* = cint(131084)
|
||||
DAY_7* = cint(131085)
|
||||
ABDAY_1* = cint(131072)
|
||||
ABDAY_2* = cint(131073)
|
||||
ABDAY_3* = cint(131074)
|
||||
ABDAY_4* = cint(131075)
|
||||
ABDAY_5* = cint(131076)
|
||||
ABDAY_6* = cint(131077)
|
||||
ABDAY_7* = cint(131078)
|
||||
MON_1* = cint(131098)
|
||||
MON_2* = cint(131099)
|
||||
MON_3* = cint(131100)
|
||||
MON_4* = cint(131101)
|
||||
MON_5* = cint(131102)
|
||||
MON_6* = cint(131103)
|
||||
MON_7* = cint(131104)
|
||||
MON_8* = cint(131105)
|
||||
MON_9* = cint(131106)
|
||||
MON_10* = cint(131107)
|
||||
MON_11* = cint(131108)
|
||||
MON_12* = cint(131109)
|
||||
ABMON_1* = cint(131086)
|
||||
ABMON_2* = cint(131087)
|
||||
ABMON_3* = cint(131088)
|
||||
ABMON_4* = cint(131089)
|
||||
ABMON_5* = cint(131090)
|
||||
ABMON_6* = cint(131091)
|
||||
ABMON_7* = cint(131092)
|
||||
ABMON_8* = cint(131093)
|
||||
ABMON_9* = cint(131094)
|
||||
ABMON_10* = cint(131095)
|
||||
ABMON_11* = cint(131096)
|
||||
ABMON_12* = cint(131097)
|
||||
ERA* = cint(131116)
|
||||
ERA_D_FMT* = cint(131118)
|
||||
ERA_D_T_FMT* = cint(131120)
|
||||
ERA_T_FMT* = cint(131121)
|
||||
ALT_DIGITS* = cint(131119)
|
||||
RADIXCHAR* = cint(65536)
|
||||
THOUSEP* = cint(65537)
|
||||
YESEXPR* = cint(327680)
|
||||
NOEXPR* = cint(327681)
|
||||
CRNCYSTR* = cint(262159)
|
||||
LC_ALL* = cint(6)
|
||||
LC_COLLATE* = cint(3)
|
||||
LC_CTYPE* = cint(0)
|
||||
LC_MESSAGES* = cint(5)
|
||||
LC_MONETARY* = cint(4)
|
||||
LC_NUMERIC* = cint(1)
|
||||
LC_TIME* = cint(2)
|
||||
PTHREAD_BARRIER_SERIAL_THREAD* = cint(-1)
|
||||
PTHREAD_CANCEL_ASYNCHRONOUS* = cint(1)
|
||||
PTHREAD_CANCEL_ENABLE* = cint(0)
|
||||
PTHREAD_CANCEL_DEFERRED* = cint(0)
|
||||
PTHREAD_CANCEL_DISABLE* = cint(1)
|
||||
PTHREAD_CREATE_DETACHED* = cint(1)
|
||||
PTHREAD_CREATE_JOINABLE* = cint(0)
|
||||
PTHREAD_EXPLICIT_SCHED* = cint(1)
|
||||
PTHREAD_INHERIT_SCHED* = cint(0)
|
||||
PTHREAD_ONCE_INIT* = cint(0)
|
||||
PTHREAD_PROCESS_SHARED* = cint(1)
|
||||
PTHREAD_PROCESS_PRIVATE* = cint(0)
|
||||
PTHREAD_SCOPE_PROCESS* = cint(1)
|
||||
PTHREAD_SCOPE_SYSTEM* = cint(0)
|
||||
POSIX_ASYNC_IO* = cint(1)
|
||||
F_OK* = cint(0)
|
||||
R_OK* = cint(4)
|
||||
W_OK* = cint(2)
|
||||
X_OK* = cint(1)
|
||||
CS_PATH* = cint(0)
|
||||
CS_POSIX_V6_ILP32_OFF32_CFLAGS* = cint(1116)
|
||||
CS_POSIX_V6_ILP32_OFF32_LDFLAGS* = cint(1117)
|
||||
CS_POSIX_V6_ILP32_OFF32_LIBS* = cint(1118)
|
||||
CS_POSIX_V6_ILP32_OFFBIG_CFLAGS* = cint(1120)
|
||||
CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS* = cint(1121)
|
||||
CS_POSIX_V6_ILP32_OFFBIG_LIBS* = cint(1122)
|
||||
CS_POSIX_V6_LP64_OFF64_CFLAGS* = cint(1124)
|
||||
CS_POSIX_V6_LP64_OFF64_LDFLAGS* = cint(1125)
|
||||
CS_POSIX_V6_LP64_OFF64_LIBS* = cint(1126)
|
||||
CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS* = cint(1128)
|
||||
CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS* = cint(1129)
|
||||
CS_POSIX_V6_LPBIG_OFFBIG_LIBS* = cint(1130)
|
||||
CS_POSIX_V6_WIDTH_RESTRICTED_ENVS* = cint(1)
|
||||
F_LOCK* = cint(1)
|
||||
F_TEST* = cint(3)
|
||||
F_TLOCK* = cint(2)
|
||||
F_ULOCK* = cint(0)
|
||||
PC_2_SYMLINKS* = cint(20)
|
||||
PC_ALLOC_SIZE_MIN* = cint(18)
|
||||
PC_ASYNC_IO* = cint(10)
|
||||
PC_CHOWN_RESTRICTED* = cint(6)
|
||||
PC_FILESIZEBITS* = cint(13)
|
||||
PC_LINK_MAX* = cint(0)
|
||||
PC_MAX_CANON* = cint(1)
|
||||
PC_MAX_INPUT* = cint(2)
|
||||
PC_NAME_MAX* = cint(3)
|
||||
PC_NO_TRUNC* = cint(7)
|
||||
PC_PATH_MAX* = cint(4)
|
||||
PC_PIPE_BUF* = cint(5)
|
||||
PC_PRIO_IO* = cint(11)
|
||||
PC_REC_INCR_XFER_SIZE* = cint(14)
|
||||
PC_REC_MIN_XFER_SIZE* = cint(16)
|
||||
PC_REC_XFER_ALIGN* = cint(17)
|
||||
PC_SYMLINK_MAX* = cint(19)
|
||||
PC_SYNC_IO* = cint(9)
|
||||
PC_VDISABLE* = cint(8)
|
||||
SC_2_C_BIND* = cint(47)
|
||||
SC_2_C_DEV* = cint(48)
|
||||
SC_2_CHAR_TERM* = cint(95)
|
||||
SC_2_FORT_DEV* = cint(49)
|
||||
SC_2_FORT_RUN* = cint(50)
|
||||
SC_2_LOCALEDEF* = cint(52)
|
||||
SC_2_PBS* = cint(168)
|
||||
SC_2_PBS_ACCOUNTING* = cint(169)
|
||||
SC_2_PBS_CHECKPOINT* = cint(175)
|
||||
SC_2_PBS_LOCATE* = cint(170)
|
||||
SC_2_PBS_MESSAGE* = cint(171)
|
||||
SC_2_PBS_TRACK* = cint(172)
|
||||
SC_2_SW_DEV* = cint(51)
|
||||
SC_2_UPE* = cint(97)
|
||||
SC_2_VERSION* = cint(46)
|
||||
SC_ADVISORY_INFO* = cint(132)
|
||||
SC_AIO_LISTIO_MAX* = cint(23)
|
||||
SC_AIO_MAX* = cint(24)
|
||||
SC_AIO_PRIO_DELTA_MAX* = cint(25)
|
||||
SC_ARG_MAX* = cint(0)
|
||||
SC_ASYNCHRONOUS_IO* = cint(12)
|
||||
SC_ATEXIT_MAX* = cint(87)
|
||||
SC_BARRIERS* = cint(133)
|
||||
SC_BC_BASE_MAX* = cint(36)
|
||||
SC_BC_DIM_MAX* = cint(37)
|
||||
SC_BC_SCALE_MAX* = cint(38)
|
||||
SC_BC_STRING_MAX* = cint(39)
|
||||
SC_CHILD_MAX* = cint(1)
|
||||
SC_CLK_TCK* = cint(2)
|
||||
SC_CLOCK_SELECTION* = cint(137)
|
||||
SC_COLL_WEIGHTS_MAX* = cint(40)
|
||||
SC_CPUTIME* = cint(138)
|
||||
SC_DELAYTIMER_MAX* = cint(26)
|
||||
SC_EXPR_NEST_MAX* = cint(42)
|
||||
SC_FSYNC* = cint(15)
|
||||
SC_GETGR_R_SIZE_MAX* = cint(69)
|
||||
SC_GETPW_R_SIZE_MAX* = cint(70)
|
||||
SC_HOST_NAME_MAX* = cint(180)
|
||||
SC_IOV_MAX* = cint(60)
|
||||
SC_IPV6* = cint(235)
|
||||
SC_JOB_CONTROL* = cint(7)
|
||||
SC_LINE_MAX* = cint(43)
|
||||
SC_LOGIN_NAME_MAX* = cint(71)
|
||||
SC_MAPPED_FILES* = cint(16)
|
||||
SC_MEMLOCK* = cint(17)
|
||||
SC_MEMLOCK_RANGE* = cint(18)
|
||||
SC_MEMORY_PROTECTION* = cint(19)
|
||||
SC_MESSAGE_PASSING* = cint(20)
|
||||
SC_MONOTONIC_CLOCK* = cint(149)
|
||||
SC_MQ_OPEN_MAX* = cint(27)
|
||||
SC_MQ_PRIO_MAX* = cint(28)
|
||||
SC_NGROUPS_MAX* = cint(3)
|
||||
SC_OPEN_MAX* = cint(4)
|
||||
SC_PAGE_SIZE* = cint(30)
|
||||
SC_PRIORITIZED_IO* = cint(13)
|
||||
SC_PRIORITY_SCHEDULING* = cint(10)
|
||||
SC_RAW_SOCKETS* = cint(236)
|
||||
SC_RE_DUP_MAX* = cint(44)
|
||||
SC_READER_WRITER_LOCKS* = cint(153)
|
||||
SC_REALTIME_SIGNALS* = cint(9)
|
||||
SC_REGEXP* = cint(155)
|
||||
SC_RTSIG_MAX* = cint(31)
|
||||
SC_SAVED_IDS* = cint(8)
|
||||
SC_SEM_NSEMS_MAX* = cint(32)
|
||||
SC_SEM_VALUE_MAX* = cint(33)
|
||||
SC_SEMAPHORES* = cint(21)
|
||||
SC_SHARED_MEMORY_OBJECTS* = cint(22)
|
||||
SC_SHELL* = cint(157)
|
||||
SC_SIGQUEUE_MAX* = cint(34)
|
||||
SC_SPAWN* = cint(159)
|
||||
SC_SPIN_LOCKS* = cint(154)
|
||||
SC_SPORADIC_SERVER* = cint(160)
|
||||
SC_STREAM_MAX* = cint(5)
|
||||
SC_SYMLOOP_MAX* = cint(173)
|
||||
SC_SYNCHRONIZED_IO* = cint(14)
|
||||
SC_THREAD_ATTR_STACKADDR* = cint(77)
|
||||
SC_THREAD_ATTR_STACKSIZE* = cint(78)
|
||||
SC_THREAD_CPUTIME* = cint(139)
|
||||
SC_THREAD_DESTRUCTOR_ITERATIONS* = cint(73)
|
||||
SC_THREAD_KEYS_MAX* = cint(74)
|
||||
SC_THREAD_PRIO_INHERIT* = cint(80)
|
||||
SC_THREAD_PRIO_PROTECT* = cint(81)
|
||||
SC_THREAD_PRIORITY_SCHEDULING* = cint(79)
|
||||
SC_THREAD_PROCESS_SHARED* = cint(82)
|
||||
SC_THREAD_SAFE_FUNCTIONS* = cint(68)
|
||||
SC_THREAD_SPORADIC_SERVER* = cint(161)
|
||||
SC_THREAD_STACK_MIN* = cint(75)
|
||||
SC_THREAD_THREADS_MAX* = cint(76)
|
||||
SC_THREADS* = cint(67)
|
||||
SC_TIMEOUTS* = cint(164)
|
||||
SC_TIMER_MAX* = cint(35)
|
||||
SC_TIMERS* = cint(11)
|
||||
SC_TRACE* = cint(181)
|
||||
SC_TRACE_EVENT_FILTER* = cint(182)
|
||||
SC_TRACE_INHERIT* = cint(183)
|
||||
SC_TRACE_LOG* = cint(184)
|
||||
SC_TTY_NAME_MAX* = cint(72)
|
||||
SC_TYPED_MEMORY_OBJECTS* = cint(165)
|
||||
SC_TZNAME_MAX* = cint(6)
|
||||
SC_V6_ILP32_OFF32* = cint(176)
|
||||
SC_V6_ILP32_OFFBIG* = cint(177)
|
||||
SC_V6_LP64_OFF64* = cint(178)
|
||||
SC_V6_LPBIG_OFFBIG* = cint(179)
|
||||
SC_VERSION* = cint(29)
|
||||
SC_XBS5_ILP32_OFF32* = cint(125)
|
||||
SC_XBS5_ILP32_OFFBIG* = cint(126)
|
||||
SC_XBS5_LP64_OFF64* = cint(127)
|
||||
SC_XBS5_LPBIG_OFFBIG* = cint(128)
|
||||
SC_XOPEN_CRYPT* = cint(92)
|
||||
SC_XOPEN_ENH_I18N* = cint(93)
|
||||
SC_XOPEN_LEGACY* = cint(129)
|
||||
SC_XOPEN_REALTIME* = cint(130)
|
||||
SC_XOPEN_REALTIME_THREADS* = cint(131)
|
||||
SC_XOPEN_SHM* = cint(94)
|
||||
SC_XOPEN_UNIX* = cint(91)
|
||||
SC_XOPEN_VERSION* = cint(89)
|
||||
SEEK_SET* = cint(0)
|
||||
SEEK_CUR* = cint(1)
|
||||
SEEK_END* = cint(2)
|
||||
SEM_FAILED* = cast[pointer]((nil))
|
||||
IPC_CREAT* = cint(512)
|
||||
IPC_EXCL* = cint(1024)
|
||||
IPC_NOWAIT* = cint(2048)
|
||||
IPC_PRIVATE* = cint(0)
|
||||
IPC_RMID* = cint(0)
|
||||
IPC_SET* = cint(1)
|
||||
IPC_STAT* = cint(2)
|
||||
S_IFMT* = cint(61440)
|
||||
S_IFBLK* = cint(24576)
|
||||
S_IFCHR* = cint(8192)
|
||||
S_IFIFO* = cint(4096)
|
||||
S_IFREG* = cint(32768)
|
||||
S_IFDIR* = cint(16384)
|
||||
S_IFLNK* = cint(40960)
|
||||
S_IFSOCK* = cint(49152)
|
||||
S_IRWXU* = cint(448)
|
||||
S_IRUSR* = cint(256)
|
||||
S_IWUSR* = cint(128)
|
||||
S_IXUSR* = cint(64)
|
||||
S_IRWXG* = cint(56)
|
||||
S_IRGRP* = cint(32)
|
||||
S_IWGRP* = cint(16)
|
||||
S_IXGRP* = cint(8)
|
||||
S_IRWXO* = cint(7)
|
||||
S_IROTH* = cint(4)
|
||||
S_IWOTH* = cint(2)
|
||||
S_IXOTH* = cint(1)
|
||||
S_ISUID* = cint(2048)
|
||||
S_ISGID* = cint(1024)
|
||||
S_ISVTX* = cint(512)
|
||||
ST_RDONLY* = cint(1)
|
||||
ST_NOSUID* = cint(2)
|
||||
PROT_READ* = cint(1)
|
||||
PROT_WRITE* = cint(2)
|
||||
PROT_EXEC* = cint(4)
|
||||
PROT_NONE* = cint(0)
|
||||
MAP_SHARED* = cint(1)
|
||||
MAP_PRIVATE* = cint(2)
|
||||
MAP_FIXED* = cint(16)
|
||||
MS_ASYNC* = cint(1)
|
||||
MS_SYNC* = cint(4)
|
||||
MS_INVALIDATE* = cint(2)
|
||||
MCL_CURRENT* = cint(1)
|
||||
MCL_FUTURE* = cint(2)
|
||||
MAP_FAILED* = cast[pointer](0xffffffffffffffff)
|
||||
POSIX_MADV_NORMAL* = cint(0)
|
||||
POSIX_MADV_SEQUENTIAL* = cint(2)
|
||||
POSIX_MADV_RANDOM* = cint(1)
|
||||
POSIX_MADV_WILLNEED* = cint(3)
|
||||
POSIX_MADV_DONTNEED* = cint(4)
|
||||
CLOCKS_PER_SEC* = clong(1000000)
|
||||
CLOCK_PROCESS_CPUTIME_ID* = cint(2)
|
||||
CLOCK_THREAD_CPUTIME_ID* = cint(3)
|
||||
CLOCK_REALTIME* = cint(0)
|
||||
TIMER_ABSTIME* = cint(1)
|
||||
CLOCK_MONOTONIC* = cint(1)
|
||||
WNOHANG* = cint(1)
|
||||
WUNTRACED* = cint(2)
|
||||
WEXITED* = cint(4)
|
||||
WSTOPPED* = cint(2)
|
||||
WCONTINUED* = cint(8)
|
||||
WNOWAIT* = cint(16777216)
|
||||
SIGEV_NONE* = cint(1)
|
||||
SIGEV_SIGNAL* = cint(0)
|
||||
SIGEV_THREAD* = cint(2)
|
||||
SIGABRT* = cint(6)
|
||||
SIGALRM* = cint(14)
|
||||
SIGBUS* = cint(7)
|
||||
SIGCHLD* = cint(17)
|
||||
SIGCONT* = cint(18)
|
||||
SIGFPE* = cint(8)
|
||||
SIGHUP* = cint(1)
|
||||
SIGILL* = cint(4)
|
||||
SIGINT* = cint(2)
|
||||
SIGKILL* = cint(9)
|
||||
SIGPIPE* = cint(13)
|
||||
SIGQUIT* = cint(3)
|
||||
SIGSEGV* = cint(11)
|
||||
SIGSTOP* = cint(19)
|
||||
SIGTERM* = cint(15)
|
||||
SIGTSTP* = cint(20)
|
||||
SIGTTIN* = cint(21)
|
||||
SIGTTOU* = cint(22)
|
||||
SIGUSR1* = cint(10)
|
||||
SIGUSR2* = cint(12)
|
||||
SIGPOLL* = cint(29)
|
||||
SIGPROF* = cint(27)
|
||||
SIGSYS* = cint(31)
|
||||
SIGTRAP* = cint(5)
|
||||
SIGURG* = cint(23)
|
||||
SIGVTALRM* = cint(26)
|
||||
SIGXCPU* = cint(24)
|
||||
SIGXFSZ* = cint(25)
|
||||
SA_NOCLDSTOP* = cint(1)
|
||||
SIG_BLOCK* = cint(0)
|
||||
SIG_UNBLOCK* = cint(1)
|
||||
SIG_SETMASK* = cint(2)
|
||||
SA_ONSTACK* = cint(134217728)
|
||||
SA_RESETHAND* = cint(-2147483648)
|
||||
SA_RESTART* = cint(268435456)
|
||||
SA_SIGINFO* = cint(4)
|
||||
SA_NOCLDWAIT* = cint(2)
|
||||
SA_NODEFER* = cint(1073741824)
|
||||
SS_ONSTACK* = cint(1)
|
||||
SS_DISABLE* = cint(2)
|
||||
MINSIGSTKSZ* = cint(2048)
|
||||
SIGSTKSZ* = cint(8192)
|
||||
NL_SETD* = cint(1)
|
||||
NL_CAT_LOCALE* = cint(1)
|
||||
SCHED_FIFO* = cint(1)
|
||||
SCHED_RR* = cint(2)
|
||||
SCHED_OTHER* = cint(0)
|
||||
FD_SETSIZE* = cint(1024)
|
||||
IF_NAMESIZE* = cint(16)
|
||||
SCM_RIGHTS* = cint(1)
|
||||
SOCK_DGRAM* = cint(2)
|
||||
SOCK_RAW* = cint(3)
|
||||
SOCK_SEQPACKET* = cint(5)
|
||||
SOCK_STREAM* = cint(1)
|
||||
SOL_SOCKET* = cint(1)
|
||||
SO_ACCEPTCONN* = cint(30)
|
||||
SO_BROADCAST* = cint(6)
|
||||
SO_DEBUG* = cint(1)
|
||||
SO_DONTROUTE* = cint(5)
|
||||
SO_ERROR* = cint(4)
|
||||
SO_KEEPALIVE* = cint(9)
|
||||
SO_LINGER* = cint(13)
|
||||
SO_OOBINLINE* = cint(10)
|
||||
SO_RCVBUF* = cint(8)
|
||||
SO_RCVLOWAT* = cint(18)
|
||||
SO_RCVTIMEO* = cint(20)
|
||||
SO_REUSEADDR* = cint(2)
|
||||
SO_SNDBUF* = cint(7)
|
||||
SO_SNDLOWAT* = cint(19)
|
||||
SO_SNDTIMEO* = cint(21)
|
||||
SO_TYPE* = cint(3)
|
||||
SOMAXCONN* = cint(128)
|
||||
MSG_CTRUNC* = cint(8)
|
||||
MSG_DONTROUTE* = cint(4)
|
||||
MSG_EOR* = cint(128)
|
||||
MSG_OOB* = cint(1)
|
||||
MSG_PEEK* = cint(2)
|
||||
MSG_TRUNC* = cint(32)
|
||||
MSG_WAITALL* = cint(256)
|
||||
AF_INET* = cint(2)
|
||||
AF_INET6* = cint(10)
|
||||
AF_UNIX* = cint(1)
|
||||
AF_UNSPEC* = cint(0)
|
||||
SHUT_RD* = cint(0)
|
||||
SHUT_RDWR* = cint(2)
|
||||
SHUT_WR* = cint(1)
|
||||
IPPROTO_IP* = cint(0)
|
||||
IPPROTO_IPV6* = cint(41)
|
||||
IPPROTO_ICMP* = cint(1)
|
||||
IPPROTO_RAW* = cint(255)
|
||||
IPPROTO_TCP* = cint(6)
|
||||
IPPROTO_UDP* = cint(17)
|
||||
INADDR_ANY* = cint(0)
|
||||
INADDR_BROADCAST* = cint(-1)
|
||||
INET_ADDRSTRLEN* = cint(16)
|
||||
IPV6_JOIN_GROUP* = cint(20)
|
||||
IPV6_LEAVE_GROUP* = cint(21)
|
||||
IPV6_MULTICAST_HOPS* = cint(18)
|
||||
IPV6_MULTICAST_IF* = cint(17)
|
||||
IPV6_MULTICAST_LOOP* = cint(19)
|
||||
IPV6_UNICAST_HOPS* = cint(16)
|
||||
IPV6_V6ONLY* = cint(26)
|
||||
IPPORT_RESERVED* = cint(1024)
|
||||
HOST_NOT_FOUND* = cint(1)
|
||||
NO_DATA* = cint(4)
|
||||
NO_RECOVERY* = cint(3)
|
||||
TRY_AGAIN* = cint(2)
|
||||
AI_PASSIVE* = cint(1)
|
||||
AI_CANONNAME* = cint(2)
|
||||
AI_NUMERICHOST* = cint(4)
|
||||
AI_NUMERICSERV* = cint(1024)
|
||||
AI_V4MAPPED* = cint(8)
|
||||
AI_ALL* = cint(16)
|
||||
AI_ADDRCONFIG* = cint(32)
|
||||
NI_NOFQDN* = cint(4)
|
||||
NI_NUMERICHOST* = cint(1)
|
||||
NI_NAMEREQD* = cint(8)
|
||||
NI_NUMERICSERV* = cint(2)
|
||||
NI_DGRAM* = cint(16)
|
||||
EAI_AGAIN* = cint(-3)
|
||||
EAI_BADFLAGS* = cint(-1)
|
||||
EAI_FAIL* = cint(-4)
|
||||
EAI_FAMILY* = cint(-6)
|
||||
EAI_MEMORY* = cint(-10)
|
||||
EAI_NONAME* = cint(-2)
|
||||
EAI_SERVICE* = cint(-8)
|
||||
EAI_SOCKTYPE* = cint(-7)
|
||||
EAI_SYSTEM* = cint(-11)
|
||||
EAI_OVERFLOW* = cint(-12)
|
||||
POLLIN* = cshort(1)
|
||||
POLLPRI* = cshort(2)
|
||||
POLLOUT* = cshort(4)
|
||||
POLLERR* = cshort(8)
|
||||
POLLHUP* = cshort(16)
|
||||
POLLNVAL* = cshort(32)
|
||||
POSIX_SPAWN_RESETIDS* = cint(1)
|
||||
POSIX_SPAWN_SETPGROUP* = cint(2)
|
||||
POSIX_SPAWN_SETSCHEDPARAM* = cint(16)
|
||||
POSIX_SPAWN_SETSCHEDULER* = cint(32)
|
||||
POSIX_SPAWN_SETSIGDEF* = cint(4)
|
||||
POSIX_SPAWN_SETSIGMASK* = cint(8)
|
||||
@@ -26,33 +26,37 @@
|
||||
## This library relies on the header files of your C compiler. Thus the
|
||||
## resulting C code will just include <XYZ.h> and *not* define the
|
||||
## symbols declared here.
|
||||
|
||||
from times import TTime
|
||||
|
||||
const
|
||||
hasSpawnH = defined(linux)
|
||||
hasAioH = defined(linux)
|
||||
|
||||
|
||||
when false:
|
||||
const
|
||||
C_IRUSR = 0c000400 ## Read by owner.
|
||||
C_IWUSR = 0c000200 ## Write by owner.
|
||||
C_IXUSR = 0c000100 ## Execute by owner.
|
||||
C_IRGRP = 0c000040 ## Read by group.
|
||||
C_IWGRP = 0c000020 ## Write by group.
|
||||
C_IXGRP = 0c000010 ## Execute by group.
|
||||
C_IROTH = 0c000004 ## Read by others.
|
||||
C_IWOTH = 0c000002 ## Write by others.
|
||||
C_IXOTH = 0c000001 ## Execute by others.
|
||||
C_ISUID = 0c004000 ## Set user ID.
|
||||
C_ISGID = 0c002000 ## Set group ID.
|
||||
C_ISVTX = 0c001000 ## On directories, restricted deletion flag.
|
||||
C_ISDIR = 0c040000 ## Directory.
|
||||
C_ISFIFO = 0c010000 ##FIFO.
|
||||
C_ISREG = 0c100000 ## Regular file.
|
||||
C_ISBLK = 0c060000 ## Block special.
|
||||
C_ISCHR = 0c020000 ## Character special.
|
||||
C_ISCTG = 0c110000 ## Reserved.
|
||||
C_ISLNK = 0c120000 ## Symbolic link.</p>
|
||||
C_ISSOCK = 0c140000 ## Socket.
|
||||
|
||||
const
|
||||
C_IRUSR* = 0c000400 ## Read by owner.
|
||||
C_IWUSR* = 0c000200 ## Write by owner.
|
||||
C_IXUSR* = 0c000100 ## Execute by owner.
|
||||
C_IRGRP* = 0c000040 ## Read by group.
|
||||
C_IWGRP* = 0c000020 ## Write by group.
|
||||
C_IXGRP* = 0c000010 ## Execute by group.
|
||||
C_IROTH* = 0c000004 ## Read by others.
|
||||
C_IWOTH* = 0c000002 ## Write by others.
|
||||
C_IXOTH* = 0c000001 ## Execute by others.
|
||||
C_ISUID* = 0c004000 ## Set user ID.
|
||||
C_ISGID* = 0c002000 ## Set group ID.
|
||||
C_ISVTX* = 0c001000 ## On directories, restricted deletion flag.
|
||||
C_ISDIR* = 0c040000 ## Directory.
|
||||
C_ISFIFO* = 0c010000 ##FIFO.
|
||||
C_ISREG* = 0c100000 ## Regular file.
|
||||
C_ISBLK* = 0c060000 ## Block special.
|
||||
C_ISCHR* = 0c020000 ## Character special.
|
||||
C_ISCTG* = 0c110000 ## Reserved.
|
||||
C_ISLNK* = 0c120000 ## Symbolic link.</p>
|
||||
C_ISSOCK* = 0c140000 ## Socket.
|
||||
|
||||
MM_NULLLBL* = nil
|
||||
MM_NULLSEV* = 0
|
||||
MM_NULLMC* = 0
|
||||
@@ -104,9 +108,9 @@ type
|
||||
|
||||
TGlob* {.importc: "glob_t", header: "<glob.h>",
|
||||
final, pure.} = object ## glob_t
|
||||
gl_pathc*: int ## Count of paths matched by pattern.
|
||||
gl_pathv*: ptr cstring ## Pointer to a list of matched pathnames.
|
||||
gl_offs*: int ## Slots to reserve at the beginning of gl_pathv.
|
||||
gl_pathc*: int ## Count of paths matched by pattern.
|
||||
gl_pathv*: cstringArray ## Pointer to a list of matched pathnames.
|
||||
gl_offs*: int ## Slots to reserve at the beginning of gl_pathv.
|
||||
|
||||
TGroup* {.importc: "struct group", header: "<grp.h>",
|
||||
final, pure.} = object ## struct group
|
||||
@@ -198,7 +202,7 @@ type
|
||||
header: "<sys/types.h>".} = int
|
||||
Tpthread* {.importc: "pthread_t", header: "<sys/types.h>".} = int
|
||||
Tsuseconds* {.importc: "suseconds_t", header: "<sys/types.h>".} = int
|
||||
Ttime* {.importc: "time_t", header: "<sys/types.h>".} = int
|
||||
#Ttime* {.importc: "time_t", header: "<sys/types.h>".} = int
|
||||
Ttimer* {.importc: "timer_t", header: "<sys/types.h>".} = int
|
||||
Ttrace_attr* {.importc: "trace_attr_t", header: "<sys/types.h>".} = int
|
||||
Ttrace_event_id* {.importc: "trace_event_id_t",
|
||||
@@ -2431,4 +2435,7 @@ proc setservent*(a1: cint) {.importc, header: "<netdb.h>".}
|
||||
proc poll*(a1: ptr Tpollfd, a2: Tnfds, a3: int): cint {.
|
||||
importc, header: "<poll.h>".}
|
||||
|
||||
proc realpath*(name, resolved: CString): CString {.
|
||||
importc: "realpath", header: "<stdlib.h>".}
|
||||
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
; This contains the CPU-dependant variants of some routines.
|
||||
; (C) 2005 Andreas Rumpf
|
||||
; This code was inspired by the Freepascal compiler's sources
|
||||
; All routines here have the _cdecl calling convention because
|
||||
; that is the only convention any C compiler supports.
|
||||
|
||||
\python{
|
||||
def c(name):
|
||||
if os.name == 'posix':
|
||||
return name
|
||||
else:
|
||||
return "_" + name
|
||||
}
|
||||
|
||||
segment code
|
||||
|
||||
global \c{cpu_inc_locked}
|
||||
global \c{cpu_dec_locked}
|
||||
|
||||
\c{cpu_dec_locked}:
|
||||
; input: address of arg in r3
|
||||
.LDecLockedLoop:
|
||||
lwarx r10,0,r3
|
||||
subi r10,r10,1
|
||||
stwcx. r10,0,r3
|
||||
bne- .LDecLockedLoop
|
||||
cntlzw r3,r10
|
||||
srwi r3,r3,5
|
||||
|
||||
\c{cpu_inc_locked}:
|
||||
.LIncLockedLoop:
|
||||
lwarx r10,0,r3
|
||||
addi r10,r10,1
|
||||
stwcx. r10,0,r3
|
||||
bne- .LIncLockedLoop
|
||||
84
lib/pure/dynlib.nim
Normal file
84
lib/pure/dynlib.nim
Normal file
@@ -0,0 +1,84 @@
|
||||
#
|
||||
#
|
||||
# Nimrod's Runtime Library
|
||||
# (c) Copyright 2009 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
# distribution, for details about the copyright.
|
||||
#
|
||||
|
||||
## This module implements the ability to access symbols from shared
|
||||
## libraries. On POSIX this uses the ``dlsym`` mechanism, on
|
||||
## Windows ``LoadLibrary``.
|
||||
|
||||
type
|
||||
TLibHandle* = pointer ## a handle to a dynamically loaded library
|
||||
|
||||
proc LoadLib*(path: string): TLibHandle
|
||||
## loads a library from `path`. Returns nil if the library could not
|
||||
## be loaded.
|
||||
|
||||
proc UnloadLib*(lib: TLibHandle)
|
||||
## unloads the library `lib`
|
||||
|
||||
proc symAddr*(lib: TLibHandle, name: string): pointer
|
||||
## retrieves the address of a procedure/variable from `lib`. Returns nil
|
||||
## if the symbol could not be found.
|
||||
|
||||
proc checkedSymAddr*(lib: TLibHandle, name: string): pointer =
|
||||
## retrieves the address of a procedure/variable from `lib`. Raises
|
||||
## `EInvalidLibrary` if the symbol could not be found.
|
||||
result = symAddr(lib, name)
|
||||
if result == nil:
|
||||
var e: ref EInvalidLibrary
|
||||
new(e)
|
||||
e.msg = "could not find symbol: " & name
|
||||
raise e
|
||||
|
||||
when defined(posix):
|
||||
#
|
||||
# =========================================================================
|
||||
# This is an implementation based on the dlfcn interface.
|
||||
# The dlfcn interface is available in Linux, SunOS, Solaris, IRIX, FreeBSD,
|
||||
# NetBSD, AIX 4.2, HPUX 11, and probably most other Unix flavors, at least
|
||||
# as an emulation layer on top of native functions.
|
||||
# =========================================================================
|
||||
#
|
||||
var
|
||||
RTLD_NOW {.importc: "RTLD_NOW", header: "<dlfcn.h>".}: int
|
||||
|
||||
proc dlclose(lib: TLibHandle) {.importc, header: "<dlfcn.h>".}
|
||||
proc dlopen(path: CString, mode: int): TLibHandle {.
|
||||
importc, header: "<dlfcn.h>".}
|
||||
proc dlsym(lib: TLibHandle, name: cstring): pointer {.
|
||||
importc, header: "<dlfcn.h>".}
|
||||
|
||||
proc LoadLib(path: string): TLibHandle = return dlopen(path, RTLD_NOW)
|
||||
proc UnloadLib(lib: TLibHandle) = dlclose(lib)
|
||||
proc symAddr(lib: TLibHandle, name: string): pointer =
|
||||
return dlsym(lib, name)
|
||||
|
||||
elif defined(windows) or defined(dos):
|
||||
#
|
||||
# =======================================================================
|
||||
# Native Windows Implementation
|
||||
# =======================================================================
|
||||
#
|
||||
type
|
||||
THINSTANCE {.importc: "HINSTANCE".} = pointer
|
||||
|
||||
proc FreeLibrary(lib: THINSTANCE) {.importc, header: "<windows.h>", stdcall.}
|
||||
proc winLoadLibrary(path: cstring): THINSTANCE {.
|
||||
importc: "LoadLibraryA", header: "<windows.h>", stdcall.}
|
||||
proc GetProcAddress(lib: THINSTANCE, name: cstring): pointer {.
|
||||
importc: "GetProcAddress", header: "<windows.h>", stdcall.}
|
||||
|
||||
proc LoadLib(path: string): TLibHandle =
|
||||
result = cast[TLibHandle](winLoadLibrary(path))
|
||||
proc UnloadLib(lib: TLibHandle) = FreeLibrary(cast[THINSTANCE](lib))
|
||||
|
||||
proc symAddr(lib: TLibHandle, name: string): pointer =
|
||||
result = GetProcAddress(cast[THINSTANCE](lib), name)
|
||||
|
||||
else:
|
||||
{.error: "no implementation for dynlib".}
|
||||
@@ -64,19 +64,19 @@ type
|
||||
nnkStmtListExpr, nnkBlockExpr, nnkStmtListType, nnkBlockType,
|
||||
nnkVm, nnkTypeOfExpr, nnkObjectTy, nnkTupleTy,
|
||||
nnkRecList, nnkRecCase, nnkRecWhen, nnkRefTy,
|
||||
nnkPtrTy, nnkVarTy, nnkProcTy, nnkEnumTy,
|
||||
nnkEnumFieldDef, nnkReturnToken
|
||||
nnkPtrTy, nnkVarTy, nnkAbstractTy, nnkProcTy,
|
||||
nnkEnumTy, nnkEnumFieldDef, nnkReturnToken
|
||||
TNimNodeKinds* = set[TNimrodNodeKind]
|
||||
TNimrodTypeKind* = enum
|
||||
ntyNone, ntyBool, ntyChar, ntyEmpty,
|
||||
ntyArrayConstr, ntyNil, ntyGeneric, ntyGenericInst,
|
||||
ntyGenericParam, ntyEnum, ntyAnyEnum, ntyArray,
|
||||
ntyObject, ntyTuple, ntySet, ntyRange,
|
||||
ntyPtr, ntyRef, ntyVar, ntySequence,
|
||||
ntyProc, ntyPointer, ntyOpenArray, ntyString,
|
||||
ntyCString, ntyForward, ntyInt, ntyInt8,
|
||||
ntyInt16, ntyInt32, ntyInt64, ntyFloat,
|
||||
ntyFloat32, ntyFloat64, ntyFloat128
|
||||
ntyGenericParam, ntyAbstract, ntyEnum, ntyOrdinal,
|
||||
ntyArray, ntyObject, ntyTuple, ntySet,
|
||||
ntyRange, ntyPtr, ntyRef, ntyVar,
|
||||
ntySequence, ntyProc, ntyPointer, ntyOpenArray,
|
||||
ntyString, ntyCString, ntyForward, ntyInt,
|
||||
ntyInt8, ntyInt16, ntyInt32, ntyInt64,
|
||||
ntyFloat, ntyFloat32, ntyFloat64, ntyFloat128
|
||||
TNimTypeKinds* = set[TNimrodTypeKind]
|
||||
TNimrodSymKind* = enum
|
||||
nskUnknownSym, nskConditional, nskDynLib, nskParam,
|
||||
@@ -86,7 +86,7 @@ proc nextPowerOfTwo*(x: int): int =
|
||||
proc countBits*(n: int32): int {.noSideEffect.}
|
||||
## counts the set bits in `n`.
|
||||
|
||||
include cntbits
|
||||
include "system/cntbits"
|
||||
|
||||
proc sum*[T](x: openarray[T]): T {.noSideEffect.} =
|
||||
## computes the sum of the elements in `x`.
|
||||
245
lib/pure/md5.nim
Normal file
245
lib/pure/md5.nim
Normal file
@@ -0,0 +1,245 @@
|
||||
#
|
||||
#
|
||||
# Nimrod's Runtime Library
|
||||
# (c) Copyright 2009 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
# distribution, for details about the copyright.
|
||||
#
|
||||
|
||||
## Module for computing MD5 checksums.
|
||||
|
||||
type
|
||||
MD5State = array[0..3, int32]
|
||||
MD5Block = array[0..15, int32]
|
||||
MD5CBits = array[0..7, int8]
|
||||
MD5Digest* = array[0..15, int8]
|
||||
MD5Buffer = array[0..63, int8]
|
||||
MD5Context* {.final.} = object
|
||||
State: MD5State
|
||||
Count: array[0..1, int32]
|
||||
Buffer: MD5Buffer
|
||||
|
||||
const
|
||||
padding: cstring = "\x80\0\0\0" &
|
||||
"\0\0\0\0\0\0\0\0" &
|
||||
"\0\0\0\0\0\0\0\0" &
|
||||
"\0\0\0\0\0\0\0\0" &
|
||||
"\0\0\0\0\0\0\0\0" &
|
||||
"\0\0\0\0\0\0\0\0" &
|
||||
"\0\0\0\0\0\0\0\0" &
|
||||
"\0\0\0\0\0\0\0\0" &
|
||||
"\0\0\0\0"
|
||||
|
||||
proc F(x, y, z: int32): int32 {.inline.} =
|
||||
Result = (x and y) or ((not x) and z)
|
||||
|
||||
proc G(x, y, z: int32): int32 {.inline.} =
|
||||
Result = (x and z) or (y and (not z))
|
||||
|
||||
proc H(x, y, z: int32): int32 {.inline.} =
|
||||
Result = x xor y xor z
|
||||
|
||||
proc I(x, y, z: int32): int32 {.inline.} =
|
||||
Result = y xor (x or (not z))
|
||||
|
||||
proc rot(x: var int32, n: int8) {.inline.} =
|
||||
x = toU32(x shl ze(n)) or (x shr toU32(32 -% ze(n)))
|
||||
|
||||
proc FF(a: var int32, b, c, d, x: int32, s: int8, ac: int32) =
|
||||
a = a +% F(b, c, d) +% x +% ac
|
||||
rot(a, s)
|
||||
a = a +% b
|
||||
|
||||
proc GG(a: var int32, b, c, d, x: int32, s: int8, ac: int32) =
|
||||
a = a +% G(b, c, d) +% x +% ac
|
||||
rot(a, s)
|
||||
a = a +% b
|
||||
|
||||
proc HH(a: var int32, b, c, d, x: int32, s: int8, ac: int32) =
|
||||
a = a +% H(b, c, d) +% x +% ac
|
||||
rot(a, s)
|
||||
a = a +% b
|
||||
|
||||
proc II(a: var int32, b, c, d, x: int32, s: int8, ac: int32) =
|
||||
a = a +% I(b, c, d) +% x +% ac
|
||||
rot(a, s)
|
||||
a = a +% b
|
||||
|
||||
proc encode(dest: var MD5Block, src: cstring) =
|
||||
var j = 0
|
||||
for i in 0..high(dest):
|
||||
dest[i] = toU32(ord(src[j]) or
|
||||
ord(src[j+1]) shl 8 or
|
||||
ord(src[j+2]) shl 16 or
|
||||
ord(src[j+3]) shl 24)
|
||||
inc(j, 4)
|
||||
|
||||
proc decode(dest: var openarray[int8], src: openarray[int32]) =
|
||||
var i = 0
|
||||
for j in 0..high(src):
|
||||
dest[i] = toU8(src[j] and 0xff'i32)
|
||||
dest[i+1] = toU8(src[j] shr 8'i32 and 0xff'i32)
|
||||
dest[i+2] = toU8(src[j] shr 16'i32 and 0xff'i32)
|
||||
dest[i+3] = toU8(src[j] shr 24'i32 and 0xff'i32)
|
||||
inc(i, 4)
|
||||
|
||||
proc transform(Buffer: pointer, State: var MD5State) =
|
||||
var
|
||||
myBlock: MD5Block
|
||||
encode(myBlock, cast[cstring](buffer))
|
||||
var a = State[0]
|
||||
var b = State[1]
|
||||
var c = State[2]
|
||||
var d = State[3]
|
||||
FF(a, b, c, d, myBlock[0], 7'i8, 0xD76AA478'i32)
|
||||
FF(d, a, b, c, myBlock[1], 12'i8, 0xE8C7B756'i32)
|
||||
FF(c, d, a, b, myBlock[2], 17'i8, 0x242070DB'i32)
|
||||
FF(b, c, d, a, myBlock[3], 22'i8, 0xC1BDCEEE'i32)
|
||||
FF(a, b, c, d, myBlock[4], 7'i8, 0xF57C0FAF'i32)
|
||||
FF(d, a, b, c, myBlock[5], 12'i8, 0x4787C62A'i32)
|
||||
FF(c, d, a, b, myBlock[6], 17'i8, 0xA8304613'i32)
|
||||
FF(b, c, d, a, myBlock[7], 22'i8, 0xFD469501'i32)
|
||||
FF(a, b, c, d, myBlock[8], 7'i8, 0x698098D8'i32)
|
||||
FF(d, a, b, c, myBlock[9], 12'i8, 0x8B44F7AF'i32)
|
||||
FF(c, d, a, b, myBlock[10], 17'i8, 0xFFFF5BB1'i32)
|
||||
FF(b, c, d, a, myBlock[11], 22'i8, 0x895CD7BE'i32)
|
||||
FF(a, b, c, d, myBlock[12], 7'i8, 0x6B901122'i32)
|
||||
FF(d, a, b, c, myBlock[13], 12'i8, 0xFD987193'i32)
|
||||
FF(c, d, a, b, myBlock[14], 17'i8, 0xA679438E'i32)
|
||||
FF(b, c, d, a, myBlock[15], 22'i8, 0x49B40821'i32)
|
||||
GG(a, b, c, d, myBlock[1], 5'i8, 0xF61E2562'i32)
|
||||
GG(d, a, b, c, myBlock[6], 9'i8, 0xC040B340'i32)
|
||||
GG(c, d, a, b, myBlock[11], 14'i8, 0x265E5A51'i32)
|
||||
GG(b, c, d, a, myBlock[0], 20'i8, 0xE9B6C7AA'i32)
|
||||
GG(a, b, c, d, myBlock[5], 5'i8, 0xD62F105D'i32)
|
||||
GG(d, a, b, c, myBlock[10], 9'i8, 0x02441453'i32)
|
||||
GG(c, d, a, b, myBlock[15], 14'i8, 0xD8A1E681'i32)
|
||||
GG(b, c, d, a, myBlock[4], 20'i8, 0xE7D3FBC8'i32)
|
||||
GG(a, b, c, d, myBlock[9], 5'i8, 0x21E1CDE6'i32)
|
||||
GG(d, a, b, c, myBlock[14], 9'i8, 0xC33707D6'i32)
|
||||
GG(c, d, a, b, myBlock[3], 14'i8, 0xF4D50D87'i32)
|
||||
GG(b, c, d, a, myBlock[8], 20'i8, 0x455A14ED'i32)
|
||||
GG(a, b, c, d, myBlock[13], 5'i8, 0xA9E3E905'i32)
|
||||
GG(d, a, b, c, myBlock[2], 9'i8, 0xFCEFA3F8'i32)
|
||||
GG(c, d, a, b, myBlock[7], 14'i8, 0x676F02D9'i32)
|
||||
GG(b, c, d, a, myBlock[12], 20'i8, 0x8D2A4C8A'i32)
|
||||
HH(a, b, c, d, myBlock[5], 4'i8, 0xFFFA3942'i32)
|
||||
HH(d, a, b, c, myBlock[8], 11'i8, 0x8771F681'i32)
|
||||
HH(c, d, a, b, myBlock[11], 16'i8, 0x6D9D6122'i32)
|
||||
HH(b, c, d, a, myBlock[14], 23'i8, 0xFDE5380C'i32)
|
||||
HH(a, b, c, d, myBlock[1], 4'i8, 0xA4BEEA44'i32)
|
||||
HH(d, a, b, c, myBlock[4], 11'i8, 0x4BDECFA9'i32)
|
||||
HH(c, d, a, b, myBlock[7], 16'i8, 0xF6BB4B60'i32)
|
||||
HH(b, c, d, a, myBlock[10], 23'i8, 0xBEBFBC70'i32)
|
||||
HH(a, b, c, d, myBlock[13], 4'i8, 0x289B7EC6'i32)
|
||||
HH(d, a, b, c, myBlock[0], 11'i8, 0xEAA127FA'i32)
|
||||
HH(c, d, a, b, myBlock[3], 16'i8, 0xD4EF3085'i32)
|
||||
HH(b, c, d, a, myBlock[6], 23'i8, 0x04881D05'i32)
|
||||
HH(a, b, c, d, myBlock[9], 4'i8, 0xD9D4D039'i32)
|
||||
HH(d, a, b, c, myBlock[12], 11'i8, 0xE6DB99E5'i32)
|
||||
HH(c, d, a, b, myBlock[15], 16'i8, 0x1FA27CF8'i32)
|
||||
HH(b, c, d, a, myBlock[2], 23'i8, 0xC4AC5665'i32)
|
||||
II(a, b, c, d, myBlock[0], 6'i8, 0xF4292244'i32)
|
||||
II(d, a, b, c, myBlock[7], 10'i8, 0x432AFF97'i32)
|
||||
II(c, d, a, b, myBlock[14], 15'i8, 0xAB9423A7'i32)
|
||||
II(b, c, d, a, myBlock[5], 21'i8, 0xFC93A039'i32)
|
||||
II(a, b, c, d, myBlock[12], 6'i8, 0x655B59C3'i32)
|
||||
II(d, a, b, c, myBlock[3], 10'i8, 0x8F0CCC92'i32)
|
||||
II(c, d, a, b, myBlock[10], 15'i8, 0xFFEFF47D'i32)
|
||||
II(b, c, d, a, myBlock[1], 21'i8, 0x85845DD1'i32)
|
||||
II(a, b, c, d, myBlock[8], 6'i8, 0x6FA87E4F'i32)
|
||||
II(d, a, b, c, myBlock[15], 10'i8, 0xFE2CE6E0'i32)
|
||||
II(c, d, a, b, myBlock[6], 15'i8, 0xA3014314'i32)
|
||||
II(b, c, d, a, myBlock[13], 21'i8, 0x4E0811A1'i32)
|
||||
II(a, b, c, d, myBlock[4], 6'i8, 0xF7537E82'i32)
|
||||
II(d, a, b, c, myBlock[11], 10'i8, 0xBD3AF235'i32)
|
||||
II(c, d, a, b, myBlock[2], 15'i8, 0x2AD7D2BB'i32)
|
||||
II(b, c, d, a, myBlock[9], 21'i8, 0xEB86D391'i32)
|
||||
State[0] = State[0] +% a
|
||||
State[1] = State[1] +% b
|
||||
State[2] = State[2] +% c
|
||||
State[3] = State[3] +% d
|
||||
|
||||
proc MD5Init*(c: var MD5Context) =
|
||||
## initializes a MD5Context
|
||||
c.State[0] = 0x67452301'i32
|
||||
c.State[1] = 0xEFCDAB89'i32
|
||||
c.State[2] = 0x98BADCFE'i32
|
||||
c.State[3] = 0x10325476'i32
|
||||
c.Count[0] = 0'i32
|
||||
c.Count[1] = 0'i32
|
||||
ZeroMem(addr(c.Buffer), SizeOf(MD5Buffer))
|
||||
|
||||
proc MD5Update*(c: var MD5Context, input: cstring, len: int) =
|
||||
## updates the MD5Context with the `input` data of length `len`
|
||||
var input = input
|
||||
var Index = (c.Count[0] shr 3) and 0x3F
|
||||
c.Count[0] = c.count[0] +% toU32(len shl 3)
|
||||
if c.Count[0] < (len shl 3): c.Count[1] = c.count[1] +% 1'i32
|
||||
c.Count[1] = c.count[1] +% toU32(len shr 29)
|
||||
var PartLen = 64 - Index
|
||||
if len >= PartLen:
|
||||
CopyMem(addr(c.Buffer[Index]), Input, PartLen)
|
||||
transform(addr(c.Buffer), c.State)
|
||||
var i = PartLen
|
||||
while i + 63 < len:
|
||||
Transform(addr(Input[I]), c.State)
|
||||
inc(i, 64)
|
||||
CopyMem(addr(c.Buffer[0]), addr(Input[i]), len-i)
|
||||
else:
|
||||
CopyMem(addr(c.Buffer[Index]), addr(Input[0]), len)
|
||||
|
||||
proc MD5Final*(c: var MD5Context, digest: var MD5Digest) =
|
||||
## finishes the MD5Context and stores the result in `digest`
|
||||
var
|
||||
Bits: MD5CBits
|
||||
PadLen: int
|
||||
decode(bits, c.Count)
|
||||
var Index = (c.Count[0] shr 3) and 0x3F
|
||||
if Index < 56: PadLen = 56 - Index
|
||||
else: PadLen = 120 - Index
|
||||
MD5Update(c, padding, PadLen)
|
||||
MD5Update(c, cast[cstring](addr(Bits)), 8)
|
||||
decode(digest, c.State)
|
||||
ZeroMem(addr(c), SizeOf(MD5Context))
|
||||
|
||||
proc toMD5*(s: string): MD5Digest =
|
||||
## computes the MD5Digest value for a string `s`
|
||||
var c: MD5Context
|
||||
MD5Init(c)
|
||||
MD5Update(c, cstring(s), len(s))
|
||||
MD5Final(c, result)
|
||||
|
||||
proc `$`*(D: MD5Digest): string =
|
||||
## converts a MD5Digest value into its string representation
|
||||
const digits = "0123456789abcdef"
|
||||
result = ""
|
||||
for i in 0..15:
|
||||
add(result, Digits[(D[I] shr 4) and 0xF])
|
||||
add(result, Digits[D[I] and 0xF])
|
||||
|
||||
proc getMD5*(s: string): string =
|
||||
## computes an MD5 value of `s` and returns its string representation
|
||||
var
|
||||
c: MD5Context
|
||||
d: MD5Digest
|
||||
MD5Init(c)
|
||||
MD5Update(c, cstring(s), len(s))
|
||||
MD5Final(c, d)
|
||||
result = $d
|
||||
|
||||
proc `==`*(D1, D2: MD5Digest): bool =
|
||||
## checks if two MD5Digest values are identical
|
||||
for i in 0..15:
|
||||
if D1[i] != D2[i]: return false
|
||||
return true
|
||||
|
||||
when isMainModule:
|
||||
assert(getMD5("Franz jagt im komplett verwahrlosten Taxi quer durch Bayern") ==
|
||||
"a3cca2b2aa1e3b5b3b5aad99a8529074")
|
||||
assert(getMD5("Frank jagt im komplett verwahrlosten Taxi quer durch Bayern") ==
|
||||
"7e716d0e702df0505fc72e2b89467910")
|
||||
assert($toMD5("") == "d41d8cd98f00b204e9800998ecf8427e")
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -198,6 +198,7 @@ proc getString(c: var TCfgParser, tok: var TToken, rawMode: bool) =
|
||||
inc(pos, 2) # skip ""
|
||||
# skip leading newline:
|
||||
pos = HandleCRLF(c, pos)
|
||||
buf = c.buf
|
||||
while true:
|
||||
case buf[pos]
|
||||
of '\"':
|
||||
@@ -206,6 +207,7 @@ proc getString(c: var TCfgParser, tok: var TToken, rawMode: bool) =
|
||||
Inc(pos)
|
||||
of '\c', '\L':
|
||||
pos = HandleCRLF(c, pos)
|
||||
buf = c.buf
|
||||
add(tok.literal, nl)
|
||||
of lexbase.EndOfFile:
|
||||
tok.kind = tkInvalid
|
||||
@@ -254,6 +256,7 @@ proc skip(c: var TCfgParser) =
|
||||
while not (buf[pos] in {'\c', '\L', lexbase.EndOfFile}): inc(pos)
|
||||
of '\c', '\L':
|
||||
pos = HandleCRLF(c, pos)
|
||||
buf = c.buf
|
||||
else:
|
||||
break # EndOfFile also leaves the loop
|
||||
c.bufpos = pos
|
||||
@@ -103,9 +103,11 @@ proc parseField(my: var TCsvParser, a: var string) =
|
||||
case c
|
||||
of '\c':
|
||||
pos = handleCR(my, pos)
|
||||
buf = my.buf
|
||||
add(a, "\n")
|
||||
of '\l':
|
||||
pos = handleLF(my, pos)
|
||||
buf = my.buf
|
||||
add(a, "\n")
|
||||
else:
|
||||
add(a, c)
|
||||
1333
lib/pure/parsesql.nim
Normal file
1333
lib/pure/parsesql.nim
Normal file
File diff suppressed because it is too large
Load Diff
@@ -215,9 +215,11 @@ proc parseCDATA(my: var TXMLParser) =
|
||||
break
|
||||
of '\c':
|
||||
pos = lexbase.HandleCR(my, pos)
|
||||
buf = my.buf
|
||||
add(my.a, '\L')
|
||||
of '\L':
|
||||
pos = lexbase.HandleLF(my, pos)
|
||||
buf = my.buf
|
||||
add(my.a, '\L')
|
||||
else:
|
||||
add(my.a, buf[pos])
|
||||
@@ -241,9 +243,11 @@ proc parseComment(my: var TXMLParser) =
|
||||
break
|
||||
of '\c':
|
||||
pos = lexbase.HandleCR(my, pos)
|
||||
buf = my.buf
|
||||
if my.options.contains(reportComments): add(my.a, '\L')
|
||||
of '\L':
|
||||
pos = lexbase.HandleLF(my, pos)
|
||||
buf = my.buf
|
||||
if my.options.contains(reportComments): add(my.a, '\L')
|
||||
else:
|
||||
if my.options.contains(reportComments): add(my.a, buf[pos])
|
||||
@@ -262,9 +266,11 @@ proc parseWhitespace(my: var TXmlParser, skip=False) =
|
||||
of '\c':
|
||||
# the specification says that CR-LF, CR are to be transformed to LF
|
||||
pos = lexbase.HandleCR(my, pos)
|
||||
buf = my.buf
|
||||
if not skip: add(my.a, '\L')
|
||||
of '\L':
|
||||
pos = lexbase.HandleLF(my, pos)
|
||||
buf = my.buf
|
||||
if not skip: add(my.a, '\L')
|
||||
else:
|
||||
break
|
||||
@@ -358,9 +364,11 @@ proc parsePI(my: var TXmlParser) =
|
||||
of '\c':
|
||||
# the specification says that CR-LF, CR are to be transformed to LF
|
||||
pos = lexbase.HandleCR(my, pos)
|
||||
buf = my.buf
|
||||
add(my.b, '\L')
|
||||
of '\L':
|
||||
pos = lexbase.HandleLF(my, pos)
|
||||
buf = my.buf
|
||||
add(my.b, '\L')
|
||||
else:
|
||||
add(my.b, buf[pos])
|
||||
@@ -391,9 +399,11 @@ proc parseSpecial(my: var TXmlParser) =
|
||||
add(my.a, '>')
|
||||
of '\c':
|
||||
pos = lexbase.HandleCR(my, pos)
|
||||
buf = my.buf
|
||||
add(my.a, '\L')
|
||||
of '\L':
|
||||
pos = lexbase.HandleLF(my, pos)
|
||||
buf = my.buf
|
||||
add(my.a, '\L')
|
||||
else:
|
||||
add(my.a, buf[pos])
|
||||
@@ -474,9 +484,11 @@ proc parseAttribute(my: var TXmlParser) =
|
||||
inc(pos)
|
||||
of '\c':
|
||||
pos = lexbase.HandleCR(my, pos)
|
||||
buf = my.buf
|
||||
pendingSpace = true
|
||||
of '\L':
|
||||
pos = lexbase.HandleLF(my, pos)
|
||||
buf = my.buf
|
||||
pendingSpace = true
|
||||
else:
|
||||
if buf[pos] == quote:
|
||||
@@ -502,9 +514,11 @@ proc parseCharData(my: var TXmlParser) =
|
||||
of '\c':
|
||||
# the specification says that CR-LF, CR are to be transformed to LF
|
||||
pos = lexbase.HandleCR(my, pos)
|
||||
buf = my.buf
|
||||
add(my.a, '\L')
|
||||
of '\L':
|
||||
pos = lexbase.HandleLF(my, pos)
|
||||
buf = my.buf
|
||||
add(my.a, '\L')
|
||||
else:
|
||||
add(my.a, buf[pos])
|
||||
@@ -393,6 +393,17 @@ proc endsWith(s, suffix: string): bool =
|
||||
if s[i+j] != suffix[i]: return false
|
||||
inc(i)
|
||||
|
||||
when false:
|
||||
proc abbrev(s: string, possibilities: openarray[string]): int =
|
||||
## returns the index of the first item in `possibilities` if not
|
||||
## ambigious; -1 if no item has been found; -2 if multiple items
|
||||
## match.
|
||||
result = -1 # none found
|
||||
for i in 0..possibilities.len-1:
|
||||
if possibilities[i].startsWith(s):
|
||||
if result >= 0: return -2 # ambigious
|
||||
result = i
|
||||
|
||||
proc repeatChar(count: int, c: Char = ' '): string =
|
||||
result = newString(count)
|
||||
for i in 0..count-1:
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
#
|
||||
# Nimrod's Runtime Library
|
||||
# (c) Copyright 2008 Andreas Rumpf
|
||||
# (c) Copyright 2009 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
# distribution, for details about the copyright.
|
||||
@@ -22,10 +22,19 @@ type
|
||||
mJan, mFeb, mMar, mApr, mMay, mJun, mJul, mAug, mSep, mOct, mNov, mDec
|
||||
TWeekDay* = enum ## represents a weekday
|
||||
dMon, dTue, dWed, dThu, dFri, dSat, dSun
|
||||
|
||||
TTime* {.importc: "time_t", header: "<time.h>", final.} = object ## abstract type that
|
||||
## represents a time
|
||||
when defined(ECMAScript):
|
||||
|
||||
when defined(posix):
|
||||
type
|
||||
TTime* = abstract int ## abstract type that represents a time
|
||||
elif defined(windows):
|
||||
when defined(vcc):
|
||||
# newest version of Visual C++ defines time_t to be of 64 bits
|
||||
type TTime* = abstract int64
|
||||
else:
|
||||
type TTime* = abstract int32
|
||||
elif defined(ECMAScript):
|
||||
type
|
||||
TTime* {.final.} = object
|
||||
getDay: proc (): int
|
||||
getFullYear: proc (): int
|
||||
getHours: proc (): int
|
||||
@@ -64,7 +73,7 @@ type
|
||||
toLocaleString: proc (): cstring
|
||||
UTC: proc (): int
|
||||
|
||||
|
||||
type
|
||||
TTimeInfo* = object of TObject ## represents a time in different parts
|
||||
second*: range[0..61] ## The number of seconds after the minute,
|
||||
## normally in the range 0 to 59, but can
|
||||
@@ -121,8 +130,7 @@ proc getStartMilsecs*(): int
|
||||
## get the miliseconds from the start of the program
|
||||
|
||||
|
||||
when not defined(ECMAScript):
|
||||
|
||||
when not defined(ECMAScript):
|
||||
# C wrapper:
|
||||
type
|
||||
structTM {.importc: "struct tm", final.} = object
|
||||
@@ -225,6 +233,18 @@ when not defined(ECMAScript):
|
||||
var a = time
|
||||
return toStringTillNL(ctime(addr(a)))
|
||||
|
||||
const
|
||||
epochDiff = 116444736000000000'i64
|
||||
rateDiff = 10000000'i64 # 100 nsecs
|
||||
|
||||
proc unixTimeToWinTime*(t: TTime): int64 =
|
||||
## converts a UNIX `TTime` (``time_t``) to a Windows file time
|
||||
result = int64(t) * rateDiff + epochDiff
|
||||
|
||||
proc winTimeToUnixTime*(t: int64): TTime =
|
||||
## converts a Windows time to a UNIX `TTime` (``time_t``)
|
||||
result = TTime((t - epochDiff) div rateDiff)
|
||||
|
||||
else:
|
||||
proc getTime(): TTime {.importc: "new Date", nodecl.}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
#
|
||||
# Nimrod's Runtime Library
|
||||
# (c) Copyright 2008 Andreas Rumpf
|
||||
# (c) Copyright 2009 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
# distribution, for details about the copyright.
|
||||
@@ -38,7 +38,7 @@ type
|
||||
string* {.magic: String.} ## built-in string type
|
||||
cstring* {.magic: Cstring.} ## built-in cstring (*compatible string*) type
|
||||
pointer* {.magic: Pointer.} ## built-in pointer type
|
||||
TAnyEnum {.magic: AnyEnum.}
|
||||
Ordinal* {.magic: Ordinal.}[T]
|
||||
|
||||
type
|
||||
`nil` {.magic: "Nil".}
|
||||
@@ -115,7 +115,7 @@ when not defined(EcmaScript) and not defined(NimrodVM):
|
||||
data: array[0..100_000_000, char]
|
||||
NimString = ptr NimStringDesc
|
||||
|
||||
include hti
|
||||
include "system/hti"
|
||||
|
||||
type
|
||||
Byte* = Int8 ## this is an alias for ``int8``, that is a signed
|
||||
@@ -157,6 +157,8 @@ type
|
||||
## system raises.
|
||||
EIO* = object of ESystem ## raised if an IO error occured.
|
||||
EOS* = object of ESystem ## raised if an operating system service failed.
|
||||
EInvalidLibrary* = object of EOS ## raised if a dynamic library
|
||||
## could not be loaded.
|
||||
ERessourceExhausted* = object of ESystem ## raised if a ressource request
|
||||
## could not be fullfilled.
|
||||
EArithmetic* = object of ESynch ## raised if any kind of arithmetic
|
||||
@@ -218,26 +220,26 @@ proc sizeof*[T](x: T): natural {.magic: "SizeOf", noSideEffect.}
|
||||
## that one never needs to know ``x``'s size. As a special semantic rule,
|
||||
## ``x`` may also be a type identifier (``sizeof(int)`` is valid).
|
||||
|
||||
proc succ*[T](x: T, y = 1): T {.magic: "Succ", noSideEffect.}
|
||||
proc succ*[T](x: ordinal[T], y = 1): T {.magic: "Succ", noSideEffect.}
|
||||
## returns the ``y``-th successor of the value ``x``. ``T`` has to be
|
||||
## an ordinal type. If such a value does not exist, ``EOutOfRange`` is raised
|
||||
## or a compile time error occurs.
|
||||
|
||||
proc pred*[T](x: T, y = 1): T {.magic: "Pred", noSideEffect.}
|
||||
proc pred*[T](x: ordinal[T], y = 1): T {.magic: "Pred", noSideEffect.}
|
||||
## returns the ``y``-th predecessor of the value ``x``. ``T`` has to be
|
||||
## an ordinal type. If such a value does not exist, ``EOutOfRange`` is raised
|
||||
## or a compile time error occurs.
|
||||
|
||||
proc inc*[T](x: var T, y = 1) {.magic: "Inc".}
|
||||
proc inc*[T](x: var ordinal[T], y = 1) {.magic: "Inc".}
|
||||
## increments the ordinal ``x`` by ``y``. If such a value does not
|
||||
## exist, ``EOutOfRange`` is raised or a compile time error occurs. This is a
|
||||
## short notation for: ``x = succ(x, y)``.
|
||||
|
||||
proc dec*[T](x: var T, y = 1) {.magic: "Dec".}
|
||||
proc dec*[T](x: var ordinal[T], y = 1) {.magic: "Dec".}
|
||||
## decrements the ordinal ``x`` by ``y``. If such a value does not
|
||||
## exist, ``EOutOfRange`` is raised or a compile time error occurs. This is a
|
||||
## short notation for: ``x = pred(x, y)``.
|
||||
|
||||
|
||||
proc newSeq*[T](s: var seq[T], len: int) {.magic: "NewSeq".}
|
||||
## creates a new sequence of type ``seq[T]`` with length ``len``.
|
||||
## This is equivalent to ``s = []; setlen(s, len)``, but more
|
||||
@@ -546,7 +548,7 @@ proc `-+-` *[T](x, y: set[T]): set[T] {.magic: "SymDiffSet", noSideEffect.}
|
||||
## ``(A - B) + (B - A)``, but more efficient.
|
||||
|
||||
# comparison operators:
|
||||
proc `==` *(x, y: TAnyEnum): bool {.magic: "EqEnum", noSideEffect.}
|
||||
proc `==` *[T](x, y: ordinal[T]): bool {.magic: "EqEnum", noSideEffect.}
|
||||
proc `==` *(x, y: pointer): bool {.magic: "EqRef", noSideEffect.}
|
||||
proc `==` *(x, y: string): bool {.magic: "EqStr", noSideEffect.}
|
||||
proc `==` *(x, y: cstring): bool {.magic: "EqCString", noSideEffect.}
|
||||
@@ -556,7 +558,7 @@ proc `==` *[T](x, y: set[T]): bool {.magic: "EqSet", noSideEffect.}
|
||||
proc `==` *[T](x, y: ref T): bool {.magic: "EqRef", noSideEffect.}
|
||||
proc `==` *[T](x, y: ptr T): bool {.magic: "EqRef", noSideEffect.}
|
||||
|
||||
proc `<=` *(x, y: TAnyEnum): bool {.magic: "LeEnum", noSideEffect.}
|
||||
proc `<=` *[T](x, y: ordinal[T]): bool {.magic: "LeEnum", noSideEffect.}
|
||||
proc `<=` *(x, y: string): bool {.magic: "LeStr", noSideEffect.}
|
||||
proc `<=` *(x, y: char): bool {.magic: "LeCh", noSideEffect.}
|
||||
proc `<=` *[T](x, y: set[T]): bool {.magic: "LeSet", noSideEffect.}
|
||||
@@ -564,7 +566,7 @@ proc `<=` *(x, y: bool): bool {.magic: "LeB", noSideEffect.}
|
||||
proc `<=` *[T](x, y: ref T): bool {.magic: "LePtr", noSideEffect.}
|
||||
proc `<=` *(x, y: pointer): bool {.magic: "LePtr", noSideEffect.}
|
||||
|
||||
proc `<` *(x, y: TAnyEnum): bool {.magic: "LtEnum", noSideEffect.}
|
||||
proc `<` *[T](x, y: ordinal[T]): bool {.magic: "LtEnum", noSideEffect.}
|
||||
proc `<` *(x, y: string): bool {.magic: "LtStr", noSideEffect.}
|
||||
proc `<` *(x, y: char): bool {.magic: "LtCh", noSideEffect.}
|
||||
proc `<` *[T](x, y: set[T]): bool {.magic: "LtSet", noSideEffect.}
|
||||
@@ -925,7 +927,7 @@ proc `$` *(x: string): string {.magic: "StrToStr", noSideEffect.}
|
||||
## as it is. This operator is useful for generic code, so
|
||||
## that ``$expr`` also works if ``expr`` is already a string.
|
||||
|
||||
proc `$` *(x: TAnyEnum): string {.magic: "EnumToStr", noSideEffect.}
|
||||
proc `$` *[T](x: ordinal[T]): string {.magic: "EnumToStr", noSideEffect.}
|
||||
## The stingify operator for an enumeration argument. This works for
|
||||
## any enumeration type thanks to compiler magic. If a
|
||||
## a ``$`` operator for a concrete enumeration is provided, this is
|
||||
@@ -1182,15 +1184,10 @@ proc GC_unref*(x: string) {.magic: "GCunref".}
|
||||
# however, stack-traces are available for most parts
|
||||
# of the code
|
||||
|
||||
proc echo*[Ty](x: Ty) {.inline.}
|
||||
proc echo*[Ty](x: openarray[Ty]) {.magic: "Echo".}
|
||||
## equivalent to ``writeln(stdout, x); flush(stdout)``. BUT: This is
|
||||
## available for the ECMAScript target too!
|
||||
|
||||
proc echo*[Ty](x: openarray[Ty]) {.inline.}
|
||||
## equivalent to ``writeln(stdout, x); flush(stdout)``. BUT: This is
|
||||
## available for the ECMAScript target too!
|
||||
|
||||
|
||||
template newException(exceptn, message: expr): expr =
|
||||
block: # open a new scope
|
||||
var
|
||||
@@ -1235,7 +1232,7 @@ when not defined(EcmaScript) and not defined(NimrodVM):
|
||||
|
||||
{.push stack_trace: off.}
|
||||
|
||||
include ansi_c
|
||||
include "system/ansi_c"
|
||||
|
||||
proc cmp(x, y: string): int =
|
||||
return int(c_strcmp(x, y))
|
||||
@@ -1390,7 +1387,7 @@ when not defined(EcmaScript) and not defined(NimrodVM):
|
||||
## retrieves the current position of the file pointer that is used to
|
||||
## read from the file `f`. The file's first byte has the index zero.
|
||||
|
||||
include sysio
|
||||
include "system/sysio"
|
||||
|
||||
iterator lines*(filename: string): string =
|
||||
## Iterate over any line in the file named `filename`.
|
||||
@@ -1416,12 +1413,12 @@ when not defined(EcmaScript) and not defined(NimrodVM):
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
include excpt
|
||||
include "system/excpt"
|
||||
# we cannot compile this with stack tracing on
|
||||
# as it would recurse endlessly!
|
||||
include arithm
|
||||
include "system/arithm"
|
||||
{.pop.} # stack trace
|
||||
include dyncalls
|
||||
include "system/dyncalls"
|
||||
|
||||
const
|
||||
GenericSeqSize = (2 * sizeof(int))
|
||||
@@ -1448,10 +1445,10 @@ when not defined(EcmaScript) and not defined(NimrodVM):
|
||||
else:
|
||||
result = n.sons[n.len]
|
||||
|
||||
include mm
|
||||
include sysstr
|
||||
include assign
|
||||
include repr
|
||||
include "system/mm"
|
||||
include "system/sysstr"
|
||||
include "system/assign"
|
||||
include "system/repr"
|
||||
|
||||
# we have to implement it here after gentostr for the cstrToNimStrDummy proc
|
||||
proc getCurrentExceptionMsg(): string =
|
||||
@@ -1460,14 +1457,14 @@ when not defined(EcmaScript) and not defined(NimrodVM):
|
||||
|
||||
{.push stack_trace: off.}
|
||||
when defined(endb):
|
||||
include debugger
|
||||
include "system/debugger"
|
||||
|
||||
when defined(profiler):
|
||||
include profiler
|
||||
include "system/profiler"
|
||||
{.pop.} # stacktrace
|
||||
|
||||
elif defined(ecmaScript):
|
||||
include ecmasys
|
||||
include "system/ecmasys"
|
||||
elif defined(NimrodVM):
|
||||
# Stubs for the GC interface:
|
||||
proc GC_disable() = nil
|
||||
@@ -1481,8 +1478,6 @@ elif defined(NimrodVM):
|
||||
proc getOccupiedMem(): int = return -1
|
||||
proc getFreeMem(): int = return -1
|
||||
proc getTotalMem(): int = return -1
|
||||
proc echo[Ty](x: Ty) = nil
|
||||
proc echo[Ty](x: openarray[Ty]) = nil
|
||||
|
||||
proc cmp(x, y: string): int =
|
||||
if x == y: return 0
|
||||
|
||||
@@ -11,10 +11,12 @@
|
||||
# and definitions of Ansi C types in Nimrod syntax
|
||||
# All symbols are prefixed with 'c_' to avoid ambiguities
|
||||
|
||||
{.push hints:off}
|
||||
|
||||
proc c_strcmp(a, b: CString): cint {.nodecl, importc: "strcmp".}
|
||||
proc c_memcmp(a, b: CString, size: cint): cint {.nodecl, importc: "memcmp".}
|
||||
proc c_memcpy(a, b: CString, size: cint) {.nodecl, importc: "memcpy".}
|
||||
proc c_strlen(a: CString): cint {.nodecl, importc: "strlen".}
|
||||
proc c_strlen(a: CString): int {.nodecl, importc: "strlen".}
|
||||
proc c_memset(p: pointer, value: cint, size: int) {.nodecl, importc: "memset".}
|
||||
|
||||
type
|
||||
@@ -87,3 +89,16 @@ proc c_feof(stream: C_TextFileStar): bool {.importc: "feof", nodecl.}
|
||||
proc c_malloc(size: int): pointer {.importc: "malloc", nodecl.}
|
||||
proc c_free(p: pointer) {.importc: "free", nodecl.}
|
||||
proc c_realloc(p: pointer, newsize: int): pointer {.importc: "realloc", nodecl.}
|
||||
|
||||
var errno {.importc, header: "<errno.h>".}: cint ## error variable
|
||||
proc strerror(errnum: cint): cstring {.importc, header: "<string.h>".}
|
||||
|
||||
proc c_remove(filename: CString): cint {.importc: "remove", noDecl.}
|
||||
proc c_rename(oldname, newname: CString): cint {.importc: "rename", noDecl.}
|
||||
|
||||
proc c_system(cmd: CString): cint {.importc: "system", header: "<stdlib.h>".}
|
||||
proc c_getenv(env: CString): CString {.importc: "getenv", noDecl.}
|
||||
proc c_putenv(env: CString): cint {.importc: "putenv", noDecl.}
|
||||
|
||||
{.pop}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
#
|
||||
# Nimrod's Runtime Library
|
||||
# (c) Copyright 2006 Andreas Rumpf
|
||||
# (c) Copyright 2009 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
# distribution, for details about the copyright.
|
||||
@@ -12,9 +12,6 @@
|
||||
# However, the interface has been designed to take platform differences into
|
||||
# account and been ported to all major platforms.
|
||||
|
||||
type
|
||||
EInvalidLibrary = object of EOS
|
||||
|
||||
type
|
||||
TLibHandle = pointer # private type
|
||||
TProcAddr = pointer # libary loading and loading of procs:
|
||||
@@ -26,6 +23,9 @@ proc nimLoadLibrary(path: string): TLibHandle {.compilerproc.}
|
||||
proc nimUnloadLibrary(lib: TLibHandle) {.compilerproc.}
|
||||
proc nimGetProcAddr(lib: TLibHandle, name: cstring): TProcAddr {.compilerproc.}
|
||||
|
||||
proc nimLoadLibraryError(path: string) {.compilerproc, noinline.} =
|
||||
raise newException(EInvalidLibrary, "could not load: " & path)
|
||||
|
||||
# this code was inspired from Lua's source code:
|
||||
# Lua - An Extensible Extension Language
|
||||
# Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
|
||||
@@ -57,11 +57,6 @@ when defined(posix):
|
||||
|
||||
proc nimLoadLibrary(path: string): TLibHandle =
|
||||
result = dlopen(path, RTLD_NOW)
|
||||
if result == nil:
|
||||
writeToStdErr("could not load: ")
|
||||
writeToStdErr(path)
|
||||
writeToStdErr("\n")
|
||||
#raise newException(EInvalidLibrary, "could not load: " & path)
|
||||
|
||||
proc nimGetProcAddr(lib: TLibHandle, name: cstring): TProcAddr =
|
||||
result = dlsym(lib, name)
|
||||
@@ -86,11 +81,6 @@ elif defined(windows) or defined(dos):
|
||||
|
||||
proc nimLoadLibrary(path: string): TLibHandle =
|
||||
result = cast[TLibHandle](winLoadLibrary(path))
|
||||
if result == nil:
|
||||
writeToStdErr("could not load: ")
|
||||
writeToStdErr(path)
|
||||
writeToStdErr("\n")
|
||||
#raise newException(EInvalidLibrary, "could not load: " & path)
|
||||
|
||||
proc nimGetProcAddr(lib: TLibHandle, name: cstring): TProcAddr =
|
||||
result = GetProcAddress(cast[THINSTANCE](lib), name)
|
||||
@@ -123,11 +113,6 @@ elif defined(mac):
|
||||
NSLINKMODULE_OPTION_RETURN_ON_ERROR)
|
||||
NSDestroyObjectFileImage(img)
|
||||
result = TLibHandle(modul)
|
||||
if result == nil:
|
||||
writeToStdErr("could not load: ")
|
||||
writeToStdErr(path)
|
||||
writeToStdErr("\n")
|
||||
#raise newException(EInvalidLibrary, "could not load: " & path)
|
||||
|
||||
proc nimGetProcAddr(lib: TLibHandle, cname: string): TProcAddr =
|
||||
var
|
||||
@@ -418,7 +418,7 @@ proc internalAssert(file: cstring, line: int) {.pure, compilerproc.} =
|
||||
include hti
|
||||
|
||||
proc isFatPointer(ti: PNimType): bool =
|
||||
# This has to be consistens with the code generator!
|
||||
# This has to be consistent with the code generator!
|
||||
return ti.base.kind notin {tyRecord, tyRecordConstr, tyObject,
|
||||
tyArray, tyArrayConstr, tyPureObject, tyTuple,
|
||||
tyEmptySet, tyOpenArray, tySet, tyVar, tyRef, tyPtr}
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
#
|
||||
# Nimrod's Runtime Library
|
||||
# (c) Copyright 2008 Andreas Rumpf
|
||||
# (c) Copyright 2009 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
# distribution, for details about the copyright.
|
||||
@@ -19,26 +19,27 @@ type # This should be he same as ast.TTypeKind
|
||||
tyGeneric, # 6
|
||||
tyGenericInst, # 7
|
||||
tyGenericParam, # 8
|
||||
tyEnum, # 9
|
||||
tyAnyEnum, # 10
|
||||
tyArray, # 11
|
||||
tyObject, # 12
|
||||
tyTuple, # 13
|
||||
tySet, # 14
|
||||
tyRange, # 15
|
||||
tyPtr, # 16
|
||||
tyRef, # 17
|
||||
tyVar, # 18
|
||||
tySequence, # 19
|
||||
tyProc, # 20
|
||||
tyPointer, # 21
|
||||
tyOpenArray, # 22
|
||||
tyString, # 23
|
||||
tyCString, # 24
|
||||
tyForward, # 25
|
||||
tyAbstract, # 9
|
||||
tyEnum, # 10
|
||||
tyOrdinal, # 11
|
||||
tyArray, # 12
|
||||
tyObject, # 13
|
||||
tyTuple, # 14
|
||||
tySet, # 15
|
||||
tyRange, # 16
|
||||
tyPtr, # 17
|
||||
tyRef, # 18
|
||||
tyVar, # 19
|
||||
tySequence, # 20
|
||||
tyProc, # 21
|
||||
tyPointer, # 22
|
||||
tyOpenArray, # 23
|
||||
tyString, # 24
|
||||
tyCString, # 25
|
||||
tyForward, # 26
|
||||
tyInt, tyInt8, tyInt16, tyInt32, tyInt64,
|
||||
tyFloat, tyFloat32, tyFloat64, tyFloat128,
|
||||
tyPureObject # 35: signals that object has no `n_type` field
|
||||
tyPureObject # 36: signals that object has no `n_type` field
|
||||
|
||||
TNimNodeKind = enum nkNone, nkSlot, nkList, nkCase
|
||||
TNimNode {.compilerproc, final.} = object
|
||||
@@ -128,7 +128,7 @@ when defined(boehmgc):
|
||||
proc asgnRefNoCycle(dest: ppointer, src: pointer) {.compilerproc, inline.} =
|
||||
dest^ = src
|
||||
|
||||
include cellsets
|
||||
include "system/cellsets"
|
||||
elif defined(nogc):
|
||||
proc alloc(size: int): pointer =
|
||||
result = c_malloc(size)
|
||||
@@ -176,12 +176,12 @@ elif defined(nogc):
|
||||
proc asgnRefNoCycle(dest: ppointer, src: pointer) {.compilerproc, inline.} =
|
||||
dest^ = src
|
||||
|
||||
include cellsets
|
||||
include "system/cellsets"
|
||||
else:
|
||||
include alloc
|
||||
include cellsets
|
||||
include "system/alloc"
|
||||
include "system/cellsets"
|
||||
assert(sizeof(TCell) == sizeof(TFreeCell))
|
||||
include gc
|
||||
include "system/gc"
|
||||
|
||||
{.pop.}
|
||||
|
||||
@@ -20,7 +20,7 @@ proc countBits(n: int32): int {.exportc: "countBits".}
|
||||
# in math.nim too. So when linking with math.nim it'd give a duplicated
|
||||
# symbol error which we avoid by renaming here.
|
||||
|
||||
include cntbits
|
||||
include "system/cntbits"
|
||||
|
||||
proc unionSets(res: var TNimSet, a, b: TNimSet, len: int) {.
|
||||
compilerproc, inline.} =
|
||||
@@ -99,10 +99,8 @@ proc writeln[Ty](f: TFile, x: openArray[Ty]) =
|
||||
for i in items(x): write(f, i)
|
||||
write(f, "\n")
|
||||
|
||||
proc echo[Ty](x: Ty) = writeln(stdout, x)
|
||||
proc echo[Ty](x: openArray[Ty]) =
|
||||
for i in items(x): write(stdout, i)
|
||||
write(stdout, "\n")
|
||||
proc rawEcho(x: string) {.inline, compilerproc.} = write(stdout, x)
|
||||
proc rawEchoNL() {.inline, compilerproc.} = write(stdout, "\n")
|
||||
|
||||
# interface to the C procs:
|
||||
proc fopen(filename, mode: CString): pointer {.importc: "fopen", noDecl.}
|
||||
12
lib/target.h
12
lib/target.h
@@ -1,12 +0,0 @@
|
||||
#ifndef _TARGET_H_
|
||||
#define _TARGET_H_
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#define TLSF_MLOCK_T pthread_mutex_t
|
||||
#define TLSF_CREATE_LOCK(l) pthread_mutex_init (l, NULL)
|
||||
#define TLSF_DESTROY_LOCK(l) pthread_mutex_destroy(l)
|
||||
#define TLSF_ACQUIRE_LOCK(l) pthread_mutex_lock(l)
|
||||
#define TLSF_RELEASE_LOCK(l) pthread_mutex_unlock(l)
|
||||
|
||||
#endif
|
||||
1005
lib/tlsf.c
1005
lib/tlsf.c
File diff suppressed because it is too large
Load Diff
39
lib/tlsf.h
39
lib/tlsf.h
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Two Levels Segregate Fit memory allocator (TLSF)
|
||||
* Version 2.4.3
|
||||
*
|
||||
* Written by Miguel Masmano Tello <mimastel@doctor.upv.es>
|
||||
*
|
||||
* Thanks to Ismael Ripoll for his suggestions and reviews
|
||||
*
|
||||
* Copyright (C) 2008, 2007, 2006, 2005, 2004
|
||||
*
|
||||
* This code is released using a dual license strategy: GPL/LGPL
|
||||
* You can choose the licence that better fits your requirements.
|
||||
*
|
||||
* Released under the terms of the GNU General Public License Version 2.0
|
||||
* Released under the terms of the GNU Lesser General Public License Version 2.1
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _TLSF_H_
|
||||
#define _TLSF_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
extern size_t init_memory_pool(size_t, void *);
|
||||
extern size_t get_used_size(void *);
|
||||
extern size_t get_max_size(void *);
|
||||
extern void destroy_memory_pool(void *);
|
||||
extern size_t add_new_area(void *, size_t, void *);
|
||||
extern void *malloc_ex(size_t, void *);
|
||||
extern void free_ex(void *, void *);
|
||||
extern void *realloc_ex(void *, size_t, void *);
|
||||
extern void *calloc_ex(size_t, size_t, void *);
|
||||
|
||||
extern void *tlsf_malloc(size_t size);
|
||||
extern void tlsf_free(void *ptr);
|
||||
extern void *tlsf_realloc(void *ptr, size_t size);
|
||||
extern void *tlsf_calloc(size_t nelem, size_t elem_size);
|
||||
|
||||
#endif
|
||||
698
lib/tlsfnim.nim
698
lib/tlsfnim.nim
@@ -1,698 +0,0 @@
|
||||
#
|
||||
#
|
||||
# Nimrod's Runtime Library
|
||||
# (c) Copyright 2008 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
# distribution, for details about the copyright.
|
||||
#
|
||||
|
||||
|
||||
# Memory manager. Based on:
|
||||
# Two Levels Segregate Fit memory allocator (TLSF)
|
||||
# Version 2.4.2
|
||||
#
|
||||
# Written by Miguel Masmano Tello <mimastel@doctor.upv.es>
|
||||
#
|
||||
# Thanks to Ismael Ripoll for his suggestions and reviews
|
||||
#
|
||||
# Copyright (C) 2008, 2007, 2006, 2005, 2004
|
||||
#
|
||||
# This code is released using a dual license strategy: GPL/LGPL
|
||||
# You can choose the licence that better fits your requirements.
|
||||
#
|
||||
# Released under the terms of the GNU General Public License Version 2.0
|
||||
# Released under the terms of the GNU Lesser General Public License Version 2.1
|
||||
|
||||
|
||||
# Some IMPORTANT TLSF parameters
|
||||
const
|
||||
blockAlign = sizeof(pointer) * 2
|
||||
maxFli = 30
|
||||
maxLog2Sli = 5
|
||||
maxSli = 1 shl maxLog2Sli
|
||||
|
||||
fliOffset = 6 # tlsf structure just will manage blocks bigger than 128 bytes
|
||||
smallBlock = 128
|
||||
realFli = MaxFli - fliOffset
|
||||
|
||||
type
|
||||
TFreePtr {.final.} = object
|
||||
prev, next: PBhdr
|
||||
Pbhdr = ptr Tbhdr
|
||||
Tbhdr {.final.} = object
|
||||
prevHdr: Pbhdr # this is just valid if the first bit of size is set
|
||||
size: int # the size is stored in bytes
|
||||
# bit 0 indicates whether the block is used and
|
||||
# bit 1 allows to know whether the previous block is free
|
||||
freePtr: TFreePtr # at this offset bhdr.buffer starts (was a union in the
|
||||
# C version)
|
||||
TAreaInfo {.final.} = object # This structure is embedded at the beginning
|
||||
# of each area, giving us enough information
|
||||
# to cope with a set of areas
|
||||
theEnd: Pbhdr
|
||||
next: PAreaInfo
|
||||
PAreaInfo = ptr TAreaInfo
|
||||
|
||||
TLSF {.final.} = object
|
||||
tlsf_signature: int32 # the TLSF's structure signature
|
||||
usedSize, maxSize: int
|
||||
areaHead: PAreaInfo # A linked list holding all the existing areas
|
||||
|
||||
flBitmap: int32 # the first-level bitmap
|
||||
# This array should have a size of REAL_FLI bits
|
||||
slBitmap: array[0..realFli, int32] # the second-level bitmap
|
||||
matrix: array [0..realFli, array[0..maxSli, PBhdr]]
|
||||
|
||||
const
|
||||
minBlockSize = sizeof(TFreePtr)
|
||||
bhdrOverhead = sizeof(Tbhdr) - minBlockSize
|
||||
tlsfSignature = 0x2A59FA59
|
||||
ptrMask = sizeof(pointer) - 1
|
||||
blockSize = 0xFFFFFFFF - ptrMask
|
||||
memAlign = blockAlign - 1
|
||||
blockState = 0x1
|
||||
prevState = 0x2
|
||||
|
||||
freeBlock = 0x1 # bit 0 of the block size
|
||||
usedBlock = 0x0
|
||||
|
||||
prevFree = 0x2 # bit 1 of the block size
|
||||
prevUsed = 0x0
|
||||
|
||||
defaultAreaSize = 64*1024 # 1024*10
|
||||
pageSize = if defined(cpu32): 4096 else: 4096*2
|
||||
|
||||
|
||||
proc getNextBlock(adr: pointer, r: int): PBhdr {.inline.} =
|
||||
return cast[PBhdr](cast[TAddress](adr) +% r)
|
||||
|
||||
proc roundupSize(r: int): int = return (r +% memAlign) and not memAlign
|
||||
proc rounddownSize(r: int): int = return r and not memAlign
|
||||
proc roundup(x, v: int): int = return (((not x)+%1) and (v-%1)) +% x
|
||||
|
||||
proc addSize(s: PTLSF, b: Pbhdr) =
|
||||
inc(s.usedSize, (b.size and blockSize) + bhdrOverhead)
|
||||
s.maxSize = max(s.maxSize, s.usedSize)
|
||||
|
||||
proc removeSize(s: PTLSF, b: Pbhdr) =
|
||||
dec(s.usedSize, (b.size and blockSize) + bhdrOverhead)
|
||||
|
||||
# ------------ platform specific code -----------------------------------------
|
||||
|
||||
when defined(posix):
|
||||
const # XXX: make these variables for portability?
|
||||
PROT_READ = 1 # page can be read
|
||||
PROT_WRITE = 2 # page can be written
|
||||
PROT_EXEC = 4 # page can be executed
|
||||
PROT_NONE = 0 # page can not be accessed
|
||||
|
||||
MAP_SHARED = 1 # Share changes
|
||||
MAP_PRIVATE = 2 # Changes are private
|
||||
MAP_TYPE = 0xf # Mask for type of mapping
|
||||
MAP_FIXED = 0x10 # Interpret addr exactly
|
||||
MAP_ANONYMOUS = 0x20 # don't use a file
|
||||
|
||||
MAP_GROWSDOWN = 0x100 # stack-like segment
|
||||
MAP_DENYWRITE = 0x800 # ETXTBSY
|
||||
MAP_EXECUTABLE = 0x1000 # mark it as an executable
|
||||
MAP_LOCKED = 0x2000 # pages are locked
|
||||
MAP_NORESERVE = 0x4000 # don't check for reservations
|
||||
|
||||
proc mmap(adr: pointer, len: int, prot, flags, fildes: cint,
|
||||
off: int): pointer {.header: "<sys/mman.h>".}
|
||||
|
||||
proc getNewArea(size: var int): pointer {.inline.} =
|
||||
size = roundup(size, PageSize)
|
||||
result = mmap(0, size, PROT_READ or PROT_WRITE,
|
||||
MAP_PRIVATE or MAP_ANONYMOUS, -1, 0)
|
||||
if result == nil or result == cast[pointer](-1):
|
||||
raiseOutOfMem()
|
||||
|
||||
elif defined(windows):
|
||||
const
|
||||
MEM_RESERVE = 0x2000
|
||||
MEM_COMMIT = 0x1000
|
||||
MEM_TOP_DOWN = 0x100000
|
||||
PAGE_READWRITE = 0x04
|
||||
|
||||
proc VirtualAlloc(lpAddress: pointer, dwSize: int, flAllocationType,
|
||||
flProtect: int32): pointer {.
|
||||
header: "<windows.h>", stdcall.}
|
||||
|
||||
proc getNewArea(size: var int): pointer {.inline.} =
|
||||
size = roundup(size, PageSize)
|
||||
result = VirtualAlloc(nil, size, MEM_RESERVE or MEM_COMMIT or MEM_TOP_DOWN,
|
||||
PAGE_READWRITE)
|
||||
if result == nil: raiseOutOfMem()
|
||||
|
||||
else:
|
||||
{.warning: "Generic code for allocating pages is used".}
|
||||
# generic implementation relying on malloc:
|
||||
proc malloc(size: int): pointer {.nodecl, importc.}
|
||||
|
||||
proc getNewArea(size: var int): pointer {.inline.} =
|
||||
size = roundup(size, PageSize)
|
||||
result = malloc(size)
|
||||
if result == nil: raiseOutOfMem()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# small fixed size allocator:
|
||||
|
||||
# Design: We manage pages. A page is of constant size, but not necessarily
|
||||
# the OS's page size. Pages are managed in a hash table taking advantage of
|
||||
# the fact that the OS is likely to give us pages with contingous numbers.
|
||||
# A page contains either small fixed size objects of the same size or
|
||||
# variable length objects. An object's size is always aligned at 16 byte
|
||||
# boundary. Huge objects are dealt with the TLSF algorithm.
|
||||
# The design supports iterating over any object in a fast way.
|
||||
|
||||
# A bitset contains any page that starts an allocated page. The page may be
|
||||
# empty however. This bitset can be used to quickly determine if a given
|
||||
# page belongs to the GC heap. The design of the memory allocator makes it
|
||||
# simple to return unused pages back to the OS.
|
||||
|
||||
|
||||
# Small bocks
|
||||
# -----------
|
||||
#
|
||||
# If we use a list in the free object's space. Allocation and deallocation are
|
||||
# O(1). Since any object is of the same size, iteration is quite efficient too.
|
||||
# However, pointer detection is easy too: Just check if the type-field is nil.
|
||||
# Deallocation sets it to nil.
|
||||
# Algorithm:
|
||||
|
||||
# i = 0
|
||||
# f = b.f # first free address
|
||||
# while i < max:
|
||||
# if a[i] == f: # not a valid block
|
||||
# f = f.next # next free address
|
||||
# else:
|
||||
# a[i] is a valid object of size s
|
||||
# inc(i)
|
||||
|
||||
# The zero count table is an array. Since we know that the RC is zero, we can
|
||||
# use the bits for an index into this array. Thus multiple ZCT tables are not
|
||||
# difficult to support and insertion and removal is O(1). We use negative
|
||||
# indexes for this. This makes it even fast enough (and necessary!) to do a ZCT
|
||||
# removal if the RC is incremented.
|
||||
#
|
||||
|
||||
# Huge blocks
|
||||
# -----------
|
||||
#
|
||||
# Huge blocks are always rounded up to a multiple of the page size. These are
|
||||
# called *strides*. We also need to keep an index structure
|
||||
# of (stridesize, pagelist).
|
||||
#
|
||||
|
||||
const
|
||||
MemAlign = 8
|
||||
PageShift = if sizeof(int) == 4: 12 else: 13
|
||||
PageSize = 1 shl PageShift
|
||||
type
|
||||
TFreeList {.final.} = object
|
||||
next, prev: ptr TFreeList
|
||||
|
||||
TPageDesc {.final.} = object # the start of a stride always starts with this!
|
||||
size: int # lowest bit is set, if it is a huge block
|
||||
free: ptr TFreeList # only used if it manages multiple cells
|
||||
snext, sprev: ptr TPageDesc # next and prev pagedescs with the same size
|
||||
|
||||
TCellArray {.final.} = object
|
||||
i: int # length
|
||||
d: ptr array [0..1000_000, TCell]
|
||||
|
||||
TPageManager = table[page, ptr TPageDesc]
|
||||
|
||||
TGcHeap {.final.} = object
|
||||
# structure that manages the garbage collected heap
|
||||
zct: TCellArray
|
||||
stackCells: TCellArray
|
||||
smallBlocks: array [PageSize div MemAlign, ptr TPageDesc]
|
||||
freeLists: array [PageSize div MemAlign, ptr TFreeList]
|
||||
pages: TPageManager
|
||||
usedPages: TPageList
|
||||
freePages: TPageList
|
||||
|
||||
# small blocks:
|
||||
proc allocSmall(var h: TGcHeap, size: int): pointer =
|
||||
var s = align(size)
|
||||
var f = h.freeLists[s]
|
||||
if f != nil:
|
||||
f.prev = f.next # remove from list
|
||||
f.next.prev = f.prev
|
||||
return f
|
||||
var p = h.smallBlocks[s]
|
||||
if p == nil or p.free == nil:
|
||||
p = newSmallBlock(s, p)
|
||||
h.smallBlocks[s] = p
|
||||
|
||||
|
||||
|
||||
proc decRef(cell: PCell) {.inline.} =
|
||||
assert(cell in ct.AT)
|
||||
assert(cell.refcount > 0) # this should be the case!
|
||||
assert(seqCheck(cell))
|
||||
dec(cell.refcount)
|
||||
if cell.refcount == 0:
|
||||
# add to zero count table:
|
||||
zct.d[zct.i] = cell
|
||||
cell.recfcount = -zct.i
|
||||
inc(zct.i)
|
||||
|
||||
proc incRef(cell: PCell) {.inline.} =
|
||||
assert(seqCheck(cell))
|
||||
if cell.refcount < 0:
|
||||
# remove from zero count table:
|
||||
zct.d[-cell.refcount] = zct.d[zct.i-1]
|
||||
dec(zct.i)
|
||||
cell.refcount = 1
|
||||
else:
|
||||
inc(cell.refcount)
|
||||
|
||||
proc asgnRef(dest: ppointer, src: pointer) =
|
||||
# the code generator calls this proc!
|
||||
assert(not isOnStack(dest))
|
||||
# BUGFIX: first incRef then decRef!
|
||||
if src != nil: incRef(usrToCell(src))
|
||||
if dest^ != nil: decRef(usrToCell(dest^))
|
||||
dest^ = src
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# helpers
|
||||
|
||||
const
|
||||
table: array[0..255, int8] = [
|
||||
-1, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 5,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||
6, 6, 6, 6, 6, 6, 6, 6,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||
6, 6, 6, 6, 6, 6, 6, 6,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7
|
||||
]
|
||||
|
||||
proc ls_bit(i: int32): int {.inline.} =
|
||||
var
|
||||
a: int = 0
|
||||
x: int = i and -i
|
||||
if x <=% 0xffff:
|
||||
if x <=% ff: a = 0
|
||||
else: a = 8
|
||||
elif x <=% 0xffffff: a = 16
|
||||
else: a = 24
|
||||
return table[x shr a] + a
|
||||
|
||||
proc ms_bit(i: int): int {.inline.} =
|
||||
var
|
||||
a = if i <=% 0xffff: (if i <=% 0xff: 0 else: 8) elif
|
||||
i <=% 0xffffff: 16 else: 24
|
||||
return table[i shr a] + a
|
||||
|
||||
proc set_bit[IX](nr: int, adr: var array[IX, int32]) {.inline.} =
|
||||
adr[nr shr 5] = adr[nr shr 5] or (1 shl (nr and 0x1f))
|
||||
|
||||
proc clear_bit[IX](nr: int, adr: var array[IX, int32]) {.inline.} =
|
||||
adr[nr shr 5] = adr[nr shr 5] and not (1 shl (nr and 0x1f))
|
||||
|
||||
proc mappingSearch(r, fl, sl: var int) {.inline.} =
|
||||
if r < smallBlock:
|
||||
fl = 0
|
||||
sl = r div (smallBlock div maxSli)
|
||||
else:
|
||||
var t = (1 shl (ms_bit(r) - maxLog2Sli)) - 1
|
||||
r = r + t
|
||||
fl = ms_bit(r)
|
||||
sl = (r shl (fl - maxLog2Sli)) - maxSli
|
||||
fl = fl - fliOffset
|
||||
r = r and not t
|
||||
|
||||
proc mappingInsert(r: int, fl, sl: var int) {.inline.} =
|
||||
if r < smallBlock:
|
||||
fl = 0
|
||||
sl = r div (smallBlock div maxSli)
|
||||
else:
|
||||
fl = ms_bit(r)
|
||||
sl = (r shr (fl - maxLog2Sli)) - maxSli
|
||||
fl = fl - fliOffset
|
||||
|
||||
proc findSuitableBlock(t: var TLSF, fl, sl: var int): Pbhdr =
|
||||
var tmp = t.slBitmap[fl] and ((not 0) shl sl)
|
||||
if tmp != 0:
|
||||
sl = ls_bit(tmp)
|
||||
result = t.matrix[fl][sl]
|
||||
else:
|
||||
fl = ls_bit(t.flBitmap and (not 0 shl (fl + 1)))
|
||||
if fl > 0: # likely
|
||||
sl = ls_bit(t.slBitmap[fl])
|
||||
result = t.matrix[fl][sl]
|
||||
|
||||
proc extractBlockHdr(b: Pbhdr, t: var TLSF, fl, sl: int) {.inline.} =
|
||||
t.matrix[fl][sl] = b.freePtr.next
|
||||
if t.matrix[fl][sl] != nil:
|
||||
t.matrix[fl][sl].freePtr.prev = nil
|
||||
else:
|
||||
clear_bit(sl, t.slBitmap[fl])
|
||||
if t.slBitmap[fl] == 0:
|
||||
clear_bit(fl, t.flBitmap)
|
||||
b.freePtr.prev = nil
|
||||
b.freePtr.next = nil
|
||||
|
||||
proc extractBlock(b: Pbhdr, t: var TLSF, fl, sl: int) {.inline.} =
|
||||
if b.freePtr.next != nil:
|
||||
b.freePtr.next.freePtr.prev = b.freePtr.prev
|
||||
if b.freePtr.prev != nil:
|
||||
b.freePtr.prev.freePtr.next = b.freePtr.next
|
||||
if t.matrix[fl][sl] == b:
|
||||
t.matrix[fl][sl] = b.freePtr.next
|
||||
if t.matrix[fl][sl] == nil:
|
||||
clear_bit(sl, t.slBitmap[fl])
|
||||
if t.slBitmap[fl] == 0:
|
||||
clear_bit(fl, t.flBitmap)
|
||||
b.freePtr.prev = nil
|
||||
b.freePtr.next = nil
|
||||
|
||||
proc insertBlock(b: Pbhdr, t: var TLSF, fl, sl: int) {.inline.} =
|
||||
b.freePtr.prev = nil
|
||||
b.freePtr.next = t.matrix[fl][sl]
|
||||
if t.matrix[fl][sl] != nil:
|
||||
t.matrix[fl][sl].freePtr.prev = b
|
||||
t.matrix[fl][sl] = b
|
||||
set_bit(sl, t.slBitmap[fl])
|
||||
set_bit(fl, t.flBitmap)
|
||||
|
||||
proc getBuffer(b: Pbhdr): pointer {.inline.} =
|
||||
result = cast[pointer](addr(b.freePtr))
|
||||
|
||||
proc processArea(area: pointer, size: int): Pbhdr =
|
||||
var
|
||||
b, lb, ib: Pbhdr
|
||||
ai: PAreaInfo
|
||||
ib = cast[Pbhdr](area)
|
||||
if sizeof(TAreaInfo) < minBlockSize:
|
||||
ib.size = minBlockSize or usedBlock or prevUsed
|
||||
else
|
||||
ib.size = roundupSize(sizeof(TAreaInfo)) or usedBlock or prevUsed
|
||||
b = getNextBlock(getBuffer(ib), ib.size and blockSize)
|
||||
b.size = rounddownSize(size - 3 * bhdrOverhead - (ib.size and blockSize)) or
|
||||
usedBlock or prevUsed
|
||||
b.freePtr.prev = nil
|
||||
b.freePtr.next = nil
|
||||
lb = getNextBlock(getBuffer(b), b.size and blockSize)
|
||||
lb.prevHdr = b
|
||||
lb.size = 0 or usedBlock or prevFree
|
||||
ai = cast[PAreaInfo](getBuffer(ib))
|
||||
ai.next = nil
|
||||
ai.theEnd = lb
|
||||
return ib
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Begin of the allocator code
|
||||
|
||||
proc initMemoryPool(memPoolSize: int, memPool: pointer): int =
|
||||
var
|
||||
t: PLSF
|
||||
b, ib: Pbhdr
|
||||
|
||||
if memPool == nil or memPoolSize < sizeof(TLSF) + bhdrOverhead * 8:
|
||||
writeToStdErr("initMemoryPool(): memory_pool invalid\n")
|
||||
return -1
|
||||
|
||||
if (cast[TAddress](memPool) and ptrMask) != 0:
|
||||
writeToStdErr("initMemoryPool(): memPool must be aligned to a word\n")
|
||||
return -1
|
||||
t = cast[PLSF](memPool)
|
||||
# Check if already initialised
|
||||
if t.signature == tlsfSignature:
|
||||
b = getNextBlock(memPool, roundupSize(sizeof(TLSF)))
|
||||
return b.size and blockSize
|
||||
zeroMem(memPool, sizeof(TLSF))
|
||||
|
||||
t.signature = tlsfSignature
|
||||
ib = processArea(getNextBlock(memPool, roundupSize(sizeof(TLSF))),
|
||||
rounddownSize(memPoolSize - sizeof(TLSF)))
|
||||
b = getNextBlock(getBuffer(ib), ib.size and blockSize)
|
||||
freeEx(getBuffer(b), t)
|
||||
t.areaHead = cast[PAreaInfo](getBuffer(ib))
|
||||
|
||||
t.used_size = memPoolSize - (b.size and blockSize)
|
||||
t.max_size = t.used_size
|
||||
return b.size and blockSize
|
||||
|
||||
|
||||
proc addNewArea(area: pointer, areaSize: int, t: var TLSF): int =
|
||||
var
|
||||
p, ptrPrev, ai: PAreaInfo
|
||||
ib0, b0, lb0, ib1, b1, lb1, nextB: Pbhdr
|
||||
|
||||
zeroMem(area, areaSize)
|
||||
p = t.areaHead
|
||||
ptrPrev = 0
|
||||
|
||||
ib0 = processArea(area, areaSize)
|
||||
b0 = getNextBlock(getBuffer(ib0), ib0.size and blockSize)
|
||||
lb0 = getNextBlock(getBuffer(b0), b0.size and blockSize)
|
||||
|
||||
# Before inserting the new area, we have to merge this area with the
|
||||
# already existing ones
|
||||
while p != nil:
|
||||
ib1 = cast[Pbhdr](cast[TAddress](p) -% bhdrOverhead)
|
||||
b1 = getNextBlock(getBuffer(ib1), ib1.size and blockSize)
|
||||
lb1 = p.theEnd
|
||||
|
||||
# Merging the new area with the next physically contigous one
|
||||
if cast[TAddress](ib1) == cast[TAddress](lb0) +% bhdrOverhead:
|
||||
if t.areaHead == p:
|
||||
t.areaHead = p.next
|
||||
p = p.next
|
||||
else:
|
||||
ptrPrev.next = p.next
|
||||
p = p.next
|
||||
b0.size = rounddownSize((b0.size and blockSize) +
|
||||
(ib1.size and blockSize) + 2 * bhdrOverhead) or
|
||||
usedBlock or prevUsed
|
||||
b1.prevHdr = b0
|
||||
lb0 = lb1
|
||||
continue
|
||||
|
||||
# Merging the new area with the previous physically contigous one
|
||||
if getBuffer(lb1) == pointer(ib0):
|
||||
if t.areaHead == p:
|
||||
t.areaHead = p.next
|
||||
p = p.next
|
||||
else:
|
||||
ptrPrev.next = p.next
|
||||
p = p.next
|
||||
lb1->size = rounddownSize((b0.size and blockSize) +
|
||||
(ib0.size and blockSize) + 2 * bhdrOverhead) or
|
||||
usedBlock or (lb1.size and prevState)
|
||||
nextB = getNextBlock(getBuffer(lb1), lb1.size and blockSize)
|
||||
nextB.prevHdr = lb1
|
||||
b0 = lb1
|
||||
ib0 = ib1
|
||||
continue
|
||||
ptrPrev = p
|
||||
p = p.next
|
||||
|
||||
# Inserting the area in the list of linked areas
|
||||
ai = cast[PAreaInfo](getBuffer(ib0))
|
||||
ai.next = t.areaHead
|
||||
ai.theEnd = lb0
|
||||
t.areaHead = ai
|
||||
freeEx(getBuffer(b0), memPool)
|
||||
return (b0.size and blockSize)
|
||||
|
||||
proc mallocEx(asize: int, t: var TLSF): pointer =
|
||||
var
|
||||
b, b2, nextB: Pbhdr
|
||||
fl, sl, tmpSize, size: int
|
||||
|
||||
size = if asize < minBlockSize: minBlockSize else: roundupSize(asize)
|
||||
|
||||
# Rounding up the requested size and calculating fl and sl
|
||||
mappingSearch(size, fl, sl)
|
||||
|
||||
# Searching a free block, recall that this function changes the values
|
||||
# of fl and sl, so they are not longer valid when the function fails
|
||||
b = findSuitableBlock(tlsf, fl, sl)
|
||||
if b == nil:
|
||||
# Growing the pool size when needed
|
||||
# size plus enough room for the required headers:
|
||||
var areaSize = max(size + bhdrOverhead * 8, defaultAreaSize)
|
||||
var area = getNewArea(areaSize)
|
||||
addNewArea(area, areaSize, t)
|
||||
# Rounding up the requested size and calculating fl and sl
|
||||
mappingSearch(size, fl, sl)
|
||||
# Searching a free block
|
||||
b = findSuitableBlock(t, fl, sl)
|
||||
if b == nil:
|
||||
raiseOutOfMem()
|
||||
|
||||
extractBlockHdr(b, t, fl, sl)
|
||||
|
||||
#-- found:
|
||||
nextB = getNextBlock(getBuffer(b), b.size and blockSize)
|
||||
# Should the block be split?
|
||||
tmpSize = (b.size and blockSize) - size
|
||||
if tmpSize >= sizeof(Tbhdr):
|
||||
dec(tmpSize, bhdrOverhead)
|
||||
b2 = getNextBlock(getBuffer(b), size)
|
||||
b2.size = tmpSize or freeBlock or prevUsed
|
||||
nextB.prevHdr = b2
|
||||
mappingInsert(tmpSize, fl, sl)
|
||||
insertBlock(b2, t, fl, sl)
|
||||
|
||||
b.size = size or (b.size and prevState)
|
||||
else:
|
||||
nextB.size = nextB.size and not prevFree
|
||||
b.size = b.size and not freeBlock # Now it's used
|
||||
|
||||
addSize(t, b)
|
||||
return getBuffer(b)
|
||||
|
||||
|
||||
proc freeEx(p: pointer, t: var TLSF) =
|
||||
var
|
||||
fl = 0
|
||||
sl = 0
|
||||
b, tmpB: Pbhdr
|
||||
|
||||
assert(p != nil)
|
||||
b = cast[Pbhdr](cast[TAddress](p) -% bhdrOverhead)
|
||||
b.size = b.size or freeBlock
|
||||
|
||||
removeSize(t, b)
|
||||
b.freePtr.prev = nil
|
||||
b.freePtr.next = nil
|
||||
tmpB = getNextBlock(getBuffer(b), b.size and blockSize)
|
||||
if (tmpB.size and freeBlock) != 0:
|
||||
mappingInsert(tmpB.size and blockSize, fl, sl)
|
||||
extractBlock(tmpB, t, fl, sl)
|
||||
inc(b.size, (tmpB.size and blockSize) + bhdrOverhead)
|
||||
if (b.size and prevFree) != 0:
|
||||
tmpB = b.prevHdr
|
||||
mappingInsert(tmpB.size and blockSize, fl, sl)
|
||||
extractBlock(tmpB, t, fl, sl)
|
||||
inc(tmpB.size, (b.size and blockSize) + bhdrOverhead)
|
||||
b = tmpB
|
||||
mappingInsert(b.size and blockSize, fl, sl)
|
||||
insertBlock(b, t, fl, sl)
|
||||
|
||||
tmpB = getNextBlock(getBuffer(b), b.size and blockSize)
|
||||
tmpB.size = tmpB.size or prevFree
|
||||
tmpB.prevHdr = b
|
||||
|
||||
proc reallocEx(p: pointer, newSize: int, t: var TLSF): pointer =
|
||||
var
|
||||
cpsize, fl, sl, tmpSize: int
|
||||
b, tmpB, nextB: Pbhdr
|
||||
|
||||
assert(p != nil)
|
||||
assert(newSize > 0)
|
||||
|
||||
b = cast[Pbhdr](cast[TAddress](p) -% bhdrOverhead)
|
||||
nextB = getNextBlock(getBuffer(b), b.size and blockSize)
|
||||
newSize = if newSize < minBlockSize: minBlockSize else: roundupSize(newSize)
|
||||
tmpSize = b.size and blockSize
|
||||
if newSize <= tmpSize:
|
||||
removeSize(t, b)
|
||||
if (nextB.size and freeBlock) != 0:
|
||||
mappingInsert(nextB.size and blockSize, fl, sl)
|
||||
extractBlock(nextB, t, fl, sl)
|
||||
inc(tmpSize, (nextB.size and blockSize) + bhdrOverhead)
|
||||
nextB = getNextBlock(getBuffer(nextB), nextB.size and blockSize)
|
||||
# We always reenter this free block because tmpSize will
|
||||
# be greater then sizeof(Tbhdr)
|
||||
dec(tmpSize, newSize)
|
||||
if tmpSize >= sizeof(Tbhdr):
|
||||
dec(tmpSize, bhdrOverhead)
|
||||
tmpB = getNextBlock(getBuffer(b), newSize)
|
||||
tmpB.size = tmpSize or freeBlock or prevUsed
|
||||
nextB.prevHdr = tmpB
|
||||
nextB.size = nextB.size or prevFree
|
||||
mappingInsert(tmpSize, fl, sl)
|
||||
insertBlock(tmpB, t, fl, sl)
|
||||
b.size = newSize or (b.size and prevState)
|
||||
addSize(t, b)
|
||||
return getBuffer(b)
|
||||
|
||||
if (nextB.size and freeBlock) != 0:
|
||||
if newSize <= tmpSize + (nextB.size and blockSize):
|
||||
removeSize(t, b)
|
||||
mappingInsert(nextB.size and blockSize, fl, sl)
|
||||
extractBlock(nextB, t, fl, sl)
|
||||
inc(b.size, (nextB.size and blockSize) + bhdrOverhead)
|
||||
nextB = getNextBlock(getBuffer(b), b.size and blockSize)
|
||||
nextB.prevHdr = b
|
||||
nextB.size = nextB.size and not prevFree
|
||||
tmpSize = (b.size and blockSize) - newSize
|
||||
if tmpSize >= sizeof(Tbhdr):
|
||||
dec(tmpSize, bhdrOverhead)
|
||||
tmpB = getNextBlock(getBuffer(b), newSize)
|
||||
tmpB.size = tmpSize or freeBlock or prevUsed
|
||||
nextB.prevHdr = tmpB
|
||||
nextB.size = nextB.size or prevFree
|
||||
mappingInsert(tmpSize, fl, sl)
|
||||
insertBlock(tmpB, t, fl, sl)
|
||||
b.size = newSize or (b.size and prevState)
|
||||
addSize(t, b)
|
||||
return getBuffer(b)
|
||||
|
||||
var ptrAux = mallocEx(newSize, t)
|
||||
cpsize = if (b.size and blockSize) > newSize: newSize else:
|
||||
(b.size and blockSize)
|
||||
copyMem(ptrAux, p, cpsize)
|
||||
freeEx(p, memPool)
|
||||
return ptrAux
|
||||
|
||||
|
||||
proc ansiCrealloc(p: pointer, newSize: int, t: var TLSF): pointer =
|
||||
if p == nil:
|
||||
if newSize > 0:
|
||||
result = mallocEx(newSize, t)
|
||||
else:
|
||||
result = nil
|
||||
elif newSize <= 0:
|
||||
freeEx(p, t)
|
||||
result = nil
|
||||
else:
|
||||
result = reallocEx(p, newSize, t)
|
||||
|
||||
proc InitTLSF(t: var TLSF) =
|
||||
var areaSize = sizeof(TLSF) + BHDR_OVERHEAD * 8 # Just a safety constant
|
||||
areaSize = max(areaSize, DEFAULT_areaSize)
|
||||
var area = getNewArea(areaSize)
|
||||
|
||||
|
||||
initMemoryPool(areaSize, area)
|
||||
|
||||
var
|
||||
t: PLSF
|
||||
b, ib: Pbhdr
|
||||
|
||||
t = cast[PLSF](memPool)
|
||||
|
||||
zeroMem(area, areaSize)
|
||||
|
||||
t.signature = tlsfSignature
|
||||
var ib = processArea(getNextBlock(memPool, roundupSize(sizeof(TLSF))),
|
||||
rounddownSize(memPoolSize - sizeof(TLSF)))
|
||||
var b = getNextBlock(getBuffer(ib), ib.size and blockSize)
|
||||
freeEx(getBuffer(b), t)
|
||||
t.areaHead = cast[PAreaInfo](getBuffer(ib))
|
||||
|
||||
t.used_size = memPoolSize - (b.size and blockSize)
|
||||
t.max_size = t.used_size
|
||||
|
||||
# XXX
|
||||
@@ -105,4 +105,82 @@ proc SetStdHandle*(nStdHandle: int32, hHandle: THANDLE): WINBOOL {.stdcall,
|
||||
dynlib: "kernel32", importc: "SetStdHandle".}
|
||||
proc FlushFileBuffers*(hFile: THANDLE): WINBOOL {.stdcall, dynlib: "kernel32",
|
||||
importc: "FlushFileBuffers".}
|
||||
|
||||
|
||||
proc GetLastError*(): int32 {.importc, stdcall, dynlib: "kernel32".}
|
||||
proc FormatMessageA*(dwFlags: int32, lpSource: pointer,
|
||||
dwMessageId, dwLanguageId: int32,
|
||||
lpBuffer: pointer, nSize: int32,
|
||||
Arguments: pointer): int32 {.
|
||||
importc, stdcall, dynlib: "kernel32".}
|
||||
proc LocalFree*(p: pointer) {.importc, stdcall, dynlib: "kernel32".}
|
||||
|
||||
proc GetCurrentDirectoryA*(nBufferLength: int32, lpBuffer: cstring): int32 {.
|
||||
importc, dynlib: "kernel32", stdcall.}
|
||||
proc SetCurrentDirectoryA*(lpPathName: cstring): int32 {.
|
||||
importc, dynlib: "kernel32", stdcall.}
|
||||
proc CreateDirectoryA*(pathName: cstring, security: Pointer): int32 {.
|
||||
importc: "CreateDirectoryA", dynlib: "kernel32", stdcall.}
|
||||
proc RemoveDirectoryA*(lpPathName: cstring): int32 {.
|
||||
importc, dynlib: "kernel32", stdcall.}
|
||||
proc SetEnvironmentVariableA*(lpName, lpValue: cstring): int32 {.
|
||||
stdcall, dynlib: "kernel32", importc.}
|
||||
|
||||
proc GetModuleFileNameA*(handle: THandle, buf: CString, size: int32): int32 {.
|
||||
importc, dynlib: "kernel32", stdcall.}
|
||||
|
||||
const
|
||||
FILE_ATTRIBUTE_ARCHIVE* = 32'i32
|
||||
FILE_ATTRIBUTE_COMPRESSED* = 2048'i32
|
||||
FILE_ATTRIBUTE_NORMAL* = 128'i32
|
||||
FILE_ATTRIBUTE_DIRECTORY* = 16'i32
|
||||
FILE_ATTRIBUTE_HIDDEN* = 2'i32
|
||||
FILE_ATTRIBUTE_READONLY* = 1'i32
|
||||
FILE_ATTRIBUTE_SYSTEM* = 4'i32
|
||||
|
||||
MAX_PATH* = 260
|
||||
type
|
||||
FILETIME* {.final, pure.} = object ## CANNOT BE int64 BECAUSE OF ALIGNMENT
|
||||
dwLowDateTime*: int32
|
||||
dwHighDateTime*: int32
|
||||
TWIN32_FIND_DATA* {.pure.} = object
|
||||
dwFileAttributes*: int32
|
||||
ftCreationTime*: FILETIME
|
||||
ftLastAccessTime*: FILETIME
|
||||
ftLastWriteTime*: FILETIME
|
||||
nFileSizeHigh*: int32
|
||||
nFileSizeLow*: int32
|
||||
dwReserved0: int32
|
||||
dwReserved1: int32
|
||||
cFileName*: array[0..(MAX_PATH) - 1, char]
|
||||
cAlternateFileName*: array[0..13, char]
|
||||
proc FindFirstFileA*(lpFileName: cstring,
|
||||
lpFindFileData: var TWIN32_FIND_DATA): THANDLE {.
|
||||
stdcall, dynlib: "kernel32", importc: "FindFirstFileA".}
|
||||
proc FindNextFileA*(hFindFile: THANDLE,
|
||||
lpFindFileData: var TWIN32_FIND_DATA): int32 {.
|
||||
stdcall, dynlib: "kernel32", importc: "FindNextFileA".}
|
||||
proc FindClose*(hFindFile: THANDLE) {.stdcall, dynlib: "kernel32",
|
||||
importc: "FindClose".}
|
||||
|
||||
proc GetFullPathNameA*(lpFileName: cstring, nBufferLength: int32,
|
||||
lpBuffer: cstring, lpFilePart: var cstring): int32 {.
|
||||
stdcall, dynlib: "kernel32", importc.}
|
||||
proc GetFileAttributesA*(lpFileName: cstring): int32 {.
|
||||
stdcall, dynlib: "kernel32", importc.}
|
||||
proc SetFileAttributesA*(lpFileName: cstring, dwFileAttributes: int32): WINBOOL {.
|
||||
stdcall, dynlib: "kernel32", importc: "SetFileAttributesA".}
|
||||
|
||||
proc CopyFileA*(lpExistingFileName, lpNewFileName: CString,
|
||||
bFailIfExists: cint): cint {.
|
||||
importc, stdcall, dynlib: "kernel32".}
|
||||
|
||||
proc GetEnvironmentStringsA*(): cstring {.
|
||||
stdcall, dynlib: "kernel32", importc.}
|
||||
proc FreeEnvironmentStringsA*(para1: cstring): int32 {.
|
||||
stdcall, dynlib: "kernel32", importc.}
|
||||
|
||||
proc GetCommandLineA*(): CString {.importc, stdcall, dynlib: "kernel32".}
|
||||
|
||||
proc rdFileTime*(f: FILETIME): int64 =
|
||||
result = ze64(f.dwLowDateTime) or (ze64(f.dwHighDateTime) shl 32)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#** In french or in english
|
||||
#
|
||||
|
||||
import "lib/base/lua/lua"
|
||||
import lua
|
||||
|
||||
proc lua_pushstring*(L: Plua_State, s: string)
|
||||
# compatibilty macros
|
||||
@@ -37,16 +37,16 @@
|
||||
|
||||
when defined(MACOSX):
|
||||
const
|
||||
LUA_NAME* = "liblua5.1.dylib"
|
||||
LUA_LIB_NAME* = "liblua5.1.dylib"
|
||||
LUA_NAME* = "liblua(5.2|5.1|5.0).dylib"
|
||||
LUA_LIB_NAME* = "liblua(5.2|5.1|5.0).dylib"
|
||||
elif defined(UNIX):
|
||||
const
|
||||
LUA_NAME* = "liblua5.1.so"
|
||||
LUA_LIB_NAME* = "liblua5.1.so"
|
||||
LUA_NAME* = "liblua(5.2|5.1|5.0).so.0"
|
||||
LUA_LIB_NAME* = "liblua(5.2|5.1|5.0).so.0"
|
||||
else:
|
||||
const
|
||||
LUA_NAME* = "lua5.1.dll"
|
||||
LUA_LIB_NAME* = "lua5.1.dll"
|
||||
LUA_NAME* = "lua(5.2|5.1|5.0).dll"
|
||||
LUA_LIB_NAME* = "lua(5.2|5.1|5.0).dll"
|
||||
type
|
||||
size_t* = int
|
||||
Psize_t* = ptr size_t
|
||||
@@ -19,7 +19,7 @@
|
||||
#** In french or in english
|
||||
#
|
||||
|
||||
import "lib/base/lua/lua"
|
||||
import lua
|
||||
|
||||
const
|
||||
LUA_COLIBNAME* = "coroutine"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user