From dd83807050ad0b1eba66aeba1957f52e2140e109 Mon Sep 17 00:00:00 2001
From: James Willis <james.s.willis@durham.ac.uk>
Date: Tue, 31 May 2016 10:58:44 +0100
Subject: [PATCH] Added name of parameter file to error messages.

---
 src/parser.c | 9 +++++----
 src/parser.h | 1 +
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/parser.c b/src/parser.c
index 7329d15e87..49b035db05 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 cdbdc477ae..2d50ddc49b 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. */
-- 
GitLab