48f5ba862e02908ed74f62ee5d9d4860b7f25eee
[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 #include "embryo_private.h"
6 #include <time.h>
7
8 static int _embryo_init_count = 0;
9
10 /*** EXPORTED CALLS ***/
11
12 /**
13  * @defgroup Embryo_Library_Group Library Maintenance Functions
14  *
15  * Functions that start up and shutdown the Embryo library.
16  */
17
18 /**
19  * Initialises the Embryo library.
20  * @return  The number of times the library has been initialised without being
21  *          shut down.
22  * @ingroup Embryo_Library_Group
23  */
24 EAPI int
25 embryo_init(void)
26 {
27    _embryo_init_count++;
28    if (_embryo_init_count > 1) return _embryo_init_count;
29
30    srand(time(NULL));
31
32    return _embryo_init_count;
33 }
34
35 /**
36  * Shuts down the Embryo library.
37  * @return  The number of times the library has been initialised without being
38  *          shutdown.
39  * @ingroup Embryo_Library_Group
40  */
41 EAPI int
42 embryo_shutdown(void)
43 {
44    _embryo_init_count--;
45    if (_embryo_init_count > 0) return _embryo_init_count;
46
47    return _embryo_init_count;
48 }