flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Macroinstructions > Array of String->String: Unsetable

Author
Thread Post new topic Reply to topic
l4m2



Joined: 15 Jan 2015
Posts: 570
Array of String->String: Unsetable

Code:
macro tmp {
  local type
  macro ucall fun, [arg] \{
    common
    local n
    if defined type#fun
      type#fun arg
    else
      push edi
      n=0
      reverse
      pushd arg
      n=n+4
      common
      lea edi, [esp+n]
      call fun
      mov espedi
      pop edi
    end if
  \}
  macro setcall funt \{
    type#fun equ t
  \}
}
tmp
purge tmp

setcall fun1cdecl
use32
ucall fun11
fun1:


I mean to have fun using the calling type when set, and if not, just use the common way. However, the code made a 15-byte bin file, meaning that setcall was ignored.
Post 06 Aug 2016, 15:32
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6253
Location: Kraków, Poland
Your "if defined type#fun" line becomes "if defined cdecl" (because "equ" defines symbolic variable that is replaced text-for-text by the preprocessor), and "defined" only checks for existence of a label / numeric variable, it does not check for the existence of a macro.
Post 06 Aug 2016, 16:24
View user's profile Send private message Visit poster's website Reply with quote
l4m2



Joined: 15 Jan 2015
Posts: 570

Tomasz Grysztar wrote:
Your "if defined type#fun" line becomes "if defined cdecl" (because "equ" defines symbolic variable that is replaced text-for-text by the preprocessor), and "defined" only checks for existence of a label / numeric variable, it does not check for the existence of a macro.

Solved.

Code:
    match =type#funtype#fun \\{
      r equ 0
    \\}
    if ~defined r

works.
Post 06 Aug 2016, 16:59
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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.