Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
buildsupport
Commits
2590d82c
Commit
2590d82c
authored
Aug 29, 2016
by
Maxime Perrotin
Browse files
Add preliminary support for vdm
parent
5455eb83
Pipeline
#1173
skipped
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ada/buildsupport.adb
View file @
2590d82c
...
...
@@ -200,6 +200,9 @@ procedure BuildSupport is
when
Language_CPP
=>
Imported_Routines
.
C_Set_Language_To_CPP
;
when
Language_VDM
=>
Imported_Routines
.
C_Set_Language_To_VDM
;
when
Language_SDL_OpenGEODE
=>
Imported_Routines
.
C_Set_Language_To_SDL
;
...
...
ada/imported_routines.ads
View file @
2590d82c
...
...
@@ -150,6 +150,7 @@ package Imported_Routines is
procedure
C_Set_Language_To_QGenAda
;
procedure
C_Set_Language_To_QGenC
;
procedure
C_Set_Language_To_CPP
;
procedure
C_Set_Language_To_VDM
;
procedure
C_Set_Language_To_OpenGEODE
;
procedure
C_Set_Language_To_BlackBox_Device
;
procedure
C_Set_Language_To_RTDS
;
...
...
@@ -232,7 +233,8 @@ private
pragma
Import
(
C
,
C_Set_Language_To_Other
,
"Set_Language_To_Other"
);
pragma
Import
(
C
,
C_Set_Language_To_C
,
"Set_Language_To_C"
);
pragma
Import
(
C
,
C_Set_Language_To_CPP
,
"Set_Language_To_CPP"
);
pragma
Import
(
C
,
C_Set_Language_To_OpenGEODE
,
"Set_Language_To_OpenGEODE"
);
pragma
Import
(
C
,
C_Set_Language_To_VDM
,
"Set_Language_To_VDM"
);
pragma
Import
(
C
,
C_Set_Language_To_OpenGEODE
,
"Set_Language_To_SDL"
);
pragma
Import
(
C
,
C_Set_Language_To_BlackBox_Device
,
"Set_Language_To_BlackBox_Device"
);
pragma
Import
(
C
,
C_Set_Language_To_RTDS
,
"Set_Language_To_RTDS"
);
...
...
c/build_rtds_glue.c
View file @
2590d82c
...
...
@@ -29,76 +29,76 @@ void rtds_glue_preamble(FV * fv)
/* Check if any interface needs ASN.1 types */
FOREACH
(
i
,
Interface
,
fv
->
interfaces
,
{
if
(
NULL
!=
i
->
in
||
NULL
!=
i
->
out
)
hasparam
=
1
;}
if
(
NULL
!=
i
->
in
||
NULL
!=
i
->
out
)
hasparam
=
1
;}
);
/* a. glue_.h preamble */
fprintf
(
glue_h
,
"/* This file was generated automatically: DO NOT MODIFY IT ! */
\n\n
"
);
"/* This file was generated automatically: DO NOT MODIFY IT ! */
\n\n
"
);
fprintf
(
glue_h
,
"/* Declaration of the provided and required interfaces */
\n\n
"
);
"/* Declaration of the provided and required interfaces */
\n\n
"
);
fprintf
(
glue_h
,
"#ifndef __GLUE_H_%s__
\n
#define __GLUE_H_%s__
\n\n
"
,
fv
->
name
,
fv
->
name
);
fv
->
name
,
fv
->
name
);
if
(
hasparam
)
{
fprintf
(
glue_h
,
"#include
\"
C_ASN1_Types.h
\"\n\n
"
);
fprintf
(
glue_h
,
"#include
\"
RTDS_ASN1_Types.h
\"\n\n
"
);
fprintf
(
glue_h
,
"#include
\"
C_ASN1_Types.h
\"\n\n
"
);
fprintf
(
glue_h
,
"#include
\"
RTDS_ASN1_Types.h
\"\n\n
"
);
}
/* fprintf(glue_h, "#include \"RTDS_OS.h\"\n"); */
fprintf
(
glue_h
,
"#include
\"
RTDS_gen.h
\"\n
"
);
fprintf
(
glue_h
,
"#include
\"
RTDS_Proc.h
\"\n
"
);
fprintf
(
glue_h
,
"#include
\"
RTDS_%s_project_messages.h
\"\n
"
,
fv
->
name
);
fv
->
name
);
fprintf
(
glue_h
,
"#include
\"
%s_p_decl.h
\"\n\n
"
,
fv
->
name
);
fprintf
(
glue_h
,
"static RTDS_Proc %s_instanceDescriptor;
\n
"
,
fv
->
name
);
/* Declare the SDL instance descriptor */
fprintf
(
glue_h
,
"static RTDS_GlobalProcessInfo %s_instanceContext;
\n
"
,
fv
->
name
);
/* Declare the SDL instance context */
fprintf
(
glue_h
,
"static RTDS_MessageHeader currentMessage;
\n\n
"
);
/* Declare the RTDS message header */
fprintf
(
glue_h
,
"static RTDS_Proc %s_instanceDescriptor;
\n
"
,
fv
->
name
);
/* Declare the SDL instance descriptor */
fprintf
(
glue_h
,
"static RTDS_GlobalProcessInfo %s_instanceContext;
\n
"
,
fv
->
name
);
/* Declare the SDL instance context */
fprintf
(
glue_h
,
"static RTDS_MessageHeader currentMessage;
\n\n
"
);
/* Declare the RTDS message header */
/* b. glue_.c preamble */
fprintf
(
glue_c
,
"/* This file was generated automatically: DO NOT MODIFY IT ! */
\n\n
"
);
"/* This file was generated automatically: DO NOT MODIFY IT ! */
\n\n
"
);
fprintf
(
glue_c
,
"#include
\"
glue_%s.h
\"\n\n
"
,
fv
->
name
);
fprintf
(
glue_c
,
"RTDS_Proc* %s_instanceDescriptor_ptr = NULL;
\n
"
,
fv
->
name
);
"RTDS_Proc* %s_instanceDescriptor_ptr = NULL;
\n
"
,
fv
->
name
);
fprintf
(
glue_c
,
"char* %s_instanceDescriptor_locals_ptr = NULL;
\n
"
,
fv
->
name
);
"char* %s_instanceDescriptor_locals_ptr = NULL;
\n
"
,
fv
->
name
);
fprintf
(
glue_c
,
"void %s_startup()
\n
{
\n
"
,
fv
->
name
);
fprintf
(
glue_h
,
"void %s_startup();
\n\n
"
,
fv
->
name
);
fprintf
(
glue_c
,
"
\t
RTDS_Proc_%s_p_createInstance(&%s_instanceDescriptor, NULL, &%s_instanceContext, NULL);
\n
"
,
fv
->
name
,
fv
->
name
,
fv
->
name
);
"
\t
RTDS_Proc_%s_p_createInstance(&%s_instanceDescriptor, NULL, &%s_instanceContext, NULL);
\n
"
,
fv
->
name
,
fv
->
name
,
fv
->
name
);
fprintf
(
glue_c
,
"
\t
%s_instanceDescriptor_ptr = &%s_instanceDescriptor;
\n
"
,
fv
->
name
,
fv
->
name
);
"
\t
%s_instanceDescriptor_ptr = &%s_instanceDescriptor;
\n
"
,
fv
->
name
,
fv
->
name
);
fprintf
(
glue_c
,
"
\t
%s_instanceDescriptor_locals_ptr = %s_instanceDescriptor.myLocals.%s_p.RTDS_myLocals;
\n
"
,
fv
->
name
,
fv
->
name
,
fv
->
name
);
"
\t
%s_instanceDescriptor_locals_ptr = %s_instanceDescriptor.myLocals.%s_p.RTDS_myLocals;
\n
"
,
fv
->
name
,
fv
->
name
,
fv
->
name
);
fprintf
(
glue_c
,
"
\t
RTDS_%s_p_executeTransition(&%s_instanceDescriptor, NULL);
\n
}
\n\n
"
,
fv
->
name
,
fv
->
name
);
"
\t
RTDS_%s_p_executeTransition(&%s_instanceDescriptor, NULL);
\n
}
\n\n
"
,
fv
->
name
,
fv
->
name
);
/* c. glue macros preamble */
fprintf
(
glue_macros
,
"/* This file was generated automatically: DO NOT MODIFY IT ! */
\n
"
);
"/* This file was generated automatically: DO NOT MODIFY IT ! */
\n
"
);
fprintf
(
glue_macros
,
"/* Definition of the RI macros called by RTDS generated code */
\n\n
"
);
"/* Definition of the RI macros called by RTDS generated code */
\n\n
"
);
fprintf
(
glue_macros
,
"#include
\"
glue_%s.h
\"\n\n
"
,
fv
->
name
);
/* d. sync_RI preamble */
fprintf
(
sync_ri
,
"/* This file was generated automatically: DO NOT MODIFY IT ! */
\n\n
"
);
"/* This file was generated automatically: DO NOT MODIFY IT ! */
\n\n
"
);
fprintf
(
sync_ri
,
"/* Definition of the synchronous required interfaces */
\n\n
"
);
"/* Definition of the synchronous required interfaces */
\n\n
"
);
fprintf
(
sync_ri
,
"#include
\"
common.h
\"\n\n
"
);
}
...
...
@@ -137,7 +137,7 @@ int Init_RTDS_GLUE_Backend(FV * fv)
free
(
filename
);
assert
(
NULL
!=
glue_h
&&
NULL
!=
glue_c
&&
NULL
!=
glue_macros
&&
NULL
!=
sync_ri
);
&&
NULL
!=
sync_ri
);
rtds_glue_preamble
(
fv
);
...
...
@@ -152,10 +152,10 @@ int Init_RTDS_GLUE_Backend(FV * fv)
void
Convert_ASN1_to_RTDS
(
Parameter
*
p
,
FILE
**
file
)
{
fprintf
(
*
file
,
"
\t
Convert_%s_from_ASN1SCC_to_RTDS (&rtds_%s_%s, asn1_%s_%s);
\n
"
,
p
->
type
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
name
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
name
);
"
\t
Convert_%s_from_ASN1SCC_to_RTDS (&rtds_%s_%s, asn1_%s_%s);
\n
"
,
p
->
type
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
name
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
name
);
}
/*
...
...
@@ -167,10 +167,10 @@ void Convert_ASN1_to_RTDS(Parameter * p, FILE ** file)
void
Convert_ASN1_to_RTDS_Macro
(
Parameter
*
p
,
FILE
**
file
)
{
fprintf
(
*
file
,
"
\t
Convert_%s_from_ASN1SCC_to_RTDS (rtds_%s_%s_%s, &asn1_%s_%s);
\\\n
"
,
p
->
type
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
interface
->
name
,
p
->
name
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
name
);
"
\t
Convert_%s_from_ASN1SCC_to_RTDS (rtds_%s_%s_%s, &asn1_%s_%s);
\\\n
"
,
p
->
type
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
interface
->
name
,
p
->
name
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
name
);
}
/*
...
...
@@ -181,13 +181,13 @@ void Convert_ASN1_to_RTDS_Macro(Parameter * p, FILE ** file)
void
Convert_RTDS_to_ASN1
(
Parameter
*
p
,
FILE
**
file
,
char
*
eol_separator
)
{
fprintf
(
*
file
,
"
\t
Convert_%s_from_RTDS_to_ASN1SCC (&asn1_%s_%s_%s, %srtds_%s_%s);"
,
p
->
type
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
interface
->
name
,
p
->
name
,
(
SIMPLETYPE
(
p
)
||
synch
==
p
->
interface
->
synchronism
)
?
""
:
"&"
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
name
);
"
\t
Convert_%s_from_RTDS_to_ASN1SCC (&asn1_%s_%s_%s, %srtds_%s_%s);"
,
p
->
type
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
interface
->
name
,
p
->
name
,
(
SIMPLETYPE
(
p
)
||
synch
==
p
->
interface
->
synchronism
)
?
""
:
"&"
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
name
);
fprintf
(
*
file
,
"%s"
,
eol_separator
);
}
...
...
@@ -201,14 +201,14 @@ void List_RTDS_Params(Parameter * p, FILE ** file)
/* Determine if a comma is needed prior to the item to be put in the list. */
comma
=
((
p
->
param_direction
==
param_in
&&
p
!=
p
->
interface
->
in
->
value
)
||
(
p
->
param_direction
==
param_out
&&
(
NULL
!=
p
->
interface
->
in
||
p
!=
p
->
interface
->
out
->
value
)));
((
p
->
param_direction
==
param_in
&&
p
!=
p
->
interface
->
in
->
value
)
||
(
p
->
param_direction
==
param_out
&&
(
NULL
!=
p
->
interface
->
in
||
p
!=
p
->
interface
->
out
->
value
)));
fprintf
(
*
file
,
"%srtds_%s_%s"
,
comma
?
", "
:
""
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
name
);
comma
?
", "
:
""
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
name
);
}
/*
...
...
@@ -218,14 +218,14 @@ void List_RTDS_Params(Parameter * p, FILE ** file)
void
List_RTDS_Types_And_Params
(
Parameter
*
p
,
FILE
**
file
)
{
if
((
param_in
==
p
->
param_direction
&&
p
!=
p
->
interface
->
in
->
value
)
||
(
param_out
==
p
->
param_direction
&&
(
NULL
!=
p
->
interface
->
in
||
p
!=
p
->
interface
->
out
->
value
)))
{
fprintf
(
*
file
,
", "
);
(
param_out
==
p
->
param_direction
&&
(
NULL
!=
p
->
interface
->
in
||
p
!=
p
->
interface
->
out
->
value
)))
{
fprintf
(
*
file
,
", "
);
}
fprintf
(
*
file
,
"%s %srtds_%s_%s"
,
p
->
type
,
(
param_out
==
p
->
param_direction
||
!
SIMPLETYPE
(
p
))
?
"*"
:
""
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
name
);
p
->
type
,
(
param_out
==
p
->
param_direction
||
!
SIMPLETYPE
(
p
))
?
"*"
:
""
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
name
);
}
/*
...
...
@@ -238,24 +238,24 @@ void List_ASN1_Params_With_Pointers(Parameter * p, FILE ** file)
/* Determine if a comma is needed prior to the item to be put in the list. */
comma
=
((
p
->
param_direction
==
param_in
&&
p
!=
p
->
interface
->
in
->
value
)
||
(
p
->
param_direction
==
param_out
&&
(
NULL
!=
p
->
interface
->
in
||
p
!=
p
->
interface
->
out
->
value
)));
((
p
->
param_direction
==
param_in
&&
p
!=
p
->
interface
->
in
->
value
)
||
(
p
->
param_direction
==
param_out
&&
(
NULL
!=
p
->
interface
->
in
||
p
!=
p
->
interface
->
out
->
value
)));
fprintf
(
*
file
,
"%s&asn1_%s_%s_%s"
,
comma
?
", "
:
""
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
interface
->
name
,
p
->
name
);
comma
?
", "
:
""
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
interface
->
name
,
p
->
name
);
}
/* ForEachWithParam function : Make a declaration of static variable for a given parameter */
void
Declare_static_ASN1_param
(
Parameter
*
p
,
FILE
**
file
)
{
fprintf
(
*
file
,
"static asn1Scc%s asn1_%s_%s_%s;
\n
"
,
p
->
type
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
interface
->
name
,
p
->
name
);
p
->
type
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
interface
->
name
,
p
->
name
);
}
/*
...
...
@@ -272,52 +272,52 @@ void add_PI_to_RTDS_glue(Interface * i)
tmp
=
i
->
in
;
while
(
NULL
!=
tmp
)
{
fprintf
(
glue_h
,
"%sconst asn1Scc%s *"
,
(
tmp
!=
i
->
in
)
?
", "
:
""
,
tmp
->
value
->
type
);
fprintf
(
glue_h
,
"%sconst asn1Scc%s *"
,
(
tmp
!=
i
->
in
)
?
", "
:
""
,
tmp
->
value
->
type
);
fprintf
(
glue_c
,
"%sconst asn1Scc%s *asn1_IN_%s"
,
(
tmp
!=
i
->
in
)
?
", "
:
""
,
tmp
->
value
->
type
,
tmp
->
value
->
name
);
tmp
=
tmp
->
next
;
fprintf
(
glue_c
,
"%sconst asn1Scc%s *asn1_IN_%s"
,
(
tmp
!=
i
->
in
)
?
", "
:
""
,
tmp
->
value
->
type
,
tmp
->
value
->
name
);
tmp
=
tmp
->
next
;
}
fprintf
(
glue_h
,
");
\n\n
"
);
fprintf
(
glue_c
,
")
\n
{
\n
"
);
fprintf
(
glue_c
,
"
\t
/* 1) For each parameter, declare a RTDS variable */
\n
"
);
"
\t
/* 1) For each parameter, declare a RTDS variable */
\n
"
);
FOREACH
(
p
,
Parameter
,
i
->
in
,
{
fprintf
(
glue_c
,
"
\t
%s rtds_%s_%s;
\n
"
,
p
->
type
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
name
);}
fprintf
(
glue_c
,
"
\t
%s rtds_%s_%s;
\n
"
,
p
->
type
,
(
param_in
==
p
->
param_direction
)
?
"IN"
:
"OUT"
,
p
->
name
);}
)
fprintf
(
glue_c
,
"
\t
/* 2) RTDS Macro to declare a message */
\n
"
);
fprintf
(
glue_c
,
"
\t
/* 2) RTDS Macro to declare a message */
\n
"
);
fprintf
(
glue_c
,
"
\n\t
RTDS_MSG_DATA_DECL
\n
"
);
fprintf
(
glue_c
,
"
\n\t
/* 3) Convert each input parameter from ASN.1 to RTDS */
\n
"
);
"
\n\t
/* 3) Convert each input parameter from ASN.1 to RTDS */
\n
"
);
/*ForEachWithParam (i->in, Convert_ASN1_to_RTDS, &glue_c); */
FOREACH
(
p
,
Parameter
,
i
->
in
,
{
Convert_ASN1_to_RTDS
(
p
,
&
glue_c
);
}
Convert_ASN1_to_RTDS
(
p
,
&
glue_c
);
}
);
fprintf
(
glue_c
,
"
\n\t
/* 4) Set the message header */
\n
"
);
fprintf
(
glue_c
,
"
\t
RTDS_%s_SET_MESSAGE(¤tMessage%s"
,
i
->
name
,
(
NULL
!=
i
->
in
)
?
", "
:
""
);
(
NULL
!=
i
->
in
)
?
", "
:
""
);
/*ForEachWithParam (i->in, List_RTDS_Params, &glue_c); */
FOREACH
(
p
,
Parameter
,
i
->
in
,
{
List_RTDS_Params
(
p
,
&
glue_c
);
}
List_RTDS_Params
(
p
,
&
glue_c
);
}
);
fprintf
(
glue_c
,
");
\n
"
);
fprintf
(
glue_c
,
"
\n\t
/* 5) Execute the SDL transition */
\n
"
);
fprintf
(
glue_c
,
"
\t
RTDS_%s_p_executeTransition (&%s_instanceDescriptor, ¤tMessage);
\n
"
,
i
->
parent_fv
->
name
,
i
->
parent_fv
->
name
);
"
\t
RTDS_%s_p_executeTransition (&%s_instanceDescriptor, ¤tMessage);
\n
"
,
i
->
parent_fv
->
name
,
i
->
parent_fv
->
name
);
fprintf
(
glue_c
,
"}
\n\n
"
);
}
...
...
@@ -335,19 +335,19 @@ void add_RI_to_RTDS_glue(Interface * i)
tmp
=
i
->
in
;
while
(
NULL
!=
tmp
)
{
fprintf
(
glue_h
,
"%sconst asn1Scc%s *"
,
(
tmp
!=
i
->
in
)
?
", "
:
""
,
tmp
->
value
->
type
);
tmp
=
tmp
->
next
;
fprintf
(
glue_h
,
"%sconst asn1Scc%s *"
,
(
tmp
!=
i
->
in
)
?
", "
:
""
,
tmp
->
value
->
type
);
tmp
=
tmp
->
next
;
}
tmp
=
i
->
out
;
while
(
NULL
!=
tmp
)
{
fprintf
(
glue_h
,
"%sasn1Scc%s *"
,
(
tmp
!=
i
->
out
||
(
tmp
==
i
->
out
&&
NULL
!=
i
->
in
))
?
", "
:
""
,
tmp
->
value
->
type
);
tmp
=
tmp
->
next
;
fprintf
(
glue_h
,
"%sasn1Scc%s *"
,
(
tmp
!=
i
->
out
||
(
tmp
==
i
->
out
&&
NULL
!=
i
->
in
))
?
", "
:
""
,
tmp
->
value
->
type
);
tmp
=
tmp
->
next
;
}
fprintf
(
glue_h
,
");
\n\n
"
);
...
...
@@ -357,7 +357,7 @@ void add_RI_to_RTDS_glue(Interface * i)
void
add_sync_RI
(
Interface
*
i
)
{
fprintf
(
sync_ri
,
"
\n
/* SYNCHRONOUS REQUIRED INTERFACE %s */
\n
"
,
i
->
name
);
i
->
name
);
/*
* function prototype : syncRI_<InterfaceName> (rtdstype [*]rtds_IN_param1,.., rtdstype *rtds_OUT_param1,...)
...
...
@@ -365,43 +365,43 @@ void add_sync_RI(Interface * i)
*/
fprintf
(
sync_ri
,
"void syncRI_%s ("
,
i
->
name
);
FOREACH
(
p
,
Parameter
,
i
->
in
,
{
List_RTDS_Types_And_Params
(
p
,
&
sync_ri
);
});
List_RTDS_Types_And_Params
(
p
,
&
sync_ri
);
});
FOREACH
(
p
,
Parameter
,
i
->
out
,
{
List_RTDS_Types_And_Params
(
p
,
&
sync_ri
);
});
List_RTDS_Types_And_Params
(
p
,
&
sync_ri
);
});
fprintf
(
sync_ri
,
")
\n
{
\n
"
);
/* declare static data to put the Asn.1 encoded data */
FOREACH
(
p
,
Parameter
,
i
->
in
,
{
Declare_static_ASN1_param
(
p
,
&
sync_ri
);
});
Declare_static_ASN1_param
(
p
,
&
sync_ri
);
});
FOREACH
(
p
,
Parameter
,
i
->
out
,
{
Declare_static_ASN1_param
(
p
,
&
sync_ri
);
});
Declare_static_ASN1_param
(
p
,
&
sync_ri
);
});
/* convert rtds input to asn.1 static data */
FOREACH
(
p
,
Parameter
,
i
->
in
,
{
Convert_RTDS_to_ASN1
(
p
,
&
sync_ri
,
"
\n
"
);
});
Convert_RTDS_to_ASN1
(
p
,
&
sync_ri
,
"
\n
"
);
});
fprintf
(
sync_ri
,
"
\n
"
);
/* call RI function generated in invoke_ri.c by the C backend */
fprintf
(
sync_ri
,
"
\t
%s_RI_%s("
,
i
->
parent_fv
->
name
,
i
->
name
);
FOREACH
(
p
,
Parameter
,
i
->
in
,
{
List_ASN1_Params_With_Pointers
(
p
,
&
sync_ri
);
});
List_ASN1_Params_With_Pointers
(
p
,
&
sync_ri
);
});
FOREACH
(
p
,
Parameter
,
i
->
out
,
{
List_ASN1_Params_With_Pointers
(
p
,
&
sync_ri
);
});
List_ASN1_Params_With_Pointers
(
p
,
&
sync_ri
);
});
fprintf
(
sync_ri
,
");
\n
"
);
/* convert result from asn1 to rtds and end function */
FOREACH
(
p
,
Parameter
,
i
->
out
,
{
fprintf
(
sync_ri
,
"
\t
Convert_%s_from_ASN1SCC_to_RTDS (rtds_OUT_%s, &asn1_OUT_%s_%s);
\n
"
,
p
->
type
,
p
->
name
,
p
->
interface
->
name
,
p
->
name
);});
fprintf
(
sync_ri
,
"
\t
Convert_%s_from_ASN1SCC_to_RTDS (rtds_OUT_%s, &asn1_OUT_%s_%s);
\n
"
,
p
->
type
,
p
->
name
,
p
->
interface
->
name
,
p
->
name
);});
fprintf
(
sync_ri
,
"}
\n
"
);
}
...
...
@@ -413,11 +413,11 @@ void add_RI_to_Macro_Definitions(Interface * i)
/* 1) declare static data to put the Asn.1 encoded data */
FOREACH
(
p
,
Parameter
,
i
->
in
,
{
Declare_static_ASN1_param
(
p
,
&
glue_macros
);
});
Declare_static_ASN1_param
(
p
,
&
glue_macros
);
});
FOREACH
(
p
,
Parameter
,
i
->
out
,
{
Declare_static_ASN1_param
(
p
,
&
glue_macros
);
});
Declare_static_ASN1_param
(
p
,
&
glue_macros
);
});
/* 2) undef the possibly existing macro */
fprintf
(
glue_macros
,
"
\n
#undef RTDS_MSG_SEND_%s
\n
"
,
i
->
name
);
...
...
@@ -431,22 +431,22 @@ void add_RI_to_Macro_Definitions(Interface * i)
* }
*/
fprintf
(
glue_macros
,
"#define RTDS_MSG_SEND_%s%s"
,
i
->
name
,
(
NULL
!=
i
->
in
||
NULL
!=
i
->
out
)
?
"("
:
""
);
(
NULL
!=
i
->
in
||
NULL
!=
i
->
out
)
?
"("
:
""
);
FOREACH
(
p
,
Parameter
,
i
->
in
,
{
List_RTDS_Params
(
p
,
&
glue_macros
);
List_RTDS_Params
(
p
,
&
glue_macros
);
})
FOREACH
(
p
,
Parameter
,
i
->
out
,
{
List_RTDS_Params
(
p
,
&
glue_macros
);
})
fprintf
(
glue_macros
,
"%s
\\\n
{ "
,
(
NULL
!=
i
->
in
||
NULL
!=
i
->
out
)
?
")"
:
""
);
(
NULL
!=
i
->
in
||
NULL
!=
i
->
out
)
?
")"
:
""
);
FOREACH
(
p
,
Parameter
,
i
->
in
,
{
Convert_RTDS_to_ASN1
(
p
,
&
glue_macros
,
"
\\\n
"
);
});
Convert_RTDS_to_ASN1
(
p
,
&
glue_macros
,
"
\\\n
"
);
});
fprintf
(
glue_macros
,
"
\t
%s_RI_%s("
,
i
->
parent_fv
->
name
,
i
->
name
);
FOREACH
(
p
,
Parameter
,
i
->
in
,
{
List_ASN1_Params_With_Pointers
(
p
,
&
glue_macros
);
List_ASN1_Params_With_Pointers
(
p
,
&
glue_macros
);
})
FOREACH
(
p
,
Parameter
,
i
->
out
,
{
List_ASN1_Params_With_Pointers
(
p
,
&
glue_macros
);
...
...
@@ -454,7 +454,7 @@ void add_RI_to_Macro_Definitions(Interface * i)
fprintf
(
glue_macros
,
");
\\\n
"
);
FOREACH
(
p
,
Parameter
,
i
->
out
,
{
Convert_ASN1_to_RTDS_Macro
(
p
,
&
glue_macros
);
Convert_ASN1_to_RTDS_Macro
(
p
,
&
glue_macros
);
})
fprintf
(
glue_macros
,
"}
\n\n
"
);
}
...
...
@@ -464,18 +464,18 @@ void GLUE_RTDS_Interface(Interface * i)
{
switch
(
i
->
direction
)
{
case
PI
:
add_PI_to_RTDS_glue
(
i
);
break
;
add_PI_to_RTDS_glue
(
i
);
break
;
case
RI
:
add_RI_to_RTDS_glue
(
i
);
if
(
asynch
==
i
->
synchronism
)
add_RI_to_Macro_Definitions
(
i
);
if
(
synch
==
i
->
synchronism
)
add_sync_RI
(
i
);
break
;
add_RI_to_RTDS_glue
(
i
);
if
(
asynch
==
i
->
synchronism
)
add_RI_to_Macro_Definitions
(
i
);
if
(
synch
==
i
->
synchronism
)
add_sync_RI
(
i
);
break
;
default:
break
;
break
;
}
}
...
...
@@ -484,18 +484,18 @@ void GLUE_RTDS_Backend(FV * fv)
{
if
(
fv
->
system_ast
->
context
->
onlycv
)
return
;
return
;
if
(
rtds
==
fv
->
language
)
{
Init_RTDS_GLUE_Backend
(
fv
);
FOREACH
(
i
,
Interface
,
fv
->
interfaces
,
{
GLUE_RTDS_Interface
(
i
);
})
Init_RTDS_GLUE_Backend
(
fv
);
FOREACH
(
i
,
Interface
,
fv
->
interfaces
,
{
GLUE_RTDS_Interface
(
i
);
})
fprintf
(
glue_h
,
"
\n
#endif
\n
"
);
close_file
(
&
glue_h
);
close_file
(
&
glue_c
);
close_file
(
&
glue_macros
);
close_file
(
&
sync_ri
);
fprintf
(
glue_h
,
"
\n
#endif
\n
"
);
close_file
(
&
glue_h
);
close_file
(
&
glue_c
);
close_file
(
&
glue_macros
);
close_file
(
&
sync_ri
);
}
}
c/build_rtds_skeletons.c
View file @
2590d82c
...
...
@@ -152,7 +152,7 @@ void GW_RTDS_Backend(FV *fv)
FILE
*
script
=
NULL
;
if
(
fv
->
system_ast
->
context
->
onlycv
)
return
;
if
(
rtds
==
fv
->
language
&&
fv
->
system_ast
->
context
->
gw
)
{
#ifndef __unix__
...
...
@@ -186,8 +186,8 @@ void GW_RTDS_Backend(FV *fv)
}
build_string
(
&
sig_decl
,
";
\\\n\\\n
"
,
strlen
(
";
\\\n\\\n
"
));
}
/*
/*
* Provided interfaces can only by asynchronous and have
* a single input parameter
*/
...
...
@@ -200,7 +200,7 @@ void GW_RTDS_Backend(FV *fv)
* Synchronous interfaces can have several parameters
*/
else
if
(
RI
==
i
->
direction
)
{
/*
* Add SDL SIGNAL for Asynchronous RI
*/
...
...
@@ -277,14 +277,14 @@ void GW_RTDS_Backend(FV *fv)
fv
->
name
,
NULL
!=
outputline
?
outputline
:
""
);
#else
/*
/*
* (3) Invoke sed to replace strings in the template files
*/
script_name
=
make_string
(
"./tmp_rtds_script_%s.sh"
,
fv
->
name
);
script
=
fopen
(
script_name
,
"w"
);
assert
(
NULL
!=
script
);
path
=
fv
->
system_ast
->
context
->
output
;
/* Project template file: */
...
...
@@ -400,14 +400,14 @@ void GW_RTDS_Backend(FV *fv)
exit
(
-
1
);
}
/*
* Delete the sed script
/*
* Delete the sed script
*/
if
(
!
get_context
()
->
test
)
{
unlink
(
script_name
);
}
free
(
script_name
);
script_name
=
NULL
;
#endif
#endif