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

* ocarina/src/backends/ocarina-backends-po_hi_c-deployment.adb

   - Map ASN type to C type names

 * ocarina/src/backends/ocarina-backends-c_common-mapping.adb
   ocarina/src/backends/ocarina-backends-c_common-mapping.ads
   - Add Map_ASN_Type function

 * ocarina/resources/Makefile.am
   - Substitute OCARINA_INCLUDE_PATH to the ocarina_components.aadl
     file

 * ocarina/resources/AADLv2/components/devices.aadl
   - Specify ASN.1 and C header files



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@2062 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 0a8b3119
......@@ -35,14 +35,16 @@ public
data configuration_type_ip
properties
Type_Source_Name => "__po_hi_c_ip_conf_t";
Source_Text => ("drivers/configuration/ip.h");
Type_Source_Name => "IP-Conf-T";
Source_Language => ASN1;
Source_Text => ("OCARINA_INCLUDE_PATH/ocarina/runtime/polyorb-hi-c/src/drivers/configuration/ip.asn" , "drivers/configuration/ip.h");
end configuration_type_ip;
data configuration_type_serial
properties
Type_Source_Name => "__po_hi_c_serial_conf_t";
Source_Text => ("drivers/configuration/serial.h");
Type_Source_Name => "Serial-Conf-T";
Source_Language => ASN1;
Source_Text => ("OCARINA_INCLUDE_PATH/ocarina/runtime/polyorb-hi-c/src/drivers/configuration/serial.asn", "drivers/configuration/serial.h");
end configuration_type_serial;
--------------
......
......@@ -67,6 +67,11 @@ install-data-local:
for file in $(srcdir)/AADLv2/components/processors/*.aadl; do \
cat $$file >> $(DESTDIR)$(datadir)/ocarina/AADLv2/ocarina_components.aadl || exit 1; \
done
echo -n "s/OCARINA_INCLUDE_PATH/" > sedscript
echo -n $(DESTDIR)$(includedir)|sed -e 's/\//\\\//g' >> sedscript
echo -n "/g" >> sedscript
sed -f sedscript $(DESTDIR)$(datadir)/ocarina/AADLv2/ocarina_components.aadl > tmp.aadl
mv -f tmp.aadl $(DESTDIR)$(datadir)/ocarina/AADLv2/ocarina_components.aadl
for file in $(MODE_FILES); do \
$(INSTALL_DATA) $$file $(DESTDIR)$(datadir)/ocarina || exit 1; \
done
......
......@@ -4114,4 +4114,19 @@ package body Ocarina.Backends.C_Common.Mapping is
return No_Name;
end Map_Device_Confvar_Name;
------------------
-- Map_ASN_Type --
------------------
function Map_ASN_Type (ASN_Name : Name_Id) return Name_Id
is
Converted : Name_Id;
begin
Set_Str_To_Name_Buffer ("__po_hi_c_");
Get_Name_String_And_Append (ASN_Name);
Converted := Name_Find;
Converted := Replace_Char (Converted, '-', '_');
return To_Lower (Converted);
end Map_ASN_Type;
end Ocarina.Backends.C_Common.Mapping;
......@@ -397,4 +397,7 @@ package Ocarina.Backends.C_Common.Mapping is
-- Map the device identifier name into a variable name
-- that is supposed to contain the device configuration.
function Map_ASN_Type (ASN_Name : Name_Id) return Name_Id;
-- Map the name of an ASN.1 type into the C mapping.
end Ocarina.Backends.C_Common.Mapping;
......@@ -578,9 +578,10 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
Used_Type =>
Make_Pointer_Type
(Make_Defining_Identifier
(Map_ASN_Type
(Get_String_Property
(Configuration_Data,
"type_source_name")))));
"type_source_name"))))));
Append_Node_To_List
(N, CTN.Declarations (Current_File));
declare
......@@ -590,27 +591,33 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
begin
Set_Deployment_Header;
if ST'Length /= 1 then
if ST'Length = 0 then
Display_Error
("Source_Text property of " &
"configuration data" &
" must have only one element " &
" must have at least one element " &
"(the header file).",
Fatal => True);
end if;
Get_Name_String (ST (1));
Include_Name := No_Name;
if Name_Len <= 2 then
for Index in ST'Range loop
Get_Name_String (ST (Index));
if Name_Buffer (Name_Len - 1 .. Name_Len)
= ".h" then
Include_Name := Get_String_Name
(Name_Buffer (1 .. Name_Len - 2));
end if;
end loop;
if Include_Name = No_Name then
Display_Error
("Name of Source_Text of " &
"configuration data" &
"must be longer than 2 chars.",
("Cannot find header file " &
"that implements the data type",
Fatal => True);
end if;
Include_Name := Get_String_Name
(Name_Buffer (1 .. Name_Len - 2));
Add_Include
(Make_Include_Clause
(Make_Defining_Identifier
......
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