Commit ebeccbff authored by julien.delange's avatar julien.delange
Browse files

* add replace_char function to be compliant with ASN1 requirements



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@683 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent c4d9a0f3
...@@ -274,6 +274,8 @@ package body Ocarina.Backends.ASN1.Deployment is ...@@ -274,6 +274,8 @@ package body Ocarina.Backends.ASN1.Deployment is
Port_Name := Name_Find; Port_Name := Name_Find;
Port_Name := To_Upper (Port_Name); Port_Name := To_Upper (Port_Name);
Port_Name := Replace_Char (Port_Name, '_', '-');
Append_Node_To_List Append_Node_To_List
(Make_Enumerated_Value (Make_Enumerated_Value
(Port_Name, Port_Id), (Port_Name, Port_Id),
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2007-2009, GET-Telecom Paris. -- -- Copyright (C) 2007-2010, GET-Telecom Paris. --
-- -- -- --
-- Ocarina is free software; you can redistribute it and/or modify -- -- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the -- -- it under terms of the GNU General Public License as published by the --
...@@ -178,6 +178,31 @@ package body Utils is ...@@ -178,6 +178,31 @@ package body Utils is
return Quoted (Get_Name_String (N), D); return Quoted (Get_Name_String (N), D);
end Quoted; end Quoted;
------------------
-- Replace_Char --
------------------
function Replace_Char (Name : Name_Id; O : Character; N : Character)
return Name_Id is
pragma Unreferenced (O);
pragma Unreferenced (N);
Len : Natural;
New_Name : Name_Id := No_Name;
begin
Get_Name_String (Name);
Len := Name_Len;
declare
New_Str : String (1 .. Len);
begin
for I in 1 .. Len loop
New_Str (I) := Name_Buffer (I);
end loop;
New_Name := Get_String_Name (New_Str);
end;
return New_Name;
end Replace_Char;
-------------- --------------
-- To_Lower -- -- To_Lower --
-------------- --------------
...@@ -236,5 +261,4 @@ package body Utils is ...@@ -236,5 +261,4 @@ package body Utils is
return True; return True;
end Is_Prefix; end Is_Prefix;
end Utils; end Utils;
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2007-2009, GET-Telecom Paris. -- -- Copyright (C) 2007-2010, GET-Telecom Paris. --
-- -- -- --
-- Ocarina is free software; you can redistribute it and/or modify -- -- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the -- -- it under terms of the GNU General Public License as published by the --
...@@ -74,6 +74,10 @@ package Utils is ...@@ -74,6 +74,10 @@ package Utils is
function To_Lower (N : Name_Id) return Name_Id; function To_Lower (N : Name_Id) return Name_Id;
function To_Upper (N : Name_Id) return Name_Id; function To_Upper (N : Name_Id) return Name_Id;
function Replace_Char (Name : Name_Id; O : Character; N : Character)
return Name_Id;
-- Replace occurence of character O in the Name by character N.
function Is_Prefix (N1 : Name_Id; N2 : Name_Id) return Boolean; function Is_Prefix (N1 : Name_Id; N2 : Name_Id) return Boolean;
-- Is N1 a prefix of N2 -- Is N1 a prefix of N2
......
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