Commit 25076bd9 authored by Maxime Perrotin's avatar Maxime Perrotin

Make sure kazoo is found in the path

parent 71f2c2a1
......@@ -41,7 +41,8 @@ endif
install:
$(MAKE)
cp kazoo `ocarina-config --prefix`/bin/
mkdir -p `ocarina-config --prefix`/share/kazoo
cp -a templates kazoo `ocarina-config --prefix`/share/kazoo
edit:
OCARINA_PATH=`ocarina-config --prefix` gps
......
......@@ -175,6 +175,7 @@ package body TASTE.Concurrency_View is
All_Thread_Names : Tag; -- Complete list of threads
All_Target_Names : Tag; -- List of all targets used (AADL packages)
begin
Put_Debug ("Concurrency View templates expected in " & Prefix);
Start_Search (Search => ST,
Pattern => "",
Directory => Prefix,
......@@ -636,10 +637,6 @@ package body TASTE.Concurrency_View is
procedure Generate_CV (CV : Taste_Concurrency_View) is
begin
-- In this first iteration Nodes are generated in standalone files,
-- and they include their processes. It would be useful to be able
-- to decide if processes could also have their own files, since
-- in the future they may be more than one process per node (for TSP).
CV.Generate_Code;
exception
when Error : Concurrency_View_Error | Ada.IO_Exceptions.Name_Error =>
......
......@@ -51,6 +51,7 @@ package body TASTE.Dump is
-- Tags that are built over the whole system
-- and cleant up between each template folder:
begin
Put_Debug ("Folder with Dump templates: " & Prefix);
Start_Search (Search => ST,
Pattern => "",
Directory => Prefix,
......
......@@ -6,6 +6,9 @@ with Ada.Characters.Latin_1,
Ada.Strings.Maps,
Ada.Strings.Fixed,
Ada.Strings,
Ada.Directories,
Ada.Command_Line,
Ada.Environment_Variables,
GNAT.OS_Lib,
GNAT.Strings,
GNAT.Command_Line,
......@@ -66,11 +69,47 @@ package body TASTE.Parser_Utils is
procedure Parse_Command_Line (Result : out Taste_Configuration) is
Config : Command_Line_Configuration;
Version : aliased Boolean := False;
Command : constant String := Ada.Command_Line.Command_Name;
use String_Holders;
IV, DeplV, DataV, OutDir : aliased GNAT.Strings.String_Access := null;
begin
Result.Binary_Path := To_Holder (Get_Program_Directory);
-- Retrieve the path of the kazoo binary, to have a base prefix
-- to find the templates folder
if Command /= "kazoo" then
-- Command used a explicit path to call kazoo - use it
Result.Binary_Path := To_Holder (Get_Program_Directory);
else
-- We must find kazoo in the PATH
-- This will work only on Linux because the PATH separator is ":"
-- while on Windows it is ";"
declare
Path : constant String := Ada.Environment_Variables.Value ("PATH");
Nb : constant Natural := Ada.Strings.Fixed.Count (Path, ":");
From : Natural := Path'First;
To : Natural;
begin
if Nb = 0 then
To := Path'Last;
end if;
for I in 0 .. Nb loop
To := Ada.Strings.Fixed.Index (Path, ":", From => From);
if To = 0 then
To := Path'Last + 1;
end if;
if Ada.Directories.Exists
(Path (From .. To - 1) & "/" & "kazoo")
then
-- Found the folder containing the kazoo binary
Result.Binary_Path := To_Holder
(Path (From .. To - 1) & "/");
exit;
end if;
From := To + 1;
end loop;
end;
end if;
Define_Switch (Config, Output => IV'Access,
Switch => "-i:",
Long_Switch => "--interfaceview=",
......
Markdown is supported
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