[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[certi-cvs] applications/PyHLA/hla _omt/basicdata.cpp _omt/...
From: |
CERTI CVS commits |
Subject: |
[certi-cvs] applications/PyHLA/hla _omt/basicdata.cpp _omt/... |
Date: |
Thu, 23 Jun 2011 00:10:08 +0000 |
CVSROOT: /sources/certi
Module name: applications
Changes by: Petr Gotthard <gotthardp> 11/06/23 00:10:08
Modified files:
PyHLA/hla/_omt : basicdata.cpp module.cpp module.h
PyHLA/hla/_rti : exceptions.h federateambassador.cpp handles.cpp
module.cpp module.h rtiambassador.cpp
Log message:
Fixes to compile PyHLA under Python 3.1.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/applications/PyHLA/hla/_omt/basicdata.cpp?cvsroot=certi&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/applications/PyHLA/hla/_omt/module.cpp?cvsroot=certi&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/applications/PyHLA/hla/_omt/module.h?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/applications/PyHLA/hla/_rti/exceptions.h?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/applications/PyHLA/hla/_rti/federateambassador.cpp?cvsroot=certi&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/applications/PyHLA/hla/_rti/handles.cpp?cvsroot=certi&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/applications/PyHLA/hla/_rti/module.cpp?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/applications/PyHLA/hla/_rti/module.h?cvsroot=certi&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/applications/PyHLA/hla/_rti/rtiambassador.cpp?cvsroot=certi&r1=1.7&r2=1.8
Patches:
Index: _omt/basicdata.cpp
===================================================================
RCS file: /sources/certi/applications/PyHLA/hla/_omt/basicdata.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- _omt/basicdata.cpp 8 Jun 2009 15:52:01 -0000 1.6
+++ _omt/basicdata.cpp 23 Jun 2011 00:10:03 -0000 1.7
@@ -11,7 +11,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * $Id: basicdata.cpp,v 1.6 2009/06/08 15:52:01 gotthardp Exp $
+ * $Id: basicdata.cpp,v 1.7 2011/06/23 00:10:03 gotthardp Exp $
*/
// note: you must include Python.h before any standard headers are included
@@ -150,7 +150,7 @@
{
return PyTuple_Pack(2,
object,
- PyInt_FromLong(size));
+ PyLong_FromLong(size));
}
/*
@@ -163,7 +163,7 @@
if(!PyArg_ParseTuple(args, "h", &value))
return NULL;
int16_t buffer = BigEndian<int16_t>()(value);
- return PyString_FromStringAndSize((const char *)&buffer, sizeof(int16_t));
+ return PyBytes_FromStringAndSize((const char *)&buffer, sizeof(int16_t));
}
static PyObject *
@@ -193,7 +193,7 @@
if(!PyArg_ParseTuple(args, "l", &value))
return NULL;
int32_t buffer = BigEndian<int32_t>()(value);
- return PyString_FromStringAndSize((const char *)&buffer, sizeof(int32_t));
+ return PyBytes_FromStringAndSize((const char *)&buffer, sizeof(int32_t));
}
static PyObject *
@@ -225,7 +225,7 @@
if(!PyArg_ParseTuple(args, "L", &value))
return NULL;
int64_t buffer = BigEndian<int64_t>()(value);
- return PyString_FromStringAndSize((const char *)&buffer, sizeof(int64_t));
+ return PyBytes_FromStringAndSize((const char *)&buffer, sizeof(int64_t));
}
static PyObject *
@@ -257,7 +257,7 @@
if(!PyArg_ParseTuple(args, "f", &value))
return NULL;
float buffer = BigEndian<float>()(value);
- return PyString_FromStringAndSize((const char *)&buffer, sizeof(float));
+ return PyBytes_FromStringAndSize((const char *)&buffer, sizeof(float));
}
static PyObject *
@@ -287,7 +287,7 @@
if(!PyArg_ParseTuple(args, "d", &value))
return NULL;
double buffer = BigEndian<double>()(value);
- return PyString_FromStringAndSize((const char *)&buffer, sizeof(double));
+ return PyBytes_FromStringAndSize((const char *)&buffer, sizeof(double));
}
static PyObject *
@@ -317,7 +317,7 @@
if(!PyArg_ParseTuple(args, "h", &value))
return NULL;
int16_t buffer = LittleEndian<int16_t>()(value);
- return PyString_FromStringAndSize((const char *)&buffer, sizeof(int16_t));
+ return PyBytes_FromStringAndSize((const char *)&buffer, sizeof(int16_t));
}
static PyObject *
@@ -347,7 +347,7 @@
if(!PyArg_ParseTuple(args, "l", &value))
return NULL;
int32_t buffer = LittleEndian<int32_t>()(value);
- return PyString_FromStringAndSize((const char *)&buffer, sizeof(int32_t));
+ return PyBytes_FromStringAndSize((const char *)&buffer, sizeof(int32_t));
}
static PyObject *
@@ -379,7 +379,7 @@
if(!PyArg_ParseTuple(args, "L", &value))
return NULL;
int64_t buffer = LittleEndian<int64_t>()(value);
- return PyString_FromStringAndSize((const char *)&buffer, sizeof(int64_t));
+ return PyBytes_FromStringAndSize((const char *)&buffer, sizeof(int64_t));
}
static PyObject *
@@ -411,7 +411,7 @@
if(!PyArg_ParseTuple(args, "f", &value))
return NULL;
float buffer = LittleEndian<float>()(value);
- return PyString_FromStringAndSize((const char *)&buffer, sizeof(float));
+ return PyBytes_FromStringAndSize((const char *)&buffer, sizeof(float));
}
static PyObject *
@@ -441,7 +441,7 @@
if(!PyArg_ParseTuple(args, "d", &value))
return NULL;
double buffer = LittleEndian<double>()(value);
- return PyString_FromStringAndSize((const char *)&buffer, sizeof(double));
+ return PyBytes_FromStringAndSize((const char *)&buffer, sizeof(double));
}
static PyObject *
@@ -470,7 +470,7 @@
char buffer;
if(!PyArg_ParseTuple(args, "c", &buffer))
return NULL;
- return PyString_FromStringAndSize(&buffer, sizeof(char));
+ return PyBytes_FromStringAndSize(&buffer, sizeof(char));
}
static PyObject *
@@ -479,7 +479,7 @@
const char *buffer = getUnpackBuffer<char>(args);
if(buffer == NULL)
return NULL;
- return createObjectSizeTuple(PyString_FromStringAndSize(buffer,
sizeof(char)), sizeof(char));
+ return createObjectSizeTuple(PyBytes_FromStringAndSize(buffer,
sizeof(char)), sizeof(char));
}
static PyMethodDef HLAoctet_methods[] =
@@ -504,7 +504,7 @@
*(int32_t *)buffer = BigEndian<int32_t>()(length);
memcpy(buffer+sizeof(int32_t), value, length);
- PyObject *result = PyString_FromStringAndSize(buffer,
sizeof(int32_t)+length);
+ PyObject *result = PyBytes_FromStringAndSize(buffer,
sizeof(int32_t)+length);
free(buffer);
return result;
@@ -525,7 +525,7 @@
}
return createObjectSizeTuple(
- PyString_FromStringAndSize((const char *)buffer+sizeof(int32_t),
length),
+ PyBytes_FromStringAndSize((const char *)buffer+sizeof(int32_t),
length),
sizeof(int32_t)+length);
}
@@ -546,7 +546,7 @@
if(!PyArg_ParseTuple(args, "H", &value))
return NULL;
uint16_t buffer = BigEndian<uint16_t>()(value);
- return PyString_FromStringAndSize((const char *)&buffer, sizeof(uint16_t));
+ return PyBytes_FromStringAndSize((const char *)&buffer, sizeof(uint16_t));
}
static PyObject *
@@ -576,7 +576,7 @@
if(!PyArg_ParseTuple(args, "k", &value))
return NULL;
uint32_t buffer = BigEndian<uint32_t>()(value);
- return PyString_FromStringAndSize((const char *)&buffer, sizeof(uint32_t));
+ return PyBytes_FromStringAndSize((const char *)&buffer, sizeof(uint32_t));
}
static PyObject *
@@ -608,7 +608,7 @@
if(!PyArg_ParseTuple(args, "K", &value))
return NULL;
uint64_t buffer = BigEndian<uint64_t>()(value);
- return PyString_FromStringAndSize((const char *)&buffer, sizeof(uint64_t));
+ return PyBytes_FromStringAndSize((const char *)&buffer, sizeof(uint64_t));
}
static PyObject *
@@ -666,8 +666,12 @@
PyTypeObject RtiCodingType =
{
+#if PY_MAJOR_VERSION >= 3
+ PyVarObject_HEAD_INIT(NULL, 0)
+#else
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
+#endif
MODULE_NAME ".Coding", /* tp_name */
sizeof(RtiCoding), /* tp_basicsize */
0, /* tp_itemsize */
@@ -675,7 +679,7 @@
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
- 0, /* tp_compare */
+ 0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -717,7 +721,7 @@
if(result->ob_dict == NULL)
return; // error occurred
- PyObject* octetBoundary = PyInt_FromLong(size);
+ PyObject* octetBoundary = PyLong_FromLong(size);
if(octetBoundary == NULL)
return; // error occurred
PyDict_SetItemString(result->ob_dict, "octetBoundary", octetBoundary);
@@ -761,4 +765,4 @@
add_encoding(dict, pos->co_name, pos->co_size, pos->co_methods);
}
-// $Id: basicdata.cpp,v 1.6 2009/06/08 15:52:01 gotthardp Exp $
+// $Id: basicdata.cpp,v 1.7 2011/06/23 00:10:03 gotthardp Exp $
Index: _omt/module.cpp
===================================================================
RCS file: /sources/certi/applications/PyHLA/hla/_omt/module.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- _omt/module.cpp 15 Nov 2008 14:34:05 -0000 1.3
+++ _omt/module.cpp 23 Jun 2011 00:10:04 -0000 1.4
@@ -11,7 +11,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * $Id: module.cpp,v 1.3 2008/11/15 14:34:05 gotthardp Exp $
+ * $Id: module.cpp,v 1.4 2011/06/23 00:10:04 gotthardp Exp $
*/
// note: you must include Python.h before any standard headers are included
@@ -60,14 +60,39 @@
{NULL, NULL, 0, NULL} // sentinel
};
+static const char *omt_doc =
+ "Modeling and Simulation (M&S) High Level Architecture (HLA) -- Object
Model Template (OMT).";
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef omt_module =
+{
+ PyModuleDef_HEAD_INIT,
+ "_omt", /* m_name */
+ omt_doc, /* m_doc */
+ -1, /* m_size */
+ omt_methods, /* m_methods */
+};
+
+PyMODINIT_FUNC
+PyInit__omt(void)
+{
+ PyObject* module = PyModule_Create(&omt_module);
+
+ // call initializers
+ OmtInitializer::init(module);
+ return module;
+}
+
+#else
+
PyMODINIT_FUNC
init_omt(void)
{
- PyObject* module = Py_InitModule3("_omt", omt_methods,
- "Modeling and Simulation (M&S) High Level Architecture (HLA) -- Object
Model Template (OMT).");
+ PyObject* module = Py_InitModule3("_omt", omt_methods, omt_doc);
// call initializers
OmtInitializer::init(module);
}
+#endif
-// $Id: module.cpp,v 1.3 2008/11/15 14:34:05 gotthardp Exp $
+// $Id: module.cpp,v 1.4 2011/06/23 00:10:04 gotthardp Exp $
Index: _omt/module.h
===================================================================
RCS file: /sources/certi/applications/PyHLA/hla/_omt/module.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- _omt/module.h 15 Nov 2008 14:34:05 -0000 1.2
+++ _omt/module.h 23 Jun 2011 00:10:04 -0000 1.3
@@ -11,7 +11,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * $Id: module.h,v 1.2 2008/11/15 14:34:05 gotthardp Exp $
+ * $Id: module.h,v 1.3 2011/06/23 00:10:04 gotthardp Exp $
*/
#ifndef OMT_MODULE_H
@@ -21,6 +21,11 @@
#define MODULE_NAME "omt"
+#if PY_VERSION_HEX < 0x02060000
+// Python 2.5 compatibility macros
+#define PyBytes_FromStringAndSize PyString_FromStringAndSize
+#endif
+
class OmtInitializer
{
public:
@@ -33,4 +38,4 @@
#endif // OMT_MODULE_H
-// $Id: module.h,v 1.2 2008/11/15 14:34:05 gotthardp Exp $
+// $Id: module.h,v 1.3 2011/06/23 00:10:04 gotthardp Exp $
Index: _rti/exceptions.h
===================================================================
RCS file: /sources/certi/applications/PyHLA/hla/_rti/exceptions.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- _rti/exceptions.h 6 Nov 2008 08:15:51 -0000 1.2
+++ _rti/exceptions.h 23 Jun 2011 00:10:06 -0000 1.3
@@ -11,7 +11,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * $Id: exceptions.h,v 1.2 2008/11/06 08:15:51 gotthardp Exp $
+ * $Id: exceptions.h,v 1.3 2011/06/23 00:10:06 gotthardp Exp $
*/
#ifndef RTI_EXCEPTIONS_H
@@ -129,7 +129,7 @@
}
PyObject *strvalue = PyObject_Str(value);
- msg << ": " << PyString_AsString(strvalue);
+ msg << ": " << PyUnicode_AsString(strvalue);
Py_XDECREF(strvalue);
Py_XDECREF(exception);
@@ -141,4 +141,4 @@
#endif // RTI_EXCEPTIONS_H
-// $Id: exceptions.h,v 1.2 2008/11/06 08:15:51 gotthardp Exp $
+// $Id: exceptions.h,v 1.3 2011/06/23 00:10:06 gotthardp Exp $
Index: _rti/federateambassador.cpp
===================================================================
RCS file: /sources/certi/applications/PyHLA/hla/_rti/federateambassador.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- _rti/federateambassador.cpp 1 Oct 2010 19:56:39 -0000 1.6
+++ _rti/federateambassador.cpp 23 Jun 2011 00:10:07 -0000 1.7
@@ -11,7 +11,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * $Id: federateambassador.cpp,v 1.6 2010/10/01 19:56:39 gotthardp Exp $
+ * $Id: federateambassador.cpp,v 1.7 2011/06/23 00:10:07 gotthardp Exp $
*/
// note: you must include Python.h before any standard headers are included
@@ -52,7 +52,7 @@
{
delete self->ob_federate;
- self->ob_type->tp_free((PyObject*)self);
+ Py_TYPE(self)->tp_free((PyObject*)self);
}
Py_FederateAmbassador::Py_FederateAmbassador(FederateAmbassadorObject
*federate)
@@ -1117,8 +1117,12 @@
PyTypeObject FederateAmbassadorObjectType =
{
+#if PY_MAJOR_VERSION >= 3
+ PyVarObject_HEAD_INIT(NULL, 0)
+#else
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
+#endif
MODULE_NAME ".FederateAmbassador", /* tp_name */
sizeof(FederateAmbassadorObject), /* tp_basicsize */
0, /* tp_itemsize */
@@ -1126,7 +1130,7 @@
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
- 0, /* tp_compare */
+ 0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -1177,4 +1181,4 @@
PyModule_AddObject(module, "FederateAmbassador", (PyObject
*)&FederateAmbassadorObjectType);
}
-// $Id: federateambassador.cpp,v 1.6 2010/10/01 19:56:39 gotthardp Exp $
+// $Id: federateambassador.cpp,v 1.7 2011/06/23 00:10:07 gotthardp Exp $
Index: _rti/handles.cpp
===================================================================
RCS file: /sources/certi/applications/PyHLA/hla/_rti/handles.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- _rti/handles.cpp 10 Sep 2010 21:04:29 -0000 1.5
+++ _rti/handles.cpp 23 Jun 2011 00:10:07 -0000 1.6
@@ -11,7 +11,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * $Id: handles.cpp,v 1.5 2010/09/10 21:04:29 gotthardp Exp $
+ * $Id: handles.cpp,v 1.6 2011/06/23 00:10:07 gotthardp Exp $
*/
// note: you must include Python.h before any standard headers are included
@@ -23,6 +23,12 @@
#include "handles.h"
+#if PY_VERSION_HEX < 0x02060000
+// Python 2.5 compatibility macros
+#define Py_TYPE(o) (((PyObject*)(o))->ob_type)
+#define PyBytes_FromStringAndSize PyString_FromStringAndSize
+#endif
+
/* Numeric handles are represented by encapsulated integers.
* These objects can be assigned and compared, but cannot be directly
initialized
* and do not support arithmetic operations.
@@ -265,7 +271,7 @@
RTI::ULong length;
char* data = value->getValuePointer(i, length);
- PyObject *atData = PyString_FromStringAndSize(data, length);
+ PyObject *atData = PyBytes_FromStringAndSize(data, length);
PyDict_SetItem(result, atHandle, atData);
@@ -329,7 +335,7 @@
RTI::ULong length;
char* data = value->getValuePointer(i, length);
- PyObject *atData = PyString_FromStringAndSize(data, length);
+ PyObject *atData = PyBytes_FromStringAndSize(data, length);
PyDict_SetItem(result, atHandle, atData);
@@ -343,21 +349,14 @@
static int
ulonghandle_print(RtiULongHandleObject *v, FILE *fp, int flags)
{
- fprintf(fp, "<%s=%lu>", v->ob_type->tp_name, v->ob_ival);
+ fprintf(fp, "<%s=%lu>", Py_TYPE(v)->tp_name, v->ob_ival);
return 0;
}
-static int
-ulonghandle_compare(RtiULongHandleObject *v, RtiULongHandleObject *w)
-{
- return (v->ob_ival < w->ob_ival) ? -1 :
- (v->ob_ival > w->ob_ival) ? 1 : 0;
-}
-
static PyObject *
ulonghandle_repr(RtiULongHandleObject *v)
{
- return PyString_FromFormat("<%s=%lu>", v->ob_type->tp_name, v->ob_ival);
+ return PyUnicode_FromFormat("<%s=%lu>", Py_TYPE(v)->tp_name, v->ob_ival);
}
static long
@@ -368,9 +367,49 @@
return (v->ob_ival >> __shift) | (v->ob_ival & ~0UL << __shift);
}
+static PyObject *
+ulonghandle_richcompare(RtiULongHandleObject *v, RtiULongHandleObject *w, int
op)
+{
+ int res;
+
+ switch(op)
+ {
+ case Py_LT:
+ res = v->ob_ival < w->ob_ival;
+ break;
+ case Py_LE:
+ res = v->ob_ival <= w->ob_ival;
+ break;
+ case Py_EQ:
+ res = v->ob_ival == w->ob_ival;
+ break;
+ case Py_NE:
+ res = v->ob_ival != w->ob_ival;
+ break;
+ case Py_GT:
+ res = v->ob_ival > w->ob_ival;
+ break;
+ case Py_GE:
+ res = v->ob_ival >= w->ob_ival;
+ break;
+ default:
+ PyErr_BadArgument();
+ return NULL;
+ }
+
+ if(res)
+ Py_RETURN_TRUE;
+ else
+ Py_RETURN_FALSE;
+}
+
PyTypeObject RtiObjectClassHandleType = {
+#if PY_MAJOR_VERSION >= 3
+ PyVarObject_HEAD_INIT(NULL, 0)
+#else
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
+#endif
MODULE_NAME ".ObjectClassHandle", /* tp_name */
sizeof(RtiULongHandleObject), /* tp_basicsize */
0, /* tp_itemsize */
@@ -378,7 +417,7 @@
(printfunc)ulonghandle_print, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
- (cmpfunc)ulonghandle_compare, /* tp_compare */
+ 0, /* tp_reserved */
(reprfunc)ulonghandle_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -391,11 +430,18 @@
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"ObjectClassHandle", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ (richcmpfunc)ulonghandle_richcompare, /* tp_richcompare */
};
PyTypeObject RtiInteractionClassHandleType = {
+#if PY_MAJOR_VERSION >= 3
+ PyVarObject_HEAD_INIT(NULL, 0)
+#else
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
+#endif
MODULE_NAME ".InteractionClassHandle", /* tp_name */
sizeof(RtiULongHandleObject), /* tp_basicsize */
0, /* tp_itemsize */
@@ -403,7 +449,7 @@
(printfunc)ulonghandle_print, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
- (cmpfunc)ulonghandle_compare, /* tp_compare */
+ 0, /* tp_reserved */
(reprfunc)ulonghandle_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -416,11 +462,18 @@
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"InteractionClassHandle", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ (richcmpfunc)ulonghandle_richcompare, /* tp_richcompare */
};
PyTypeObject RtiAttributeHandleType = {
+#if PY_MAJOR_VERSION >= 3
+ PyVarObject_HEAD_INIT(NULL, 0)
+#else
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
+#endif
MODULE_NAME ".AttributeHandle", /* tp_name */
sizeof(RtiULongHandleObject), /* tp_basicsize */
0, /* tp_itemsize */
@@ -428,7 +481,7 @@
(printfunc)ulonghandle_print, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
- (cmpfunc)ulonghandle_compare, /* tp_compare */
+ 0, /* tp_reserved */
(reprfunc)ulonghandle_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -441,11 +494,18 @@
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"AttributeHandle", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ (richcmpfunc)ulonghandle_richcompare, /* tp_richcompare */
};
PyTypeObject RtiParameterHandleType = {
+#if PY_MAJOR_VERSION >= 3
+ PyVarObject_HEAD_INIT(NULL, 0)
+#else
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
+#endif
MODULE_NAME ".ParameterHandle", /* tp_name */
sizeof(RtiULongHandleObject), /* tp_basicsize */
0, /* tp_itemsize */
@@ -453,7 +513,7 @@
(printfunc)ulonghandle_print, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
- (cmpfunc)ulonghandle_compare, /* tp_compare */
+ 0, /* tp_reserved */
(reprfunc)ulonghandle_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -466,11 +526,18 @@
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"ParameterHandle", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ (richcmpfunc)ulonghandle_richcompare, /* tp_richcompare */
};
PyTypeObject RtiObjectHandleType = {
+#if PY_MAJOR_VERSION >= 3
+ PyVarObject_HEAD_INIT(NULL, 0)
+#else
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
+#endif
MODULE_NAME ".ObjectHandle", /* tp_name */
sizeof(RtiULongHandleObject), /* tp_basicsize */
0, /* tp_itemsize */
@@ -478,7 +545,7 @@
(printfunc)ulonghandle_print, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
- (cmpfunc)ulonghandle_compare, /* tp_compare */
+ 0, /* tp_reserved */
(reprfunc)ulonghandle_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -491,11 +558,18 @@
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"ClassHandle", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ (richcmpfunc)ulonghandle_richcompare, /* tp_richcompare */
};
PyTypeObject RtiFederateHandleType = {
+#if PY_MAJOR_VERSION >= 3
+ PyVarObject_HEAD_INIT(NULL, 0)
+#else
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
+#endif
MODULE_NAME ".FederateHandle", /* tp_name */
sizeof(RtiULongHandleObject), /* tp_basicsize */
0, /* tp_itemsize */
@@ -503,7 +577,7 @@
(printfunc)ulonghandle_print, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
- (cmpfunc)ulonghandle_compare, /* tp_compare */
+ 0, /* tp_reserved */
(reprfunc)ulonghandle_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -516,11 +590,18 @@
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"FederateHandle", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ (richcmpfunc)ulonghandle_richcompare, /* tp_richcompare */
};
PyTypeObject RtiOrderingHandleType = {
+#if PY_MAJOR_VERSION >= 3
+ PyVarObject_HEAD_INIT(NULL, 0)
+#else
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
+#endif
MODULE_NAME ".OrderingHandle", /* tp_name */
sizeof(RtiULongHandleObject), /* tp_basicsize */
0, /* tp_itemsize */
@@ -528,7 +609,7 @@
(printfunc)ulonghandle_print, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
- (cmpfunc)ulonghandle_compare, /* tp_compare */
+ 0, /* tp_reserved */
(reprfunc)ulonghandle_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -541,11 +622,18 @@
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"OrderingHandle", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ (richcmpfunc)ulonghandle_richcompare, /* tp_richcompare */
};
PyTypeObject RtiTransportationHandleType = {
+#if PY_MAJOR_VERSION >= 3
+ PyVarObject_HEAD_INIT(NULL, 0)
+#else
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
+#endif
MODULE_NAME ".TransportationHandle", /* tp_name */
sizeof(RtiULongHandleObject), /* tp_basicsize */
0, /* tp_itemsize */
@@ -553,7 +641,7 @@
(printfunc)ulonghandle_print, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
- (cmpfunc)ulonghandle_compare, /* tp_compare */
+ 0, /* tp_reserved */
(reprfunc)ulonghandle_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -566,29 +654,23 @@
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"TransportationHandle", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ (richcmpfunc)ulonghandle_richcompare, /* tp_richcompare */
};
static int
EventRetractionHandle_print(EventRetractionHandleObject *v, FILE *fp, int
flags)
{
- fprintf(fp, "<%s=%lu:%lu>", v->ob_type->tp_name,
+ fprintf(fp, "<%s=%lu:%lu>", Py_TYPE(v)->tp_name,
v->ob_value.sendingFederate, v->ob_value.theSerialNumber);
return 0;
}
-static int
-EventRetractionHandle_compare(EventRetractionHandleObject *v,
EventRetractionHandleObject *w)
-{
- return v->ob_value.sendingFederate < w->ob_value.sendingFederate ? -1 :
- v->ob_value.sendingFederate > w->ob_value.sendingFederate ? 1 :
- v->ob_value.theSerialNumber < w->ob_value.theSerialNumber ? -1 :
- v->ob_value.theSerialNumber > w->ob_value.theSerialNumber ? 1 : 0;
-}
-
static PyObject *
EventRetractionHandle_repr(EventRetractionHandleObject *v)
{
- return PyString_FromFormat("<%s=%lu:%lu>", v->ob_type->tp_name,
+ return PyUnicode_FromFormat("<%s=%lu:%lu>", Py_TYPE(v)->tp_name,
v->ob_value.sendingFederate, v->ob_value.theSerialNumber);
}
@@ -601,9 +683,59 @@
| (v->ob_value.theSerialNumber >> __shift) |
(v->ob_value.theSerialNumber & ~0UL << __shift);
}
+static PyObject *
+EventRetractionHandle_richcompare(EventRetractionHandleObject *v,
EventRetractionHandleObject *w, int op)
+{
+ int res;
+
+ switch(op)
+ {
+ case Py_LT:
+ res = v->ob_value.sendingFederate < w->ob_value.sendingFederate ||
+ (v->ob_value.sendingFederate == w->ob_value.sendingFederate &&
+ v->ob_value.theSerialNumber < w->ob_value.theSerialNumber);
+ break;
+ case Py_LE:
+ res = v->ob_value.sendingFederate < w->ob_value.sendingFederate ||
+ (v->ob_value.sendingFederate == w->ob_value.sendingFederate &&
+ v->ob_value.theSerialNumber <= w->ob_value.theSerialNumber);
+ break;
+ case Py_EQ:
+ res = v->ob_value.sendingFederate == w->ob_value.sendingFederate &&
+ v->ob_value.theSerialNumber == w->ob_value.theSerialNumber;
+ break;
+ case Py_NE:
+ res = v->ob_value.sendingFederate != w->ob_value.sendingFederate ||
+ v->ob_value.theSerialNumber != w->ob_value.theSerialNumber;
+ break;
+ case Py_GT:
+ res = v->ob_value.sendingFederate > w->ob_value.sendingFederate ||
+ (v->ob_value.sendingFederate == w->ob_value.sendingFederate &&
+ v->ob_value.theSerialNumber > w->ob_value.theSerialNumber);
+ break;
+ case Py_GE:
+ res = v->ob_value.sendingFederate > w->ob_value.sendingFederate ||
+ (v->ob_value.sendingFederate == w->ob_value.sendingFederate &&
+ v->ob_value.theSerialNumber >= w->ob_value.theSerialNumber);
+ break;
+ default:
+ PyErr_BadArgument();
+ return NULL;
+ }
+
+ if(res)
+ Py_RETURN_TRUE;
+ else
+ Py_RETURN_FALSE;
+}
+
PyTypeObject EventRetractionHandleType = {
+#if PY_MAJOR_VERSION >= 3
+ PyVarObject_HEAD_INIT(NULL, 0)
+#else
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
+#endif
MODULE_NAME ".EventRetractionHandle", /* tp_name */
sizeof(RtiULongHandleObject), /* tp_basicsize */
0, /* tp_itemsize */
@@ -611,7 +743,7 @@
(printfunc)EventRetractionHandle_print, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
- (cmpfunc)EventRetractionHandle_compare, /* tp_compare */
+ 0, /* tp_reserved */
(reprfunc)EventRetractionHandle_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -624,6 +756,9 @@
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"EventRetractionHandle", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ (richcmpfunc)EventRetractionHandle_richcompare, /* tp_richcompare */
};
int
@@ -667,21 +802,14 @@
static int
RegionHandle_print(RegionHandleObject *v, FILE *fp, int flags)
{
- fprintf(fp, "<%s=%lu>", v->ob_type->tp_name, v->ob_handle);
+ fprintf(fp, "<%s=%lu>", Py_TYPE(v)->tp_name, v->ob_handle);
return 0;
}
-static int
-RegionHandle_compare(RegionHandleObject *v, RegionHandleObject *w)
-{
- return (v->ob_handle < w->ob_handle) ? -1 :
- (v->ob_handle > w->ob_handle) ? 1 : 0;
-}
-
static PyObject *
RegionHandle_repr(RegionHandleObject *v)
{
- return PyString_FromFormat("<%s=%lu>", v->ob_type->tp_name, v->ob_handle);
+ return PyUnicode_FromFormat("<%s=%lu>", Py_TYPE(v)->tp_name, v->ob_handle);
}
static long
@@ -692,9 +820,49 @@
return (v->ob_handle >> __shift) | (v->ob_handle & ~0UL << __shift);
}
+static PyObject *
+RegionHandle_richcompare(RegionHandleObject *v, RegionHandleObject *w, int op)
+{
+ int res;
+
+ switch(op)
+ {
+ case Py_LT:
+ res = v->ob_handle < w->ob_handle;
+ break;
+ case Py_LE:
+ res = v->ob_handle <= w->ob_handle;
+ break;
+ case Py_EQ:
+ res = v->ob_handle == w->ob_handle;
+ break;
+ case Py_NE:
+ res = v->ob_handle != w->ob_handle;
+ break;
+ case Py_GT:
+ res = v->ob_handle > w->ob_handle;
+ break;
+ case Py_GE:
+ res = v->ob_handle >= w->ob_handle;
+ break;
+ default:
+ PyErr_BadArgument();
+ return NULL;
+ }
+
+ if(res)
+ Py_RETURN_TRUE;
+ else
+ Py_RETURN_FALSE;
+}
+
PyTypeObject RegionHandleType = {
+#if PY_MAJOR_VERSION >= 3
+ PyVarObject_HEAD_INIT(NULL, 0)
+#else
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
+#endif
MODULE_NAME ".RegionHandle", /* tp_name */
sizeof(RtiULongHandleObject), /* tp_basicsize */
0, /* tp_itemsize */
@@ -702,7 +870,7 @@
(printfunc)RegionHandle_print, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
- (cmpfunc)RegionHandle_compare, /* tp_compare */
+ 0, /* tp_reserved */
(reprfunc)RegionHandle_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -715,6 +883,9 @@
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"RegionHandle", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ (richcmpfunc)RegionHandle_richcompare, /* tp_richcompare */
};
int
@@ -733,21 +904,14 @@
static int
longhandle_print(RtiLongHandleObject *v, FILE *fp, int flags)
{
- fprintf(fp, "<%s=%li>", v->ob_type->tp_name, v->ob_ival);
+ fprintf(fp, "<%s=%li>", Py_TYPE(v)->tp_name, v->ob_ival);
return 0;
}
-static int
-longhandle_compare(RtiLongHandleObject *v, RtiLongHandleObject *w)
-{
- return (v->ob_ival < w->ob_ival) ? -1 :
- (v->ob_ival > w->ob_ival) ? 1 : 0;
-}
-
static PyObject *
longhandle_repr(RtiLongHandleObject *v)
{
- return PyString_FromFormat("<%s=%li>", v->ob_type->tp_name, v->ob_ival);
+ return PyUnicode_FromFormat("<%s=%li>", Py_TYPE(v)->tp_name, v->ob_ival);
}
static long
@@ -756,9 +920,49 @@
return v->ob_ival;
}
+static PyObject *
+longhandle_richcompare(RtiLongHandleObject *v, RtiLongHandleObject *w, int op)
+{
+ int res;
+
+ switch(op)
+ {
+ case Py_LT:
+ res = v->ob_ival < w->ob_ival;
+ break;
+ case Py_LE:
+ res = v->ob_ival <= w->ob_ival;
+ break;
+ case Py_EQ:
+ res = v->ob_ival == w->ob_ival;
+ break;
+ case Py_NE:
+ res = v->ob_ival != w->ob_ival;
+ break;
+ case Py_GT:
+ res = v->ob_ival > w->ob_ival;
+ break;
+ case Py_GE:
+ res = v->ob_ival >= w->ob_ival;
+ break;
+ default:
+ PyErr_BadArgument();
+ return NULL;
+ }
+
+ if(res)
+ Py_RETURN_TRUE;
+ else
+ Py_RETURN_FALSE;
+}
+
PyTypeObject RtiSpaceHandleType = {
+#if PY_MAJOR_VERSION >= 3
+ PyVarObject_HEAD_INIT(NULL, 0)
+#else
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
+#endif
MODULE_NAME ".SpaceHandle", /* tp_name */
sizeof(RtiLongHandleObject), /* tp_basicsize */
0, /* tp_itemsize */
@@ -766,7 +970,7 @@
(printfunc)longhandle_print, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
- (cmpfunc)longhandle_compare, /* tp_compare */
+ 0, /* tp_reserved */
(reprfunc)longhandle_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -779,6 +983,9 @@
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"SpaceHandle", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ (richcmpfunc)longhandle_richcompare, /* tp_richcompare */
};
int
@@ -807,8 +1014,12 @@
}
PyTypeObject RtiDimensionHandleType = {
+#if PY_MAJOR_VERSION >= 3
+ PyVarObject_HEAD_INIT(NULL, 0)
+#else
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
+#endif
MODULE_NAME ".DimensionHandle", /* tp_name */
sizeof(RtiULongHandleObject), /* tp_basicsize */
0, /* tp_itemsize */
@@ -816,7 +1027,7 @@
(printfunc)ulonghandle_print, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
- (cmpfunc)ulonghandle_compare, /* tp_compare */
+ 0, /* tp_reserved */
(reprfunc)ulonghandle_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -829,6 +1040,9 @@
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"DimensionHandle", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ (richcmpfunc)ulonghandle_richcompare, /* tp_richcompare */
};
int
@@ -929,4 +1143,4 @@
PyModule_AddObject(module, "DimensionHandle", (PyObject
*)&RtiDimensionHandleType);
}
-// $Id: handles.cpp,v 1.5 2010/09/10 21:04:29 gotthardp Exp $
+// $Id: handles.cpp,v 1.6 2011/06/23 00:10:07 gotthardp Exp $
Index: _rti/module.cpp
===================================================================
RCS file: /sources/certi/applications/PyHLA/hla/_rti/module.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- _rti/module.cpp 15 Nov 2008 14:34:06 -0000 1.2
+++ _rti/module.cpp 23 Jun 2011 00:10:07 -0000 1.3
@@ -11,7 +11,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * $Id: module.cpp,v 1.2 2008/11/15 14:34:06 gotthardp Exp $
+ * $Id: module.cpp,v 1.3 2011/06/23 00:10:07 gotthardp Exp $
*/
// note: you must include Python.h before any standard headers are included
@@ -69,14 +69,38 @@
{NULL, NULL, 0, NULL} // sentinel
};
+static const char *rti_doc =
+ "Modeling and Simulation (M&S) High Level Architecture (HLA) -- Basic
Federate Interface.";
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef rti_module =
+{
+ PyModuleDef_HEAD_INIT,
+ "_rti", /* m_name */
+ rti_doc, /* m_doc */
+ -1, /* m_size */
+ rti_methods, /* m_methods */
+};
+
+PyMODINIT_FUNC
+PyInit__rti(void)
+{
+ PyObject* module = PyModule_Create(&rti_module);
+
+ // call initializers
+ RtiInitializer::init(module);
+ return module;
+}
+
+#else
PyMODINIT_FUNC
init_rti(void)
{
- PyObject* module = Py_InitModule3("_rti", rti_methods,
- "Modeling and Simulation (M&S) High Level Architecture (HLA) -- Basic
Federate Interface.");
+ PyObject* module = Py_InitModule3("_rti", rti_methods, rti_doc);
// call initializers
RtiInitializer::init(module);
}
+#endif
-// $Id: module.cpp,v 1.2 2008/11/15 14:34:06 gotthardp Exp $
+// $Id: module.cpp,v 1.3 2011/06/23 00:10:07 gotthardp Exp $
Index: _rti/module.h
===================================================================
RCS file: /sources/certi/applications/PyHLA/hla/_rti/module.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- _rti/module.h 15 Nov 2008 14:34:06 -0000 1.3
+++ _rti/module.h 23 Jun 2011 00:10:08 -0000 1.4
@@ -11,7 +11,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * $Id: module.h,v 1.3 2008/11/15 14:34:06 gotthardp Exp $
+ * $Id: module.h,v 1.4 2011/06/23 00:10:08 gotthardp Exp $
*/
#ifndef RTI_MODULE_H
@@ -21,6 +21,16 @@
#define MODULE_NAME "rti"
+#if PY_VERSION_HEX < 0x02060000
+// Python 2.5 compatibility macros
+#define Py_TYPE(o) (((PyObject*)(o))->ob_type)
+#define PyBytes_AsString PyString_AsString
+#define PyBytes_FromStringAndSize PyString_FromStringAndSize
+#define PyUnicode_AsString PyString_AsString
+#define PyUnicode_FromFormat PyString_FromFormat
+#define PyUnicode_FromString PyString_FromString
+#endif
+
template<typename T>
class auto_arrayptr
{
@@ -61,4 +71,4 @@
#endif // RTI_MODULE_H
-// $Id: module.h,v 1.3 2008/11/15 14:34:06 gotthardp Exp $
+// $Id: module.h,v 1.4 2011/06/23 00:10:08 gotthardp Exp $
Index: _rti/rtiambassador.cpp
===================================================================
RCS file: /sources/certi/applications/PyHLA/hla/_rti/rtiambassador.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- _rti/rtiambassador.cpp 16 Mar 2011 16:36:13 -0000 1.7
+++ _rti/rtiambassador.cpp 23 Jun 2011 00:10:08 -0000 1.8
@@ -11,7 +11,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * $Id: rtiambassador.cpp,v 1.7 2011/03/16 16:36:13 erk Exp $
+ * $Id: rtiambassador.cpp,v 1.8 2011/06/23 00:10:08 gotthardp Exp $
*/
// note: you must include Python.h before any standard headers are included
@@ -64,7 +64,7 @@
}
CATCH_RTI_EXCEPTION2(RTI::Exception, rti_RTIInternalError)
- self->ob_type->tp_free((PyObject *)self);
+ Py_TYPE(self)->tp_free((PyObject *)self);
}
// Federation Management Services
@@ -2159,7 +2159,7 @@
try {
char *theName = self->ob_rtia->getObjectClassName(theHandle);
- PyObject *result = PyString_FromString(theName);
+ PyObject *result = PyUnicode_FromString(theName);
delete[] theName;
return result;
@@ -2213,7 +2213,7 @@
try {
char *theName = self->ob_rtia->getAttributeName(theHandle, whichClass);
- PyObject *result = PyString_FromString(theName);
+ PyObject *result = PyUnicode_FromString(theName);
delete[] theName;
return result;
@@ -2262,7 +2262,7 @@
try {
char *theName = self->ob_rtia->getInteractionClassName(theHandle);
- PyObject *result = PyString_FromString(theName);
+ PyObject *result = PyUnicode_FromString(theName);
delete[] theName;
return result;
@@ -2316,7 +2316,7 @@
try {
char *theName = self->ob_rtia->getParameterName(theHandle, whichClass);
- PyObject *result = PyString_FromString(theName);
+ PyObject *result = PyUnicode_FromString(theName);
delete[] theName;
return result;
@@ -2365,7 +2365,7 @@
try {
char *theName = self->ob_rtia->getObjectInstanceName(theHandle);
- PyObject *result = PyString_FromString(theName);
+ PyObject *result = PyUnicode_FromString(theName);
delete[] theName;
return result;
@@ -2413,7 +2413,7 @@
try {
char *theName = self->ob_rtia->getRoutingSpaceName(theHandle);
- PyObject *result = PyString_FromString(theName);
+ PyObject *result = PyUnicode_FromString(theName);
delete[] theName;
return result;
@@ -2467,7 +2467,7 @@
try {
char *theName = self->ob_rtia->getDimensionName(theHandle, whichSpace);
- PyObject *result = PyString_FromString(theName);
+ PyObject *result = PyUnicode_FromString(theName);
delete[] theName;
return result;
@@ -2588,7 +2588,7 @@
try {
char *theName = self->ob_rtia->getTransportationName(theHandle);
- PyObject *result = PyString_FromString(theName);
+ PyObject *result = PyUnicode_FromString(theName);
delete[] theName;
return result;
@@ -2636,7 +2636,7 @@
try {
char *theName = self->ob_rtia->getOrderingName(theHandle);
- PyObject *result = PyString_FromString(theName);
+ PyObject *result = PyUnicode_FromString(theName);
delete[] theName;
return result;
@@ -3165,8 +3165,12 @@
static PyTypeObject RTIAmbassadorObjectType =
{
+#if PY_MAJOR_VERSION >= 3
+ PyVarObject_HEAD_INIT(NULL, 0)
+#else
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
+#endif
MODULE_NAME ".RTIAmbassador", /* tp_name */
sizeof(RTIAmbassadorObject), /* tp_basicsize */
0, /* tp_itemsize */
@@ -3174,7 +3178,7 @@
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
- 0, /* tp_compare */
+ 0, /* tp_reserved */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -3225,4 +3229,4 @@
PyModule_AddObject(module, "RTIAmbassador", (PyObject
*)&RTIAmbassadorObjectType);
}
-// $Id: rtiambassador.cpp,v 1.7 2011/03/16 16:36:13 erk Exp $
+// $Id: rtiambassador.cpp,v 1.8 2011/06/23 00:10:08 gotthardp Exp $
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [certi-cvs] applications/PyHLA/hla _omt/basicdata.cpp _omt/...,
CERTI CVS commits <=