Stream.h 701 B

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