Changeset 49

Show
Ignore:
Timestamp:
12/01/06 17:15:39 (2 years ago)
Author:
KirkMcDonald
Message:

'DPy' prefix finally changed to 'Pyd'

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dcompiler.py

    r48 r49  
    3030    'def.d', 
    3131    'dg_convert.d', 
    32     'dpyobject.d', 
    3332    'exception.d', 
    3433    'func_wrap.d', 
     
    3736    'op_wrap.d', 
    3837    'pyd.d', 
     38    'pydobject.d', 
    3939] 
    4040 
  • trunk/html_doc/basics.html

    r45 r49  
    1818<a class="nav" href="class_wrapping.html">Class wrapping</a><br /> 
    1919<a class="nav" href="except_wrapping.html">Exception wrapping</a><br /> 
    20 <a class="nav" href="dpyobject.html">DPyObject</a><br /> 
     20<a class="nav" href="pydobject.html">PydObject</a><br /> 
    2121<a class="nav" href="credits.html">Credits</a> 
    2222</div> 
     
    4949<p><code>PyObject* module_init(char[] <span class="arg">name</span>);</code></p> 
    5050 
    51 <p>It does little more than call <a href="http://docs.python.org/api/allocating-objects.html">Py_InitModule</a> and return the new module object. This object is also available via the <code>DPy_Module_p</code> property once you've called <code>module_init</code>.</p> 
     51<p>It does little more than call <a href="http://docs.python.org/api/allocating-objects.html">Py_InitModule</a> and return the new module object. This object is also available via the <code>Pyd_Module_p</code> property once you've called <code>module_init</code>.</p> 
    5252 
    5353<p>Due to the way in which Pyd implements function and class wrapping, any calls to <code>def</code> must occur <em>before</em> the call to <code>module_init</code>, and any calls to <code>finalize_class</code> must occur <em>after</em> the call. I know this seems like a rather arbitrary rule, but it is important. Calls to <code>def</code> in the wrong place will simply be ignored, and calls to <code>finalize_class</code> in the wrong place will throw an assert. (And this assert will cause the Python interpreter to crash. So be warned.)</p> 
  • trunk/html_doc/celerid.html

    r48 r49  
    1818<a class="nav" href="class_wrapping.html">Class wrapping</a><br /> 
    1919<a class="nav" href="except_wrapping.html">Exception wrapping</a><br /> 
    20 <a class="nav" href="dpyobject.html">DPyObject</a><br /> 
     20<a class="nav" href="pydobject.html">PydObject</a><br /> 
    2121<a class="nav" href="credits.html">Credits</a> 
    2222</div> 
  • trunk/html_doc/class_wrapping.html

    r45 r49  
    1818<a class="navcur" href="class_wrapping.html">Class wrapping</a><br /> 
    1919<a class="nav" href="except_wrapping.html">Exception wrapping</a><br /> 
    20 <a class="nav" href="dpyobject.html">DPyObject</a><br /> 
     20<a class="nav" href="pydobject.html">PydObject</a><br /> 
    2121<a class="nav" href="credits.html">Credits</a> 
    2222</div> 
  • trunk/html_doc/conversion.html

    r45 r49  
    1818<a class="nav" href="class_wrapping.html">Class wrapping</a><br /> 
    1919<a class="nav" href="except_wrapping.html">Exception wrapping</a><br /> 
    20 <a class="nav" href="dpyobject.html">DPyObject</a><br /> 
     20<a class="nav" href="pydobject.html">PydObject</a><br /> 
    2121<a class="nav" href="credits.html">Credits</a> 
    2222</div> 
     
    4545<tr><td>delegate or function pointer</td>       <td>A callable object</td></tr> 
    4646<tr><td><a href="class_wrapping.html">A wrapped class</a></td> <td>The wrapped type</td></tr> 
    47 <tr><td><a href="dpyobject.html">DPyObject</a></td> <td>The wrapped object's type</td></tr> 
     47<tr><td><a href="pydobject.html">PydObject</a></td> <td>The wrapped object's type</td></tr> 
    4848<tr><td>PyObject*</td>                          <td>The object's type</td></tr> 
    4949</table> 
     
    5151This function will set a Python <code>RuntimeError</code> and return <code>null</code> if the conversion is not possible.</dd> 
    5252 
    53 <dt><code>DPyObject py(<span class="t_arg">T</span>) (<span class="t_arg">T</span> <span class="arg">t</span>);</code></dt> 
    54 <dd>Converts D item <span class="arg">t</span> of type <span class="t_arg">T</span> to a PyObject with the <code>_py</code> function (above), and returns a <a href="dpyobject.html">DPyObject</a> wrapping that PyObject. This will <a href="except_wrapping.html">throw a wrapped Python <code>RuntimeError</code></a> if the conversion is not possible.</dd> 
     53<dt><code>PydObject py(<span class="t_arg">T</span>) (<span class="t_arg">T</span> <span class="arg">t</span>);</code></dt> 
     54<dd>Converts D item <span class="arg">t</span> of type <span class="t_arg">T</span> to a PyObject with the <code>_py</code> function (above), and returns a <a href="pydobject.html">PydObject</a> wrapping that PyObject. This will <a href="except_wrapping.html">throw a wrapped Python <code>RuntimeError</code></a> if the conversion is not possible.</dd> 
    5555 
    5656<dt><code><span class="t_arg">T</span> d_type(<span class="t_arg">T</span>) (PyObject* <span class="arg">o</span>);</dt> 
     
    6060<tr><th>Python type</th>    <th>D type</th>                             </tr> 
    6161<tr><td>Any type</td>       <td>PyObject*</td>                          </tr> 
    62 <tr><td>Any type</td>       <td><a href="dpyobject.html">DPyObject</a></td></tr> 
     62<tr><td>Any type</td>       <td><a href="pydobject.html">PydObject</a></td></tr> 
    6363<tr><td><a href="class_wrapping.html">Wrapped class</a></td> <td>Wrapped class</td></tr> 
    6464<tr><td>Any callable</td>   <td>delegate</td>                           </tr> 
     
    7171</table> 
    7272 
    73 This function will throw a <code>DPyConversionException</code> if the conversion is not possible.</dd> 
     73This function will throw a <code>PydConversionException</code> if the conversion is not possible.</dd> 
    7474</dl> 
    7575</div> 
  • trunk/html_doc/credits.html

    r45 r49  
    1818<a class="nav" href="class_wrapping.html">Class wrapping</a><br /> 
    1919<a class="nav" href="except_wrapping.html">Exception wrapping</a><br /> 
    20 <a class="nav" href="dpyobject.html">DPyObject</a><br /> 
     20<a class="nav" href="pydobject.html">PydObject</a><br /> 
    2121<a class="navcur" href="credits.html">Credits</a> 
    2222</div> 
  • trunk/html_doc/except_wrapping.html

    r46 r49  
    1818<a class="nav" href="class_wrapping.html">Class wrapping</a><br /> 
    1919<a class="navcur" href="except_wrapping.html">Exception wrapping</a><br /> 
    20 <a class="nav" href="dpyobject.html">DPyObject</a><br /> 
     20<a class="nav" href="pydobject.html">PydObject</a><br /> 
    2121<a class="nav" href="credits.html">Credits</a> 
    2222</div> 
     
    3030<p>When wrapping functions and classes, the latter is usually of more interest. All wrapped functions, methods, constructors, properties, &amp;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> 
    3131 
    32 <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> 
     32<p>The <a href="pydobject.html">PydObject</a> class wraps a portion of the Python/C API. Whenever a Python exception is raised by a method of PydObject, 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> 
    3333 
    3434<p>Pyd provides the following exception-related functions:</p> 
  • trunk/html_doc/func_wrapping.html

    r45 r49  
    1818<a class="nav" href="class_wrapping.html">Class wrapping</a><br /> 
    1919<a class="nav" href="except_wrapping.html">Exception wrapping</a><br /> 
    20 <a class="nav" href="dpyobject.html">DPyObject</a><br /> 
     20<a class="nav" href="pydobject.html">PydObject</a><br /> 
    2121<a class="nav" href="credits.html">Credits</a> 
    2222</div> 
  • trunk/html_doc/index.html

    r45 r49  
    1818<a class="nav" href="class_wrapping.html">Class wrapping</a><br /> 
    1919<a class="nav" href="except_wrapping.html">Exception wrapping</a><br /> 
    20 <a class="nav" href="dpyobject.html">DPyObject</a><br /> 
     20<a class="nav" href="pydobject.html">PydObject</a><br /> 
    2121<a class="nav" href="credits.html">Credits</a> 
    2222</div> 
  • trunk/html_doc/install.html

    r45 r49  
    1818<a class="nav" href="class_wrapping.html">Class wrapping</a><br /> 
    1919<a class="nav" href="except_wrapping.html">Exception wrapping</a><br /> 
    20 <a class="nav" href="dpyobject.html">DPyObject</a><br /> 
     20<a class="nav" href="pydobject.html">PydObject</a><br /> 
    2121<a class="nav" href="credits.html">Credits</a> 
    2222</div> 
  • trunk/html_doc/pydobject.html

    r45 r49  
    44    <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> 
    55    <link href="pyd.css" rel="stylesheet" type="text/css"> 
    6     <title>pyd.dpyobject</title> 
     6    <title>pyd.pydobject</title> 
    77</head> 
    88 
     
    1818<a class="nav" href="class_wrapping.html">Class wrapping</a><br /> 
    1919<a class="nav" href="except_wrapping.html">Exception wrapping</a><br /> 
    20 <a class="navcur" href="dpyobject.html">DPyObject</a><br /> 
     20<a class="navcur" href="pydobject.html">PydObject</a><br /> 
    2121<a class="nav" href="credits.html">Credits</a> 
    2222</div> 
     
    2424<div id="content"> 
    2525 
    26 <h1>pyd.dpyobject</h1> 
    27 <!-- Generated by Ddoc from pyd\dpyobject.d --> 
    28 <p>The DPyObject class wraps a PyObject*, using the D garbage collector to handle the reference count so that you don't have to. It also overloads quite a lot of operators, and tries to make using Python objects in D code as much like using them in Python as possible. However, it is incomplete (the function and method call methods in particular need work, and there are a number of helper functions that need to be written), and remains a work in progress.</p> 
    29  
    30 <dl><dt><big>class <u>DPyObject</u>; 
     26<h1>pyd.pydobject</h1> 
     27<!-- Generated by Ddoc from pyd\pydobject.d --> 
     28<p>The PydObject class wraps a PyObject*, using the D garbage collector to handle the reference count so that you don't have to. It also overloads quite a lot of operators, and tries to make using Python objects in D code as much like using them in Python as possible. However, it is incomplete (the function and method call methods in particular need work, and there are a number of helper functions that need to be written), and remains a work in progress.</p> 
     29 
     30<dl><dt><big>class <u>PydObject</u>; 
    3131</big></dt> 
    3232<dd>Wrapper class for a Python/C API PyObject. 
     
    5252<tr><td>PyObject * <i>o</i></td>  <td>The PyObject to wrap.</td></tr> 
    5353<tr><td>bool <i>borrowed</i></td> <td>Whether <i>o</i> is a borrowed reference. Instances 
    54                  of DPyObject always own their references. 
     54                 of PydObject always own their references. 
    5555                 Therefore, Py_INCREF will be called if <i>borrowed</i> is 
    5656                 true.</td></tr> 
     
    5858 
    5959<dt><big>this();</big></dt> 
    60 <dd>The default constructor constructs an instance of the Py_None DPyObject.<br /><br /></dd> 
     60<dd>The default constructor constructs an instance of the Py_None PydObject.<br /><br /></dd> 
    6161 
    6262<dt><big>PyObject * <u>ptr</u>();</big></dt> 
     
    6666<dd>Same as hasattr(this, <i>attr_name</i>) in Python.<br><br></dd> 
    6767 
    68 <dt><big>bool <u>hasattr</u>(DPyObject <i>attr_name</i>); 
     68<dt><big>bool <u>hasattr</u>(PydObject <i>attr_name</i>); 
    6969</big></dt> 
    7070<dd>Same as hasattr(this, <i>attr_name</i>) in Python. 
     
    7272 
    7373</dd> 
    74 <dt><big>DPyObject <u>getattr</u>(char[] <i>attr_name</i>); 
     74<dt><big>PydObject <u>getattr</u>(char[] <i>attr_name</i>); 
    7575</big></dt> 
    7676<dd>Same as getattr(this, <i>attr_name</i>) in Python. 
     
    7878 
    7979</dd> 
    80 <dt><big>DPyObject <u>getattr</u>(DPyObject <i>attr_name</i>); 
     80<dt><big>PydObject <u>getattr</u>(PydObject <i>attr_name</i>); 
    8181</big></dt> 
    8282<dd>Same as getattr(this, <i>attr_name</i>) in Python. 
     
    8484 
    8585</dd> 
    86 <dt><big>void <u>setattr</u>(char[] <i>attr_name</i>, DPyObject <i>v</i>); 
     86<dt><big>void <u>setattr</u>(char[] <i>attr_name</i>, PydObject <i>v</i>); 
    8787</big></dt> 
    8888<dd>Same as setattr(this, <i>attr_name</i>, <i>v</i>) in Python. 
     
    9191 
    9292</dd> 
    93 <dt><big>void <u>setattr</u>(DPyObject <i>attr_name</i>, DPyObject <i>v</i>); 
     93<dt><big>void <u>setattr</u>(PydObject <i>attr_name</i>, PydObject <i>v</i>); 
    9494</big></dt> 
    9595<dd>Same as setattr(this, <i>attr_name</i>, <i>v</i>) in Python. 
     
    105105 
    106106</dd> 
    107 <dt><big>void <u>delattr</u>(DPyObject <i>attr_name</i>); 
     107<dt><big>void <u>delattr</u>(PydObject <i>attr_name</i>); 
    108108</big></dt> 
    109109<dd>Same as del this.<i>attr_name</i> in Python. 
     
    112112 
    113113</dd> 
    114 <dt><big>int <u>opCmp</u>(DPyObject <i>rhs</i>); 
     114<dt><big>int <u>opCmp</u>(PydObject <i>rhs</i>); 
    115115</big></dt> 
    116116<dd>Exposes Python object comparison to D. Same as cmp(this, <i>rhs</i>) in Python. 
     
    119119 
    120120</dd> 
    121 <dt><big>bool <u>opEquals</u>(DPyObject <i>rhs</i>); 
     121<dt><big>bool <u>opEquals</u>(PydObject <i>rhs</i>); 
    122122</big></dt> 
    123123<dd>Exposes Python object equality check to D. 
     
    126126 
    127127</dd> 
    128 <dt><big>DPyObject <u>repr</u>(); 
     128<dt><big>PydObject <u>repr</u>(); 
    129129</big></dt> 
    130130<dd>Same as repr(this) in Python. 
     
    132132 
    133133</dd> 
    134 <dt><big>DPyObject <u>str</u>(); 
     134<dt><big>PydObject <u>str</u>(); 
    135135</big></dt> 
    136136<dd>Same as str(this) in Python. 
     
    140140<dt><big>char[] <u>toString</u>(); 
    141141</big></dt> 
    142 <dd>Allows use of DPyObject in writef via %s 
    143 <br><br> 
    144  
    145 </dd> 
    146 <dt><big>DPyObject <u>unicode</u>(); 
     142<dd>Allows use of PydObject in writef via %s 
     143<br><br> 
     144 
     145</dd> 
     146<dt><big>PydObject <u>unicode</u>(); 
    147147</big></dt> 
    148148<dd>Same as unicode(this) in Python. 
     
    150150 
    151151</dd> 
    152 <dt><big>bool <u>isInstance</u>(DPyObject <i>cls</i>); 
     152<dt><big>bool <u>isInstance</u>(PydObject <i>cls</i>); 
    153153</big></dt> 
    154154<dd>Same as isinstance(this, <i>cls</i>) in Python. 
     
    156156 
    157157</dd> 
    158 <dt><big>bool <u>isSubclass</u>(DPyObject <i>cls</i>); 
     158<dt><big>bool <u>isSubclass</u>(PydObject <i>cls</i>); 
    159159</big></dt> 
    160160<dd>Same as issubclass(this, <i>cls</i>) in Python. Only works if this is a class. 
     
    168168 
    169169</dd> 
    170 <dt><big>DPyObject <u>opCall</u>(DPyObject <i>args</i> = null); 
    171 </big></dt> 
    172 <dd>Calls the DPyObject. <strong>(Note: The opCall functions will be changing in the future to something more useful.)</strong> 
     170<dt><big>PydObject <u>opCall</u>(PydObject <i>args</i> = null); 
     171</big></dt> 
     172<dd>Calls the PydObject. <strong>(Note: The opCall functions will be changing in the future to something more useful.)</strong> 
    173173<br><br> 
    174174<b>Params:</b><br> 
    175 <table><tr><td>DPyObject <i>args</i></td> 
    176 <td>Should be a DPyTuple of the arguments to pass. Omit to 
     175<table><tr><td>PydObject <i>args</i></td> 
     176<td>Should be a PydTuple of the arguments to pass. Omit to 
    177177             call with no arguments.</td></tr> 
    178178</table><br> 
    179179<b>Returns:</b><br> 
    180 Whatever the function DPyObject returns. 
    181       
    182 <br><br> 
    183  
    184 </dd> 
    185 <dt><big>DPyObject <u>opCall</u>(DPyObject <i>args</i>, DPyObject <i>kw</i>); 
    186 </big></dt> 
    187 <dd>Calls the DPyObject with positional and keyword arguments. 
     180Whatever the function PydObject returns. 
     181      
     182<br><br> 
     183 
     184</dd> 
     185<dt><big>PydObject <u>opCall</u>(PydObject <i>args</i>, PydObject <i>kw</i>); 
     186</big></dt> 
     187<dd>Calls the PydObject with positional and keyword arguments. 
    188188<br><br> 
    189189<b>Params:</b><br> 
    190 <table><tr><td>DPyObject <i>args</i></td> 
    191 <td>Positional arguments. Should be a DPyTuple. Pass an empty 
    192              DPyTuple for no positional arguments.</td></tr> 
    193 <tr><td>DPyObject <i>kw</i></td> 
    194 <td>Keyword arguments. Should be a DPyDict.</td></tr> 
     190<table><tr><td>PydObject <i>args</i></td> 
     191<td>Positional arguments. Should be a PydTuple. Pass an empty 
     192             PydTuple for no positional arguments.</td></tr> 
     193<tr><td>PydObject <i>kw</i></td> 
     194<td>Keyword arguments. Should be a PydDict.</td></tr> 
    195195</table><br> 
    196196<b>Returns:</b><br> 
    197 Whatever the function DPyObject returns. 
    198       
    199 <br><br> 
    200  
    201 </dd> 
    202 <dt><big>DPyObject <u>method</u>(char[] <i>name</i>, DPyObject <i>args</i> = null); 
     197Whatever the function PydObject returns. 
     198      
     199<br><br> 
     200 
     201</dd> 
     202<dt><big>PydObject <u>method</u>(char[] <i>name</i>, PydObject <i>args</i> = null); 
    203203</big></dt> 
    204204<dd><br><br> 
     
    222222 
    223223</dd> 
    224 <dt><big>DPyObject <u>type</u>(); 
    225 </big></dt> 
    226 <dd>Gets the type of this DPyObject. Same as type(this) in Python. 
     224<dt><big>PydObject <u>type</u>(); 
     225</big></dt> 
     226<dd>Gets the type of this PydObject. Same as type(this) in Python. 
    227227<br><br> 
    228228<b>Returns:</b><br> 
    229 The type DPyObject of this DPyObject. 
     229The type PydObject of this PydObject. 
    230230      
    231231<br><br> 
     
    234234<dt><big>int <u>length</u>(); 
    235235</big></dt> 
    236 <dd>The length of this DPyObject. Same as len(this) in Python. 
     236<dd>The length of this PydObject. Same as len(this) in Python. 
    237237      
    238238<br><br> 
     
    245245 
    246246</dd> 
    247 <dt><big>DPyObject <u>dir</u>(); 
     247<dt><big>PydObject <u>dir</u>(); 
    248248</big></dt> 
    249249<dd>Same as dir(this) in Python. 
     
    251251 
    252252</dd> 
    253 <dt><big>DPyObject <u>opIndex</u>(DPyObject <i>key</i>); 
     253<dt><big>PydObject <u>opIndex</u>(PydObject <i>key</i>); 
    254254</big></dt> 
    255255<dd>Equivalent to o[key] in Python. 
     
    257257 
    258258</dd> 
    259 <dt><big>DPyObject <u>opIndex</u>(char[] <i>key</i>); 
     259<dt><big>PydObject <u>opIndex</u>(char[] <i>key</i>); 
    260260</big></dt> 
    261261<dd>Equivalent to o['key'] in Python; usually only makes sense for 
     
    265265 
    266266</dd> 
    267 <dt><big>DPyObject <u>opIndex</u>(int <i>i</i>); 
     267<dt><big>PydObject <u>opIndex</u>(int <i>i</i>); 
    268268</big></dt> 
    269269<dd>Equivalent to o[i] in Python; usually only makes sense for sequences. 
     
    271271 
    272272</dd> 
    273 <dt><big>void <u>opIndexAssign</u>(DPyObject <i>value</i>, DPyObject <i>key</i>); 
     273<dt><big>void <u>opIndexAssign</u>(PydObject <i>value</i>, PydObject <i>key</i>); 
    274274</big></dt> 
    275275<dd>Equivalent to o[key] = value in Python. 
     
    277277 
    278278</dd> 
    279 <dt><big>void <u>opIndexAssign</u>(DPyObject <i>value</i>, char[] <i>key</i>); 
     279<dt><big>void <u>opIndexAssign</u>(PydObject <i>value</i>, char[] <i>key</i>); 
    280280</big></dt> 
    281281<dd>Equivalent to o['key'] = value in Python. Usually only makes sense for 
     
    285285 
    286286</dd> 
    287 <dt><big>void <u>opIndexAssign</u>(DPyObject <i>value</i>, int <i>i</i>); 
     287<dt><big>void <u>opIndexAssign</u>(PydObject <i>value</i>, int <i>i</i>); 
    288288</big></dt> 
    289289<dd>Equivalent to o[i] = value in Python. Usually only makes sense for 
     
    293293 
    294294</dd> 
    295 <dt><big>void <u>delItem</u>(DPyObject <i>key</i>); 
     295<dt><big>void <u>delItem</u>(PydObject <i>key</i>); 
    296296</big></dt> 
    297297<dd>Equivalent to del o[key] in Python. 
     
    315315 
    316316</dd> 
    317 <dt><big>DPyObject <u>opSlice</u>(int <i>i1</i>, int <i>i2</i>); 
     317<dt><big>PydObject <u>opSlice</u>(int <i>i1</i>, int <i>i2</i>); 
    318318</big></dt> 
    319319<dd>Equivalent to o[i1:i2] in Python. 
     
    321321 
    322322</dd> 
    323 <dt><big>DPyObject <u>opSlice</u>(); 
     323<dt><big>PydObject <u>opSlice</u>(); 
    324324</big></dt> 
    325325<dd>Equivalent to o[:] in Python. 
     
    327327 
    328328</dd> 
    329 <dt><big>void <u>opSliceAssign</u>(DPyObject <i>v</i>, int <i>i1</i>, int <i>i2</i>); 
     329<dt><big>void <u>opSliceAssign</u>(PydObject <i>v</i>, int <i>i1</i>, int <i>i2</i>); 
    330330</big></dt> 
    331331<dd>Equivalent to o[i1:i2] = v in Python. 
     
    333333 
    334334</dd> 
    335 <dt><big>void <u>opSliceAssign</u>(DPyObject <i>v</i>); 
     335<dt><big>void <u>opSliceAssign</u>(PydObject <i>v</i>); 
    336336</big></dt> 
    337337<dd>Equivalent to o[:] = v in Python. 
     
    351351 
    352352</dd> 
    353 <dt><big>int <u>opApply</u>(int delegate(inout DPyObject) <i>dg</i>); 
     353<dt><big>int <u>opApply</u>(int delegate(inout PydObject) <i>dg</i>); 
    354354</big></dt> 
    355355<dd>Iterates over the items in a collection, be they the items in a 
    356356 sequence, keys in a dictionary, or some other iteration defined for the 
    357  DPyObject's type. 
    358       
    359 <br><br> 
    360  
    361 </dd> 
    362 <dt><big>int <u>opApply</u>(int delegate(inout DPyObject, inout DPyObject) <i>dg</i>); 
    363 </big></dt> 
    364 <dd>Iterate over (key, value) pairs in a dictionary. If the DPyObject is not 
     357 PydObject's type. 
     358      
     359<br><br> 
     360 
     361</dd> 
     362<dt><big>int <u>opApply</u>(int delegate(inout PydObject, inout PydObject) <i>dg</i>); 
     363</big></dt> 
     364<dd>Iterate over (key, value) pairs in a dictionary. If the PydObject is not 
    365365 a dict, this simply does nothing. (It iterates over no items.) You 
    366366 should not attempt to modify the dictionary while iterating through it, 
     
    371371 
    372372</dd> 
    373 <dt><big>DPyObject <u>opAdd</u>(DPyObject <i>o</i>); 
    374 </big></dt> 
    375 <dd><br><br> 
    376 </dd> 
    377 <dt><big>DPyObject <u>opSub</u>(DPyObject <i>o</i>); 
    378 </big></dt> 
    379 <dd><br><br> 
    380 </dd> 
    381 <dt><big>DPyObject <u>opMul</u>(DPyObject <i>o</i>); 
    382 </big></dt> 
    383 <dd><br><br> 
    384 </dd> 
    385 <dt><big>DPyObject <u>opMul</u>(int <i>count</i>); 
     373<dt><big>PydObject <u>opAdd</u>(PydObject <i>o</i>); 
     374</big></dt> 
     375<dd><br><br> 
     376</dd> 
     377<dt><big>PydObject <u>opSub</u>(PydObject <i>o</i>); 
     378</big></dt> 
     379<dd><br><br> 
     380</dd> 
     381<dt><big>PydObject <u>opMul</u>(PydObject <i>o</i>); 
     382</big></dt> 
     383<dd><br><br> 
     384</dd> 
     385<dt><big>PydObject <u>opMul</u>(int <i>count</i>); 
    386386</big></dt> 
    387387<dd>Sequence repetition 
     
    389389 
    390390</dd> 
    391 <dt><big>DPyObject <u>opDiv</u>(DPyObject <i>o</i>); 
    392 </big></dt> 
    393 <dd><br><br> 
    394 </dd> 
    395 <dt><big>DPyObject <u>floorDiv</u>(DPyObject <i>o</i>); 
    396 </big></dt> 
    397 <dd><br><br> 
    398 </dd> 
    399 <dt><big>DPyObject <u>opMod</u>(DPyObject <i>o</i>); 
    400 </big></dt> 
    401 <dd><br><br> 
    402 </dd> 
    403 <dt><big>DPyObject <u>divmod</u>(DPyObject <i>o</i>); 
    404 </big></dt> 
    405 <dd><br><br> 
    406 </dd> 
    407 <dt><big>DPyObject <u>pow</u>(DPyObject <i>o1</i>, DPyObject <i>o2</i> = null); 
    408 </big></dt> 
    409 <dd><br><br> 
    410 </dd> 
    411 <dt><big>DPyObject <u>opPos</u>(); 
    412 </big></dt> 
    413 <dd><br><br> 
    414 </dd> 
    415 <dt><big>DPyObject <u>opNeg</u>(); 
    416 </big></dt> 
    417 <dd><br><br> 
    418 </dd> 
    419 <dt><big>DPyObject <u>abs</u>(); 
    420 </big></dt> 
    421 <dd><br><br> 
    422 </dd> 
    423 <dt><big>DPyObject <u>opCom</u>(); 
    424 </big></dt> 
    425 <dd><br><br> 
    426 </dd> 
    427 <dt><big>DPyObject <u>opShl</u>(DPyObject <i>o</i>); 
    428 </big></dt> 
    429 <dd><br><br> 
    430 </dd> 
    431 <dt><big>DPyObject <u>opShr</u>(DPyObject <i>o</i>); 
    432 </big></dt> 
    433 <dd><br><br> 
    434 </dd> 
    435 <dt><big>DPyObject <u>opAnd</u>(DPyObject <i>o</i>); 
    436 </big></dt> 
    437 <dd><br><br> 
    438 </dd> 
    439 <dt><big>DPyObject <u>opXor</u>(DPyObject <i>o</i>); 
    440 </big></dt> 
    441 <dd><br><br> 
    442 </dd> 
    443 <dt><big>DPyObject <u>opOr</u>(DPyObject <i>o</i>); 
    444 </big></dt> 
    445 <dd><br><br> 
    446 </dd> 
    447 <dt><big>DPyObject <u>opAddAssign</u>(DPyObject <i>o</i>); 
    448 </big></dt> 
    449 <dd><br><br> 
    450 </dd> 
    451 <dt><big>DPyObject <u>opSubAssign</u>(DPyObject <i>o</i>); 
    452 </big></dt> 
    453 <dd><br><br> 
    454 </dd> 
    455 <dt><big>DPyObject <u>opMulAssign</u>(DPyObject <i>o</i>); 
    456 </big></dt> 
    457 <dd><br><br> 
    458 </dd> 
    459 <dt><big>DPyObject <u>opMulAssign</u>(int <i>count</i>); 
     391<dt><big>PydObject <u>opDiv</u>(PydObject <i>o</i>); 
     392</big></dt> 
     393<dd><br><br> 
     394</dd> 
     395<dt><big>PydObject <u>floorDiv</u>(PydObject <i>o</i>); 
     396</big></dt> 
     397<dd><br><br> 
     398</dd> 
     399<dt><big>PydObject <u>opMod</u>(PydObject <i>o</i>); 
     400</big></dt> 
     401<dd><br><br> 
     402</dd> 
     403<dt><big>PydObject <u>divmod</u>(PydObject <i>o</i>); 
     404</big></dt> 
     405<dd><br><br> 
     406</dd> 
     407<dt><big>PydObject <u>pow</u>(PydObject <i>o1</i>, PydObject <i>o2</i> = null); 
     408</big></dt> 
     409<dd><br><br> 
     410</dd> 
     411<dt><big>PydObject <u>opPos</u>(); 
     412</big></dt> 
     413<dd><br><br> 
     414</dd> 
     415<dt><big>PydObject <u>opNeg</u>(); 
     416</big></dt> 
     417<dd><br><br> 
     418</dd> 
     419<dt><big>PydObject <u>abs</u>(); 
     420</big></dt> 
     421<dd><br><br> 
     422</dd> 
     423<dt><big>PydObject <u>opCom</u>(); 
     424</big></dt> 
     425<dd><br><br> 
     426</dd> 
     427<dt><big>PydObject <u>opShl</u>(PydObject <i>o</i>); 
     428</big></dt> 
     429<dd><br><br> 
     430</dd> 
     431<dt><big>PydObject <u>opShr</u>(PydObject <i>o</i>); 
     432</big></dt> 
     433<dd><br><br> 
     434</dd> 
     435<dt><big>PydObject <u>opAnd</u>(PydObject <i>o</i>); 
     436</big></dt> 
     437<dd><br><br> 
     438</dd> 
     439<dt><big>PydObject <u>opXor</u>(PydObject <i>o</i>); 
     440</big></dt> 
     441<dd><br><br> 
     442</dd> 
     443<dt><big>PydObject <u>opOr</u>(PydObject <i>o</i>); 
     444</big></dt> 
     445<dd><br><br> 
     446</dd> 
     447<dt><big>PydObject <u>opAddAssign</u>(PydObject <i>o</i>); 
     448</big></dt> 
     449<dd><br><br> 
     450</dd> 
     451<dt><big>PydObject <u>opSubAssign</u>(PydObject <i>o</i>); 
     452</big></dt> 
     453<dd><br><br> 
     454</dd> 
     455<dt><big>PydObject <u>opMulAssign</u>(PydObject <i>o</i>); 
     456</big></dt> 
     457<dd><br><br> 
     458</dd> 
     459<dt><big>PydObject <u>opMulAssign</u>(int <i>count</i>); 
    460460</big></dt> 
    461461<dd>In-place sequence repetition 
     
    463463 
    464464</dd> 
    465 <dt><big>DPyObject <u>opDivAssign</u>(DPyObject <i>o</i>); 
    466 </big></dt> 
    467 <dd><br><br> 
    468 </dd> 
    469 <dt><big>DPyObject <u>floorDivAssign</u>(DPyObject <i>o</i>); 
    470 </big></dt> 
    471 <dd><br><br> 
    472 </dd> 
    473 <dt><big>DPyObject <u>opModAssign</u>(DPyObject <i>o</i>); 
    474 </big></dt> 
    475 <dd><br><br> 
    476 </dd> 
    477 <dt><big>DPyObject <u>powAssign</u>(DPyObject <i>o1</i>, DPyObject <i>o2</i> = null); 
    478 </big></dt> 
    479 <dd><br><br> 
    480 </dd> 
    481 <dt><big>DPyObject <u>opShlAssign</u>(DPyObject <i>o</i>); 
    482 </big></dt> 
    483 <dd><br><br> 
    484 </dd> 
    485 <dt><big>DPyObject <u>opShrAssign</u>(DPyObject <i>o</i>); 
    486 </big></dt> 
    487 <dd><br><br> 
    488 </dd> 
    489 <dt><big>DPyObject <u>opAndAssign</u>(DPyObject <i>o</i>); 
    490 </big></dt> 
    491 <dd><br><br> 
    492 </dd> 
    493 <dt><big>DPyObject <u>opXorAssign</u>(DPyObject <i>o</i>); 
    494 </big></dt> 
    495 <dd><br><br> 
    496 </dd> 
    497 <dt><big>DPyObject <u>opOrAssign</u>(DPyObject <i>o</i>); 
    498 </big></dt> 
    499 <dd><br><br> 
    500 </dd> 
    501 <dt><big>DPyObject <u>asInt</u>(); 
    502 </big></dt> 
    503 <dd><br><br> 
    504 </dd> 
    505 <dt><big>DPyObject <u>asLong</u>(); 
    506 </big></dt> 
    507 <dd><br><br> 
    508 </dd> 
    509 <dt><big>DPyObject <u>asFloat</u>(); 
     465<dt><big>PydObject <u>opDivAssign</u>(PydObject <i>o</i>); 
     466</big></dt> 
     467<dd><br><br> 
     468</dd> 
     469<dt><big>PydObject <u>floorDivAssign</u>(PydObject <i>o</i>); 
     470</big></dt> 
     471<dd><br><br> 
     472</dd> 
     473<dt><big>PydObject <u>opModAssign</u>(PydObject <i>o</i>); 
     474</big></dt> 
     475<dd><br><br> 
     476</dd> 
     477<dt><big>PydObject <u>powAssign</u>(PydObject <i>o1</i>, PydObject <i>o2</i> = null); 
     478</big></dt> 
     479<dd><br><br> 
     480</dd> 
     481<dt><big>PydObject <u>opShlAssign</u>(PydObject <i>o</i>); 
     482</big></dt> 
     483<dd><br><br> 
     484</dd> 
     485<dt><big>PydObject <u>opShrAssign</u>(PydObject <i>o</i>); 
     486</big></dt> 
     487<dd><br><br> 
     488</dd> 
     489<dt><big>PydObject <u>opAndAssign</u>(PydObject <i>o</i>); 
     490</big></dt> 
     491<dd><br><br> 
     492</dd> 
     493<dt><big>PydObject <u>opXorAssign</u>(PydObject <i>o</i>); 
     494</big></dt> 
     495<dd><br><br> 
     496</dd> 
     497<dt><big>PydObject <u>opOrAssign</u>(PydObject <i>o</i>); 
     498</big></dt> 
     499<dd><br><br> 
     500</dd> 
     501<dt><big>PydObject <u>asInt</u>(); 
     502</big></dt> 
     503<dd><br><br> 
     504</dd> 
     505<dt><big>PydObject <u>asLong</u>(); 
     506</big></dt> 
     507<dd><br><br> 
     508</dd> 
     509<dt><big>PydObject <u>asFloat</u>(); 
    510510</big></dt> 
    511511<dd><br><br> 
     
    527527<dd><br><br> 
    528528</dd> 
    529 <dt><big>DPyObject <u>opCat</u>(DPyObject <i>o</i>); 
     529<dt><big>PydObject <u>opCat</u>(PydObject <i>o</i>); 
    530530</big></dt> 
    531531<dd>Sequence concatenation 
     
    533533 
    534534</dd> 
    535 <dt><big>DPyObject <u>opCatAssign</u>(DPyObject <i>o</i>); 
     535<dt><big>PydObject <u>opCatAssign</u>(PydObject <i>o</i>); 
    536536</big></dt> 
    537537<dd>In-place sequence concatenation 
     
    539539 
    540540</dd> 
    541 <dt><big>int <u>count</u>(DPyObject <i>v</i>); 
    542 </big></dt> 
    543 <dd><br><br> 
    544 </dd> 
    545 <dt><big>int <u>index</u>(DPyObject <i>v</i>); 
    546 </big></dt> 
    547 <dd><br><br> 
    548 </dd> 
    549 <dt><big>DPyObject <u>asList</u>(); 
    550 </big></dt> 
    551 <dd>Converts any iterable DPyObject to a list 
    552 <br><br> 
    553  
    554 </dd> 
    555 <dt><big>DPyObject <u>asTuple</u>(); 
    556 </big></dt> 
    557 <dd>Converts any iterable DPyObject to a tuple 
    558 <br><br> 
    559  
    560 </dd> 
    561 <dt><big>bool <u>opIn_r</u>(DPyObject <i>v</i>); 
     541<dt><big>int <u>count</u>(PydObject <i>v</i>); 
     542</big></dt> 
     543<dd><br><br> 
     544</dd> 
     545<dt><big>int <u>index</u>(PydObject <i>v</i>); 
     546</big></dt> 
     547<dd><br><br> 
     548</dd> 
     549<dt><big>PydObject <u>asList</u>(); 
     550</big></dt> 
     551<dd>Converts any iterable PydObject to a list 
     552<br><br> 
     553 
     554</dd> 
     555<dt><big>PydObject <u>asTuple</u>(); 
     556</big></dt> 
     557<dd>Converts any iterable PydObject to a tuple 
     558<br><br> 
     559 
     560</dd> 
     561<dt><big>bool <u>opIn_r</u>(PydObject <i>v</i>); 
    562562</big></dt> 
    563563<dd>Same as "<i>v</i> in this" in Python. 
     
    565565 
    566566</dd> 
    567 <dt><big>bool <u>hasKey</u>(DPyObject <i>key</i>); 
     567<dt><big>bool <u>hasKey</u>(PydObject <i>key</i>); 
    568568</big></dt> 
    569569<dd>Same as opIn_r 
     
    583583 
    584584</dd> 
    585 <dt><big>DPyObject <u>keys</u>(); 
    586 </big></dt> 
    587 <dd><br><br> 
    588 </dd> 
    589 <dt><big>DPyObject <u>values</u>(); 
    590 </big></dt> 
    591 <dd><br><br> 
    592 </dd> 
    593 <dt><big>DPyObject <u>items</u>(); 
     585<dt><big>PydObject <u>keys</u>(); 
     586</big></dt> 
     587<dd><br><br> 
     588</dd> 
     589<dt><big>PydObject <u>values</u>(); 
     590</big></dt> 
     591<dd><br><br> 
     592</dd> 
     593<dt><big>PydObject <u>items</u>(); 
    594594</big></dt> 
    595595<dd><br><br> 
  • trunk/infrastructure/pyd/class_wrap.d

    r48 r49  
    4545 
    4646// This is split out in case I ever want to make a subtype of a wrapped class. 
    47 template DPyObject_HEAD(T) { 
     47template PydWrapObject_HEAD(T) { 
    4848    mixin PyObject_HEAD; 
    4949    T d_obj; 
     
    5454    extern(C) 
    5555    struct wrapped_class_object { 
    56         mixin DPyObject_HEAD!(T); 
     56        mixin PydWrapObject_HEAD!(T); 
    5757    } 
    5858} 
     
    333333         */ 
    334334        static void iter(iter_t) () { 
    335             DPySC_Ready(); 
     335            PydStackContext_Ready(); 
    336336            wrapped_class_type!(T).tp_iter = &wrapped_iter!(T, T.opApply, int function(iter_t)).iter; 
    337337        } 
     
    345345            static PyMethodDef empty = { null, null, 0, null }; 
    346346            alias wrapped_method_list!(T) list; 
     347            PydStackContext_Ready(); 
    347348            list[length-1].ml_name = name ~ \0; 
    348349            list[length-1].ml_meth = cast(PyCFunction)&wrapped_iter!(T, fn, int function(iter_t)).iter; 
     
    369370    pragma(msg, "finalize_class: " ~ name); 
    370371     
    371     assert(DPy_Module_p !is null, "Must initialize module before wrapping classes."); 
    372     char[] module_name = toString(PyModule_GetName(DPy_Module_p)); 
     372    assert(Pyd_Module_p !is null, "Must initialize module before wrapping classes."); 
     373    char[] module_name = toString(PyModule_GetName(Pyd_Module_p)); 
    373374    // Fill in missing values 
    374375    type.ob_type      = PyType_Type_p(); 
     
    401402        static if (is(typeof(&T.opApply))) { 
    402403            if (type.tp_iter is null) { 
    403                 DPySC_Ready(); 
     404                PydStackContext_Ready(); 
    404405                type.tp_iter = &wrapped_iter!(T, T.opApply).iter; 
    405406            } 
     
    425426