flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > [request] command line include Goto page 1, 2 Next |
Author |
|
UCM 20 Apr 2006, 00:00
fasm was designed with NOT having this in mind- the idea is, you can simply compile any file just typing `fasm blah.asm' (and if you get `out of memory' you use -m and increase memory limit), if you did this then people would have to remember to put this as the command line argument.
this is what you could do instead: (putting this in the beginning of the file, of course) Code: OS equ linux ;change it to win32 to use oswin32.inc instead match =linux,OS { include 'oslinux.inc' } match =win32,OS { include 'oswin32.inc' } Note: if you don't understand this, maybe you should read the `Macroinstructions' part of the manual |
|||
20 Apr 2006, 00:00 |
|
okasvi 20 Apr 2006, 01:43
Code: WIN equ 1 ;0 for linux IF WIN = 1 include 'oswin32.inc' ELSE include 'oslinux.inc' ENDIF 'Conditional Assembly' http://flatassembler.net/docs.php?article=manual#2.2.2 |
|||
20 Apr 2006, 01:43 |
|
LocoDelAssembly 20 Apr 2006, 02:13
okasvi, with conditional assembly both macro sets will be included, you must use match instead like UCM. If both, oswin32 and oslinux has a macro named printf then even if "WIN equ 1" is present the linux printf macro will be used.
|
|||
20 Apr 2006, 02:13 |
|
turdus 20 Apr 2006, 11:36
[quote="UCM"]fasm was designed with NOT having this in mind- the idea is, you can simply compile any file just typing `fasm blah.asm' (and if you get `out of memory' you use -m and increase memory limit), if you did this then people would have to remember to put this as the command line argument.
this is what you could do instead: (putting this in the beginning of the file, of course) [/quote] You missed the point!!! It was just an example. The point is NOT PUTTING ANYTHING in the beginning of file. I could have used [code] include mylittlemacros.inc [/code] which is trivial. I think an '-i' switch won't hurt anyone, and you could compile any file just typing 'fasm blah.asm', but others (like me) could type 'fasm -i my.inc blah.asm' too. So, just make it clear: I want have some macros predefined when processing of blah.asm begins. |
|||
20 Apr 2006, 11:36 |
|
Tomasz Grysztar 20 Apr 2006, 11:56
You can do it with environment variables, like:
Code: include 'os%ASMOS%.inc' |
|||
20 Apr 2006, 11:56 |
|
turdus 20 Apr 2006, 12:03
Tomasz Grysztar wrote: You can do it with environment variables, like: I repeat: the point is not putting anything in beginning of file! Forget the example. Focus on the main topic: command line include, predefined macros. Please... won't hurt you, and I would appreciate very much. |
|||
20 Apr 2006, 12:03 |
|
vid 20 Apr 2006, 12:06
okasvi: no, it doesn't work this way. You must use match as UCM showed
|
|||
20 Apr 2006, 12:06 |
|
Tomasz Grysztar 20 Apr 2006, 12:09
OK, so without putting anything in your main file
ECHO include 'oswin32.inc' > tmp.asm ECHO include '%1' >> tmp.asm fasm tmp.asm %2 del tmp.asm |
|||
20 Apr 2006, 12:09 |
|
turdus 20 Apr 2006, 12:54
Tomasz Grysztar wrote: OK, so without putting anything in your main file That's what I call wasting resources Wouldn't be simplier Code:
fasm -i mymacros.inc %1.asm
? It would really really useful. Eg.: Code: fasm -i formattingmacros.inc easytoread.asm fasm -i tasmsyntax.inc tasmcompatible.asm (These are just examples!!!) |
|||
20 Apr 2006, 12:54 |
|
vid 20 Apr 2006, 13:00
it would be easier, but not efficient, because one of best things on fasm is that result depends ONLY on contents of source, so if you can compile source at one place, you can compile it everywhere.
ever tried to compile som multi-platform GCC sources? 95% times you need to go into sources and change some settings or even code. There is a great mess required to make compilation close-to-possible on many systems with this approach. You will appreciate it after you use it a while, believe me |
|||
20 Apr 2006, 13:00 |
|
Tomasz Grysztar 20 Apr 2006, 13:38
This is not really related to SSSO principle, as it is not the thing HOW the source is processed, but WHAT source is processed. This is simply the matter of OS interface. I proposed that simple batch script, to show that it's rather a matter of interface than of fasm's core.
|
|||
20 Apr 2006, 13:38 |
|
turdus 20 Apr 2006, 13:56
Forget it. I've modified the source, now I have predefined macros.
Thanks for your kind help. |
|||
20 Apr 2006, 13:56 |
|
vid 20 Apr 2006, 15:40
do you think it isn't releated to SSSO? I think this would break SSSO (like environment variables do, but this is acceptable useful exception)
|
|||
20 Apr 2006, 15:40 |
|
turdus 20 Apr 2006, 16:07
vid wrote: do you think it isn't releated to SSSO? I think this would break SSSO (like environment variables do, but this is acceptable useful exception) This is also an acceptable useful exception. Nevertheless gcc and nasm also has it. Code: gcc -include file nasm -P file Bye. |
|||
20 Apr 2006, 16:07 |
|
vid 20 Apr 2006, 16:32
Well, it wouldn't probably do any direct bad, but people will tend to use it, even though in 99.9% of cases there is a better solution.
|
|||
20 Apr 2006, 16:32 |
|
Tomasz Grysztar 20 Apr 2006, 16:41
vid wrote: do you think it isn't releated to SSSO? I think this would break SSSO (like environment variables do, but this is acceptable useful exception) This, and environment variables, are both, as I said: "not the thing HOW the source is processed, but WHAT source is processed". In the same way like the path that you give in the command line determines what file will be loaded for processing. The paths given inside the INCLUDE directive are interpreted by the system to find the appropriate file and this is where SSSO cannot be applied. |
|||
20 Apr 2006, 16:41 |
|
vid 20 Apr 2006, 18:04
well, from some point of view. BUt that include file can adjust meaning of things in another file, like overload instruction etc.
|
|||
20 Apr 2006, 18:04 |
|
Tomasz Grysztar 20 Apr 2006, 19:32
Of course - this is a different source then.
But I agree that also, from some other point of view, it may be considered a bit SSSO-breaking, though. |
|||
20 Apr 2006, 19:32 |
|
RedGhost 21 Apr 2006, 11:32
turdus wrote:
nasm is crap compared to fasm, it's a design principle of the assembler and frankly i love it, that's one of the things that really bothered me about nasm was all the command line stuff, i see no reason why preprocessor isn't good enough for you here here i provide another solution even Code: WIN32 = 1 if defined WIN32 include 'win32.inc' else if defined LINUX include 'linux.inc' else display 'choose a platform' end if _________________ redghost.ca |
|||
21 Apr 2006, 11:32 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.