Skip to content

Feature: Function/Pointer syntax #45

@XMDS

Description

@XMDS

In fact, it may not make sense to do so. But in theory, I hope that the sb tool can add more new OP writing methods. Essentially, I think we should add a new simple syntax to the frequently used basic OP and SA (CLEO4).VC.3 (CLEO2.0) OP

In fact, I got the idea from gosub:
gosub @xxxx
xxxx ()

But actually you should add highlighting to the above code

Back to the topic, I have an example:
0AA5: call 0x123456 num_params 3 pop 3 0@ 1@ 2@
Maybe this:
call 0x123456 (3 2@ 1@ 0@)
call 0x123456 3(2@ 1@ 0@)
By writing call address + (parameter), the SB tool can automatically detect the number of parameters (num_params) in () when compiling.
In fact (3 2@ 1@ 0@), the 3 in () should be the pop parameter. In fact, OP 0AA5 fills the parameters in CLEO upside down, which is very uncomfortable. 2@ should be the first parameter

More examples:
0AA5: call 0x123456 num_params 3 pop 3 0@ 1@ 2@
call 0x123456 (3 2@ 1@ 0@)

0AA6: call_method 0x123456 struct 30@ num_params 3 pop 3 0@ 1@ 2@
call 0x123456 30@(3 2@ 1@ 0@)

0AA7: call_function 0x123456 num_params 3 pop 3 0@ 1@ 2@ ret 3@
call 0x123456 (3 2@ 1@ 0@) ret 3@

0AA8: call_function_method 0x123456 struct 30@ num_params 3 pop 3 0@ 1@ 2@ ret 3@
call 0x123456 30@(3 2@ 1@ 0@) ret 3@

0AB1: call_scm_func @xxxx 3 0@ 1@ 2@ ret 3@ 4@ 5@
call xxxx (3 0@ 1@ 2@)ret 3@ 4@ 5@
:xxxx
0AB2: ret 3 3@ 4@ 5@
ret (3@ 4@ 5@)
ret 0 = ret

Just like the example, the sb tool automatically detects the number of parameters (). But the above code is still not good. Such as pop and struct parameters. Maybe it can be declared at the beginning:
var
this 30@
stdcall 0x654321
cdecl 0x123456
end

call 0x123456 (30@ 2@ 1@ 0@}
call 0x654321 (30@ 2@ 1@ 0@}

In the end I suggest this
call address + (parameter)
pop and struct can be declared at the beginning

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions