Commit e255d8e3 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Cleanup simulator code

parent 05ec510f
......@@ -539,15 +539,6 @@ class sdlHandler(QObject):
# get internal variables, translate them to swig, and print them
setter_ptr = getattr(target, "_set_{}".format(var))
value_asn1 = target_state[idx]
# try:
# value_swig_ptr = int(value_asn1._ptr)
# except TypeError:
# # for some types, swig uses a proxy class, in which case the
# # pointer is not in _ptr but in _ptr.this
# value_swig_ptr = int(value_asn1._ptr.this)
# value_ptr = ctypes.cast(value_swig_ptr,
# ctypes.POINTER(ctypes.c_uint32))
# setter_ptr(value_ptr)
setter_ptr(value_asn1._ptr)
state_value = target_state[idx+1]
set_state = getattr(target, "_set_state")
......@@ -646,8 +637,6 @@ class sdlHandler(QObject):
context = self.proc
def find_allowed_tc(context, statename):
#print 'Looking for TC in state', statename
#print context.mapping.keys()
try:
inputs = context.mapping[statename.lower()]
for each in inputs:
......@@ -878,9 +867,6 @@ class sdlHandler(QObject):
procedure = self.proc_handlers[name.lower()][1]
# Decode all input and output parameters and create native ASN.1 values
for spec, (val, size) in zip(procedure.fpar, params):
# Cast the void* to an array of unsigned bytes, knowing the size:
# as_bytes = ctypes.cast(val,
# ctypes.POINTER((ctypes.c_ubyte * (size / 8))))
# Create native ASN.1 type
typename = spec['type'].ReferencedTypeName.replace('-', '_')
asn1_instance = getattr(ASN1, typename)(ptr=val)
......@@ -911,20 +897,6 @@ class sdlHandler(QObject):
sort=spec['type'],
ASN1_AST=self.proc.dataview,
ASN1Mod=ASN1)
# Copy the OUT parameters back from SWIG to ctypes
# MP: with the new ctypes interface I think there is nothing to keep
# here. The vdm_to_ctypes should have filled the value directly...
# ! TESTME !
# for spec, val, asn1_instance in interface['out']:
# asn1_instance.SetData(val)
# # Create new SWIG byte array
# swig_ptr = ASN1.DV.new_byte_SWIG_PTR(len(as_bytes.contents))
# typename = spec['type'].ReferencedTypeName.replace('-', '_')
# setter = getattr(ASN1.DV, "SetDataFor_{}".format(typename))
# setter(swig_ptr, asn1_instance._ptr)
# for idx in xrange(len(as_bytes.contents)):
# as_bytes.contents[idx] = \
# ASN1.DV.byte_SWIG_PTR_getitem(swig_ptr, idx)
# Display the call on the MSC
inp, outp = [], []
for _, asn1_instance in interface['in']:
......@@ -1062,10 +1034,10 @@ class sdlHandler(QObject):
print("VDM class creation error: " + str(err))
elif "#c" in cmt:
print(u'Procedure {} in C... Loading DLL'
print(u'Procedure {} in C... UNSUPPORTED'
.format(each.inputString))
elif "#ada" in cmt:
print(u'Procedure {} in Ada... Loading DLL'
print(u'Procedure {} in Ada... UNSUPPORTED'
.format(each.inputString))
# Variable number of parameters of type (void *, size)
params = (ctypes.c_char_p,) + \
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment