diff options
author | Nicholas Piper <nicholas@users.sourceforge.net> | 2006-05-06 16:27:57 +0000 |
---|---|---|
committer | Nicholas Piper <nicholas@users.sourceforge.net> | 2006-05-06 16:27:57 +0000 |
commit | 3e6c8bf8b536725c15378edf9042c677675342a9 (patch) | |
tree | 2598f66438afbf32d0d42af6f48ab246f90ceb49 | |
parent | 065bb22b051f9a888b34d5db710ce958a0e98fa0 (diff) | |
download | libgpod-3e6c8bf8b536725c15378edf9042c677675342a9.tar.gz libgpod-3e6c8bf8b536725c15378edf9042c677675342a9.tar.xz libgpod-3e6c8bf8b536725c15378edf9042c677675342a9.zip |
Add gint8-gint64 typemaps for 'in'
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1255 f01d2545-417e-4e96-918e-98f8d0dbbcb6
-rw-r--r-- | bindings/python/gpod.i | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/bindings/python/gpod.i b/bindings/python/gpod.i index c6f0bbf..39de9c1 100644 --- a/bindings/python/gpod.i +++ b/bindings/python/gpod.i @@ -114,6 +114,19 @@ typedef char gchar; } } +%typemap(in) gint8 { + long ival; + ival = PyInt_AsInt($input); + if (PyErr_Occurred()) + SWIG_fail; + if ((ival < -128) || (ival > 127)) { + PyErr_SetString(PyExc_ValueError, "$symname: Value must be between -128 and 127"); + SWIG_fail; + } else { + $1 = (gint8) ival; + } +} + %typemap(in) guint16 { unsigned long ival; ival = PyInt_AsUnsignedLongMask($input); @@ -127,6 +140,19 @@ typedef char gchar; } } +%typemap(in) gint16 { + long ival; + ival = PyInt_AsLong($input); + if (PyErr_Occurred()) + SWIG_fail; + if ((ival < -32768) || (ival > 32767)) { + PyErr_SetString(PyExc_ValueError, "$symname: Value must be between -32,768 and 32,767"); + SWIG_fail; + } else { + $1 = (gint16) ival; + } +} + %typemap(in) guint32 { unsigned long ival; ival = PyInt_AsUnsignedLongMask($input); @@ -135,6 +161,14 @@ typedef char gchar; $1 = (guint32) ival; } +%typemap(in) gint32 { + long ival; + ival = PyInt_AsLong($input); + if (PyErr_Occurred()) + SWIG_fail; + $1 = (gint32) ival; +} + %typemap(in) guint64 { unsigned long ival; ival = PyInt_AsUnsignedLongLongMask($input); @@ -143,6 +177,14 @@ typedef char gchar; $1 = (guint64) ival; } +%typemap(in) gint64 { + long ival; + ival = PyInt_AsUnsignedLongMask($input); + if (PyErr_Occurred()) + SWIG_fail; + $1 = (gint64) ival; +} + %typemap(out) guint64 { $result = PyLong_FromUnsignedLongLong($1); } |