From d59b45036d97f494cb43eb0a0e9fed668b0639b6 Mon Sep 17 00:00:00 2001 From: marcobaye Date: Mon, 24 Aug 2020 16:31:36 +0000 Subject: [PATCH] "Cannot open input file" error message now contains file name. git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@294 4df02467-bbd4-4a76-a152-e7ce94205b78 --- src/global.c | 1 - src/global.h | 1 - src/input.c | 11 +++++++++-- src/version.h | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/global.c b/src/global.c index 2155438..6583ac6 100644 --- a/src/global.c +++ b/src/global.c @@ -33,7 +33,6 @@ char s_untitled[] = ""; // FIXME - this is actually const // Exception messages during assembly -const char exception_cannot_open_input_file[] = "Cannot open input file."; const char exception_missing_string[] = "No string given."; const char exception_negative_size[] = "Negative size argument."; const char exception_no_left_brace[] = "Missing '{'."; diff --git a/src/global.h b/src/global.h index e43fef5..6633fda 100644 --- a/src/global.h +++ b/src/global.h @@ -23,7 +23,6 @@ #define SF_IMPLIED_LABEL (1u << 1) // statement had implied label def extern char s_untitled[]; // error messages during assembly -extern const char exception_cannot_open_input_file[]; extern const char exception_missing_string[]; extern const char exception_negative_size[]; extern const char exception_no_left_brace[]; diff --git a/src/input.c b/src/input.c index d1dd57a..4858d8c 100644 --- a/src/input.c +++ b/src/input.c @@ -737,8 +737,15 @@ FILE *includepaths_open_ro(boolean uses_lib) } } } - if (stream == NULL) - Throw_error(exception_cannot_open_input_file); + if (stream == NULL) { + // CAUTION, I'm re-using the path dynabuf to assemble the error message: + DYNABUF_CLEAR(pathbuf); + DynaBuf_add_string(pathbuf, "Cannot open input file \""); + DynaBuf_add_string(pathbuf, GLOBALDYNABUF_CURRENT); + DynaBuf_add_string(pathbuf, "\"."); + DynaBuf_append(pathbuf, '\0'); + Throw_error(pathbuf->buffer); + } //fprintf(stderr, "File is [%s]\n", GLOBALDYNABUF_CURRENT); return stream; } diff --git a/src/version.h b/src/version.h index e68bece..2b2c4cc 100644 --- a/src/version.h +++ b/src/version.h @@ -9,7 +9,7 @@ #define RELEASE "0.97" // update before release FIXME #define CODENAME "Zem" // update before release -#define CHANGE_DATE "20 Aug" // update before release FIXME +#define CHANGE_DATE "24 Aug" // update before release FIXME #define CHANGE_YEAR "2020" // update before release //#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/" #define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME