/* stringq process char buffer as queue like pipe -----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*----- Author: Yoshioka Tsuneo(QWF00133@nifty.ne.jp) Welcome any e-mail to me(-: If you can, please send only one email to me that you use this file/program. You can copy,edit,re-distribute this file for any purpose FREE! You can use this file as PDS(Public Domain Software). You can send bugs,hope,etc.. to me with no fee. You can take support service with charging a fee. please consult to me. Thank you for use my program. -----*-----*-----*-----*-----*-----*-----*-----*-----*-----*-----*----- */ #ifndef __STRINGQ_H #define __STRINGQ_H #define STRINGQ_BUFSIZ 0x10000 /* fixed size for the time beging */ #ifndef MIN #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif #ifndef MAX #define MAX(a,b) (((a) > (b)) ? (a) : (b)) #endif struct STRINGQ_{ unsigned char *buf; int buf_by_user; int bufsize; int start_ptr; int end_ptr; int exist_eof; int len; }; #ifndef TYPEDEF_STRINGQ #define TYPEDEF_STRINGQ typedef struct STRINGQ_ STRINGQ; #endif STRINGQ *STRINGQ_open(char *buff,int size); int STRINGQ_getc(STRINGQ *b); int STRINGQ_ungetc(int c,STRINGQ *b); int STRINGQ_putc(int c,STRINGQ *b); void STRINGQ_puteof(STRINGQ *b); void STRINGQ_close(STRINGQ *b); int STRINGQ_write(STRINGQ *b,const char *buff,int len); int STRINGQ_read(STRINGQ *b,char *buff,int len); int STRINGQ_puts(const char *str,STRINGQ *b); int STRINGQ_printf(STRINGQ *b,const char *format,...); char *STRINGQ_gets(char *str,int n,STRINGQ *b); #endif /* __STRINGQ */