Stream.h 616 B

1234567891011121314151617181920212223242526272829
  1. #ifndef STREAM_H
  2. #define STREAM_H
  3. typedef struct Stream
  4. {
  5. int capacity;
  6. int size;
  7. int index;
  8. char* data;
  9. } Stream;
  10. void streamInit(Stream* s, int size);
  11. void streamRemove(Stream* s);
  12. void streamEnsureIndex(Stream* s, int length);
  13. typedef void (*ClientStreamFunction) (Stream*);
  14. typedef int (*ServerStreamFunction) (int, int, Stream*);
  15. int streamSeekNewLine(Stream* in);
  16. int streamHasData(Stream* in);
  17. int streamGetChar(Stream* in, char* c);
  18. int streamGetChars(Stream* in, char* buffer, int length);
  19. int streamWriteChar(Stream* out, char c);
  20. int streamWriteChars(Stream* out, char* c);
  21. #endif