Changeset 36

Show
Ignore:
Timestamp:
07/26/04 07:17:57 (4 years ago)
Author:
aldacron
Message:

*[DerelictPY] added boolobject.d, bufferobject.d, descrobject.d and methodobject.d
*[DerelictPY] deviated somewhat from the C header versions by moving some items from methodobject and descrobject to object instead (makes more sense)
*[DerelictPY] updated the makefile

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/DerelictPY/Makefile

    r35 r36  
    1010PY.SRC.DIR = $(SRC.DIR)\derelict\python 
    1111PY.SRC = \ 
     12    $(PY.SRC.DIR)\boolobject.d \ 
     13    $(PY.SRC.DIR)\bufferobject.d \ 
    1214    $(PY.SRC.DIR)\complexobject.d \ 
     15    $(PY.SRC.DIR)\descrobject.d \ 
    1316    $(PY.SRC.DIR)\floatobject.d \ 
    1417    $(PY.SRC.DIR)\intobject.d \ 
    1518    $(PY.SRC.DIR)\longintrepr.d \ 
    1619    $(PY.SRC.DIR)\longobject.d \ 
     20    $(PY.SRC.DIR)\methodobject.d \ 
    1721    $(PY.SRC.DIR)\object.d \ 
    1822    $(PY.SRC.DIR)\python.d \ 
     
    2125PY.OBJ.DIR = $(OBJ.DIR)\python 
    2226PY.OBJ = \ 
     27    $(PY.OBJ.DIR)\boolobject.obj \ 
     28    $(PY.OBJ.DIR)\bufferobject.obj \ 
    2329    $(PY.OBJ.DIR)\complexobject.obj \ 
     30    $(PY.OBJ.DIR)\descrobject.obj \ 
    2431    $(PY.OBJ.DIR)\floatobject.obj \ 
    2532    $(PY.OBJ.DIR)\intobject.obj \ 
    2633    $(PY.OBJ.DIR)\longintrepr.obj \ 
    2734    $(PY.OBJ.DIR)\longobject.obj \ 
     35    $(PY.OBJ.DIR)\methodobject.obj \ 
    2836    $(PY.OBJ.DIR)\object.obj \ 
    2937    $(PY.OBJ.DIR)\python.obj \ 
  • trunk/DerelictPY/derelict/python/object.d

    r35 r36  
    11module derelict.python.object; 
    22 
     3private import std.c.stdio; 
    34 
    45//============================================================================== 
     
    78extern(C) 
    89{ 
     10     
     11// these two moved here from descrobject 
     12typedef PyObject* function(PyObject*, void*) getter; 
     13typedef int function(PyObject*, PyObject*, void*) setter; 
     14 
     15// these three moved from methodobject 
     16typedef PyObject* function(PyObject*, PyObject*) PyCFunction; 
     17typedef PyObject* function(PyObject*, PyObject*, PyObject*) PyCFunctionWithKeywords; 
     18typedef PyObject* function(PyObject*) PyNoArgsFunction; 
     19 
     20typedef PyObject* function(PyObject*) unaryfunc; 
     21typedef PyObject* function(PyObject*, PyObject*) binaryfunc; 
     22typedef PyObject* function(PyObject*, PyObject*, PyObject*) ternaryfunc; 
     23typedef int function(PyObject*) inquiry; 
     24typedef int function(PyObject**, PyObject**) coercion; 
     25typedef PyObject* function(PyObject*, int) intargfunc; 
     26typedef PyObject* function(PyObject*, int, int) intintargfunc; 
     27typedef int function(PyObject*, int, PyObject*) intobjargproc; 
     28typedef int function(PyObject*, int, int, PyObject*) intintobjargproc; 
     29typedef int function(PyObject*, PyObject*, PyObject*) objobjargproc; 
     30typedef int function(PyObject*, int, void**) getreadbufferproc; 
     31typedef int function(PyObject*, int, void**) getwritebufferproc; 
     32typedef int function(PyObject*, int*) getsegcountproc; 
     33typedef int function(PyObject*, int, char**) getcharbufferproc; 
     34typedef int function(PyObject*, PyObject*) objobjproc; 
     35typedef int function(PyObject*, void*) visitproc; 
     36typedef int function(PyObject*, visitproc, void*) traverseproc; 
     37typedef void function(void*) freefunc; 
     38typedef void function(PyObject*) destructor; 
     39typedef int function(PyObject*, FILE*, int) printfunc; 
     40typedef PyObject* function(PyObject*, char*) getattrfunc; 
     41typedef PyObject* function(PyObject*, PyObject*) getattrofunc; 
     42typedef int function(PyObject*, char*, PyObject*) setattrfunc; 
     43typedef int function(PyObject*, PyObject*, PyObject*) setattrofunc; 
     44typedef int function(PyObject*, PyObject*) cmpfunc; 
     45typedef PyObject* function(PyObject*) reprfunc; 
     46typedef int function(PyObject*) hashfunc; 
     47typedef PyObject* function(PyObject*, PyObject*, int) richcmpfunc; 
     48typedef PyObject* function(PyObject*) getiterfunc; 
     49typedef PyObject* function(PyObject*) iternextfunc; 
     50typedef PyObject* function(PyObject*, PyObject*, PyObject*) descrgetfunc; 
     51typedef int function(PyObject*, PyObject*, PyObject*) descrsetfunc; 
     52typedef int function(PyObject*, PyObject*, PyObject*) initproc; 
     53typedef PyObject* function(PyTypeObject*, PyObject*, PyObject*) newfunc; 
     54typedef PyObject* function(PyTypeObject*, int) allocfunc; 
     55 
     56} // extern(C) 
    957     
    1058struct PyObject 
    1159{ 
    1260    int ob_refcnt; 
    13     PyTypeObject *ob_type; 
     61    PyTypeObject* ob_type; 
    1462} 
    1563 
     
    1765{ 
    1866    int ob_refcnt; 
    19     PyTypeObject *obType; 
     67    PyTypeObject* obType; 
    2068    int ob_size; 
    2169} 
     
    2371struct PyMemberDef 
    2472{ 
    25     char *name; 
     73    char* name; 
    2674    int type; 
    2775    int offset; 
    2876    int flags; 
    29     char *doc; 
     77    char* doc; 
     78
     79 
     80// moved here from descrobject - it makes more sense 
     81struct PyGetSetDef 
     82
     83    char* name; 
     84    getter get; 
     85    setter set; 
     86    char* doc; 
     87    void* closure; 
     88
     89 
     90// moved here from methodobject - it makes more sense 
     91struct PyMethodDef 
     92
     93    char* ml_name; 
     94    PyCFunction ml_meth; 
     95    int ml_flags; 
     96    char* ml_doc; 
    3097} 
    3198 
     
    104171{ 
    105172    int ob_refcnt; 
    106     PyTypeObject *ob_type; 
     173    PyTypeObject* ob_type; 
    107174    int ob_size; 
    108175    char *tp_name; 
     
    115182    cmpfunc tp_compare; 
    116183    reprfunc tp_repr; 
    117     PyNumberMethods *tp_as_number; 
    118     PySequenceMethods *tp_as_sequence; 
    119     PyMappingMethods *tp_as_mapping; 
     184    PyNumberMethods* tp_as_number; 
     185    PySequenceMethods* tp_as_sequence; 
     186    PyMappingMethods* tp_as_mapping; 
    120187    hashfunc tp_hash; 
    121188    ternaryfunc tp_call; 
     
    123190    getattrofunc tp_getattro; 
    124191    setattrofunc tp_setattro; 
    125     PyBufferProcs *tp_as_buffer; 
     192    PyBufferProcs* tp_as_buffer; 
    126193    int tp_flags; 
    127     char *tp_doc; 
     194    char* tp_doc; 
    128195    traverseproc tp_traverse; 
    129196    inquiry tp_clear; 
     
    132199    getiterfunc tp_iter; 
    133200    iternextfunc tp_iternext; 
    134 //  PyMethodDef *tp_methods;    FIX_ME! 
    135     PyMemberDef *tp_members; 
    136 //  PyGetSetDef *tp_getset;     FIX_ME! 
    137     PyTypeObject *tp_base; 
     201    PyMethodDef* tp_methods; 
     202    PyMemberDef* tp_members; 
     203    PyGetSetDef* tp_getset; 
     204    PyTypeObject* tp_base; 
    138205    PyObject *tp_dict; 
    139206    descrgetfunc tp_descr_get; 
     
    145212    freefunc tp_free; 
    146213    inquiry tp_is_gc; 
    147     PyObject *tp_bases; 
    148     PyObject *tp_mro; 
    149     PyObject *tp_cache; 
    150     PyObject *tp_subclasses; 
    151     PyObject *tp_weaklist; 
     214    PyObject* tp_bases; 
     215    PyObject* tp_mro; 
     216    PyObject* tp_cache; 
     217    PyObject* tp_subclasses; 
     218    PyObject* tp_weaklist; 
    152219    destructor tp_del;   
    153220} 
     
    160227    PySequenceMethods as_sequence; 
    161228    PyBufferProcs as_buffer; 
    162     PyObject *name; 
    163     PyObject *slots; 
    164 
    165  
    166 // function pointers used as struct members 
    167 typedef PyObject* function(PyObject*) unaryfunc; 
    168 typedef PyObject* function(PyObject*, PyObject*) binaryfunc; 
    169 typedef PyObject* function(PyObject*, PyObject*, PyObject*) ternaryfunc; 
    170 typedef int function(PyObject*) inquiry; 
    171 typedef int function(PyObject**, PyObject**) coercion; 
    172 typedef PyObject* function(PyObject*, int) intargfunc; 
    173 typedef PyObject* function(PyObject*, int, int) intintargfunc; 
    174 typedef int function(PyObject*, int, PyObject*) intobjargproc; 
    175 typedef int function(PyObject*, int, int, PyObject*) intintobjargproc; 
    176 typedef int function(PyObject*, PyObject*, PyObject*) objobjargproc; 
    177 typedef int function(PyObject*, int, void**) getreadbufferproc; 
    178 typedef int function(PyObject*, int, void**) getwritebufferproc; 
    179 typedef int function(PyObject*, int*) getsegcountproc; 
    180 typedef int function(PyObject*, int, char**) getcharbufferproc; 
    181 typedef int function(PyObject*, PyObject*) objobjproc; 
    182 typedef int function(PyObject*, void*) visitproc; 
    183 typedef int function(PyObject*, visitproc, void*) traverseproc; 
    184  
    185 private import std.c.stdio; 
    186  
    187 typedef void function(void*) freefunc; 
    188 typedef void function(PyObject*) destructor; 
    189 typedef int function(PyObject*, FILE*, int) printfunc; 
    190 typedef PyObject* function(PyObject*, char*) getattrfunc; 
    191 typedef PyObject* function(PyObject*, PyObject*) getattrofunc; 
    192 typedef int function(PyObject*, char*, PyObject*) setattrfunc; 
    193 typedef int function(PyObject*, PyObject*, PyObject*) setattrofunc; 
    194 typedef int function(PyObject*, PyObject*) cmpfunc; 
    195 typedef PyObject* function(PyObject*) reprfunc; 
    196 typedef int function(PyObject*) hashfunc; 
    197 typedef PyObject* function(PyObject*, PyObject*, int) richcmpfunc; 
    198 typedef PyObject* function(PyObject*) getiterfunc; 
    199 typedef PyObject* function(PyObject*) iternextfunc; 
    200 typedef PyObject* function(PyObject*, PyObject*, PyObject*) descrgetfunc; 
    201 typedef int function(PyObject*, PyObject*, PyObject*) descrsetfunc; 
    202 typedef int function(PyObject*, PyObject*, PyObject*) initproc; 
    203 typedef PyObject* function(PyTypeObject*, PyObject*, PyObject*) newfunc; 
    204 typedef PyObject* function(PyTypeObject*, int) allocfunc; 
    205  
    206 } // extern(C) 
     229    PyObject* name; 
     230    PyObject* slots; 
     231
    207232 
    208233const int Py_PRINT_RAW                          = 1;