Stream.h 583 B

12345678910111213141516171819202122232425262728
  1. #ifndef STREAM_H
  2. #define STREAM_H
  3. #define BUFFER_SIZE 1024
  4. typedef struct Stream
  5. {
  6. int size;
  7. int index;
  8. char data[BUFFER_SIZE];
  9. } Stream;
  10. void streamInit(Stream* s);
  11. typedef void (*StreamFunction) (Stream*);
  12. int streamGetChar(Stream* in, char* c);
  13. int streamGetChars(Stream* in, char* buffer, int length);
  14. int streamGetShort(Stream* in, short* s);
  15. int streamGetInt(Stream* in, int* i);
  16. int streamWriteChar(Stream* out, char c);
  17. int streamWriteChars(Stream* out, char* c);
  18. int streamWriteShort(Stream* out, short s);
  19. int streamWriteInt(Stream* out, int i);
  20. #endif