You can use ASM to push caller's adress to one of registers before making call, and then get it from called function. But this makes no sense as it is more clear to use something like that
Code: Select all
EnableExplicit
Global *A_freedom_to_go_home
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Procedure SomeProc ()
CallFunctionFast(*A_freedom_to_go_home, #False)
EndProcedure
Procedure Caller1 (jmp)
*A_freedom_to_go_home = @Caller1()
Debug "Caller1: " + Str(jmp)
If jmp
SomeProc()
EndIf
EndProcedure
Procedure Caller2 (jmp)
*A_freedom_to_go_home = @Caller2()
Debug "Caller2: " + Str(jmp)
If jmp
SomeProc()
EndIf
EndProcedure
;;;;;;;;;;;;;;;;;;;;;;;;
Caller1(#True)
Caller2(#True)
This can also be made as a preprocessing tool for IDE, but it doesn't make it less ugly and poor. Even more, causes problems when you try to share some your preprocessed code.
That all is of course just a shitty workaround, and this makes me angry as I remember when I needed such thing. I don't understand why not just add support of this little and useful stuff at compiler level, as it is added to any adequate compiler of language where low-level stuff/callbacks used often. GCC has it, for example, and I guess MSVC too.