Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
kazoo
Commits
41dfc1ad
Commit
41dfc1ad
authored
Nov 28, 2017
by
Maxime Perrotin
Browse files
Add helper functions to rename interfaces
parent
1255b189
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/aadl_parser.adb
View file @
41dfc1ad
...
...
@@ -681,7 +681,6 @@ procedure AADL_Parser is
Previous_IFview
:
Boolean
:=
False
;
Previous_CView
:
Boolean
:=
False
;
Previous_DataView
:
Boolean
:=
False
;
Previous_Stack
:
Boolean
:=
False
;
Previous_TimerRes
:
Boolean
:=
False
;
begin
for
J
in
1
..
Ada
.
Command_Line
.
Argument_Count
loop
...
...
@@ -704,10 +703,6 @@ procedure AADL_Parser is
OutDir
:=
J
;
Previous_OutDir
:=
false
;
elsif
Previous_Stack
then
Stack_Val
:=
J
;
Previous_Stack
:=
false
;
elsif
Previous_TimerRes
then
Timer_Resolution
:=
J
;
Previous_TimerRes
:=
false
;
...
...
@@ -769,12 +764,6 @@ procedure AADL_Parser is
then
Previous_Ifview
:=
True
;
elsif
Ada
.
Command_Line
.
Argument
(
J
)
=
"--stack"
or
else
Ada
.
Command_Line
.
Argument
(
J
)
=
"-stack"
or
else
Ada
.
Command_Line
.
Argument
(
J
)
=
"-s"
then
Previous_Stack
:=
True
;
elsif
Ada
.
Command_Line
.
Argument
(
J
)
=
"--timer"
or
else
Ada
.
Command_Line
.
Argument
(
J
)
=
"-timer"
or
else
Ada
.
Command_Line
.
Argument
(
J
)
=
"-x"
...
...
src/interface_view.adb
View file @
41dfc1ad
...
...
@@ -709,6 +709,60 @@ package body Interface_View is
New_Item
=>
FV
);
end
Rename_Function
;
procedure
Rename_Provided_Interface
(
IV
:
in
out
Complete_Interface_View
;
Func
:
String
;
Iface
:
String
;
To
:
String
)
is
FV
:
Taste_Terminal_Function
:=
IV
.
Flat_Functions
.
Element
(
Key
=>
Func
);
FV_If
:
Taste_Interface
:=
FV
.
Provided
.
Element
(
Key
=>
Iface
);
begin
FV_If
.
Name
:=
US
(
To
);
FV
.
Provided
.
Delete
(
Key
=>
Iface
);
FV
.
Provided
.
Insert
(
Key
=>
To
,
New_Item
=>
FV_If
);
-- Now fix all references to this interface
for
Each
of
IV
.
Flat_Functions
loop
for
RI
of
Each
.
Required
loop
for
Remote
of
RI
.
Remote_Interfaces
loop
if
Remote
.
Function_Name
=
FV
.
Name
and
then
Remote
.
Interface_Name
=
US
(
Iface
)
then
Remote
.
Interface_Name
:=
FV_If
.
Name
;
end
if
;
end
loop
;
end
loop
;
end
loop
;
end
Rename_Provided_Interface
;
procedure
Rename_Required_Interface
(
IV
:
in
out
Complete_Interface_View
;
Func
:
String
;
Iface
:
String
;
To
:
String
)
is
FV
:
Taste_Terminal_Function
:=
IV
.
Flat_Functions
.
Element
(
Key
=>
Func
);
FV_If
:
Taste_Interface
:=
FV
.
Provided
.
Element
(
Key
=>
Iface
);
begin
FV_If
.
Name
:=
US
(
To
);
FV
.
Required
.
Delete
(
Key
=>
Iface
);
FV
.
Required
.
Insert
(
Key
=>
To
,
New_Item
=>
FV_If
);
-- Now fix all references to this interface
for
Each
of
IV
.
Flat_Functions
loop
for
PI
of
Each
.
Provided
loop
for
Remote
of
PI
.
Remote_Interfaces
loop
if
Remote
.
Function_Name
=
FV
.
Name
and
then
Remote
.
Interface_Name
=
US
(
Iface
)
then
Remote
.
Interface_Name
:=
FV_If
.
Name
;
end
if
;
end
loop
;
end
loop
;
end
loop
;
end
Rename_Required_Interface
;
procedure
Debug_Dump_IV
(
IV
:
Complete_Interface_View
)
is
procedure
Dump_Interface
(
Ind
:
String
:=
" "
;
I
:
Taste_Interface
)
is
...
...
src/interface_view.ads
View file @
41dfc1ad
...
...
@@ -9,7 +9,6 @@ with Ocarina,
Ocarina
.
Backends
.
Properties
,
Ada
.
Containers
.
Indefinite_Ordered_Maps
,
Ada
.
Containers
.
Indefinite_Vectors
,
-- Ocarina.ME_AADL.AADL_Tree.Nodes,
Ada
.
Strings
.
Unbounded
,
Option_Type
,
Parser_Utils
;
...
...
@@ -17,7 +16,6 @@ with Ocarina,
use
Ocarina
,
Ocarina
.
Types
,
Ocarina
.
Backends
.
Properties
,
-- Ocarina.ME_AADL.AADL_Tree.Nodes,
Ada
.
Containers
,
Ada
.
Strings
.
Unbounded
,
Parser_Utils
;
...
...
@@ -171,6 +169,16 @@ package Interface_View is
procedure
Rename_Function
(
IV
:
in
out
Complete_Interface_View
;
From
,
To
:
String
);
procedure
Rename_Provided_Interface
(
IV
:
in
out
Complete_Interface_View
;
Func
:
String
;
Iface
:
String
;
To
:
String
);
procedure
Rename_Required_Interface
(
IV
:
in
out
Complete_Interface_View
;
Func
:
String
;
Iface
:
String
;
To
:
String
);
procedure
Debug_Dump_IV
(
IV
:
Complete_Interface_View
);
end
Interface_View
;
src/parser_utils.adb
View file @
41dfc1ad
...
...
@@ -62,8 +62,6 @@ package body Parser_Utils is
Put_Line
(
"Dump model information"
);
Put
(
"-g, --debug"
&
HT
&
HT
&
HT
&
HT
);
Put_Line
(
"Generate runtime debug output"
);
Put
(
"-s, --stack <stack-value>"
&
HT
&
HT
);
Put_Line
(
"Set the size of the stack per thread in kbytes (default 50)"
);
Put
(
"-x, --timer <timer-resolution in ms>"
&
HT
);
Put_Line
(
"Set the timer resolution (default 100 ms)"
);
Put
(
"-v, --version"
&
HT
&
HT
&
HT
&
HT
);
...
...
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