home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / d / desklib / !DeskLib / h_doc / Import2 < prev    next >
Encoding:
Text File  |  1996-07-22  |  1.8 KB  |  70 lines

  1. #ifndef __Desk_Import2_h
  2. #define __Desk_Import2_h
  3.  
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7.  
  8. #ifndef __Desk_wimp_h
  9. #include "Desk.Wimp.h"
  10. #endif
  11.  
  12.  
  13. typedef struct    {
  14.     void*            reference;    /* As passed to Desk_Import2_ImportData.        */
  15.     size_t            ram_progress;    /* Total bytes transfered using RAM transfer.    */
  16.     Desk_message_block    initialdatasave;
  17.     }
  18.     Desk_Import2_clientinfo;
  19. /*
  20. A pointer to this type is passed whenever Import calls a client function.
  21.  */
  22.  
  23.  
  24.  
  25.  
  26. typedef int (*Desk_Import2_fileimporter)( Desk_message_dataload* data, Desk_Import2_clientinfo* info);
  27. /*
  28. This function-type should load data from the file specified in 'data'.
  29. Return 0 if file was loaded succesfully, otherwise 1 to indicate an
  30. error (eg not enough memory to load file).
  31.  */
  32.  
  33. typedef void*    (*Desk_Import2_ramallocator)( size_t* buffsize, Desk_Import2_clientinfo* info);
  34. /*
  35. Should allocate a buffer for a ram-transfer, make 'buffsize' be size of
  36. buffer, and return a pointer to the buffer.
  37.  */
  38.  
  39. typedef void    (*Desk_Import2_ramhandler)( void* buffer, int numbytes, Desk_Import2_clientinfo* info);
  40. /*
  41. Should deal with the data put into buffer by sending task. 'buffer' is
  42. as returned by the last call to Desk_Import2_ramallocator. 
  43.  
  44. Called with numbytes==-1 when sending task fails to respond to request
  45. for RAM transfer. This is so that the client can free the initial block
  46. of memory allocated by the Desk_Import2_ramallocator. 
  47.  
  48. Called with buffer==0 to indicate end of ram transfer.
  49.  */
  50.  
  51. void    Desk_Import2_ImportData( 
  52.         Desk_event_pollblock*        event,    /* The message_DATASAVE    */
  53.         Desk_Import2_fileimporter    fileimporter, 
  54.         Desk_Import2_ramallocator    ramallocator,
  55.         Desk_Import2_ramhandler        ramhandler,
  56.         void*                reference
  57.         );
  58. /*
  59. Imports data in response to the specified message_DATASAVE event, using
  60. ramallocator/handler if possible, otherwise uses fileimporter.
  61.  */
  62.  
  63.  
  64. #ifdef __cplusplus
  65. }
  66. #endif
  67.  
  68. #endif
  69.  
  70.