flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Fill struct like in c |
Author |
|
Tomasz Grysztar 17 Mar 2016, 12:20
It may not be possible with fasm 1 macros, but with the fasm g engine you could do something like this:
Code: macro __fill sname,arg& irp definition, arg match name==value, definition display `sname,`name,' filled with value ',`value,13,10 ; store value at sname#name else display 'invalid syntax: ',`definition,13,10 end match end irp end macro macro Fill sname,first& macro ? line& match single=, ,line __fill sname,single else __fill sname,line purge ? end match end macro first end macro Fill fb_infor,.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, .pNext = NULL, .renderPass = 0, .attachmentCount = 2, .pAttachments = attachments0, .width = 12, .height = 12, .layers = 1 |
|||
17 Mar 2016, 12:20 |
|
l_inc 17 Mar 2016, 13:05
Tomasz Grysztar
Quote: It may not be possible with fasm 1 macros It is possible, but not nice. I guess the following syntax for structure definition would be well perceived: Code: Fill fb_infor : sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO pNext = NULL ;... ends fb_infor This is also possible with fasm 1, but it may further simplify and robustify implementation if every line in the structure definition required to specify a keyword at the beginning like item . P.S. I actually missed that Fill is a macro, and not a structure identifier, and fb_infor is a structure identifier, and not a structure type identifier. In any case implementing the fill in fasm 1 would require to go into the internals of the struct macro. In the requested syntax it would be enough (but again, not nice) to enumerate the list fields@VkFramebufferCreateInfo and to redefine the field names with macros, but the name VkFramebufferCreateInfo should then be made exposed by the struct macros. _________________ Faith is a superposition of knowledge and fallacy |
|||
17 Mar 2016, 13:05 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.