1 /* EINA - EFL data type library
2 * Copyright (C) 2008 Cedric Bail
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library;
16 * if not, see <http://www.gnu.org/licenses/>.
25 #include "eina_types.h"
26 #include "eina_main.h"
27 #include "eina_error.h"
28 #include "eina_hash.h"
29 #include "eina_stringshare.h"
30 #include "eina_list.h"
31 #include "eina_array.h"
32 #include "eina_counter.h"
33 #include "eina_benchmark.h"
34 #include "eina_magic.h"
35 #include "eina_rectangle.h"
37 /*============================================================================*
39 *============================================================================*/
41 /*============================================================================*
43 *============================================================================*/
45 static int _eina_main_count = 0;
50 if (_eina_main_count) goto finish_init;
52 if (!eina_error_init())
54 fprintf(stderr, "Could not initialize eina error module.\n");
57 if (!eina_hash_init())
59 EINA_ERROR_PERR("Could not initialize eina hash module.\n");
62 if (!eina_stringshare_init())
64 EINA_ERROR_PERR("Could not initialize eina stringshare module.\n");
65 goto stringshare_init_error;
67 if (!eina_list_init())
69 EINA_ERROR_PERR("Could not initialize eina list module.\n");
72 if (!eina_array_init())
74 EINA_ERROR_PERR("Could not initialize eina array module.\n");
75 goto array_init_error;
77 if (!eina_counter_init())
79 EINA_ERROR_PERR("Could not initialize eina counter module.\n");
80 goto counter_init_error;
82 if (!eina_benchmark_init())
84 EINA_ERROR_PERR("Could not initialize eina benchmark module.\n");
85 goto benchmark_init_error;
87 if (!eina_magic_string_init())
89 EINA_ERROR_PERR("Could not initialize eina magic string module.\n");
90 goto magic_string_init_error;
92 if (!eina_rectangle_init())
94 EINA_ERROR_PERR("Could not initialize eina rectangle module.\n");
95 goto rectangle_init_error;
99 return ++_eina_main_count;
101 rectangle_init_error:
102 eina_magic_string_shutdown();
103 magic_string_init_error:
104 eina_benchmark_shutdown();
105 benchmark_init_error:
106 eina_counter_shutdown();
108 eina_array_shutdown();
110 eina_list_shutdown();
112 eina_stringshare_shutdown();
113 stringshare_init_error:
114 eina_hash_shutdown();
116 eina_error_shutdown();
123 if (_eina_main_count != 1) goto finish_shutdown;
125 eina_rectangle_shutdown();
126 eina_magic_string_shutdown();
127 eina_benchmark_shutdown();
128 eina_counter_shutdown();
129 eina_array_shutdown();
130 eina_list_shutdown();
131 eina_stringshare_shutdown();
132 eina_hash_shutdown();
133 eina_error_shutdown();
136 return --_eina_main_count;