home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 February / PCWFEB08.iso / Software / Resources / Utilities / Partition Logic 0.68 / partlogic-0.68.iso / system / headers / sys / stream.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-05-10  |  2.0 KB  |  70 lines

  1. // 
  2. //  Visopsys
  3. //  Copyright (C) 1998-2007 J. Andrew McLaughlin
  4. //  
  5. //  This library is free software; you can redistribute it and/or modify it
  6. //  under the terms of the GNU Lesser General Public License as published by
  7. //  the Free Software Foundation; either version 2.1 of the License, or (at
  8. //  your option) any later version.
  9. //
  10. //  This library is distributed in the hope that it will be useful, but
  11. //  WITHOUT ANY WARRANTY; without even the implied warranty of
  12. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
  13. //  General Public License for more details.
  14. //
  15. //  You should have received a copy of the GNU Lesser General Public License
  16. //  along with this library; if not, write to the Free Software Foundation,
  17. //  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. //
  19. //  stream.h
  20. //
  21.  
  22. // This file contains definitions and structures for using and manipulating
  23. // streams in Visopsys.
  24.  
  25. #if !defined(_STREAM_H)
  26.  
  27. #include <sys/file.h>
  28.  
  29. // An enum for describing the size of each item in the stream
  30. typedef enum {
  31.   itemsize_byte, itemsize_dword
  32. } streamItemSize;
  33.  
  34. // This data structure is the generic stream
  35. typedef volatile struct _stream {
  36.   unsigned char *buffer;
  37.   unsigned buffSize;
  38.   unsigned size;
  39.   unsigned first;
  40.   unsigned last;
  41.   unsigned count;
  42.  
  43.   // Stream functions.  These are not for calling from user space.
  44.   int (*clear) (volatile struct _stream *);
  45.   int (*intercept) (volatile struct _stream *, ...);
  46.   int (*append) (volatile struct _stream *, ...);
  47.   int (*appendN) (volatile struct _stream *, unsigned, ...);
  48.   int (*push) (volatile struct _stream *, ...);
  49.   int (*pushN) (volatile struct _stream *, unsigned, ...);
  50.   int (*pop) (volatile struct _stream *, ...);
  51.   int (*popN) (volatile struct _stream *, unsigned, ...);
  52.  
  53. } stream;
  54.  
  55. // Some specialized kinds of streams
  56.  
  57. // A file stream, for character-based file IO
  58. typedef struct {
  59.   file f;
  60.   unsigned block;
  61.   int dirty;
  62.   stream s;
  63.  
  64. } fileStream;
  65.  
  66. typedef stream networkStream;
  67.  
  68. #define _STREAM_H
  69. #endif
  70.