1. Overwriting function
Is there a way to overwrite an Euphoria function, but stll be able to call
the original function?
Example:
procedure puts(integer hnd, object x)
if hnd < 0 then
-- ... so something
else
puts(hnd, x) -- Call original puts()
end if
end procedure
Regards,
Daniel Berstein
daber at pair.com
2. Re: Overwriting function
Daniel Berstein writes:
> Is there a way to overwrite an Euphoria function, but stll be
> able to call the original function?
See euphoria\include\safe.e. It's done several times in there.
e.g.
function original_peek(object x)
return peek(x) -- Euphoria's normal peek
end function
without warning
-- override "peek" with debug peek
global function peek(object x)
-- safe version of peek
integer len
atom a
if atom(x) then
len = 1
a = x
else
len = x[2]
a = x[1]
end if
if safe_address(a, len) then
return original_peek(x)
else
die("BAD PEEK" & bad_address(a))
end if
end function
Regards,
Rob Craig
Rapid Deployment Software