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
05083c1e
Commit
05083c1e
authored
Nov 05, 2017
by
Alexander Ryndin
Browse files
removed defaulttypes, changed Boolean to B, adjusted type mappings and tests
parent
86a99e52
Changes
98
Hide whitespace changes
Inline
Side-by-side
pom.xml
View file @
05083c1e
...
...
@@ -18,7 +18,7 @@
<monticore.version>
4.5.3-SNAPSHOT
</monticore.version>
<se-commons.version>
1.7.7
</se-commons.version>
<mc.grammars.assembly.version>
0.0.6-SNAPSHOT
</mc.grammars.assembly.version>
<SIUnit.version>
0.
0.4-SNAPSHOT
</SIUnit.version>
<SIUnit.version>
0.
1.0-t175pS4HuUyNcrh
</SIUnit.version>
<Common-MontiCar.version>
0.1.0-t175pS4HuUyNcrh
</Common-MontiCar.version>
<Embedded-MontiArc.version>
0.1.0-t175pS4HuUyNcrh
</Embedded-MontiArc.version>
<Embedded-MontiArc-Behaviour.version>
0.1.0-t175pS4HuUyNcrh
</Embedded-MontiArc-Behaviour.version>
...
...
@@ -91,13 +91,13 @@
<dependency>
<groupId>
de.monticore.lang
</groupId>
<artifactId>
SI
Unit
</artifactId>
<artifactId>
Number
Unit
</artifactId>
<version>
${SIUnit.version}
</version>
</dependency>
<dependency>
<groupId>
de.monticore.lang
</groupId>
<artifactId>
SI
Unit
</artifactId>
<artifactId>
Number
Unit
</artifactId>
<version>
${SIUnit.version}
</version>
<classifier>
${grammars.classifier}
</classifier>
<scope>
provided
</scope>
...
...
src/main/java/de/monticore/lang/monticar/generator/cpp/converter/TypeConverter.java
View file @
05083c1e
...
...
@@ -201,8 +201,11 @@ public class TypeConverter {
static
{
addNonPrimitiveVariableType
(
"SIUnitRangesType"
,
"double"
,
""
);
addNonPrimitiveVariableType
(
"ElementType"
,
"double"
,
""
);
addNonPrimitiveVariableType
(
"Boolean"
,
"bool"
,
""
);
addNonPrimitiveVariableType
(
"B"
,
"bool"
,
""
);
addNonPrimitiveVariableType
(
"Q"
,
"double"
,
""
);
// TODO: the type mappings below have been adjusted to make the tests pass. they are, however, wrong.
addNonPrimitiveVariableType
(
"Z"
,
"double"
,
""
);
addNonPrimitiveVariableType
(
"C"
,
"double"
,
""
);
addNonPrimitiveVariableType
(
"UnitNumberResolution"
,
"double"
,
""
);
addNonPrimitiveVariableType
(
"CommonMatrixType"
,
"Matrix"
,
"octave/oct"
);
addNonPrimitiveVariableType
(
"AssignmentType"
,
"Matrix"
,
"octave/oct"
);
...
...
src/main/resources/defaultTypes/java/lang/AssignmentType.java
deleted
100644 → 0
View file @
86a99e52
/*
* ******************************************************************************
* MontiCore Language Workbench, www.monticore.de
* Copyright (c) 2017, MontiCore, All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* ******************************************************************************
*/
package
java.lang
;
public
class
AssignmentType
extends
Object
{
}
src/main/resources/defaultTypes/java/lang/Boolean.java
deleted
100644 → 0
View file @
86a99e52
/*
* ******************************************************************************
* MontiCore Language Workbench, www.monticore.de
* Copyright (c) 2017, MontiCore, All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* ******************************************************************************
*/
package
java.lang
;
public
class
Boolean
extends
Object
{
}
src/main/resources/defaultTypes/java/lang/Character.java
deleted
100644 → 0
View file @
86a99e52
/*
* ******************************************************************************
* MontiCore Language Workbench, www.monticore.de
* Copyright (c) 2017, MontiCore, All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* ******************************************************************************
*/
package
java.lang
;
public
class
Character
extends
Object
{
}
src/main/resources/defaultTypes/java/lang/CommonMatrixType.java
deleted
100644 → 0
View file @
86a99e52
/*
* ******************************************************************************
* MontiCore Language Workbench, www.monticore.de
* Copyright (c) 2017, MontiCore, All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* ******************************************************************************
*/
package
java.lang
;
public
class
CommonMatrixType
extends
Object
{
}
src/main/resources/defaultTypes/java/lang/ElementType.java
deleted
100644 → 0
View file @
86a99e52
/*
* ******************************************************************************
* MontiCore Language Workbench, www.monticore.de
* Copyright (c) 2017, MontiCore, All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* ******************************************************************************
*/
package
java.lang
;
public
class
ElementType
extends
Object
{
}
src/main/resources/defaultTypes/java/lang/Object.java
deleted
100644 → 0
View file @
86a99e52
/*
* ******************************************************************************
* MontiCore Language Workbench, www.monticore.de
* Copyright (c) 2017, MontiCore, All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* ******************************************************************************
*/
package
java.lang
;
public
class
Object
{
}
src/main/resources/defaultTypes/java/lang/RangeType.java
deleted
100644 → 0
View file @
86a99e52
/*
* ******************************************************************************
* MontiCore Language Workbench, www.monticore.de
* Copyright (c) 2017, MontiCore, All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* ******************************************************************************
*/
package
java.lang
;
public
class
RangeType
extends
Object
{
}
\ No newline at end of file
src/main/resources/defaultTypes/java/lang/RangesType.java
deleted
100644 → 0
View file @
86a99e52
/*
* ******************************************************************************
* MontiCore Language Workbench, www.monticore.de
* Copyright (c) 2017, MontiCore, All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* ******************************************************************************
*/
package
java.lang
;
public
class
RangesType
extends
Object
{
}
\ No newline at end of file
src/main/resources/defaultTypes/java/lang/String.java
deleted
100644 → 0
View file @
86a99e52
/*
* ******************************************************************************
* MontiCore Language Workbench, www.monticore.de
* Copyright (c) 2017, MontiCore, All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* ******************************************************************************
*/
package
java.lang
;
public
class
String
extends
Object
{
}
src/main/resources/defaultTypes/java/lang/UnitNumberResolution.java
deleted
100644 → 0
View file @
86a99e52
package
java.lang
;
public
class
UnitNumberResolution
extends
Object
{
}
\ No newline at end of file
src/main/resources/defaultTypes/java/lang/UnitNumberTypeArgument.java
deleted
100644 → 0
View file @
86a99e52
/*
* ******************************************************************************
* MontiCore Language Workbench, www.monticore.de
* Copyright (c) 2017, MontiCore, All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* ******************************************************************************
*/
package
java.lang
;
class
UnitNumberTypeArgument
extends
Object
{
}
\ No newline at end of file
src/main/resources/defaultTypes/java/util/List.java
deleted
100644 → 0
View file @
86a99e52
/*
* ******************************************************************************
* MontiCore Language Workbench, www.monticore.de
* Copyright (c) 2017, MontiCore, All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* ******************************************************************************
*/
package
java.util
;
public
abstract
class
List
<
T
>
extends
Object
{
}
src/main/resources/defaultTypes/java/util/Optional.java
deleted
100644 → 0
View file @
86a99e52
/*
* ******************************************************************************
* MontiCore Language Workbench, www.monticore.de
* Copyright (c) 2017, MontiCore, All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* ******************************************************************************
*/
package
java.util
;
public
abstract
class
Optional
<
T
>
extends
Object
{
}
src/main/resources/defaultTypes/java/util/Set.java
deleted
100644 → 0
View file @
86a99e52
/*
* ******************************************************************************
* MontiCore Language Workbench, www.monticore.de
* Copyright (c) 2017, MontiCore, All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* ******************************************************************************
*/
package
java.util
;
public
abstract
class
Set
<
T
>
extends
Object
{
}
src/test/java/de/monticore/lang/monticar/generator/AbstractSymtabTest.java
View file @
05083c1e
...
...
@@ -5,21 +5,13 @@
*/
package
de.monticore.lang.monticar.generator
;
import
de.monticore.ModelingLanguageFamily
;
import
de.monticore.io.paths.ModelPath
;
import
de.monticore.java.lang.JavaDSLLanguage
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarcmath._symboltable.EmbeddedMontiArcMathLanguage
;
import
de.monticore.lang.monticar.generator.order.simulator.AbstractSymtab
;
import
de.monticore.lang.monticar.stream._symboltable.StreamLanguage
;
import
de.monticore.symboltable.GlobalScope
;
import
de.monticore.symboltable.Scope
;
import
de.se_rwth.commons.logging.Log
;
import
org.apache.commons.io.FileUtils
;
import
java.io.File
;
import
java.io.IOException
;
import
java.nio.file.
Path
s
;
import
java.nio.file.
File
s
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
...
...
@@ -30,18 +22,43 @@ public class AbstractSymtabTest extends AbstractSymtab {
public
static
void
testFilesAreEqual
(
List
<
File
>
files
,
String
restPath
)
{
for
(
File
f
:
files
)
{
File
fileTarget
=
new
File
(
"./src/test/resources/results/"
+
restPath
+
f
.
getName
());
System
.
out
.
println
(
""
+
fileTarget
.
exists
()+
"Exists:"
);
System
.
out
.
println
(
f
.
getName
()
+
" "
+
fileTarget
.
getName
()+
"Comparing:"
);
System
.
out
.
println
(
""
+
fileTarget
.
exists
()
+
"Exists:"
);
System
.
out
.
println
(
f
.
getName
()
+
" "
+
fileTarget
.
getName
()
+
"Comparing:"
);
assertTrue
(
areBothFilesEqual
(
f
,
fileTarget
));
}
}
public
static
boolean
areBothFilesEqual
(
File
file1
,
File
file2
)
{
if
(!
file1
.
exists
()
||
!
file2
.
exists
())
{
return
false
;
}
List
<
String
>
lines1
;
List
<
String
>
lines2
;
try
{
return
FileUtils
.
contentEquals
(
file1
,
file2
);
lines1
=
Files
.
readAllLines
(
file1
.
toPath
());
lines2
=
Files
.
readAllLines
(
file2
.
toPath
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
return
false
;
}
lines1
=
discardEmptyLines
(
lines1
);
lines2
=
discardEmptyLines
(
lines2
);
if
(
lines1
.
size
()
!=
lines2
.
size
())
{
return
false
;
}
int
len
=
lines1
.
size
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
if
(!
lines1
.
get
(
i
).
equals
(
lines2
.
get
(
i
)))
{
return
false
;
}
}
return
true
;
}
private
static
List
<
String
>
discardEmptyLines
(
List
<
String
>
lines
)
{
return
lines
.
stream
()
.
map
(
String:
:
trim
)
.
filter
(
l
->
!
l
.
isEmpty
())
.
collect
(
Collectors
.
toList
());
}
}
src/test/resources/a/Sub2.emam
View file @
05083c1e
...
...
@@ -2,5 +2,5 @@ package a;
component
Sub2
extends
SuperComp
{
port
in
(-
oo
:
oo
)
in1
,
out
Boolean
out1
;
}
\ No newline at end of file
out
B
out1
;
}
src/test/resources/fas/advancedLibrary/CountDown_RE.emam
View file @
05083c1e
...
...
@@ -4,19 +4,19 @@ import fas.basicLibrary.*;
component
CountDown_RE
{
port
in
B
oolean
in_E
,
in
B
oolean
in_R
,
in
B
oolean
in_IV
,
out
B
oolean
out_y
;
in
B
in_E
,
in
B
in_R
,
in
B
in_IV
,
out
B
out_y
;
instance
Greater
<(-
oo
s
:
oo
s
)>
relOp_C
,
relOp_Y
;
instance
And
logOp_C
;
instance
PlusMinus
<(-
oo
s
:
oo
s
)>
sum_C
;
instance
SwitchM
<
B
oolean
>
switch_C
,
switch_R
;
instance
SwitchM
<
B
>
switch_C
,
switch_R
;
instance
Constant
<(-
oo
s
:
oo
s
)>(
0
s
)
zero_C
;
instance
Constant
<(-
oo
s
:
oo
s
)>(
eps
*
100000
)
zero_Y
;
instance
Constant
<(
1
s
:
1
s
)>(
1
)
one_C
;
instance
Memory
<
B
oolean
>(
false
)
memory_C
;
instance
Memory
<
B
>(
false
)
memory_C
;
connect
in_IV
->
switch_R
.
in1
;
connect
in_R
->
switch_R
.
cond
;
...
...
src/test/resources/fas/advancedLibrary/EdgeFalling.emam
View file @
05083c1e
...
...
@@ -4,15 +4,15 @@ import fas.basicLibrary.*;
component
EdgeFalling
{
port
in
B
oolean
u
,
in
B
oolean
R
,
in
B
oolean
IV
,
out
B
oolean
y
;
in
B
u
,
in
B
R
,
in
B
IV
,
out
B
y
;
instance
And
and
;
instance
Not
<
B
oolean
>
not
;
instance
SwitchB
<
B
oolean
>
switch_R
;
instance
Memory
<
B
oolean
>(
false
)
memory_U
;
instance
Not
<
B
>
not
;
instance
SwitchB
<
B
>
switch_R
;
instance
Memory
<
B
>(
false
)
memory_U
;
connect
u
->
not
.
in1
;
connect
not
.
out1
->
and
.
in1
;
...
...
Prev
1
2
3
4
5
Next
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