Changeset 35
- Timestamp:
- 08/13/06 20:30:19 (2 years ago)
- Files:
-
- trunk/html_doc/basics.html (added)
- trunk/html_doc/celerid.html (modified) (2 diffs)
- trunk/html_doc/class_wrap.html (deleted)
- trunk/html_doc/class_wrapping.html (modified) (3 diffs)
- trunk/html_doc/conversion.html (modified) (2 diffs)
- trunk/html_doc/ctor_wrap.html (deleted)
- trunk/html_doc/def.html (deleted)
- trunk/html_doc/dg_convert.html (deleted)
- trunk/html_doc/dpyobject.html (modified) (2 diffs)
- trunk/html_doc/except_wrapping.html (modified) (1 diff)
- trunk/html_doc/exception.html (deleted)
- trunk/html_doc/ftype.html (deleted)
- trunk/html_doc/func_wrapping.html (modified) (2 diffs)
- trunk/html_doc/index.html (modified) (3 diffs)
- trunk/html_doc/make_object.html (deleted)
- trunk/html_doc/pyd.css (modified) (2 diffs)
- trunk/html_doc/pyd.html (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/html_doc/celerid.html
r34 r35 8 8 9 9 <body> 10 <div class="nav"><a class="nav" href="index.html">Main</a> | <a class="navcur" href="celerid.html">CeleriD</a> | <a class="nav" href="conversion.html">Type conversion</a> | <a class="nav" href="func_wrapping.html">Function wrapping</a> | <a class="nav" href="class_wrapping.html">Class wrapping</a> | <a class="nav" href="except_wrapping.html">Exception wrapping</a> | <a class="nav" href="dpyobject.html">DPyObject</a></div> 10 <div id="nav"> 11 <p><big>Contents</big></p> 12 <a class="nav" href="index.html">Main</a><br /> 13 <a class="nav" href="basics.html">The basics</a><br /> 14 <a class="navcur" href="celerid.html">CeleriD</a><br /> 15 <a class="nav" href="conversion.html">Type conversion</a><br /> 16 <a class="nav" href="func_wrapping.html">Function wrapping</a><br /> 17 <a class="nav" href="class_wrapping.html">Class wrapping</a><br /> 18 <a class="nav" href="except_wrapping.html">Exception wrapping</a><br /> 19 <a class="nav" href="dpyobject.html">DPyObject</a> 20 </div> 21 22 <div id="content"> 11 23 12 24 <h1>CeleriD</h1> … … 29 41 30 42 <pre class="code">>python setup.py build</pre> 43 </div> 44 31 45 </body> 32 46 </html> trunk/html_doc/class_wrapping.html
r34 r35 8 8 9 9 <body> 10 <div class="nav"><a class="nav" href="index.html">Main</a> | <a class="nav" href="celerid.html">CeleriD</a> | <a class="nav" href="conversion.html">Type conversion</a> | <a class="nav" href="func_wrapping.html">Function wrapping</a> | <a class="navcur" href="class_wrapping.html">Class wrapping</a> | <a class="nav" href="except_wrapping.html">Exception wrapping</a> | <a class="nav" href="dpyobject.html">DPyObject</a></div> 10 <div id="nav"> 11 <p><big>Contents</big></p> 12 <a class="nav" href="index.html">Main</a><br /> 13 <a class="nav" href="basics.html">The basics</a><br /> 14 <a class="nav" href="celerid.html">CeleriD</a><br /> 15 <a class="nav" href="conversion.html">Type conversion</a><br /> 16 <a class="nav" href="func_wrapping.html">Function wrapping</a><br /> 17 <a class="navcur" href="class_wrapping.html">Class wrapping</a><br /> 18 <a class="nav" href="except_wrapping.html">Exception wrapping</a><br /> 19 <a class="nav" href="dpyobject.html">DPyObject</a> 20 </div> 21 22 <div id="content"> 11 23 12 24 <h1>Class wrapping</h1> … … 50 62 51 63 <p>If you have a class <code>Foo</code>, you can check whether it is wrapped by simply checking whether <code>is_wrapped!(Foo)</code> is true. It is important to note that this is <em>not</em> a <code>const bool</code>, it is a <em>runtime</em> check.</p> 64 65 <h3>Automatic operator overloading</h3> 66 67 <p><i>Docs coming soon...</i></p> 52 68 53 69 <h3>Examples</h3> … … 105 121 >>> </pre> 106 122 123 </div> 124 107 125 </body> 108 126 </html> trunk/html_doc/conversion.html
r34 r35 8 8 9 9 <body> 10 <div class="nav"><a class="nav" href="index.html">Main</a> | <a class="nav" href="celerid.html">CeleriD</a> | <a class="navcur" href="conversion.html">Type conversion</a> | <a class="nav" href="func_wrapping.html">Function wrapping</a> | <a class="nav" href="class_wrapping.html">Class wrapping</a> | <a class="nav" href="except_wrapping.html">Exception wrapping</a> | <a class="nav" href="dpyobject.html">DPyObject</a></div> 10 <div id="nav"> 11 <p><big>Contents</big></p> 12 <a class="nav" href="index.html">Main</a><br /> 13 <a class="nav" href="basics.html">The basics</a><br /> 14 <a class="nav" href="celerid.html">CeleriD</a><br /> 15 <a class="navcur" href="conversion.html">Type conversion</a><br /> 16 <a class="nav" href="func_wrapping.html">Function wrapping</a><br /> 17 <a class="nav" href="class_wrapping.html">Class wrapping</a><br /> 18 <a class="nav" href="except_wrapping.html">Exception wrapping</a><br /> 19 <a class="nav" href="dpyobject.html">DPyObject</a> 20 </div> 21 22 <div id="content"> 11 23 12 24 <h1>Type conversion</h1> … … 59 71 This function will throw a <code>DPyConversionException</code> if the conversion is not possible.</dd> 60 72 </dl> 73 </div> 74 61 75 </body> 62 76 </html> trunk/html_doc/dpyobject.html
r34 r35 8 8 9 9 <body> 10 <div class="nav"><a class="nav" href="index.html">Main</a> | <a class="nav" href="celerid.html">CeleriD</a> | <a class="nav" href="conversion.html">Type conversion</a> | <a class="nav" href="func_wrapping.html">Function wrapping</a> | <a class="nav" href="class_wrapping.html">Class wrapping</a> | <a class="nav" href="except_wrapping.html">Exception wrapping</a> | <a class="navcur" href="dpyobject.html">DPyObject</a></div> 10 <div id="nav"> 11 <p><big>Contents</big></p> 12 <a class="nav" href="index.html">Main</a><br /> 13 <a class="nav" href="basics.html">The basics</a><br /> 14 <a class="nav" href="celerid.html">CeleriD</a><br /> 15 <a class="nav" href="conversion.html">Type conversion</a><br /> 16 <a class="nav" href="func_wrapping.html">Function wrapping</a><br /> 17 <a class="nav" href="class_wrapping.html">Class wrapping</a><br /> 18 <a class="nav" href="except_wrapping.html">Exception wrapping</a><br /> 19 <a class="navcur" href="dpyobject.html">DPyObject</a> 20 </div> 21 22 <div id="content"> 11 23 12 24 <h1>pyd.dpyobject</h1> … … 587 599 <hr /> 588 600 <small>Page generated by <a href="http://www.digitalmars.com/d/ddoc.html">Ddoc</a>.</small> 601 </div> 602 589 603 </body> 590 604 </html> trunk/html_doc/except_wrapping.html
r34 r35 8 8 9 9 <body> 10 <div class="nav"><a class="nav" href="index.html">Main</a> | <a class="nav" href="celerid.html">CeleriD</a> | <a class="nav" href="conversion.html">Type conversion</a> | <a class="nav" href="func_wrapping.html">Function wrapping</a> | <a class="nav" href="class_wrapping.html">Class wrapping</a> | <a class="navcur" href="except_wrapping.html">Exception wrapping</a> | <a class="nav" href="dpyobject.html">DPyObject</a></div> 10 <div id="nav"> 11 <p><big>Contents</big></p> 12 <a class="nav" href="index.html">Main</a><br /> 13 <a class="nav" href="basics.html">The basics</a><br /> 14 <a class="nav" href="celerid.html">CeleriD</a><br /> 15 <a class="nav" href="conversion.html">Type conversion</a><br /> 16 <a class="nav" href="func_wrapping.html">Function wrapping</a><br /> 17 <a class="nav" href="class_wrapping.html">Class wrapping</a><br /> 18 <a class="navcur" href="except_wrapping.html">Exception wrapping</a><br /> 19 <a class="nav" href="dpyobject.html">DPyObject</a> 20 </div> 21 22 <div id="content"> 11 23 12 24 <h1>Exception wrapping</h1> 13 25 14 <p><i>Coming soon...</i></p> 26 <p>The raw Python/C API has a <a href="http://docs.python.org/api/exceptionHandling.html">protocol</a> for allowing C extensions to use Python's exception mechanism. It is a goal of Pyd's that a user will never have to deal with this protocol. Instead, Pyd provides a mechanism for translating Python exceptions into D exceptions, and for translating D exceptions into Python exceptions.</p> 27 28 <p>When wrapping functions and classes, the latter is usually of more interest. All wrapped functions, methods, constructors, properties, &c, will catch any otherwise uncaught D exceptions and translate them into a Python <code>RuntimeError</code>. <i>(In the future, I may define a new Python exception type for this purpose.)</i> This is fairly important, as any uncaught D exceptions would otherwise crash the Python interpreter.</p> 29 30 <p>The <a href="dpyobject.html">DPyObject</a> class wraps a portion of the Python/C API. Whenever a Python exception is raised by a method of DPyObject, it will be thrown as a <code>PythonException</code>. This is a normal D exception that knows how to carry the complete state of a Python exception. <code>PythonException</code> objects have three properties, <code>type</code>, <code>value</code>, and <code>traceback</code>, which each return an owned reference to a <code>PyObject*</code> corresponding to a different part of a Python exception. If the <code>PythonException</code> goes uncaught, the function wrapper will catch it, and translate it back into the original Python exception.</p> 31 32 <p>Pyd provides the following exception-related functions:</p> 33 34 <dl> 35 <dt><code>void handle_exception();</code></dt> 36 <dd>This checks if a Python exception has been set and, if it has, throws a <code>PythonException</code> containing the set exception. It will also clear the Python error condition.</dd> 37 38 <dt><code>PyObject* exception_catcher(PyObject* delegate() <span class="arg">dg</span>);</code</dt> 39 <dt><code>int exception_catcher(int delegate() <span class="arg">dg</span>);</code</dt> 40 <dd>These two functions call the passed delegate within a <code>try ... catch</code> block, and if any exception occurs, will set an appropriate Python error condidition and return an "invalid" value. (These are <code>null</code> for the <code>PyObject*</code> version, -1 for the <code>int</code> version.) Otherwise, it will simply return whatever the delegate does. It is recommended that any function that interfaces directly with Python place its contents within a function literal in a call to one of these functions. (D can usually infer the return type of a function literal. If it can't, you might want to review D's syntax for <a href="http://www.digitalmars.com/d/expression.html#FunctionLiteral">function literals</a>.) For example: 41 42 <pre class="code"><span class="keyword">extern</span> (C) 43 PyObject* some_func(PyObject* self) { 44 <span class="keyword">return</span> exception_catcher({ 45 PyObject* result; 46 <span class="comment">// do something useful</span> 47 <span class="keyword">return</span> result; 48 }); 49 }</pre> 50 </dd> 51 52 </div> 15 53 16 54 </body> trunk/html_doc/func_wrapping.html
r34 r35 8 8 9 9 <body> 10 <div class="nav"><a class="nav" href="index.html">Main</a> | <a class="nav" href="celerid.html">CeleriD</a> | <a class="nav" href="conversion.html">Type conversion</a> | <a class="navcur" href="func_wrapping.html">Function wrapping</a> | <a class="nav" href="class_wrapping.html">Class wrapping</a> | <a class="nav" href="except_wrapping.html">Exception wrapping</a> | <a class="nav" href="dpyobject.html">DPyObject</a></div> 10 <div id="nav"> 11 <p><big>Contents</big></p> 12 <a class="nav" href="index.html">Main</a><br /> 13 <a class="nav" href="basics.html">The basics</a><br /> 14 <a class="nav" href="celerid.html">CeleriD</a><br /> 15 <a class="nav" href="conversion.html">Type conversion</a><br /> 16 <a class="navcur" href="func_wrapping.html">Function wrapping</a><br /> 17 <a class="nav" href="class_wrapping.html">Class wrapping</a><br /> 18 <a class="nav" href="except_wrapping.html">Exception wrapping</a><br /> 19 <a class="nav" href="dpyobject.html">DPyObject</a> 20 </div> 21 22 <div id="content"> 11 23 12 24 <h1>Function wrapping</h1> … … 76 88 s = apple</pre> 77 89 90 </div> 91 78 92 </body> 79 93 </html> trunk/html_doc/index.html
r34 r35 8 8 9 9 <body> 10 <div class="nav"><a class="navcur" href="index.html">Main</a> | <a class="nav" href="celerid.html">CeleriD</a> | <a class="nav" href="conversion.html">Type conversion</a> | <a class="nav" href="func_wrapping.html">Function wrapping</a> | <a class="nav" href="class_wrapping.html">Class wrapping</a> | <a class="nav" href="except_wrapping.html">Exception wrapping</a> | <a class="nav" href="dpyobject.html">DPyObject</a></div> 10 <div id="nav"> 11 <p><big>Contents</big></p> 12 <a class="navcur" href="index.html">Main</a><br /> 13 <a class="nav" href="basics.html">The basics</a><br /> 14 <a class="nav" href="celerid.html">CeleriD</a><br /> 15 <a class="nav" href="conversion.html">Type conversion</a><br /> 16 <a class="nav" href="func_wrapping.html">Function wrapping</a><br /> 17 <a class="nav" href="class_wrapping.html">Class wrapping</a><br /> 18 <a class="nav" href="except_wrapping.html">Exception wrapping</a><br /> 19 <a class="nav" href="dpyobject.html">DPyObject</a> 20 </div> 21 22 <div id="content"> 11 23 12 24 <h1>Pyd</h1> … … 14 26 15 27 <p>Pyd also comes with its own extension to Python's <a href="http://docs.python.org/dist/dist.html">distutils</a>, called <a href="celerid.html">CeleriD</a>, making the building of extension modules quite easy.</p> 28 29 <p>Pyd's Trac page can be found <a href="http://dsource.org/projects/pyd/wiki">here</a>.</p> 16 30 17 31 <p>A simple "hello, world" module might look like this:</p> … … 36 50 >>> testdll.hello_func() 37 51 Hello, world!</pre> 52 53 </div> 54 38 55 </body> 39 56 </html> trunk/html_doc/pyd.css
r33 r35 1 1 body { 2 2 background-color: #d8d8d8; 3 margin: 0px 0px 0px 0px; 3 4 font-size: 90%; 4 5 font-family: Geneva, Arial, Helvetica, sans-serif; … … 11 12 background-color: #305880; 12 13 } 13 div.nav { 14 width: 100%; 14 div#content { 15 position: absolute; 16 left: 160px; 17 top: 0px; 18 padding: 5px; 19 } 20 div#nav { 15 21 color: #d8d8d8; 16 22 background-color: #305880; 17 text-align: center; 18 margin: 2px; 23 margin-right: 15px; 19 24 padding: 2px; 20 25 line-height: 140%; 26 width: 150px; 21 27 } 22 28 a.nav {
