[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[certi-cvs] applications/PyHLA/test fom-simple.py
From: |
certi-cvs |
Subject: |
[certi-cvs] applications/PyHLA/test fom-simple.py |
Date: |
Mon, 04 Oct 2010 20:41:18 +0000 |
CVSROOT: /sources/certi
Module name: applications
Changes by: Petr Gotthard <gotthardp> 10/10/04 20:41:18
Added files:
PyHLA/test : fom-simple.py
Log message:
New test added.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/applications/PyHLA/test/fom-simple.py?cvsroot=certi&rev=1.1
Patches:
Index: fom-simple.py
===================================================================
RCS file: fom-simple.py
diff -N fom-simple.py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ fom-simple.py 4 Oct 2010 20:41:18 -0000 1.1
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+import hla.omt as fom
+
+fom.HLAuse('rpr2-d18.xml')
+
+def dump(string):
+ for c in string:
+ print '%02x' % ord(c),
+ print
+
+Enum = fom.HLAenumerated("Enum", fom.HLAinteger32BE,
+ {"Little":0, "Big":1, "Yellow":64})
+
+print Enum.Little
+
+Rec = fom.HLAvariantRecord("Rec",("T", Enum),
+ [([Enum.Little], "A", fom.HLAinteger16LE),
+ ([Enum.Big, None], "B", fom.HLAinteger16BE)])
+
+haf = Rec.pack({"T":Enum.Yellow, "B":42})
+dump(haf)
+
+val, size = Rec.unpack(haf)
+print val
+
+cc = fom.HLAASCIIstring.pack("UFO");
+dump(cc)
+
+cc2, size = fom.HLAASCIIstring.unpack(cc)
+print cc2
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [certi-cvs] applications/PyHLA/test fom-simple.py,
certi-cvs <=