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
28e5276a
Commit
28e5276a
authored
Mar 07, 2018
by
Maxime Perrotin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support timers properly in SDL instances
parent
f930627d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
17 deletions
+40
-17
c/sdl_gateway.c
c/sdl_gateway.c
+40
-17
No files found.
c/sdl_gateway.c
View file @
28e5276a
...
@@ -67,9 +67,11 @@ void Create_New_SDL_Structure(FV * fv)
...
@@ -67,9 +67,11 @@ void Create_New_SDL_Structure(FV * fv)
}
}
char
*
filename
=
make_string
(
"%s.pr"
,
fv
->
name
);
char
*
filename
=
make_string
(
"%s.pr"
,
fv
->
name
);
/* If not already existing, also create an empty
system_implementation
.pr
/* If not already existing, also create an empty
<function>
.pr
* file - includes timer declarations, if any.
* file - includes timer declarations, if any.
* Do not create in case the function is an instance of a generic function*/
* Do not create in case the function is an instance of a generic function
* In that case (instance of), timers will be added to the list of signals
* to make them visible at code generation time */
if
(
!
file_exists
(
path
,
filename
)
&&
(
NULL
==
fv
->
instance_of
))
{
if
(
!
file_exists
(
path
,
filename
)
&&
(
NULL
==
fv
->
instance_of
))
{
create_file
(
path
,
filename
,
&
process
);
create_file
(
path
,
filename
,
&
process
);
if
(
fv
->
is_component_type
==
false
)
{
if
(
fv
->
is_component_type
==
false
)
{
...
@@ -108,7 +110,7 @@ void Create_New_SDL_Structure(FV * fv)
...
@@ -108,7 +110,7 @@ void Create_New_SDL_Structure(FV * fv)
free
(
filename
);
free
(
filename
);
}
}
void
Add_SDL_Signal
(
Interface
*
i
)
void
Add_SDL_Signal
(
Interface
*
i
)
{
{
Parameter_list
*
p
=
NULL
;
Parameter_list
*
p
=
NULL
;
if
(
NULL
==
f
)
{
if
(
NULL
==
f
)
{
...
@@ -137,6 +139,7 @@ void Add_SDL_Signal(Interface * i)
...
@@ -137,6 +139,7 @@ void Add_SDL_Signal(Interface * i)
}
}
fprintf
(
f
,
");
\n\n
"
);
fprintf
(
f
,
");
\n\n
"
);
}
}
}
}
...
@@ -144,7 +147,7 @@ void Add_SDL_Signal(Interface * i)
...
@@ -144,7 +147,7 @@ void Add_SDL_Signal(Interface * i)
* Create a string with the list of PI for the current functional view
* Create a string with the list of PI for the current functional view
* This is later used to build the SDL connections (CHANNELs and ROUTEs)
* This is later used to build the SDL connections (CHANNELs and ROUTEs)
*/
*/
void
add_PI_to_string
(
char
*
if_name
)
void
add_PI_to_string
(
char
*
if_name
)
{
{
pi_string
=
build_comma_string
(
&
pi_string
,
if_name
,
strlen
(
if_name
));
pi_string
=
build_comma_string
(
&
pi_string
,
if_name
,
strlen
(
if_name
));
}
}
...
@@ -196,18 +199,25 @@ void Build_SDL_Connections(FV * fv)
...
@@ -196,18 +199,25 @@ void Build_SDL_Connections(FV * fv)
if
(
NULL
==
f
)
if
(
NULL
==
f
)
return
;
return
;
fprintf
(
f
,
"
\t
CHANNEL c
\n
"
);
fprintf
(
f
,
"
\t
CHANNEL c
\n
"
);
if
(
NULL
!=
pi_string
)
fprintf
(
f
,
"
\t\t
FROM ENV TO %s WITH %s;
\n
"
,
fv
->
name
,
pi_string
);
if
(
NULL
!=
pi_string
)
{
if
(
NULL
!=
ri_string
)
fprintf
(
f
,
"
\t\t
FROM ENV TO %s WITH %s;
\n
"
,
fv
->
name
,
pi_string
);
fprintf
(
f
,
"
\t\t
FROM %s TO ENV WITH %s;
\n
"
,
fv
->
name
,
ri_string
);
}
if
(
NULL
!=
ri_string
)
{
fprintf
(
f
,
"
\t\t
FROM %s TO ENV WITH %s;
\n
"
,
fv
->
name
,
ri_string
);
}
fprintf
(
f
,
"
\t
ENDCHANNEL;
\n\n
"
);
fprintf
(
f
,
"
\t
ENDCHANNEL;
\n\n
"
);
fprintf
(
f
,
"
\t
BLOCK %s;
\n\n\t\t
SIGNALROUTE r
\n
"
,
fv
->
name
);
fprintf
(
f
,
"
\t
BLOCK %s;
\n\n\t\t
SIGNALROUTE r
\n
"
,
fv
->
name
);
if
(
NULL
!=
pi_string
)
fprintf
(
f
,
"
\t\t\t
FROM ENV TO %s WITH %s;
\n
"
,
fv
->
name
,
if
(
NULL
!=
pi_string
)
{
pi_string
);
fprintf
(
f
,
"
\t\t\t
FROM ENV TO %s WITH %s;
\n
"
,
fv
->
name
,
pi_string
);
if
(
NULL
!=
ri_string
)
}
fprintf
(
f
,
"
\t\t\t
FROM %s TO ENV WITH %s;
\n
"
,
fv
->
name
,
ri_string
);
if
(
NULL
!=
ri_string
)
{
fprintf
(
f
,
"
\t\t\t
FROM %s TO ENV WITH %s;
\n
"
,
fv
->
name
,
ri_string
);
}
fprintf
(
f
,
"
\n\t\t
CONNECT c and r;
\n\n
"
);
fprintf
(
f
,
"
\n\t\t
CONNECT c and r;
\n\n
"
);
if
(
fv
->
is_component_type
==
false
)
{
if
(
fv
->
is_component_type
==
false
)
{
...
@@ -229,7 +239,7 @@ void Close_SDL_Structure()
...
@@ -229,7 +239,7 @@ void Close_SDL_Structure()
}
}
/* Function to process one interface of the FV */
/* Function to process one interface of the FV */
void
GW_SDL_Interface
(
Interface
*
i
)
void
GW_SDL_Interface
(
Interface
*
i
)
{
{
switch
(
i
->
synchronism
)
{
switch
(
i
->
synchronism
)
{
case
asynch
:
case
asynch
:
...
@@ -255,7 +265,7 @@ void GW_SDL_Interface(Interface * i)
...
@@ -255,7 +265,7 @@ void GW_SDL_Interface(Interface * i)
/* External interface */
/* External interface */
void
GW_SDL_Backend
(
FV
*
fv
)
void
GW_SDL_Backend
(
FV
*
fv
)
{
{
if
(
fv
->
system_ast
->
context
->
onlycv
)
return
;
if
(
fv
->
system_ast
->
context
->
onlycv
)
return
;
...
@@ -263,7 +273,20 @@ void GW_SDL_Backend(FV * fv)
...
@@ -263,7 +273,20 @@ void GW_SDL_Backend(FV * fv)
Create_New_SDL_Structure
(
fv
);
Create_New_SDL_Structure
(
fv
);
FOREACH
(
i
,
Interface
,
fv
->
interfaces
,
{
FOREACH
(
i
,
Interface
,
fv
->
interfaces
,
{
GW_SDL_Interface
(
i
);
GW_SDL_Interface
(
i
);
})
});
if
(
NULL
!=
fv
->
instance_of
)
{
/* component is an instance: declare the timers as signals so that
* opengeode generates code for them, otherwise it would have no
* visibility on them, since they are declared in the code of the
* function type only
*/
FOREACH
(
timer
,
String
,
fv
->
timer_list
,
{
fprintf
(
f
,
"
\t
SIGNAL %s;
\n
"
,
timer
);
add_PI_to_string
(
timer
);
});
}
Build_SDL_Connections
(
fv
);
Build_SDL_Connections
(
fv
);
Close_SDL_Structure
();
Close_SDL_Structure
();
}
}
...
...
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