summaryrefslogtreecommitdiff
path: root/src/lib/ecore/efl_general.h
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2017-11-09 15:08:40 -0800
committerCedric Bail <cedric@osg.samsung.com>2017-11-09 15:13:37 -0800
commitbd83a76393a1e5ceb7f725916a7eb9d41305f788 (patch)
tree926566c022d5c6f7905aed495a2051d57341a16e /src/lib/ecore/efl_general.h
parent66c46f052832a98b2e6c09d7853e9557f03287c3 (diff)
ecore: move EFL_MAIN to Efl_Core.h
This make EFL_MAIN available and working with just Ecore. For simplicity it is available with Efl_Core.h. Ideally it should also work with Efl_Net.h alone and finally with an Efl_Ui.h. T6262
Diffstat (limited to 'src/lib/ecore/efl_general.h')
-rw-r--r--src/lib/ecore/efl_general.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/src/lib/ecore/efl_general.h b/src/lib/ecore/efl_general.h
new file mode 100644
index 0000000000..b4ffdfe97a
--- /dev/null
+++ b/src/lib/ecore/efl_general.h
@@ -0,0 +1,101 @@
1#ifdef EFL_BETA_API_SUPPORT
2
3// This file is designed to be included again and again
4// so cleanup last inclusion before generating this one.
5#undef _EFL_VERSION_MICRO
6#undef _EFL_VERSION_REVISION
7#undef _EFL_VERSION_FLAVOR
8#undef _EFL_BUILD_ID
9#undef _EFL_APP_VERSION_SET
10#undef __EFL_MAIN_CONSTRUCTOR
11#undef __EFL_MAIN_DESTRUCTOR
12#undef __EFL_UI
13#undef EFL_MAIN
14#undef EFL_MAIN_EX
15
16#ifdef EFL_VERSION_MICRO
17# define _EFL_VERSION_MICRO EFL_VERSION_MICRO
18#else
19# define _EFL_VERSION_MICRO 0
20#endif
21
22#ifdef EFL_VERSION_REVISION
23# define _EFL_VERSION_REVISION EFL_VERSION_REVISION
24#else
25# define _EFL_VERSION_REVISION 0
26#endif
27
28#ifdef EFL_VERSION_FLAVOR
29# define _EFL_VERSION_FLAVOR EFL_VERSION_FLAVOR
30#else
31# define _EFL_VERSION_FLAVOR NULL
32#endif
33
34#ifdef EFL_BUILD_ID
35# define _EFL_BUILD_ID EFL_BUILD_ID
36#else
37# define _EFL_BUILD_ID NULL
38#endif
39
40#define __EFL_MAIN_CONSTRUCTOR \
41 __EFL_UI(elm_init(argc, argv);)
42
43#define __EFL_MAIN_DESTRUCTOR \
44 __EFL_UI(elm_shutdown();)
45
46#ifdef __EFL_UI_IS_REQUIRED
47# define __EFL_UI(...) __VA_ARGS__
48#else
49# define __EFL_UI(...)
50#endif
51
52#define _EFL_APP_VERSION_SET() \
53 do { \
54 if (efl_build_version_set) \
55 efl_build_version_set(EFL_VERSION_MAJOR, EFL_VERSION_MINOR, _EFL_VERSION_MICRO, \
56 _EFL_VERSION_REVISION, _EFL_VERSION_FLAVOR, _EFL_BUILD_ID); \
57 } while (0)
58
59#define EFL_MAIN() int main(int argc, char **argv) \
60 { \
61 Eina_Value *ret__; \
62 int real__; \
63 _efl_startup_time = ecore_time_unix_get(); \
64 _EFL_APP_VERSION_SET(); \
65 ecore_init(); \
66 efl_event_callback_add(ecore_main_loop_get(), EFL_LOOP_EVENT_ARGUMENTS, efl_main, NULL); \
67 ecore_init_ex(argc, argv); \
68 __EFL_MAIN_CONSTRUCTOR; \
69 ret__ = efl_loop_begin(ecore_main_loop_get()); \
70 real__ = efl_loop_exit_code_process(ret__); \
71 __EFL_MAIN_DESTRUCTOR; \
72 ecore_shutdown_ex(); \
73 ecore_shutdown(); \
74 return real__; \
75 }
76
77#define EFL_MAIN_EX() \
78 EFL_CALLBACKS_ARRAY_DEFINE(_efl_main_ex, \
79 { EFL_LOOP_EVENT_ARGUMENTS, efl_main }, \
80 { EFL_LOOP_EVENT_PAUSE, efl_pause }, \
81 { EFL_LOOP_EVENT_RESUME, efl_resume }, \
82 { EFL_LOOP_EVENT_TERMINATE, efl_terminate }); \
83 int main(int argc, char **argv) \
84 { \
85 Eina_Value *ret__; \
86 int real__; \
87 _efl_startup_time = ecore_time_unix_get(); \
88 _EFL_APP_VERSION_SET(); \
89 ecore_init(); \
90 efl_event_callback_array_add(ecore_main_loop_get(), _efl_main_ex(), NULL); \
91 ecore_init_ex(argc, argv); \
92 __EFL_MAIN_CONSTRUCTOR; \
93 ret__ = efl_loop_begin(ecore_main_loop_get()); \
94 real__ = efl_loop_exit_code_process(ret__); \
95 __EFL_MAIN_DESTRUCTOR; \
96 ecore_shutdown_ex(); \
97 ecore_shutdown(); \
98 return real__; \
99 }
100
101#endif /* EFL_BETA_API_SUPPORT */