Menu

#14 @Proc text equate

open
nobody
None
5
2010-03-11
2010-03-11
Anonymous
No

"@Proc" (or similar name) text equate to be used in debugging/debug builds.

Like for instance:
%invoke _assert,T(exptxt),T("@FileCur"),@Line,T(@ProcName)

I know this can be emulated by replacing prologue macro but having a builtin equate would be nice and it wouldn't break "release" code ML compatibility.

regards,
drizz

Discussion

  • Nobody/Anonymous

    if it was a bit unclear i was thinking of c/c++ __func__ equivalent;
    to be set inside proc -- endp block

     
  • japheth

    japheth - 2010-03-18

    IIRC I did introduce the OPTION RENAMEKEYWORD for such intentions.

    This is an example how a @ProcName equate will "automatically" contain the name of the current proc:

    [code]
    .386
    .model flat, stdcall

    option renamekeyword:<proc>,_proc
    option renamekeyword:<endp>,_endp

    proc macro name:label, args:vararg
    @ProcName equ <name>
    name _proc args
    endm

    endp macro name:label
    name _endp
    @ProcName equ <>
    endm

    .code

    firstproc proc
    % echo current proc is @ProcName
    ret
    firstproc endp

    secondproc proc
    % echo current proc is @ProcName
    ret
    secondproc endp

    end
    [/code]

     
  • Nobody/Anonymous

    Nice example for the new renamekeyword option!

    But using custom prologue macro in this case would be cleaner since nested macros can cause problems.
    this will fail:
    main proc C <FORCEFRAME> uses esi edi ebx, argc:dword, argv:ptr dword
    %echo current proc is @ProcName
    ret
    main endp

    it's not a problem really, as i said i can work it out with prologue macro what i was hoping for was simplification with built in equate same as C99's __func__.

     

Log in to post a comment.