Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
Ocarina
Commits
61425ccb
Commit
61425ccb
authored
Dec 29, 2014
by
yoogx
Browse files
* Continue code refactoring
parent
44e8768d
Changes
4
Hide whitespace changes
Inline
Side-by-side
resources/deployment.aadl
View file @
61425ccb
...
@@ -14,12 +14,6 @@ property set Deployment is
...
@@ -14,12 +14,6 @@ property set Deployment is
Port_Number : aadlinteger applies to (process, device);
Port_Number : aadlinteger applies to (process, device);
-- IP port number of a process (BSD_Sockets specific)
-- IP port number of a process (BSD_Sockets specific)
Process_ID : aadlinteger applies to (process, device);
-- Process identifier (SpaceWire specific)
Channel_Address : aadlinteger applies to (process, device);
-- Communication channel address (SpaceWire specific)
Protocol_Type : type enumeration (iiop, diop);
Protocol_Type : type enumeration (iiop, diop);
-- Supported communication protocols
-- Supported communication protocols
Protocol : Deployment::Protocol_Type applies to (system);
Protocol : Deployment::Protocol_Type applies to (system);
...
...
src/backends/ocarina-backends-properties-utils.adb
View file @
61425ccb
...
@@ -31,10 +31,17 @@
...
@@ -31,10 +31,17 @@
-- --
-- --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
with
Ocarina
.
Backends
.
Messages
;
with
Ocarina
.
Instances
.
Queries
;
with
Ocarina
.
Instances
.
Queries
;
with
Ocarina
.
ME_AADL
.
AADL_Instances
.
Nodes
;
with
Ocarina
.
Namet
;
package
body
Ocarina
.
Backends
.
Properties
.
Utils
is
package
body
Ocarina
.
Backends
.
Properties
.
Utils
is
use
Ocarina
.
Backends
.
Messages
;
use
Ocarina
.
Instances
.
Queries
;
use
Ocarina
.
Instances
.
Queries
;
use
Ocarina
.
ME_AADL
.
AADL_Instances
.
Nodes
;
use
Ocarina
.
Namet
;
----------------------------
----------------------------
-- Check_And_Get_Property --
-- Check_And_Get_Property --
...
@@ -79,6 +86,19 @@ package body Ocarina.Backends.Properties.Utils is
...
@@ -79,6 +86,19 @@ package body Ocarina.Backends.Properties.Utils is
end
if
;
end
if
;
end
Check_And_Get_Property
;
end
Check_And_Get_Property
;
function
Check_And_Get_Property
(
E
:
Node_Id
;
Property_Name
:
Name_Id
;
Default_Value
:
List_Id
:=
No_List
)
return
List_Id
is
begin
if
Is_Defined_List_Property
(
E
,
Property_Name
)
then
return
Get_List_Property
(
E
,
Property_Name
);
else
return
Default_Value
;
end
if
;
end
Check_And_Get_Property
;
function
Check_And_Get_Property
function
Check_And_Get_Property
(
E
:
Node_Id
;
(
E
:
Node_Id
;
Property_Name
:
Name_Id
;
Property_Name
:
Name_Id
;
...
@@ -92,4 +112,31 @@ package body Ocarina.Backends.Properties.Utils is
...
@@ -92,4 +112,31 @@ package body Ocarina.Backends.Properties.Utils is
end
if
;
end
if
;
end
Check_And_Get_Property
;
end
Check_And_Get_Property
;
function
Check_And_Get_Property
(
E
:
Node_Id
;
Property_Name
:
Name_Id
;
Names
:
Name_Array
;
Default_Value
:
Int
:=
Int
'
First
)
return
Int
is
P_Name
:
Name_Id
;
begin
if
not
Is_Defined_Enumeration_Property
(
E
,
Property_Name
)
then
return
Default_Value
;
end
if
;
P_Name
:=
Get_Enumeration_Property
(
E
,
Property_Name
);
for
J
in
Names
'
Range
loop
if
P_Name
=
Names
(
J
)
then
return
J
;
end
if
;
end
loop
;
Display_Located_Error
(
Loc
(
E
),
"Unknown enumerator "
&
Get_Name_String
(
P_Name
),
Fatal
=>
True
);
return
Default_Value
;
end
Check_And_Get_Property
;
end
Ocarina
.
Backends
.
Properties
.
Utils
;
end
Ocarina
.
Backends
.
Properties
.
Utils
;
src/backends/ocarina-backends-properties-utils.ads
View file @
61425ccb
...
@@ -51,12 +51,25 @@ package Ocarina.Backends.Properties.Utils is
...
@@ -51,12 +51,25 @@ package Ocarina.Backends.Properties.Utils is
Default_Value
:
Node_Id
:=
No_Node
)
Default_Value
:
Node_Id
:=
No_Node
)
return
Node_Id
;
return
Node_Id
;
function
Check_And_Get_Property
(
E
:
Node_Id
;
Property_Name
:
Name_Id
;
Default_Value
:
List_Id
:=
No_List
)
return
List_Id
;
function
Check_And_Get_Property
function
Check_And_Get_Property
(
E
:
Node_Id
;
(
E
:
Node_Id
;
Property_Name
:
Name_Id
;
Property_Name
:
Name_Id
;
Default_Value
:
Boolean
:=
False
)
Default_Value
:
Boolean
:=
False
)
return
Boolean
;
return
Boolean
;
function
Check_And_Get_Property
(
E
:
Node_Id
;
Property_Name
:
Name_Id
;
Names
:
Name_Array
;
Default_Value
:
Int
:=
Int
'
First
)
return
Int
;
-- Check Property_Name is set on node E, if so returns its value
-- Check Property_Name is set on node E, if so returns its value
-- otherwise return the default value.
-- otherwise return the default value.
...
...
src/backends/ocarina-backends-properties.adb
View file @
61425ccb
...
@@ -658,14 +658,9 @@ package body Ocarina.Backends.Properties is
...
@@ -658,14 +658,9 @@ package body Ocarina.Backends.Properties is
-------------------
-------------------
function
Get_Base_Type
(
D
:
Node_Id
)
return
List_Id
is
function
Get_Base_Type
(
D
:
Node_Id
)
return
List_Id
is
begin
pragma
Assert
(
AINU
.
Is_Data
(
D
));
pragma
Assert
(
AINU
.
Is_Data
(
D
));
begin
if
Is_Defined_List_Property
(
D
,
Base_Type
)
then
return
Check_And_Get_Property
(
D
,
Base_Type
);
return
Get_List_Property
(
D
,
Base_Type
);
else
return
No_List
;
end
if
;
end
Get_Base_Type
;
end
Get_Base_Type
;
------------------
------------------
...
@@ -947,27 +942,26 @@ package body Ocarina.Backends.Properties is
...
@@ -947,27 +942,26 @@ package body Ocarina.Backends.Properties is
function
Get_IEEE754_Precision
function
Get_IEEE754_Precision
(
D
:
Node_Id
)
return
Supported_IEEE754_Precision
(
D
:
Node_Id
)
return
Supported_IEEE754_Precision
is
is
P_Name
:
Name_Id
;
begin
pragma
Assert
(
AINU
.
Is_Data
(
D
));
pragma
Assert
(
AINU
.
Is_Data
(
D
));
if
Is_Defined_Enumeration_Property
(
D
,
IEEE754_Precision
)
then
IEEE754_Names
:
constant
Name_Array
P_Name
:=
Get_Enumeration_Property
(
D
,
IEEE754_Precision
);
(
Supported_IEEE754_Precision
'
Pos
(
Supported_IEEE754_Precision
'
First
)
..
Supported_IEEE754_Precision
'
Pos
(
Supported_IEEE754_Precision
'
Last
))
:=
(
Supported_IEEE754_Precision
'
Pos
(
Precision_Simple
)
=>
Precision_Simple_Name
,
Supported_IEEE754_Precision
'
Pos
(
Precision_Double
)
=>
Precision_Double_Name
,
Supported_IEEE754_Precision
'
Pos
(
Precision_None
)
=>
No_Name
);
if
P_Name
=
Precision_Simple_Name
then
begin
return
Precision_Simple
;
return
Supported_IEEE754_Precision
'
Val
elsif
P_Name
=
Precision_Double_Name
then
(
Check_And_Get_Property
return
Precision_Double
;
(
D
,
else
IEEE754_Precision
,
Display_Located_Error
IEEE754_Names
,
(
AIN
.
Loc
(
D
),
Supported_IEEE754_Precision
'
Pos
(
Precision_None
)));
"Unknown floating point precision"
,
Fatal
=>
True
);
return
Precision_None
;
end
if
;
else
return
Precision_None
;
end
if
;
end
Get_IEEE754_Precision
;
end
Get_IEEE754_Precision
;
-----------------------
-----------------------
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment