diff --git a/src/parser.c b/src/parser.c index 7329d15e872ec766556e493063bb4f410e99dcdf..49b035db05722d13d1ce48129b8fae8bfc1ad86b 100644 --- a/src/parser.c +++ b/src/parser.c @@ -70,6 +70,7 @@ void parser_read_file(const char *file_name, struct swift_params *params) { /* Initialise parameter count. */ params->paramCount = 0; params->sectionCount = 0; + strcpy(params->fileName, file_name); /* Check if parameter file exits. */ if (file == NULL) { @@ -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; } @@ -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; } @@ -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; } @@ -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.; } diff --git a/src/parser.h b/src/parser.h index cdbdc477ae8c90a504919618c84d03622099df01..2d50ddc49bf2231235bbb73040b067f77462d33e 100644 --- a/src/parser.h +++ b/src/parser.h @@ -42,6 +42,7 @@ struct swift_params { struct parameter data[PARSER_MAX_NO_OF_PARAMS]; int sectionCount; int paramCount; + char fileName[PARSER_MAX_LINE_SIZE]; }; /* Public API. */