home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / CMDS / mtools_3.6.src.lzh / MTOOLS_3.6 / stream.h < prev    next >
Text File  |  1997-11-12  |  2KB  |  65 lines

  1. #ifndef MTOOLS_STREAM_H
  2. #define MTOOLS_STREAM_H
  3.  
  4. typedef struct Stream_t {
  5.     struct Class_t *Class;
  6.     int refs;
  7.     struct Stream_t *Next;
  8.     struct Stream_t *Buffer;
  9. } Stream_t;
  10.  
  11. #include "mtools.h"
  12. #include "msdos.h"
  13.  
  14. typedef struct Class_t {
  15.     int (*read)(Stream_t *, char *, off_t, size_t);
  16.     int (*write)(Stream_t *, char *, off_t, size_t);
  17.     int (*flush)(Stream_t *);
  18.     int (*free)(Stream_t *);
  19.     int (*set_geom)(Stream_t *, device_t *, device_t *, int media,
  20.             struct bootsector *);
  21.     int (*get_data)(Stream_t *, long *, size_t *, int *, int *);
  22. } Class_t;
  23.  
  24. #define READS(stream, buf, address, data) \
  25. (stream)->Class->read( (stream), (char *) (buf), (address), (data) )
  26.  
  27. #define WRITES(stream, buf, address, data) \
  28. (stream)->Class->write( (stream), (char *) (buf), (address), (data) )
  29.  
  30. #define SET_GEOM(stream, dev, orig_dev, media, boot) \
  31. (stream)->Class->set_geom( (stream), (dev), (orig_dev), (media), (boot) )
  32.  
  33. #define GET_DATA(stream, date, size, type, address) \
  34. (stream)->Class->get_data( (stream), (date), (size), (type), (address) )
  35.  
  36.  
  37. int flush_stream(Stream_t *Stream);
  38. Stream_t *copy_stream(Stream_t *Stream);
  39. int free_stream(Stream_t **Stream);
  40.  
  41. #define FLUSH(stream) \
  42. flush_stream( (stream) )
  43.  
  44. #define FREE(stream) \
  45. free_stream( (stream) )
  46.  
  47. #define COPY(stream) \
  48. copy_stream( (stream) )
  49.  
  50.  
  51. #define DeclareThis(x) x *This = (x *) Stream
  52.  
  53. int force_write(Stream_t *Stream, char *buf, off_t start, size_t len);
  54. int force_read(Stream_t *Stream, char *buf, off_t start, size_t len);
  55.  
  56. extern struct Stream_t *default_drive;
  57.  
  58. int get_data_pass_through(Stream_t *Stream, long *date, size_t *size,
  59.               int *type, int *address);
  60.  
  61. int read_pass_through(Stream_t *Stream, char *buf, off_t start, size_t len);
  62. int write_pass_through(Stream_t *Stream, char *buf, off_t start, size_t len);
  63. #endif
  64.  
  65.