[PD-cvs] externals/grill/py/source main.cpp,1.8,1.9 main.h,1.13,1.14 pyargs.cpp,1.3,1.4 pyext.cpp,1.11,1.12 pyext.h,1.9,1.10

xovo at users.sourceforge.net xovo at users.sourceforge.net
Wed Jan 7 04:38:27 CET 2004


Update of /cvsroot/pure-data/externals/grill/py/source
In directory sc8-pr-cvs1:/tmp/cvs-serv16867/source

Modified Files:
	main.cpp main.h pyargs.cpp pyext.cpp pyext.h 
Log Message:
 ""

Index: main.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/main.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** main.cpp	6 Jan 2004 03:38:37 -0000	1.8
--- main.cpp	7 Jan 2004 03:38:25 -0000	1.9
***************
*** 129,133 ****
  
  
! void py::m__dir(PyObject *obj)
  {
      if(obj) {
--- 129,133 ----
  
  
! void py::GetDir(PyObject *obj,AtomList &lst)
  {
      if(obj) {
***************
*** 135,147 ****
      
          PyObject *pvar  = PyObject_Dir(obj);
! 	    if(pvar == NULL) {
  		    PyErr_Print(); // no method found
- 	    }
  	    else {
!             AtomList *lst = GetPyArgs(pvar);
!             if(lst) {
!                 // dump dir to attribute outlet
!                 ToOutAnything(GetOutAttr(),thisTag(),lst->Count(),lst->Atoms());
!                 delete lst;
              }
              else
--- 135,144 ----
      
          PyObject *pvar  = PyObject_Dir(obj);
! 	    if(!pvar)
  		    PyErr_Print(); // no method found
  	    else {
!             AtomList *l = GetPyArgs(pvar);
!             if(l) { 
!                 lst = *l; delete l; 
              }
              else
***************
*** 152,155 ****
--- 149,160 ----
          PY_UNLOCK
      }
+ }
+ 
+ void py::m__dir(PyObject *obj)
+ {
+     AtomList lst;
+     GetDir(obj,lst);
+     // dump dir to attribute outlet
+     ToOutAnything(GetOutAttr(),thisTag(),lst.Count(),lst.Atoms());
  }
  

Index: main.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/main.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** main.h	6 Jan 2004 03:38:37 -0000	1.13
--- main.h	7 Jan 2004 03:38:25 -0000	1.14
***************
*** 70,73 ****
--- 70,74 ----
  
      V m_dir() { m__dir(module); }
+     V mg_dir(AtomList &lst) { m__dir(module); }
      V m_doc() { m__doc(dict); }
  
***************
*** 77,80 ****
--- 78,83 ----
  	static const C *py_doc;
  
+     V GetDir(PyObject *obj,AtomList &lst);
+ 
  	V GetModulePath(const C *mod,C *dir,I len);
  	V AddToPath(const C *dir);
***************
*** 138,141 ****
--- 141,145 ----
  	FLEXT_CALLBACK_V(m_stop)
  	FLEXT_CALLBACK(m_dir)
+ 	FLEXT_ATTRGET_V(mg_dir)
  	FLEXT_CALLBACK(m_doc)
      FLEXT_CALLBACK_T(tick)

Index: pyargs.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/pyargs.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** pyargs.cpp	6 Jan 2004 03:38:37 -0000	1.3
--- pyargs.cpp	7 Jan 2004 03:38:25 -0000	1.4
***************
*** 13,21 ****
  static PyObject *MakePyAtom(const t_atom &at)
  {
!     if(flext::IsFloat(at)) return PyFloat_FromDouble((D)flext::GetFloat(at));
! 	else if(flext::IsInt(at)) return PyInt_FromLong(flext::GetInt(at));
! 	else if(flext::IsSymbol(at)) return PyString_FromString(flext::GetString(at));
  //	else if(flext::IsPointer(at)) return NULL; // not handled
!     else return NULL;
  }
  
--- 13,29 ----
  static PyObject *MakePyAtom(const t_atom &at)
  {
! 	if(flext::IsSymbol(at)) return PyString_FromString(flext::GetString(at));
  //	else if(flext::IsPointer(at)) return NULL; // not handled
!     else if(flext::CanbeInt(at) && flext::CanbeFloat(at)) {
!         // if a number can be an integer... let at be an integer!
!         int ival = flext::GetAInt(at);
!         double fval = flext::GetAFloat(at);
!         return (double)ival == fval?PyInt_FromLong(ival):PyFloat_FromDouble(fval);
!     }
!     // these following should never happen
!     else if(flext::IsFloat(at)) return PyFloat_FromDouble((D)flext::GetFloat(at));
! 	else if(flext::IsInt(at)) return PyInt_FromLong(flext::GetInt(at));
!   
!     return NULL;
  }
  

Index: pyext.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/pyext.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** pyext.cpp	6 Jan 2004 03:38:37 -0000	1.11
--- pyext.cpp	7 Jan 2004 03:38:25 -0000	1.12
***************
*** 13,17 ****
  
  
! FLEXT_LIB_V("pyext",pyext)
  
  V pyext::Setup(t_classid c)
--- 13,17 ----
  
  
! FLEXT_LIB_V("pyext pyx",pyext)
  
  V pyext::Setup(t_classid c)
***************
*** 23,26 ****
--- 23,29 ----
  	FLEXT_CADDMETHOD_(c,0,"doc",m_doc);
  	FLEXT_CADDMETHOD_(c,0,"doc+",m_doc_);
+ 
+   	FLEXT_CADDATTR_VAR(c,"args",args,ms_args);
+ 	FLEXT_CADDATTR_GET(c,"dir+",mg_dir_);
  
  #ifdef FLEXT_THREADS

Index: pyext.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/pyext.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** pyext.h	21 Oct 2003 02:38:31 -0000	1.9
--- pyext.h	7 Jan 2004 03:38:25 -0000	1.10
***************
*** 49,53 ****
--- 49,55 ----
  	V m_reload();
  	V m_reload_(I argc,const t_atom *argv);
+     V ms_args(const AtomList &a) { m_reload_(a.Count(),a.Atoms()); }
      V m_dir_() { m__dir(pyobj); }
+     V mg_dir_(AtomList &lst) { GetDir(pyobj,lst); }
      V m_doc_() { m__doc(pyobj); }
  	virtual V m_help();
***************
*** 109,113 ****
--- 111,120 ----
  	FLEXT_CALLBACK_V(m_reload_)
  	FLEXT_CALLBACK(m_dir_)
+ 	FLEXT_CALLGET_V(mg_dir_)
  	FLEXT_CALLBACK(m_doc_)
+ 	FLEXT_CALLGET_V(mg_doc_)
+ 
+     FLEXT_ATTRGET_V(args)
+     FLEXT_CALLSET_V(ms_args)
  
  	FLEXT_CALLBACK_S(m_get)






More information about the Pd-cvs mailing list