use __attribute__((packed)) if __GNUC__ is defined
[framework/uifw/embryo.git] / src / lib / embryo_main.c
1 /*
2  * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3  */
4
5 #ifdef HAVE_CONFIG_H
6 # include "config.h"
7 #endif
8
9 #include <stdlib.h>
10 #include <time.h>
11
12 #include "Embryo.h"
13 #include "embryo_private.h"
14
15 static int _embryo_init_count = 0;
16
17 /*** EXPORTED CALLS ***/
18
19 /**
20  * @defgroup Embryo_Library_Group Library Maintenance Functions
21  *
22  * Functions that start up and shutdown the Embryo library.
23  */
24
25 /**
26  * Initialises the Embryo library.
27  * @return  The number of times the library has been initialised without being
28  *          shut down.
29  * @ingroup Embryo_Library_Group
30  */
31 EAPI int
32 embryo_init(void)
33 {
34    _embryo_init_count++;
35    if (_embryo_init_count > 1) return _embryo_init_count;
36
37    srand(time(NULL));
38
39    return _embryo_init_count;
40 }
41
42 /**
43  * Shuts down the Embryo library.
44  * @return  The number of times the library has been initialised without being
45  *          shutdown.
46  * @ingroup Embryo_Library_Group
47  */
48 EAPI int
49 embryo_shutdown(void)
50 {
51    _embryo_init_count--;
52    if (_embryo_init_count > 0) return _embryo_init_count;
53
54    return _embryo_init_count;
55 }