-
Notifications
You must be signed in to change notification settings - Fork 1
/
tutorial.html
648 lines (586 loc) · 53.3 KB
/
tutorial.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tutorial — xdress 0.4 documentation</title>
<link rel="stylesheet" href="_static/numpy_friendly.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Noticia+Text|Open+Sans|Droid+Sans+Mono" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '0.4',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/jquery.cookie.js"></script>
<script type="text/javascript" src="_static/cloud.js"></script>
<link rel="top" title="xdress 0.4 documentation" href="index.html" />
<link rel="next" title="mypack" href="mypack/index.html" />
<link rel="prev" title="XDress" href="index.html" />
<meta name="viewport" content="width=device-width, initial-scale=1"><script type="text/javascript">
var ga_enabled = !$.cookie('disable-ga');
if(ga_enabled){
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-41934829-1']);
_gaq.push(['_setCookiePath', '/']);
_gaq.push(['_setDetectFlash', false]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
}
</script>
</head>
<body>
<div class="relbar-top">
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> </li>
<li class="right" >
<a href="np-modindex.html" title="Python Module Index"
>modules</a> </li>
<li class="right" >
<a href="mypack/index.html" title="mypack"
accesskey="N">next</a> </li>
<li class="right" >
<a href="index.html" title="XDress"
accesskey="P">previous</a> </li>
<li><a href="index.html">xdress 0.4 documentation</a> »</li>
</ul>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="tutorial">
<span id="id1"></span><h1>Tutorial<a class="headerlink" href="#tutorial" title="Permalink to this headline">¶</a></h1>
<p>At its core, xdress is type system on which code generation utilities are written.
These utilities may be executed via the <tt class="docutils literal"><span class="pre">xdress</span></tt> command line interface. This
tutorial presents a brief walk through of the type system, the STL container wrapper
generator, and the C/C++ API wrapper generator.</p>
<div class="section" id="the-type-system">
<h2>The Type System<a class="headerlink" href="#the-type-system" title="Permalink to this headline">¶</a></h2>
<p>XDress provides an interface for denoting, describing, and converting
between various data types and the types coming from various systems. This is
achieved by providing canonical abstractions of various kinds of types:</p>
<ul class="simple">
<li>Base types (int, str, float, non-templated classes)</li>
<li>Refined types (even or odd ints, strings containing the letter ‘a’)</li>
<li>Dependent types (templates such arrays, maps, sets, vectors)</li>
</ul>
<p>All types are known by their name (a string identifier) and may be aliased with
other names. However, the string id of a type is not sufficient to fully describe
most types. The system here implements a canonical form for all kinds of types.
This canonical form is itself hashable, being comprised only of strings, ints,
and tuples.</p>
<p>These canonical forms are covered in detail in the <a class="reference internal" href="libref/typesystem.html#xdress-typesystem"><em>Type System</em></a>
documentation. However, what are more important and useful from an end-user
perspective are the short hand notations that should be used by mortals:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c"># Base type are just their names</span>
<span class="s">'str'</span>
<span class="s">'int32'</span>
<span class="s">'float64'</span>
<span class="c"># Aliases may also be used</span>
<span class="s">'f4'</span> <span class="c"># -> 'float32'</span>
<span class="s">'uint'</span> <span class="c"># -> 'uint32'</span>
<span class="s">'float'</span> <span class="c"># -> 'float64'</span>
<span class="c"># Length-1 tuples expand to have scalar predicates</span>
<span class="p">(</span><span class="s">'int32'</span><span class="p">,)</span> <span class="c"># -> ('int32', 0)</span>
<span class="c"># Refinement types may be listed by name only</span>
<span class="s">'posint'</span> <span class="c"># -> ('int32', 'posint')</span>
<span class="c"># Templates are given within tuples</span>
<span class="p">(</span><span class="s">'set'</span><span class="p">,</span> <span class="s">'str'</span><span class="p">)</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'i4'</span><span class="p">,</span> <span class="s">'float'</span><span class="p">)</span>
<span class="c"># As are dependencies values</span>
<span class="p">(</span><span class="s">'intrange'</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="p">(</span><span class="s">'range'</span><span class="p">,</span> <span class="s">'int32'</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="c"># And any combination of the above!</span>
<span class="p">((</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'posint'</span><span class="p">,</span> <span class="p">(</span><span class="s">'set'</span><span class="p">,</span> <span class="p">(</span><span class="s">'intrange'</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">))),)</span>
</pre></div>
</div>
</div>
<div class="section" id="stl-containers-stlwrap">
<h2>STL Containers (stlwrap)<a class="headerlink" href="#stl-containers-stlwrap" title="Permalink to this headline">¶</a></h2>
<p>The first tool we discuss is the C++ STL container wrapper generator. This tool
relies solely on the type system. XDress is governed by a run control file, called
<tt class="docutils literal"><span class="pre">xdressrc.py</span></tt> by default. This is a pure Python file that should be placed
in the directory where you will run the <tt class="docutils literal"><span class="pre">xdress</span></tt> command. A simple stlwrap run
control file would contain the following variables.</p>
<p><strong>xdressrc.py</strong>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">package</span> <span class="o">=</span> <span class="s">'mypack'</span> <span class="c"># top-level python package name</span>
<span class="n">packagedir</span> <span class="o">=</span> <span class="s">'mypack'</span> <span class="c"># location of the python package</span>
<span class="n">stlcontainers</span> <span class="o">=</span> <span class="p">[</span>
<span class="p">(</span><span class="s">'vector'</span><span class="p">,</span> <span class="s">'str'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'set'</span><span class="p">,</span> <span class="s">'uint'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="s">'float'</span><span class="p">),</span>
<span class="p">]</span>
<span class="c"># will be used later, but need to be present now</span>
<span class="n">classes</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">functions</span> <span class="o">=</span> <span class="p">[]</span>
</pre></div>
</div>
<p>This would tell <tt class="docutils literal"><span class="pre">xdress</span></tt> to generate a numpy dtype for <tt class="docutils literal"><span class="pre">std::string</span></tt> (to be used
with normal numpy arrays), a wrapper class for <tt class="docutils literal"><span class="pre">std::set<unsigned</span> <span class="pre">int></span></tt>, and a
wrapper class for <tt class="docutils literal"><span class="pre">std::map<int,</span> <span class="pre">double></span></tt>. Suppose we started with an empty
project,</p>
<div class="highlight-bash"><div class="highlight"><pre>scopatz@ares ~/mypack <span class="nv">$ </span>mkdir src
scopatz@ares ~/mypack <span class="nv">$ </span>mkdir mypack
scopatz@ares ~/mypack <span class="nv">$ </span>ls *
xdressrc.py
mypack:
__init__.py
src:
</pre></div>
</div>
<p>We would then run xdress to execute stlwrap. This then generates the following
files:</p>
<div class="highlight-bash"><div class="highlight"><pre>scopatz@ares ~/mypack <span class="nv">$ </span>xdress
generating C++ standard library wrappers & converters
scopatz@ares ~/mypack <span class="nv">$ </span>ls *
xdressrc.py
mypack:
stlcontainers.pxd stlcontainers.pyx tests xdress_extra_types.pxd
xdress_extra_types.pyx __init__.pxd __init__.py
src:
xdress_extra_types.h
</pre></div>
</div>
<p>It is then our job to pass these files off to Cython and a C++ compiler, typically
as part of a larger build system.</p>
</div>
<div class="section" id="c-c-api-generation-cythongen">
<h2>C/C++ API Generation (cythongen)<a class="headerlink" href="#c-c-api-generation-cythongen" title="Permalink to this headline">¶</a></h2>
<p>The next tool that is built off of the xdress type system may be used for
automatically creating Python wrappers of C/C++ APIs. This requires that the user
has GCC-XML and lxml installed are their system. Now suppose we had some C++ code
living in the <tt class="docutils literal"><span class="pre">src/</span></tt> directory.</p>
<p><strong>src/hoover.h</strong>:</p>
<div class="highlight-cpp"><div class="highlight"><pre><span class="cp">#if !defined(HOOVER)</span>
<span class="cp">#define HOOVER</span>
<span class="cp">#include <map></span>
<span class="k">namespace</span> <span class="n">hoover</span> <span class="p">{</span>
<span class="k">class</span> <span class="nc">A</span><span class="p">{</span>
<span class="nl">public:</span>
<span class="n">A</span><span class="p">(</span><span class="kt">int</span> <span class="n">x</span><span class="o">=</span><span class="mi">5</span><span class="p">);</span>
<span class="o">~</span><span class="n">A</span><span class="p">();</span>
<span class="n">std</span><span class="o">::</span><span class="n">map</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="kt">double</span><span class="o">></span> <span class="n">y</span><span class="p">;</span>
<span class="p">};</span>
<span class="k">class</span> <span class="nc">B</span> <span class="o">:</span> <span class="k">public</span> <span class="n">A</span> <span class="p">{</span>
<span class="nl">public:</span>
<span class="n">B</span><span class="p">();</span>
<span class="o">~</span><span class="n">B</span><span class="p">();</span>
<span class="kt">int</span> <span class="n">z</span><span class="p">;</span>
<span class="p">};</span>
<span class="kt">void</span> <span class="nf">do_nothing_ab</span><span class="p">(</span><span class="n">A</span> <span class="n">a</span><span class="p">,</span> <span class="n">B</span> <span class="n">b</span><span class="p">);</span>
<span class="p">};</span>
<span class="cp">#endif</span>
</pre></div>
</div>
<p><strong>src/hoover.cpp</strong>:</p>
<div class="highlight-cpp"><div class="highlight"><pre><span class="cp">#include "hoover.h"</span>
<span class="k">namespace</span> <span class="n">hoover</span> <span class="p">{</span>
<span class="n">A</span><span class="o">::</span><span class="n">A</span><span class="p">(</span><span class="kt">int</span> <span class="n">x</span><span class="p">){</span><span class="n">y</span><span class="p">[</span><span class="n">x</span><span class="p">]</span> <span class="o">=</span> <span class="n">x</span> <span class="o">*</span> <span class="mf">42.0</span><span class="p">;};</span>
<span class="n">A</span><span class="o">::~</span><span class="n">A</span><span class="p">(){};</span>
<span class="n">B</span><span class="o">::</span><span class="n">B</span><span class="p">(){</span><span class="n">z</span><span class="o">=</span><span class="mi">3</span><span class="p">;};</span>
<span class="n">B</span><span class="o">::~</span><span class="n">B</span><span class="p">(){};</span>
<span class="kt">void</span> <span class="nf">do_nothing_ab</span><span class="p">(</span><span class="n">A</span> <span class="n">a</span><span class="p">,</span> <span class="n">B</span> <span class="n">b</span><span class="p">)</span> <span class="p">{};</span>
<span class="p">};</span> <span class="c1">// namespace hoover</span>
</pre></div>
</div>
<p>To tell xdress that we what to wrap the A & B classes and the do nothing function,
we simply need to tell xdress that they live in hoover. We do this by adding to the
<tt class="docutils literal"><span class="pre">classes</span></tt> and <tt class="docutils literal"><span class="pre">functions</span></tt> lists in the run control file.</p>
<p><strong>xdressrc.py</strong>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">classes</span> <span class="o">=</span> <span class="p">[</span>
<span class="p">(</span><span class="s">'A'</span><span class="p">,</span> <span class="s">'src/hoover.*'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'B'</span><span class="p">,</span> <span class="s">'src/hoover.*'</span><span class="p">,</span> <span class="s">'hoover_b'</span><span class="p">),</span>
<span class="p">]</span>
<span class="n">functions</span> <span class="o">=</span> <span class="p">[(</span><span class="s">'do_nothing_ab'</span><span class="p">,</span> <span class="s">'src/hoover.*'</span><span class="p">)]</span>
</pre></div>
</div>
<p>Note that to do this we need only give the construct names – no signatures need
be specified. That is the point of API generation! Also note that we only give
the base file name with the preceding <tt class="docutils literal"><span class="pre">src/</span></tt> directory and the file extension
(<tt class="docutils literal"><span class="pre">.cpp</span></tt>, <tt class="docutils literal"><span class="pre">.h</span></tt>). Strings passed in here are globbed, so we can be a little lazy.
Furthermore, the base names of the source and target files need not be the
same...even for APIs which share the same source file! We may then run
xdress normally:</p>
<div class="highlight-bash"><div class="highlight"><pre>scopatz@ares ~/mypack <span class="nv">$ </span>xdress
generating C++ standard library wrappers & converters
parsing A
registering A
parsing B
registering B
parsing B
making cython bindings
scopatz@ares ~/mypack <span class="nv">$ </span>ls *
xdressrc.py
build:
desc.cache
mypack:
cpp_hoover.pxd hoover.pyx stlcontainers.pxd xdress_extra_types.pxd
cpp_hoover_b.pxd hoover_b.pxd stlcontainers.pyx xdress_extra_types.pyx
hoover.pxd hoover_b.pyx tests __init__.pxd
__init__.py
src:
hoover.cpp hoover.h xdress_extra_types.h
</pre></div>
</div>
<p>Since C/C++ API scraping may be an expensive task for large codes or files,
the descriptions of classes and functions that are generated are stored in the
<tt class="docutils literal"><span class="pre">build/desc.cache</span></tt>. This cache is simply a pickled dictionary that maps
names, source files, and kinds to a hash of the source file and the description.
Thus API elements are not re-described if the source file has not changed.
You may view the contents of a description cache with the <tt class="docutils literal"><span class="pre">dumpdesc</span></tt> option.</p>
<div class="highlight-bash"><div class="highlight"><pre>scopatz@ares ~/mypack <span class="nv">$ </span>xdress --dumpdesc
<span class="o">{(</span><span class="s1">'A'</span>, <span class="s1">'src/hoover.cpp'</span>, <span class="s1">'class'</span><span class="o">)</span>: <span class="o">(</span><span class="s1">'54a508b1e10845f26d9888a6ad2a470e'</span>,
<span class="o">{</span><span class="s1">'attrs'</span>: <span class="o">{</span><span class="s1">'y'</span>: <span class="o">(</span><span class="s1">'map'</span>,
<span class="s1">'int32'</span>,
<span class="s1">'float64'</span><span class="o">)}</span>,
<span class="s1">'methods'</span>: <span class="o">{(</span><span class="s1">'A'</span>, <span class="o">(</span><span class="s1">'x'</span>, <span class="s1">'int32'</span>, 5<span class="o">))</span>: None,
<span class="o">(</span><span class="s1">'~A'</span>,<span class="o">)</span>: None<span class="o">}</span>,
<span class="s1">'name'</span>: <span class="s1">'A'</span>,
<span class="s1">'namespace'</span>: <span class="s1">'hoover'</span>,
<span class="s1">'parents'</span>: None<span class="o">})</span>,
<span class="o">(</span><span class="s1">'B'</span>, <span class="s1">'src/hoover.cpp'</span>, <span class="s1">'class'</span><span class="o">)</span>: <span class="o">(</span><span class="s1">'54a508b1e10845f26d9888a6ad2a470e'</span>,
<span class="o">{</span><span class="s1">'attrs'</span>: <span class="o">{</span><span class="s1">'z'</span>: <span class="s1">'int32'</span><span class="o">}</span>,
<span class="s1">'methods'</span>: <span class="o">{(</span><span class="s1">'B'</span>,<span class="o">)</span>: None,
<span class="o">(</span><span class="s1">'~B'</span>,<span class="o">)</span>: None<span class="o">}</span>,
<span class="s1">'name'</span>: <span class="s1">'B'</span>,
<span class="s1">'namespace'</span>: <span class="s1">'hoover'</span>,
<span class="s1">'parents'</span>: <span class="o">[</span><span class="s1">'A'</span><span class="o">]})</span>,
<span class="o">(</span><span class="s1">'do_nothing_ab'</span>, <span class="s1">'src/hoover.cpp'</span>, <span class="s1">'func'</span><span class="o">)</span>: <span class="o">(</span><span class="s1">'54a508b1e10845f26d9888a6ad2a470e'</span>,
<span class="o">{</span><span class="s1">'name'</span>: <span class="s1">'do_nothing_ab'</span>,
<span class="s1">'namespace'</span>: <span class="s1">'hoover'</span>,
<span class="s1">'signatures'</span>: <span class="o">{(</span><span class="s1">'do_nothing_ab'</span>, <span class="o">(</span><span class="s1">'a'</span>, <span class="s1">'A'</span><span class="o">)</span>, <span class="o">(</span><span class="s1">'b'</span>, <span class="s1">'B'</span><span class="o">))</span>: <span class="s1">'void'</span><span class="o">}})}</span>
</pre></div>
</div>
<p>Be aware that the <tt class="docutils literal"><span class="pre">y</span></tt> member variable on class <tt class="docutils literal"><span class="pre">A</span></tt> – which has type
<tt class="docutils literal"><span class="pre">map<int,</span> <span class="pre">double></span></tt> – requires that stlwrap tool also have a matching container.
Luckily, we declared <tt class="docutils literal"><span class="pre">('map',</span> <span class="pre">'int',</span> <span class="pre">'float')</span></tt> in the <tt class="docutils literal"><span class="pre">stlcontainers</span></tt> list
previously =).</p>
<p><strong>Once again, it is up to the user to integrate the files created by xdress into their
own build system.</strong> However, for the above example the following <tt class="docutils literal"><span class="pre">setup.py</span></tt> file
will work:</p>
<p><strong>setup.py</strong>:</p>
<div class="highlight-py"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">os</span>
<span class="kn">from</span> <span class="nn">distutils.core</span> <span class="kn">import</span> <span class="n">setup</span>
<span class="kn">from</span> <span class="nn">distutils.extension</span> <span class="kn">import</span> <span class="n">Extension</span>
<span class="kn">from</span> <span class="nn">Cython.Distutils</span> <span class="kn">import</span> <span class="n">build_ext</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>
<span class="n">incdirs</span> <span class="o">=</span> <span class="p">[</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">(),</span> <span class="s">'src'</span><span class="p">),</span> <span class="n">np</span><span class="o">.</span><span class="n">get_include</span><span class="p">()]</span>
<span class="n">ext_modules</span> <span class="o">=</span> <span class="p">[</span>
<span class="n">Extension</span><span class="p">(</span><span class="s">"mypack.mypack_extra_types"</span><span class="p">,</span> <span class="p">[</span><span class="s">"mypack/mypack_extra_types.pyx"</span><span class="p">],</span>
<span class="n">include_dirs</span><span class="o">=</span><span class="n">incdirs</span><span class="p">,</span> <span class="n">language</span><span class="o">=</span><span class="s">"c++"</span><span class="p">),</span>
<span class="n">Extension</span><span class="p">(</span><span class="s">"mypack.stlcontainers"</span><span class="p">,</span> <span class="p">[</span><span class="s">"mypack/stlcontainers.pyx"</span><span class="p">],</span>
<span class="n">include_dirs</span><span class="o">=</span><span class="n">incdirs</span><span class="p">,</span> <span class="n">language</span><span class="o">=</span><span class="s">"c++"</span><span class="p">),</span>
<span class="n">Extension</span><span class="p">(</span><span class="s">"mypack.hoover"</span><span class="p">,</span> <span class="p">[</span><span class="s">'src/hoover.cpp'</span><span class="p">,</span> <span class="s">"mypack/hoover.pyx"</span><span class="p">,</span> <span class="p">],</span>
<span class="n">include_dirs</span><span class="o">=</span><span class="n">incdirs</span><span class="p">,</span> <span class="n">language</span><span class="o">=</span><span class="s">"c++"</span><span class="p">),</span>
<span class="n">Extension</span><span class="p">(</span><span class="s">"mypack.hoover_b"</span><span class="p">,</span> <span class="p">[</span><span class="s">'src/hoover.cpp'</span><span class="p">,</span> <span class="s">"mypack/hoover_b.pyx"</span><span class="p">,</span> <span class="p">],</span>
<span class="n">include_dirs</span><span class="o">=</span><span class="n">incdirs</span><span class="p">,</span> <span class="n">language</span><span class="o">=</span><span class="s">"c++"</span><span class="p">),</span>
<span class="p">]</span>
<span class="n">setup</span><span class="p">(</span>
<span class="n">name</span> <span class="o">=</span> <span class="s">'mypack'</span><span class="p">,</span>
<span class="n">cmdclass</span> <span class="o">=</span> <span class="p">{</span><span class="s">'build_ext'</span><span class="p">:</span> <span class="n">build_ext</span><span class="p">},</span>
<span class="n">ext_modules</span> <span class="o">=</span> <span class="n">ext_modules</span><span class="p">,</span>
<span class="n">packages</span> <span class="o">=</span> <span class="p">[</span><span class="s">'mypack'</span><span class="p">]</span>
<span class="p">)</span>
</pre></div>
</div>
<p>Or, the following <tt class="docutils literal"><span class="pre">CMakeLists.txt</span></tt> files will work to build the modules with
<a class="reference external" href="http://cmake.org">CMake</a>.</p>
<p><strong>CMakeLists.txt</strong>:</p>
<div class="highlight-cmake"><div class="highlight"><pre><span class="nb">cmake_minimum_required</span><span class="p">(</span> <span class="s">VERSION</span> <span class="s">2.8</span> <span class="p">)</span>
<span class="nb">project</span><span class="p">(</span> <span class="s">mypack</span> <span class="p">)</span>
<span class="c"># The files in the cmake directory must also be included in your project</span>
<span class="c"># until they are merged into upstream CMake.</span>
<span class="nb">set</span><span class="p">(</span> <span class="s">CMAKE_MODULE_PATH</span> <span class="o">${</span><span class="nv">CMAKE_MODULE_PATH</span><span class="o">}</span> <span class="o">${</span><span class="nv">CMAKE_CURRENT_LIST_DIR</span><span class="o">}</span><span class="s">/cmake</span> <span class="p">)</span>
<span class="nb">include</span><span class="p">(</span> <span class="s">UseCython</span> <span class="p">)</span>
<span class="c"># With CMake, a clean separation can be made between the source tree and the</span>
<span class="c"># build tree. When all source is compiled, as with pure C/C++, the source is</span>
<span class="c"># no-longer needed in the build tree. However, with pure *.py source, the</span>
<span class="c"># source is processed directly. To handle this, we reproduce the availability</span>
<span class="c"># of the source files in the build tree.</span>
<span class="nb">add_custom_target</span><span class="p">(</span> <span class="s">ReplicatePythonSourceTree</span> <span class="s">ALL</span> <span class="o">${</span><span class="nv">CMAKE_COMMAND</span><span class="o">}</span> <span class="s">-P</span>
<span class="o">${</span><span class="nv">CMAKE_CURRENT_SOURCE_DIR</span><span class="o">}</span><span class="s">/cmake/ReplicatePythonSourceTree.cmake</span>
<span class="o">${</span><span class="nv">CMAKE_CURRENT_BINARY_DIR</span><span class="o">}</span>
<span class="s">WORKING_DIRECTORY</span> <span class="o">${</span><span class="nv">CMAKE_CURRENT_SOURCE_DIR</span><span class="o">}</span> <span class="p">)</span>
<span class="nb">include_directories</span><span class="p">(</span> <span class="o">${</span><span class="nv">CMAKE_CURRENT_SOURCE_DIR</span><span class="o">}</span><span class="s">/src</span> <span class="p">)</span>
<span class="nb">enable_testing</span><span class="p">()</span>
<span class="nb">find_file</span><span class="p">(</span> <span class="s">NOSETESTS_EXECUTABLE</span> <span class="s">nosetests</span> <span class="p">)</span>
<span class="nb">add_test</span><span class="p">(</span> <span class="s">nosetests</span> <span class="s2">"${NOSETESTS_EXECUTABLE}"</span> <span class="s">-v</span> <span class="s">--with-xunit</span> <span class="p">)</span>
<span class="nb">add_subdirectory</span><span class="p">(</span> <span class="s">mypack</span> <span class="p">)</span>
</pre></div>
</div>
<p><strong>mypack/CMakeLists.txt</strong>:</p>
<div class="highlight-cmake"><div class="highlight"><pre><span class="nb">if</span><span class="p">(</span> <span class="s">NOT</span> <span class="s">NUMPY_INCLUDE_DIR</span> <span class="p">)</span>
<span class="nb">find_package</span><span class="p">(</span> <span class="s">PythonInterp</span> <span class="p">)</span>
<span class="nb">execute_process</span><span class="p">(</span>
<span class="s">COMMAND</span> <span class="o">${</span><span class="nv">PYTHON_EXECUTABLE</span><span class="o">}</span> <span class="s">-c</span> <span class="s2">"import numpy; print(numpy.get_include())"</span>
<span class="s">OUTPUT_VARIABLE</span> <span class="s">_numpy_include</span>
<span class="s">OUTPUT_STRIP_TRAILING_WHITESPACE</span>
<span class="p">)</span>
<span class="nb">find_path</span><span class="p">(</span> <span class="s">NUMPY_INCLUDE_DIR</span> <span class="s">numpy/arrayobject.h</span>
<span class="s">HINTS</span> <span class="o">${</span><span class="nv">_numpy_include</span><span class="o">}</span> <span class="p">)</span>
<span class="nb">endif</span><span class="p">()</span>
<span class="nb">include_directories</span><span class="p">(</span> <span class="o">${</span><span class="nv">NUMPY_INCLUDE_DIR</span><span class="o">}</span> <span class="p">)</span>
<span class="nb">set</span><span class="p">(</span> <span class="s">cxx_pyx_files</span>
<span class="s">hoover_b.pyx</span>
<span class="s">hoover.pyx</span>
<span class="s">stlcontainers.pyx</span>
<span class="s">mypack_extra_types.pyx</span>
<span class="p">)</span>
<span class="nb">set_source_files_properties</span><span class="p">(</span> <span class="o">${</span><span class="nv">cxx_pyx_files</span><span class="o">}</span>
<span class="s">PROPERTIES</span> <span class="s">CYTHON_IS_CXX</span> <span class="s">TRUE</span> <span class="p">)</span>
<span class="nb">cython_add_module</span><span class="p">(</span> <span class="s">mypack_extra_types</span> <span class="s">mypack_extra_types.pyx</span><span class="p">)</span>
<span class="nb">cython_add_module</span><span class="p">(</span> <span class="s">stlcontainers</span> <span class="s">stlcontainers.pyx</span> <span class="p">)</span>
<span class="nb">cython_add_module</span><span class="p">(</span> <span class="s">hoover</span> <span class="s">hoover.pyx</span> <span class="s">../src/hoover.cpp</span> <span class="p">)</span>
<span class="nb">cython_add_module</span><span class="p">(</span> <span class="s">hoover_b</span> <span class="s">hoover_b.pyx</span> <span class="s">../src/hoover.cpp</span> <span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="code-listings">
<h2>Code Listings<a class="headerlink" href="#code-listings" title="Permalink to this headline">¶</a></h2>
<p>The following are code listings of the files generated above, since they are too
large to in-line into the tutorial text. You may also find <a class="reference external" href="https://github.com/xdress/xdress/tree/master/docs/mypack">this example implemented
in the xdress repo</a></p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="mypack/index.html">mypack</a><ul>
<li class="toctree-l2"><a class="reference internal" href="mypack/CMakeLists.txt.html">CMakeLists.txt</a></li>
<li class="toctree-l2"><a class="reference internal" href="mypack/mypack/index.html">mypack</a><ul>
<li class="toctree-l3"><a class="reference internal" href="mypack/mypack/CMakeLists.txt.html">CMakeLists.txt</a></li>
<li class="toctree-l3"><a class="reference internal" href="mypack/mypack/cpp_hoover.pxd.html">cpp_hoover.pxd</a></li>
<li class="toctree-l3"><a class="reference internal" href="mypack/mypack/cpp_hoover_b.pxd.html">cpp_hoover_b.pxd</a></li>
<li class="toctree-l3"><a class="reference internal" href="mypack/mypack/hoover.pxd.html">hoover.pxd</a></li>
<li class="toctree-l3"><a class="reference internal" href="mypack/mypack/hoover.pyx.html">hoover.pyx</a></li>
<li class="toctree-l3"><a class="reference internal" href="mypack/mypack/hoover_b.pxd.html">hoover_b.pxd</a></li>
<li class="toctree-l3"><a class="reference internal" href="mypack/mypack/hoover_b.pyx.html">hoover_b.pyx</a></li>
<li class="toctree-l3"><a class="reference internal" href="mypack/mypack/dtypes.pxd.html">dtypes.pxd</a></li>
<li class="toctree-l3"><a class="reference internal" href="mypack/mypack/dtypes.pyx.html">dtypes.pyx</a></li>
<li class="toctree-l3"><a class="reference internal" href="mypack/mypack/stlcontainers.pxd.html">stlcontainers.pxd</a></li>
<li class="toctree-l3"><a class="reference internal" href="mypack/mypack/stlcontainers.pyx.html">stlcontainers.pyx</a></li>
<li class="toctree-l3"><a class="reference internal" href="mypack/mypack/tests/index.html">tests</a><ul>
<li class="toctree-l4"><a class="reference internal" href="mypack/mypack/tests/test_dtypes.py.html">test_dtypes.py</a></li>
<li class="toctree-l4"><a class="reference internal" href="mypack/mypack/tests/test_stlcontainers.py.html">test_stlcontainers.py</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="mypack/mypack/mypack_extra_types.pxd.html">mypack_extra_types.pxd</a></li>
<li class="toctree-l3"><a class="reference internal" href="mypack/mypack/mypack_extra_types.pyx.html">mypack_extra_types.pyx</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="mypack/src/index.html">src</a><ul>
<li class="toctree-l3"><a class="reference internal" href="mypack/src/hoover.cpp.html">hoover.cpp</a></li>
<li class="toctree-l3"><a class="reference internal" href="mypack/src/hoover.h.html">hoover.h</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="mypack/setup.py.html">setup.py</a></li>
<li class="toctree-l2"><a class="reference internal" href="mypack/xdressrc.py.html">xdressrc.py</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="section" id="putting-it-all-together">
<h2>Putting It All Together<a class="headerlink" href="#putting-it-all-together" title="Permalink to this headline">¶</a></h2>
<p>The following is a more complete, realistic example of an xdressrc.py file that
one might run across in a production level environment.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">package</span> <span class="o">=</span> <span class="s">'mypack'</span> <span class="c"># top-level python package name</span>
<span class="n">packagedir</span> <span class="o">=</span> <span class="s">'mypack'</span> <span class="c"># location of the python package</span>
<span class="c"># wrappers for non-standard types (uints, complex)</span>
<span class="n">extra_types</span> <span class="o">=</span> <span class="s">'xdress_extra_types'</span>
<span class="c"># List of C++ standard library container template types</span>
<span class="c"># to instantiate and wrap with Cython. See the type</span>
<span class="c"># system documentation for more details. Note that</span>
<span class="c"># vectors are wrapped as numpy arrays of the appropriate</span>
<span class="c"># type. If the type has no corresponding primitive C++</span>
<span class="c"># type, then a new numpy dtype is created to handle it.</span>
<span class="c"># For example, this allows the wrapping of vector< vector<int> ></span>
<span class="c"># as an np.array(..., dtype=xd_vector_int).</span>
<span class="n">stlcontainers</span> <span class="o">=</span> <span class="p">[</span>
<span class="p">(</span><span class="s">'vector'</span><span class="p">,</span> <span class="s">'str'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'vector'</span><span class="p">,</span> <span class="s">'int32'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'vector'</span><span class="p">,</span> <span class="s">'complex'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'vector'</span><span class="p">,</span> <span class="s">'float32'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'vector'</span><span class="p">,</span> <span class="s">'float64'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'vector'</span><span class="p">,</span> <span class="p">(</span><span class="s">'vector'</span><span class="p">,</span> <span class="s">'float64'</span><span class="p">)),</span>
<span class="p">(</span><span class="s">'set'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'set'</span><span class="p">,</span> <span class="s">'str'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'set'</span><span class="p">,</span> <span class="s">'uint'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'set'</span><span class="p">,</span> <span class="s">'char'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'str'</span><span class="p">,</span> <span class="s">'str'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'str'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="s">'str'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'str'</span><span class="p">,</span> <span class="s">'uint'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'uint'</span><span class="p">,</span> <span class="s">'str'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'uint'</span><span class="p">,</span> <span class="s">'uint'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'str'</span><span class="p">,</span> <span class="s">'float'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="s">'bool'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="s">'char'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="s">'float'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'uint'</span><span class="p">,</span> <span class="s">'float'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="s">'complex'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="p">(</span><span class="s">'set'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">)),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="p">(</span><span class="s">'set'</span><span class="p">,</span> <span class="s">'str'</span><span class="p">)),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="p">(</span><span class="s">'set'</span><span class="p">,</span> <span class="s">'uint'</span><span class="p">)),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="p">(</span><span class="s">'set'</span><span class="p">,</span> <span class="s">'char'</span><span class="p">)),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="p">(</span><span class="s">'vector'</span><span class="p">,</span> <span class="s">'str'</span><span class="p">)),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="p">(</span><span class="s">'vector'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">)),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="p">(</span><span class="s">'vector'</span><span class="p">,</span> <span class="s">'uint'</span><span class="p">)),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="p">(</span><span class="s">'vector'</span><span class="p">,</span> <span class="s">'char'</span><span class="p">)),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="p">(</span><span class="s">'vector'</span><span class="p">,</span> <span class="s">'bool'</span><span class="p">)),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="p">(</span><span class="s">'vector'</span><span class="p">,</span> <span class="s">'float'</span><span class="p">)),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="p">(</span><span class="s">'vector'</span><span class="p">,</span> <span class="p">(</span><span class="s">'vector'</span><span class="p">,</span> <span class="s">'float64'</span><span class="p">))),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="s">'bool'</span><span class="p">)),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="s">'char'</span><span class="p">)),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="s">'float'</span><span class="p">)),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="p">(</span><span class="s">'vector'</span><span class="p">,</span> <span class="s">'bool'</span><span class="p">))),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="p">(</span><span class="s">'vector'</span><span class="p">,</span> <span class="s">'char'</span><span class="p">))),</span>
<span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="p">(</span><span class="s">'map'</span><span class="p">,</span> <span class="s">'int'</span><span class="p">,</span> <span class="p">(</span><span class="s">'vector'</span><span class="p">,</span> <span class="s">'float'</span><span class="p">))),</span>
<span class="p">]</span>
<span class="c"># name of the C++ standard library container module in</span>
<span class="c"># the packagedir</span>
<span class="c">#stlcontainers_module = 'stlcontainers' # default value</span>
<span class="c"># List of classes to wrap. These may take one of the following</span>
<span class="c"># forms:</span>
<span class="c">#</span>
<span class="c"># (classname, base source filename)</span>
<span class="c"># (classname, base source filename, base package filename)</span>
<span class="c"># (classname, base source filename, None)</span>
<span class="c">#</span>
<span class="c"># In the first case, the base source filename will be used as</span>
<span class="c"># the base package name as well. In the last case, a None value</span>
<span class="c"># will register this class for the purpose of generating other</span>
<span class="c"># APIs, but will not create the corresponding bindings. Additionally,</span>
<span class="c"># if the "xdress.autoall" plugin is enabled, you may also use an</span>
<span class="c"># asterix (or star) to tell xdress to search the source file for</span>
<span class="c"># all classes, functions, and/or variables:</span>
<span class="c">#</span>
<span class="c"># ('*', base source filename)</span>
<span class="c"># ('*', base source filename, base package filename)</span>
<span class="c"># ('*', base source filename, None)</span>
<span class="c">#</span>
<span class="c"># This is useful for wrapping larger existing libraries.</span>
<span class="n">classes</span> <span class="o">=</span> <span class="p">[</span>
<span class="p">(</span><span class="s">'FCComp'</span><span class="p">,</span> <span class="s">'src/fccomp.*'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'EnrichmentParameters'</span><span class="p">,</span> <span class="s">'src/enrichment_parameters.*'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'Enrichment'</span><span class="p">,</span> <span class="s">'src/bright_enrichment.*'</span><span class="p">,</span> <span class="s">'enrichment'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'DontWrap'</span><span class="p">,</span> <span class="s">'src/bright_enrichment.*'</span><span class="p">,</span> <span class="bp">None</span><span class="p">),</span>
<span class="p">(</span><span class="s">'Reprocess'</span><span class="p">,</span> <span class="s">'src/reprocess.*'</span><span class="p">),</span>
<span class="p">]</span>
<span class="c"># List of functions to wrap</span>
<span class="n">functions</span> <span class="o">=</span> <span class="p">[</span>
<span class="p">(</span><span class="s">'*'</span><span class="p">,</span> <span class="s">'src/reprocess.*'</span><span class="p">),</span>
<span class="p">(</span><span class="s">'fillUraniumEnrichmentDefaults'</span><span class="p">,</span> <span class="s">'src/enrichment_parameters.*'</span><span class="p">),</span>
<span class="p">]</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="index.html">
<img class="logo" src="_static/HooverJoven.jpg" alt="Logo"/>
</a></p>
<div class="sphinxlocaltoc">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Tutorial</a><ul>
<li><a class="reference internal" href="#the-type-system">The Type System</a></li>
<li><a class="reference internal" href="#stl-containers-stlwrap">STL Containers (stlwrap)</a></li>
<li><a class="reference internal" href="#c-c-api-generation-cythongen">C/C++ API Generation (cythongen)</a></li>
<li><a class="reference internal" href="#code-listings">Code Listings</a><ul>
</ul>
</li>
<li><a class="reference internal" href="#putting-it-all-together">Putting It All Together</a></li>
</ul>
</li>
</ul>
</div>
<h4>Previous topic</h4>
<p class="topless"><a href="index.html"
title="previous chapter">XDress</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="mypack/index.html"
title="next chapter">mypack</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/tutorial.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="relbar-bottom">
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> </li>
<li class="right" >
<a href="np-modindex.html" title="Python Module Index"
>modules</a> </li>
<li class="right" >
<a href="mypack/index.html" title="mypack"
>next</a> </li>
<li class="right" >
<a href="index.html" title="XDress"
>previous</a> </li>
<li><a href="index.html">xdress 0.4 documentation</a> »</li>
</ul>
</div>
</div>
<div class="footer">
© Copyright 2013, Anthony Scopatz.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div><script type="text/javascript">
if(ga_enabled){
document.write("<div class=\"footer\">This page uses <a href=\"http://analytics.google.com\">Google Analytics</a> to collect statistics. ");
document.write("Click <button title=\"set cookie to disable analytics for this site\" class=\"link\" onclick=\"$.cookie('disable-ga', 'true', {expires: 3650, path: '/'}); window.location.reload(); return false; \">here</button> to disable analytics for this site.");
document.write("</div>");
}else{
document.write("<div class=\"footer\">Google Analytics has been disabled. ");
document.write("Click <button title=\"set cookie to re-enable analytics for this site\" class=\"link\" onclick=\"$.cookie('disable-ga', null, {path: '/'}); window.location.reload(); return false; \">here</button> to re-enable analytics for this site.");
};
</script>
<!-- cloud_sptheme 1.4 -->
</body>
</html>