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
e1061afa
Commit
e1061afa
authored
Jun 05, 2015
by
yoogx
Browse files
* Allow Exit_On_Error to raise an exception, required for the
Python bindings. For ticket #37
parent
8b83ae06
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/core/common_files/errors.adb
View file @
e1061afa
...
...
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-201
4
ESA & ISAE. --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-201
5
ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
...
...
@@ -39,6 +39,17 @@ with Ocarina.Namet; use Ocarina.Namet;
package
body
Errors
is
---------------------------
-- Use_Exception_To_Exit --
---------------------------
Use_Exception
:
Boolean
:=
True
;
procedure
Use_Exception_To_Exit
is
begin
Use_Exception
:=
True
;
end
Use_Exception_To_Exit
;
procedure
Internal_Display_Message
(
S
:
String
);
procedure
Check_Space
;
...
...
@@ -230,8 +241,12 @@ package body Errors is
begin
if
Error
then
Set_Standard_Error
;
Write_Line
(
Reason
);
OS_Exit
(
1
);
if
Use_Exception
then
raise
Ocarina_Error
with
Reason
;
else
Write_Line
(
Reason
);
OS_Exit
(
1
);
end
if
;
end
if
;
end
Exit_On_Error
;
...
...
src/core/common_files/errors.ads
View file @
e1061afa
...
...
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2012-201
4
ESA & ISAE. --
-- Copyright (C) 2012-201
5
ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
...
...
@@ -68,6 +68,14 @@ package Errors is
procedure
Display_Bug_Box
(
E
:
Ada
.
Exceptions
.
Exception_Occurrence
);
-- Error reporting
-- * by default, Exit_On_Error directly exists;
-- * if Use_Exception_To_Exit is called, Exit_On_Error raises the
-- Ocarina_Error exception
procedure
Use_Exception_To_Exit
;
Ocarina_Error
:
exception
;
procedure
Exit_On_Error
(
Error
:
Boolean
;
Reason
:
String
);
end
Errors
;
src/python/ocarina-python_cmd.adb
View file @
e1061afa
...
...
@@ -42,6 +42,7 @@ with Ocarina.Configuration; use Ocarina.Configuration;
with
GNATCOLL
.
VFS
;
use
GNATCOLL
.
VFS
;
with
Ocarina
.
Output
;
use
Ocarina
.
Output
;
with
Errors
;
with
Ocarina
.
Types
;
use
Ocarina
.
Types
;
with
Ocarina
.
Utils
;
use
Ocarina
.
Utils
;
with
Ocarina
.
Lmp
;
use
Ocarina
.
Lmp
;
...
...
@@ -697,6 +698,7 @@ package body Ocarina.Python_Cmd is
Default_AADL_Version
:=
Get_Default_AADL_Version
;
AADL_Version
:=
Ocarina
.
AADL_V2
;
Ocarina
.
Configuration
.
Init_Modules
;
Errors
.
Use_Exception_To_Exit
;
-- Initialize Python bindings
Repo
:=
Register_Scripts_And_Functions
;
...
...
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