flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > COM 'interface' macro with inheritance

Author
Thread Post new topic Reply to topic
Abyx



Joined: 17 Apr 2008
Posts: 9
Abyx 11 Jan 2010, 12:07
Code:
macro interface NameBase,[Method]
{
common
  local done
  done equ
  match Name:Base,NameBase \{ interface2 Name, Base, Method
    done equ yes \}
  match ,done \{ interface2 NameBase, ,Method \}
}

macro interface2 Name,Base,[Method]
{
common
  macro Name#_vftable name_
  \{
    match any,Base \\{ ; line break must be here
      Base#_vftable name_ \\}
forward
    name_\#.#Method dd ?
common
  \}

  virtual at 0
    Name#_vftable Name
  end virtual

  struc Name
  \{
    match any, fields@struct \\{ fields@struct equ fields@struct,.,Name, \\}
    match , fields@struct
    \\{
      . dd ?
      virtual at 0
    Name#_vftable .
      end virtual
    \\}
  \}
}
    

usage:
Code:
interface IUnknown,\
           QueryInterface,\
           AddRef,\
           Release

interface ITaskBarList:IUnknown,\
           HrInit,\
           AddTab,\
           DeleteTab,\
           ActivateTab,\
           SetActiveAlt
    
Post 11 Jan 2010, 12:07
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.