| M E M _ O P E N I F H ( )
| | | | | SOURCE: qdev_autodocs.txt 1.163 (12/09/2014) English AMIGA - MEM_#?
----------------------------------------------------------------------------
NAME
mem_openifh() - Create internal/emulated file desc.
SYNOPSIS
fd = mem_openifh(objptr, objlen, handler);
LONG mem_openifh(void *, LONG, ULONG (*)
(register ULONG __asm("d0"),
register struct mem_ifh_data * __asm("a1")));
FUNCTION
This func. allows to emulate file descriptor to which
at the other end user data and its size are attached.
INPUTS
objptr - Pointer to (hexdumped) data.
objlen - Size of that data.
handler - Packet handler.
RETURNS
Returns almost compatible to 'Open()' file descriptor,
but it cannot be 'Close()'d !!!
BASES
SysBase, DOSBase
NOTES
Please note, emulated file descriptors are picky mainly
because they do not multitask! Also, there can be up to
16 such file desc. per process, see 'mem_addexhandler()'
to find out why.
Dont 'Forbid()'/'Permit()' protect 'mem_openifh()'/
'mem_closeifh()' code, or it will block forever upon
read attempt, because there will be no way to jump to
the exception routnie!
Possible ops on emulated file descriptors depend on the
handler! Overall you can generally use all the standard
'dos' funcs.(including buffered ones).
Never manipulate 'tc_ExceptCode'/'tc_ExceptData' after
you obtained the descriptor! Use 'mem_addexhandler()'
if you need custom exception handler.
Never pass pointer to the data that are on stack! You
can either 'static' it or just allocate the memory and
put it there. This applies to 'Read()', 'Write()' and
the like as well!
Exception data structure is defined and described in
the private header!
SEE ALSO
mem_closeifh(), han_rollifh(),
han_binaryifh(), han_termifh(), han_rwifh()
EXAMPLE
See 'a-mem_iloadseg.c' for a practical use.
BUGS
None known.
----------------------------------------------------------------------------
| |
| |