Update documentation
This commit is contained in:
parent
674f008fe8
commit
8869e0013f
6 changed files with 1340 additions and 9 deletions
45
cimport.html
45
cimport.html
|
|
@ -1265,6 +1265,8 @@ function main() {
|
|||
title="cOverride(body): untyped"><wbr />c<wbr />Override<span class="attachedType" style="visibility:hidden"></span></a></li>
|
||||
<li><a class="reference" href="#cSkipSymbol.m%2Cvarargs%5Bstring%5D"
|
||||
title="cSkipSymbol(skips: varargs[string]): untyped"><wbr />c<wbr />Skip<wbr />Symbol<span class="attachedType" style="visibility:hidden"></span></a></li>
|
||||
<li><a class="reference" href="#cPlugin.m%2C"
|
||||
title="cPlugin(body): untyped"><wbr />c<wbr />Plugin<span class="attachedType" style="visibility:hidden"></span></a></li>
|
||||
<li><a class="reference" href="#cDebug.m%2C"
|
||||
title="cDebug(): untyped"><wbr />c<wbr />Debug<span class="attachedType" style="visibility:hidden"></span></a></li>
|
||||
<li><a class="reference" href="#cDisableCaching.m%2C"
|
||||
|
|
@ -1299,7 +1301,7 @@ function main() {
|
|||
<div class="section" id="6">
|
||||
<h1><a class="toc-backref" href="#6">Imports</a></h1>
|
||||
<dl class="item">
|
||||
<a class="reference external" href="types.html">types</a>
|
||||
<a class="reference external" href="plugin.html">plugin</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>
|
||||
|
|
@ -1322,7 +1324,7 @@ function main() {
|
|||
<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 could get mapped to:</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>
|
||||
|
|
@ -1332,7 +1334,34 @@ function main() {
|
|||
<a id="cSkipSymbol.m,varargs[string]"></a>
|
||||
<dt><pre><span class="Keyword">macro</span> <span class="Identifier">cSkipSymbol</span><span class="Other">(</span><span class="Identifier">skips</span><span class="Other">:</span> <span class="Identifier">varargs</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</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.<pre class="listing"><span class="Identifier">cSkipSymbol</span> <span class="StringLit">"proc1"</span><span class="Punctuation">,</span> <span class="StringLit">"Type2"</span></pre>
|
||||
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="Identifier">cSkipSymbol</span> <span class="StringLit">"proc1"</span><span class="Other">,</span> <span class="StringLit">"Type2"</span></pre>
|
||||
|
||||
</dd>
|
||||
<a id="cPlugin.m,"></a>
|
||||
<dt><pre><span class="Keyword">macro</span> <span class="Identifier">cPlugin</span><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%2Cvarargs[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><cite>onSymbol()</cite> can be used to handle symbol name modifications required due to invalid characters like leading/trailing <cite>_</cite> or rename symbols that would clash due to Nim's style insensitivity. It can also be used to remove prefixes and suffixes like <cite>SDL_</cite>. 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 <cite>nskParam</cite> and <cite>nskField</cite> since the generated Nim code will be wrong.</p>
|
||||
<p>Symbol types can be any of the following:</p>
|
||||
<ul class="simple"><li><cite>nskConst</cite> for constants</li>
|
||||
<li><cite>nskType</cite> for type identifiers, including primitive</li>
|
||||
<li><cite>nskParam</cite> for param names</li>
|
||||
<li><cite>nskField</cite> for struct field names</li>
|
||||
<li><cite>nskEnumField</cite> for enum (field) names, though they are in the global namespace as <cite>nskConst</cite></li>
|
||||
<li><cite>nskProc</cite> - for proc names</li>
|
||||
</ul>
|
||||
<p><cite>nimterop/plugins</cite> 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>
|
||||
|
||||
</dd>
|
||||
<a id="cDebug.m,"></a>
|
||||
|
|
@ -1375,9 +1404,11 @@ Add an include directory that is forwarded to the C/C++ compiler using <tt class
|
|||
<dt><pre><span class="Keyword">macro</span> <span class="Identifier">cAddStdDir</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="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
|
||||
<dd>
|
||||
<p>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>
|
||||
<p>This allows something like this:</p>
|
||||
<pre class="listing"><span class="Identifier">cAddStdDir</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
|
||||
<span class="Identifier">cImport</span> <span class="Identifier">cSearchPath</span><span class="Punctuation">(</span><span class="StringLit">"math.h"</span><span class="Punctuation">)</span></pre>
|
||||
<p>This allows something like this: </p>
|
||||
|
||||
<p><strong class="examples_text">Examples:</strong></p>
|
||||
<pre class="listing"><span class="Identifier">cAddStdDir</span><span class="Other">(</span><span class="Other">)</span>
|
||||
<span class="Identifier">echo</span> <span class="Identifier">cSearchPath</span><span class="Other">(</span><span class="StringLit">"math.h"</span><span class="Other">)</span></pre>
|
||||
|
||||
</dd>
|
||||
<a id="cCompile.m,,string"></a>
|
||||
|
|
@ -1409,7 +1440,7 @@ Add an include directory that is forwarded to the C/C++ compiler using <tt class
|
|||
<div class="twelve-columns footer">
|
||||
<span class="nim-sprite"></span>
|
||||
<br/>
|
||||
<small>Made with Nim. Generated: 2019-01-24 01:58:20 UTC</small>
|
||||
<small>Made with Nim. Generated: 2019-01-28 16:53:06 UTC</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
cOverride cimport.html#cOverride.m, cimport: cOverride(body): untyped
|
||||
cSkipSymbol cimport.html#cSkipSymbol.m,varargs[string] cimport: cSkipSymbol(skips: varargs[string]): untyped
|
||||
cPlugin cimport.html#cPlugin.m, cimport: cPlugin(body): untyped
|
||||
cSearchPath cimport.html#cSearchPath,string cimport: cSearchPath(path: string): string
|
||||
cDebug cimport.html#cDebug.m, cimport: cDebug(): untyped
|
||||
cDisableCaching cimport.html#cDisableCaching.m, cimport: cDisableCaching(): untyped
|
||||
|
|
|
|||
2
git.html
2
git.html
|
|
@ -1324,7 +1324,7 @@ function main() {
|
|||
<div class="twelve-columns footer">
|
||||
<span class="nim-sprite"></span>
|
||||
<br/>
|
||||
<small>Made with Nim. Generated: 2019-01-24 01:58:21 UTC</small>
|
||||
<small>Made with Nim. Generated: 2019-01-28 16:53:07 UTC</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
1297
plugin.html
Normal file
1297
plugin.html
Normal file
File diff suppressed because it is too large
Load diff
2
plugin.idx
Normal file
2
plugin.idx
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Symbol plugin.html#Symbol plugin: Symbol
|
||||
OnSymbol plugin.html#OnSymbol plugin: OnSymbol
|
||||
|
|
@ -1288,7 +1288,7 @@ function main() {
|
|||
<div class="twelve-columns footer">
|
||||
<span class="nim-sprite"></span>
|
||||
<br/>
|
||||
<small>Made with Nim. Generated: 2019-01-24 01:58:20 UTC</small>
|
||||
<small>Made with Nim. Generated: 2019-01-28 16:53:02 UTC</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue