Commit f2dda3b1 authored by julien.delange's avatar julien.delange

* ocarina/src/backends/ocarina-backends-c_tree-nutils.adb

   ocarina/src/backends/ocarina-backends-c_tree-nutils.ads
   - Add Keyword_Check parameter to decide if we need to check
     that a generated item correspond to an AADL keyword

 * ocarina/src/backends/ocarina-backends-xml_tree-generator.adb
   - Avoid the generation of automatic .asn1 extension

 * ocarina/src/backends/ocarina-backends-c_common-mapping.adb
   ocarina/src/backends/ocarina-backends-pok_c-makefile.adb
   - Do not check AADL keyword for directories



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@1455 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent fe636ad3
......@@ -319,7 +319,8 @@ package body Ocarina.Backends.C_Common.Mapping is
if Get_Current_Backend_Kind = PolyORB_Kernel_C then
CTN.Set_Name (D, To_C_Name
(AIN.Name
(AIN.Identifier (Parent_Subcomponent (E)))));
(AIN.Identifier (Parent_Subcomponent (E))),
Keyword_Check => False));
else
CTN.Set_Name (D, To_C_Name (AIN.Name (AIN.Identifier (E))));
end if;
......@@ -355,7 +356,8 @@ package body Ocarina.Backends.C_Common.Mapping is
(AIN.Name
(AIN.Identifier
(AIN.Parent_Subcomponent
(E)))));
(E))),
Keyword_Check => False));
end if;
Set_Units (N, New_List (K_List_Id));
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2008-2009, GET-Telecom Paris. --
-- Copyright (C) 2008-2010, European Space Agency (ESA). --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -1146,7 +1146,9 @@ package body Ocarina.Backends.C_Tree.Nutils is
-- To_C_Name --
---------------
function To_C_Name (N : Name_Id; Ada_Style : Boolean := False)
function To_C_Name (N : Name_Id;
Ada_Style : Boolean := False;
Keyword_Check : Boolean := True)
return Name_Id is
Name : Name_Id;
Test_Name : Name_Id;
......@@ -1155,17 +1157,19 @@ package body Ocarina.Backends.C_Tree.Nutils is
Get_Name_String (Normalize_Name (N, Ada_Style));
Name := Name_Find;
-- If the identifier collides with a C reserved word insert
-- "AADL_" string before the identifier.
if Keyword_Check then
Test_Name := Add_Suffix_To_Name (Keyword_Suffix, Name);
V := Get_Name_Table_Byte (Test_Name);
if V > 0 then
Set_Str_To_Name_Buffer ("AADL_");
Get_Name_String_And_Append (Name);
Name := Name_Find;
end if;
-- If the identifier collides with a C reserved word insert
-- "AADL_" string before the identifier.
Test_Name := Add_Suffix_To_Name (Keyword_Suffix, Name);
V := Get_Name_Table_Byte (Test_Name);
if V > 0 then
Set_Str_To_Name_Buffer ("AADL_");
Get_Name_String_And_Append (Name);
Name := Name_Find;
end if;
end if;
return To_Lower (Name);
end To_C_Name;
......
......@@ -481,7 +481,9 @@ package Ocarina.Backends.C_Tree.Nutils is
procedure Set_Request_Header (N : Node_Id := No_Node);
function To_C_Name (N : Name_Id; Ada_Style : Boolean := False)
function To_C_Name (N : Name_Id;
Ada_Style : Boolean := False;
Keyword_Check : Boolean := True)
return Name_Id;
-- Convert N to a valid Ada identifier (no clashing with keywords,
-- no consecutive '_', no heading '_'...).
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2008-2010, GET-Telecom Paris. --
-- Copyright (C) 2008-2010, European Space Agency (ESA). --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -322,7 +322,8 @@ package body Ocarina.Backends.POK_C.Makefile is
(AIN.Name
(AIN.Identifier
(AIN.Parent_Subcomponent
(E)))));
(E))),
Keyword_Check => False));
Fd := Create_File ("Makefile", Text);
Partition_Object_Files := CTU.New_List (CTN.K_Element_List);
......@@ -604,7 +605,8 @@ package body Ocarina.Backends.POK_C.Makefile is
-- Reset the partition names table for this node.
Enter_Directory
(To_C_Name (AIN.Name (AIN.Identifier (Parent_Subcomponent (E)))));
(To_C_Name (AIN.Name (AIN.Identifier (Parent_Subcomponent (E))),
Keyword_Check => False));
Kernel_Mode := False;
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2008-2010, GET-Telecom Paris. --
-- Copyright (C) 2008-2010, European Space Agency (ESA). --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -114,7 +114,7 @@ package body Ocarina.Backends.XML_Tree.Generator is
-- the same name
Fd := Create_File
(Name_Buffer (1 .. Name_Len) & ".asn1", Text);
(Name_Buffer (1 .. Name_Len), Text);
if Fd = Invalid_FD then
raise Program_Error;
......
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