flat assembler
Message board for the users of flat assembler.
Index
> Main > Conditional inclusion: MATCH and definitions ? |
Author |
|
vid 11 Sep 2005, 09:00
you can't define equates externally, this was already discussed somewhere on board. FASM's philosophy is that contents of generated file depends ONLY on contents of source file. It's quite easy to define it somewhere by the beginning of file.
|
|||
11 Sep 2005, 09:00 |
|
james 11 Sep 2005, 20:46
Vid,
thanks, but then its not conditional. No need for match then. rgs, james. |
|||
11 Sep 2005, 20:46 |
|
Tomasz Grysztar 11 Sep 2005, 21:42
You can have environment variable with the name of include file, like DEBUG=debug.inc or DEBUG=nul, and then include it like:
Code: include '%DEBUG%' |
|||
11 Sep 2005, 21:42 |
|
james 12 Sep 2005, 04:26
Tomasz,
Setting an environment variable seems a little much when trying to do conditional preprocessing. I was hoping you could do a "-d os=win32" on the command line and then in code do a Code: match =win32, OS { include 'win32ax.inc' } This seems to be a defacto standard approach, but I appreciate FASM is different and "flat". I can get around this with a batch (.bat) file and a shell script (.sh) but it doesnt seem as elegant. BTW Tomasz, any chance of an example source to making a shared library under linux ? Rgs, James. |
|||
12 Sep 2005, 04:26 |
|
james 02 Oct 2005, 03:06
Can anyone show a working example using match ?
|
|||
02 Oct 2005, 03:06 |
|
revolution 02 Oct 2005, 06:09
You can also use something like this:
File MyApp-osWIN32.asm: Code: OS equ WIN32
include "MyApp.asm" File MyApp-osLINUX.asm Code: OS equ LINUX
include "MyApp.asm" File MyApp-osWIN32-debug.asm: Code: OS equ WIN32
DEBUG equ TRUE
include "MyApp.asm" File MyApp-osLINUX-debug.asm Code: OS equ LINUX
DEBUG equ TRUE
include "MyApp.asm" File MyApp.asm: Code: match =WIN32,OS {;stuff for win32 goes here} match =LINUX,OS {;stuff for linux goes here} match =TRUE,DEBUG {;debugging stuff goes here} |
|||
02 Oct 2005, 06:09 |
|
revolution 02 Oct 2005, 06:16
Also try this:
File FASM-debug.bat: Code: @echo DEBUG equ TRUE >FASM-debug.abc @echo include '%1.asm' >>FASM-debug.abc @fasm FASM-debug.abc %1.exe @del FASM-debug.abc |
|||
02 Oct 2005, 06:16 |
|
james 02 Oct 2005, 06:54
thanks for the examples. They help me a lot.
|
|||
02 Oct 2005, 06:54 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.