04/09/2021 10:24
Código:
stock SafeReturnCode(const src[], const bytes = sizeof (src))
{
// Push the lengths for the memcpy (needs "pri", so done first).
#emit LOAD.S.pri bytes
#emit SHL.C.pri 2
#emit PUSH.pri
#emit PUSH.pri
// Get the parameter count.
#emit LOAD.S.pri 0
#emit MOVE.alt
#emit ADD.C 8
#emit LOAD.I
// Get the desination pointer.
#emit ADD
#emit ADD.C 12
#emit LOAD.I
// Do a raw memcpy (pointer to pointer, not array to array).
#emit PUSH.C 0
#emit PUSH.S src
#emit PUSH.pri
#emit PUSH.C 20
#emit SYSREQ.C memcpy
// Return to the caller's caller.
#emit MOVE.pri
#emit SCTRL 5
#emit SCTRL 4
#emit RETN
// Compiler cleanup.
return 0;
}
#define safe_return%0; return SafeReturnCode(%0),(%0);
Código:
safe_return FunCaoNome();
Citar:
Gostou do meu conteúdo? que tal me ajudar com alguma reputação? ( Estrela )