home *** CD-ROM | disk | FTP | other *** search
- #ifndef __Desk_Import2_h
- #define __Desk_Import2_h
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #ifndef __Desk_wimp_h
- #include "Desk.Wimp.h"
- #endif
-
-
- typedef struct {
- void* reference; /* As passed to Desk_Import2_ImportData. */
- size_t ram_progress; /* Total bytes transfered using RAM transfer. */
- Desk_message_block initialdatasave;
- }
- Desk_Import2_clientinfo;
- /*
- A pointer to this type is passed whenever Import calls a client function.
- */
-
-
-
-
- typedef int (*Desk_Import2_fileimporter)( Desk_message_dataload* data, Desk_Import2_clientinfo* info);
- /*
- This function-type should load data from the file specified in 'data'.
- Return 0 if file was loaded succesfully, otherwise 1 to indicate an
- error (eg not enough memory to load file).
- */
-
- typedef void* (*Desk_Import2_ramallocator)( size_t* buffsize, Desk_Import2_clientinfo* info);
- /*
- Should allocate a buffer for a ram-transfer, make 'buffsize' be size of
- buffer, and return a pointer to the buffer.
- */
-
- typedef void (*Desk_Import2_ramhandler)( void* buffer, int numbytes, Desk_Import2_clientinfo* info);
- /*
- Should deal with the data put into buffer by sending task. 'buffer' is
- as returned by the last call to Desk_Import2_ramallocator.
-
- Called with numbytes==-1 when sending task fails to respond to request
- for RAM transfer. This is so that the client can free the initial block
- of memory allocated by the Desk_Import2_ramallocator.
-
- Called with buffer==0 to indicate end of ram transfer.
- */
-
- void Desk_Import2_ImportData(
- Desk_event_pollblock* event, /* The message_DATASAVE */
- Desk_Import2_fileimporter fileimporter,
- Desk_Import2_ramallocator ramallocator,
- Desk_Import2_ramhandler ramhandler,
- void* reference
- );
- /*
- Imports data in response to the specified message_DATASAVE event, using
- ramallocator/handler if possible, otherwise uses fileimporter.
- */
-
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-
-