aboutsummaryrefslogtreecommitdiff
path: root/include/libtio/io/generic.h
blob: 18878569b407014f815f95e40cf7c2076b817f91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef  LIBTIO_IO_GENERIC_H
# define LIBTIO_IO_GENERIC_H 20190429
# include "../cdefs.h"

TIO_BEGIN_NAMESPACE

/* A generic stream is inspired from the libc streams, which mainly serve
 * for interacting with local files. Using such a stream, you can read,
 * write and seek (move the cursor to a specific offset in the stream).
 *
 * Offset types, for seeking, are the following:
 *
 * `SET`: set the current position to the offset.
 * `CUR`: add the offset to the current position.
 * `END`: set the current position to the end minus the offset.
 * `DATA`: seek to the next data.
 * `HOLE`: seek to the next hole. */

typedef long tio_off_t;

typedef int  tio_whence_t;

# define TIO_SEEK_SET   1
# define TIO_SEEK_CUR   2
# define TIO_SEEK_END   4

# define TIO_SEEK_DATA  8
# define TIO_SEEK_HOLE 16

TIO_END_NAMESPACE

#endif /* LIBTIO_IO_GENERIC_H */