flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Remy Vincent
![]() ![]() ![]() ![]() ![]() _________________ Groups lower your IQ |
|||
![]() |
|
Eoin
Well now, macros aren't all bad. Anyway back on topic I came up with a solution;
Code: macro tprocMacro mname,[params] { common macro mname,params { forward CheckParam params common } macro tendpMacro { ; Do something here too } tproc fix tprocMacro tendp fix tendpMacro } It is used as following; Code: tproc MacroCode param1,param2 ; Do stuff tendp Now the remaining problem is that param1 seems to be counted as part of the mname parameter and so only param2 gets passed to the CheckParam macro which is supposed to perform some preprocessing on all the parameters for the macro. I take it the lack of a comma between 'MacroCode param1' is the problem, but putting one there gives an error. |
|||
![]() |
|
Eoin
This seems a bit hacky, but it does work..
Code: macro tprocMacro mname,[params] { common match a b,mname \{ macro a b,params { CheckParam b \} forward CheckParam params } Is there a neater way? |
|||
![]() |
|
Tomasz Grysztar
Quote:
This means that you can do something like: Code: tproc fix tprocMacro
tendp fix } tendpMacro And "tendpMacro" will be evaluated after finishing the definition started with "tprocMacro". |
|||
![]() |
|
Eoin
Thank you for your reply Thomaz, the tendpMacro actually generates some code which needs to go with each instance of the generated macro as opposed to just with its definition, so the ordering tendp fix tendpMacro } works best in my case.
I am still having trouble processing the parameters though. I can't get a consistent method which will work for 0, 1 or 2+ parameters. The one I am using (above) accepts 2+ parameters only and work work with less. |
|||
![]() |
|
Eoin
Ok I think I've come up with a clean solution which works for the different cases.
Code: macro tprocMacro name,[param] { common macro name param { if ~ param eq forward ; Parameter processing here common end if } macro tendpMacro { ; End stuff here } tproc fix tprocMacro tendp fix tendpMacro } In the end it seems quite simple, but sure thats what yo want. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.