Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
buildsupport
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TASTE
buildsupport
Commits
3d17b378
Commit
3d17b378
authored
Oct 03, 2017
by
Maxime Perrotin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Ada headers to instiantiate packages
..when using component types in SDL
parent
dfe9cd5b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
9 deletions
+55
-9
c/build_ada_skeletons.c
c/build_ada_skeletons.c
+55
-9
No files found.
c/build_ada_skeletons.c
View file @
3d17b378
...
@@ -73,6 +73,9 @@ int ada_gw_preamble(FV * fv)
...
@@ -73,6 +73,9 @@ int ada_gw_preamble(FV * fv)
fprintf
(
ads
,
"with %s;
\n
use %s;
\n\n
"
,
m
,
m
);}
fprintf
(
ads
,
"with %s;
\n
use %s;
\n\n
"
,
m
,
m
);}
);
);
}
}
if
(
NULL
!=
fv
->
instance_of
)
{
fprintf
(
ads
,
"with %s;
\n\n
"
,
fv
->
instance_of
);
}
if
(
has_context_param
(
fv
))
{
if
(
has_context_param
(
fv
))
{
fprintf
(
ads
,
fprintf
(
ads
,
...
@@ -325,6 +328,8 @@ void add_RI_to_Ada_gw(Interface * i)
...
@@ -325,6 +328,8 @@ void add_RI_to_Ada_gw(Interface * i)
/* Add timer declarations to the Ada code skeletons */
/* Add timer declarations to the Ada code skeletons */
void
Ada_Add_timers
(
FV
*
fv
)
void
Ada_Add_timers
(
FV
*
fv
)
{
{
if
(
NULL
==
ads
)
return
;
if
(
NULL
!=
fv
->
timer_list
)
{
if
(
NULL
!=
fv
->
timer_list
)
{
fprintf
(
ads
,
fprintf
(
ads
,
" -- ------------------------------------------------ --
\n
"
" -- ------------------------------------------------ --
\n
"
...
@@ -370,21 +375,57 @@ void Ada_Add_timers (FV *fv)
...
@@ -370,21 +375,57 @@ void Ada_Add_timers (FV *fv)
});
});
}
}
/* Handle instanciation of generic packages */
void
Ada_Add_Instanciation
(
FV
*
fv
)
{
if
(
NULL
==
ads
)
return
;
char
*
decl
=
make_string
(
"package %s_Instance is new %s"
,
fv
->
name
,
fv
->
instance_of
);
/* Instantiate the generic with the required interfaces and timers */
bool
comma
=
false
;
char
*
params
=
NULL
;
FOREACH
(
i
,
Interface
,
fv
->
interfaces
,
{
if
(
RI
==
i
->
direction
)
{
params
=
make_string
(
"%s%sRI%s => %s"
,
NULL
!=
params
?
params
:
""
,
comma
?
", "
:
"("
,
i
->
name
,
i
->
name
);
comma
=
true
;
}
});
FOREACH
(
timer
,
String
,
fv
->
timer_list
,
{
params
=
make_string
(
"%s%sSet_%s => Set_%s, Reset_%s => Reset_%s"
,
NULL
!=
params
?
params
:
""
,
comma
?
", "
:
"("
,
timer
,
timer
,
timer
,
timer
);
comma
=
true
;
});
if
(
NULL
!=
params
)
{
decl
=
make_string
(
"%s%s);"
,
decl
,
params
);
}
else
{
decl
=
make_string
(
"%s;"
,
decl
);
}
fprintf
(
ads
,
"%s
\n
"
,
decl
);
free
(
decl
);
}
/* External interface */
/* External interface */
void
GW_Ada_Backend
(
FV
*
fv
)
void
GW_Ada_Backend
(
FV
*
fv
)
{
{
if
(
fv
->
system_ast
->
context
->
onlycv
)
if
(
fv
->
system_ast
->
context
->
onlycv
)
return
;
return
;
/* For instance of components (SDL only), disable the overwriting of the
* ads file, as it is handled by OpenGEODE, and the content is different
* than for normal functions - it instantiates the generic package, etc.
*/
if
(
NULL
!=
fv
->
instance_of
)
{
return
;
}
if
(
ada
==
fv
->
language
||
qgenada
==
fv
->
language
)
{
if
(
ada
==
fv
->
language
||
qgenada
==
fv
->
language
)
{
/* Create the files and add headers */
/* Create the files and add headers */
...
@@ -412,6 +453,11 @@ void GW_Ada_Backend(FV * fv)
...
@@ -412,6 +453,11 @@ void GW_Ada_Backend(FV * fv)
// If any timers, add declarations in code skeleton
// If any timers, add declarations in code skeleton
Ada_Add_timers
(
fv
);
Ada_Add_timers
(
fv
);
// If the function is an instance, instantiate the generic package
if
(
NULL
!=
fv
->
instance_of
)
{
Ada_Add_Instanciation
(
fv
);
}
/* Write footers and close files */
/* Write footers and close files */
close_ada_gw_files
(
fv
);
close_ada_gw_files
(
fv
);
}
}
...
...
Write
Preview
Markdown
is supported
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