Update of 
/cvsroot/playerstage/code/player/client_libs/libplayerc/bindings/python
In directory 
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22298/client_libs/libplayerc/bindings/python

Modified Files:
        playerc.i 
Log Message:
Updated python bindings to handle arrays of floats correctly. Added support for 
multi_pos actarray command to p2os driver.


Index: playerc.i
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc/bindings/python/playerc.i,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** playerc.i   18 Jun 2006 19:34:32 -0000      1.22
--- playerc.i   20 Mar 2007 07:30:42 -0000      1.23
***************
*** 41,44 ****
--- 41,71 ----
  }
  
+ %typemap(in) float [ANY] (float temp[$1_dim0])
+ {
+   int i;
+   if (!PySequence_Check($input))
+   {
+     PyErr_SetString(PyExc_ValueError,"Expected a sequence");
+     return NULL;
+   }
+   if (PySequence_Length($input) != $1_dim0) {
+     PyErr_SetString(PyExc_ValueError,"Size mismatch. Expected $1_dim0 
elements");
+     return NULL;
+   }
+   for (i = 0; i < $1_dim0; i++)
+   {
+     PyObject *o = PySequence_GetItem($input,i);
+     if (PyNumber_Check(o))
+     {
+       temp[i] = (float) PyFloat_AsDouble(o);    }
+     else
+     {
+       PyErr_SetString(PyExc_ValueError,"Sequence elements must be numbers");
+       return NULL;
+     }
+   }
+   $1 = temp;
+ }
+ 
  %typemap(python,in) uint8_t data[]
  {


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to