Commit 3685658d authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add VDM to mini-CV

parent f0053de7
/* Buildsupport is (c) 2008-2015 European Space Agency /* Buildsupport is (c) 2008-2016 European Space Agency
* contact: maxime.perrotin@esa.int * contact: maxime.perrotin@esa.int
* License is LGPL, check LICENSE file */ * License is LGPL, check LICENSE file */
/* /*
...@@ -20,7 +20,7 @@ Copyright 2014-2015 IB Krates <info@krates.ee> ...@@ -20,7 +20,7 @@ Copyright 2014-2015 IB Krates <info@krates.ee>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/stat.h> // Works with GCC under Windows (not tested with cl.exe) #include <sys/stat.h>
#include "my_types.h" #include "my_types.h"
#include "practical_functions.h" #include "practical_functions.h"
...@@ -29,11 +29,12 @@ Copyright 2014-2015 IB Krates <info@krates.ee> ...@@ -29,11 +29,12 @@ Copyright 2014-2015 IB Krates <info@krates.ee>
(simulink==i->parent_fv->language)?"Simulink":\ (simulink==i->parent_fv->language)?"Simulink":\
(qgenc==i->parent_fv->language)?"QGenC":\ (qgenc==i->parent_fv->language)?"QGenC":\
(ada==i->parent_fv->language)?"Ada":\ (ada==i->parent_fv->language)?"Ada":\
(vdm==i->parent_fv->language)?"Vdm":\
(qgenada==i->parent_fv->language)?"QGenAda":\ (qgenada==i->parent_fv->language)?"QGenAda":\
(rtds==i->parent_fv->language)?"RTDS":\ (rtds==i->parent_fv->language)?"RTDS":\
(scade==i->parent_fv->language)?"SCADE6":\ (scade==i->parent_fv->language)?"SCADE6":\
(vhdl==i->parent_fv->language)?"VHDL":\ (vhdl==i->parent_fv->language)?"VHDL":\
(system_c==i->parent_fv->language)?"SYSTEM_C":\ (system_c==i->parent_fv->language)?"SYSTEM_C":\
(gui==i->parent_fv->language && PI==i->direction)?"GUI_PI":\ (gui==i->parent_fv->language && PI==i->direction)?"GUI_PI":\
(gui==i->parent_fv->language && RI==i->direction)?"GUI_RI":\ (gui==i->parent_fv->language && RI==i->direction)?"GUI_RI":\
(rhapsody==i->parent_fv->language)? "Rhapsody":"C" (rhapsody==i->parent_fv->language)? "Rhapsody":"C"
...@@ -45,77 +46,60 @@ void Init_MiniCV_Backend(FV * fv) ...@@ -45,77 +46,60 @@ void Init_MiniCV_Backend(FV * fv)
{ {
char *path = NULL; char *path = NULL;
if (NULL != fv->system_ast->context->output) if (NULL != fv->system_ast->context->output)
build_string(&path, fv->system_ast->context->output, build_string(&path, fv->system_ast->context->output,
strlen(fv->system_ast->context->output)); strlen(fv->system_ast->context->output));
build_string(&path, fv->name, strlen(fv->name)); build_string(&path, fv->name, strlen(fv->name));
create_file(path, "mini_cv.aadl", &cv); create_file(path, "mini_cv.aadl", &cv);
free(path); free(path);
if (NULL != cv) { if (NULL != cv) {
fprintf(cv, fprintf(cv,
"-- Automatically Generated - For use with AADL2GlueC only - Do NOT modify! --\n\n"); "-- Automatically Generated - For use with AADL2GlueC only - Do NOT modify! --\n\n");
} }
} }
/* Add a new AADL SUBPROGRAM to the Concurrency view*/ /* Add a new AADL SUBPROGRAM to the Concurrency view*/
void Add_Subprogram(Interface * i) void Add_Subprogram(Interface * i)
{ {
Parameter_list *tmp;
if (NULL == cv) if (NULL == cv)
return; return;
fprintf(cv, "SUBPROGRAM %s\n", i->name); fprintf(cv, "SUBPROGRAM %s\n", i->name);
/* If the PI has parameters, add a FEATURE section */ /* If the PI has parameters, add a FEATURE section */
if (NULL != i->in || NULL != i->out) { if (NULL != i->in || NULL != i->out) {
fprintf(cv, "FEATURES\n"); fprintf(cv, "FEATURES\n");
tmp = i->in; FOREACH(param, Parameter, i->in, {
fprintf(cv,
while (NULL != tmp) { "\t%s:%s PARAMETER DataView::%s {encoding=>%s;};\n",
fprintf(cv, param->name,
"\t%s:%s PARAMETER DataView::%s {encoding=>%s;};\n", (PI == i->direction) ? "IN" : "OUT",
tmp->value->name, (PI == i->direction) ? "IN" : "OUT", param->type,
(tmp->value->type), BINARY_ENCODING(param));
BINARY_ENCODING(tmp->value)); });
/* (native == tmp->value->encoding) ? "Native" : (uper ==
tmp->
value-> FOREACH(param, Parameter, i->out, {
encoding) fprintf(cv,
? "UPER" : (NULL != i->out) ? "Native" : "UPER"); */ "\t%s:%s PARAMETER DataView::%s {encoding=>%s;};\n",
tmp = tmp->next; param->name,
} (PI == i->direction) ? "OUT" : "IN",
param->type,
tmp = i->out; BINARY_ENCODING(param));
});
while (NULL != tmp) {
fprintf(cv,
"\t%s:%s PARAMETER DataView::%s {encoding=>%s;};\n",
tmp->value->name, (PI == i->direction) ? "OUT" : "IN",
(tmp->value->type),
BINARY_ENCODING(tmp->value));
/* (native == tmp->value->encoding) ? "Native" : (uper ==
tmp->
value->
encoding)
? "UPER" : "Native");*/
tmp = tmp->next;
}
} }
fprintf(cv, "END %s;\n\n", i->name); fprintf(cv, "END %s;\n\n", i->name);
fprintf(cv, "SUBPROGRAM IMPLEMENTATION %s.%s\nPROPERTIES\n", fprintf(cv, "SUBPROGRAM IMPLEMENTATION %s.%s\nPROPERTIES\n",
i->name, ENCODING(i) i->name, ENCODING(i));
);
fprintf(cv, "\tFV_Name => \"%s\";\n", i->parent_fv->name); fprintf(cv, "\tFV_Name => \"%s\";\n", i->parent_fv->name);
fprintf(cv, "\tSource_Language => %s;\nEND %s.%s;\n\n", fprintf(cv, "\tSource_Language => %s;\nEND %s.%s;\n\n",
ENCODING(i), i->name, ENCODING(i) ENCODING(i), i->name, ENCODING(i));
);
} }
/* Close the Concurrency view */ /* Close the Concurrency view */
...@@ -136,7 +120,7 @@ void GLUE_MiniCV_Interface(Interface * i) ...@@ -136,7 +120,7 @@ void GLUE_MiniCV_Interface(Interface * i)
void GLUE_MiniCV_Backend(FV * fv) void GLUE_MiniCV_Backend(FV * fv)
{ {
if (fv->system_ast->context->onlycv) if (fv->system_ast->context->onlycv)
return; return;
Init_MiniCV_Backend(fv); Init_MiniCV_Backend(fv);
......
Supports Markdown
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