News:

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

macro question

Started by korte, March 20, 2007, 11:31:27 AM

Previous topic - Next topic

korte


I writing

  prop   color=value

step 1:
convert string "color=value" to "color,value"

step 2:
"color" is defined stucture tag
"xxx" is defined constant point to strucure array.
store "value" to "xxx.color"

possible only macro?

push $
org xxx.color
dd value
pop $








korte


prop macro p1,p2
    local q1,q2
    q1 WINDOW {1,2,3,4}
    q2 equ $
    org q1+WINDOW._WINDOW_&p1
    dd p2
    org q2
    endm

prop Y,100

it is work, but not nice.
nice is :  prop y=100


korte

not work :-(

WINDOW_DEF   macro p1,p2,p3,p4,p5,p6,p7,p8
lastwin = $
   WINDOW {p1,p2,p3,p4,offset WINDOWS_&p5&_Proc,p6,p7,p8}

   endm


prop macro p1,p2
   local q2
q2 equ $
   org lastwin+WINDOW._WINDOW_&p1  <<<<<<<<<<<<<<<<<------ error this line
   dd p2
   org q2
endm

dialog1   label byte
   WINDOW_DEF   30,30,80,20,stdButton,WS_SHOW | WS_DEF,1,1
   WINDOW_DEF   30,80,80,20,stdButton,WS_SHOW0,2,2
       prop X,100

MichaelW

#3
korte,

You would have a greater chance of getting useful help if you would provide more information and/or more code. For example, you have apparently defined a WINDOW structure, but we have no way of knowing exactly what that structure is. We also have no way of knowing what symbols have been defined at the point of the macro calls. With no clear explanation of what you are trying to do, and only small snippets of code, much of which do not work, there are just too many unknowns.

eschew obfuscation

korte

ok.

Unpacking my idea (sorry litle english)


first macro define and fill structure (not all data fillin only first 7)

window struc
.
.
.
_window_color
.
.
window ends
defi macro p1,p2,p3,p4,p5,p6,p7
  _last_win = $
window {p1,p2,p3,p4,p5,p6,p7}

and calling data segment

defi 100,100,100,30,0,0,0
defi 200,100,100,30,0,0,0
defi 300,100,100,30,0,0,0

defining 3 window, setting pos and any sturct data leave 0. (default value)
Want second macro filling last defined window x structue tag value

defi 100,100,100,30,0,0,0
defi 200,100,100,30,0,0,0
defi 300,100,100,30,0,0,0
       prop _window_color,100

"_last_win" (define first macro) pointing begin of last stored stucture

prop macro p1,p2
   local q2
q2 equ $  ; storing position
   org _lastwin+WINDOW.p1  <<<<<<<<<<<<<<<<<------ error this line
   dd p2
   org q2
endm

masm error "_lastwin not a constant"

if change
" _lastwin=$"  to "_lastwin equ $"
no error first calling bit second calling error "_lastwin redefinition)

I want to VB stile form definition.
First line define requiered parameter and second macro (prop) setting not default parameter, optional color and font size...




korte

WORK :-)

WINDOW   STRUCT
_WINDOW_X      DD   ?
_WINDOW_Y      DD   ?
_WINDOW_WIDTH      DD   ?
_WINDOW_HEIGHT      DD   ?
_WINDOW_PROC             DD      ?
_WINDOW_STYLE      DD   ?
_WINDOW_ID      DD   ?
_WINDOW_VALUE      DD   ?

_WINDOW_STATE     DD   ?
_WINDOW_CLASS     DD   ?
_WINDOW_PARRENT   DD   ?
_WINDOW_SCRADDR   DD   ?
_WINDOW_ESI      DD   ?
_WINDOW_MEM      DD   ?
_WINDOW_HMEM      DD   ?
_WINDOW_FONT      DD   ?
_WINDOW_PAR_1            DD      ?
_WINDOW_PAR_2            DD      ?
_WINDOW_PAR_3            DD      ?
_WINDOW_PAR_4            DD      ?
_WINDOW_PAR_5            DD      ?
WINDOW ENDS





WINDOW_DEF   macro p1,p2,p3,p4,p5,p6,p7,p8
lastwin = $
   WINDOW {p1,p2,p3,p4,offset WINDOWS_&p5&_Proc,p6,p7,offset p8}

   endm


prop macro p1,p2
   local _prop
   org $-sizeof(WINDOW)
_prop:
   org  $+WINDOW._WINDOW_&p1
   dd   p2
   org _prop +sizeof(WINDOW)
endm


.
.
.
.

dialog1 label byte
        WINDOW_DEF      30,30,200,50,Edit,0,1,edit_duma

        WINDOW_DEF      100,360,60,60,stdButton,0,2,gomb_pont
        WINDOW_DEF      000,000,0,60,stdButton,0,2,gomb_minusz
      prop Y,360
      prop X,170
                                prop WIDTH,60
        WINDOW_DEF      30,430,200,60,stdButton,0,2,gomb_bevitel


        TableEnd