Menu

#111 Jwasm expands macros inside quoted text

v208
closed
nobody
None
5
2012-09-01
2010-12-23
jj2007
No

xPrint "These are My$(0) and My$(1): ", chr$(13, 10), My$(0), chr$(13, 10), My$(1), chr$(13, 10)

My$() macro gets expanded also inside the quotes. MASM behaviour is different.

Discussion

  • jj2007

    jj2007 - 2010-12-23

    Full example with echos showing repeated calls to My$()

     
  • japheth

    japheth - 2010-12-23

    > "Jwasm expands macros inside quoted text"

    Masm may do this also - it requires the '%' operator at the beginning of a line AND the '&' operator in the quoted string. JWasm currently doesn't need the '&'.
    My testcase is:

    ---------------------------------------------------
    .386
    .model flat, stdcall

    TE1 equ <abc>

    m1 macro text
    db text
    endm
    m2 macro text
    % db text
    endm

    .data

    db "TE1"
    db "&TE1"
    m1 "TE1"
    m1 "&TE1"
    m2 "TE1"
    m2 "&TE1" ;expands

    % db "TE1"
    % db "&TE1" ;expands
    % m1 "TE1"
    % m1 "&TE1" ;expands
    % m2 "TE1"
    % m2 "&TE1" ;expands

    end
    ---------------------------------------------------

    I'm not sure if this will be fixed for v2.05 final. It is no regression. May be left for v2.06 to fix.

     
  • jj2007

    jj2007 - 2010-12-28
    • priority: 5 --> 7
     
  • japheth

    japheth - 2011-01-02

    changed priority back to 5.

    JJ, please note that I'd like to reserve priorities > 5 to regressions and crashes.

    As far as this peculiar error is concerned: I understand if it's annoying, but a fix requires a change it the macro argument parser, which is planned to be changed in v2.06 anyway. So I really like to avoid double work and delay this fix to 2.06.

     
  • japheth

    japheth - 2011-01-02
    • priority: 7 --> 5
     
  • jj2007

    jj2007 - 2011-06-22

    Japheth,

    I see in the v2.06 history.txt
    - a text macro which contained a macro function call and extra chars
    might not have been expanded correctly if it was used as an argument
    in one of the string directives.
    That looks like you've attacked this problem. However, the macro expansion inside quoted text persists for the two examples below...

    include \masm32\MasmBasic\MasmBasic.inc ; http://www.masm32.com/board/index.php?topic=12460
    Init

    Let esi=Chr$("This text was should show Str", "ing$(32767, 32) in Mixed Case: String$(32767, 32)")
    PrintLine esi

    Dim Test$(99)
    Let Test$('A')=String$(32767, 32)
    Bmove Chr$("This text was bmoved into a String$(32767, 32) in Test$('A')"), Test$('A')
    Inkey Test$(65)

    Exit
    end start

    Output:
    JWasm:
    This text was should show String$(32767, 32) in Mixed case: ( eAx)
    This text was bmoved into a ( eAx) in ( EaX)

    Masm:
    This text was should show String$(32767, 32) in Mixed Case: String$(32767, 32)
    This text was bmoved into a String$(32767, 32) in Test$('A')

     
  • japheth

    japheth - 2011-06-23

    > That looks like you've attacked this problem.

    No, sorry! There is no simple word-around for this issue and the general clean-up of jwasm's expansion functionality - which was sort of planned for v2.06 - is delayed until ( hopefully ) v2.07.

     
  • japheth

    japheth - 2012-07-21
    • milestone: --> v208
     
  • japheth

    japheth - 2012-07-21

    will be fixed in v2.08

     
  • japheth

    japheth - 2012-09-01
    • status: open --> closed
     

Log in to post a comment.