News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Macro szCmp help !

Started by theunknownguy, June 17, 2010, 09:14:14 PM

Previous topic - Next topic

qWord

ok, i did not full understand your concept, but these macros may help you:
declare_proc macro name:req
IFNDEF dclp_cntr
dclp_cntr = 0
ENDIF
@CatStr(<dclp_proc_>,%dclp_cntr) TEXTEQU <&name>
dclp_cntr = dclp_cntr + 1
endm

; returns zero-based index or -1 if proc not found
get_proc_index macro name:req
IFNDEF dclp_cntr
.err <xyz>
EXITM <-1>
ENDIF
gpi_cntr = 0
gpi_flag = 0
REPEAT dclp_cntr
% IFIDN <@CatStr(<dclp_proc_>,%gpi_cntr)>,<&name>
gpi_flag = 1
EXITM
ENDIF
gpi_cntr = gpi_cntr + 1
ENDM
IF gpi_flag
EXITM %gpi_cntr
ELSE
.err <function not found>
EXITM <-1>
ENDIF
endm



declare_proc Test1
declare_proc abc
declare_proc def

%echo get_proc_index(def)
FPU in a trice: SmplMath
It's that simple!

theunknownguy

Quote from: qWord on June 17, 2010, 11:28:39 PM
ok, i did not full understand your concept, but these macros may help you:
declare_proc macro name:req
IFNDEF dclp_cntr
dclp_cntr = 0
ENDIF
@CatStr(<dclp_proc_>,%dclp_cntr) TEXTEQU <&name>
dclp_cntr = dclp_cntr + 1
endm

; returns zero-based index or -1 if proc not found
get_proc_index macro name:req
IFNDEF dclp_cntr
.err <xyz>
EXITM <-1>
ENDIF
gpi_cntr = 0
gpi_flag = 0
REPEAT dclp_cntr
% IFIDN <@CatStr(<dclp_proc_>,%gpi_cntr)>,<&name>
gpi_flag = 1
EXITM
ENDIF
gpi_cntr = gpi_cntr + 1
ENDM
IF gpi_flag
EXITM %gpi_cntr
ELSE
.err <function not found>
EXITM <-1>
ENDIF
endm



declare_proc Test1
declare_proc abc
declare_proc def

%echo get_proc_index(def)


You rulz thanks so much going to test it right now  :cheekygreen:

PS: It takes the index in base of the order of setting isnt?

qWord

Quote from: theunknownguy on June 17, 2010, 11:32:39 PM
PS: It takes the index in base of the order of setting isnt?
yes, in the order of declaration.
FPU in a trice: SmplMath
It's that simple!

theunknownguy

Can i request this thread to be deleted or leave my first post only  + final answer of qword please.

Thanks much for the help.

Farabi

Using macro for string compare can make your app size bigger but faster, using proc can make it slower but less byte added each time you compare the string.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

hutch--

theunknownguy,

> Can i request this thread to be deleted or leave my first post only  + final answer of qword please.

No as a matter of fact, this forum is among other things a database for other members to read and use and the development of a thread from its first post to any answers it may receive is preserved for other members to read.

You should not treat this forum like a paid help desk, you could not afford the costs involveed if it was.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

theunknownguy

Quote from: hutch-- on June 18, 2010, 03:29:33 PM
theunknownguy,

> Can i request this thread to be deleted or leave my first post only  + final answer of qword please.

No as a matter of fact, this forum is among other things a database for other members to read and use and the development of a thread from its first post to any answers it may receive is preserved for other members to read.

You should not treat this forum like a paid help desk, you could not afford the costs involveed if it was.

I think you get it wrong, but no worry the stupid nickname i use nobody will track to this forum at least...

But has i say there are post here that doesnt involve the problem, where just aditional info for qWord. Does anyone need to read that? (nothing releated to the problem)

I tought post where preserved for other members to read when the question / answer have vital information for solve the problem...

But still was just a request. And i dont treat the forum has a paid help desk, but yeah i could afford the costs, money is not a problem if that what you mean.

PS: At least on my world everything have a price.