Commit e3b74852 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Handle taste-types.asn better

parent ef0e69b2
......@@ -5,6 +5,7 @@
-- Interface View parser
with Ada.Directories,
GNAT.Directory_Operations,
Ocarina.Instances.Queries,
Ocarina.Analyzer,
Ocarina.Backends.Properties,
......@@ -16,7 +17,8 @@ with Ada.Directories,
package body TASTE.Data_View is
use Ocarina.Instances.Queries,
use GNAT.Directory_Operations,
Ocarina.Instances.Queries,
Ocarina.Namet,
Ocarina.Backends.Properties,
Ocarina.Options,
......@@ -79,8 +81,11 @@ package body TASTE.Data_View is
Get_String_Name ("taste::ada_package_name")));
ACN_Ref : constant Node_Id := Get_Classifier_Property
(Asntype, "taste::encodingdefinitionfile");
Filename : constant String := Get_Name_String
Raw_Name : constant String := Get_Name_String
(Get_Source_Text (Asntype) (1));
Filename : constant String :=
(if Base_Name (Raw_Name) = "taste-types.asn"
then "taste-types.asn" else Raw_Name);
File_Ref : constant ASN1_File_Maps.Cursor := Files.Find (Filename);
begin
-- If there are ACN files, add them to the list
......@@ -113,7 +118,10 @@ package body TASTE.Data_View is
begin
New_Module.Name := US (Module);
New_Module.Types := (Empty_Vector & Sort);
if Filename (Filename'First) /= '/' then
if Filename = "taste-types.asn" then
Relative_Path := US ("${TOOL_INST}"
& "/share/taste-types/taste-types.asn");
elsif Filename (Filename'First) /= '/' then
Relative_Path := "../" & Relative_Path;
end if;
New_File.Path := Relative_Path;
......@@ -147,12 +155,15 @@ package body TASTE.Data_View is
-- 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.
-- Ignore taste-types.asn, because it is provided by taste and its actual
-- location depends on the current installation path (user name)
procedure Check_Files (DV : Taste_Data_View) is
Success : Boolean := True;
begin
for Idx in DV.ASN1_Files.Iterate loop
-- The Key of the map contains the path as found in the dataview
if not Ada.Directories.Exists (ASN1_File_Maps.Key (Idx))
and ASN1_File_Maps.Key (Idx) /= "taste-types.asn"
then
Put_Error ("ASN.1 File not found: " & ASN1_File_Maps.Key (Idx));
Success := False;
......@@ -184,10 +195,12 @@ package body TASTE.Data_View is
procedure Export_ASN1_Files (DV : Taste_Data_View; Output_Path : String) is
begin
for Idx in DV.ASN1_Files.Iterate loop
Ada.Directories.Copy_File
(Source_Name => ASN1_File_Maps.Key (Idx),
Target_Name => Output_Path
& Ada.Directories.Simple_Name (ASN1_File_Maps.Key (Idx)));
if ASN1_File_Maps.Key (Idx) /= "taste-types.asn" then
Ada.Directories.Copy_File
(Source_Name => ASN1_File_Maps.Key (Idx),
Target_Name => Output_Path
& Ada.Directories.Simple_Name (ASN1_File_Maps.Key (Idx)));
end if;
end loop;
end Export_ASN1_Files;
end TASTE.Data_View;
......@@ -6,6 +6,7 @@
@@--
# MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
MAKEFILE_PATH := $(lastword $(MAKEFILE_LIST))
TOOL_INST := $(shell taste-config --prefix)
OUTDIR := $(dir $(MAKEFILE_PATH))
ASN1_FILES := @_REPLACE_ALL(,/):ASN1_Files_@
CP_FILES := @_REPLACE_ALL(,/):CP_Files_@ # Context parameters
......@@ -149,8 +150,8 @@ dataview/C/built: ${DATAVIEW_UNIQ} ${DATAVIEW_ACN} ${CP_FILES}
# asn2dataModel does not take the ACN files, and only calls asn1.exe
# asn2dataModel -o $(dir $@) -toC ${DATAVIEW_UNIQ} ${DATAVIEW_ACN}
mono $(shell which asn1.exe) -typePrefix asn1Scc -equal -fp AUTO -o $(dir $@) -c -uPER -ACN $^
cp $(shell taste-config --prefix)/share/AutoGUI/debug_messages.? dataview/C
cp $(shell taste-config --prefix)/share/AutoGUI/timeInMS.? dataview/C
cp ${TOOL_INST}/share/AutoGUI/debug_messages.? dataview/C
cp ${TOOL_INST}/share/AutoGUI/timeInMS.? dataview/C
cd dataview/C && msgPrinter ../dataview-uniq.asn
cd dataview/C && msgPrinterASN1 ../dataview-uniq.asn
touch $@
......@@ -193,15 +194,15 @@ dataview/C/built: ${DATAVIEW_UNIQ} ${DATAVIEW_ACN} ${CP_FILES}
@@-- If system contains the PeekPoke component, copy the relevant code in the gui folder
@@IF@@ @_LOWER:Function_Names_@ = taste_probe_console
@# Peek-Poke function is placed in the gui folder
cp $(shell taste-config --prefix)/bin/taste-gnuplot-streams binaries/@_LOWER:Function_Names_@_GUI/driveGnuPlotsStreams.pl
cp $(shell taste-config --prefix)/share/peekpoke/peekpoke.py binaries/@_LOWER:Function_Names_@_GUI
cp $(shell taste-config --prefix)/share/peekpoke/PeekPoke.glade binaries/@_LOWER:Function_Names_@_GUI
cp ${TOOL_INST}/bin/taste-gnuplot-streams binaries/@_LOWER:Function_Names_@_GUI/driveGnuPlotsStreams.pl
cp ${TOOL_INST}/share/peekpoke/peekpoke.py binaries/@_LOWER:Function_Names_@_GUI
cp ${TOOL_INST}/share/peekpoke/PeekPoke.glade binaries/@_LOWER:Function_Names_@_GUI
@@END_IF@@ @@-- End of PeekPoke-specifics
@@-- Add symbolic link to the SQL Database interface for the GUIs, if needed
if [ -f sql_db/db.info ]; then cd binaries/@_LOWER:Function_Names_@_GUI && ln -fs ../../sql_db; fi
@@-- Copy default UserWidgets.py file for user to customise the GUI widgets
# User can edit at will the customisable user widgets python module:
cp -u $(shell taste-config --prefix)/share/AutoGUI/UserWidgets.py binaries/@_LOWER:Function_Names_@_GUI
cp -u ${TOOL_INST}/share/AutoGUI/UserWidgets.py binaries/@_LOWER:Function_Names_@_GUI
@@-- Copy InterfaceView.aadl, it is needed to replay MSC scenarios
# Interface view must be placed in the gui folder to allow replaying MSCs
cp -u ../InterfaceView.aadl binaries/@_LOWER:Function_Names_@_GUI
......
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