[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

	ExitHandler -- add an exit handler to the IFFHandle context. (V36)

	error = ExitHandler(iff, type, id, position, handler, object);
	D0                  A0   D0    D1  D2        A1       A2

	LONG ExitHandler(struct IFFHandle *, LONG, LONG, LONG,
	                 struct Hook *, APTR object(;

	Installs an exit handler vector for a specific type of chunk into the
	context for the given IFFHandle structure. Type and id are the longword
	identifiers for the chunk to handle. The handler is a client-supplied
	standard Hook structure, properly initialized. Position tells
	where to put the handler in the context. The handler will be called
	just before the parser exits the given chunk in the "pause" parse
	state. The IFF stream may not be positioned predictably within the
	chunk. The handler will execute in the same context as whoever
	called ParseIFF(). The handler will be called (through the hook)
	with the following arguments:

		A0:	the Hook pointer you passed.
		A2:	the 'object' pointer you passed.
		A1:	pointer to a LONG containing the value

	The error code your call-back routine returns will affect the parser
	in three different ways:

	Return value		Result
	------------		------
	0:			Normal success;  ParseIFF() will continue
				through the file.
	IFF_RETURN2CLIENT:	ParseIFF() will stop and return the value 0.
				(StopChunk() is internally implemented using
				this return value.)
	Any other value:	ParseIFF() will stop and return the value
				you supplied. This is how errors should be

	iff - pointer to IFFHandle structure.
	type - type code for chunk to handle (ex. "ILBM").
	id - identifier code for chunk to handle (ex. "CMAP").
	position - local context item position. One of the IFFSLI_#? codes.
	handler - pointer to Hook structure.
	object - a client-defined pointer which is passed in A2 during call-

	error - 0 if successful or an IFFERR_#? error code if unsuccessful.

	Returning the values IFFERR_EOF or IFFERR_EOC from the call-back
	routine *may* confuse the parser.

	There is no way to explicitly remove a handler once installed.
	However, by installing a do-nothing handler using IFFSLI_TOP,
	previous handlers will be overridden until the context expires.

	EntryHandler(), StoreLocalItem(), StoreItemInContext(),
	<utility/hooks.h>, <libraries/iffparse.h>

[Back to Amiga Developer Docs]