Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
Ocarina
Commits
07467d45
Commit
07467d45
authored
Dec 28, 2015
by
yoogx
Browse files
* Reorganize code: Python related stuff should remain in
Ocarina.Python_Cmd
parent
aed798db
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/python/ocarina-python_cmd.adb
View file @
07467d45
...
...
@@ -56,6 +56,61 @@ package body Ocarina.Python_Cmd is
package
ATNP
renames
Ocarina
.
ME_AADL
.
AADL_Tree
.
Nodes
.
Python
;
package
AINP
renames
Ocarina
.
ME_AADL
.
AADL_Instances
.
Nodes
.
Python
;
procedure
Get_Node_Id
(
Data
:
in
out
Callback_Data
'
Class
;
N
:
String
);
procedure
Get_Property_Value
(
Data
:
in
out
Callback_Data
'
Class
;
PropId
:
String
;
PropName
:
String
);
procedure
Get_Property_Value_By_Name
(
Data
:
in
out
Callback_Data
'
Class
;
PropId
:
String
;
PropName
:
String
);
------------------------
-- Get_Property_Value --
------------------------
procedure
Get_Property_Value
(
Data
:
in
out
Callback_Data
'
Class
;
PropId
:
String
;
PropName
:
String
)
is
Result
:
constant
String_List
:=
Ocarina
.
Backends
.
Properties
.
Utils
.
Check_And_Get_Property
(
Get_Node_Id_From_String
(
PropId
),
Get_Node_Id_From_String
(
PropName
));
begin
Set_Return_Value_As_List
(
Data
);
for
Elt
of
Result
loop
Set_Return_Value
(
Data
,
Elt
.
all
);
end
loop
;
end
Get_Property_Value
;
--------------------------------
-- Get_Property_Value_By_Name --
--------------------------------
procedure
Get_Property_Value_By_Name
(
Data
:
in
out
Callback_Data
'
Class
;
PropId
:
String
;
PropName
:
String
)
is
Result
:
constant
String_List
:=
Ocarina
.
Backends
.
Properties
.
Utils
.
Check_And_Get_Property
(
Get_Node_Id_From_String
(
PropId
),
Get_String_Name
(
PropName
));
begin
Set_Return_Value_As_List
(
Data
);
for
Elt
of
Result
loop
Set_Return_Value
(
Data
,
Elt
.
all
);
end
loop
;
end
Get_Property_Value_By_Name
;
-----------------
-- Get_Node_Id --
-----------------
procedure
Get_Node_Id
(
Data
:
in
out
Callback_Data
'
Class
;
N
:
String
)
is
begin
Set_Return_Value
(
Data
,
Integer
'
Image
(
Integer
(
Namet
.
Get_String_Name
(
N
))));
end
Get_Node_Id
;
--------------
-- On_Reset --
--------------
...
...
src/python/ocarina-utils.adb
View file @
07467d45
...
...
@@ -29,8 +29,6 @@
-- --
------------------------------------------------------------------------------
with
GNAT
.
OS_Lib
;
use
GNAT
.
OS_Lib
;
with
Errors
;
use
Errors
;
with
Locations
;
use
Locations
;
with
Ocarina
.
Namet
;
use
Ocarina
.
Namet
;
...
...
@@ -46,7 +44,6 @@ with Ocarina.Instances; use Ocarina.Instances;
with
Ocarina
.
Parser
;
use
Ocarina
.
Parser
;
with
Ocarina
.
Options
;
use
Ocarina
.
Options
;
with
Ocarina
.
Files
;
use
Ocarina
.
Files
;
with
Ocarina
.
Backends
.
Properties
.
Utils
;
package
body
Ocarina
.
Utils
is
...
...
@@ -181,55 +178,6 @@ package body Ocarina.Utils is
return
AADL_Root
;
end
Get_AADL_Root
;
------------------------
-- Get_Property_Value --
------------------------
procedure
Get_Property_Value
(
Data
:
in
out
Callback_Data
'
Class
;
PropId
:
String
;
PropName
:
String
)
is
Result
:
constant
String_List
:=
Ocarina
.
Backends
.
Properties
.
Utils
.
Check_And_Get_Property
(
Get_Node_Id_From_String
(
PropId
),
Get_Node_Id_From_String
(
PropName
));
begin
Set_Return_Value_As_List
(
Data
);
for
Elt
of
Result
loop
Set_Return_Value
(
Data
,
Elt
.
all
);
end
loop
;
end
Get_Property_Value
;
--------------------------------
-- Get_Property_Value_By_Name --
--------------------------------
procedure
Get_Property_Value_By_Name
(
Data
:
in
out
Callback_Data
'
Class
;
PropId
:
String
;
PropName
:
String
)
is
Result
:
constant
String_List
:=
Ocarina
.
Backends
.
Properties
.
Utils
.
Check_And_Get_Property
(
Get_Node_Id_From_String
(
PropId
),
Get_String_Name
(
PropName
));
begin
Set_Return_Value_As_List
(
Data
);
for
Elt
of
Result
loop
Set_Return_Value
(
Data
,
Elt
.
all
);
end
loop
;
end
Get_Property_Value_By_Name
;
-----------------
-- Get_Node_Id --
-----------------
procedure
Get_Node_Id
(
Data
:
in
out
Callback_Data
'
Class
;
N
:
String
)
is
begin
Set_Return_Value
(
Data
,
Integer
'
Image
(
Integer
(
Namet
.
Get_String_Name
(
N
))));
end
Get_Node_Id
;
-----------------------------
-- Get_Node_Id_From_String --
-----------------------------
...
...
src/python/ocarina-utils.ads
View file @
07467d45
...
...
@@ -29,11 +29,7 @@
-- --
------------------------------------------------------------------------------
pragma
Warnings
(
Off
);
with
Ocarina
.
Types
;
use
Ocarina
.
Types
;
with
GNATCOLL
.
Scripts
;
use
GNATCOLL
.
Scripts
;
with
Ocarina
.
ME_AADL
;
with
Ocarina
.
ME_AADL
.
AADL_Tree
.
Nodes
;
package
Ocarina
.
Utils
is
...
...
@@ -55,10 +51,4 @@ package Ocarina.Utils is
function
Get_Int_From_String
(
Name
:
String
)
return
Int
;
function
Get_Value_Id_From_String
(
Name
:
String
)
return
Value_Id
;
procedure
Get_Node_Id
(
Data
:
in
out
Callback_Data
'
Class
;
N
:
String
);
procedure
Get_Property_Value
(
Data
:
in
out
Callback_Data
'
Class
;
PropId
:
String
;
PropName
:
String
);
procedure
Get_Property_Value_By_Name
(
Data
:
in
out
Callback_Data
'
Class
;
PropId
:
String
;
PropName
:
String
);
end
Ocarina
.
Utils
;
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