Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

pushtexti & poptexti

Started by jj2007, April 25, 2016, 09:22:48 PM

Previous topic - Next topic


macros.asm, lines 2739ff:
Quotecomment * ----------------------------------------------------
        The following macro system for a string comparison
        switch block was designed by Michael Webster. It has
        been slightly modified for case INSENSITIVE comparison.
        ----------------------------------------------------- *

; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
; Macros for storing and retrieving text macros, based on
; the $casstk code from Greg Falen's Switch/Case macros.
; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    $text_stacki$ equ <#>

    pushtexti MACRO name:req
        $text_stacki$ CATSTR <name>, <#>, $text_stacki$

    poptexti MACRO name:req
        LOCAL pos
        pos INSTR $text_stacki$, <#>
        name SUBSTR $text_stacki$, 1, pos-1
        $text_stacki$ SUBSTR $text_stacki$, pos+1

Question: What does "case insensitive" mean in this context? The macro language INSTR is (unfortunately) always case sensitive...


Perhaps in line 2824;    casei$ MACRO quoted_text:REQ
        ;; The case statements will be any statements between the case$ and the following case$,
        ;; else$, or endsw$.
        ;; If this is a following case$, emit a jump to the exit label for this Select/Case and
        ;; terminate the .IF block.
        ;; --------------------------------
        IFIDN $sw_statei$, <if>
          poptexti $end_swi$                 ;; Because there could have been an intervening
          pushtexti $end_swi$                ;; Switch/Case we need to recover the correct
          jmp   $end_swi$                    ;; exit label for this Switch/Case.
        ;; --------------------------------
        ;; Start a new .IF block and update the state global.

        ;; *******************************************
        IFNDEF __UNICODE__
          .if rv(Cmpi,$test_vali$,chr$(quoted_text)) == 0                                     <------- H E R E
          .if rv(lstrcmpi,$test_vali$,chr$(quoted_text)) == 0
        ;; *******************************************

        $sw_statei$ equ <if>
Equations in Assembly: SmplMath


Yes, but poptext and poptexti do exactly the same, except perhaps that they set a different global variable, i.e. $text_stack$ vs $text_stacki$...


So what is the point? Redundance of some auxiliary macros?
MREAL macros - when you need floating point arithmetic while assembling!


I think it's a label thing, and it' case sensitive. Only the string comparison is case insensitive. That means that you can write several times the same label with diferent case?
Equations in Assembly: SmplMath