/* read.h */

#ifndef _read_h
#define _read_h

#include "toolbox.h"

typedef void (*PendingHandler)( void *handle, int event, WimpPollBlock *wpb );

_kernel_oserror *read_object
(ObjectId object, char *buffer, int space);

_kernel_oserror * read_gadget
(ObjectId object, ComponentId component, char *buffer, int space);

_kernel_oserror *read_event
( int ec, WimpPollBlock *e, ComponentId c, char *buffer, int space,
  int *pending, PendingHandler p, void *handle);

_kernel_oserror *read_toolbox
( int ec, ToolboxEvent *e, ComponentId c, char *buffer, int space );

_kernel_oserror *read_message
( WimpMessage *message, ComponentId c, char *buffer, int space,
  int *pending, PendingHandler p, void *handle );
  
/* if read_message is unable to return a value immediately,
   because it is the start of a sequence of messages it will
   1.  Set pending to 1 and return.
   2.  When the next message in the sequence becomes available it will call the
       pending handler.
       Request the value from read_message.  If it lies further down the
       sequence then this process will be repeated until the value is available.
*/

#endif
