Commit 64dfccae by Arnaud Charlet

[multiple changes]

2015-10-26  Emmanuel Briot  <briot@adacore.com>

	* s-os_lib.adb (Argument_String_To_List): Remove backslashes in
	argument value.

2015-10-26  Javier Miranda  <miranda@adacore.com>

	* exp_unst.ads, exp_unst.adb (Is_Uplevel_Referenced): Removed.

From-SVN: r229361
parent a9658b11
2015-10-26 Emmanuel Briot <briot@adacore.com>
* s-os_lib.adb (Argument_String_To_List): Remove backslashes in
argument value.
2015-10-26 Javier Miranda <miranda@adacore.com>
* exp_unst.ads, exp_unst.adb (Is_Uplevel_Referenced): Removed.
2015-10-26 Hristian Kirtchev <kirtchev@adacore.com>
* exp_util.adb, sem_aux.adb, exp_attr.adb, sem_eval.adb: Minor
......
......@@ -119,21 +119,6 @@ package body Exp_Unst is
Table_Increment => 200,
Table_Name => "Unnest_Urefs");
---------------------------
-- Is_Uplevel_Referenced --
---------------------------
function Is_Uplevel_Referenced (E : Entity_Id) return Boolean is
begin
for J in Urefs.First .. Urefs.Last loop
if Urefs.Table (J).Ent = E then
return True;
end if;
end loop;
return False;
end Is_Uplevel_Referenced;
-----------------------
-- Unnest_Subprogram --
-----------------------
......
......@@ -686,7 +686,4 @@ package Exp_Unst is
-- adds the ARECP parameter to all nested subprograms which need it, and
-- modifies all uplevel references appropriately.
function Is_Uplevel_Referenced (E : Entity_Id) return Boolean;
-- Determines if E has some uplevel reference from a nested subprogram
end Exp_Unst;
......@@ -189,6 +189,12 @@ package body System.OS_Lib is
New_Argc : Natural := 0;
Idx : Integer;
Cleaned : String (1 .. Arg_String'Length);
Cleaned_Idx : Natural;
-- A cleaned up version of the argument. This function is taking
-- backslash escapes when computing the bounds for arguments. It is
-- then removing the extra backslashes from the argument.
begin
Idx := Arg_String'First;
......@@ -198,10 +204,9 @@ package body System.OS_Lib is
declare
Quoted : Boolean := False;
Backqd : Boolean := False;
Old_Idx : Integer;
begin
Old_Idx := Idx;
Cleaned_Idx := Cleaned'First;
loop
-- An unquoted space is the end of an argument
......@@ -217,25 +222,34 @@ package body System.OS_Lib is
and then Arg_String (Idx) = '"'
then
Quoted := True;
Cleaned (Cleaned_Idx) := Arg_String (Idx);
Cleaned_Idx := Cleaned_Idx + 1;
-- End of a quoted string and end of an argument
elsif (Quoted and not Backqd)
and then Arg_String (Idx) = '"'
then
Cleaned (Cleaned_Idx) := Arg_String (Idx);
Cleaned_Idx := Cleaned_Idx + 1;
Idx := Idx + 1;
exit;
-- Following character is backquoted
elsif Arg_String (Idx) = '\' then
Backqd := True;
-- Turn off backquoting after advancing one character
elsif Backqd then
Backqd := False;
Cleaned (Cleaned_Idx) := Arg_String (Idx);
Cleaned_Idx := Cleaned_Idx + 1;
-- Following character is backquoted
elsif Arg_String (Idx) = '\' then
Backqd := True;
else
Cleaned (Cleaned_Idx) := Arg_String (Idx);
Cleaned_Idx := Cleaned_Idx + 1;
end if;
Idx := Idx + 1;
......@@ -246,7 +260,7 @@ package body System.OS_Lib is
New_Argc := New_Argc + 1;
New_Argv (New_Argc) :=
new String'(Arg_String (Old_Idx .. Idx - 1));
new String'(Cleaned (Cleaned'First .. Cleaned_Idx - 1));
-- Skip extraneous spaces
......
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