aboutsummaryrefslogtreecommitdiff
path: root/include/libtio.h
blob: c71c539bd5dda5f6ff991d19237cb41ecaf2dc7d (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
33
34
35
36
37
38
39
#ifndef  LIBTIO_H
# define LIBTIO_H 20180710

# include "libtio/cdefs.h"
# include "libtio/error.h"
# include "libtio/log.h"

# include "libtio/iter.h"
# include "libtio/stream.h"
# include "libtio/chrono.h"
# include "libtio/mutex.h"

/* Define what is required to use the library facilities. */

TIO_EXTERN(int) tio_check_version
	OF((unsigned long version));

TIO_EXTERN(int)  tio_init
	OF((void));
TIO_EXTERN(void) tio_exit
	OF((void));

# ifndef TIO_NOINIT
#  include <stdlib.h>

#  define TIO_INIT \
	{ \
		int TIO_error; \
		\
		if (tio_check_version(LIBTIO_VERNUM)) \
			exit(EXIT_FAILURE); \
		if (!(TIO_error = tio_init())) \
			atexit(&tio_exit); \
		else if (TIO_error != tio_error_arg) \
			exit(EXIT_FAILURE); \
	}
# endif

#endif /* LIBTIO_H */