[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[certi-cvs] applications/PyHLA examples/updateAttributeValu...
From: |
CERTI CVS commits |
Subject: |
[certi-cvs] applications/PyHLA examples/updateAttributeValu... |
Date: |
Thu, 23 Jun 2011 18:45:37 +0000 |
CVSROOT: /sources/certi
Module name: applications
Changes by: Petr Gotthard <gotthardp> 11/06/23 18:45:37
Modified files:
PyHLA/examples/updateAttributeValues: uav-receive.py uav-send.py
PyHLA/hla/omt : __init__.py array.py enumerated.py record.py
Log message:
Additional Python 3.x portability fixes. Thanks to Charles
Lesire-Cabaniols
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/applications/PyHLA/examples/updateAttributeValues/uav-receive.py?cvsroot=certi&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/applications/PyHLA/examples/updateAttributeValues/uav-send.py?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/applications/PyHLA/hla/omt/__init__.py?cvsroot=certi&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/applications/PyHLA/hla/omt/array.py?cvsroot=certi&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/applications/PyHLA/hla/omt/enumerated.py?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/applications/PyHLA/hla/omt/record.py?cvsroot=certi&r1=1.3&r2=1.4
Patches:
Index: examples/updateAttributeValues/uav-receive.py
===================================================================
RCS file:
/sources/certi/applications/PyHLA/examples/updateAttributeValues/uav-receive.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- examples/updateAttributeValues/uav-receive.py 9 Jul 2009 15:47:25
-0000 1.1
+++ examples/updateAttributeValues/uav-receive.py 23 Jun 2011 18:45:37
-0000 1.2
@@ -18,30 +18,30 @@
# RTI callbacks
def discoverObjectInstance(self, object, objectclass, name):
- print "DISCOVER", name
+ print("DISCOVER", name)
rtia.requestObjectAttributeValueUpdate(object,
[self.textAttributeHandle, self.structAttributeHandle,
self.fomAttributeHandle])
def reflectAttributeValues(self, object, attributes, tag, order,
transport, time=None, retraction=None):
if self.textAttributeHandle in attributes:
- print "REFLECT", attributes[self.textAttributeHandle]
+ print("REFLECT", attributes[self.textAttributeHandle])
if self.structAttributeHandle in attributes:
structValue = struct.unpack('hhl',
attributes[self.structAttributeHandle])
- print "REFLECT", structValue
+ print("REFLECT", structValue)
if self.fomAttributeHandle in attributes:
fomValue, size =
fom.HLAfloat32BE.unpack(attributes[self.fomAttributeHandle])
- print "REFLECT", fomValue
+ print("REFLECT", fomValue)
-print "Create ambassador"
+print("Create ambassador")
rtia = hla.rti.RTIAmbassador()
try:
rtia.createFederationExecution("uav", "uav.fed")
- print "Federation created."
+ print("Federation created.")
except hla.rti.FederationExecutionAlreadyExists:
- print "Federation already exists."
+ print("Federation already exists.")
mya = MyAmbassador()
rtia.joinFederationExecution("uav-receive", "uav", mya)
@@ -56,4 +56,4 @@
rtia.resignFederationExecution(hla.rti.ResignAction.DeleteObjectsAndReleaseAttributes)
-print "Done."
+print("Done.")
Index: examples/updateAttributeValues/uav-send.py
===================================================================
RCS file:
/sources/certi/applications/PyHLA/examples/updateAttributeValues/uav-send.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- examples/updateAttributeValues/uav-send.py 4 Oct 2010 20:25:58 -0000
1.2
+++ examples/updateAttributeValues/uav-send.py 23 Jun 2011 18:45:37 -0000
1.3
@@ -22,20 +22,20 @@
# RTI callbacks
def startRegistrationForObjectClass(*params):
- print "START", params
+ print("START", params)
def provideAttributeValueUpdate(*params):
- print "PROVIDE UAV", params
+ print("PROVIDE UAV", params)
-print "Create ambassador"
+print("Create ambassador")
rtia = hla.rti.RTIAmbassador()
-print rtia
+print(rtia)
try:
rtia.createFederationExecution("uav", "uav.fed")
- print "Federation created."
+ print("Federation created.")
except hla.rti.FederationExecutionAlreadyExists:
- print "Federation already exists."
+ print("Federation already exists.")
mya = MyAmbassador()
rtia.joinFederationExecution("uav-send", "uav", mya)
@@ -57,4 +57,4 @@
rtia.resignFederationExecution(hla.rti.ResignAction.DeleteObjectsAndReleaseAttributes)
-print "Done."
+print("Done.")
Index: hla/omt/__init__.py
===================================================================
RCS file: /sources/certi/applications/PyHLA/hla/omt/__init__.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- hla/omt/__init__.py 11 Jun 2009 17:15:11 -0000 1.5
+++ hla/omt/__init__.py 23 Jun 2011 18:45:37 -0000 1.6
@@ -11,15 +11,15 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
-# $Id: __init__.py,v 1.5 2009/06/11 17:15:11 gotthardp Exp $
+# $Id: __init__.py,v 1.6 2011/06/23 18:45:37 gotthardp Exp $
import types
import xml.sax.handler
from hla._omt import *
-from enumerated import HLAenumerated
-from array import HLAfixedArray, HLAvariableArray
-from record import HLAfixedRecord, HLAvariantRecord
+from .enumerated import HLAenumerated
+from .array import HLAfixedArray, HLAvariableArray
+from .record import HLAfixedRecord, HLAvariantRecord
class TypeParser(xml.sax.handler.ContentHandler):
def __init__(self):
@@ -140,4 +140,4 @@
parser.setContentHandler(handler)
parser.parse(filename)
-# $Id: __init__.py,v 1.5 2009/06/11 17:15:11 gotthardp Exp $
+# $Id: __init__.py,v 1.6 2011/06/23 18:45:37 gotthardp Exp $
Index: hla/omt/array.py
===================================================================
RCS file: /sources/certi/applications/PyHLA/hla/omt/array.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- hla/omt/array.py 6 Nov 2008 08:12:18 -0000 1.3
+++ hla/omt/array.py 23 Jun 2011 18:45:37 -0000 1.4
@@ -11,10 +11,10 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
-# $Id: array.py,v 1.3 2008/11/06 08:12:18 gotthardp Exp $
+# $Id: array.py,v 1.4 2011/06/23 18:45:37 gotthardp Exp $
from hla._omt import *
-from basic import *
+from .basic import *
# For example:
# +-------------+----------------+-------------+-----------------+-----------+
@@ -92,4 +92,4 @@
return value, size
-# $Id: array.py,v 1.3 2008/11/06 08:12:18 gotthardp Exp $
+# $Id: array.py,v 1.4 2011/06/23 18:45:37 gotthardp Exp $
Index: hla/omt/enumerated.py
===================================================================
RCS file: /sources/certi/applications/PyHLA/hla/omt/enumerated.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- hla/omt/enumerated.py 11 Jun 2009 17:15:11 -0000 1.2
+++ hla/omt/enumerated.py 23 Jun 2011 18:45:37 -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: enumerated.py,v 1.2 2009/06/11 17:15:11 gotthardp Exp $
+# $Id: enumerated.py,v 1.3 2011/06/23 18:45:37 gotthardp Exp $
# For example:
# +------------+----------------+------------+--------+-----------+
@@ -41,7 +41,7 @@
self.representation = representation
self.enumerators = {}
# initialize enumerators
- for key in enumerators.keys():
+ for key in list(enumerators.keys()):
self.enumerators[key] = HLAenumerator(typeName, key,
enumerators[key])
def __getattr__(self, name):
@@ -57,10 +57,10 @@
def unpack(self, buffer, offset = 0):
value, size = self.representation.unpack(buffer, offset)
# find a corresponding enumerator
- for name, enum in self.enumerators.items():
+ for name, enum in list(self.enumerators.items()):
if enum == value:
return enum, size
# if not found
return value, size
-# $Id: enumerated.py,v 1.2 2009/06/11 17:15:11 gotthardp Exp $
+# $Id: enumerated.py,v 1.3 2011/06/23 18:45:37 gotthardp Exp $
Index: hla/omt/record.py
===================================================================
RCS file: /sources/certi/applications/PyHLA/hla/omt/record.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- hla/omt/record.py 13 Oct 2008 17:15:41 -0000 1.3
+++ hla/omt/record.py 23 Jun 2011 18:45:37 -0000 1.4
@@ -11,10 +11,10 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
-# $Id: record.py,v 1.3 2008/10/13 17:15:41 gotthardp Exp $
+# $Id: record.py,v 1.4 2011/06/23 18:45:37 gotthardp Exp $
from hla._omt import *
-from basic import *
+from .basic import *
# For example:
#
+-------------+------------------------------------+----------------+-----------+
@@ -121,4 +121,4 @@
buffer += padding(len(buffer), self.octetBoundary)*'\0'
return value, size
-# $Id: record.py,v 1.3 2008/10/13 17:15:41 gotthardp Exp $
+# $Id: record.py,v 1.4 2011/06/23 18:45:37 gotthardp Exp $
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [certi-cvs] applications/PyHLA examples/updateAttributeValu...,
CERTI CVS commits <=