z00m128 / sjasmplus

Command-line cross-compiler of assembly language for Z80 CPU.
http://z00m128.github.io/sjasmplus/
BSD 3-Clause "New" or "Revised" License
383 stars 54 forks source link

Add expression to concatenate strings #246

Open vmorilla opened 1 month ago

vmorilla commented 1 month ago

sjasmplus does not seem to allow expressions involving strings, more specifically, the concatenation.

In my case, I am trying to produce output files with a different name that depend on an environment variable to control some localization outputs. So far, I am doing something like this:

        DEFINE LANG 1
        IF LANG = 1
            DEFINE SNAFILE "build/zx_en.sna"
            DEFINE TAPFILE "build/zx_en.tap"
        ELSE
            IF LANG = 2
                DEFINE SNAFILE "build/zx_fr.sna"
                DEFINE TAPFILE "build/zx_fr.tap"
            ELSE
                DEFINE SNAFILE "build/zx_es.sna"
                DEFINE TAPFILE "build/zx_es.tap"
            ENDIF
        ENDIF 

which is quite cumbersome. Rather than that, I would like to do something like this:

Suggested solution:

        DEFINE LANG "ES"
        DEFINE SNAFILE "build/zx_" + LANG +  ".sna"
        DEFINE TAPFILE "build/zx_" + LANG + ".tap"

where '+' (or any alternative operator) produces the concatenation of two strings.

Thanks!