added CLI option to override path to ACME library

git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@438 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
marcobaye
2025-06-16 21:15:35 +00:00
parent 1a6184fd85
commit ed36ca72da
9 changed files with 24 additions and 26 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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 <stdlib.h> // 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);
}
}

View File

@@ -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

View File

@@ -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