Commit c4dec83f by Jose Ruiz Committed by Arnaud Charlet

osint.ads, osint.adb (Get_Libraries_From_Registry): Improve documentation.

2008-04-08  Jose Ruiz  <ruiz@adacore.com>

	* osint.ads, osint.adb (Get_Libraries_From_Registry): Improve
	documentation.
	Update comments.
	(Read_Default_Search_Dirs): Do not consider spaces as path separators
	because spaces may be part of legal paths.

From-SVN: r134043
parent 3f088c35
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -250,7 +250,11 @@ package body Osint is ...@@ -250,7 +250,11 @@ package body Osint is
-- --
-- HKEY_LOCAL_MACHINE\SOFTWARE\Ada Core Technologies\ -- HKEY_LOCAL_MACHINE\SOFTWARE\Ada Core Technologies\
-- GNAT\Standard Libraries -- GNAT\Standard Libraries
-- Return an empty string on other systems -- Return an empty string on other systems.
--
-- Note that this is an undocumented legacy feature, and that it
-- works only when using the default runtime library (i.e. no --RTS=
-- command line switch).
-------------------- --------------------
-- Add_Search_Dir -- -- Add_Search_Dir --
...@@ -1874,6 +1878,31 @@ package body Osint is ...@@ -1874,6 +1878,31 @@ package body Osint is
Res : String_Access; Res : String_Access;
begin begin
-- GNAAMP tool names require special treatment
if AAMP_On_Target then
-- The name "gcc" is mapped to "gnaamp" (the compiler driver)
if Nam = "gcc" then
return new String'("gnaamp");
-- Tool names starting with "gnat" are mapped by substituting the
-- string "gnaamp" for "gnat" (for example, "gnatpp" => "gnaamppp").
elsif Nam'Length >= 4
and then Nam (Nam'First .. Nam'First + 3) = "gnat"
then
return new String'("gnaamp" & Nam (Nam'First + 4 .. Nam'Last));
-- No other mapping rules, so we continue and handle any other forms
-- of tool names the same as on other targets.
else
null;
end if;
end if;
-- Get the name of the current program being executed -- Get the name of the current program being executed
Find_Program_Name; Find_Program_Name;
...@@ -1976,19 +2005,30 @@ package body Osint is ...@@ -1976,19 +2005,30 @@ package body Osint is
Curr := Curr + Actual_Len; Curr := Curr + Actual_Len;
end loop; end loop;
-- Process the file, translating line and file ending -- Process the file, dealing with path separators
-- control characters to a path separator character.
Prev_Was_Separator := True; Prev_Was_Separator := True;
Nb_Relative_Dir := 0; Nb_Relative_Dir := 0;
for J in 1 .. Len loop for J in 1 .. Len loop
if S (J) in ASCII.NUL .. ASCII.US or else S (J) = ' ' then
-- Treat any control character as a path separator. Note that we do
-- not treat space as a path separator (we used to treat space as a
-- path separator in an earlier version). That way space can appear
-- as a legitimate character in a path name.
-- Why do we treat all control characters as path separators???
if S (J) in ASCII.NUL .. ASCII.US then
S (J) := Path_Separator; S (J) := Path_Separator;
end if; end if;
-- Test for explicit path separator (or control char as above)
if S (J) = Path_Separator then if S (J) = Path_Separator then
Prev_Was_Separator := True; Prev_Was_Separator := True;
-- If not path separator, register use of relative directory
else else
if Prev_Was_Separator and then Is_Relative (S.all, J) then if Prev_Was_Separator and then Is_Relative (S.all, J) then
Nb_Relative_Dir := Nb_Relative_Dir + 1; Nb_Relative_Dir := Nb_Relative_Dir + 1;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2007, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -110,7 +110,9 @@ package Osint is ...@@ -110,7 +110,9 @@ package Osint is
-- cross compilation case, looks at the prefix of the current program being -- cross compilation case, looks at the prefix of the current program being
-- run and prepend it to Nam. For instance if the program being run is -- run and prepend it to Nam. For instance if the program being run is
-- <target>-gnatmake and Nam is "gcc", the returned value will be a pointer -- <target>-gnatmake and Nam is "gcc", the returned value will be a pointer
-- to "<target>-gcc". This function clobbers Name_Buffer and Name_Len. -- to "<target>-gcc". In the specific case where AAMP_On_Target is set, the
-- name "gcc" is mapped to "gnaamp", and names of the form "gnat*" are
-- mapped to "gnaamp*". This function clobbers Name_Buffer and Name_Len.
procedure Write_Program_Name; procedure Write_Program_Name;
-- Writes name of program as invoked to the current output -- Writes name of program as invoked to the current output
......
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