1 #undef EAPI_MAIN
2 #undef __EFL_UI
3 #undef __EFL_NET
4 
5 #ifdef _WIN32
6 // There is no support for quicklaunch on windows, so no needs
7 // to export the efl_main symbol
8 # define EAPI_MAIN
9 #else
10 # ifdef __GNUC__
11 #  if __GNUC__ >= 4
12 #   define EAPI_MAIN __attribute__ ((visibility("default")))
13 #  else
14 #   define EAPI_MAIN
15 #  endif
16 # else
17 #  define EAPI_MAIN
18 # endif
19 #endif /* ! _WIN32 */
20 
21 #ifdef __EFL_UI_IS_REQUIRED
22 # define __EFL_UI(...) __VA_ARGS__
23 # define __EFL_UI_IS_DEFINED
24 #else
25 # define __EFL_UI(...)
26 #endif
27 
28 #ifdef __EFL_NET_IS_REQUIRED
29 # define __EFL_NET(...) __VA_ARGS__
30 #else
31 # define __EFL_NET(...)
32 #endif
33 
34 // This file is designed to be included again and again
35 // so cleanup last inclusion before generating this one.
36 #undef _EFL_VERSION_MICRO
37 #undef _EFL_VERSION_REVISION
38 #undef _EFL_VERSION_FLAVOR
39 #undef _EFL_BUILD_ID
40 #undef _EFL_APP_VERSION_SET
41 #undef __EFL_MAIN_CONSTRUCTOR
42 #undef __EFL_MAIN_DESTRUCTOR
43 #undef EFL_MAIN
44 #undef EFL_MAIN_EX
45 
46 #ifdef EFL_VERSION_MICRO
47 # define _EFL_VERSION_MICRO EFL_VERSION_MICRO
48 #else
49 # define _EFL_VERSION_MICRO 0
50 #endif
51 
52 #ifdef EFL_VERSION_REVISION
53 # define _EFL_VERSION_REVISION EFL_VERSION_REVISION
54 #else
55 # define _EFL_VERSION_REVISION 0
56 #endif
57 
58 #ifdef EFL_VERSION_FLAVOR
59 # define _EFL_VERSION_FLAVOR EFL_VERSION_FLAVOR
60 #else
61 # define _EFL_VERSION_FLAVOR NULL
62 #endif
63 
64 #ifdef EFL_BUILD_ID
65 # define _EFL_BUILD_ID EFL_BUILD_ID
66 #else
67 # define _EFL_BUILD_ID NULL
68 #endif
69 
70 #define __EFL_MAIN_CONSTRUCTOR                  \
71   __EFL_NET(ecore_con_init();)                  \
72   __EFL_NET(ecore_con_url_init();)              \
73   __EFL_UI(elm_init(argc, argv);)
74 
75 #define __EFL_MAIN_DESTRUCTOR                   \
76   __EFL_UI(elm_shutdown();)                     \
77   __EFL_NET(ecore_con_url_shutdown();)          \
78   __EFL_NET(ecore_con_shutdown();)
79 
80 #define _EFL_APP_VERSION_SET()                                          \
81   do {                                                                  \
82      if (efl_build_version_set)                                         \
83        efl_build_version_set(EFL_VERSION_MAJOR, EFL_VERSION_MINOR, _EFL_VERSION_MICRO, \
84                              _EFL_VERSION_REVISION, _EFL_VERSION_FLAVOR, _EFL_BUILD_ID); \
85   } while (0)
86 
87 #define EFL_MAIN() int main(int argc, char **argv)                      \
88   {                                                                     \
89      Eina_Value *ret__;                                                 \
90      int real__;                                                        \
91      _efl_startup_time = ecore_time_unix_get();                         \
92      _EFL_APP_VERSION_SET();                                            \
93      ecore_init();                                                      \
94      efl_event_callback_add(efl_main_loop_get(), EFL_LOOP_EVENT_ARGUMENTS, efl_main, NULL); \
95      ecore_init_ex(argc, argv);                                         \
96      __EFL_MAIN_CONSTRUCTOR;                                            \
97      ret__ = efl_loop_begin(efl_main_loop_get());                     \
98      real__ = efl_loop_exit_code_process(ret__);                        \
99      __EFL_MAIN_DESTRUCTOR;                                             \
100      ecore_shutdown_ex();                                               \
101      ecore_shutdown();                                                  \
102      return real__;                                                     \
103   }
104 
105 #define EFL_MAIN_EX()                                                   \
106   EFL_CALLBACKS_ARRAY_DEFINE(_efl_main_ex,                              \
107                              { EFL_LOOP_EVENT_ARGUMENTS, efl_main },    \
108                              { EFL_APP_EVENT_PAUSE, efl_pause },       \
109                              { EFL_APP_EVENT_RESUME, efl_resume },     \
110                              { EFL_APP_EVENT_TERMINATE, efl_terminate });         \
111   int main(int argc, char **argv)                                       \
112   {                                                                     \
113      Eina_Value *ret__;                                                 \
114      int real__;                                                        \
115      _efl_startup_time = ecore_time_unix_get();                         \
116      _EFL_APP_VERSION_SET();                                            \
117      ecore_init();                                                      \
118      efl_event_callback_array_add(efl_main_loop_get(), _efl_main_ex(), NULL); \
119      ecore_init_ex(argc, argv);                                         \
120      __EFL_MAIN_CONSTRUCTOR;                                            \
121      ret__ = efl_loop_begin(efl_main_loop_get());                     \
122      real__ = efl_loop_exit_code_process(ret__);                        \
123      __EFL_MAIN_DESTRUCTOR;                                             \
124      ecore_shutdown_ex();                                               \
125      ecore_shutdown();                                                  \
126      return real__;                                                     \
127   }
128