flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > ada syntax

Author
Thread Post new topic Reply to topic
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 16 Jan 2006, 15:26
Hi to all, some time ago I had the idea of making "invoke", "stdcall", and all that stuff capable of handling ada syntax but since I think I will never finish it I decided to post my incomplete code just for if someone want to finish it.

Code:
macro proto name, [args]{
common
local count
  count = 0
  PROTO # name = 1

forward
  count = count + 1

  argPROTO # name # args = count

common
  countPROTO # name = count
}

proto MessageBox,\
    hWnd,\            ; handle of owner window
    lpText,\          ; address of text in message box
    lpCaption,\       ; address of title of message box
    uType             ; style of message box

macro adainv name, [args]
{
common
local count, passed
  count = 0

  if ~defined PROTO # name
    display "There is no procedure nor proto with name """, `name, """"
    err
  end if

forward
  if 1
  match arg ==> value, args
  \{
    if ~defined argPROTO \# name \# arg
      display \`arg, " is not an argument of ", \`name
      err
    end if

    if defined arg \# passed
      display "Argument ", \`arg, " of ", \`name, " already passed"
      err
    end if
    arg \# passed equ 1    ; To signal arg was passed

    count = count + 1
  else
  \}
    display "Invalid argument"
    err
  end if

common
local arg_list
arg_list equ

  if countPROTO # name > count
    display "At least an argument is missing"
    err
  end if

; ##### At this point we are ready to reorder the arguments (if needed) before calling the procedure/function

}

adainv MessageBox, hWnd => 0, lpText => text, lpCaption => NULL, uType => MB_ICONINFORMATION
adainv MessageBox, uType => MB_ICONINFORMATION, lpCaption => NULL, lpText => text, hWnd => 0
adainv MessageBox, lpCaption => NULL, hWnd => 0, lpText => text, uType => MB_ICONINFORMATION    


Note that the macro doesn't handle unnamed args (which violates the ada syntax).

Well I don't know, I think it could be nice that FASM package supports it but I a very bad macro writer and is to hard for me making it :'(
Post 16 Jan 2006, 15:26
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 19 Jan 2006, 02:59
Well, I just finished something near of ada syntax. Check attachment, it still not finish thought, if the named argument is not placed in the intended order assembling will fail with a message telling "not implemented".

Thanks to revolution for the trick of making lists. Yes, from those times I was wanting to do the ada syntax stuff.


Description:
Download
Filename: BEER.zip
Filesize: 2.18 KB
Downloaded: 636 Time(s)

Post 19 Jan 2006, 02: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


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.