/[zanavi_public1]/navit/navit/start_real.c
ZANavi

Diff of /navit/navit/start_real.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 27 Revision 30
1/**
2 * ZANavi, Zoff Android Navigation system.
3 * Copyright (C) 2011-2012 Zoff <zoff@zoff.cc>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
8 *
9 * This program 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
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
1/** 20/**
2 * Navit, a modular navigation system. 21 * Navit, a modular navigation system.
3 * Copyright (C) 2005-2008 Navit Team 22 * Copyright (C) 2005-2008 Navit Team
4 * 23 *
5 * This program is free software; you can redistribute it and/or 24 * This program is free software; you can redistribute it and/or
64extern void builtin_init(void); 83extern void builtin_init(void);
65#endif /* USE_PLUGINS*/ 84#endif /* USE_PLUGINS*/
66 85
67int main_real(int argc, char **argv) 86int main_real(int argc, char **argv)
68{ 87{
88 dbg(0,"in main loop 001 ##########################\n");
89
69 xmlerror *error = NULL; 90 xmlerror *error = NULL;
70 char *config_file = NULL; 91 char *config_file = NULL;
71 int opt; 92 int opt;
72 char *cp; 93 char *cp;
73 struct attr navit; 94 struct attr navit;
74 95
75 GList *list = NULL, *li; 96 GList *list = NULL, *li;
76 main_argc=argc; 97 main_argc=argc;
77 main_argv=argv; 98 main_argv=argv;
78 99
100 dbg(0,"in main loop 002 ##########################\n");
79 101
80#ifdef HAVE_GLIB 102#ifdef HAVE_GLIB
81 event_glib_init(); 103 event_glib_init();
104 dbg(0,"in main loop 003 ##########################\n");
82#else 105#else
83 _g_slice_thread_init_nomessage(); 106 _g_slice_thread_init_nomessage();
107 dbg(0,"in main loop 004 ##########################\n");
84#endif 108#endif
85 atom_init(); 109 atom_init();
86 main_init(argv[0]); 110 main_init(argv[0]);
87 main_init_nls(); 111 main_init_nls();
88 debug_init(argv[0]); 112 debug_init(argv[0]);
89 113
90 cp = getenv("NAVIT_LOGFILE"); 114 cp = getenv("NAVIT_LOGFILE");
91 if (cp) { 115 if (cp)
116 {
92 debug_set_logfile(cp); 117 debug_set_logfile(cp);
93 } 118 }
94#ifdef HAVE_API_WIN32_CE 119#ifdef HAVE_API_WIN32_CE
95 else { 120 else
121 {
96 debug_set_logfile("/Storage Card/navit.log"); 122 debug_set_logfile("/Storage Card/navit.log");
97 } 123 }
98#endif 124#endif
125
126
127 dbg(0,"in main loop 005 ##########################\n");
99 file_init(); 128 file_init();
129 dbg(0,"in main loop 006 ##########################\n");
130
100#ifndef USE_PLUGINS 131#ifndef USE_PLUGINS
132 dbg(0,"in main loop 007 ##########################\n");
101 builtin_init(); 133 builtin_init();
102#endif 134#endif
135
136 dbg(0,"in main loop 008 ##########################\n");
103 route_init(); 137 route_init();
138 dbg(0,"in main loop 008.1 ##########################\n");
104 navigation_init(); 139 navigation_init();
140 dbg(0,"in main loop 008.2 ##########################\n");
105 tracking_init(); 141 tracking_init();
142 dbg(0,"in main loop 008.3 ##########################\n");
106 search_init(); 143 search_init();
144 dbg(0,"in main loop 008.4 ##########################\n");
107 linguistics_init(); 145 linguistics_init();
146 dbg(0,"in main loop 0014 ##########################\n");
147
108 config_file=NULL; 148 config_file=NULL;
109#ifdef HAVE_GETOPT_H 149#ifdef HAVE_GETOPT_H
110 opterr=0; //don't bomb out on errors. 150 opterr=0; //don't bomb out on errors.
111#endif /* _MSC_VER */ 151#endif /* _MSC_VER */
112 if (argc > 1) { 152 if (argc > 1) {
182 if (file_exists(config_file)) 222 if (file_exists(config_file))
183 { 223 {
184 break; 224 break;
185 } 225 }
186 else 226 else
227 {
187 g_free(config_file); 228 g_free(config_file);
229 }
188 li = g_list_next(li); 230 li = g_list_next(li);
189 } 231 }
190 232
233
234 // ############### load XML config file, and call all the init/new functions ################
235 // ############### load XML config file, and call all the init/new functions ################
236 // ############### load XML config file, and call all the init/new functions ################
237 clock_t s_ = debug_measure_start();
191 if (!config_load(config_file, &error)) 238 if (!config_load(config_file, &error))
192 { 239 {
193 } 240 }
241 debug_mrp("load and init xmlconfig:", debug_measure_end(s_));
242 // ############### load XML config file, and call all the init/new functions ################
243 // ############### load XML config file, and call all the init/new functions ################
244 // ############### load XML config file, and call all the init/new functions ################
245
194 246
195 while (li) 247 while (li)
196 { 248 {
197 g_free(li->data); 249 g_free(li->data);
198 li = g_list_next(li); 250 li = g_list_next(li);
199 } 251 }
252
200 g_list_free(list); 253 g_list_free(list);
254
201 if (! config_get_attr(config, attr_navit, &navit, NULL) && !config_empty_ok) { 255 if (! config_get_attr(config, attr_navit, &navit, NULL) && !config_empty_ok)
256 {
202 dbg(0, "No instance has been created, exiting\n"); 257 dbg(0, "No instance has been created, exiting\n");
203 exit(1); 258 exit(1);
204 } 259 }
260
261 dbg(0,"in main loop 026 ##########################\n");
205 event_main_loop_run(); 262 event_main_loop_run();
206
207 dbg(0,"1 after main loop ##########################"); 263 dbg(0,"after main loop ##########################");
208 dbg(0,"2 after main loop ##########################");
209 dbg(0,"3 after main loop ##########################");
210 dbg(0,"4 after main loop ##########################");
211 dbg(0,"5 after main loop ##########################");
212 264
213#ifndef HAVE_API_ANDROID 265#ifndef HAVE_API_ANDROID
214 debug_finished(); 266 debug_finished();
215#endif 267#endif
216 return 0; 268 return 0;

Legend:
Removed from v.27  
changed lines
  Added in v.30

   
Visit the ZANavi Wiki