flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > How do you use match to split at a .

Author
Thread Post new topic Reply to topic
MichaelH



Joined: 03 May 2005
Posts: 402
MichaelH 22 Jan 2007, 02:23
How do you use match to split at a .

Example using :

Code:
macro doCall param 
{ 
        match library:proc,param 

        etc etc ......
}


doCall kernel32:ExitProcess

    


Works because : is a symbol character, library and proc are separated Smile



Code:
macro doCall param 
{ 
        match library.proc,param 

        etc etc ......
}


doCall kernel32.ExitProcess

    


Does not work. I've reread the docs, looked at include file all over the place, but still can't work it out Sad
Post 22 Jan 2007, 02:23
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 22 Jan 2007, 06:19
"." is normal character, just like any of a-z, A-Z, 0-9. That would be same as trying to split "kernel32xExitProcess"
Post 22 Jan 2007, 06:19
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
MichaelH



Joined: 03 May 2005
Posts: 402
MichaelH 22 Jan 2007, 09:41
Quote:

That would be same as trying to split "kernel32xExitProcess"


Below, doCall1 prints out "kernel32 ExitProcess" because : is a symbol character, but as you say . is not a symbol character, it's a normal character. So what is the syntax to achieve the same print out with doCall2 using a non symbol character like a dot?

Clearly it must be easy but it seems I'm to stupid to work it out Sad



Code:
macro doCall1 param 
{ 
        match library:proc, param 
        \{
                display \`library, ' ', \`proc, 13,10
        \}
}

macro doCall2 param 
{ 
        match library.proc, param 
        \{
                display \`library, ' ', \`proc
        \}
}


doCall1 kernel32:ExitProcess
doCall2 kernel32.ExitProcess
    



output:

doCall1 = kernel32 ExitProcess
doCall2 = library proc <-- wrong
Post 22 Jan 2007, 09:41
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 22 Jan 2007, 12:06
Quote:
So what is the syntax to achieve the same print out with doCall2 using a non symbol character like a dot?
none. think of the problem, as if you would want "x" to become separator. for example "doCall2" would have to split "abcxyz" to "abc" and "yz". It is exactly same problem as with ".". There is no (normal) solution i know to that.
Post 22 Jan 2007, 12:06
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
MichaelH



Joined: 03 May 2005
Posts: 402
MichaelH 22 Jan 2007, 12:35
So there is no solution Shocked

Seems strange to be able to concat a string but not split it. Oh well, thanks for the reply.

Does anyone have a complicated macro way of doing this?
Post 22 Jan 2007, 12:35
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 22 Jan 2007, 13:59
MichaelH: thing about "`", "load" and "store". that is the ugly way.
Post 22 Jan 2007, 13:59
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
afw2004



Joined: 16 Jun 2005
Posts: 49
Location: Kharkov, Ukraine
afw2004 22 Jan 2007, 15:57
Is it possible to parse GUID string {XXXXXXXX-XXXX-XXXX-XXXXXXXXXX} into GUID struct using "match" keyword? How to split last XXXXXXXXXX into db 0XXh,0XXh,0XXh,0XXh,0XXh,0XXh,0XXh,0XXh,0XXh,0XXh ?
Post 22 Jan 2007, 15:57
View user's profile Send private message ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 22 Jan 2007, 16:31
afw2004: i am afraid, you will need ugly `/load/store tricks again. If the number would fit into dq, it would be much easier.
Post 22 Jan 2007, 16:31
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 22 Jan 2007, 16:40
afw2004 wrote:
Is it possible to parse GUID string {XXXXXXXX-XXXX-XXXX-XXXXXXXXXX} into GUID struct using "match" keyword? How to split last XXXXXXXXXX into db 0XXh,0XXh,0XXh,0XXh,0XXh,0XXh,0XXh,0XXh,0XXh,0XXh ?

Have you seen the GUID macro in the USECOM example in standard Win32 package?
Post 22 Jan 2007, 16:40
View user's profile Send private message Visit poster's website Reply with quote
afw2004



Joined: 16 Jun 2005
Posts: 49
Location: Kharkov, Ukraine
afw2004 22 Jan 2007, 16:59
Thanks Smile
Post 22 Jan 2007, 16:59
View user's profile Send private message ICQ Number Reply with quote
MichaelH



Joined: 03 May 2005
Posts: 402
MichaelH 22 Jan 2007, 20:01
Tomasz since match already can separated using symbol characters, would it be out of the question to have match be able to split a string with non symbol characters or is that just too difficult?

split is a very powerful function in javascript and having it in fasm macros would to great if it could be done.
Post 22 Jan 2007, 20:01
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 22 Jan 2007, 21:57
I agree that this would be an useful addition to preprocessor, however I really don't understand the reference to JavaScript. Wink
Post 22 Jan 2007, 21:57
View user's profile Send private message Visit poster's website Reply with quote
MichaelH



Joined: 03 May 2005
Posts: 402
MichaelH 22 Jan 2007, 22:55
Yes, you are right, sorry Smile

Given what you still have to achieve with a debug format for fasm etc, I suspect this idea will not happen for some time?
Post 22 Jan 2007, 22:55
View user's profile Send private message Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body 12 Mar 2007, 12:54
MichaelH wrote:
Tomasz since match already can separated using symbol characters, would it be out of the question to have match be able to split a string with non symbol characters or is that just too difficult?


when we can expect this improvement?
Post 12 Mar 2007, 12:54
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.