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
27751aae
Commit
27751aae
authored
Apr 29, 2014
by
yoogx
Browse files
* Add reset() method to reinitialize Ocarina Python bindings
parent
1d1f5093
Changes
4
Hide whitespace changes
Inline
Side-by-side
resources/runtime/python/ocarina.py
View file @
27751aae
...
...
@@ -25,6 +25,11 @@ def status ():
'''Print Ocarina status'''
libocarina_python
.
status
();
################################################################################
def
reset
():
'''Reset Ocarina'''
libocarina_python
.
reset
();
################################################################################
def
load
(
filename
):
'''Load a file
...
...
src/python/ocarina-python_cmd.adb
View file @
27751aae
...
...
@@ -34,11 +34,26 @@
with
GNATCOLL
.
Scripts
;
use
GNATCOLL
.
Scripts
;
with
GNATCOLL
.
Scripts
.
Python
;
use
GNATCOLL
.
Scripts
.
Python
;
with
Ocarina
.
Configuration
;
use
Ocarina
.
Configuration
;
with
Ocarina
.
Configuration
;
use
Ocarina
.
Configuration
;
with
Ocarina
.
Utils
;
package
body
Ocarina
.
Python_Cmd
is
--------------
-- On_Reset --
--------------
procedure
On_Reset
(
Data
:
in
out
Callback_Data
'
Class
;
Command
:
String
);
procedure
On_Reset
(
Data
:
in
out
Callback_Data
'
Class
;
Command
:
String
)
is
pragma
Unreferenced
(
Data
,
Command
);
begin
Ocarina
.
Utils
.
Reset
;
end
On_Reset
;
----------------
-- On_Version --
----------------
...
...
@@ -151,6 +166,10 @@ package body Ocarina.Python_Cmd is
-- Register our custom functions
-- reset() function
Register_Command
(
Repo
,
"reset"
,
0
,
0
,
Handler
=>
On_Reset
'
Unrestricted_Access
);
-- version() function
Register_Command
(
Repo
,
"version"
,
0
,
0
,
Handler
=>
On_Version
'
Unrestricted_Access
);
...
...
src/python/ocarina-utils.adb
View file @
27751aae
...
...
@@ -56,9 +56,34 @@ with Ocarina.Files; use Ocarina.Files;
package
body
Ocarina
.
Utils
is
AADL_Root
:
Node_Id
:=
No_Node
;
File_Name
:
Name_Id
;
File_Name
:
Name_Id
:=
No_Name
;
Buffer
:
Location
;
Language
:
Name_Id
;
Language
:
Name_Id
:=
No_Name
;
-----------
-- Reset --
-----------
procedure
Reset
is
begin
-- Reset Ocarina
Ocarina
.
Configuration
.
Reset_Modules
;
Ocarina
.
Reset
;
-- Initialize Ocarina
Ocarina
.
AADL_Version
:=
Get_Default_AADL_Version
;
AADL_Version
:=
Ocarina
.
AADL_V2
;
Ocarina
.
Initialize
;
Ocarina
.
Configuration
.
Init_Modules
;
-- Reset library
AADL_Root
:=
No_Node
;
File_Name
:=
No_Name
;
Language
:=
No_Name
;
end
Reset
;
-------------
-- Version --
...
...
src/python/ocarina-utils.ads
View file @
27751aae
...
...
@@ -46,5 +46,6 @@ package Ocarina.Utils is
procedure
Analyze
;
procedure
Instantiate
(
Root_System
:
String
);
procedure
Generate
(
Backend_Name
:
String
);
procedure
Reset
;
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