diff --git a/src/_dos.h b/src/_dos.h index 22cac41..3afa917 100644 --- a/src/_dos.h +++ b/src/_dos.h @@ -1,5 +1,5 @@ // ACME - a crossassembler for producing 6502/65c02/65816/65ce02 code. -// Copyright (C) 1998-2024 Marco Baye +// Copyright (C) 1998-2025 Marco Baye // Have a look at "acme.c" for further info // // Platform specific stuff (in this case, for DOS, OS/2 and Windows) @@ -17,7 +17,7 @@ #define ALTERNATIVE_DIR_SEP '\\' // dummy // string containing the prefix for accessing files from the library tree -#define PLATFORM_LIBPREFIX platform_lib_prefix +#define PLATFORM_LIBPREFIX NULL #define PLATFORM_NEEDS_ENV_VAR 1 // library access needs "ACME" environment variable // setting file types of created files diff --git a/src/_std.h b/src/_std.h index c58f2d6..11a1a5c 100644 --- a/src/_std.h +++ b/src/_std.h @@ -1,5 +1,5 @@ // ACME - a crossassembler for producing 6502/65c02/65816/65ce02 code. -// Copyright (C) 1998-2024 Marco Baye +// Copyright (C) 1998-2025 Marco Baye // Have a look at "acme.c" for further info // // Platform specific stuff (in this case, for unknown OSes) @@ -17,7 +17,7 @@ #define ALTERNATIVE_DIR_SEP '/' // dummy // string containing the prefix for accessing files from the library tree -#define PLATFORM_LIBPREFIX platform_lib_prefix +#define PLATFORM_LIBPREFIX NULL #define PLATFORM_NEEDS_ENV_VAR 1 // library access needs "ACME" environment variable // setting the created files' types diff --git a/src/acme.c b/src/acme.c index 035bc99..fb9f569 100644 --- a/src/acme.c +++ b/src/acme.c @@ -1,5 +1,5 @@ // ACME - a crossassembler for producing 6502/65c02/65816/65ce02 code. -// Copyright (C) 1998-2024 Marco Baye +// Copyright (C) 1998-2025 Marco Baye // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -67,6 +67,7 @@ static const char arg_vicelabels[] = "VICE labels filename"; #define OPTION_IGNORE_ZEROES "ignore-zeroes" #define OPTION_STRICT_SEGMENTS "strict-segments" #define OPTION_STRICT "strict" +#define OPTION_LIBPATH "libpath" #define OPTION_DIALECT "dialect" #define OPTION_DEBUGLEVEL "debuglevel" #define OPTION_TEST "test" @@ -133,6 +134,7 @@ static void show_help_and_exit(void) " -vDIGIT set verbosity level\n" " -D SYMBOL=VALUE define global symbol\n" " -I PATH/TO/DIR add search path for input files\n" +" --" OPTION_LIBPATH " PATH/TO/DIR set path to ACME library\n" // TODO: replace these: " -W" OPTIONWNO_LABEL_INDENT " suppress warnings about indented labels\n" " -W" OPTIONWNO_OLD_FOR " (old, use \"--dialect 0.94.8\" instead)\n" @@ -725,6 +727,8 @@ static const char *long_option(const char *string) config.strict_segments = TRUE; else if (strcmp(string, OPTION_STRICT) == 0) config.all_warnings_are_errors = TRUE; + else if (strcmp(string, OPTION_LIBPATH) == 0) + config.platform_lib_prefix = cliargs_safe_get_next("path to library"); else if (strcmp(string, OPTION_DIALECT) == 0) set_dialect(cliargs_get_next()); // NULL is ok (handled like unknown) else if (strcmp(string, OPTION_DEBUGLEVEL) == 0) diff --git a/src/global.c b/src/global.c index 4fb00b6..a78e633 100644 --- a/src/global.c +++ b/src/global.c @@ -1,5 +1,5 @@ // ACME - a crossassembler for producing 6502/65c02/65816/65ce02 code. -// Copyright (C) 1998-2024 Marco Baye +// Copyright (C) 1998-2025 Marco Baye // Have a look at "acme.c" for further info // // Global stuff - things that are needed by several modules @@ -123,6 +123,7 @@ void config_default(struct config *conf) conf->test_new_features = FALSE; // enabled by --test conf->dialect = V__CURRENT_VERSION; // changed by --dialect conf->debuglevel = DEBUGLEVEL_DEBUG; // changed by --debuglevel, used by "!debug" + conf->platform_lib_prefix = PLATFORM_LIBPREFIX; conf->initial_cpu_type = NULL; conf->symbollist_filename = NULL; conf->vicelabels_filename = NULL; diff --git a/src/global.h b/src/global.h index 5eef9fd..f0b9f2b 100644 --- a/src/global.h +++ b/src/global.h @@ -1,5 +1,5 @@ // ACME - a crossassembler for producing 6502/65c02/65816/65ce02 code. -// Copyright (C) 1998-2024 Marco Baye +// Copyright (C) 1998-2025 Marco Baye // Have a look at "acme.c" for further info // // Global stuff - things that are needed by several modules @@ -90,6 +90,7 @@ struct config { boolean test_new_features; // FALSE, enabled by --test enum dialect dialect; // set by --dialect (and --test --test) int debuglevel; // set by --debuglevel, used by "!debug" + const char *platform_lib_prefix; // default value depends on platform const struct cpu_type *initial_cpu_type; const char *symbollist_filename; const char *vicelabels_filename; diff --git a/src/input.c b/src/input.c index ac63735..d830573 100644 --- a/src/input.c +++ b/src/input.c @@ -1,5 +1,5 @@ // ACME - a crossassembler for producing 6502/65c02/65816/65ce02 code. -// Copyright (C) 1998-2024 Marco Baye +// Copyright (C) 1998-2025 Marco Baye // Have a look at "acme.c" for further info // // Input stuff @@ -1101,14 +1101,11 @@ static STRUCT_DYNABUF_REF(pathbuf, 256); // to combine search path and file spec // copy platform-specific library search path into pathbuf: static void library_path_to_pathbuf(void) { - char *lib_prefix; // depends on platform - dynabuf_clear(pathbuf); - lib_prefix = PLATFORM_LIBPREFIX; - if ((PLATFORM_NEEDS_ENV_VAR) && (lib_prefix == NULL)) { + if ((PLATFORM_NEEDS_ENV_VAR) && (config.platform_lib_prefix == NULL)) { throw_error("\"ACME\" environment variable not found."); } else { - dynabuf_add_string(pathbuf, lib_prefix); + dynabuf_add_string(pathbuf, config.platform_lib_prefix); } } diff --git a/src/platform.c b/src/platform.c index 3f51414..274c943 100644 --- a/src/platform.c +++ b/src/platform.c @@ -1,5 +1,5 @@ // ACME - a crossassembler for producing 6502/65c02/65816/65ce02 code. -// Copyright (C) 1998-2024 Marco Baye +// Copyright (C) 1998-2025 Marco Baye // Have a look at "acme.c" for further info // // Platform specific stuff @@ -34,11 +34,9 @@ #include // for getenv() #include "dynabuf.h" +#include "global.h" // for config -// path of library tree, taken from env var -char *platform_lib_prefix = NULL; - -// function to setup pointer above +// function to setup pointer to library tree from env var void platform_read_env_var(void) { char *env_var; @@ -51,7 +49,7 @@ void platform_read_env_var(void) // copy environment variable to global dynamic buffer dynabuf_add_string(GlobalDynaBuf, env_var); dynabuf_append(GlobalDynaBuf, '\0'); // add terminator - platform_lib_prefix = dynabuf_get_copy(GlobalDynaBuf); + config.platform_lib_prefix = dynabuf_get_copy(GlobalDynaBuf); } } diff --git a/src/platform.h b/src/platform.h index 21180b2..3a4ac97 100644 --- a/src/platform.h +++ b/src/platform.h @@ -1,5 +1,5 @@ // ACME - a crossassembler for producing 6502/65c02/65816/65ce02 code. -// Copyright (C) 1998-2024 Marco Baye +// Copyright (C) 1998-2025 Marco Baye // Have a look at "acme.c" for further info // // Platform specific stuff @@ -45,10 +45,7 @@ extern void platform_convert_path(boolean *is_absolute, char *p); // stuff shared by some, but not all platforms: #if PLATFORM_NEEDS_ENV_VAR -// path to library tree, taken from env var: -extern char *platform_lib_prefix; - -// function to setup pointer above +// function to setup pointer to library tree from env var extern void platform_read_env_var(void); #endif diff --git a/src/version.h b/src/version.h index cab9224..8fd5dcd 100644 --- a/src/version.h +++ b/src/version.h @@ -1,5 +1,5 @@ // ACME - a crossassembler for producing 6502/65c02/65816/65ce02 code. -// Copyright (C) 1998-2024 Marco Baye +// Copyright (C) 1998-2025 Marco Baye // Have a look at "acme.c" for further info // // version info @@ -9,7 +9,7 @@ #define RELEASE "0.97" // update before release FIXME #define CODENAME "Zem" // update before release -#define CHANGE_DATE "5 May" // update before release FIXME +#define CHANGE_DATE "15 Jun" // update before release FIXME #define CHANGE_YEAR "2025" // update before release //#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/" #define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME