Skip to content
Snippets Groups Projects
Commit 145f97b5 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'Parameter-File' into 'master'

Added name of parameter file to error messages.



See merge request !170
parents 22f10e35 3dcd7f02
No related branches found
No related tags found
1 merge request!170Added name of parameter file to error messages.
...@@ -70,6 +70,7 @@ void parser_read_file(const char *file_name, struct swift_params *params) { ...@@ -70,6 +70,7 @@ void parser_read_file(const char *file_name, struct swift_params *params) {
/* Initialise parameter count. */ /* Initialise parameter count. */
params->paramCount = 0; params->paramCount = 0;
params->sectionCount = 0; params->sectionCount = 0;
strcpy(params->fileName, file_name);
/* Check if parameter file exits. */ /* Check if parameter file exits. */
if (file == NULL) { if (file == NULL) {
...@@ -375,7 +376,7 @@ int parser_get_param_int(const struct swift_params *params, const char *name) { ...@@ -375,7 +376,7 @@ int parser_get_param_int(const struct swift_params *params, const char *name) {
} }
} }
error("Cannot find '%s' in the structure.", name); error("Cannot find '%s' in the structure, in file '%s'.", name,params->fileName);
return 0; return 0;
} }
...@@ -407,7 +408,7 @@ char parser_get_param_char(const struct swift_params *params, ...@@ -407,7 +408,7 @@ char parser_get_param_char(const struct swift_params *params,
} }
} }
error("Cannot find '%s' in the structure.", name); error("Cannot find '%s' in the structure, in file '%s'.", name,params->fileName);
return 0; return 0;
} }
...@@ -439,7 +440,7 @@ float parser_get_param_float(const struct swift_params *params, ...@@ -439,7 +440,7 @@ float parser_get_param_float(const struct swift_params *params,
} }
} }
error("Cannot find '%s' in the structure.", name); error("Cannot find '%s' in the structure, in file '%s'.", name,params->fileName);
return 0.f; return 0.f;
} }
...@@ -470,7 +471,7 @@ double parser_get_param_double(const struct swift_params *params, ...@@ -470,7 +471,7 @@ double parser_get_param_double(const struct swift_params *params,
} }
} }
error("Cannot find '%s' in the structure.", name); error("Cannot find '%s' in the structure, in file '%s'.", name,params->fileName);
return 0.; return 0.;
} }
......
...@@ -42,6 +42,7 @@ struct swift_params { ...@@ -42,6 +42,7 @@ struct swift_params {
struct parameter data[PARSER_MAX_NO_OF_PARAMS]; struct parameter data[PARSER_MAX_NO_OF_PARAMS];
int sectionCount; int sectionCount;
int paramCount; int paramCount;
char fileName[PARSER_MAX_LINE_SIZE];
}; };
/* Public API. */ /* Public API. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment