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
d06e0e9f
Commit
d06e0e9f
authored
Jan 24, 2018
by
Maxime Perrotin
Browse files
Add Put_Info and Put_Error with colors
parent
e27fb2ef
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/taste-aadl_parser.adb
View file @
d06e0e9f
...
...
@@ -166,22 +166,18 @@ package body TASTE.AADL_Parser is
|
No_RCM_Error
|
Deployment_View_Error
|
Data_View_Error
|
TASTE
.
Backend
.
Skeletons
.
Skeleton_Error
|
Device_Driver_Error
=>
Put
(
Red_Bold
&
"[ERROR] "
&
White_Bold
);
Put_Line
(
Exception_Message
(
Error
)
&
No_Color
);
Put_Error
(
Exception_Message
(
Error
));
raise
Quit_Taste
;
when
GNAT
.
Command_Line
.
Exit_From_Command_Line
=>
New_Line
;
Put
(
Yellow_Bold
&
"[INFO] "
&
No_Color
);
Put
(
"For more information, visit "
&
Underline
&
White_Bold
);
Put_Line
(
"https://taste.tools"
&
No_Color
);
Put_Info
(
"For more information, visit "
&
Underline
&
White_Bold
&
"https://taste.tools"
);
raise
Quit_Taste
;
when
GNAT
.
Command_Line
.
Invalid_Switch
|
GNAT
.
Command_Line
.
Invalid_Parameter
|
GNAT
.
Command_Line
.
Invalid_Section
=>
Put
(
Red_Bold
&
"[ERROR] "
&
White_Bold
);
Put_Line
(
"Invalid switch or parameter (try --help)"
&
No_Color
);
Put_Error
(
"Invalid switch or parameter (try --help)"
&
No_Color
);
raise
Quit_Taste
;
when
E
:
others
=>
Errors
.
Display_Bug_Box
(
E
);
...
...
@@ -190,15 +186,15 @@ package body TASTE.AADL_Parser is
procedure
Dump
(
Model
:
TASTE_Model
)
is
begin
Put_
Line
(
"==== Dump of the Interface View ===="
);
Put_
Info
(
"==== Dump of the Interface View ===="
);
Model
.
Interface_View
.
Debug_Dump
;
if
Model
.
Configuration
.
Deployment_View
.
all
'
Length
>
0
then
Put_
Line
(
"==== Dump of the Deployment View ===="
);
Put_
Info
(
"==== Dump of the Deployment View ===="
);
Model
.
Deployment_View
.
Debug_Dump
;
end
if
;
Put_
Line
(
"==== Dump of the Data View ===="
);
Put_
Info
(
"==== Dump of the Data View ===="
);
Model
.
Data_View
.
Debug_Dump
;
Put_
Line
(
"==== Dump of the Command Line ===="
);
Put_
Info
(
"==== Dump of the Command Line ===="
);
Model
.
Configuration
.
Debug_Dump
;
end
Dump
;
...
...
@@ -210,6 +206,12 @@ package body TASTE.AADL_Parser is
procedure
Generate_Skeletons
(
Model
:
TASTE_Model
)
is
begin
TASTE
.
Backend
.
Skeletons
.
Generate
(
Model
);
exception
when
Error
:
TASTE
.
Backend
.
Skeletons
.
Skeleton_Error
=>
Put_Error
(
Exception_Message
(
Error
));
raise
Quit_Taste
;
when
E
:
others
=>
Errors
.
Display_Bug_Box
(
E
);
raise
Quit_Taste
;
end
Generate_Skeletons
;
end
TASTE
.
AADL_Parser
;
src/taste-backend-build_script.adb
View file @
d06e0e9f
with
Text_IO
,
Templates_Parser
;
Templates_Parser
,
TASTE
.
Parser_Utils
;
use
Text_IO
,
Templates_Parser
;
Templates_Parser
,
TASTE
.
Parser_Utils
;
package
body
TASTE
.
Backend
.
Build_Script
is
procedure
Generate
(
Model
:
TASTE_Model
)
is
...
...
@@ -34,7 +36,7 @@ package body TASTE.Backend.Build_Script is
end
if
;
end
;
end
loop
;
Put_
Line
(
"====
Generating build script
====
"
);
Put_
Info
(
"
Generating build script"
);
declare
Template_Data
:
constant
Translate_Table
:=
(
1
=>
Assoc
(
"Interface_View_Path"
,
...
...
src/taste-backend-skeletons.adb
View file @
d06e0e9f
...
...
@@ -2,11 +2,13 @@ with Text_IO; use Text_IO;
with
Ada
.
Strings
.
Unbounded
,
Ada
.
Characters
.
Handling
,
Ada
.
Exceptions
,
Ada
.
Directories
;
Ada
.
Directories
,
TASTE
.
Parser_Utils
;
use
Ada
.
Characters
.
Handling
,
Ada
.
Exceptions
,
Ada
.
Directories
;
Ada
.
Directories
,
TASTE
.
Parser_Utils
;
-- This package covers the generation of skeletons for all supported languages
-- There is no code that is specific to one particular language. The package
...
...
@@ -70,7 +72,7 @@ package body TASTE.Backend.Skeletons is
return
Interfaces_Tag
;
end
Process_Interfaces
;
begin
Put_
Line
(
"=== Generate skeletons ==="
);
Put_
Info
(
"=== Generate skeletons ==="
);
for
Each
of
Model
.
Interface_View
.
Flat_Functions
loop
declare
Language
:
constant
String
:=
Language_Spelling
(
Each
);
...
...
@@ -122,25 +124,28 @@ package body TASTE.Backend.Skeletons is
if
Proceed
then
-- Create directory tree (output/function/language/src)
Create_Path
(
Output_Src
);
Put_
Line
(
"***
Generating "
&
Header_File
);
Put_
Info
(
"
Generating "
&
Header_File
);
Create
(
File
=>
Output
,
Mode
=>
Out_File
,
Name
=>
Output_Src
&
Header_File
);
Put_Line
(
Output
,
Header_Text
);
Close
(
Output
);
if
not
Exists
(
Output_Src
&
Body_File
)
then
Put_
Line
(
"***
Generating "
&
Body_File
);
Put_
Info
(
"
Generating "
&
Body_File
);
Create
(
File
=>
Output
,
Mode
=>
Out_File
,
Name
=>
Output_Src
&
Body_File
);
Put_Line
(
Output
,
Body_Text
);
Close
(
Output
);
else
Put_Info
(
Body_File
&
" already exists, ignoring"
);
end
if
;
else
Put_
Line
(
"Ignoring function "
&
To_String
(
Each
.
Name
));
Put_
Info
(
"Ignoring function "
&
To_String
(
Each
.
Name
));
end
if
;
exception
when
E
:
End_Error
=>
when
E
:
End_Error
|
Text_IO
.
Use_Error
=>
if
Is_Open
(
Output
)
then
Close
(
Output
);
end
if
;
...
...
src/taste-parser_utils.adb
View file @
d06e0e9f
...
...
@@ -23,6 +23,16 @@ package body TASTE.Parser_Utils is
Ocarina
.
Instances
.
Queries
,
Ocarina
.
ME_AADL
;
procedure
Put_Info
(
Info
:
String
)
is
begin
Put_Line
(
Yellow_Bold
&
"[INFO] "
&
No_Color
&
Info
&
No_Color
);
end
Put_Info
;
procedure
Put_Error
(
Error
:
String
)
is
begin
Put_Line
(
Red_Bold
&
"[ERROR] "
&
White_Bold
&
Error
&
No_Color
);
end
Put_Error
;
procedure
Banner
is
The_Banner
:
constant
String
:=
Yellow_Bold
&
"TASTE AADL Parser"
&
No_Color
&
" (Version "
...
...
src/taste-parser_utils.ads
View file @
d06e0e9f
...
...
@@ -51,6 +51,9 @@ package TASTE.Parser_Utils is
(
if
Is_Tty
then
ASCII
.
ESC
&
"[4m"
else
""
);
function
White_Bold
return
String
is
(
if
Is_Tty
then
White
&
Bold
else
""
);
procedure
Put_Info
(
Info
:
String
);
procedure
Put_Error
(
Error
:
String
);
procedure
Banner
;
AADL_Parser_Error
:
exception
;
...
...
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