Commits (22)
...@@ -141,6 +141,25 @@ The background pattern was downloaded from www.subtlepatterns.com ...@@ -141,6 +141,25 @@ The background pattern was downloaded from www.subtlepatterns.com
Changelog Changelog
========= =========
1.5.38 (06/2017)
- Fix unicode issue in Ada backend
1.5.37 (05/2017)
- Fix Ada backend bug with sequence of literals in nested states
1.5.36 (05/2017)
- Fix Unicode issues in Ada backend
1.5.35 (05/2017)
- Fix FOR LOOPS code generation
1.5.34 (05/2017)
- Fix statechart message selection box
1.5.33 (04/2017)
- Fix unicode issue with the simulation code
- Use -fPIC when building the simulation library
1.5.32 (04/2017) 1.5.32 (04/2017)
- Unicode bugfixes in Ada backend - Unicode bugfixes in Ada backend
- Bugfix with SEQUENCE OF literals in Ada backend - Bugfix with SEQUENCE OF literals in Ada backend
......
...@@ -250,9 +250,9 @@ asn1.exe -Ada -typePrefix asn1Scc -equal {asn1} ...@@ -250,9 +250,9 @@ asn1.exe -Ada -typePrefix asn1Scc -equal {asn1}
asn1.exe -c -typePrefix asn1Scc -equal {asn1}'''.format(asn1=asn1_filenames) asn1.exe -c -typePrefix asn1Scc -equal {asn1}'''.format(asn1=asn1_filenames)
simu_script += ''' simu_script += '''
gnatmake -gnat2012 -c *.adb gnatmake -fPIC -gnat2012 -c *.adb
gnatbind -n -Llib{pr} {pr} gnatbind -n -Llib{pr} {pr}
gnatmake -c -gnat2012 b~{pr}.adb gnatmake -fPIC -c -gnat2012 b~{pr}.adb
gcc -shared -fPIC -o lib{pr}.so b~{pr}.o {pr}.o {asn1_mod} adaasn1rtl.o -lgnat gcc -shared -fPIC -o lib{pr}.so b~{pr}.o {pr}.o {asn1_mod} adaasn1rtl.o -lgnat
rm -f dataview-uniq.c dataview-uniq.h rm -f dataview-uniq.c dataview-uniq.h
asn2aadlPlus dataview-uniq.asn DataView.aadl asn2aadlPlus dataview-uniq.asn DataView.aadl
...@@ -513,23 +513,23 @@ package {process_name} is'''.format(generic=generic_spec, ...@@ -513,23 +513,23 @@ package {process_name} is'''.format(generic=generic_spec,
# Functions to get gobal variables (length and value) # Functions to get gobal variables (length and value)
for var_name, (var_type, _) in process.variables.viewitems(): for var_name, (var_type, _) in process.variables.viewitems():
# Getters for external applications to view local variables via dll # Getters for external applications to view local variables via dll
process_level_decl.append("function l_{name}_value" process_level_decl.append(u"function l_{name}_value"
" return access {sort} " u" return access {sort} "
"is ({prefix}.{name}'access) with Export," u"is ({prefix}.{name}'access) with Export,"
" Convention => C," u" Convention => C,"
' Link_Name => "{name}_value";' u' Link_Name => "{name}_value";'
.format(prefix=LPREFIX, name=var_name, .format(prefix=LPREFIX, name=var_name,
sort=type_name(var_type))) sort=type_name(var_type)))
# Setters for local variables # Setters for local variables
setter_decl = "procedure dll_set_l_{name}(value: access {sort})"\ setter_decl = u"procedure dll_set_l_{name}(value: access {sort})"\
.format(name=var_name, sort=type_name(var_type)) .format(name=var_name, sort=type_name(var_type))
ads_template.append('{};'.format(setter_decl)) ads_template.append(u'{};'.format(setter_decl))
ads_template.append('pragma Export(C, dll_set_l_{name},' ads_template.append(u'pragma Export(C, dll_set_l_{name},'
' "_set_{name}");'.format(name=var_name)) ' "_set_{name}");'.format(name=var_name))
dll_api.append('{} is'.format(setter_decl)) dll_api.append(u'{} is'.format(setter_decl))
dll_api.append('begin') dll_api.append(u'begin')
dll_api.append('{}.{} := value.all;'.format(LPREFIX, var_name)) dll_api.append(u'{}.{} := value.all;'.format(LPREFIX, var_name))
dll_api.append('end dll_set_l_{};'.format(var_name)) dll_api.append(u'end dll_set_l_{};'.format(var_name))
dll_api.append('') dll_api.append('')
# Generate the the code of the procedures # Generate the the code of the procedures
...@@ -1418,14 +1418,14 @@ def _task_forloop(task, **kwargs): ...@@ -1418,14 +1418,14 @@ def _task_forloop(task, **kwargs):
stmt.extend(list_stmt) stmt.extend(list_stmt)
local_decl.extend(list_local) local_decl.extend(list_local)
stmt.extend(['declare', stmt.extend(['declare',
'{} : {};'.format(loop['var'], u'{} : {};'.format(loop['var'],
type_name(loop['type'])), type_name(loop['type'])),
'', u'',
'begin', u'begin',
'for {it}_idx in {rc} loop'.format(it=loop['var'], u'for {it}_idx in {rc} loop'.format(it=loop['var'],
rc=range_str), rc=range_str),
'{it} := {var}({it}_idx);'.format(it=loop['var'], u'{it} := {var}({it}_idx);'.format(it=loop['var'],
var=list_payload)]) var=list_payload)])
try: try:
code_trans, local_trans = generate(loop['transition']) code_trans, local_trans = generate(loop['transition'])
if local_trans: if local_trans:
...@@ -1439,7 +1439,7 @@ def _task_forloop(task, **kwargs): ...@@ -1439,7 +1439,7 @@ def _task_forloop(task, **kwargs):
except AttributeError: except AttributeError:
stmt.append('null;') stmt.append('null;')
if loop['range'] and loop['range']['step'] != 1: if loop['range'] and loop['range']['step'] != 1:
stmt.append('{it} := {it} + {step};'.format(it=loop['var'], stmt.append(u'{it} := {it} + {step};'.format(it=loop['var'],
step=loop['range']['step'])) step=loop['range']['step']))
stmt.append('end loop;') stmt.append('end loop;')
if (loop['range'] and loop['range']['step'] != 1) or loop['list']: if (loop['range'] and loop['range']['step'] != 1) or loop['list']:
...@@ -1991,15 +1991,15 @@ def _append(expr): ...@@ -1991,15 +1991,15 @@ def _append(expr):
local_decl.extend(left_local) local_decl.extend(left_local)
local_decl.extend(right_local) local_decl.extend(right_local)
left = '{}{}'.format(left_str, string_payload(expr.left, left_str) if left = u'{}{}'.format(left_str, string_payload(expr.left, left_str) if
isinstance(expr.left, (ogAST.PrimVariable, isinstance(expr.left, (ogAST.PrimVariable,
ogAST.PrimConstant)) else '') ogAST.PrimConstant)) else '')
right = '{}{}'.format(right_str, string_payload(expr.right, right_str) if right = u'{}{}'.format(right_str, string_payload(expr.right, right_str) if
isinstance(expr.right, (ogAST.PrimVariable, isinstance(expr.right, (ogAST.PrimVariable,
ogAST.PrimConditional, ogAST.PrimConditional,
ogAST.PrimConstant)) else '') ogAST.PrimConstant)) else '')
ada_string = '(({}) & ({}))'.format(left, right) ada_string = u'(({}) & ({}))'.format(left, right)
return stmts, unicode(ada_string), local_decl return stmts, unicode(ada_string), local_decl
...@@ -2774,7 +2774,7 @@ def append_size(append): ...@@ -2774,7 +2774,7 @@ def append_size(append):
else: else:
# Must be a variable of type SEQOF # Must be a variable of type SEQOF
_, inner, _ = expression(each) _, inner, _ = expression(each)
result += '{}.Length'.format(inner) result += u'{}.Length'.format(inner)
return result return result
......
...@@ -367,11 +367,11 @@ def rename_everything(ast, from_name, to_name): ...@@ -367,11 +367,11 @@ def rename_everything(ast, from_name, to_name):
in the scope of a composite state, so that they do not overwrite in the scope of a composite state, so that they do not overwrite
a variable with the same name declared at a higher scope. a variable with the same name declared at a higher scope.
''' '''
# LOG.debug ('rename_everything - ' + str(ast) + " - ") LOG.debug ('rename_everything - ' + str(ast) + " - ")
# try: try:
# LOG.debug(ast.inputString) LOG.debug(ast.inputString)
# except: except:
# pass pass
_, _, _ = ast, from_name, to_name _, _, _ = ast, from_name, to_name
...@@ -475,9 +475,11 @@ def _rename_forloop(ast, from_name, to_name): ...@@ -475,9 +475,11 @@ def _rename_forloop(ast, from_name, to_name):
''' List of FOR loops ''' ''' List of FOR loops '''
for each in ast.elems: for each in ast.elems:
rename_everything(each['list'], from_name, to_name) rename_everything(each['list'], from_name, to_name)
rename_everything(each['range']['start'], from_name, to_name) if each['range'] is not None:
rename_everything(each['range']['stop'], from_name, to_name) rename_everything(each['range']['start'], from_name, to_name)
rename_everything(each['transition'], from_name, to_name) rename_everything(each['range']['stop'], from_name, to_name)
if each['transition'] is not None:
rename_everything(each['transition'], from_name, to_name)
@rename_everything.register(ogAST.ExprPlus) @rename_everything.register(ogAST.ExprPlus)
...@@ -505,6 +507,14 @@ def _rename_expr(ast, from_name, to_name): ...@@ -505,6 +507,14 @@ def _rename_expr(ast, from_name, to_name):
rename_everything(ast.right, from_name, to_name) rename_everything(ast.right, from_name, to_name)
@rename_everything.register(ogAST.PrimSequenceOf)
def _rename_prim_seq_of(ast, from_name, to_name):
''' List of primary '''
for each in ast.value:
rename_everything(each, from_name, to_name)
@rename_everything.register(ogAST.PrimIndex) @rename_everything.register(ogAST.PrimIndex)
def _rename_index(ast, from_name, to_name): def _rename_index(ast, from_name, to_name):
''' Index of an array ''' ''' Index of an array '''
......
...@@ -569,7 +569,7 @@ def locked(): ...@@ -569,7 +569,7 @@ def locked():
return g_statechart_lock return g_statechart_lock
def create_dot_graph(root_ast, basic=False, scene=None): def create_dot_graph(root_ast, basic=False, scene=None, view=None):
''' Return a dot.AGraph item, from an ogAST.Process or child entry ''' Return a dot.AGraph item, from an ogAST.Process or child entry
Set basic=True to generate a simple graph with at most one edge Set basic=True to generate a simple graph with at most one edge
between two states and no diamond nodes between two states and no diamond nodes
...@@ -612,7 +612,7 @@ def create_dot_graph(root_ast, basic=False, scene=None): ...@@ -612,7 +612,7 @@ def create_dot_graph(root_ast, basic=False, scene=None):
else: else:
LOG.info ("Statechart settings read from configuration file") LOG.info ("Statechart settings read from configuration file")
if scene and scene.views(): if scene and view:
# Load and display a table for the user to filter out messages that # Load and display a table for the user to filter out messages that
# are not relevant to display on the statechart - and make it lighter # are not relevant to display on the statechart - and make it lighter
# Repeat for substates, too. # Repeat for substates, too.
...@@ -629,7 +629,7 @@ def create_dot_graph(root_ast, basic=False, scene=None): ...@@ -629,7 +629,7 @@ def create_dot_graph(root_ast, basic=False, scene=None):
ui_file = QtCore.QFile(":/statechart_cfg.ui") ui_file = QtCore.QFile(":/statechart_cfg.ui")
ui_file.open(QtCore.QFile.ReadOnly) ui_file.open(QtCore.QFile.ReadOnly)
dialog = loader.load(ui_file) dialog = loader.load(ui_file)
dialog.setParent (scene.views()[0], QtCore.Qt.Dialog) dialog.setParent (view, QtCore.Qt.Dialog)
okButton = dialog.findChild(QtGui.QPushButton, "okButton") okButton = dialog.findChild(QtGui.QPushButton, "okButton")
rightButton = dialog.findChild(QtGui.QToolButton, "toRight") rightButton = dialog.findChild(QtGui.QToolButton, "toRight")
leftButton = dialog.findChild(QtGui.QToolButton, "toLeft") leftButton = dialog.findChild(QtGui.QToolButton, "toLeft")
......
...@@ -666,7 +666,7 @@ def check_type_compatibility(primary, type_ref, context): # type: -> [warnings] ...@@ -666,7 +666,7 @@ def check_type_compatibility(primary, type_ref, context): # type: -> [warnings]
''' '''
Check if an ogAST.Primary (raw value, enumerated, ASN.1 Value...) Check if an ogAST.Primary (raw value, enumerated, ASN.1 Value...)
is compatible with a given type (type_ref is an ASN1Scc type) is compatible with a given type (type_ref is an ASN1Scc type)
Does not return anything if OK, otherwise raises TypeError Possibly returns a list of warnings; can raises TypeError
''' '''
warnings = [] # function returns a list of warnings warnings = [] # function returns a list of warnings
assert type_ref is not None assert type_ref is not None
...@@ -749,9 +749,10 @@ def check_type_compatibility(primary, type_ref, context): # type: -> [warnings] ...@@ -749,9 +749,10 @@ def check_type_compatibility(primary, type_ref, context): # type: -> [warnings]
if type_ref.__name__ != 'Apnd' and \ if type_ref.__name__ != 'Apnd' and \
(len(primary.value) < int(basic_type.Min) or (len(primary.value) < int(basic_type.Min) or
len(primary.value) > int(basic_type.Max)): len(primary.value) > int(basic_type.Max)):
#print traceback.print_stack()
raise TypeError(str(len(primary.value)) + raise TypeError(str(len(primary.value)) +
' elements in SEQUENCE OF, while constraint is [' + ' element(s) in SEQUENCE OF, while constraint is [' +
str(basic_type.Min) + '..' + str(basic_type.Max) + ']') str(basic_type.Min) + ' .. ' + str(basic_type.Max) + ']')
for elem in primary.value: for elem in primary.value:
warnings.extend(check_type_compatibility(elem, warnings.extend(check_type_compatibility(elem,
basic_type.type, basic_type.type,
...@@ -1039,7 +1040,7 @@ def fix_expression_types(expr, context): # type: -> [warnings] ...@@ -1039,7 +1040,7 @@ def fix_expression_types(expr, context): # type: -> [warnings]
# the type of the raw PrimSequenceOf can be set now # the type of the raw PrimSequenceOf can be set now
value.exprType.type = asn_type value.exprType.type = asn_type
if isinstance(expr, ogAST.ExprIn): if isinstance(expr, (ogAST.ExprIn, ogAST.ExprAppend)):
return warnings return warnings
if not expr.right.is_raw and not expr.left.is_raw: if not expr.right.is_raw and not expr.left.is_raw:
...@@ -1435,15 +1436,24 @@ def append_expression(root, context): ...@@ -1435,15 +1436,24 @@ def append_expression(root, context):
''' Append expression analysis ''' ''' Append expression analysis '''
expr, errors, warnings = binary_expression(root, context) expr, errors, warnings = binary_expression(root, context)
left = find_basic_type(expr.left.exprType) left = find_basic_type(expr.left.exprType)
right = find_basic_type(expr.right.exprType) right = find_basic_type(expr.right.exprType)
# check that both left and right are actual strings
for bty in (left, right): for bty in (left, right):
if bty.kind != 'SequenceOfType' and not is_string(bty): if bty.kind != 'SequenceOfType' and not is_string(bty):
msg = 'Append can only be applied to types SequenceOf or String' msg = 'Append can only be applied to types SequenceOf or String'
errors.append(error(root, msg)) errors.append(error(root, msg))
break break
else: else:
try:
warnings.extend(compare_types(left.type, right.type))
except TypeError as err:
errors.append(error(root, str(err)))
except AttributeError:
# The above only applies to Sequence of, not strings
pass
attrs = {'Min': str(int(right.Min) + int(left.Min)), attrs = {'Min': str(int(right.Min) + int(left.Min)),
'Max': str(int(right.Max) + int(left.Max))} 'Max': str(int(right.Max) + int(left.Max))}
# It is wrong to set the type as inheriting from the left side FIXME # It is wrong to set the type as inheriting from the left side FIXME
......
...@@ -124,6 +124,7 @@ MODULES = [ ...@@ -124,6 +124,7 @@ MODULES = [
# Define custom UserRoles # Define custom UserRoles
ANCHOR = Qt.UserRole + 1 ANCHOR = Qt.UserRole + 1
try: try:
import LlvmGenerator import LlvmGenerator
MODULES.append(LlvmGenerator) MODULES.append(LlvmGenerator)
...@@ -138,7 +139,7 @@ except ImportError: ...@@ -138,7 +139,7 @@ except ImportError:
__all__ = ['opengeode', 'SDL_Scene', 'SDL_View', 'parse'] __all__ = ['opengeode', 'SDL_Scene', 'SDL_View', 'parse']
__version__ = '1.5.32' __version__ = '1.5.38'
if hasattr(sys, 'frozen'): if hasattr(sys, 'frozen'):
# Detect if we are running on Windows (py2exe-generated) # Detect if we are running on Windows (py2exe-generated)
...@@ -425,6 +426,8 @@ class SDL_Scene(QtGui.QGraphicsScene, object): ...@@ -425,6 +426,8 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
# Keep a track of highlighted symbols: { symbol: brush } # Keep a track of highlighted symbols: { symbol: brush }
self.highlighted = {} self.highlighted = {}
self.refresh_requested = False self.refresh_requested = False
# Flag indicating the presence of unsolved semantic errors in the model
self.semantic_errors = False
def close(self): def close(self):
''' close function is needed by py.test-qt ''' ''' close function is needed by py.test-qt '''
...@@ -1026,11 +1029,13 @@ class SDL_Scene(QtGui.QGraphicsScene, object): ...@@ -1026,11 +1029,13 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
self.refresh() self.refresh()
def sdl_to_statechart(self, basic=True): def sdl_to_statechart(self, basic=True, view=None):
''' Create a graphviz representation of the SDL model ''' ''' Create a graphviz representation of the SDL model
Optionally take a QGraphicsView to use as parent for modals '''
pr_raw = Pr.parse_scene(self) pr_raw = Pr.parse_scene(self)
pr_data = unicode('\n'.join(pr_raw)) pr_data = unicode('\n'.join(pr_raw))
ast, _, _ = ogParser.parse_pr(string=pr_data) ast, _, err = ogParser.parse_pr(string=pr_data)
self.semantic_errors = True if err else False
try: try:
process_ast, = ast.processes process_ast, = ast.processes
except ValueError: except ValueError:
...@@ -1046,7 +1051,8 @@ class SDL_Scene(QtGui.QGraphicsScene, object): ...@@ -1046,7 +1051,8 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
# dot supports only vertically-aligned states, and fdp does not # dot supports only vertically-aligned states, and fdp does not
# support curved edges and is buggy with pygraphviz anyway) # support curved edges and is buggy with pygraphviz anyway)
# Helper.flatten(process_ast) # Helper.flatten(process_ast)
return Statechart.create_dot_graph(process_ast, basic, scene=self) return Statechart.create_dot_graph(process_ast, basic,
scene=self, view=view)
def export_branch_to_picture(self, symbol, filename, doc_format): def export_branch_to_picture(self, symbol, filename, doc_format):
...@@ -1813,10 +1819,27 @@ class SDL_View(QtGui.QGraphicsView, object): ...@@ -1813,10 +1819,27 @@ class SDL_View(QtGui.QGraphicsView, object):
try: try:
if item.allow_nesting: if item.allow_nesting:
item.double_click() item.double_click()
ctx = unicode(item.context_name) #__class__.__name__.lower()) ctx = unicode(item.context_name)
if not isinstance(item.nested_scene, SDL_Scene): if not isinstance(item.nested_scene, SDL_Scene):
item.nested_scene = \ msg_box = QtGui.QMessageBox(self)
msg_box.setWindowTitle('Create nested symbol')
msg_box.setText('Do you want to create a new sub-{} ?'
'\n\n'
'If you do, you can come back to the '
'current diagram using the up arrow '
'in the menu bar on the top of the '
'screen'
.format(item.context_name))
msg_box.setStandardButtons(QtGui.QMessageBox.Yes |
QtGui.QMessageBox.Cancel)
msg_box.setDefaultButton(QtGui.QMessageBox.Yes)
ret = msg_box.exec_()
if ret == QtGui.QMessageBox.Yes:
item.nested_scene = \
self.scene().create_subscene(ctx, self.scene()) self.scene().create_subscene(ctx, self.scene())
else:
item.edit_text(self.mapToScene(evt.pos()))
return
self.go_down(item.nested_scene, self.go_down(item.nested_scene,
name=u"{} {}".format(ctx, unicode(item))) name=u"{} {}".format(ctx, unicode(item)))
else: else:
...@@ -1877,10 +1900,31 @@ class SDL_View(QtGui.QGraphicsView, object): ...@@ -1877,10 +1900,31 @@ class SDL_View(QtGui.QGraphicsView, object):
LOG.info('No scene - nothing to save') LOG.info('No scene - nothing to save')
return False return False
# check syntax and raise a big warning before saving
if not autosave: if not autosave:
self.messages_window.clear() self.messages_window.clear()
if not autosave and not scene.global_syntax_check(): # Propose to check semantics if the last check had errors
syntax_errors = None
if not autosave and (scene.semantic_errors
or not self.is_model_clean()):
msg_box = QtGui.QMessageBox(self)
msg_box.setIcon(QtGui.QMessageBox.Question)
msg_box.setWindowTitle('OpenGEODE - Check Semantics')
msg_box.setText("We recommend to make a semantic check of the "
"model now.\n\n"
"Choose Apply to perform this check "
"and Cancel otherwise.")
msg_box.setStandardButtons(QtGui.QMessageBox.Apply
| QtGui.QMessageBox.Cancel)
msg_box.setDefaultButton(QtGui.QMessageBox.Apply)
res = msg_box.exec_()
if res == QtGui.QMessageBox.Apply:
syntex_error = True if self.check_model() == "Syntax Errors" \
else False
# check syntax (if not done) and raise a big warning before saving
if syntax_errors is True or (syntax_errors is None
and not autosave
and not scene.global_syntax_check()):
LOG.error('Syntax errors must be fixed NOW ' LOG.error('Syntax errors must be fixed NOW '
'or you may not be able to reload the model') 'or you may not be able to reload the model')
msg_box = QtGui.QMessageBox(self) msg_box = QtGui.QMessageBox(self)
...@@ -2060,22 +2104,24 @@ class SDL_View(QtGui.QGraphicsView, object): ...@@ -2060,22 +2104,24 @@ class SDL_View(QtGui.QGraphicsView, object):
self.messages_window.addItem("Checking syntax") self.messages_window.addItem("Checking syntax")
if not scene.global_syntax_check(): if not scene.global_syntax_check():
self.messages_window.addItem("Aborted. Fix syntax errors first") self.messages_window.addItem("Aborted. Fix syntax errors first")
return return "Syntax Errors"
self.messages_window.addItem("No syntax errors") self.messages_window.addItem("No syntax errors")
self.messages_window.addItem("Checking semantics") self.messages_window.addItem("Checking semantics")
if scene.context not in ('process', 'state', 'procedure', 'block'): if scene.context not in ('process', 'state', 'procedure', 'block'):
# check can only be done on SDL diagrams # check can only be done on SDL diagrams
return return "Non-SDL"
pr_raw = Pr.parse_scene(scene, full_model=True pr_raw = Pr.parse_scene(scene, full_model=True
if not self.readonly_pr else False) if not self.readonly_pr else False)
pr_data = unicode('\n'.join(pr_raw)) pr_data = unicode('\n'.join(pr_raw))
if pr_data: if pr_data:
ast, warnings, errors = ogParser.parse_pr(files=self.readonly_pr, ast, warnings, errors = ogParser.parse_pr(files=self.readonly_pr,
string=pr_data) string=pr_data)
scene.semantic_errors = True if errors else False
log_errors(self.messages_window, errors, warnings, log_errors(self.messages_window, errors, warnings,
clearfirst=False) clearfirst=False)
self.update_asn1_dock.emit(ast) self.update_asn1_dock.emit(ast)
return "Done"
def show_item(self, item): def show_item(self, item):
''' '''
...@@ -2146,6 +2192,7 @@ class SDL_View(QtGui.QGraphicsView, object): ...@@ -2146,6 +2192,7 @@ class SDL_View(QtGui.QGraphicsView, object):
if pr_data: if pr_data:
ast, warnings, errors = ogParser.parse_pr(files=self.readonly_pr, ast, warnings, errors = ogParser.parse_pr(files=self.readonly_pr,
string=pr_data) string=pr_data)
scene.semantic_errors = True if errors else False
process, = ast.processes process, = ast.processes
log_errors(self.messages_window, errors, warnings) log_errors(self.messages_window, errors, warnings)
if len(errors) > 0: if len(errors) > 0:
...@@ -2340,7 +2387,7 @@ class OG_MainWindow(QtGui.QMainWindow, object): ...@@ -2340,7 +2387,7 @@ class OG_MainWindow(QtGui.QMainWindow, object):
# so the lock is necessary to prevent recursive execution # so the lock is necessary to prevent recursive execution
scene = self.view.top_scene() scene = self.view.top_scene()
try: try:
graph = scene.sdl_to_statechart() graph = scene.sdl_to_statechart(view=self.view)
Statechart.render_statechart(self.statechart_scene, Statechart.render_statechart(self.statechart_scene,
graph) graph)
self.statechart_view.refresh() self.statechart_view.refresh()
......
...@@ -7,9 +7,9 @@ opengeode testsc.pr --shared ...@@ -7,9 +7,9 @@ opengeode testsc.pr --shared
cat dataview.asn >> dataview-uniq.asn cat dataview.asn >> dataview-uniq.asn
asn1.exe -Ada -typePrefix asn1Scc -equal dataview.asn asn1.exe -Ada -typePrefix asn1Scc -equal dataview.asn
asn1.exe -c -typePrefix asn1Scc -equal dataview.asn asn1.exe -c -typePrefix asn1Scc -equal dataview.asn
gnatmake -gnat2012 -c *.adb gnatmake -gnat2012 -fPIC -c *.adb
gnatbind -n -Llibtestsc testsc gnatbind -n -Llibtestsc testsc
gnatmake -c -gnat2012 b~testsc.adb gnatmake -c -fPIC -gnat2012 b~testsc.adb
gcc -shared -fPIC -o libtestsc.so b~testsc.o testsc.o ccsdssoissubnetwork.o ccsdssoissubnetworkinterfaces.o demo.o demointerfaces.o environment.o environmentinterfaces.o adaasn1rtl.o -lgnat gcc -shared -fPIC -o libtestsc.so b~testsc.o testsc.o ccsdssoissubnetwork.o ccsdssoissubnetworkinterfaces.o demo.o demointerfaces.o environment.o environmentinterfaces.o adaasn1rtl.o -lgnat
rm -f dataview-uniq.c dataview-uniq.h rm -f dataview-uniq.c dataview-uniq.h
asn2aadlPlus dataview-uniq.asn DataView.aadl asn2aadlPlus dataview-uniq.asn DataView.aadl
......
include ../shared.mk
all: test-ada test-llvm
edit:
$(OPENGEODE) test.pr
test-parse:
$(OPENGEODE) test.pr --check
test-ada:
$(OPENGEODE) test.pr --toAda
$(ASN1SCC) -Ada dataview.asn -typePrefix asn1Scc -equal
$(GNATMAKE) -O$(O) -c *.adb
$(GNATBIND) -n test.ali
gnat make test_ada.ada
simu:
$(OPENGEODE) test.pr --shared
./test_simu.sh
test-c:
$(OPENGEODE) test.pr --toC
$(ASN1SCC) -c dataview.asn -typePrefix asn1Scc -equal
$(CC) -O$(O) -c *.c
test-llvm:
$(OPENGEODE) test.pr --llvm -O$(O)
$(LLC) *.ll
$(CC) -O$(O) -c *.s
coverage:
coverage run -p $(OPENGEODE) test.pr --toAda
.PHONY: all edit test-parse test-ada test-llvm coverage simu
TASTE-Dataview DEFINITIONS ::=
BEGIN
MySeqOf ::= SEQUENCE (SIZE (3..10)) OF BOOLEAN
MyBoolean ::= BOOLEAN
END
system test;
/* CIF TEXT (164, 303), (356, 219) */
-- Text area for declarations and comments
use datamodel comment 'dataview.asn';
signal seqof1(MySeqOf);
/* CIF ENDTEXT */
channel c
from env to test with seqof1;
endchannel;
block test;
signalroute r
from env to test with seqof1;
connect c and r;
/* CIF PROCESS (202, 142), (150, 75) */
process test;
/* CIF TEXT (438, 271), (287, 140) */
dcl s1, s2 MySeqof;
dcl boo MyBoolean;
/* CIF ENDTEXT */
/* CIF START (198, 56), (70, 35) */
START;
/* CIF task (132, 111), (201, 35) */
task s2 := { true, true, false, true };
/* CIF PROCEDURECALL (157, 161), (152, 35) */
call writeln ( length (s1) )
/* CIF comment (329, 161), (189, 35) */
comment 'Uninitialized => will return 0';
/* CIF task (183, 216), (99, 35) */
task s1 := s2 (1,3)
/* CIF comment (302, 216), (284, 38) */
comment 'Minimum size
s1 (1, 3) := { true, false, true} provokes a bug';
/* CIF PROCEDURECALL (157, 271), (152, 35) */
call writeln ( length (s1) );
/* CIF task (149, 326), (167, 35) */
task s1 := s1 // { false };
/* CIF PROCEDURECALL (157, 381), (152, 35) */
call writeln ( length (s1) );
/* CIF task (170, 436), (126, 35) */
task s1 := s1 // {boo};
/* CIF PROCEDURECALL (157, 491), (152, 35) */
call writeln ( length (s1) );
/* CIF NEXTSTATE (198, 541), (70, 35) */
NEXTSTATE wait;
/* CIF state (596, 470), (70, 35) */
state wait;
endstate;
endprocess test;
endblock;
endsystem;
\ No newline at end of file
with text_io, test;
use text_io, test;
procedure test_ada is
begin
put_line ("hello");
end;
...@@ -57,10 +57,10 @@ def summarize(results, elapsed): ...@@ -57,10 +57,10 @@ def summarize(results, elapsed):
print("ERROR: %s %s" % (path, rule)) print("ERROR: %s %s" % (path, rule))
if stdout: if stdout:
print("-- stdout " + "-" * 70) print("-- stdout " + "-" * 70)
print(stdout) print(stdout.decode())
if stderr: if stderr:
print("-- stderr " + "-" * 70) print("-- stderr " + "-" * 70)
print(stderr) print(stderr.decode())
print("-" * 80) print("-" * 80)
print("Finished in %.3fs" % elapsed) print("Finished in %.3fs" % elapsed)
print("%s tests, %s errors" % (len(results), failed)) print("%s tests, %s errors" % (len(results), failed))
......