The user may define functions to be called at certain occasions by the
Prolog system. This is accomplished by passing the functions as
arguments to the following set-hook-functions. The functions
can be removed by passing a NULL
.
typedef int (SP_ReadHookProc) (int fd)
SP_ReadHookProc SP_set_read_hook (SP_ReadHookProc *)
obsolescentfd
provided it is
associated with a terminal device. This
function shall return nonzero when there is input available at
fd
. It is called repeatedly until it returns nonzero.
You should avoid the use of a read hook if possible. It is not
possible to write a reliable read hook. The reason is that SICStus
streams are typically based on C stdio streams
(FILE*
). Such streams can contain buffered data that is not
accessible from the file descriptor. Using e.g. select()
can
therefore block even though fgetc
on the underlying FILE*
would not block.
typedef void (SP_VoidFun) (void)
SP_VoidFun * SP_set_reinit_hook (SP_VoidFun *)
typedef void (SP_VoidFun) (void);
SP_VoidFun * SP_set_interrupt_hook (SP_VoidFun *)