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