aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/embryo/embryo_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/embryo/embryo_main.c')
-rw-r--r--src/lib/embryo/embryo_main.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/lib/embryo/embryo_main.c b/src/lib/embryo/embryo_main.c
new file mode 100644
index 000000000..3c57ec7c3
--- /dev/null
+++ b/src/lib/embryo/embryo_main.c
@@ -0,0 +1,42 @@
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+#include "Embryo.h"
+#include "embryo_private.h"
+
+static Embryo_Version _version = { VMAJ, VMIN, VMIC, VREV };
+EAPI Embryo_Version *embryo_version = &_version;
+
+static int _embryo_init_count = 0;
+
+/*** EXPORTED CALLS ***/
+
+EAPI int
+embryo_init(void)
+{
+ if (++_embryo_init_count != 1)
+ return _embryo_init_count;
+
+ srand(time(NULL));
+
+ return _embryo_init_count;
+}
+
+EAPI int
+embryo_shutdown(void)
+{
+ if (_embryo_init_count <= 0)
+ {
+ printf("%s:%i Init count not greater than 0 in shutdown.", __FUNCTION__, __LINE__);
+ return 0;
+ }
+ if (--_embryo_init_count != 0)
+ return _embryo_init_count;
+
+ return _embryo_init_count;
+}