flat assembler
Message board for the users of flat assembler.

flat assembler > Main > define and init array of structures

Author
Thread Post new topic Reply to topic
_ensein



Joined: 10 Oct 2003
Posts: 3
hi,

I've been searching the board and there's lots questions on this subject but none seems to anwser my question..

in masm I could do something like this to define and initialize an array of structures:

Code:
tbbtn1   TBBUTTON <0,IDTB_CONST,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0,0>
         TBBUTTON <1,IDTB_CONST+1,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0,0>
         TBBUTTON <2,IDTB_CONST+2,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0,0>
         TBBUTTON <3,IDTB_CONST+3,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0,0>
         TBBUTTON <0,0,TBSTATE_ENABLED,TBSTYLE_SEP,0,0,0>
         TBBUTTON <4,IDTB_CONST+4,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0,0>
    



is it possible to do something similar in fasm?
I have little knowledge on macros..
Post 10 Oct 2003, 10:56
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
Hi _ensein. Welcome on board. Smile

Well, structures in standard Win32 include files are undefined. You have to redefine the structure, using parameters. In FASM, structures and mactoses have similar behaviour, so you can use parameters for "struc" operator. I have no time to write TBBUTTON for you, but will give you small example and you can try to make it:
Code:
; definition
struc MyStruc  fld1, fld2, fld3 {
  .Field1  dd fld1
  .Field2  db fld2
  .Field3  db fld3
}

virtual at 0 ; This is instead of "struct" macro, because of arguments.
  MyStruc MyStruc ?, ?, ?
  sizeof.MyStruc = $
end virtual

; using: You have to put label before structure.
; Fortunately FASM allows equal names for macroses and structures, so
; you can define macros with same name:

macro MyStruc fld1, fld2, fld3 {
  local lbl
  lbl MyStruc fld1, fld2, fld3
}

; Now you can use it this way:

var1 MyStruc 1234, 123, 21 
        MyStruc 3424, 32, 27
        MyStruc  234, 1, 2
    
Post 10 Oct 2003, 11:44
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
_ensein



Joined: 10 Oct 2003
Posts: 3
thank you Very Happy !

I'll be working on it
Post 10 Oct 2003, 12:06
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7272
Location: Kraków, Poland
Please look also at this thread: http://board.flatassembler.net/topic.php?t=273
Post 13 Oct 2003, 08:07
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2019, Tomasz Grysztar.

Powered by rwasa.