flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Stoping the compilation

Author
Thread Post new topic Reply to topic
zenek_tm



Joined: 21 Mar 2004
Posts: 33
Location: Poland
zenek_tm 14 Apr 2004, 14:59
Hi.

I'm trying to write some useful OOP macros for fasm. I have some ideas, but I need to know one thing. Is there a special directive that stops the compilation? Something like:
Code:
macro testing
{
  if defined foo
    display 2, 'Error!', 13, 10
    exit
  else
     ; the rest of the macro
  endif
}    
Well it can be done by simply putting an unknown command, but I'm looking for some clean way to do this. Can you help me?
Post 14 Apr 2004, 14:59
View user's profile Send private message Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 14 Apr 2004, 15:19
AFAIK there's no such directive in FASM Confused
Post 14 Apr 2004, 15:19
View user's profile Send private message Visit poster's website Reply with quote
zenek_tm



Joined: 21 Mar 2004
Posts: 33
Location: Poland
zenek_tm 14 Apr 2004, 17:10
Ok something else then.

I have declared a constant
Code:
value = 10    
How can I concatenate the value of this constant with other label? This code
Code:
foo#value    
will produce label foovalue and I want a label foo10. It is important to me to have control over the value that is concatenated. How can I achieve this? Just don't tell me it's impossible Smile
Post 14 Apr 2004, 17:10
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 14 Apr 2004, 19:27
impossible (sorry). I got fooled with this too. And due to FASM internal way it works it won't be possible unless some really REALLY big internal changes will be made.

You can obtain similar results by using macro with group argument, in "forward" or "reverse" block. If you give me more concrete example i'll (maybe) show you how.
Post 14 Apr 2004, 19:27
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
zenek_tm



Joined: 21 Mar 2004
Posts: 33
Location: Poland
zenek_tm 14 Apr 2004, 21:16
This is what I want to achieve. It's macro to declare fields in class.
Code:
macro var variable
{
  fields#className = fields#className + 1
  numer = fields#className
  field#className#numer equ .#variable ; the dot is there so the fields can be declared without it
}
    
className holds the name of the class that is currently being defined. fields#className is supposed to hold the number of fields declared (it increases with each field declaration). field#className#1, field#className#2 etc. should hold the definition passed in <>. These are suposed to be used later to generate the struc with all these fields. If it's possible to write it with group argument, I'll be most grateful for at least some example.

I also ask you to check if the syntax in this macro is correct, since I'm still learning it and this macro does not work at all, so there is no way I can test it.
Post 14 Apr 2004, 21:16
View user's profile Send private message Reply with quote
zenek_tm



Joined: 21 Mar 2004
Posts: 33
Location: Poland
zenek_tm 14 Apr 2004, 21:31
Useful ideas always come late I guess Smile
I believe that this macro should solve my problem. I have no time to test it now though.
Code:
macro var [variable]
{

  ; field counter is not necessary here
  common
    fields#className fix variable ; something like this is in proc macro
}
    
And later to create a structure out of them.
Code:
macro createstruc
{
  struc className _%
    forward
      fields#className ; or maybe even .#fields#className but that I can't tell now
    ; other declarations
  %_
  struct className
}
    
Of course the struc will also have some other fields from what is in my head. I will test this code tomorrow, so if you see any bugs just let me know.
Post 14 Apr 2004, 21:31
View user's profile Send private message Reply with quote
zenek_tm



Joined: 21 Mar 2004
Posts: 33
Location: Poland
zenek_tm 15 Apr 2004, 17:39
I solved this problem and started a seperate thread about the macros i'm writing. Any further questions about those macros will be placed in that thread.
Post 15 Apr 2004, 17:39
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.