summaryrefslogtreecommitdiff
path: root/src/lib/ecore/efl_general.h
blob: 222c799c2c119f6bba06df70208168f8a7e89bcf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#undef EAPI_MAIN
#undef __EFL_UI
#undef __EFL_NET

#ifdef _WIN32
// There is no support for quicklaunch on windows, so no needs
// to export the efl_main symbol
# define EAPI_MAIN
#else
# ifdef __GNUC__
#  if __GNUC__ >= 4
#   define EAPI_MAIN __attribute__ ((visibility("default")))
#  else
#   define EAPI_MAIN
#  endif
# else
#  define EAPI_MAIN
# endif
#endif /* ! _WIN32 */

#ifdef __EFL_UI_IS_REQUIRED
# define __EFL_UI(...) __VA_ARGS__
# define __EFL_UI_IS_DEFINED
#else
# define __EFL_UI(...)
#endif

#ifdef __EFL_NET_IS_REQUIRED
# define __EFL_NET(...) __VA_ARGS__
#else
# define __EFL_NET(...)
#endif

#ifdef EFL_BETA_API_SUPPORT

// This file is designed to be included again and again
// so cleanup last inclusion before generating this one.
#undef _EFL_VERSION_MICRO
#undef _EFL_VERSION_REVISION
#undef _EFL_VERSION_FLAVOR
#undef _EFL_BUILD_ID
#undef _EFL_APP_VERSION_SET
#undef __EFL_MAIN_CONSTRUCTOR
#undef __EFL_MAIN_DESTRUCTOR
#undef EFL_MAIN
#undef EFL_MAIN_EX

#ifdef EFL_VERSION_MICRO
# define _EFL_VERSION_MICRO EFL_VERSION_MICRO
#else
# define _EFL_VERSION_MICRO 0
#endif

#ifdef EFL_VERSION_REVISION
# define _EFL_VERSION_REVISION EFL_VERSION_REVISION
#else
# define _EFL_VERSION_REVISION 0
#endif

#ifdef EFL_VERSION_FLAVOR
# define _EFL_VERSION_FLAVOR EFL_VERSION_FLAVOR
#else
# define _EFL_VERSION_FLAVOR NULL
#endif

#ifdef EFL_BUILD_ID
# define _EFL_BUILD_ID EFL_BUILD_ID
#else
# define _EFL_BUILD_ID NULL
#endif

#define __EFL_MAIN_CONSTRUCTOR                  \
  __EFL_NET(ecore_con_init();)                  \
  __EFL_NET(ecore_con_url_init();)              \
  __EFL_UI(elm_init(argc, argv);)

#define __EFL_MAIN_DESTRUCTOR                   \
  __EFL_UI(elm_shutdown();)                     \
  __EFL_NET(ecore_con_url_shutdown();)          \
  __EFL_NET(ecore_con_shutdown();)

#define _EFL_APP_VERSION_SET()                                          \
  do {                                                                  \
     if (efl_build_version_set)                                         \
       efl_build_version_set(EFL_VERSION_MAJOR, EFL_VERSION_MINOR, _EFL_VERSION_MICRO, \
                             _EFL_VERSION_REVISION, _EFL_VERSION_FLAVOR, _EFL_BUILD_ID); \
  } while (0)

#define EFL_MAIN() int main(int argc, char **argv)                      \
  {                                                                     \
     Eina_Value *ret__;                                                 \
     int real__;                                                        \
     _efl_startup_time = ecore_time_unix_get();                         \
     _EFL_APP_VERSION_SET();                                            \
     ecore_init();                                                      \
     efl_event_callback_add(efl_main_loop_get(), EFL_LOOP_EVENT_ARGUMENTS, efl_main, NULL); \
     ecore_init_ex(argc, argv);                                         \
     __EFL_MAIN_CONSTRUCTOR;                                            \
     ret__ = efl_loop_begin(efl_main_loop_get());                     \
     real__ = efl_loop_exit_code_process(ret__);                        \
     __EFL_MAIN_DESTRUCTOR;                                             \
     ecore_shutdown_ex();                                               \
     ecore_shutdown();                                                  \
     return real__;                                                     \
  }

#define EFL_MAIN_EX()                                                   \
  EFL_CALLBACKS_ARRAY_DEFINE(_efl_main_ex,                              \
                             { EFL_LOOP_EVENT_ARGUMENTS, efl_main },    \
                             { EFL_APP_EVENT_PAUSE, efl_pause },       \
                             { EFL_APP_EVENT_RESUME, efl_resume },     \
                             { EFL_APP_EVENT_TERMINATE, efl_terminate });         \
  int main(int argc, char **argv)                                       \
  {                                                                     \
     Eina_Value *ret__;                                                 \
     int real__;                                                        \
     _efl_startup_time = ecore_time_unix_get();                         \
     _EFL_APP_VERSION_SET();                                            \
     ecore_init();                                                      \
     efl_event_callback_array_add(efl_main_loop_get(), _efl_main_ex(), NULL); \
     ecore_init_ex(argc, argv);                                         \
     __EFL_MAIN_CONSTRUCTOR;                                            \
     ret__ = efl_loop_begin(efl_main_loop_get());                     \
     real__ = efl_loop_exit_code_process(ret__);                        \
     __EFL_MAIN_DESTRUCTOR;                                             \
     ecore_shutdown_ex();                                               \
     ecore_shutdown();                                                  \
     return real__;                                                     \
  }

#endif /* EFL_BETA_API_SUPPORT */