home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / clib / progs / timslib / OtherBits / c / XferRecv < prev    next >
Encoding:
Text File  |  1993-01-22  |  2.1 KB  |  73 lines

  1. /* XferRecv.c */
  2. /*                           
  3.  
  4.   #####                 #         #
  5.     #    #              #      #  #
  6.     #                   #         #
  7.     #   ##  ####   #### #     ##  ####
  8.     #    #  # # # #     #      #  #   #
  9.     #    #  # # #  ###  #      #  #   #
  10.     #    #  # # #     # #      #  #   #
  11.     #   ### # # # ####  ##### ### ####
  12.  
  13. -----------------------------------------------------------------------------
  14.  
  15. This is source for use with the 'DeskLib' Wimp C programming library for
  16. Risc OS. I currently use v1.04 of DeskLib.  This source is FreeWare, which
  17. means you can use it to write commercial applications, but you may not charge
  18. *in any way* for the distribution of this source.  I (Tim Browse) retain
  19. all copyright on this source.
  20.  
  21. This source is provided 'as is' and I offer no guarantees that is useful,
  22. bug-free, commented, that it will compile, or even that it exists.
  23.  
  24. If it breaks in half, you own both pieces.
  25.  
  26. All source © Tim Browse 1993
  27.  
  28. -----------------------------------------------------------------------------
  29.  
  30. */
  31.  
  32. /* ANSI includes */
  33. #include <string.h>
  34.  
  35. /* DeskLib includes */
  36. #include "DeskLib.Wimp.h"
  37. #include "DeskLib.WimpSWIs.h"
  38. #include "DeskLib.Event.h"
  39.  
  40. /* Message structures */
  41. static message_block    msg;
  42. static message_destinee destinee;
  43. static event_type       type;
  44.  
  45. void XferRecv_Prolog(int *filetype, char *filename)
  46. {
  47.   /* Take a copy of the message so we can send one back */
  48.   memcpy(&msg, &event_lastevent.data.message, sizeof(message_block));
  49.  
  50.   /* Set up the message to send a DataLoadAck when we're done */
  51.   msg.header.size    = sizeof(message_header); /* No data in DataLoadAck */
  52.   msg.header.action  = message_DATALOADACK;
  53.   msg.header.yourref = msg.header.myref;
  54.  
  55.   /* Get the sender of the DataLoad message */
  56.   destinee.value = msg.header.sender;
  57.  
  58.   /* Remember what kind of message it was */
  59.   type = event_lastevent.type;
  60.  
  61.   /* Get the filename and filetype for the caller */
  62.   *filetype = msg.data.dataload.filetype;
  63.   strcpy(filename, msg.data.dataload.filename);
  64. }
  65.  
  66.  
  67. void XferRecv_Epilog(void)
  68. {
  69.   /* Send the DataLoadAck message set up by XferRecv_Prolog() */
  70.   Wimp_SendMessage(type, &msg, destinee, 0);
  71. }
  72.  
  73.