home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1999 October / VPR9910A.BIN / OLS / bz2l003 / bz2l003.lzh / BZ2LIB / STRINGQ.H < prev   
C/C++ Source or Header  |  1998-06-02  |  982b  |  44 lines

  1. /*
  2.     stringq
  3.     
  4.      process char buffer as queue like pipe
  5.  
  6.     by Yoshioka Tsuneo(QWF00133@niftyserve.or.jp)
  7.     This File is Copy,Edit,Re-Distribute,etc.. FREE!
  8.     Welcome any e-mail!!
  9. */
  10. #ifndef __STRINGQ_H
  11. #define __STRINGQ_H
  12.  
  13. #define STRINGQ_BUFSIZ 0x10000    /* fixed size for the time beging */
  14. #ifndef MIN
  15.     #define MIN(a,b) (((a) < (b)) ? (a) : (b))
  16. #endif
  17. #ifndef MAX
  18.     #define MAX(a,b) (((a) > (b)) ? (a) : (b))
  19. #endif
  20. struct STRINGQ_{
  21.     unsigned char *buf;
  22.     int bufsize;
  23.  
  24.     int start_ptr;
  25.     int end_ptr;
  26.     int exist_eof;
  27.     int len;
  28. };
  29. #ifndef TYPEDEF_STRINGQ
  30. #define TYPEDEF_STRINGQ
  31. typedef struct STRINGQ_ STRINGQ;
  32. #endif
  33.  
  34. STRINGQ *STRINGQ_open(int size);
  35. int STRINGQ_getc(STRINGQ *b);
  36. int STRINGQ_ungetc(int c,STRINGQ *b);
  37. int STRINGQ_putc(int c,STRINGQ *b);
  38. void STRINGQ_puteof(STRINGQ *b);
  39. void STRINGQ_close(STRINGQ *b);
  40. int STRINGQ_write(STRINGQ *b,char *buff,int len);
  41. int STRINGQ_read(STRINGQ *b,char *buff,int len);
  42.  
  43. #endif /* __STRINGQ */
  44.