if line eq flat
segment readable writeable executable
else
segment line
end if
}
macro FN line& {
__previous_end__ fix END
macro END \{
\}
END fix __previous_end__
match fname=(fargs=)=[flocs=], line \{
matched = 1
fname:
fargscount fargs
flocscount flocs
push rbp
mov rbp, rsp
sub rsp, flocscount * 8
\}
match fname=(fargs=), line \{
matched = 1
fname:
fargscount fargs
push rbp
mov rbp, rsp
sub rsp, fargscount * 8
\}
if ~defined matched
display "Error: Invalid function definition"
err
end if
purge matched
}
macro CLASS cname {
__previous_end__ fix END
macro END \{
__current_class__ equ
\}
END fix __previous_end__
__current_class__ equ cname
}
macro FIELDS {
__previous_end__ fix END
macro END \{
\\}
\}
END fix __previous_end__
struct __current_class__ \{
.__vtable__ equ __current_class__\#.__real_vtable__
}
macro EXPAND_CLASS cname {
__previous_end__ fix END
macro END \{
\}
END fix __previous_end__
__current_class__ equ cname
}
macro METHOD line& {
match fname=(fargs=)=[flocs=], line \{
matched = 1
\#__current_class__.__real_vtable__.\#fname:
fargscount fargs
flocscount flocs
push rbp
mov rbp, rsp
sub rsp, flocscount * 8
\}
match fname=(fargs=), line \{
matched = 1
fname:
fargscount fargs
push rbp
mov rbp, rsp
sub rsp, fargscount * 8
\}
if ~defined matched
display "Error: Invalid function definition"
err
end if
purge matched
}
fix не стоит использовать в макросах. Эта штука обрабатывается отдельно, до всех остальных выражений
Обсуждают сегодня