Author Topic: pushtexti & poptexti  (Read 4216 times)

jj2007

  • Member
  • *****
  • Posts: 13873
  • Assembly is fun ;-)
    • MasmBasic
pushtexti & poptexti
« 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...

HSE

  • Member
  • *****
  • Posts: 2465
  • AMD 7-32 / i3 10-64
Re: pushtexti & poptexti
« Reply #1 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
Equations in Assembly: SmplMath

jj2007

  • Member
  • *****
  • Posts: 13873
  • Assembly is fun ;-)
    • MasmBasic
Re: pushtexti & poptexti
« Reply #2 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$...

qWord

  • Member
  • *****
  • Posts: 1475
  • The base type of a type is the type itself
    • SmplMath macros
Re: pushtexti & poptexti
« Reply #3 on: April 26, 2016, 01:11:53 AM »
So what is the point? Redundance of some auxiliary macros?
MREAL macros - when you need floating point arithmetic while assembling!

HSE

  • Member
  • *****
  • Posts: 2465
  • AMD 7-32 / i3 10-64
Re: pushtexti & poptexti
« Reply #4 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?
Equations in Assembly: SmplMath