1 | <html> |
---|
2 | <head> |
---|
3 | <!-- Generated by the Spirit (http://spirit.sf.net) QuickDoc --> |
---|
4 | <title>Introduction</title> |
---|
5 | <link rel="stylesheet" href="theme/style.css" type="text/css"> |
---|
6 | <link rel="next" href="running_pyste.html"> |
---|
7 | </head> |
---|
8 | <body> |
---|
9 | <table width="100%" height="48" border="0" cellspacing="2"> |
---|
10 | <tr> |
---|
11 | <td><img src="../../../../boost.png"> |
---|
12 | </td> |
---|
13 | <td width="85%"> |
---|
14 | <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Introduction</b></font> |
---|
15 | </td> |
---|
16 | </tr> |
---|
17 | </table> |
---|
18 | <br> |
---|
19 | <table border="0"> |
---|
20 | <tr> |
---|
21 | <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> |
---|
22 | <td width="30"><img src="theme/l_arr_disabled.gif" border="0"></td> |
---|
23 | <td width="20"><a href="running_pyste.html"><img src="theme/r_arr.gif" border="0"></a></td> |
---|
24 | </tr> |
---|
25 | </table> |
---|
26 | <a name="what_is_pyste_"></a><h2>What is Pyste?</h2><p> |
---|
27 | Pyste is a <a href="../../index.html"> |
---|
28 | Boost.Python</a> code generator. The user specifies the classes and |
---|
29 | functions to be exported using a simple <i>interface file</i>, which following the |
---|
30 | <a href="../../index.html"> |
---|
31 | Boost.Python</a>'s philosophy, is simple Python code. Pyste then uses <a href="http://www.gccxml.org"> |
---|
32 | GCCXML</a> to |
---|
33 | parse all the headers and extract the necessary information to automatically |
---|
34 | generate C++ code.</p> |
---|
35 | <a name="example"></a><h2>Example</h2><p> |
---|
36 | Let's borrow the class <tt>World</tt> from the <a href="../../doc/tutorial/doc/html/python/exposing.html"> |
---|
37 | tutorial</a>: </p> |
---|
38 | <code><pre> |
---|
39 | <span class=keyword>struct </span><span class=identifier>World |
---|
40 | </span><span class=special>{ |
---|
41 | </span><span class=keyword>void </span><span class=identifier>set</span><span class=special>(</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string </span><span class=identifier>msg</span><span class=special>) { </span><span class=keyword>this</span><span class=special>-></span><span class=identifier>msg </span><span class=special>= </span><span class=identifier>msg</span><span class=special>; } |
---|
42 | </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string </span><span class=identifier>greet</span><span class=special>() { </span><span class=keyword>return </span><span class=identifier>msg</span><span class=special>; } |
---|
43 | </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string </span><span class=identifier>msg</span><span class=special>; |
---|
44 | }; |
---|
45 | </span></pre></code> |
---|
46 | <p> |
---|
47 | Here's the interface file for it, named <tt>world.pyste</tt>:</p> |
---|
48 | <code><pre> |
---|
49 | <span class=identifier>Class</span><span class=special>(</span><span class=string>"World"</span><span class=special>, </span><span class=string>"world.h"</span><span class=special>) |
---|
50 | </span></pre></code> |
---|
51 | <p> |
---|
52 | and that's it!</p> |
---|
53 | <p> |
---|
54 | The next step is invoke Pyste in the command-line:</p> |
---|
55 | <code><pre>python pyste.py --module=hello world.pyste</pre></code><p> |
---|
56 | this will create a file "<tt>hello.cpp</tt>" in the directory where the command was |
---|
57 | run. </p> |
---|
58 | <p> |
---|
59 | Pyste supports the following features:</p> |
---|
60 | <ul><li>Functions</li><li>Classes</li><li>Class Templates</li><li>Virtual Methods</li><li>Overloading</li><li>Attributes </li><li>Enums (both "free" enums and class enums)</li><li>Nested Classes</li><li>Support for <tt>boost::shared_ptr</tt> and <tt>std::auto_ptr</tt></li><li>Global Variables</li></ul><table border="0"> |
---|
61 | <tr> |
---|
62 | <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> |
---|
63 | <td width="30"><img src="theme/l_arr_disabled.gif" border="0"></td> |
---|
64 | <td width="20"><a href="running_pyste.html"><img src="theme/r_arr.gif" border="0"></a></td> |
---|
65 | </tr> |
---|
66 | </table> |
---|
67 | <br> |
---|
68 | <hr size="1"><p class="copyright">Copyright © 2003 Bruno da Silva de Oliveira<br>Copyright © 2002-2003 Joel de Guzman<br><br> |
---|
69 | <font size="2">Distributed under |
---|
70 | the Boost Software License, Version 1.0. (See accompanying file |
---|
71 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) </font> </p> |
---|
72 | </body> |
---|
73 | </html> |
---|