// wxString typemaps
-%typemap(in) wxString& (bool temp=False) {
+%typemap(in) wxString& (bool temp=false) {
$1 = wxString_in_helper($input);
if ($1 == NULL) SWIG_fail;
- temp = True;
+ temp = true;
}
%typemap(freearg) wxString& {
if (temp$argnum)
//---------------------------------------------------------------------------
// wxMemoryBuffer (needed for wxSTC)
-%typemap(in) wxMemoryBuffer& (bool temp=False) {
+%typemap(in) wxMemoryBuffer& (bool temp=false) {
if (!PyString_Check($input)) {
PyErr_SetString(PyExc_TypeError, "String buffer expected");
SWIG_fail;
char* str = PyString_AS_STRING($input);
int len = PyString_GET_SIZE($input);
$1 = new wxMemoryBuffer(len);
- temp = True;
+ temp = true;
memcpy($1->GetData(), str, len);
$1->SetDataLen(len);
}
//---------------------------------------------------------------------------
// Typemap for wxArrayString from Python sequence objects
-%typemap(in) wxArrayString& (bool temp=False) {
+%typemap(in) wxArrayString& (bool temp=false) {
if (! PySequence_Check($input)) {
PyErr_SetString(PyExc_TypeError, "Sequence of strings expected.");
SWIG_fail;
}
$1 = new wxArrayString;
- temp = True;
+ temp = true;
int i, len=PySequence_Length($input);
for (i=0; i<len; i++) {
PyObject* item = PySequence_GetItem($input, i);
//---------------------------------------------------------------------------
// Typemap for wxArrayInt from Python sequence objects
-%typemap(in) wxArrayInt& (bool temp=False) {
+%typemap(in) wxArrayInt& (bool temp=false) {
if (! PySequence_Check($input)) {
PyErr_SetString(PyExc_TypeError, "Sequence of integers expected.");
SWIG_fail;
}
$1 = new wxArrayInt;
- temp = True;
+ temp = true;
int i, len=PySequence_Length($input);
for (i=0; i<len; i++) {
PyObject* item = PySequence_GetItem($input, i);
}
-// These fragments are iserted in modules that need to convert PyObjects to
-// integer values, my versions allow any numeric type to be used, as long as
-// it can be converted to a PyInt. (Specifically, I allow floats where the
-// default SWIG_AsLong would raise an obsucre exception from within
-// PyLong_AsLong.)
-
-%fragment("SWIG_AsLong","header") %{
-SWIGSTATICINLINE(long)
-SWIG_AsLong(PyObject * obj)
-{
- if (PyNumber_Check(obj))
- return PyInt_AsLong(obj);
- else {
- PyObject* errmsg = PyString_FromFormat("Expected number, got %s",
- obj->ob_type->tp_name);
- PyErr_SetObject(PyExc_TypeError, errmsg);
- Py_DECREF(errmsg);
- return 0;
- }
-}
-%}
-
-%fragment("SWIG_AsUnsignedLong","header", fragment="SWIG_AsLong") %{
-SWIGSTATICINLINE(unsigned long)
-SWIG_AsUnsignedLong(PyObject * obj)
-{
- if (PyLong_Check(obj)) {
- return PyLong_AsUnsignedLong(obj);
- } else {
- long i = SWIG_AsLong(obj);
- if ( !PyErr_Occurred() && (i < 0)) {
- PyErr_SetString(PyExc_TypeError, "negative value received for unsigned type");
- }
- return i;
- }
-}
-%}
-
-
-%fragment("SWIG_AsDouble","header") %{
-SWIGSTATICINLINE(double)
-SWIG_AsDouble(PyObject *obj)
-{
- if (PyNumber_Check(obj))
- return PyFloat_AsDouble(obj);
- else {
- PyObject* errmsg = PyString_FromFormat("Expected number, got %s",
- obj->ob_type->tp_name);
- PyErr_SetObject(PyExc_TypeError, errmsg);
- Py_DECREF(errmsg);
- return 0;
- }
-}
-%}
-
-
//---------------------------------------------------------------------------
// Typemap for when GDI objects are returned by reference. This will cause a
// copy to be made instead of returning a reference to the same instance. The