Files
Thomas Quinot e429306671 Move in supporting files for new version of IAC from import directory.
For FC19-007

Subversion-branch: /trunk/polyorb
Subversion-revision: 41322
2006-12-19 11:24:07 +00:00

82 lines
1.8 KiB
Ada

with Charset; use Charset;
with Namet; use Namet;
package body Utils is
Up_To_Low : constant := Character'Pos ('A') - Character'Pos ('a');
----------------
-- Capitalize --
----------------
procedure Capitalize (S : in out String) is
Up : Boolean := True;
begin
for I in S'Range loop
if Up then
Up := False;
if S (I) in 'a' .. 'z' then
S (I) := Character'Val (Character'Pos (S (I)) + Up_To_Low);
end if;
end if;
if S (I) = '_' then
Up := True;
end if;
end loop;
end Capitalize;
------------
-- Quoted --
------------
function Quoted (S : String; D : Character := '"') return String is -- "
begin
return (1 => D) & S & (1 => D);
end Quoted;
------------
-- Quoted --
------------
function Quoted (S : String; D : Character := '"') return Name_Id is -- "
begin
Set_Char_To_Name_Buffer (D);
Add_Str_To_Name_Buffer (S);
Add_Char_To_Name_Buffer (D);
return Name_Find;
end Quoted;
------------
-- Quoted --
------------
function Quoted (N : Name_Id; D : Character := '"') return String is -- "
begin
return Quoted (Get_Name_String (N), D);
end Quoted;
------------
-- Quoted --
------------
function Quoted (N : Name_Id; D : Character := '"') return Name_Id is -- "
begin
return Quoted (Get_Name_String (N), D);
end Quoted;
--------------
-- To_Lower --
--------------
function To_Lower (N : Name_Id) return Name_Id is
begin
if N = No_Name then
return No_Name;
end if;
Get_Name_String (N);
To_Lower (Name_Buffer (1 .. Name_Len));
return Name_Find;
end To_Lower;
end Utils;