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

More VDM support

parent 05eff342
Pipeline #1176 skipped
......@@ -309,6 +309,7 @@ private
pragma Linker_Options ("build_script.o");
pragma Linker_Options ("system_config.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_driver_skeletons.o");
pragma Linker_Options ("asn2datamodel.o");
......
......@@ -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 */
FOREACH (fv, FV, get_system_ast()->functions, {
//if (sdl != fv->language PUT BACK WHEN OPENGEODE FULLY SUPPORTED
......@@ -186,13 +199,14 @@ void Create_script()
case rtds: fprintf (script, "--subRTDS ");
break;
case c:
case vdm:
case blackbox_device:
fprintf (script, "--subC ");
break;
case cpp:
fprintf (script, "--subCPP ");
break;
case sdl: // REMOVE WHEN OPENGEODE FULLY SUPPORTED
case sdl:
case ada: fprintf (script, "--subAda ");
break;
case vhdl: fprintf (script, "--subVHDL ");
......
......@@ -60,7 +60,7 @@ void Init_VDM_GW_Backend(FV *fv)
filename = make_string("%s_interface.vdmpp", fv->name);
create_file(path, filename, &interface);
free(filename);
filename = make_string("%s_code.vdmpp", fv->name);
filename = make_string("%s.vdmpp", fv->name);
if (!file_exists(path, filename)) {
create_file(path, filename, &user_code);
......@@ -137,13 +137,8 @@ void add_pi_to_vdm_gw(Interface * i)
fprintf(user_code,
"\n"
"%s%s == -- Write your code here\n\n",
NULL != i->in? params: "",
i->name);
free(signature);
free(sep2);
free(params);
free(sep);
i->name,
NULL != i->in? params: "");
}
/* Declaration of the RI */
......@@ -158,9 +153,11 @@ void add_ri_to_vdm_gw(Interface * i)
void End_VDM_GW_Backend(FV *fv)
{
fprintf(interface, "end %s_Interface\n", fv->name);
fprintf(user_code, "end %s\n", fv->name);
close_file(&interface);
close_file(&user_code);
if (NULL != user_code) {
fprintf(user_code, "end %s\n", fv->name);
close_file(&user_code);
}
}
/* Function to process one interface of the FV */
......
......@@ -126,6 +126,7 @@ void C_End()
GW_SDL_Backend(fv);
GW_Simulink_Backend(fv);
GW_C_Backend(fv);
GW_VDM_Backend(fv);
GW_Ada_Backend(fv);
GW_SCADE_Backend(fv);
GW_RTDS_Backend(fv);
......
......@@ -2,8 +2,8 @@
* contact: maxime.perrotin@esa.int
* License is LGPL, check LICENSE file */
/*
Backends.h
External declaration of the backend functions
Backends.h
External declaration of the backend functions
*/
#include "my_types.h"
......@@ -14,6 +14,7 @@
extern void GW_SDL_Backend(FV *);
extern void GW_Simulink_Backend(FV *);
extern void GW_C_Backend(FV *);
extern void GW_VDM_Backend(FV *);
extern void GW_Ada_Backend(FV *);
extern void GW_SCADE_Backend(FV *);
extern void GW_RTDS_Backend(FV *);
......
......@@ -19,7 +19,7 @@
/* 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 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")
......
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