utfio.h 591 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef UTFIOH
  2. #define UTFIOH
  3. /*
  4. * utfio
  5. */
  6. #include <unistd.h> /* read(), write() */
  7. #include "utf.h"
  8. enum {
  9. UBSIZE=4096
  10. };
  11. struct utfio_s {
  12. int fd; /* attached file */
  13. byte b[UBSIZE]; /* raw byte buffer */
  14. int i; /* index of next unused byte, or UBSIZE if empty */
  15. int z; /* index of EOF, or UBSIZE if EOF not yet in buffer */
  16. };
  17. typedef struct utfio_s utfio;
  18. utfio *uioinit(int, utfio *);
  19. utfio *uioinitrd(int, utfio *);
  20. int uiofill(utfio *);
  21. int uioflush(utfio *);
  22. int uioread(utfio *,int *,int);
  23. int uiowrite(utfio *,int *,int);
  24. #endif