flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > macro that creates static array and string table

Author
Thread Post new topic Reply to topic
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 07 Feb 2006, 21:37
Hi,
I need help in creating a macro that stores list of following structures:

Code:
struct TPref
  pPrefType dd ?    
  value     dd ?    
  pszName   dd ? 
  pszGroup  dd ?  
ends    


pszName and pszGroup are pointers to strings. Macro should create list of strings after the table. Writing this macro was very simple:

Code:
macro pref_list pref_name, [lbl,type,value,name,group] {
common
  pref_name:
forward
  local _name,_group
    lbl:
    dd type
    dd value
    dd _name
    dd _group
common
    dd 0   ; terminator
forward
  _name db name, 0
  _group db group, 0
}    


samle macro usage:
Code:
  ; Fresh user preferences
  pref_list FreshPreferences,\
  \       ; name               type            default   name        group
            prefCC,            preftypeFlag,   1,             'CC', 'Editor Settings',\
            prefHelpFile,      preftypeString, 0,       'HelpFile', 'IDE Settings',\
            prefDebugger,      preftypeString, 0,       'Debugger', 'IDE Settings',\
            prefLine,          preftypeString, 0,           'LINE', 'IDE Settings',\
            prefSavePositions, preftypeFlag,   0, 'save positions', 'IDE Settings'    


But, as you can see, strings can be equal sometimes. So macro should define given string only once. Can someone help me with this?
Post 07 Feb 2006, 21:37
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 07 Feb 2006, 22:02
Maybe with the use of the "load" look for the string in already defined data, and only when not found attach a new one? This way if you defined "Settings" after "IDE Settings", it would also find this string inside already made data, etc.

PS. Why are you posting it here?
Post 07 Feb 2006, 22:02
View user's profile Send private message Visit poster's website Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard 07 Feb 2006, 22:17
Sorry, I posted here by mistake, it should go to Macroinstructions Wink Can you move it?

I just realised that some time ago there was similar macro for declaring strings in Fresh, but now it has gone. I will look for it...
Post 07 Feb 2006, 22:17
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.