flat assembler
Message board for the users of flat assembler.
Index
> Main > Redefining the syntax (flat assembler 1.61) Goto page Previous 1, 2, 3, 4, 5 Next |
Do you like the proposed changes (read below)? | ||||||||||||||
|
||||||||||||||
Total Votes : 25 |
Author |
|
halyavin 14 Jun 2005, 09:54
I need separate IncludeIGlobals and IncludeUGlobals macros.
Previously I use this: Code: IncludeIGlobals endofcode: IncludeUGlobals end_of_program: What kglobals.inc I need now? |
|||
14 Jun 2005, 09:54 |
|
MCD 14 Jun 2005, 10:40
Yep, I think you, Privalov, should first add an obselete flag to each topic, or even better, make an obsolete section on this board. And I think it's not your response to move/reedit them all, but rather tell each moderator to move obsolete topics from his section into an own, obsolete section. Anyway, it will be hard work whatever you do.
Just think of all the work needed for all those people working on bigger projects in fasm, like Fresh or MenuetOS. Not quiet to mention the updating problems I got... Luckily this only applies to the preprocessor, especially macro bodies, which usually doesn't make the most part of a code. _________________ MCD - the inevitable return of the Mad Computer Doggy -||__/ .|+-~ .|| || Last edited by MCD on 14 Jun 2005, 14:54; edited 1 time in total |
|||
14 Jun 2005, 10:40 |
|
Tomasz Grysztar 14 Jun 2005, 14:11
halyalvin: I have updated the macros above.
|
|||
14 Jun 2005, 14:11 |
|
MCD 14 Jun 2005, 14:53
WTH does "halyalvin:" mean?
upps, missed this strange nick Last edited by MCD on 15 Jun 2005, 08:23; edited 1 time in total |
|||
14 Jun 2005, 14:53 |
|
pelaillo 14 Jun 2005, 18:12
Look at three posts above yours'
|
|||
14 Jun 2005, 18:12 |
|
halyavin 16 Jun 2005, 05:46
Privalov
Now it works. |
|||
16 Jun 2005, 05:46 |
|
halyavin 16 Jun 2005, 07:13
Misprint in documentation at page approximately 70.
Written: Quote: For example \{ is treated as single symbol, but during processing of the macroinstruction becomes the } symbol. Right: Quote: For example \{ is treated as single symbol, but during processing of the macroinstruction becomes the { symbol. |
|||
16 Jun 2005, 07:13 |
|
halyavin 16 Jun 2005, 07:31
Code: ;win32wxp.inc macro allow_nesting { macro pushd value \{ match ,value \\{ pushx equ \\} match pushx =invoke proc,pushx value \\{ invoke proc push eax pushx equ \\} match pushx,pushx \\{ pushd <value> pushx equ \\} restore pushx \} ... May be Code: match =pushx =invoke proc,pushx value and Code: match =pushx,pushx strings should be written here? |
|||
16 Jun 2005, 07:31 |
|
Tomasz Grysztar 16 Jun 2005, 08:05
What do you mean?
|
|||
16 Jun 2005, 08:05 |
|
halyavin 17 Jun 2005, 12:04
I often see construction
Code: match =something ...,something ...\{ ... something equ \} match =something ...,something ...\{ ... something equ \} ... purge something But previous code in win32wxp.inc don't follow this scheme. Is this an error? |
|||
17 Jun 2005, 12:04 |
|
Tomasz Grysztar 17 Jun 2005, 12:29
Oh, I see what you mean (sorry - didn't read to carefully the last time). But this:
Code: match pushx,pushx just checks whether "pushx" hasn't an empty value. Could be written also this way: Code: match any,pushx The first one of course also replaces the "pushx" inside the match block with the matched value, but when "pushx" is not empty, it doesn't have any value assigned at all, so this will replace "pushx" with "pushx" and everything works. Of course for the same reason your modification would also work correctly. |
|||
17 Jun 2005, 12:29 |
|
vid 21 Jun 2005, 10:11
Privalov wrote: macro ifndef name { match =name, name { } does that mean equates aren't replaced on the left side of match? |
|||
21 Jun 2005, 10:11 |
|
Tomasz Grysztar 21 Jun 2005, 10:15
Indeed - please read carefully the new section 2.3.7 in the manual - I've written it with the purpose to clear out such things about the preprocessing.
The symbols in pattern are more like the definition of parameters for macro, so this should give some intuition about using them. |
|||
21 Jun 2005, 10:15 |
|
vid 21 Jun 2005, 11:17
Privalov wrote: Some cryptic macro sample just for the fun of it: If you can make this to allow nesting, like ExitProcess(GetLastError()), then Randall Hyde MUST rewrite his assemblers review. Or he can even stop his HLA project, FASM wont be HLA's backend, but HLA will be FASM's macro-extension |
|||
21 Jun 2005, 11:17 |
|
vid 23 Jun 2005, 15:27
Privalov:
FASM Manual wrote: This label will be also attached at the beginning of every name starting with dot in the contents of macroinstruction. and FASM Manual wrote: If somewhere inside the definition of structure the name consisting of a single dot it found, it is replaced by the name of the label for the given instance of structure and this label will not be defined automatically in such case, allowing to completely customize the definition. Once you speak about appending names to labels, second time you speak about defining labels and thus namespace, which are different thing. I think (due to behior) second one should be "... instance of structure and this label won't be attached to names starting with dots anywhere in structure, allowing ...". Please justify this. |
|||
23 Jun 2005, 15:27 |
|
Tomasz Grysztar 23 Jun 2005, 15:31
No, this would mean that this:
Code: struc foo { label . .x dd ? } a foo is preprocessed to: Code: label a .x dd ? ; wrong explanation while it actually is: Code: label a a.x dd ? as opposed to: Code: struc foo { .x dd ? } a foo which becomes: Code: a: a.x dd ? |
|||
23 Jun 2005, 15:31 |
|
vid 23 Jun 2005, 16:50
You didn't mention anywhere that such label ("a") gets defined. I think you should add it to documentation
|
|||
23 Jun 2005, 16:50 |
|
vid 15 Jun 2006, 20:18
decard: you should have looked at fasmlib macros:
Code: macro idata arg { __IData equ __IData, ;add one ',' to __IData, initial "__IData" before ','s will be used to call macro macro __IDataBlock ;begin macro (or overload old one) which holds data inside "idata" block arg } macro udata arg { __UData equ __UData, macro __UDataBlock arg } ;include all "idata"-defined blocks macro IncludeIData { macro __IData dummy,[n] ;create macro which will be invoked, [n] makes sure macro's forward will \{ ;be preprocessed for each ',' added to __IData \forward __IDataBlock ;use the macro with data purge __IDataBlock ;and remove it so previous macro becomes avilable \} match I, __IData \{ I \} ;and now unroll __IData macro (just "__IData" wouldn't do, replaced equate isn't ;preprocessed anymore and so it wouldn't beheave as macro usage) purge __IData ;__Idata macro is not needed anymore } ;include all "udata"-defined blocks macro IncludeUData ;... same as IncludeIData but it is whole in virtual to count size and define labels { ;and then required space is reserved macro __UData dummy,[n] \{ \common \local ..begin, ..size ..begin = $ virtual at $ \forward __UDataBlock purge __UDataBlock \common ..size = $ - ..begin end virtual rb ..size \} match U, __UData \{ U \} purge __UData } |
|||
15 Jun 2006, 20:18 |
|
dead_body 17 Jul 2006, 08:42
Code: ;This file contains a test version of hllToFunc macro. ;Use(Initialize): ;hllToFunc MessageBox,ExitProcess ;Test string: ;ExitProcess(<MessageBox(0,"Bear","Good Morning.",0)>) macro hllToFunc [func] { macro func [sParam] \{ \common define status 0 match =0 (),status sParam ;call with no args \\{ call [func] define status 1 \\} match =0 (args),status sParam ;we have string like (arguments). \\{ macro push_args [arg] ;we define push_args macro. \\\{ \\\reverse ;change common to reverse. define status2 0 match =0 func(),status2 arg ;no arguments? \\\\{ call [func] push eax define status2 1 \\\\} match =0 func(args?),status2 arg ;argument is a return function value? \\\\{ hllToFunc func ;slow? recursion. arg ;function will be execute. purge func push eax ;push return arg from function. define status2 1 \\\\} match =0,status2 ;we have simple argument? \\\\{ pushd arg;only in test version!!! in real version it will be push_ex macro. \\\\} \\\} push_args args purge push_args ;kill mecro. call [func] define status 1 \\} match =0 =dd some?,status sParam ;we inside macro import? \\{ func sParam ;we do nothing. define status 1 \\} match =0,status \\{ unknown syntax. \\} \} } this strings(900 copies): Code: GetLastError(GetLastError(GetLastError(GetLastError(GetLastError(GetLastError()))))) compilies on my machine for about 0.500 - 0.800 seconds(in radasm). and i have an idea. what about to do something like this: Code: ... .data __int32 a,b .code EntryPoint: a = 5 cin << b a = sqrt(b) cout << a .end EntryPoint but i have some problems: 1)i can't pass: '>>' value to macro(to do cin >> b) and cin << b - is not very good. 2)i can't do: [a] = 5, because invalid macro name... how can I solve them? and may be it will be good to add directive to preprocessor,like: copyMacro macro_name this directive will add macro(that was defined) to stack of macroses(so will be able to invoke this macro once more). with this directive we will be able to do quick recursion.[/code] |
|||
17 Jul 2006, 08:42 |
|
Goto page Previous 1, 2, 3, 4, 5 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.