Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
EMAM2Cpp
Commits
6d95f5aa
Commit
6d95f5aa
authored
Jan 07, 2019
by
Nils Kaminski
Browse files
Version update + new test(s)
parent
e5906b04
Pipeline
#95687
failed with stage
in 8 minutes and 11 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
pom.xml
View file @
6d95f5aa
...
...
@@ -8,7 +8,7 @@
<groupId>
de.monticore.lang.monticar
</groupId>
<artifactId>
embedded-montiarc-math-generator
</artifactId>
<version>
0.1.
3
-SNAPSHOT
</version>
<version>
0.1.
4
-SNAPSHOT
</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
...
...
src/main/java/de/monticore/lang/monticar/generator/cpp/VariablePortValueChecker.java
View file @
6d95f5aa
...
...
@@ -30,8 +30,8 @@ public class VariablePortValueChecker extends Variable {
@Override
public
String
getNameTargetLanguageFormat
()
{
return
"__pvc_"
+
this
.
idPVC
+
"_"
+
GeneralHelperMethods
.
getTargetLanguageVariableInstanceName
(
this
.
getName
()
)
;
//
return
name
.replaceAll("\\[", "_").replaceAll("\\]", "_");
String
s
=
"__pvc_"
+
this
.
idPVC
+
"_"
+
this
.
getName
();
return
s
.
replaceAll
(
"\\["
,
"_"
).
replaceAll
(
"\\]"
,
"_"
);
}
public
String
getTypeTargetLanguageFormat
(){
...
...
@@ -39,7 +39,7 @@ public class VariablePortValueChecker extends Variable {
}
public
void
addInitInstructionsToMethod
(
Method
init
){
TargetCodeInstruction
ti
=
new
TargetCodeInstruction
(
getNameTargetLanguageFormat
()+
".setPortReference(&"
+
this
.
getName
()+
");\n"
);
TargetCodeInstruction
ti
=
new
TargetCodeInstruction
(
getNameTargetLanguageFormat
()+
".setPortReference(&"
+
GeneralHelperMethods
.
getTargetLanguageVariableInstanceName
(
this
.
getName
()
)
+
");\n"
);
init
.
addInstruction
(
ti
);
int
id
=
0
;
...
...
src/main/java/de/monticore/lang/monticar/generator/cpp/converter/EventDynamicConnectConverter.java
View file @
6d95f5aa
...
...
@@ -524,6 +524,14 @@ public class EventDynamicConnectConverter {
}
//TODO: check if names > 0
if
(
names
.
size
()
>
0
)
{
String
c
=
""
;
for
(
int
i
=
0
;
i
<
free_method_index_counter
;
++
i
){
c
+=
"(_connected_idxs["
+
i
+
"] < 0)"
;
if
(
i
<
free_method_index_counter
-
1
){
c
+=
" || "
;
}
}
body
.
addInstruction
(
new
TargetCodeInstruction
(
"if("
+
c
+
"){free(_connected_idxs); return;}\n"
));
body
.
addInstruction
(
new
TargetCodeInstruction
(
"if(__parent != NULL){__parent_dynamic(__parent, true, false);}\n"
));
free
.
addInstruction
(
new
TargetCodeInstruction
(
"if(__parent != NULL){__parent_dynamic(__parent, false, true);}\n"
));
}
...
...
src/main/resources/template/dynamics/events_port_value_check_h.ftl
View file @
6d95f5aa
...
...
@@ -164,14 +164,18 @@ public:
}
bool
check
(){
if
(
N
==
0
){
return
false
;
}
if
(
!
isNreached
){
return
false
;
}
if
(
isChecked
){
if
(
isChecked
&&
(
valueHistory
[
N-1
]
==
*
portReference)
)
{
return
checkedValue
;
}
valueHistory
[
N-1
]
=
*
portReference;
isChecked
=
true
;
for
(
int
i
=
0
;
i
<
N
;
++
i
){
if
(
!
checkers
[
i
]
->
check
()){
...
...
src/test/resources/dynamics/basicLibrary/Event1.emam
0 → 100644
View file @
6d95f5aa
package
basicLibrary
;
component
Event1
{
ports
in
Q
a
,
in
B
useSubComp
,
out
Q
b
;
component
Sub
{
ports
in
Q
x
,
out
Q
y
;
connect
x
->
y
;
}
@
useSubComponent
::
value
(
true
){
instance
Sub
s
;
connect
a
->
s
.
x
;
connect
s
.
y
->
b
;
}
@
useSubComponent
::
value
(
false
){
connect
a
->
b
;
}
}
\ No newline at end of file
src/test/resources/dynamics/basicLibrary/SchmittTrigger.emam
0 → 100644
View file @
6d95f5aa
package
basicLibrary
;
componen
SchmittTrigger
{
ports
in
Q
sigIn
,
out
B
sigOut
;
@
sigIn
::
value
(
>=
10
)
&&
sigOut
::
value
(
false
)
{
connect
true
->
sigOut
;
}
@
sigIn
::
value
(
<=
5
)
&&
sigOut
::
value
(
true
)
{
connect
true
->
sigOut
;
}
}
\ No newline at end of file
src/test/resources/dynamics/portRequest/PortRequest1.emam
View file @
6d95f5aa
...
...
@@ -2,21 +2,21 @@ package portRequest;
dynamic
component
PortRequest1
{
ports
dynamic
in
B
a
[
2
:
8
],
dynamic
out
B
b
[
3
:
8
]
,
dynamic
in
B
a
[
0
:
8
],
dynamic
out
B
b
[
0
:
8
]
;
in
Q
c
,
dynamic
out
Q
d
[
0
:
3
];
//
in
Q
c
,
//
dynamic
out
Q
d
[
0
:
3
];
connect
a
[
1
]
->
b
[
1
];
connect
a
[
2
]
->
b
[
2
];
//
connect
a
[
1
]
->
b
[
1
];
//
connect
a
[
2
]
->
b
[
2
];
@
b
::
connect
&&
a
::
connect
{
connect
a
[?]
->
b
[?];
}
/*
@
d
::
connect
{
connect
c
->
d
[?];
}
*/
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment