The MASM Forum

Projects => MASM32 => Topic started by: jj2007 on April 25, 2016, 09:22:48 PM

Title: pushtexti & poptexti
Post by: jj2007 on April 25, 2016, 09:22:48 PM
macros.asm, lines 2739ff:
Quote
comment * ----------------------------------------------------
        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$
    ENDM

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

Question: What does "case insensitive" mean in this context? The macro language INSTR is (unfortunately) always case sensitive...
Title: Re: pushtexti & poptexti
Post by: HSE on April 26, 2016, 12:27:07 AM
Perhaps in line 2824;
Code: [Select]
    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.
          .ENDIF
        ENDIF
        ;; --------------------------------
        ;; 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
        ELSE
          .if rv(lstrcmpi,$test_vali$,chr$(quoted_text)) == 0
        ENDIF
        ;; *******************************************

        $sw_statei$ equ <if>
    ENDM
Title: Re: pushtexti & poptexti
Post by: jj2007 on April 26, 2016, 12:50:28 AM
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$...
Title: Re: pushtexti & poptexti
Post by: qWord on April 26, 2016, 01:11:53 AM
So what is the point? Redundance of some auxiliary macros?
Title: Re: pushtexti & poptexti
Post by: HSE on April 26, 2016, 04:55:38 AM
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?