Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mbe-tools
TTool
Commits
bb0e1992
Commit
bb0e1992
authored
Mar 13, 2019
by
apvrille
Browse files
Update on TMLCode management
parent
281c5086
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/tmltranslator/TMLChannel.java
View file @
bb0e1992
...
...
@@ -83,7 +83,7 @@ public class TMLChannel extends TMLCommunicationElement {
private
String
SP
=
" "
;
private
int
priority
;
private
int
vc
;
private
int
vc
=
-
1
;
public
ArrayList
<
TMLTask
>
originalOriginTasks
=
new
ArrayList
<
TMLTask
>();
public
ArrayList
<
TMLTask
>
originalDestinationTasks
=
new
ArrayList
<
TMLTask
>();
...
...
src/main/java/tmltranslator/TMLTextSpecification.java
View file @
bb0e1992
...
...
@@ -102,7 +102,8 @@ public class TMLTextSpecification<E> {
private
Map
<
String
,
SecurityPattern
>
securityPatternMap
=
new
HashMap
<
String
,
SecurityPattern
>();
private
static
String
keywords
[]
=
{
"BOOL"
,
"INT"
,
"NAT"
,
"CHANNEL"
,
"EVENT"
,
"REQUEST"
,
"LOSSYCHANNEL"
,
"LOSSYEVENT"
,
"LOSSYREQUEST"
,
"BRBW"
,
"NBRNBW"
,
private
static
String
keywords
[]
=
{
"BOOL"
,
"INT"
,
"NAT"
,
"CHANNEL"
,
"EVENT"
,
"REQUEST"
,
"LOSSYCHANNEL"
,
"VCCHANNEL"
,
"LOSSYEVENT"
,
"LOSSYREQUEST"
,
"BRBW"
,
"NBRNBW"
,
"BRNBW"
,
"INF"
,
"NIB"
,
"NINB"
,
"TASK"
,
"ENDTASK"
,
"IF"
,
"ELSE"
,
"ORIF"
,
"ENDIF"
,
"FOR"
,
"ENDFOR"
,
"SELECTEVT"
,
"CASE"
,
"ENDSELECTEVT"
,
"ENDCASE"
,
"WRITE"
,
"READ"
,
"WAIT"
,
"NOTIFY"
,
"NOTIFIED"
,
"RAND"
,
"CASERAND"
,
"ENDRAND"
,
"ENDCASERAND"
,
"EXECI"
,
"EXECC"
,
"DELAY"
,
"RANDOM"
,
"RANDOMSEQ"
,
"ENDRANDOMSEQ"
,
"SEQ"
,
"ENDSEQ"
};
...
...
@@ -247,28 +248,39 @@ public class TMLTextSpecification<E> {
if
(
ch
.
isLossy
())
{
sb
+=
"LOSSYCHANNEL"
+
SP
+
ch
.
getName
()
+
SP
+
ch
.
getLossPercentage
()
+
SP
+
ch
.
getMaxNbOfLoss
()
+
CR
;
}
if
(
ch
.
getVC
()
>=
0
)
{
sb
+=
"VCCHANNEL"
+
SP
+
ch
.
getName
()
+
SP
+
ch
.
getVC
()
+
CR
;
}
}
else
{
sb
+=
"CHANNEL"
+
SP
+
ch
.
getName
()
+
SP
+
TMLChannel
.
getStringType
(
ch
.
getType
())
+
SP
+
ch
.
getSize
();
sb
+=
"CHANNEL"
+
SP
+
ch
.
getName
()
+
SP
+
TMLChannel
.
getStringType
(
ch
.
getType
())
+
SP
+
ch
.
getSize
();
if
(!
ch
.
isInfinite
())
{
sb
+=
SP
+
ch
.
getMax
();
}
sb
+=
SP
+
"OUT"
;
for
(
TMLTask
task:
ch
.
getOriginTasks
())
{
sb
+=
SP
+
task
.
getName
();
}
sb
+=
SP
+
"IN"
;
for
(
TMLTask
task:
ch
.
getDestinationTasks
())
{
sb
+=
SP
+
task
.
getName
();
}
sb
+=
CR
;
sb
+=
SP
+
"OUT"
;
for
(
TMLTask
task:
ch
.
getOriginTasks
())
{
sb
+=
SP
+
task
.
getName
();
}
sb
+=
SP
+
"IN"
;
for
(
TMLTask
task:
ch
.
getDestinationTasks
())
{
sb
+=
SP
+
task
.
getName
();
}
sb
+=
CR
;
if
(
ch
.
isLossy
())
{
sb
+=
"LOSSYCHANNEL"
+
SP
+
ch
.
getName
()
+
SP
+
ch
.
getLossPercentage
()
+
SP
+
ch
.
getMaxNbOfLoss
()
+
CR
;
if
(
ch
.
isLossy
())
{
sb
+=
"LOSSYCHANNEL"
+
SP
+
ch
.
getName
()
+
SP
+
ch
.
getLossPercentage
()
+
SP
+
ch
.
getMaxNbOfLoss
()
+
CR
;
}
}
if
(
ch
.
getVC
()
>=
0
)
{
sb
+=
"VCCHANNEL"
+
SP
+
ch
.
getName
()
+
SP
+
ch
.
getVC
()
+
CR
;
}
}
}
sb
+=
CR
;
...
...
@@ -923,7 +935,7 @@ public class TMLTextSpecification<E> {
ch
=
tmlm
.
getChannelByName
(
_split
[
1
]);
if
(
ch
==
null
)
{
error
=
"lossy channel not previ
s
ouly declared as a regular channel "
+
_split
[
1
];
error
=
"lossy channel not previou
s
ly declared as a regular channel "
+
_split
[
1
];
addError
(
0
,
_lineNb
,
0
,
error
);
return
-
1
;
}
...
...
@@ -938,6 +950,44 @@ public class TMLTextSpecification<E> {
ch
.
setLossy
(
true
,
tmp0
,
tmp1
);
}
// LOSSYCHANNEL
if
(
isInstruction
(
"VCCHANNEL"
,
_split
[
0
]))
{
if
(!
inDec
)
{
error
=
"A ycchannel may not be declared in a non-declaration part of a TML specification"
;
addError
(
0
,
_lineNb
,
0
,
error
);
return
-
1
;
}
if
(
_split
.
length
!=
2
)
{
error
=
"A vcchannel must be declared with exactly 2 parameters, and not "
+
(
_split
.
length
-
1
)
;
addError
(
0
,
_lineNb
,
0
,
error
);
return
-
1
;
}
if
(!
checkParameter
(
"VCCHANNEL"
,
_split
,
1
,
0
,
_lineNb
))
{
return
-
1
;
}
if
(!
checkParameter
(
"VCCHANNEL"
,
_split
,
2
,
1
,
_lineNb
))
{
return
-
1
;
}
ch
=
tmlm
.
getChannelByName
(
_split
[
1
]);
if
(
ch
==
null
)
{
error
=
"vc channel not previously declared as a regular channel "
+
_split
[
1
];
addError
(
0
,
_lineNb
,
0
,
error
);
return
-
1
;
}
try
{
tmp0
=
Integer
.
decode
(
_split
[
2
]);
}
catch
(
Exception
e
)
{
tmp0
=
-
1
;}
ch
.
setVC
(
tmp0
);
}
// VCCHANNEL
// EVENT
if
(
isInstruction
(
"EVENT"
,
_split
[
0
]))
{
if
(!
inDec
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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