flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > CREATE_ID simple macro to create identif-s

Author
Thread Post new topic Reply to topic
Blid



Joined: 19 Apr 2007
Posts: 31
Location: Russia, Novorossysk
Blid 05 Aug 2007, 20:55
Code:
CREATE_ID fix DEFINE_ID
macro CREATE_ID begin,[ID]
{

;CREATE_ID 0,ID_CAPTION,IDCLEAR,IDOK,IDCANCEL
;will:
;ID_CAPTION         = 0
;IDCLEAR            = 1
;IDOK               = 2
;IDCANCEL           = 3

common
local counter
  counter = begin
forward
  ID = counter
  counter = counter + 1
common
}
;use it , if need.Find bugs and post it    
    
Post 05 Aug 2007, 20:55
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 05 Aug 2007, 21:03
I was using this one for a while to uniquely identify resources
Code:
macro UID id*
{
  if ~defined UID | ~UID
    UID = 0
  end if
  UID = UID+1
  id  = UID
}    


So, each time I call UID I get a new ID.

Your macro is still good, since it behaves like enum of C and can be used for the same purposes.

Thanks for sharing!
Post 05 Aug 2007, 21:03
View user's profile Send private message Reply with quote
Blid



Joined: 19 Apr 2007
Posts: 31
Location: Russia, Novorossysk
Blid 08 Aug 2007, 07:41
Code:
your macro + my Smile
macro CREATE_ID [id] 
{
common
  if ~defined UID | ~UID 
    UID = 0 
  end if 
forward
 UID = UID + 1
 id = UID 
common
}
;CREATE_ID id_1,id_2
    
Post 08 Aug 2007, 07:41
View user's profile Send private message 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.