1040 lines
45 KiB
HTML
Executable file
1040 lines
45 KiB
HTML
Executable 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 Nim. -->
|
|
<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" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<!-- Favicon -->
|
|
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
|
|
|
|
<!-- Google fonts -->
|
|
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
|
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
|
|
|
<!-- CSS -->
|
|
<title>cimport</title>
|
|
<style type="text/css" >
|
|
/*
|
|
Stylesheet for use with Docutils/rst2html.
|
|
|
|
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
|
customize this style sheet.
|
|
|
|
Modified from Chad Skeeters' rst2html-style
|
|
https://bitbucket.org/cskeeters/rst2html-style/
|
|
|
|
Modified by Boyd Greenfield and narimiran
|
|
*/
|
|
|
|
html {
|
|
font-size: 100%;
|
|
-webkit-text-size-adjust: 100%;
|
|
-ms-text-size-adjust: 100%; }
|
|
|
|
body {
|
|
font-family: "Lato", "Helvetica Neue", "HelveticaNeue", Helvetica, Arial, sans-serif;
|
|
font-weight: 400;
|
|
font-size: 1.125em;
|
|
line-height: 1.5;
|
|
color: #222;
|
|
background-color: #FCFCFC; }
|
|
|
|
/* Skeleton grid */
|
|
.container {
|
|
position: relative;
|
|
width: 100%;
|
|
max-width: 1050px;
|
|
margin: 0 auto;
|
|
padding: 0;
|
|
box-sizing: border-box; }
|
|
|
|
.column,
|
|
.columns {
|
|
width: 100%;
|
|
float: left;
|
|
box-sizing: border-box;
|
|
margin-left: 1%;
|
|
}
|
|
|
|
.column:first-child,
|
|
.columns:first-child {
|
|
margin-left: 0; }
|
|
|
|
.three.columns {
|
|
width: 19%; }
|
|
|
|
.nine.columns {
|
|
width: 80.0%; }
|
|
|
|
.twelve.columns {
|
|
width: 100%;
|
|
margin-left: 0; }
|
|
|
|
@media screen and (max-width: 860px) {
|
|
.three.columns {
|
|
display: none;
|
|
}
|
|
.nine.columns {
|
|
width: 98.0%;
|
|
}
|
|
body {
|
|
font-size: 1em;
|
|
line-height: 1.35;
|
|
}
|
|
}
|
|
|
|
cite {
|
|
font-style: italic !important; }
|
|
|
|
|
|
/* Nim search input */
|
|
div#searchInputDiv {
|
|
margin-bottom: 1em;
|
|
}
|
|
input#searchInput {
|
|
width: 80%;
|
|
}
|
|
|
|
|
|
/* Docgen styles */
|
|
/* Links */
|
|
a {
|
|
color: #07b;
|
|
text-decoration: none;
|
|
}
|
|
|
|
a span.Identifier {
|
|
text-decoration: underline;
|
|
text-decoration-color: #aab;
|
|
}
|
|
|
|
a.reference-toplevel {
|
|
font-weight: bold;
|
|
}
|
|
|
|
a.toc-backref {
|
|
text-decoration: none;
|
|
color: #222; }
|
|
|
|
a.link-seesrc {
|
|
color: #607c9f;
|
|
font-size: 0.9em;
|
|
font-style: italic; }
|
|
|
|
a:hover,
|
|
a:focus {
|
|
color: #607c9f;
|
|
text-decoration: underline; }
|
|
|
|
a:hover span.Identifier {
|
|
color: #607c9f;
|
|
}
|
|
|
|
|
|
sub,
|
|
sup {
|
|
position: relative;
|
|
font-size: 75%;
|
|
line-height: 0;
|
|
vertical-align: baseline; }
|
|
|
|
sup {
|
|
top: -0.5em; }
|
|
|
|
sub {
|
|
bottom: -0.25em; }
|
|
|
|
img {
|
|
width: auto;
|
|
height: auto;
|
|
max-width: 100%;
|
|
vertical-align: middle;
|
|
border: 0;
|
|
-ms-interpolation-mode: bicubic; }
|
|
|
|
@media print {
|
|
* {
|
|
color: black !important;
|
|
text-shadow: none !important;
|
|
background: transparent !important;
|
|
box-shadow: none !important; }
|
|
|
|
a,
|
|
a:visited {
|
|
text-decoration: underline; }
|
|
|
|
a[href]:after {
|
|
content: " (" attr(href) ")"; }
|
|
|
|
abbr[title]:after {
|
|
content: " (" attr(title) ")"; }
|
|
|
|
.ir a:after,
|
|
a[href^="javascript:"]:after,
|
|
a[href^="#"]:after {
|
|
content: ""; }
|
|
|
|
pre,
|
|
blockquote {
|
|
border: 1px solid #999;
|
|
page-break-inside: avoid; }
|
|
|
|
thead {
|
|
display: table-header-group; }
|
|
|
|
tr,
|
|
img {
|
|
page-break-inside: avoid; }
|
|
|
|
img {
|
|
max-width: 100% !important; }
|
|
|
|
@page {
|
|
margin: 0.5cm; }
|
|
|
|
h1 {
|
|
page-break-before: always; }
|
|
|
|
h1.title {
|
|
page-break-before: avoid; }
|
|
|
|
p,
|
|
h2,
|
|
h3 {
|
|
orphans: 3;
|
|
widows: 3; }
|
|
|
|
h2,
|
|
h3 {
|
|
page-break-after: avoid; }
|
|
}
|
|
|
|
|
|
p {
|
|
margin-top: 0.5em;
|
|
margin-bottom: 0.5em;
|
|
}
|
|
|
|
small {
|
|
font-size: 85%; }
|
|
|
|
strong {
|
|
font-weight: 600;
|
|
font-size: 0.95em;
|
|
color: #3c3c3c;
|
|
}
|
|
|
|
em {
|
|
font-style: italic; }
|
|
|
|
h1 {
|
|
font-size: 1.8em;
|
|
font-weight: 400;
|
|
padding-bottom: .25em;
|
|
border-bottom: 1px solid #aaa;
|
|
margin-top: 2.5em;
|
|
margin-bottom: 1em;
|
|
line-height: 1.2em; }
|
|
|
|
h1.title {
|
|
padding-bottom: 1em;
|
|
border-bottom: 0px;
|
|
font-size: 2.5em;
|
|
text-align: center;
|
|
font-weight: 900;
|
|
margin-top: 0.75em;
|
|
margin-bottom: 0em;
|
|
}
|
|
|
|
h2 {
|
|
font-size: 1.3em;
|
|
margin-top: 2em; }
|
|
|
|
h2.subtitle {
|
|
text-align: center; }
|
|
|
|
h3 {
|
|
font-size: 1.125em;
|
|
font-style: italic;
|
|
margin-top: 1.5em; }
|
|
|
|
h4 {
|
|
font-size: 1.125em;
|
|
margin-top: 1em; }
|
|
|
|
h5 {
|
|
font-size: 1.125em;
|
|
margin-top: 0.75em; }
|
|
|
|
h6 {
|
|
font-size: 1.1em; }
|
|
|
|
|
|
ul,
|
|
ol {
|
|
padding: 0;
|
|
margin-top: 0.5em;
|
|
margin-left: 0.75em; }
|
|
|
|
ul ul,
|
|
ul ol,
|
|
ol ol,
|
|
ol ul {
|
|
margin-bottom: 0;
|
|
margin-left: 1.25em; }
|
|
|
|
li {
|
|
list-style-type: circle;
|
|
}
|
|
|
|
ul.simple-boot li {
|
|
list-style-type: none;
|
|
margin-left: 0em;
|
|
margin-bottom: 0.5em;
|
|
}
|
|
|
|
ol.simple > li, ul.simple > li {
|
|
margin-bottom: 0.25em;
|
|
margin-left: 0.4em }
|
|
|
|
ul.simple.simple-toc > li {
|
|
margin-top: 1em;
|
|
}
|
|
|
|
ul.simple-toc {
|
|
list-style: none;
|
|
font-size: 0.9em;
|
|
margin-left: -0.3em;
|
|
margin-top: 1em; }
|
|
|
|
ul.simple-toc > li {
|
|
list-style-type: none;
|
|
}
|
|
|
|
ul.simple-toc-section {
|
|
list-style-type: circle;
|
|
margin-left: 1em;
|
|
color: #6c9aae; }
|
|
|
|
|
|
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; }
|
|
|
|
ul.auto-toc {
|
|
list-style-type: none; }
|
|
|
|
|
|
dl {
|
|
margin-bottom: 1.5em; }
|
|
|
|
dt {
|
|
margin-bottom: -0.5em;
|
|
margin-left: 0.0em; }
|
|
|
|
dd {
|
|
margin-left: 2.0em;
|
|
margin-bottom: 3.0em;
|
|
margin-top: 0.5em; }
|
|
|
|
|
|
hr {
|
|
margin: 2em 0;
|
|
border: 0;
|
|
border-top: 1px solid #aaa; }
|
|
|
|
blockquote {
|
|
font-size: 0.9em;
|
|
font-style: italic;
|
|
padding-left: 0.5em;
|
|
margin-left: 0;
|
|
border-left: 5px solid #bbc;
|
|
}
|
|
|
|
.pre {
|
|
font-family: "Source Code Pro", Monaco, Menlo, Consolas, "Courier New", monospace;
|
|
font-weight: 500;
|
|
font-size: 0.85em;
|
|
background-color: #f0f3ff;
|
|
padding-left: 3px;
|
|
padding-right: 3px;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
pre {
|
|
font-family: "Source Code Pro", Monaco, Menlo, Consolas, "Courier New", monospace;
|
|
color: #222;
|
|
font-weight: 500;
|
|
display: inline-block;
|
|
box-sizing: border-box;
|
|
min-width: 100%;
|
|
padding: 0.5em;
|
|
margin-top: 0.5em;
|
|
margin-bottom: 0.5em;
|
|
font-size: 0.85em;
|
|
white-space: pre !important;
|
|
overflow-y: hidden;
|
|
overflow-x: visible;
|
|
background-color: ghostwhite;
|
|
border: 1px solid #dde;
|
|
-webkit-border-radius: 6px;
|
|
-moz-border-radius: 6px;
|
|
border-radius: 6px; }
|
|
|
|
.pre-scrollable {
|
|
max-height: 340px;
|
|
overflow-y: scroll; }
|
|
|
|
|
|
/* Nim line-numbered tables */
|
|
.line-nums-table {
|
|
width: 100%;
|
|
table-layout: fixed; }
|
|
|
|
table.line-nums-table {
|
|
border-radius: 4px;
|
|
border: 1px solid #cccccc;
|
|
background-color: ghostwhite;
|
|
border-collapse: separate;
|
|
margin-top: 15px;
|
|
margin-bottom: 25px; }
|
|
|
|
.line-nums-table tbody {
|
|
border: none; }
|
|
|
|
.line-nums-table td pre {
|
|
border: none;
|
|
background-color: transparent; }
|
|
|
|
.line-nums-table td.blob-line-nums {
|
|
width: 28px; }
|
|
|
|
.line-nums-table td.blob-line-nums pre {
|
|
color: #b0b0b0;
|
|
-webkit-filter: opacity(75%);
|
|
text-align: right;
|
|
border-color: transparent;
|
|
background-color: transparent;
|
|
padding-left: 0px;
|
|
margin-left: 0px;
|
|
padding-right: 0px;
|
|
margin-right: 0px; }
|
|
|
|
|
|
table {
|
|
max-width: 100%;
|
|
background-color: transparent;
|
|
margin-top: 0.5em;
|
|
margin-bottom: 1.5em;
|
|
border-collapse: collapse;
|
|
border-color: #ccc;
|
|
border-spacing: 0;
|
|
font-size: 0.9em;
|
|
}
|
|
|
|
table th, table td {
|
|
padding: 0px 0.5em 0px;
|
|
}
|
|
|
|
table th {
|
|
background-color: #e8e8e8;
|
|
font-weight: bold; }
|
|
|
|
table th.docinfo-name {
|
|
background-color: transparent;
|
|
}
|
|
|
|
table tr:hover {
|
|
background-color: ghostwhite; }
|
|
|
|
|
|
/* rst2html default 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 {
|
|
/* Override more specific margin styles with "! important". */
|
|
margin-top: 0 !important; }
|
|
|
|
.last, .with-subtitle {
|
|
margin-bottom: 0 !important; }
|
|
|
|
.hidden {
|
|
display: none; }
|
|
|
|
blockquote.epigraph {
|
|
margin: 2em 5em; }
|
|
|
|
dl.docutils dd {
|
|
margin-bottom: 0.5em; }
|
|
|
|
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
|
|
overflow: hidden; }
|
|
|
|
|
|
div.figure {
|
|
margin-left: 2em;
|
|
margin-right: 2em; }
|
|
|
|
div.footer, div.header {
|
|
clear: both;
|
|
text-align: center;
|
|
color: #666;
|
|
font-size: smaller; }
|
|
|
|
div.footer {
|
|
padding-top: 5em;
|
|
}
|
|
|
|
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.topic {
|
|
margin: 2em; }
|
|
|
|
div.search_results {
|
|
background-color: antiquewhite;
|
|
margin: 3em;
|
|
padding: 1em;
|
|
border: 1px solid #4d4d4d;
|
|
}
|
|
|
|
div#global-links ul {
|
|
margin-left: 0;
|
|
list-style-type: none;
|
|
}
|
|
|
|
div#global-links > simple-boot {
|
|
margin-left: 3em;
|
|
}
|
|
|
|
hr.docutils {
|
|
width: 75%; }
|
|
|
|
img.align-left, .figure.align-left, object.align-left {
|
|
clear: left;
|
|
float: left;
|
|
margin-right: 1em; }
|
|
|
|
img.align-right, .figure.align-right, object.align-right {
|
|
clear: right;
|
|
float: right;
|
|
margin-left: 1em; }
|
|
|
|
img.align-center, .figure.align-center, object.align-center {
|
|
display: block;
|
|
margin-left: auto;
|
|
margin-right: auto; }
|
|
|
|
.align-left {
|
|
text-align: left; }
|
|
|
|
.align-center {
|
|
clear: both;
|
|
text-align: center; }
|
|
|
|
.align-right {
|
|
text-align: right; }
|
|
|
|
/* reset inner alignment in figures */
|
|
div.align-right {
|
|
text-align: inherit; }
|
|
|
|
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.topic-title {
|
|
font-weight: bold; }
|
|
|
|
pre.address {
|
|
margin-bottom: 0;
|
|
margin-top: 0;
|
|
font: inherit; }
|
|
|
|
pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
|
margin-left: 2em;
|
|
margin-right: 2em; }
|
|
|
|
pre.code .ln {
|
|
color: grey; }
|
|
|
|
/* line numbers */
|
|
pre.code, code {
|
|
background-color: #eeeeee; }
|
|
|
|
pre.code .comment, code .comment {
|
|
color: #5c6576; }
|
|
|
|
pre.code .keyword, code .keyword {
|
|
color: #3B0D06;
|
|
font-weight: bold; }
|
|
|
|
pre.code .literal.string, code .literal.string {
|
|
color: #0c5404; }
|
|
|
|
pre.code .name.builtin, code .name.builtin {
|
|
color: #352b84; }
|
|
|
|
pre.code .deleted, code .deleted {
|
|
background-color: #DEB0A1; }
|
|
|
|
pre.code .inserted, code .inserted {
|
|
background-color: #A3D289; }
|
|
|
|
span.classifier {
|
|
font-style: oblique; }
|
|
|
|
span.classifier-delimiter {
|
|
font-weight: bold; }
|
|
|
|
span.option {
|
|
white-space: nowrap; }
|
|
|
|
span.problematic {
|
|
color: #b30000; }
|
|
|
|
span.section-subtitle {
|
|
/* font-size relative to parent (h1..h6 element) */
|
|
font-size: 80%; }
|
|
|
|
span.DecNumber {
|
|
color: #252dbe; }
|
|
|
|
span.BinNumber {
|
|
color: #252dbe; }
|
|
|
|
span.HexNumber {
|
|
color: #252dbe; }
|
|
|
|
span.OctNumber {
|
|
color: #252dbe; }
|
|
|
|
span.FloatNumber {
|
|
color: #252dbe; }
|
|
|
|
span.Identifier {
|
|
color: #222; }
|
|
|
|
span.Keyword {
|
|
font-weight: 600;
|
|
color: #5e8f60; }
|
|
|
|
span.StringLit {
|
|
color: #a4255b; }
|
|
|
|
span.LongStringLit {
|
|
color: #a4255b; }
|
|
|
|
span.CharLit {
|
|
color: #a4255b; }
|
|
|
|
span.EscapeSequence {
|
|
color: black; }
|
|
|
|
span.Operator {
|
|
color: black; }
|
|
|
|
span.Punctuation {
|
|
color: black; }
|
|
|
|
span.Comment, span.LongComment {
|
|
font-style: italic;
|
|
font-weight: 400;
|
|
color: #484a86; }
|
|
|
|
span.RegularExpression {
|
|
color: darkviolet; }
|
|
|
|
span.TagStart {
|
|
color: darkviolet; }
|
|
|
|
span.TagEnd {
|
|
color: darkviolet; }
|
|
|
|
span.Key {
|
|
color: #252dbe; }
|
|
|
|
span.Value {
|
|
color: #252dbe; }
|
|
|
|
span.RawData {
|
|
color: #a4255b; }
|
|
|
|
span.Assembler {
|
|
color: #252dbe; }
|
|
|
|
span.Preprocessor {
|
|
color: #252dbe; }
|
|
|
|
span.Directive {
|
|
color: #252dbe; }
|
|
|
|
span.Command, span.Rule, span.Hyperlink, span.Label, span.Reference,
|
|
span.Other {
|
|
color: black; }
|
|
|
|
/* Pop type, const, proc, and iterator defs in nim def blocks */
|
|
dt pre > span.Identifier, dt pre > span.Operator {
|
|
color: #155da4;
|
|
font-weight: 700; }
|
|
|
|
dt pre > span.Keyword ~ span.Identifier, dt pre > span.Identifier ~ span.Identifier,
|
|
dt pre > span.Operator ~ span.Identifier, dt pre > span.Other ~ span.Identifier {
|
|
color: inherit;
|
|
font-weight: inherit; }
|
|
|
|
/* Nim sprite for the footer (taken from main page favicon) */
|
|
.nim-sprite {
|
|
display: inline-block;
|
|
height: 16px;
|
|
width: 16px;
|
|
background-position: 0 0;
|
|
background-size: 16px 16px;
|
|
-webkit-filter: opacity(50%);
|
|
background-repeat: no-repeat;
|
|
background-image: url("data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA==");
|
|
margin-bottom: -5px; }
|
|
|
|
span.pragmadots {
|
|
/* Position: relative frees us up to make the dots
|
|
look really nice without fucking up the layout and
|
|
causing bulging in the parent container */
|
|
position: relative;
|
|
/* 1px down looks slightly nicer */
|
|
top: 1px;
|
|
padding: 2px;
|
|
background-color: #e8e8e8;
|
|
border-radius: 4px;
|
|
margin: 0 2px;
|
|
cursor: pointer;
|
|
font-size: 0.8em;
|
|
}
|
|
|
|
span.pragmadots:hover {
|
|
background-color: #DBDBDB;
|
|
}
|
|
span.pragmawrap {
|
|
display: none;
|
|
}
|
|
|
|
span.attachedType {
|
|
display: none;
|
|
visibility: hidden;
|
|
}
|
|
</style>
|
|
|
|
<script type="text/javascript" src="dochack.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
function main() {
|
|
var pragmaDots = document.getElementsByClassName("pragmadots");
|
|
for (var i = 0; i < pragmaDots.length; i++) {
|
|
pragmaDots[i].onclick = function(event) {
|
|
// Hide tease
|
|
event.target.parentNode.style.display = "none";
|
|
// Show actual
|
|
event.target.parentNode.nextElementSibling.style.display = "inline";
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
</head>
|
|
<body onload="main()">
|
|
<div class="document" id="documentId">
|
|
<div class="container">
|
|
<h1 class="title">cimport</h1>
|
|
<div class="row">
|
|
<div class="three columns">
|
|
<div id="global-links">
|
|
<ul class="simple">
|
|
</ul>
|
|
</div>
|
|
<div id="searchInputDiv">
|
|
Search: <input type="text" id="searchInput"
|
|
onkeyup="search()" />
|
|
</div>
|
|
<div>
|
|
Group by:
|
|
<select onchange="groupBy(this.value)">
|
|
<option value="section">Section</option>
|
|
<option value="type">Type</option>
|
|
</select>
|
|
</div>
|
|
<ul class="simple simple-toc" id="toc-list">
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
|
|
<ul class="simple simple-toc-section">
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#12" id="62">Procs</a>
|
|
<ul class="simple simple-toc-section">
|
|
<li><a class="reference" href="#cSkipSymbol%2Cseq%5BT%5D%5Bstring%5D"
|
|
title="cSkipSymbol(skips: seq[string])"><wbr />c<wbr />Skip<wbr />Symbol<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#cSearchPath%2Cstring"
|
|
title="cSearchPath(path: string): string"><wbr />c<wbr />Search<wbr />Path<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#cDebug"
|
|
title="cDebug()"><wbr />c<wbr />Debug<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#cDisableCaching"
|
|
title="cDisableCaching()"><wbr />c<wbr />Disable<wbr />Caching<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#cAddSearchDir%2Cstring"
|
|
title="cAddSearchDir(dir: string)"><wbr />c<wbr />Add<wbr />Search<wbr />Dir<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#cAddStdDir%2Cstring"
|
|
title="cAddStdDir(mode = "c")"><wbr />c<wbr />Add<wbr />Std<wbr />Dir<span class="attachedType"></span></a></li>
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#17" id="67">Macros</a>
|
|
<ul class="simple simple-toc-section">
|
|
<li><a class="reference" href="#cOverride.m"
|
|
title="cOverride(body): untyped"><wbr />c<wbr />Override<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#cPlugin.m"
|
|
title="cPlugin(body): untyped"><wbr />c<wbr />Plugin<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#cDefine.m%2C%2Cstring"
|
|
title="cDefine(name: static string; val: static string = ""): untyped"><wbr />c<wbr />Define<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#cIncludeDir.m"
|
|
title="cIncludeDir(dir: static string): untyped"><wbr />c<wbr />Include<wbr />Dir<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#cCompile.m%2C%2Cstring%2Cstring"
|
|
title="cCompile(path: static string; mode = "c"; exclude = ""): untyped"><wbr />c<wbr />Compile<span class="attachedType"></span></a></li>
|
|
<li><a class="reference" href="#cImport.m"
|
|
title="cImport(filename: static string; recurse: static bool = false): untyped"><wbr />c<wbr />Import<span class="attachedType"></span></a></li>
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#19" id="69">Exports</a>
|
|
<ul class="simple simple-toc-section">
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
<div class="nine columns" id="content">
|
|
<div id="tocRoot"></div>
|
|
<p class="module-desc"><p>Main import file to write wrappers. Each <tt class="docutils literal"><span class="pre">compileTime</span></tt> proc must be used in a compile time context, eg using:</p>
|
|
<p><pre class="listing">
|
|
static:
|
|
cAddStdDir()
|
|
</pre> </p>
|
|
</p>
|
|
<div class="section" id="6">
|
|
<h1><a class="toc-backref" href="#6">Imports</a></h1>
|
|
<dl class="item">
|
|
<a class="reference external" href="plugin.html">plugin</a>, <a class="reference external" href="git.html">git</a>, <a class="reference external" href="paths.html">paths</a>, <a class="reference external" href="types.html">types</a>
|
|
</dl></div>
|
|
<div class="section" id="12">
|
|
<h1><a class="toc-backref" href="#12">Procs</a></h1>
|
|
<dl class="item">
|
|
<a id="cSkipSymbol,seq[T][string]"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#cSkipSymbol%2Cseq%5BT%5D%5Bstring%5D"><span class="Identifier">cSkipSymbol</span></a><span class="Other">(</span><span class="Identifier">skips</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">compileTime</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
Similar to <a class="reference external" href="cimport.html#cOverride.m,">cOverride()</a>, this macro allows filtering out symbols not of interest from the generated output.
|
|
<p><strong class="examples_text">Examples:</strong></p>
|
|
<pre class="listing"><span class="Keyword">static</span> <span class="Other">:</span>
|
|
<span class="Identifier">cSkipSymbol</span> <span class="Operator">@</span><span class="Other">[</span><span class="StringLit">"proc1"</span><span class="Other">,</span> <span class="StringLit">"Type2"</span><span class="Other">]</span></pre>
|
|
|
|
</dd>
|
|
<a id="cSearchPath,string"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#cSearchPath%2Cstring"><span class="Identifier">cSearchPath</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">compileTime</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadDirEffect</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
<p>Get full path to file or directory <tt class="docutils literal"><span class="pre">path</span></tt> in search path configured using <a class="reference external" href="cimport.html#cAddSearchDir,">cAddSearchDir()</a> and <a class="reference external" href="cimport.html#cAddStdDir,string">cAddStdDir()</a>.</p>
|
|
<p>This can be used to locate files or directories that can be passed onto <a class="reference external" href="cimport.html#cCompile.m,,string">cCompile()</a>, <a class="reference external" href="cimport.html#cIncludeDir.m,">cIncludeDir()</a> and <a class="reference external" href="cimport.html#cImport.m,">cImport()</a>.</p>
|
|
|
|
|
|
</dd>
|
|
<a id="cDebug"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#cDebug"><span class="Identifier">cDebug</span></a><span class="Other">(</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">compileTime</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
Enable debug messages and display the generated Nim code
|
|
|
|
</dd>
|
|
<a id="cDisableCaching"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#cDisableCaching"><span class="Identifier">cDisableCaching</span></a><span class="Other">(</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">compileTime</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
<p>Disable caching of generated Nim code - useful during wrapper development</p>
|
|
<p>If files included by header being processed by <a class="reference external" href="cimport.html#cImport.m,">cImport()</a> change and affect the generated content, they will be ignored and the cached value will continue to be used . Use <a class="reference external" href="cimport.html#cDisableCaching,">cDisableCaching()</a> to avoid this scenario during development.</p>
|
|
<p><tt class="docutils literal"><span class="pre">nim -f</span></tt> was broken prior to 0.19.4 but can also be used to flush the cached content.</p>
|
|
|
|
|
|
</dd>
|
|
<a id="cAddSearchDir,string"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#cAddSearchDir%2Cstring"><span class="Identifier">cAddSearchDir</span></a><span class="Other">(</span><span class="Identifier">dir</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">compileTime</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
Add directory <tt class="docutils literal"><span class="pre">dir</span></tt> to the search path used in calls to <a class="reference external" href="cimport.html#cSearchPath,string">cSearchPath()</a>.
|
|
<p><strong class="examples_text">Examples:</strong></p>
|
|
<pre class="listing"><span class="Keyword">import</span>
|
|
<span class="Identifier">paths</span><span class="Other">,</span> <span class="Identifier">os</span>
|
|
|
|
<span class="Keyword">static</span> <span class="Other">:</span>
|
|
<span class="Identifier">cAddSearchDir</span> <span class="Identifier">testsIncludeDir</span><span class="Other">(</span><span class="Other">)</span>
|
|
<span class="Identifier">doAssert</span> <span class="Identifier">cSearchPath</span><span class="Other">(</span><span class="StringLit">"test.h"</span><span class="Other">)</span><span class="Other">.</span><span class="Identifier">existsFile</span></pre>
|
|
|
|
</dd>
|
|
<a id="cAddStdDir,string"></a>
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#cAddStdDir%2Cstring"><span class="Identifier">cAddStdDir</span></a><span class="Other">(</span><span class="Identifier">mode</span> <span class="Other">=</span> <span class="StringLit">"c"</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">compileTime</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
|
|
<dd>
|
|
Add the standard <tt class="docutils literal"><span class="pre">c</span></tt> [default] or <tt class="docutils literal"><span class="pre">cpp</span></tt> include paths to search path used in calls to <a class="reference external" href="cimport.html#cSearchPath,string">cSearchPath()</a>
|
|
<p><strong class="examples_text">Examples:</strong></p>
|
|
<pre class="listing"><span class="Keyword">static</span> <span class="Other">:</span>
|
|
<span class="Identifier">cAddStdDir</span><span class="Other">(</span><span class="Other">)</span>
|
|
<span class="Keyword">import</span>
|
|
<span class="Identifier">os</span>
|
|
|
|
<span class="Identifier">doAssert</span> <span class="Identifier">cSearchPath</span><span class="Other">(</span><span class="StringLit">"math.h"</span><span class="Other">)</span><span class="Other">.</span><span class="Identifier">existsFile</span></pre>
|
|
|
|
</dd>
|
|
|
|
</dl></div>
|
|
<div class="section" id="17">
|
|
<h1><a class="toc-backref" href="#17">Macros</a></h1>
|
|
<dl class="item">
|
|
<a id="cOverride.m"></a>
|
|
<dt><pre><span class="Keyword">macro</span> <a href="#cOverride.m"><span class="Identifier">cOverride</span></a><span class="Other">(</span><span class="Identifier">body</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
|
|
<dd>
|
|
<p>When the wrapper code generated by nimterop is missing certain symbols or not accurate, it may be required to hand wrap them. Define them in a <a class="reference external" href="cimport.html#cOverride.m,">cOverride()</a> macro block so that Nimterop no longer defines these symbols.</p>
|
|
<p>For example:</p>
|
|
<pre class="listing"><span class="Keyword">int</span> <span class="Identifier">svGetCallerInfo</span><span class="Punctuation">(</span><span class="Keyword">const</span> <span class="Keyword">char</span><span class="Operator">**</span> <span class="Identifier">fileName</span><span class="Punctuation">,</span> <span class="Keyword">int</span> <span class="Operator">*</span><span class="Identifier">lineNumber</span><span class="Punctuation">)</span><span class="Punctuation">;</span></pre><p>This might map to:</p>
|
|
<pre class="listing"><span class="Keyword">proc</span> <span class="Identifier">svGetCallerInfo</span><span class="Punctuation">(</span><span class="Identifier">fileName</span><span class="Punctuation">:</span> <span class="Keyword">ptr</span> <span class="Identifier">cstring</span><span class="Punctuation">;</span> <span class="Identifier">lineNumber</span><span class="Punctuation">:</span> <span class="Keyword">var</span> <span class="Identifier">cint</span><span class="Punctuation">)</span></pre><p>Whereas it might mean:</p>
|
|
<pre class="listing"><span class="Identifier">cOverride</span><span class="Punctuation">:</span>
|
|
<span class="Keyword">proc</span> <span class="Identifier">svGetCallerInfo</span><span class="Punctuation">(</span><span class="Identifier">fileName</span><span class="Punctuation">:</span> <span class="Keyword">var</span> <span class="Identifier">cstring</span><span class="Punctuation">;</span> <span class="Identifier">lineNumber</span><span class="Punctuation">:</span> <span class="Keyword">var</span> <span class="Identifier">cint</span><span class="Punctuation">)</span></pre><p>Using the <a class="reference external" href="cimport.html#cOverride.m,">cOverride()</a> block, nimterop can be instructed to skip over <tt class="docutils literal"><span class="pre">svGetCallerInfo()</span></tt>. This works for procs, consts and types.</p>
|
|
|
|
|
|
</dd>
|
|
<a id="cPlugin.m"></a>
|
|
<dt><pre><span class="Keyword">macro</span> <a href="#cPlugin.m"><span class="Identifier">cPlugin</span></a><span class="Other">(</span><span class="Identifier">body</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
|
|
<dd>
|
|
When <a class="reference external" href="cimport.html#cOverride.m,">cOverride()</a> and <a class="reference external" href="cimport.html#cSkipSymbol.m%2Cseq[string]">cSkipSymbol()</a> are not adequate, the <a class="reference external" href="cimport.html#cPlugin.m,">cPlugin()</a> macro can be used to customize the generated Nim output. The following callbacks are available at this time.<pre class="listing"><span class="Keyword">proc</span> <span class="Identifier">onSymbol</span><span class="Punctuation">(</span><span class="Identifier">sym</span><span class="Punctuation">:</span> <span class="Keyword">var</span> <span class="Identifier">Symbol</span><span class="Punctuation">)</span> <span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">exportc</span><span class="Punctuation">,</span> <span class="Identifier">dynlib</span><span class="Operator">.</span><span class="Punctuation">}</span></pre><p><tt class="docutils literal"><span class="pre">onSymbol()</span></tt> can be used to handle symbol name modifications required due to invalid characters like leading/trailing <tt class="docutils literal"><span class="pre">_</span></tt> or rename symbols that would clash due to Nim's style insensitivity. It can also be used to remove prefixes and suffixes like <tt class="docutils literal"><span class="pre">SDL_</span></tt>. The symbol name and type is provided to the callback and the name can be modified.</p>
|
|
<p>Returning a blank name will result in the symbol being skipped. This will fail for <tt class="docutils literal"><span class="pre">nskParam</span></tt> and <tt class="docutils literal"><span class="pre">nskField</span></tt> since the generated Nim code will be wrong.</p>
|
|
<p>Symbol types can be any of the following:</p>
|
|
<ul class="simple"><li><tt class="docutils literal"><span class="pre">nskConst</span></tt> for constants</li>
|
|
<li><tt class="docutils literal"><span class="pre">nskType</span></tt> for type identifiers, including primitive</li>
|
|
<li><tt class="docutils literal"><span class="pre">nskParam</span></tt> for param names</li>
|
|
<li><tt class="docutils literal"><span class="pre">nskField</span></tt> for struct field names</li>
|
|
<li><tt class="docutils literal"><span class="pre">nskEnumField</span></tt> for enum (field) names, though they are in the global namespace as <tt class="docutils literal"><span class="pre">nskConst</span></tt></li>
|
|
<li><tt class="docutils literal"><span class="pre">nskProc</span></tt> - for proc names</li>
|
|
</ul>
|
|
<p><tt class="docutils literal"><span class="pre">nimterop/plugins</span></tt> is implicitly imported to provide access to standard plugin facilities.</p>
|
|
|
|
<p><strong class="examples_text">Examples:</strong></p>
|
|
<pre class="listing"><span class="Identifier">cPlugin</span><span class="Other">:</span>
|
|
<span class="Keyword">import</span>
|
|
<span class="Identifier">strutils</span>
|
|
|
|
<span class="Keyword">proc</span> <span class="Identifier">onSymbol</span><span class="Operator">*</span><span class="Other">(</span><span class="Identifier">sym</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">Symbol</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">exportc</span><span class="Other">,</span> <span class="Identifier">dynlib</span></span><span class="Other">.}</span></span> <span class="Other">=</span>
|
|
<span class="Identifier">sym</span><span class="Other">.</span><span class="Identifier">name</span> <span class="Other">=</span> <span class="Identifier">sym</span><span class="Other">.</span><span class="Identifier">name</span><span class="Other">.</span><span class="Identifier">strip</span><span class="Other">(</span><span class="Identifier">chars</span> <span class="Other">=</span> <span class="Other">{</span><span class="CharLit">'_'</span><span class="Other">}</span><span class="Other">)</span>
|
|
</pre>
|
|
<p><strong class="examples_text">Examples:</strong></p>
|
|
<pre class="listing"><span class="Identifier">cPlugin</span><span class="Other">:</span>
|
|
<span class="Keyword">import</span>
|
|
<span class="Identifier">strutils</span>
|
|
|
|
<span class="Keyword">proc</span> <span class="Identifier">onSymbol</span><span class="Operator">*</span><span class="Other">(</span><span class="Identifier">sym</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">Symbol</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">exportc</span><span class="Other">,</span> <span class="Identifier">dynlib</span></span><span class="Other">.}</span></span> <span class="Other">=</span>
|
|
<span class="Keyword">if</span> <span class="Identifier">sym</span><span class="Other">.</span><span class="Identifier">kind</span> <span class="Operator">==</span> <span class="Identifier">nskProc</span> <span class="Keyword">and</span> <span class="Identifier">sym</span><span class="Other">.</span><span class="Identifier">name</span><span class="Other">.</span><span class="Identifier">contains</span><span class="Other">(</span><span class="StringLit">"SDL_"</span><span class="Other">)</span><span class="Other">:</span>
|
|
<span class="Identifier">sym</span><span class="Other">.</span><span class="Identifier">name</span> <span class="Other">=</span> <span class="Identifier">sym</span><span class="Other">.</span><span class="Identifier">name</span><span class="Other">.</span><span class="Identifier">replace</span><span class="Other">(</span><span class="StringLit">"SDL_"</span><span class="Other">,</span> <span class="StringLit">""</span><span class="Other">)</span>
|
|
</pre>
|
|
|
|
</dd>
|
|
<a id="cDefine.m,,string"></a>
|
|
<dt><pre><span class="Keyword">macro</span> <a href="#cDefine.m%2C%2Cstring"><span class="Identifier">cDefine</span></a><span class="Other">(</span><span class="Identifier">name</span><span class="Other">:</span> <span class="Identifier">static</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">val</span><span class="Other">:</span> <span class="Identifier">static</span> <span class="Identifier">string</span> <span class="Other">=</span> <span class="StringLit">""</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
|
|
<dd>
|
|
<tt class="docutils literal"><span class="pre">#define</span></tt> an identifer that is forwarded to the C/C++ compiler using <tt class="docutils literal"><span class="pre">{.passC: "-DXXX".}</span></tt>
|
|
|
|
</dd>
|
|
<a id="cIncludeDir.m"></a>
|
|
<dt><pre><span class="Keyword">macro</span> <a href="#cIncludeDir.m"><span class="Identifier">cIncludeDir</span></a><span class="Other">(</span><span class="Identifier">dir</span><span class="Other">:</span> <span class="Identifier">static</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
|
|
<dd>
|
|
Add an include directory that is forwarded to the C/C++ compiler using <tt class="docutils literal"><span class="pre">{.passC: "-IXXX".}</span></tt>. This is also provided to the preprocessor during Nim code generation.
|
|
|
|
</dd>
|
|
<a id="cCompile.m,,string,string"></a>
|
|
<dt><pre><span class="Keyword">macro</span> <a href="#cCompile.m%2C%2Cstring%2Cstring"><span class="Identifier">cCompile</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <span class="Identifier">static</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">mode</span> <span class="Other">=</span> <span class="StringLit">"c"</span><span class="Other">;</span> <span class="Identifier">exclude</span> <span class="Other">=</span> <span class="StringLit">""</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
|
|
<dd>
|
|
<p>Compile and link C/C++ implementation into resulting binary using <tt class="docutils literal"><span class="pre">{.compile.}</span></tt></p>
|
|
<p><tt class="docutils literal"><span class="pre">path</span></tt> can be a specific file or contain wildcards:</p>
|
|
<pre class="listing"><span class="Identifier">cCompile</span><span class="Punctuation">(</span><span class="StringLit">"file.c"</span><span class="Punctuation">)</span>
|
|
<span class="Identifier">cCompile</span><span class="Punctuation">(</span><span class="StringLit">"path/to/*.c"</span><span class="Punctuation">)</span></pre><p><tt class="docutils literal"><span class="pre">mode</span></tt> recursively searches for code files in <tt class="docutils literal"><span class="pre">path</span></tt>.</p>
|
|
<p><tt class="docutils literal"><span class="pre">c</span></tt> searches for <tt class="docutils literal"><span class="pre">*.c</span></tt> whereas <tt class="docutils literal"><span class="pre">cpp</span></tt> searches for <tt class="docutils literal"><span class="pre">*.C *.cpp *.c++ *.cc *.cxx</span></tt></p>
|
|
<pre class="listing"><span class="Identifier">cCompile</span><span class="Punctuation">(</span><span class="StringLit">"path/to/dir"</span><span class="Punctuation">,</span> <span class="StringLit">"cpp"</span><span class="Punctuation">)</span></pre><p><tt class="docutils literal"><span class="pre">exclude</span></tt> can be used to exclude files by partial string match. Comma separated to specify multiple exclude strings</p>
|
|
<pre class="listing"><span class="Identifier">cCompile</span><span class="Punctuation">(</span><span class="StringLit">"path/to/dir"</span><span class="Punctuation">,</span> <span class="Identifier">exclude</span><span class="Operator">=</span><span class="StringLit">"test2.c"</span><span class="Punctuation">)</span></pre>
|
|
|
|
</dd>
|
|
<a id="cImport.m"></a>
|
|
<dt><pre><span class="Keyword">macro</span> <a href="#cImport.m"><span class="Identifier">cImport</span></a><span class="Other">(</span><span class="Identifier">filename</span><span class="Other">:</span> <span class="Identifier">static</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">recurse</span><span class="Other">:</span> <span class="Identifier">static</span> <span class="Identifier">bool</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
|
|
<dd>
|
|
<p>Import all supported definitions from specified header file. Generated content is cached in <tt class="docutils literal"><span class="pre">nimcache</span></tt> until <tt class="docutils literal"><span class="pre">filename</span></tt> changes unless <a class="reference external" href="cimport.html#cDisableCaching,">cDisableCaching()</a> is set. <tt class="docutils literal"><span class="pre">nim -f</span></tt> can also be used after Nim v0.19.4 to flush the cache.</p>
|
|
<p><tt class="docutils literal"><span class="pre">recurse</span></tt> can be used to generate Nim wrappers from <tt class="docutils literal"><span class="pre">#include</span></tt> files referenced in <tt class="docutils literal"><span class="pre">filename</span></tt>. This is only done for files in the same directory as <tt class="docutils literal"><span class="pre">filename</span></tt> or in a directory added using <a class="reference external" href="cimport.html#cIncludeDir.m,">cIncludeDir()</a></p>
|
|
|
|
|
|
</dd>
|
|
|
|
</dl></div>
|
|
<div class="section" id="19">
|
|
<h1><a class="toc-backref" href="#19">Exports</a></h1>
|
|
<dl class="item">
|
|
<a class="reference external" href="types.html">types</a>, <a href="types.html#enumOp"><span class="Identifier">enumOp</span></a>, <a href="types.html#defineEnum"><span class="Identifier">defineEnum</span></a>, <a href="types.html#time_t"><span class="Identifier">time_t</span></a>, <a href="types.html#va_list"><span class="Identifier">va_list</span></a>, <a href="types.html#ptrdiff_t"><span class="Identifier">ptrdiff_t</span></a>
|
|
</dl></div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="twelve-columns footer">
|
|
<span class="nim-sprite"></span>
|
|
<br/>
|
|
<small>Made with Nim. Generated: 2019-04-11 03:28:45 UTC</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|