2008-10-21 01:40:54 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2012-05-30 03:08:41 -07:00
|
|
|
#include <stdio.h>
|
2008-10-21 01:40:54 -07:00
|
|
|
#include <stdlib.h>
|
2004-03-29 03:58:57 -08:00
|
|
|
#include <time.h>
|
2004-03-24 01:48:28 -08:00
|
|
|
|
2008-10-21 01:40:54 -07:00
|
|
|
#include "Embryo.h"
|
|
|
|
#include "embryo_private.h"
|
|
|
|
|
2010-05-28 23:40:07 -07:00
|
|
|
static Embryo_Version _version = { VMAJ, VMIN, VMIC, VREV };
|
|
|
|
EAPI Embryo_Version *embryo_version = &_version;
|
|
|
|
|
2004-03-24 01:48:28 -08:00
|
|
|
static int _embryo_init_count = 0;
|
|
|
|
|
|
|
|
/*** EXPORTED CALLS ***/
|
2004-09-25 07:37:39 -07:00
|
|
|
|
2006-01-06 10:02:51 -08:00
|
|
|
EAPI int
|
2004-03-24 01:48:28 -08:00
|
|
|
embryo_init(void)
|
|
|
|
{
|
2009-10-07 23:35:48 -07:00
|
|
|
if (++_embryo_init_count != 1)
|
|
|
|
return _embryo_init_count;
|
2008-04-11 12:06:18 -07:00
|
|
|
|
2004-03-29 03:58:57 -08:00
|
|
|
srand(time(NULL));
|
2008-04-11 12:06:18 -07:00
|
|
|
|
2004-03-24 01:48:28 -08:00
|
|
|
return _embryo_init_count;
|
|
|
|
}
|
|
|
|
|
2006-01-06 10:02:51 -08:00
|
|
|
EAPI int
|
2004-03-24 01:48:28 -08:00
|
|
|
embryo_shutdown(void)
|
|
|
|
{
|
2012-05-30 03:08:41 -07:00
|
|
|
if (_embryo_init_count <= 0)
|
|
|
|
{
|
|
|
|
printf("%s:%i Init count not greater than 0 in shutdown.", __FUNCTION__, __LINE__);
|
|
|
|
return 0;
|
|
|
|
}
|
2009-10-07 23:35:48 -07:00
|
|
|
if (--_embryo_init_count != 0)
|
|
|
|
return _embryo_init_count;
|
2008-04-11 12:06:18 -07:00
|
|
|
|
2004-03-24 01:48:28 -08:00
|
|
|
return _embryo_init_count;
|
|
|
|
}
|