Commit ab23a8cf authored by Maxime Perrotin's avatar Maxime Perrotin

Remove dependency on env variable ASN1SCC

parent abe758a2
......@@ -657,9 +657,9 @@ void add_RI_to_ada_wrappers(Interface * i)
fprintf(b, "%d", calltmp->value->thread_id);
}
else if (0 == count) {
ERROR ("** Error: function \"%s\" is not called by anyone (dead code)!\n", i->parent_fv->name);
ERROR ("[ERROR] Function \"%s\" is not called by anyone (dead code)!\n", i->parent_fv->name);
ERROR ("** This is not supported by the Ada runtime. You may have to change two things:\n");
ERROR ("** 1) (In any case) use the -p flag when calling the TASTE orchestrator, and\n");
ERROR ("** 1) Use the -p flag when calling the TASTE orchestrator to use the C runtime, and\n");
ERROR ("** 2) In your deployment view, if applicable, choose a non-Ada runtime\n");
ERROR ("** (do not use \"LEON_ORK\" ; \"Native\" or \"LEON_RTEMS\" are OK)\n\n");
exit(-1);
......
......@@ -68,7 +68,7 @@ void Call_asn2dataModel(FV * fv)
case EEXIST:
break;
default:
ERROR("Error creating directory %s\n", dataviewpath);
ERROR("[ERROR] Issue creating directory %s\n", dataviewpath);
add_error();
return;
break;
......@@ -87,7 +87,7 @@ void Call_asn2dataModel(FV * fv)
}
if (!file_exists(dataview_path, dataview_uniq)) {
ERROR("** Error: %s/%s not found\n", dataview_path, dataview_uniq);
ERROR("[ERROR] %s/%s not found\n", dataview_path, dataview_uniq);
exit(-1);
}
......@@ -100,7 +100,7 @@ void Call_asn2dataModel(FV * fv)
if (system(command)) {
ERROR
("** Error: Check this command line and make sure all files are valid:\n%s\n", command);
("[ERROR] Check this command line and make sure all files are valid:\n%s\n", command);
exit(-1);
}
free(command);
......
......@@ -337,8 +337,8 @@ void Set_Context_Variable (char *name, size_t len1, char *type, size_t len2,
/* First check the validity of the ASN.1 module name */
if (!strncmp (mod, "nomodule", len4)) {
ERROR ("** Error: The dataview you are using was generated using an old version\n");
ERROR (" of the toolchain. You must update it by calling taste-update-data-view\n");
ERROR ("[ERROR] The dataview you are using was generated using an old version\n");
ERROR (" of the toolchain. You must update it by calling taste-update-data-view\n");
exit (-1);
}
/* Temporary for the SMP2 support until version of taste-IV withtout obj suffixes */
......@@ -451,7 +451,7 @@ void Set_Timer_Resolution(char *val, size_t len) {
char *str = make_string("%.*s", len, val);
int time_res = (int) strtol(str, (char **)NULL, 10);
if (0 != errno) {
ERROR("** Error: Timer resolution must be a valid number\n");
ERROR("[ERROR] Timer resolution must be a valid number\n");
}
else {
printf("[INFO] Set timer resolution to %d\n", time_res);
......@@ -496,8 +496,8 @@ void Set_OutDir(char *o, size_t len)
/* create the root output directory */
if (-1 == mkdir((system_ast->context)->output, 0700)
&& EEXIST != errno) {
ERROR("** Error: output directory could not be created!\n");
ERROR(" Current directory will be used instead...\n");
ERROR("[ERROR] output directory could not be created!\n");
ERROR(" Current directory will be used instead...\n");
free((system_ast->context)->output);
(system_ast->context)->output = NULL;
}
......@@ -782,7 +782,7 @@ void Add_Binding(char *b, size_t length)
Create_Aplc_binding(&binding);
if (NULL == binding) {
ERROR ("** Error in Add_Binding->Create_Aplc_binding\n");
ERROR ("[ERROR] in Add_Binding->Create_Aplc_binding\n");
return;
}
......@@ -802,7 +802,7 @@ void Add_Binding(char *b, size_t length)
APPEND_TO_LIST(Aplc_binding, process->bindings, binding);
result_fv->process = process;
} else {
ERROR ("** Error: Binding references a non-existing FV...(%s)\n",
ERROR ("[ERROR] Binding references a non-existing FV...(%s)\n",
binding_name);
add_error();
}
......
......@@ -31,7 +31,6 @@ void Process_Context_Parameters(FV *fv)
FILE *asn = NULL;
char *fv_no_underscore = NULL;
char *cp_no_underscore = NULL;
char *asn1scc_path = NULL;
int will_fail = 0 ;
char *dataview_uniq = NULL;
char *dataview_path = NULL;
......@@ -142,13 +141,6 @@ void Process_Context_Parameters(FV *fv)
/*
* Next part: call asn1.exe with the newly-created ASN.1 file
*/
asn1scc_path = getenv ("ASN1SCC");
if (NULL == asn1scc_path) {
ERROR ("** Error: Environment variable ASN1SCC not set\n");
build_string (&asn1scc_path, "asn1.exe", strlen ("asn1.exe"));
will_fail = 1;
}
dataview_uniq = getASN1DataView();
dataview_path = getDataViewPath();
......@@ -168,8 +160,7 @@ void Process_Context_Parameters(FV *fv)
}
command = make_string
("mono %s -%s -typePrefix asn1Scc -o %s/%s %s %s/%s",
asn1scc_path,
("mono $(which asn1.exe) -%s -typePrefix asn1Scc -o %s/%s %s %s/%s",
ada==fv->language? "Ada": "c",
OUTPUT_PATH,
fv->name,
......
......@@ -26,24 +26,22 @@ void Process_Node_Driver_Configuration(Device *device, char *node)
char *command = NULL;
FILE *asn = NULL;
char *device_no_underscore = NULL;
char *asn1scc_path = NULL;
int will_fail = 0 ;
ASN1_Filename *filename = NULL;
char *driver_conf_path = NULL;
int ret = 0;
if (NULL == device->configuration || NULL == device->asn1_filename) return;
/*
if (NULL == device->configuration || NULL == device->asn1_filename) return;
/*
* Make sure the device name has no underscore (to be ASN.1-friendly)
*/
device_no_underscore =
underscore_to_dash (device->name, strlen(device->name));
/*
/*
* Create the ASN.1 file to store the configuration variable
*/
filename = make_string ("DeviceConfig-%s.asn", device_no_underscore);
filename = make_string ("DeviceConfig-%s.asn", device_no_underscore);
asn = fopen (filename, "wt");
assert (NULL != asn);
......@@ -56,31 +54,25 @@ void Process_Node_Driver_Configuration(Device *device, char *node)
fprintf(asn, "DeviceConfig-%s DEFINITIONS ::=\n", device_no_underscore);
fprintf(asn, "BEGIN\n");
/*
/*
* Import the ASN.1 module containing the type definition
*/
fprintf(asn, "IMPORTS %s FROM %s;\n\n", device->asn1_typename, device->asn1_modulename);
/*
/*
* Declare a variable of the configuration type.
*/
fprintf(asn, "\npohidrv-%s-cv %s ::= %s\n\n",
device_no_underscore,
device->asn1_typename,
device->configuration);
fprintf(asn, "END\n");
fprintf(asn, "END\n");
fclose (asn);
/*
* Call asn1.exe with the newly-created ASN.1 file
*/
asn1scc_path = getenv ("ASN1SCC");
if (NULL == asn1scc_path) {
ERROR ("** Error: environment variable ASN1SCC not set\n");
will_fail = 1;
}
driver_conf_path = make_string ("%s/DriversConfig/", OUTPUT_PATH);
ret = mkdir (driver_conf_path, 0700);
......@@ -106,24 +98,15 @@ void Process_Node_Driver_Configuration(Device *device, char *node)
}
command = make_string ("mono %s -%s -o %s %s %s",
asn1scc_path,
command = make_string ("mono $(which asn1.exe) %s -%s -o %s %s %s",
Please register or sign in to reply
C_DRIVER ? "c -typePrefix __po_hi_c_": "Ada",
driver_conf_path,
filename,
device->asn1_filename);
ERROR ("%s %s\n",
will_fail? "Because of the above error(s), the following command cannot be executed :\n":
"Executing",
command);
if (will_fail) {
ERROR ("Fix the errors and restart buildsupport!\n");
exit (-1);
}
ERROR ("Executing %s\n", command);
if (!will_fail && system (command)) {
if (system (command)) {
ERROR ("The command failed. Try it yourself (correct paths, access to files, etc.)\n");
exit (-1);
}
......
......@@ -375,7 +375,7 @@ void Add_Artificial_Function (Interface *duplicate_pi,
/* 2) Add the new FV to the binding list of the Process */
if (NULL == fv->process) {
ERROR ("** Error: function %s is not bound to any process\n",
ERROR ("[ERROR] function %s is not bound to any process\n",
fv->name);
add_error();
return;
......
......@@ -25,7 +25,7 @@ void Interface_Semantic_Check(Interface * i)
if (PI == i->direction && cyclic == i->rcm && NULL != i->distant_fv) {
ERROR
("** Error: In Function \"%s\", interface \"%s\" is cyclic and should not be connected. \n",
("[ERROR] In Function \"%s\", interface \"%s\" is cyclic and should not be connected. \n",
i->parent_fv->name, i->name);
add_error();
......@@ -36,7 +36,7 @@ void Interface_Semantic_Check(Interface * i)
&& (NULL != i->in || NULL != i->out)) {
ERROR
("** Error: In Function \"%s\", interface \"%s\" is cyclic and should not have parameters. \n",
("[ERROR] In Function \"%s\", interface \"%s\" is cyclic and should not have parameters. \n",
i->parent_fv->name, i->name);
add_error();
......@@ -53,7 +53,7 @@ void Interface_Semantic_Check(Interface * i)
if (count_param > 1) {
ERROR
("** Error: In Function \"%s\", sporadic interface \"%s\" cannot have more than 1 IN param.\n",
("[ERROR] In Function \"%s\", sporadic interface \"%s\" cannot have more than 1 IN param.\n",
i->parent_fv->name, i->name);
add_error();
}
......@@ -61,7 +61,7 @@ void Interface_Semantic_Check(Interface * i)
/* Check that SPO interfaces don't have any OUT parameters */
if (NULL != i->out) {
ERROR
("** Error: In Function \"%s\", sporadic interface \"%s\" cannot have OUT parameters.\n",
("[ERROR] In Function \"%s\", sporadic interface \"%s\" cannot have OUT parameters.\n",
i->parent_fv->name, i->name);
add_error();
}
......@@ -76,7 +76,7 @@ void Function_Semantic_Check(FV * fv)
{
if (fv->system_ast->context->glue && NULL == fv->process) {
ERROR
("** Error: Function \"%s\" is not bound to any partition.\n",
("[ERROR] Function \"%s\" is not bound to any partition.\n",
fv->name);
add_error();
}
......@@ -97,7 +97,7 @@ void Function_Semantic_Check(FV * fv)
);
if (0 == count_pi) {
ERROR
("** Error: Function \"%s\" shall contain at least one provided interface.\n",
("[ERROR] Function \"%s\" shall contain at least one provided interface.\n",
fv->name);
add_error();
}
......@@ -119,7 +119,7 @@ void Function_Semantic_Check(FV * fv)
if (1 != count_pi) {
ERROR
("** Error: %s function \"%s\" must contain ONE provided interface\n",
("[ERROR] %s function \"%s\" must contain ONE provided interface\n",
scade == fv->language ? "SCADE" : "Simulink", fv->name);
ERROR
("** (but possibly several input and output parameters).\n");
......@@ -128,7 +128,7 @@ void Function_Semantic_Check(FV * fv)
if (0 != count_ri) {
ERROR
("** Error: %s function \"%s\" must NOT contain any required interface\n",
("[ERROR] %s function \"%s\" must NOT contain any required interface\n",
scade == fv->language ? "SCADE" : "Simulink", fv->name);
ERROR
("** (use OUT parameters in the interface specification).\n");
......@@ -148,7 +148,7 @@ void Function_Semantic_Check(FV * fv)
else {
if (asynch == i->synchronism) {
ERROR
("** Error: Required interface %s of function %s should be PROTECTED or UNPROTECTED\n",
("[ERROR] Required interface %s of function %s should be PROTECTED or UNPROTECTED\n",
i->name, fv->name);
ERROR
(" because it is connected to a function that is using QGen as a source language\n");
......@@ -161,7 +161,7 @@ void Function_Semantic_Check(FV * fv)
if (0 != count_ri) {
ERROR
("** Error: %s function \"%s\" must NOT contain any required interface\n",
("[ERROR] %s function \"%s\" must NOT contain any required interface\n",
qgenc == fv->language ? "QGenC" : "QGenAda", fv->name);
ERROR
("** (use OUT parameters in the interface specification).\n");
......@@ -181,7 +181,7 @@ void Function_Semantic_Check(FV * fv)
if (strcmp(i->name, fv->name)) {
ERROR
("** Error: PI \"%s\" should have the same name as SCADE function \"%s\"\n",
("[ERROR] PI \"%s\" should have the same name as SCADE function \"%s\"\n",
i->name, fv->name);
add_error();
}
......@@ -196,7 +196,7 @@ void Function_Semantic_Check(FV * fv)
FOREACH(i, Interface, fv->interfaces, {
if (RI == i->direction) {
if (NULL == i->in) {
ERROR("** Error: in GUI function \"%s\",\n"
ERROR("[ERROR] in GUI function \"%s\",\n"
"** interface \"%s\" must contain a parameter.\n",
fv->name,
i->name);
......@@ -204,7 +204,7 @@ void Function_Semantic_Check(FV * fv)
}
/* Undefined RCM corresponds to "any type" (=inherited from PI) */
if (undefined != i->rcm && sporadic != i->rcm && variator != i->rcm) {
ERROR("** Error: All interfaces of GUI \"%s\"\n"
ERROR("[ERROR] All interfaces of GUI \"%s\"\n"
"** must be SPORADIC (e.g. %s is not).\n",
fv->name,
i->name);
......@@ -225,7 +225,7 @@ void Function_Semantic_Check(FV * fv)
if (!strcmp(function->name, i->distant_fv)
&& function->process != fv->process) {
ERROR
("** Error: Required interface %s of function %s should be SPORADIC\n",
("[ERROR] Required interface %s of function %s should be SPORADIC\n",
i->name, fv->name);
ERROR
(" because it is connected to a function that is bound to a different\n");
......@@ -259,7 +259,7 @@ void Semantic_Checks()
if (vhdl == binding->fv->language) count++;}
); if (count > 1) {
ERROR
("** Error: in a distributed system, a partition can contain only ONE\n");
("[ERROR] in a distributed system, a partition can contain only ONE\n");
ERROR(" VHDL component. Partition \"%s\" has %d.\n",
process->name, count); add_error();}
......
......@@ -30,8 +30,6 @@ void Process_Directives(FV *fv)
FILE *main_c = NULL;
char *fv_no_underscore = NULL;
char *cp_no_underscore = NULL;
char *asn1scc_path = NULL;
int will_fail = 0 ;
bool directive_present = false;
ASN1_Filename *filename = NULL;
......@@ -116,13 +114,6 @@ void Process_Directives(FV *fv)
/*
* Next part: call asn1.exe with the newly-created ASN.1 file
*/
asn1scc_path = getenv ("ASN1SCC");
if (NULL == asn1scc_path) {
ERROR ("** Error: environment variable ASN1SCC not set\n");
build_string (&asn1scc_path, "asn1.exe", strlen ("asn1.exe"));
will_fail = 1;
}
char *directives_file = make_string ("$(taste-config --directives)");
......@@ -132,26 +123,15 @@ void Process_Directives(FV *fv)
mkdir (directive_path, 0700);
free (directive_path);
command = make_string ("mono %s -c -XER -o %s/%s/directives %s %s",
asn1scc_path,
command = make_string ("mono $(which asn1.exe) -c -XER -o %s/%s/directives %s %s",
OUTPUT_PATH,
fv->name,
filename,
directives_file);
ERROR ("%s %s\n",
will_fail? "Because of the above warning(s),"
" the following command cannot be executed :\n":
"Executing",
command);
if (will_fail) {
ERROR("Fix the warnings and restart buildsupport,"
" or run it manually, you need it!\n");
exit (-1);
}
ERROR ("[INFO] Executing %s\n", command);
if (!will_fail && system (command)) {
if (system (command)) {
ERROR ("The command failed. Try it yourself"
" (correct paths, access to files, etc.)\n");
exit (-1);
......
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