Commit 6c9a4567 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add checking function for ASN.1 file presence

parent 690de90d
......@@ -151,6 +151,7 @@ package body TASTE.AADL_Parser is
if Result.Configuration.Data_View.all'Length > 0 then
Result.Data_View := Parse_Data_View (Dataview_root);
when Constraint_Error =>
raise Data_View_Error with "Update your data view!";
......@@ -4,7 +4,8 @@
-- Interface View parser
with Locations,
with Ada.Directories,
......@@ -119,6 +120,25 @@ package body TASTE.Data_View is
return Data_AST : constant Taste_Data_View := (ASN1_Files => Files);
end Parse_Data_View;
-- Function checking the actual file presence of the ASN.1 models that
-- are referenced in the input file DataView.aadl. Raise an exception
-- if any file is missing.
procedure Check_Files (DV : Taste_Data_View) is
Success : Boolean := True;
for Each of DV.ASN1_Files loop
if not Ada.Directories.Exists (To_String (Each.Path)) then
Put_Error ("File not found: " & To_String (Each.Path));
Success := False;
end if;
end loop;
if not Success then
raise Data_View_Error with
"ASN.1 files missing (wrong path in DataView.aadl). "
& "Run taste-update-data-view [list of ASN.1 files]";
end if;
end Check_Files;
procedure Debug_Dump (DV : Taste_Data_View; Output : File_Type) is
for Each of DV.ASN1_Files loop
......@@ -60,6 +60,8 @@ package TASTE.Data_View is
function Parse_Data_View (Dataview_Root : Node_Id) return Taste_Data_View
with Pre => Dataview_Root /= No_Node;
procedure Check_Files (DV : Taste_Data_View);
procedure Debug_Dump (DV : Taste_Data_View; Output : File_Type);
end TASTE.Data_View;
package TASTE.Parser_Version is
Parser_Release : constant String :=
"c7a88bb ; Commit Date: Mon Mar 12 21:34:55 2018 ";
"690de90 ; Commit Date: Mon Mar 12 21:50:07 2018 ";
Ocarina_Version : constant String :=
"Ocarina 2017.x (Working Copy from rc50d394)";
"Ocarina 2017.x (Working Copy from r61c0f39)";
end TASTE.Parser_Version;
\ No newline at end of file
......@@ -2,11 +2,11 @@ AADL_PARSER=../../aadl_parser
all: test-parse
test-parse: clean
$(AADL_PARSER) -o output -i InterfaceView.aadl -d DataView.aadl ../common/TASTE_IV_Properties.aadl
rm -rf obj $(exec) *~
rm -rf output
.PHONY: clean test-parse
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment