Commits

Anonymous committed 146b1a8

del files

Comments (0)

Files changed (2)

src/_object.c

-#include <EXTERN.h>
-#include <perl.h>
-
-#include "Python.h"
-#include "_interp.h"
-#include "_object.h"
-
-/*
-typedef struct {
-    PyObject_HEAD
-    SV *sv;
-} SvRV_Object;
-*/
-
-PyObject *
-sv2py(Perl_Object *self, SV *sv)
-{
-    PyObject *o;
-    dP;
-
-    if(SvPOK(sv)){
-        //string
-    	STRLEN len;
-	    char *s = SvPV(sv, len);
-	    o = Py_BuildValue("s#", s, len);
-    
-    }else if(SvNOK(sv)){
-        //double
-    	o = Py_BuildValue("d", SvNV(sv));
-    
-    }else if(SvIOK(sv)){
-        //long
-    	o = Py_BuildValue("l", SvIV(sv));
-
-    }else if(SvROK(sv)){
-        // ref
-	    o = Py_BuildValue("");
-
-    }else{
-        //other
-	    o = Py_BuildValue("");
-
-    }
-
-    return o;
-}
-
-SV*
-py2sv(Perl_Object *self, PyObject *o)
-{
-    dP;
-
-    if (o == Py_None) {
-	    return newSV(0);
-    }else if (PyString_Check(o)) {
-	    return newSVpvn(PyString_AS_STRING(o), PyString_GET_SIZE(o));
-    }else if (PyInt_Check(o)) {
-	    return newSViv(PyInt_AsLong(o));
-    }else if (PyLong_Check(o)) {
-	    unsigned long tmp = PyLong_AsUnsignedLong(o);
-	    return newSVuv(tmp);
-    }else if (PyFloat_Check(o)) {
-	    return newSVnv(PyFloat_AsDouble(o));
-    }else if (SVRV_Check(o)){
-	    return newSV(0);
-    }else {
-	    return newSV(0);
-    }
-    return NULL;
-
-}

src/_object.h

-
-typedef struct {
-    PyObject_HEAD
-    SV *sv;
-} SVRV_Object;
-
-PyObject* sv2py(Perl_Object *self, SV *sv);
-
-SV* py2sv(Perl_Object *self, PyObject *o);
-
-extern PyTypeObject SVRV_Type;
-
-#define SVRV_Check(v)  ((v)->ob_type == &SVRV_Type)
-//#define SVRV_RV(v)     (((PySVRV*)(v))->rv)
-