Commit 9e3040bc authored by Maxime Perrotin's avatar Maxime Perrotin

More VDM support

parent 05eff342
Pipeline #1176 skipped
...@@ -309,6 +309,7 @@ private ...@@ -309,6 +309,7 @@ private
pragma Linker_Options ("build_script.o"); pragma Linker_Options ("build_script.o");
pragma Linker_Options ("system_config.o"); pragma Linker_Options ("system_config.o");
pragma Linker_Options ("build_scade_skeletons.o"); pragma Linker_Options ("build_scade_skeletons.o");
pragma Linker_Options ("build_vdm_skeletons.o");
pragma Linker_Options ("build_rtds_skeletons.o"); pragma Linker_Options ("build_rtds_skeletons.o");
pragma Linker_Options ("build_driver_skeletons.o"); pragma Linker_Options ("build_driver_skeletons.o");
pragma Linker_Options ("asn2datamodel.o"); pragma Linker_Options ("asn2datamodel.o");
......
...@@ -120,6 +120,19 @@ void Create_script() ...@@ -120,6 +120,19 @@ void Create_script()
} }
}); });
/* VDM-Specific: call code generator and B mappers */
FOREACH (fv, FV, get_system_ast()->functions, {
if (vdm == fv->language) {
fprintf(script,
"# Generate code for VDM function %s\n"
"cd \"$SKELS\"/%s && "
"vdm2c %s.vdmpp %s_Interface.vdmpp out.vdm"
"&& cd $OLDPWD\n\n",
fv->name, fv->name, fv->name, fv->name);
}
/* TODO call B mappers or add --subVdm in orchestrator */
});
/* Remove old zip files and create fresh new ones from user code */ /* Remove old zip files and create fresh new ones from user code */
FOREACH (fv, FV, get_system_ast()->functions, { FOREACH (fv, FV, get_system_ast()->functions, {
//if (sdl != fv->language PUT BACK WHEN OPENGEODE FULLY SUPPORTED //if (sdl != fv->language PUT BACK WHEN OPENGEODE FULLY SUPPORTED
...@@ -186,13 +199,14 @@ void Create_script() ...@@ -186,13 +199,14 @@ void Create_script()
case rtds: fprintf (script, "--subRTDS "); case rtds: fprintf (script, "--subRTDS ");
break; break;
case c: case c:
case vdm:
case blackbox_device: case blackbox_device:
fprintf (script, "--subC "); fprintf (script, "--subC ");
break; break;
case cpp: case cpp:
fprintf (script, "--subCPP "); fprintf (script, "--subCPP ");
break; break;
case sdl: // REMOVE WHEN OPENGEODE FULLY SUPPORTED case sdl:
case ada: fprintf (script, "--subAda "); case ada: fprintf (script, "--subAda ");
break; break;
case vhdl: fprintf (script, "--subVHDL "); case vhdl: fprintf (script, "--subVHDL ");
......
...@@ -60,7 +60,7 @@ void Init_VDM_GW_Backend(FV *fv) ...@@ -60,7 +60,7 @@ void Init_VDM_GW_Backend(FV *fv)
filename = make_string("%s_interface.vdmpp", fv->name); filename = make_string("%s_interface.vdmpp", fv->name);
create_file(path, filename, &interface); create_file(path, filename, &interface);
free(filename); free(filename);
filename = make_string("%s_code.vdmpp", fv->name); filename = make_string("%s.vdmpp", fv->name);
if (!file_exists(path, filename)) { if (!file_exists(path, filename)) {
create_file(path, filename, &user_code); create_file(path, filename, &user_code);
...@@ -137,13 +137,8 @@ void add_pi_to_vdm_gw(Interface * i) ...@@ -137,13 +137,8 @@ void add_pi_to_vdm_gw(Interface * i)
fprintf(user_code, fprintf(user_code,
"\n" "\n"
"%s%s == -- Write your code here\n\n", "%s%s == -- Write your code here\n\n",
NULL != i->in? params: "", i->name,
i->name); NULL != i->in? params: "");
free(signature);
free(sep2);
free(params);
free(sep);
} }
/* Declaration of the RI */ /* Declaration of the RI */
...@@ -158,9 +153,11 @@ void add_ri_to_vdm_gw(Interface * i) ...@@ -158,9 +153,11 @@ void add_ri_to_vdm_gw(Interface * i)
void End_VDM_GW_Backend(FV *fv) void End_VDM_GW_Backend(FV *fv)
{ {
fprintf(interface, "end %s_Interface\n", fv->name); fprintf(interface, "end %s_Interface\n", fv->name);
fprintf(user_code, "end %s\n", fv->name);
close_file(&interface); close_file(&interface);
if (NULL != user_code) {
fprintf(user_code, "end %s\n", fv->name);
close_file(&user_code); close_file(&user_code);
}
} }
/* Function to process one interface of the FV */ /* Function to process one interface of the FV */
......
...@@ -126,6 +126,7 @@ void C_End() ...@@ -126,6 +126,7 @@ void C_End()
GW_SDL_Backend(fv); GW_SDL_Backend(fv);
GW_Simulink_Backend(fv); GW_Simulink_Backend(fv);
GW_C_Backend(fv); GW_C_Backend(fv);
GW_VDM_Backend(fv);
GW_Ada_Backend(fv); GW_Ada_Backend(fv);
GW_SCADE_Backend(fv); GW_SCADE_Backend(fv);
GW_RTDS_Backend(fv); GW_RTDS_Backend(fv);
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
extern void GW_SDL_Backend(FV *); extern void GW_SDL_Backend(FV *);
extern void GW_Simulink_Backend(FV *); extern void GW_Simulink_Backend(FV *);
extern void GW_C_Backend(FV *); extern void GW_C_Backend(FV *);
extern void GW_VDM_Backend(FV *);
extern void GW_Ada_Backend(FV *); extern void GW_Ada_Backend(FV *);
extern void GW_SCADE_Backend(FV *); extern void GW_SCADE_Backend(FV *);
extern void GW_RTDS_Backend(FV *); extern void GW_RTDS_Backend(FV *);
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
/* Return a string representing the selected encoding rules for a Parameter */ /* Return a string representing the selected encoding rules for a Parameter */
#define BINARY_ENCODING(p) (native==p->encoding)?"NATIVE":(uper==p->encoding)?"UPER":(acn==p->encoding)?"ACN":"#ERROR#" #define BINARY_ENCODING(p) (native==p->encoding)?"NATIVE":(uper==p->encoding)?"UPER":(acn==p->encoding)?"ACN":"#ERROR#"
#define LANGUAGE(fv) ada==fv->language?"Ada": c==fv->language?"C": sdl==fv->language?"OG": rtds==fv->language?"RTDS": scade==fv->language?"SCADE6":simulink==fv->language?"SIMULINK": blackbox_device==fv->language? "C": rhapsody==fv->language? "C": vhdl==fv->language?"VHDL": system_c==fv->language?"SYSTEM_C":gui==fv->language?"GUI": qgenc==fv->language?"QGenC": qgenada==fv->language?"QGenAda": cpp==fv->language?"CPP": vdm==fv->language?"VDM": "UNSUPPORTED_LANGUAGE!" #define LANGUAGE(fv) ada==fv->language?"Ada": c==fv->language?"C": sdl==fv->language?"OG": rtds==fv->language?"RTDS": scade==fv->language?"SCADE6":simulink==fv->language?"SIMULINK": blackbox_device==fv->language? "C": rhapsody==fv->language? "C": vhdl==fv->language?"VHDL": system_c==fv->language?"SYSTEM_C":gui==fv->language?"GUI": qgenc==fv->language?"QGenC": qgenada==fv->language?"QGenAda": cpp==fv->language?"CPP": vdm==fv->language?"Vdm": "UNSUPPORTED_LANGUAGE!"
#define RCM_KIND(IF) (protected==IF->rcm?"protected":unprotected==IF->rcm?"unprotected":sporadic==IF->rcm?"sporadic":cyclic==IF->rcm?"cyclic":variator==IF->rcm?"variator":"unknown") #define RCM_KIND(IF) (protected==IF->rcm?"protected":unprotected==IF->rcm?"unprotected":sporadic==IF->rcm?"sporadic":cyclic==IF->rcm?"cyclic":variator==IF->rcm?"variator":"unknown")
......
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