You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment ASM6502 opens all included files relative to the current working dir. This leads to problems for example in the following case:
main.a65:
.include "subdir/a.i65"
subdir/a.i65:
.include "b.i65" ; b.i65 in the same directory as a.i65
In this case b.i65 can not be loaded because it is searched in the directory of main.a65 and not within subdir.
Solution
This is tricky to solve in a standard-conformant C89 way without resorting implementation specific functions like POSIX, because the C standard has no knowledge of a) directory separators and b) directory change functions.
What it has is getenv to read environment variables. The most portable solution would be to introduce an environment variable ASM6502 including a search path. This PATH could then be searched if a file is not found in the current directory.
What remains are the different directory separators under different operating systems. The safest way to provide it is to define it via operating system specific makefile and pass it to the C compiler. Path scanning is a bad idea, because as an example RISC OS consideres . as path separator, clashing with the file extension under other operating systems.
The text was updated successfully, but these errors were encountered:
The common procedure for this is:
"file.inc" <- look in local dir first, then use search path
<file.inc> <- use the search path
Search path is norally a system path (i.e. an include/ folder within the package install path), or a path
based on a combination of the system path, the $PATH environment variable, and/or a compiled-in
list of folders.
I have a preliminary version of this, where
- use current dir first (for "" includes)
- use application path (installation path of the assembler), both the main folder as well as the
processor folder
Added will be the inclusion of the VASM_INCLUDE environment variable.
Fred
On Thursday, April 13, 2023 at 05:35:42 AM EDT, Bernd Böckmann ***@***.***> wrote:
Problem Description
At the moment ASM6502 opens all included files relative to the current working dir. This leads to problems for example in the following case:
main.a65:
.include "subdir/a.i65"
subdir/a.i65:
.include "b.i65" ; b.i65 in the same directory as a.i65
In this case b.i65 can not be loaded because it is searched in the directory of main.a65 and not within subdir.
Solution
This is tricky to solve in a standard-conformant C89 way without resorting implementation specific functions like POSIX, because the C standard has no knowledge of a) directory separators and b) directory change functions.
What it has is getenv to read environment variables. The most portable solution would be to introduce an environment variable ASM6502 including a search path. This PATH could then be searched if a file is not found in the current directory.
What remains are the different directory separators under different operating systems. The safest way to provide it is to define it via operating system specific makefile and pass it to the C compiler. Path scanning is a bad idea, because as an example RISC OS consideres . as path separator, clashing with the file extension under other operating systems.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
Problem Description
At the moment ASM6502 opens all included files relative to the current working dir. This leads to problems for example in the following case:
main.a65:
subdir/a.i65:
In this case b.i65 can not be loaded because it is searched in the directory of main.a65 and not within subdir.
Solution
This is tricky to solve in a standard-conformant C89 way without resorting implementation specific functions like POSIX, because the C standard has no knowledge of a) directory separators and b) directory change functions.
What it has is getenv to read environment variables. The most portable solution would be to introduce an environment variable ASM6502 including a search path. This PATH could then be searched if a file is not found in the current directory.
What remains are the different directory separators under different operating systems. The safest way to provide it is to define it via operating system specific makefile and pass it to the C compiler. Path scanning is a bad idea, because as an example RISC OS consideres . as path separator, clashing with the file extension under other operating systems.
The text was updated successfully, but these errors were encountered: