Commit 19947416 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files
parents d4825657 c55c1ed6
......@@ -44,18 +44,18 @@ update:
@git submodule update --remote
dependencies:
@pip install --user --upgrade ./singledispatch
@pip install --user --upgrade ./enum34
@pip install --user --upgrade ./speedometer
@pip install --user --upgrade ./properties
@pip install --user --upgrade ./dmt
@pip install --user --upgrade ./pymsc
@pip install --user --upgrade ./asn1-value-editor
@pip install --user --upgrade ./antlr3-python
@pip install --user --upgrade ./pygraphviz
@pip2 install --user --upgrade ./antlr3-python
@pip2 install --user --upgrade ./singledispatch
@pip2 install --user --upgrade ./enum34
@pip2 install --user --upgrade ./speedometer
#@pip2 install --user --upgrade ./properties
@pip3 install --user --upgrade ./dmt
@pip2 install --user --upgrade ./pymsc
#@pip2 install --user --upgrade ./asn1-value-editor
@pip2 install --user --upgrade ./pygraphviz
install:
@pip install --user --upgrade .
@pip2 install --user --upgrade .
full-install: update dependencies install
......
......@@ -32,7 +32,6 @@ Features
- Syntax highlighting
- Undo/Redo, Copy-Paste
- (Limited) VIM mode - You can use :wq or :%s,search,replace,g, and /search pattern
- SDL to LLVM code generation
- Python API to parse and render SDL from other Python modules
Installation
......@@ -58,8 +57,8 @@ And optionally llvm and llvmpy
On Debian, Ubuntu, and probably other distributions:
```bash
$ sudo apt-get install pkg-config python-pyside pyside-tools graphviz \
graphviz-dev libgraphviz-dev python-pip gnat-4.8 \
$ sudo apt install pkg-config python-pyside pyside-tools graphviz python-ply \
graphviz-dev libgraphviz-dev python-pip gnat \
libmono-system-runtime4.0-cil libmono-corlib4.0-cil \
libmono-system-runtime-serialization-formatters-soap4.0-cil \
libmono-system-web4.0-cil libmono-system-xml4.0-cil \
......@@ -67,7 +66,9 @@ $ sudo apt-get install pkg-config python-pyside pyside-tools graphviz \
libmono-system-data-linq4.0-cil libmono-corlib2.0-cil libmono-system2.0-cil
```
To install the ASN.1 compiler:
Some of these packages may be more recent on your distribution.
To install the ASN.1 compiler, run (possibly as root):
```bash
$ cd /opt
......@@ -82,33 +83,31 @@ Open a new terminal and check that it works:
$ mono /opt/asn1scc/asn1.exe
```
Optionally, to install llvmpy and LLVM follow the instructions [here](http://www.llvmpy.org/llvmpy-doc/0.12.7/doc/getting_started.html#installation)
OpenGEODE installation
----------------------
Make sure all dependencies are installed.
If you see a certificate error, you may need to run the following commands:
If you see a certificate error while cloning from [Gitlab](https://gitrepos.estec.esa.int/taste/opengeode), you may need to run the following commands:
```bash
$ echo -n | openssl s_client -connect gitrepos.estec.esa.int:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > gitrepos.cert
$ sudo cp gitrepos.cert /usr/local/share/ca-certificates/gitrepos.crt
$ sudo update-ca-certificate
$ sudo update-ca-certificates
```
Then you can get the software with git:
There is no such issue if you use Github:
```bash
$ git clone --recursive https://github.com/maxime-esa/opengeode.git
$ git clone --recursive https://github.com/esa/opengeode.git
```
And install it:
```bash
$ cd opengeode
$ make install
$ make full-install
```
......@@ -122,7 +121,7 @@ maxime (dot) perrotin (at) esa (dot) int
The LLVM backend was designed and implemented by Diego Barbera during the ESA
Summer of Code 2014.
Summer of Code 2014 (It is unfortunately unmaintained now and does not support all features of the tool).
Some parts implemented by Laurent Meyer (native SDL type support in the parser)
......@@ -142,6 +141,13 @@ The background pattern was downloaded from www.subtlepatterns.com
Changelog
=========
1.5.29 (04/2017)
- Unicode bugfixes in Ada backend
- Bugfix with SEQUENCE OF literals in Ada backend
1.5.28 (03/2017)
- Added preliminary support for PROCESS TYPE and instances
1.5.26 (02/2017)
- Statecharts can be configured to filter out signals
......
Subproject commit 59a971440f0b96144d4910abefcfd6f698186c92
Subproject commit 5652026598202a7c3230b4e322f7aa0b66377842
Subproject commit ab1d055747327b2f19ed45550caa15733538cd0d
Subproject commit 6665e0632db0a1b11c2942bd8ae293a00d9bc126
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="48px"
height="48px"
id="svg3021"
version="1.1"
inkscape:version="0.48.5 r10040"
sodipodi:docname="processtype.svg"
inkscape:export-filename="/home/maxime/taste/tool-src/trunk/misc/opengeode/icons/process.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
id="defs3023">
<linearGradient
id="linearGradient3816"
osb:paint="solid">
<stop
style="stop-color:#fffcc5;stop-opacity:1;"
offset="0"
id="stop3818" />
</linearGradient>
<linearGradient
id="linearGradient3810"
osb:paint="solid">
<stop
style="stop-color:#fffcc5;stop-opacity:1;"
offset="0"
id="stop3812" />
</linearGradient>
<linearGradient
id="linearGradient3788"
osb:paint="solid">
<stop
style="stop-color:#ffffca;stop-opacity:1;"
offset="0"
id="stop3790" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="-3.3870489 : 23.541286 : 1"
inkscape:vp_y="-82.859071 : 600.97062 : 0"
inkscape:vp_z="63.902198 : 22.144734 : 1"
inkscape:persp3d-origin="30.920448 : 18.035246 : 1"
id="perspective4009" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3788"
id="radialGradient3794"
cx="50"
cy="25"
fx="50"
fy="25"
r="51"
gradientTransform="matrix(1,0,0,0.50980392,0,12.254902)"
gradientUnits="userSpaceOnUse" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3788"
id="radialGradient3798"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,0.50980392,0,12.254902)"
cx="50"
cy="25"
fx="50"
fy="25"
r="51" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3788"
id="linearGradient3808"
x1="-0.4999996"
y1="20.5"
x2="50.5"
y2="20.5"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.74554189,0,0,1.0053695,-54.924261,-0.68150343)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3810"
id="linearGradient3814"
x1="4.5"
y1="33"
x2="45.5"
y2="33"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.69337979,0,0,1,6.9512195,2)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3816"
id="linearGradient3820"
x1="4.5"
y1="8"
x2="45.5"
y2="8"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.70334383,0,0,1,6.6306893,1.7142857)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3788"
id="linearGradient3822"
x1="-0.4999996"
y1="20.5"
x2="50.5"
y2="20.5"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.70882367,0,0,1.0062188,6.4936939,1.7296578)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3788"
id="linearGradient3099"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.70882367,0,0,1.0062188,6.4936939,1.7296578)"
x1="-0.4999996"
y1="20.5"
x2="50.5"
y2="20.5" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3816"
id="linearGradient3101"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.70334383,0,0,1,6.6306893,1.7142857)"
x1="4.5"
y1="8"
x2="45.5"
y2="8" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3810"
id="linearGradient3103"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.69337979,0,0,1,6.9512195,2)"
x1="4.5"
y1="33"
x2="45.5"
y2="33" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3788-2"
id="linearGradient3099-6"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.70882367,0,0,1.0062188,6.4936939,1.7296578)"
x1="-0.49999961"
y1="20.5"
x2="50.5"
y2="20.5" />
<linearGradient
id="linearGradient3788-2"
osb:paint="solid">
<stop
style="stop-color:#ffffca;stop-opacity:1;"
offset="0"
id="stop3790-6" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3816-8"
id="linearGradient3101-1"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.70334383,0,0,1,6.6306893,1.7142857)"
x1="4.5"
y1="8"
x2="45.5"
y2="8" />
<linearGradient
id="linearGradient3816-8"
osb:paint="solid">
<stop
style="stop-color:#fffcc5;stop-opacity:1;"
offset="0"
id="stop3818-7" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3810-2"
id="linearGradient3103-9"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.69337979,0,0,1,6.9512195,2)"
x1="4.5"
y1="33"
x2="45.5"
y2="33" />
<linearGradient
id="linearGradient3810-2"
osb:paint="solid">
<stop
style="stop-color:#fffcc5;stop-opacity:1;"
offset="0"
id="stop3812-0" />
</linearGradient>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="7"
inkscape:cx="-18.151922"
inkscape:cy="25.946714"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="1242"
inkscape:window-height="693"
inkscape:window-x="170"
inkscape:window-y="104"
inkscape:window-maximized="0"
showguides="true"
inkscape:guide-bbox="true">
<inkscape:grid
type="xygrid"
id="grid4049" />
</sodipodi:namedview>
<metadata
id="metadata3026">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
x="20.285713"
y="23.857143"
id="text3878"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3880"
x="20.285713"
y="23.857143" /></text>
<text
xml:space="preserve"
style="font-size:16.8021698px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
x="2.1795537"
y="22.940475"
id="text3882"
sodipodi:linespacing="125%"
transform="scale(0.91761901,1.0897769)"><tspan
sodipodi:role="line"
id="tspan3884"
x="2.1795537"
y="22.940475"
style="font-size:12px" /></text>
<g
id="g3093"
transform="translate(0.785658,-6.281734)">
<path
style="font-size:9px;font-style:normal;font-weight:400;fill:url(#linearGradient3099);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.84453046;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;font-family:Sans Serif"
inkscape:connector-curvature="0"
vector-effect="non-scaling-stroke"
d="m 10.037812,9.7794081 -3.5441178,5.0310939 0,15.093282 3.5441188,5.031094 M 38.39076,9.7794081 l 3.544118,5.0310939 0,15.093282 -3.544118,5.031094"
id="path18"
inkscape:export-filename="/home/maxime/taste/tool-src/misc/opengeode/icons-src/procedure.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
sodipodi:nodetypes="cccccccc" />
<path
style="font-size:9px;font-style:normal;font-weight:400;fill:url(#linearGradient3101);fill-opacity:1;stroke:#000000;stroke-width:0.83865595px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans Serif"
d="m 10.147409,9.7142857 28.133755,0 0,0"
id="path3008"
inkscape:connector-curvature="0" />
<path
style="font-size:9px;font-style:normal;font-weight:400;fill:url(#linearGradient3103);fill-opacity:1;stroke:#000000;stroke-width:0.83269429px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans Serif"
d="m 10.418119,35 27.735192,0"
id="path3010"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path3824"
d="m 10.073615,34.101019 c -0.02659,-0.09939 -0.03656,-5.515409 -0.02216,-12.035591 l 0.02618,-11.854877 14.08863,0 14.08863,0 0.02592,12.035591 0.02592,12.035592 -14.092393,0 c -11.180563,0 -14.102382,-0.03734 -14.140732,-0.180715 z"
style="opacity:0.98000004;fill:#fffcc5;fill-opacity:1;fill-rule:evenodd;stroke:none" />
</g>
<g
id="g3093-2"
transform="matrix(0.80777831,0,0,0.75534088,5.4655563,-0.52333659)">
<path
style="font-size:9px;font-style:normal;font-weight:400;fill:url(#linearGradient3099-6);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.84453046;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;font-family:Sans Serif"
inkscape:connector-curvature="0"
vector-effect="non-scaling-stroke"
d="m 10.037812,9.7794081 -3.5441178,5.0310939 0,15.093282 3.5441188,5.031094 M 38.39076,9.7794081 l 3.544118,5.0310939 0,15.093282 -3.544118,5.031094"
id="path18-3"
inkscape:export-filename="/home/maxime/taste/tool-src/misc/opengeode/icons-src/procedure.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
sodipodi:nodetypes="cccccccc" />
<path
style="font-size:9px;font-style:normal;font-weight:400;fill:url(#linearGradient3101-1);fill-opacity:1;stroke:#000000;stroke-width:0.83865595px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans Serif"
d="m 10.147409,9.7142857 28.133755,0 0,0"
id="path3008-7"
inkscape:connector-curvature="0" />
<path
style="font-size:9px;font-style:normal;font-weight:400;fill:url(#linearGradient3103-9);fill-opacity:1;stroke:#000000;stroke-width:0.83269429px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans Serif"
d="m 10.418119,35 27.735192,0"
id="path3010-5"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path3824-9"
d="m 10.073615,34.101019 c -0.02659,-0.09939 -0.03656,-5.515409 -0.02216,-12.035591 l 0.02618,-11.854877 14.08863,0 14.08863,0 0.02592,12.035591 0.02592,12.035592 -14.092393,0 c -11.180563,0 -14.102382,-0.03734 -14.140732,-0.180715 z"
style="opacity:0.98000004;fill:#fffcc5;fill-opacity:1;fill-rule:evenodd;stroke:none" />
</g>
</g>
</svg>
......@@ -13,6 +13,7 @@
<file>icons/procedurestop.png</file>
<file>icons/procedure.png</file>
<file>icons/process.png</file>
<file>icons/processtype.png</file>
<file>icons/start.png</file>
<file>icons/connect.png</file>
<file>icons/statestart.png</file>
......
......@@ -97,6 +97,45 @@ SHARED_LIB = False
UNICODE_SEP = u'\u00dc'
LPREFIX = u'ctxt'
def external_ri_list(process):
''' Helper function: create a list of RI with proper signature
Used for the formal parameters of generic packages when using process type
'''
result = []
for signal in process.output_signals:
param_name = signal.get('param_name') \
or u'{}_param'.format(signal['name'])
param_spec = ''
if 'type' in signal:
typename = type_name(signal['type'])
param_spec = u'({pName}: access {sort})'.format(pName=param_name,
sort=typename)
result.append(u"procedure RI{sep}{name}{param}".format(sep=UNICODE_SEP,
name=signal['name'],
param=param_spec))
for proc in (proc for proc in process.procedures if proc.external):
ri_header = u'procedure RI{sep}{sig_name}'.format(
sep=UNICODE_SEP,
sig_name=proc.inputString)
params = []
params_spec = ''
for param in proc.fpar:
typename = type_name(param['type'])
params.append(u'{par[name]}: access {sort}'.format(par=param,
sort=typename))
if params:
params_spec = u"({})".format("; ".join(params))
ri_header += params_spec
result.append(ri_header)
for timer in process.timers:
result.append(u"procedure set_{}(val: access asn1SccT_Uint32)"
.format(timer))
result.append(u"procedure reset_{}"
.format(timer))
return result
@singledispatch
def generate(*args, **kwargs):
''' Generate the code for an item of the AST '''
......@@ -106,9 +145,26 @@ def generate(*args, **kwargs):
# Processing of the AST
@generate.register(ogAST.Process)
def _process(process, simu=False, **kwargs):
''' Generate the code for a complete process (AST Top level) '''
process_name = process.processName
def _process(process, simu=False, instance=False, **kwargs):
''' Generate the code for a complete process (AST Top level)
use instance=True to generate the code for a process type instance
rather than the process type itself.
'''
# support generation of code of a process type
if not instance:
process_name = process.instance_of_name or process.processName
generic = process.instance_of_name # shortcut
process_instance = process
process = process.instance_of_ref or process
else:
process_name = process.processName
generic = False
process_instance = process
if process_instance is not process:
# Generate an instance of the process type, too.
generate(process_instance, simu, instance=True)
global TYPES
TYPES = process.dataview
del OUT_SIGNALS[:]
......@@ -294,55 +350,56 @@ LD_LIBRARY_PATH=. opengeode-simulator
context_decl.append(u'pragma import (C, ctxt, "{}_ctxt");'
.format(import_context))
if not simu:
if not simu and not instance:
process_level_decl.extend(context_decl)
# Continuous State transition id
process_level_decl.append('CS_Only : constant Integer := {};'
.format(len(process.transitions)))
for name, val in process.mapping.viewitems():
# Test val, in principle there is a value but if the code targets
# generation of properties, the model may have been cleant up and
# in that case no value would be set..
if name.endswith(u'START') and name != u'START' and val:
process_level_decl.append(u'{name} : constant := {val};'
.format(name=name, val=str(val)))
# Declare start procedure for aggregate states XXX add in C generator
# should create one START per "via" clause, TODO later
aggreg_start_proc = []
for name, substates in aggregates.viewitems():
proc_name = u'procedure {}{}START'.format(name, UNICODE_SEP)
process_level_decl.append(u'{};'.format(proc_name))
aggreg_start_proc.extend([u'{} is'.format(proc_name),
'begin'])
aggreg_start_proc.extend(u'runTransition({sub}{sep}START);'
.format(sub=subname.statename,
sep=UNICODE_SEP)
for subname in substates)
aggreg_start_proc.extend([u'end {}{}START;'
.format(name, UNICODE_SEP),
'\n'])
# Add the declaration of the runTransition procedure
process_level_decl.append('procedure runTransition(Id: Integer);')
# Generate the code of the start transition (if process not empty)
initDone = u'{ctxt}.initDone := True;'.format(ctxt=LPREFIX)
if not simu:
start_transition = [u'begin']
if process.transitions:
start_transition.append(u'runTransition(0);')
start_transition.append(initDone)
else:
start_transition = [u'procedure Startup is',
u'begin',
u' runTransition(0);' if process.transitions
else 'null;',
initDone,
u'end Startup;']
start_transition = []
# Continuous State transition id
if not instance:
process_level_decl.append('CS_Only : constant Integer := {};'
.format(len(process.transitions)))
for name, val in process.mapping.viewitems():
# Test val, in principle there is a value but if the code targets
# generation of properties, the model may have been cleant up and
# in that case no value would be set..
if name.endswith(u'START') and name != u'START' and val:
process_level_decl.append(u'{name} : constant := {val};'
.format(name=name, val=str(val)))
# Declare start procedure for aggregate states XXX add in C generator
# should create one START per "via" clause, TODO later
for name, substates in aggregates.viewitems():
proc_name = u'procedure {}{}START'.format(name, UNICODE_SEP)
process_level_decl.append(u'{};'.format(proc_name))
aggreg_start_proc.extend([u'{} is'.format(proc_name),
'begin'])
aggreg_start_proc.extend(u'runTransition({sub}{sep}START);'
.format(sub=subname.statename,
sep=UNICODE_SEP)
for subname in substates)
aggreg_start_proc.extend([u'end {}{}START;'
.format(name, UNICODE_SEP),
'\n'])
# Add the declaration of the runTransition procedure
process_level_decl.append('procedure runTransition(Id: Integer);')
# Generate the code of the start transition (if process not empty)
initDone = u'{ctxt}.initDone := True;'.format(ctxt=LPREFIX)
if not simu: