News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Cute macro problem

Started by hutch--, October 11, 2011, 02:13:31 AM

Previous topic - Next topic

hutch--

Yes, that works correctly with the equated name not being substituted. Gratsie  :U
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

hutch--

Solution for the problematic macro was simple, get rid of either FORC or WHILE loops and code a label with a GOTO to it. The main idea was to not let MASM see the complete string outside of quotes so it did not do the substitution with the API equate.


    ;; ============================================

      lcnt SIZESTR <quoted@@text>
      lcnt = lcnt - 2
      cntr = 2

      c_n_t_r = 0

      :lpstart

        argz SUBSTR <quoted@@text>,cntr,1

          if c_n_t_r lt 1
            slice@1 CATSTR slice@1,<">,argz,<">
            goto nxt
          elseif c_n_t_r lt 40
            slice@1 CATSTR slice@1,<,">,argz,<">
            goto nxt

          elseif c_n_t_r lt 41
            slice@2 CATSTR slice@2,<">,argz,<">
            goto nxt
          elseif c_n_t_r lt 80
            slice@2 CATSTR slice@2,<,">,argz,<">
            goto nxt

          elseif c_n_t_r lt 81
            slice@3 CATSTR slice@3,<">,argz,<">
            goto nxt
          elseif c_n_t_r lt 120
            slice@3 CATSTR slice@3,<,">,argz,<">
            goto nxt

          elseif c_n_t_r lt 121
            slice@4 CATSTR slice@4,<">,argz,<">
            goto nxt
          elseif c_n_t_r lt 160
            slice@4 CATSTR slice@4,<,">,argz,<">
            goto nxt

          elseif c_n_t_r lt 161
            slice@5 CATSTR slice@5,<">,argz,<">
            goto nxt
         elseif c_n_t_r lt 200
            slice@5 CATSTR slice@5,<,">,argz,<">
            goto nxt

          elseif c_n_t_r lt 201
            slice@6 CATSTR slice@6,<">,argz,<">
            goto nxt
          elseif c_n_t_r lt 240
            slice@6 CATSTR slice@6,<,">,argz,<">
            goto nxt
          endif

      :nxt
        c_n_t_r = c_n_t_r + 1

        cntr = cntr + 1
        lcnt = lcnt - 1
        if lcnt ne 0
          goto lpstart
        endif

    ;; ============================================
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php