diff options
author | Olliver Schinagl <oliver@schinagl.nl> | 2016-02-05 10:36:22 (GMT) |
---|---|---|
committer | Olliver Schinagl <oliver@schinagl.nl> | 2016-03-10 09:37:39 (GMT) |
commit | 660f1a8cc94f7176f49d5021e7b979030c5ac42e (patch) | |
tree | 9de61b286e8bb59dd9f74280082c3dcac14b8585 /src/lib | |
parent | 398af5331bacd2e2aa4914e9926bf32d28cf8c14 (diff) | |
download | engagement-660f1a8cc94f7176f49d5021e7b979030c5ac42e.zip engagement-660f1a8cc94f7176f49d5021e7b979030c5ac42e.tar.gz engagement-660f1a8cc94f7176f49d5021e7b979030c5ac42e.tar.bz2 |
Add empty eflprj generated skeleton project
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Makefile.am | 18 | ||||
-rw-r--r-- | src/lib/engagement.c | 64 | ||||
-rw-r--r-- | src/lib/engagement.h | 111 | ||||
-rw-r--r-- | src/lib/engagement_private.h | 27 |
4 files changed, 220 insertions, 0 deletions
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am new file mode 100644 index 0000000..0eaf568 --- /dev/null +++ b/src/lib/Makefile.am @@ -0,0 +1,18 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib \ +-I$(top_builddir)/src/lib \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +@EFL_CFLAGS@ \ +-DEFL_EFL_BUILD + +lib_LTLIBRARIES = libengagement.la + +includes_HEADERS = engagement.h +includesdir = $(includedir)/engagement-@VMAJ@ + +libengagement_la_SOURCES = engagement.c +libengagement_la_LIBADD = @EFL_LIBS@ -lm +libengagement_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@ diff --git a/src/lib/engagement.c b/src/lib/engagement.c new file mode 100644 index 0000000..55741a3 --- /dev/null +++ b/src/lib/engagement.c @@ -0,0 +1,64 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "engagement.h" + +#include "engagement_private.h" + +static int _engagement_init = 0; +int _engagement_lib_log_dom = -1; + +EAPI int +engagement_init(void) +{ + _engagement_init++; + if (_engagement_init > 1) return _engagement_init; + + eina_init(); + + _engagement_lib_log_dom = eina_log_domain_register("engagement", EINA_COLOR_CYAN); + if (_engagement_lib_log_dom < 0) + { + EINA_LOG_ERR("Engagement can not create its log domain."); + goto shutdown_eina; + } + + // Put here your initialization logic of your library + + eina_log_timing(_engagement_lib_log_dom, EINA_LOG_STATE_STOP, EINA_LOG_STATE_INIT); + + return _engagement_init; + + shutdown_eina: + eina_shutdown(); + _engagement_init--; + + return _engagement_init; +} + +EAPI int +engagement_shutdown(void) +{ + _engagement_init--; + if (_engagement_init != 0) return _engagement_init; + + eina_log_timing(_engagement_lib_log_dom, + EINA_LOG_STATE_START, + EINA_LOG_STATE_SHUTDOWN); + + // Put here your shutdown logic + + eina_log_domain_unregister(_engagement_lib_log_dom); + _engagement_lib_log_dom = -1; + + eina_shutdown(); + + return _engagement_init; +} + +EAPI void +engagement_library_call(void) +{ + INF("Not really doing anything useful."); +} diff --git a/src/lib/engagement.h b/src/lib/engagement.h new file mode 100644 index 0000000..487d8c9 --- /dev/null +++ b/src/lib/engagement.h @@ -0,0 +1,111 @@ +#ifndef ENGAGEMENT_H_ +# define ENGAGEMENT_H_ + +#include <Elementary.h> + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef _WIN32 +# ifdef EFL_ENGAGEMENT_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif /* ! DLL_EXPORT */ +# else +# define EAPI __declspec(dllimport) +# endif /* ! EFL_ENGAGEMENT_BUILD */ +#else +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif +#endif /* ! _WIN32 */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file + * @brief These routines are used for Engagement library interaction. + */ + +/** + * @brief Init / shutdown functions. + * @defgroup Init Init / Shutdown + * + * @{ + * + * Functions of obligatory usage, handling proper initialization + * and shutdown routines. + * + * Before the usage of any other function, Engagement should be properly + * initialized with @ref engagement_init() and the last call to Engagement's + * functions should be @ref engagement_shutdown(), so everything will + * be correctly freed. + * + * Engagement logs everything with Eina Log, using the "engagement" log domain. + * + */ + +/** + * Initialize Engagement. + * + * Initializes Engagement, its dependencies and modules. Should be the first + * function of Engagement to be called. + * + * @return The init counter value. + * + * @see engagement_shutdown(). + * + * @ingroup Init + */ +EAPI int engagement_init(void); + +/** + * Shutdown Engagement + * + * Shutdown Engagement. If init count reaches 0, all the internal structures will + * be freed. Any Engagement library call after this point will leads to an error. + * + * @return Engagement's init counter value. + * + * @see engagement_init(). + * + * @ingroup Init + */ +EAPI int engagement_shutdown(void); + +/** + * @} + */ + +/** + * @brief Main group API that wont do anything + * @defgroup Main Main + * + * @{ + * + * @brief A function that doesn't do any good nor any bad + * + * @ingroup Main + */ +EAPI void engagement_library_call(void); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* ENGAGEMENT_H_ */ diff --git a/src/lib/engagement_private.h b/src/lib/engagement_private.h new file mode 100644 index 0000000..986a70d --- /dev/null +++ b/src/lib/engagement_private.h @@ -0,0 +1,27 @@ +#ifndef ENGAGEMENT_PRIVATE_H +# define ENGAGEMENT_PRIVATE_H + +extern int _engagement_lib_log_dom; + +#ifdef ERR +# undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_engagement_lib_log_dom, __VA_ARGS__) +#ifdef INF +# undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_engagement_lib_log_dom, __VA_ARGS__) +#ifdef WRN +# undef WRN +#endif +#define WRN(...) EINA_LOG_DOM_WARN(_engagement_lib_log_dom, __VA_ARGS__) +#ifdef CRIT +# undef CRIT +#endif +#define CRIT(...) EINA_LOG_DOM_CRIT(_engagement_lib_log_dom, __VA_ARGS__) +#ifdef DBG +# undef DBG +#endif +#define DBG(...) EINA_LOG_DOM_DBG(_engagement_lib_log_dom, __VA_ARGS__) + +#endif |