summaryrefslogtreecommitdiff
path: root/navit
diff options
context:
space:
mode:
authorsleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220>2014-11-22 22:34:19 +0000
committersleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220>2014-11-22 22:34:19 +0000
commit2a6aa9b917249f44e4aa27d88e255f61eb171d6a (patch)
tree0ad46b248e42f96e93b54874aa3b073ad1273aa1 /navit
parent05edfdebd6b83267121b11538abafe39bff266e7 (diff)
downloadnavit-2a6aa9b917249f44e4aa27d88e255f61eb171d6a.tar.gz
Refactor:core:Introduce enum for debug levels, and use it everywhere.|First part of #1269.
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5960 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit')
-rw-r--r--navit/android.c110
-rw-r--r--navit/attr.c20
-rw-r--r--navit/autoload/osso/osso.c10
-rw-r--r--navit/binding/dbus/binding_dbus.c62
-rw-r--r--navit/binding/python/config.c2
-rw-r--r--navit/binding/python/navit.c8
-rw-r--r--navit/binding/python/pcoord.c2
-rw-r--r--navit/binding/win32/binding_win32.c20
-rw-r--r--navit/bookmarks.c12
-rw-r--r--navit/cache.c44
-rw-r--r--navit/callback.c10
-rw-r--r--navit/command.c50
-rw-r--r--navit/config_.c8
-rw-r--r--navit/coord.c34
-rw-r--r--navit/debug.c24
-rw-r--r--navit/debug.h26
-rw-r--r--navit/event.c6
-rw-r--r--navit/file.c32
-rw-r--r--navit/font/freetype/font_freetype.c16
-rw-r--r--navit/graphics.c62
-rw-r--r--navit/graphics/android/graphics_android.c88
-rw-r--r--navit/graphics/gd/graphics_gd.c42
-rw-r--r--navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c32
-rw-r--r--navit/graphics/null/graphics_null.c20
-rw-r--r--navit/graphics/opengl/graphics_opengl.c32
-rw-r--r--navit/graphics/opengl/graphics_opengl_egl.c14
-rw-r--r--navit/graphics/opengl/graphics_opengl_x11.c18
-rw-r--r--navit/graphics/qt_qpainter/RenderArea.cpp12
-rw-r--r--navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp28
-rw-r--r--navit/graphics/sdl/event.c32
-rw-r--r--navit/graphics/sdl/event_sdl.c30
-rw-r--r--navit/graphics/sdl/graphics_sdl.c112
-rw-r--r--navit/graphics/win32/graphics_win32.c70
-rw-r--r--navit/gui.c4
-rw-r--r--navit/gui/gtk/datawindow.c2
-rw-r--r--navit/gui/gtk/destination.c16
-rw-r--r--navit/gui/gtk/gui_gtk_action.c6
-rw-r--r--navit/gui/gtk/gui_gtk_poi.c8
-rw-r--r--navit/gui/gtk/gui_gtk_window.c10
-rw-r--r--navit/gui/internal/gui_internal.c86
-rw-r--r--navit/gui/internal/gui_internal_bookmark.c6
-rw-r--r--navit/gui/internal/gui_internal_command.c52
-rw-r--r--navit/gui/internal/gui_internal_gesture.c14
-rw-r--r--navit/gui/internal/gui_internal_html.c16
-rw-r--r--navit/gui/internal/gui_internal_menu.c4
-rw-r--r--navit/gui/internal/gui_internal_poi.c16
-rw-r--r--navit/gui/internal/gui_internal_search.c26
-rw-r--r--navit/gui/internal/gui_internal_widget.c8
-rw-r--r--navit/gui/qml/bookmarksProxy.h4
-rw-r--r--navit/gui/qml/gui_qml.cpp10
-rw-r--r--navit/gui/qml/navitProxy.h2
-rw-r--r--navit/gui/qml/ngqpoint.h2
-rw-r--r--navit/gui/qml/proxy.h2
-rw-r--r--navit/gui/qml/routeProxy.h4
-rw-r--r--navit/gui/qml/searchProxy.h6
-rw-r--r--navit/gui/win32/gui_win32.c6
-rw-r--r--navit/gui/win32/win32_gui_destination.c8
-rw-r--r--navit/item.c6
-rw-r--r--navit/layout.c10
-rw-r--r--navit/linguistics.c4
-rw-r--r--navit/log.c14
-rw-r--r--navit/main.c4
-rw-r--r--navit/map.c12
-rw-r--r--navit/map/binfile/binfile.c188
-rw-r--r--navit/map/csv/csv.c44
-rw-r--r--navit/map/csv/quadtree.c26
-rw-r--r--navit/map/filter/filter.c10
-rw-r--r--navit/map/mg/block.c18
-rw-r--r--navit/map/mg/map.c36
-rw-r--r--navit/map/mg/poly.c6
-rw-r--r--navit/map/mg/street.c80
-rw-r--r--navit/map/mg/town.c22
-rw-r--r--navit/map/mg/tree.c52
-rw-r--r--navit/map/shapefile/shapefile.c26
-rw-r--r--navit/map/textfile/textfile.c54
-rw-r--r--navit/maps.c8
-rw-r--r--navit/mapset.c2
-rw-r--r--navit/maptool/ch.c10
-rw-r--r--navit/maptool/coastline.c18
-rw-r--r--navit/navigation.c138
-rw-r--r--navit/navit.c138
-rw-r--r--navit/osd.c18
-rw-r--r--navit/osd/core/osd_core.c40
-rw-r--r--navit/plugin.c26
-rw-r--r--navit/plugin/pedestrian/pedestrian.c140
-rw-r--r--navit/popup.c14
-rw-r--r--navit/profile.c2
-rw-r--r--navit/profile_option.c2
-rw-r--r--navit/projection.c8
-rw-r--r--navit/route.c128
-rw-r--r--navit/routech.c22
-rw-r--r--navit/script.c10
-rw-r--r--navit/search.c62
-rw-r--r--navit/search_houseno_interpol.c20
-rw-r--r--navit/speech.c16
-rw-r--r--navit/speech/android/speech_android.c14
-rw-r--r--navit/speech/cmdline/speech_cmdline.c16
-rw-r--r--navit/speech/espeak/speak.c30
-rw-r--r--navit/start_real.c14
-rw-r--r--navit/support/libc/stat.c8
-rw-r--r--navit/support/win32/serial_io.c16
-rw-r--r--navit/support/wordexp/glob.c6
-rw-r--r--navit/track.c54
-rw-r--r--navit/transform.c48
-rw-r--r--navit/util.c26
-rw-r--r--navit/vehicle.c24
-rw-r--r--navit/vehicle/android/vehicle_android.c36
-rw-r--r--navit/vehicle/demo/vehicle_demo.c24
-rw-r--r--navit/vehicle/file/vehicle_file.c70
-rw-r--r--navit/vehicle/gpsd/vehicle_gpsd.c44
-rw-r--r--navit/vehicle/gpsd_dbus/vehicle_gpsd_dbus.c10
-rw-r--r--navit/vehicle/gypsy/vehicle_gypsy.c12
-rw-r--r--navit/vehicle/iphone/vehicle_iphone.c8
-rw-r--r--navit/vehicle/maemo/vehicle_maemo.c76
-rw-r--r--navit/vehicle/null/vehicle_null.c12
-rw-r--r--navit/vehicle/webos/bluetooth.c92
-rw-r--r--navit/vehicle/webos/vehicle_webos.c32
-rw-r--r--navit/vehicle/wince/vehicle_wince.c82
-rw-r--r--navit/vehicleprofile.c18
-rw-r--r--navit/xmlconfig.c50
120 files changed, 1846 insertions, 1816 deletions
diff --git a/navit/android.c b/navit/android.c
index b5a45791d..bee9ec8b0 100644
--- a/navit/android.c
+++ b/navit/android.c
@@ -43,7 +43,7 @@ android_find_class_global(char *name, jclass *ret)
{
*ret=(*jnienv)->FindClass(jnienv, name);
if (! *ret) {
- dbg(0,"Failed to get Class %s\n",name);
+ dbg(lvl_error,"Failed to get Class %s\n",name);
return 0;
}
*ret = (*jnienv)->NewGlobalRef(jnienv, *ret);
@@ -55,7 +55,7 @@ android_find_method(jclass class, char *name, char *args, jmethodID *ret)
{
*ret = (*jnienv)->GetMethodID(jnienv, class, name, args);
if (*ret == NULL) {
- dbg(0,"Failed to get Method %s with signature %s\n",name,args);
+ dbg(lvl_error,"Failed to get Method %s with signature %s\n",name,args);
return 0;
}
return 1;
@@ -67,7 +67,7 @@ android_find_static_method(jclass class, char *name, char *args, jmethodID *ret)
{
*ret = (*jnienv)->GetStaticMethodID(jnienv, class, name, args);
if (*ret == NULL) {
- dbg(0,"Failed to get static Method %s with signature %s\n",name,args);
+ dbg(lvl_error,"Failed to get static Method %s with signature %s\n",name,args);
return 0;
}
return 1;
@@ -83,12 +83,12 @@ Java_org_navitproject_navit_Navit_NavitMain( JNIEnv* env, jobject thiz, jobject
jnienv=env;
android_activity = (*jnienv)->NewGlobalRef(jnienv, activity);
langstr=(*env)->GetStringUTFChars(env, lang, NULL);
- dbg(0,"enter env=%p thiz=%p activity=%p lang=%s version=%d\n",env,thiz,android_activity,langstr,version);
+ dbg(lvl_error,"enter env=%p thiz=%p activity=%p lang=%s version=%d\n",env,thiz,android_activity,langstr,version);
setenv("LANG",langstr,1);
(*env)->ReleaseStringUTFChars(env, lang, langstr);
displaydensitystr=(*env)->GetStringUTFChars(env, display_density_string, NULL);
- dbg(0,"*****displaydensity=%s\n",displaydensitystr);
+ dbg(lvl_error,"*****displaydensity=%s\n",displaydensitystr);
setenv("ANDROID_DENSITY",displaydensitystr,1);
(*env)->ReleaseStringUTFChars(env, display_density_string, displaydensitystr);
const char *strings=(*env)->GetStringUTFChars(env, path, NULL);
@@ -99,14 +99,14 @@ Java_org_navitproject_navit_Navit_NavitMain( JNIEnv* env, jobject thiz, jobject
JNIEXPORT void JNICALL
Java_org_navitproject_navit_Navit_NavitDestroy( JNIEnv* env)
{
- dbg(0, "shutdown navit\n");
+ dbg(lvl_error, "shutdown navit\n");
exit(0);
}
JNIEXPORT void JNICALL
Java_org_navitproject_navit_NavitGraphics_SizeChangedCallback( JNIEnv* env, jobject thiz, int id, int w, int h)
{
- dbg(0,"enter %p %d %d\n",(struct callback *)id,w,h);
+ dbg(lvl_error,"enter %p %d %d\n",(struct callback *)id,w,h);
if (id)
callback_call_2((struct callback *)id,w,h);
}
@@ -114,7 +114,7 @@ Java_org_navitproject_navit_NavitGraphics_SizeChangedCallback( JNIEnv* env, jobj
JNIEXPORT void JNICALL
Java_org_navitproject_navit_NavitGraphics_ButtonCallback( JNIEnv* env, jobject thiz, int id, int pressed, int button, int x, int y)
{
- dbg(1,"enter %p %d %d\n",(struct callback *)id,pressed,button);
+ dbg(lvl_warning,"enter %p %d %d\n",(struct callback *)id,pressed,button);
if (id)
callback_call_4((struct callback *)id,pressed,button,x,y);
}
@@ -122,7 +122,7 @@ Java_org_navitproject_navit_NavitGraphics_ButtonCallback( JNIEnv* env, jobject t
JNIEXPORT void JNICALL
Java_org_navitproject_navit_NavitGraphics_MotionCallback( JNIEnv* env, jobject thiz, int id, int x, int y)
{
- dbg(1,"enter %p %d %d\n",(struct callback *)id,x,y);
+ dbg(lvl_warning,"enter %p %d %d\n",(struct callback *)id,x,y);
if (id)
callback_call_2((struct callback *)id,x,y);
}
@@ -131,9 +131,9 @@ JNIEXPORT void JNICALL
Java_org_navitproject_navit_NavitGraphics_KeypressCallback( JNIEnv* env, jobject thiz, int id, jobject str)
{
const char *s;
- dbg(0,"enter %p %p\n",(struct callback *)id,str);
+ dbg(lvl_error,"enter %p %p\n",(struct callback *)id,str);
s=(*env)->GetStringUTFChars(env, str, NULL);
- dbg(0,"key=%d",s);
+ dbg(lvl_error,"key=%d",s);
if (id)
callback_call_1((struct callback *)id,s);
(*env)->ReleaseStringUTFChars(env, str, s);
@@ -143,7 +143,7 @@ JNIEXPORT void JNICALL
Java_org_navitproject_navit_NavitTimeout_TimeoutCallback( JNIEnv* env, jobject thiz, int id)
{
void (*event_handler)(void *) = *(void **)id;
- dbg(1,"enter %p %p\n",thiz, (void *)id);
+ dbg(lvl_warning,"enter %p %p\n",thiz, (void *)id);
event_handler((void*)id);
}
@@ -156,7 +156,7 @@ Java_org_navitproject_navit_NavitVehicle_VehicleCallback( JNIEnv * env, jobject
JNIEXPORT void JNICALL
Java_org_navitproject_navit_NavitIdle_IdleCallback( JNIEnv* env, jobject thiz, int id)
{
- dbg(1,"enter %p %p\n",thiz, (void *)id);
+ dbg(lvl_warning,"enter %p %p\n",thiz, (void *)id);
callback_call_0((struct callback *)id);
}
@@ -171,14 +171,14 @@ Java_org_navitproject_navit_NavitWatch_poll( JNIEnv* env, jobject thiz, int func
JNIEXPORT void JNICALL
Java_org_navitproject_navit_NavitWatch_WatchCallback( JNIEnv* env, jobject thiz, int id)
{
- dbg(1,"enter %p %p\n",thiz, (void *)id);
+ dbg(lvl_warning,"enter %p %p\n",thiz, (void *)id);
callback_call_0((struct callback *)id);
}
JNIEXPORT void JNICALL
Java_org_navitproject_navit_NavitSensors_SensorCallback( JNIEnv* env, jobject thiz, int id, int sensor, float x, float y, float z)
{
- dbg(1,"enter %p %p %f %f %f\n",thiz, (void *)id,x,y,z);
+ dbg(lvl_warning,"enter %p %p %f %f %f\n",thiz, (void *)id,x,y,z);
callback_call_4((struct callback *)id, sensor, &x, &y, &z);
}
@@ -208,10 +208,10 @@ Java_org_navitproject_navit_NavitGraphics_CallbackLocalizedString( JNIEnv* env,
const char *localized_str;
s=(*env)->GetStringUTFChars(env, str, NULL);
- //dbg(0,"*****string=%s\n",s);
+ //dbg(lvl_error,"*****string=%s\n",s);
localized_str=navit_nls_gettext(s);
- //dbg(0,"localized string=%s",localized_str);
+ //dbg(lvl_error,"localized string=%s",localized_str);
// jstring dataStringValue = (jstring) localized_str;
jstring js = (*env)->NewStringUTF(env,localized_str);
@@ -227,7 +227,7 @@ Java_org_navitproject_navit_NavitGraphics_CallbackMessageChannel( JNIEnv* env, j
struct attr attr;
const char *s;
jint ret = 0;
- dbg(0,"enter %d %p\n",channel,str);
+ dbg(lvl_error,"enter %d %p\n",channel,str);
config_get_attr(config_get(), attr_navit, &attr, NULL);
@@ -248,7 +248,7 @@ Java_org_navitproject_navit_NavitGraphics_CallbackMessageChannel( JNIEnv* env, j
struct mapset *ms = navit_get_mapset(attr.u.navit);
struct attr type, name, data, *attrs[4];
const char *map_location=(*env)->GetStringUTFChars(env, str, NULL);
- dbg(0,"*****string=%s\n",map_location);
+ dbg(lvl_error,"*****string=%s\n",map_location);
type.type=attr_type;
type.u.str="binfile";
@@ -280,7 +280,7 @@ Java_org_navitproject_navit_NavitGraphics_CallbackMessageChannel( JNIEnv* env, j
if (delete_map)
{
- dbg(0,"delete map %s (%p)", map_location, delete_map);
+ dbg(lvl_error,"delete map %s (%p)", map_location, delete_map);
map_r.type=attr_map;
map_r.u.map=delete_map;
ret = mapset_remove_attr(ms, &map_r);
@@ -292,7 +292,7 @@ Java_org_navitproject_navit_NavitGraphics_CallbackMessageChannel( JNIEnv* env, j
case 5:
// call a command (like in gui)
s=(*env)->GetStringUTFChars(env, str, NULL);
- dbg(0,"*****string=%s\n",s);
+ dbg(lvl_error,"*****string=%s\n",s);
command_evaluate(&attr,s);
(*env)->ReleaseStringUTFChars(env, str, s);
break;
@@ -310,7 +310,7 @@ Java_org_navitproject_navit_NavitGraphics_CallbackMessageChannel( JNIEnv* env, j
char parse_str[strlen(s) + 1];
strcpy(parse_str, s);
(*env)->ReleaseStringUTFChars(env, str, s);
- dbg(0,"*****string=%s\n",parse_str);
+ dbg(lvl_error,"*****string=%s\n",parse_str);
// set destination to (pixel-x#pixel-y)
// pixel-x
@@ -320,8 +320,8 @@ Java_org_navitproject_navit_NavitGraphics_CallbackMessageChannel( JNIEnv* env, j
pstr = strtok (NULL, "#");
p.y = atoi(pstr);
- dbg(0,"11x=%d\n",p.x);
- dbg(0,"11y=%d\n",p.y);
+ dbg(lvl_error,"11x=%d\n",p.x);
+ dbg(lvl_error,"11y=%d\n",p.y);
transform_reverse(transform, &p, &c);
@@ -330,8 +330,8 @@ Java_org_navitproject_navit_NavitGraphics_CallbackMessageChannel( JNIEnv* env, j
pc.y = c.y;
pc.pro = transform_get_projection(transform);
- dbg(0,"22x=%d\n",pc.x);
- dbg(0,"22y=%d\n",pc.y);
+ dbg(lvl_error,"22x=%d\n",pc.x);
+ dbg(lvl_error,"22y=%d\n",pc.y);
// start navigation asynchronous
navit_set_destination(attr.u.navit, &pc, parse_str, 1);
@@ -345,7 +345,7 @@ Java_org_navitproject_navit_NavitGraphics_CallbackMessageChannel( JNIEnv* env, j
char parse_str[strlen(s) + 1];
strcpy(parse_str, s);
(*env)->ReleaseStringUTFChars(env, str, s);
- dbg(0,"*****string=%s\n",s);
+ dbg(lvl_error,"*****string=%s\n",s);
// set destination to (lat#lon#title)
struct coord_geo g;
@@ -361,9 +361,9 @@ Java_org_navitproject_navit_NavitGraphics_CallbackMessageChannel( JNIEnv* env, j
// description
name = strtok (NULL, "#");
- dbg(0,"lat=%f\n",g.lat);
- dbg(0,"lng=%f\n",g.lng);
- dbg(0,"str1=%s\n",name);
+ dbg(lvl_error,"lat=%f\n",g.lat);
+ dbg(lvl_error,"lng=%f\n",g.lng);
+ dbg(lvl_error,"str1=%s\n",name);
struct coord c;
transform_from_geo(projection_mg, &g, &c);
@@ -379,7 +379,7 @@ Java_org_navitproject_navit_NavitGraphics_CallbackMessageChannel( JNIEnv* env, j
}
break;
default:
- dbg(0, "Unknown command");
+ dbg(lvl_error, "Unknown command");
}
return ret;
@@ -394,7 +394,7 @@ Java_org_navitproject_navit_NavitGraphics_GetDefaultCountry( JNIEnv* env, jobjec
jstring return_string = NULL;
struct attr attr;
- dbg(0,"enter %d %p\n",channel,str);
+ dbg(lvl_error,"enter %d %p\n",channel,str);
config_get_attr(config_get(), attr_navit, &attr, NULL);
@@ -409,12 +409,12 @@ Java_org_navitproject_navit_NavitGraphics_GetDefaultCountry( JNIEnv* env, jobjec
struct mapset *ms=navit_get_mapset(attr.u.navit);
struct search_list *search_list = search_list_new(ms);
search_attr.type=attr_country_all;
- dbg(0,"country %s\n", country_name.u.str);
+ dbg(lvl_error,"country %s\n", country_name.u.str);
search_attr.u.str=country_name.u.str;
search_list_search(search_list, &search_attr, 0);
while((res=search_list_get_result(search_list)))
{
- dbg(0,"Get result: %s\n", res->country->iso2);
+ dbg(lvl_error,"Get result: %s\n", res->country->iso2);
}
if (item_attr_get(item, attr_country_iso2, &country_iso2))
return_string = (*env)->NewStringUTF(env,country_iso2.u.str);
@@ -435,7 +435,7 @@ Java_org_navitproject_navit_NavitGraphics_GetAllCountries( JNIEnv* env, jobject
jobjectArray all_countries;
struct attr attr;
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
config_get_attr(config_get(), attr_navit, &attr, NULL);
@@ -443,12 +443,12 @@ Java_org_navitproject_navit_NavitGraphics_GetAllCountries( JNIEnv* env, jobject
struct search_list *search_list = search_list_new(ms);
jobjectArray current_country = NULL;
search_attr.type=attr_country_all;
- //dbg(0,"country %s\n", country_name.u.str);
+ //dbg(lvl_error,"country %s\n", country_name.u.str);
search_attr.u.str=g_strdup("");//country_name.u.str;
search_list_search(search_list, &search_attr, 1);
while((res=search_list_get_result(search_list)))
{
- dbg(0,"Get result: %s\n", res->country->iso2);
+ dbg(lvl_error,"Get result: %s\n", res->country->iso2);
if (strlen(res->country->iso2)==2)
{
@@ -543,7 +543,7 @@ town_str(struct search_list_result *res, int level)
static void
android_search_end(struct android_search_priv *search_priv)
{
- dbg(1, "End search");
+ dbg(lvl_warning, "End search");
JNIEnv* env = search_priv->search_result_obj.env;
if (search_priv->idle_ev) {
event_remove_idle(search_priv->idle_ev);
@@ -558,7 +558,7 @@ android_search_end(struct android_search_priv *search_priv)
if(finish_MethodID != 0) {
(*env)->CallVoidMethod(env, search_priv->search_result_obj.jo, finish_MethodID);
} else {
- dbg(0, "Error method finishAddressSearch not found");
+ dbg(lvl_error, "Error method finishAddressSearch not found");
}
search_list_destroy(search_priv->search_list);
@@ -575,11 +575,11 @@ static enum attr_type android_search_level[] = {
static void
android_search_idle(struct android_search_priv *search_priv)
{
- dbg(1, "enter android_search_idle");
+ dbg(lvl_warning, "enter android_search_idle");
struct search_list_result *res = search_list_get_result(search_priv->search_list);
if (res) {
- dbg(1, "Town: %s, Street: %s\n",res->town ? res->town->common.town_name : "no town", res->street ? res->street->name : "no street");
+ dbg(lvl_warning, "Town: %s, Street: %s\n",res->town ? res->town->common.town_name : "no town", res->street ? res->street->name : "no street");
search_priv->found = 1;
switch (search_priv->search_attr.type)
{
@@ -609,7 +609,7 @@ android_search_idle(struct android_search_priv *search_priv)
break;
}
default:
- dbg(0, "Unhandled search type %d", search_priv->search_attr.type);
+ dbg(lvl_error, "Unhandled search type %d", search_priv->search_attr.type);
}
} else {
int level = search_list_level(search_priv->search_attr.type) - 1;
@@ -620,10 +620,10 @@ android_search_idle(struct android_search_priv *search_priv)
level++;
}
}
- dbg(2, "test phrase: %d,%d, %d, level %d", search_priv->current_phrase_per_level[0], search_priv->current_phrase_per_level[1], search_priv->current_phrase_per_level[2] , level)
+ dbg(lvl_info, "test phrase: %d,%d, %d, level %d", search_priv->current_phrase_per_level[0], search_priv->current_phrase_per_level[1], search_priv->current_phrase_per_level[2] , level)
do {
while (!search_priv->phrases[++search_priv->current_phrase_per_level[level]]) {
- dbg(2, "next phrase: %d,%d, %d, level %d", search_priv->current_phrase_per_level[0], search_priv->current_phrase_per_level[1], search_priv->current_phrase_per_level[2] , level)
+ dbg(lvl_info, "next phrase: %d,%d, %d, level %d", search_priv->current_phrase_per_level[0], search_priv->current_phrase_per_level[1], search_priv->current_phrase_per_level[2] , level)
if (level > 0) {
search_priv->current_phrase_per_level[level] = -1;
level--;
@@ -633,8 +633,8 @@ android_search_idle(struct android_search_priv *search_priv)
}
}
} while (level > 0 ? search_priv->current_phrase_per_level[level] == search_priv->current_phrase_per_level[level-1] : 0);
- dbg(2, "used phrase: %d,%d, %d, level %d, '%s'", search_priv->current_phrase_per_level[0], search_priv->current_phrase_per_level[1], search_priv->current_phrase_per_level[2] , level, attr_to_name(android_search_level[level]))
- dbg(1, "Search for '%s'", search_priv->phrases[search_priv->current_phrase_per_level[level]]);
+ dbg(lvl_info, "used phrase: %d,%d, %d, level %d, '%s'", search_priv->current_phrase_per_level[0], search_priv->current_phrase_per_level[1], search_priv->current_phrase_per_level[2] , level, attr_to_name(android_search_level[level]))
+ dbg(lvl_warning, "Search for '%s'", search_priv->phrases[search_priv->current_phrase_per_level[level]]);
search_priv->search_attr.type = android_search_level[level];
search_priv->search_attr.u.str = search_priv->phrases[search_priv->current_phrase_per_level[level]];
struct attr test;
@@ -642,7 +642,7 @@ android_search_idle(struct android_search_priv *search_priv)
test.u.str = search_priv->phrases[search_priv->current_phrase_per_level[level]];
search_list_search(search_priv->search_list, &test, search_priv->partial);
}
- dbg(2, "leave");
+ dbg(lvl_info, "leave");
}
static char *
@@ -677,12 +677,12 @@ search_fix_spaces(const char *str)
static void start_search(struct android_search_priv *search_priv, const char *search_string)
{
- dbg(1,"enter %s\n", search_string);
+ dbg(lvl_warning,"enter %s\n", search_string);
char *str=search_fix_spaces(search_string);
search_priv->phrases = g_strsplit(str, " ", 0);
//ret=search_address_town(ret, sl, phrases, NULL, partial, jni);
- dbg(1,"First search phrase %s", search_priv->phrases[0]);
+ dbg(lvl_warning,"First search phrase %s", search_priv->phrases[0]);
search_priv->search_attr.u.str= search_priv->phrases[0];
search_priv->search_attr.type=attr_town_or_district_name;
search_list_search(search_priv->search_list, &search_priv->search_attr, search_priv->partial);
@@ -692,7 +692,7 @@ static void start_search(struct android_search_priv *search_priv, const char *se
//callback_call_0(search_priv->idle_clb);
g_free(str);
- dbg(1,"leave\n");
+ dbg(lvl_warning,"leave\n");
}
JNIEXPORT jlong JNICALL
@@ -700,7 +700,7 @@ Java_org_navitproject_navit_NavitAddressSearchActivity_CallbackStartAddressSearc
{
struct attr attr;
const char *search_string =(*env)->GetStringUTFChars(env, str, NULL);
- dbg(0,"search '%s'\n", search_string);
+ dbg(lvl_error,"search '%s'\n", search_string);
config_get_attr(config_get(), attr_navit, &attr, NULL);
@@ -731,9 +731,9 @@ Java_org_navitproject_navit_NavitAddressSearchActivity_CallbackStartAddressSearc
count++;
}
if (!count)
- dbg(0,"Country not found");
+ dbg(lvl_error,"Country not found");
- dbg(1,"search in country '%s'\n", str_country);
+ dbg(lvl_warning,"search in country '%s'\n", str_country);
(*env)->ReleaseStringUTFChars(env, country, str_country);
search_priv->search_result_obj.env = env;
@@ -743,7 +743,7 @@ Java_org_navitproject_navit_NavitAddressSearchActivity_CallbackStartAddressSearc
start_search(search_priv, search_string);
}
else
- dbg(0,"**** Unable to get methodID: fillStringArray");
+ dbg(lvl_error,"**** Unable to get methodID: fillStringArray");
(*env)->ReleaseStringUTFChars(env, str, search_string);
@@ -758,5 +758,5 @@ Java_org_navitproject_navit_NavitAddressSearchActivity_CallbackCancelAddressSear
if (priv)
android_search_end(priv);
else
- dbg(0, "Error: Cancel search failed");
+ dbg(lvl_error, "Error: Cancel search failed");
}
diff --git a/navit/attr.c b/navit/attr.c
index defc92ce1..441344903 100644
--- a/navit/attr.c
+++ b/navit/attr.c
@@ -152,7 +152,7 @@ attr_new_from_text(const char *name, const char *value)
int min,max,count;
ret=g_new0(struct attr, 1);
- dbg(3,"enter name='%s' value='%s'\n", name, value);
+ dbg(lvl_debug,"enter name='%s' value='%s'\n", name, value);
attr=attr_from_name(name);
ret->type=attr;
switch (attr) {
@@ -170,7 +170,7 @@ attr_new_from_text(const char *name, const char *value)
ret->u.item_types[count++]=item_type;
ret->u.item_types[count]=type_none;
} else {
- dbg(0,"Unknown item type '%s' ignored.\n",tok);
+ dbg(lvl_error,"Unknown item type '%s' ignored.\n",tok);
}
str=NULL;
}
@@ -233,13 +233,13 @@ attr_new_from_text(const char *name, const char *value)
Relative values are from 0x40000001 - 0x80000000, with 0x60000000 being 0 */
if (strchr(value, '%')) {
if ((ret->u.num > 0x20000000) || (ret->u.num < -0x1FFFFFFF)) {
- dbg(0, "Relative possibly-relative attribute with invalid value %li\n", ret->u.num);
+ dbg(lvl_error, "Relative possibly-relative attribute with invalid value %li\n", ret->u.num);
}
ret->u.num += 0x60000000;
} else {
if ((ret->u.num > 0x40000000) || (ret->u.num < -0x40000000)) {
- dbg(0, "Non-relative possibly-relative attribute with invalid value %li\n", ret->u.num);
+ dbg(lvl_error, "Non-relative possibly-relative attribute with invalid value %li\n", ret->u.num);
}
}
} else if (attr >= attr_type_boolean_begin) { // also check for yes and no
@@ -267,7 +267,7 @@ attr_new_from_text(const char *name, const char *value)
color->b = (b << 8) | b;
color->a = (a << 8) | a;
} else {
- dbg(0,"color %s has unknown format\n",value);
+ dbg(lvl_error,"color %s has unknown format\n",value);
}
break;
}
@@ -278,7 +278,7 @@ attr_new_from_text(const char *name, const char *value)
transform_to_geo(projection_mg, &c, g);
break;
}
- dbg(1,"default\n");
+ dbg(lvl_warning,"default\n");
g_free(ret);
ret=NULL;
}
@@ -485,9 +485,9 @@ attr_to_text(struct attr *attr, struct map *map, int pretty)
struct attr *
attr_search(struct attr **attrs, struct attr *last, enum attr_type attr)
{
- dbg(2, "enter attrs=%p\n", attrs);
+ dbg(lvl_info, "enter attrs=%p\n", attrs);
while (*attrs) {
- dbg(3,"*attrs=%p\n", *attrs);
+ dbg(lvl_debug,"*attrs=%p\n", *attrs);
if ((*attrs)->type == attr) {
return *attrs;
}
@@ -750,7 +750,7 @@ attr_data_size(struct attr *attr)
while (attr->u.attr_types[i++] != attr_none);
return i*sizeof(enum attr_type);
}
- dbg(0,"size for %s unknown\n", attr_to_name(attr->type));
+ dbg(lvl_error,"size for %s unknown\n", attr_to_name(attr->type));
return 0;
}
@@ -887,7 +887,7 @@ attr_from_line(char *line, char *name, int *pos, char *val_ret, char *name_ret)
int len=0,quoted;
char *p,*e,*n;
- dbg(1,"get_tag %s from %s\n", name, line);
+ dbg(lvl_warning,"get_tag %s from %s\n", name, line);
if (name)
len=strlen(name);
if (pos)
diff --git a/navit/autoload/osso/osso.c b/navit/autoload/osso/osso.c
index b49bb0aea..9cb0eccf9 100644
--- a/navit/autoload/osso/osso.c
+++ b/navit/autoload/osso/osso.c
@@ -24,7 +24,7 @@ osso_display_on(struct navit *this_)
{
osso_return_t err;
err = osso_display_blanking_pause(osso_context);
- dbg(1, "Unblank result: ",
+ dbg(lvl_warning, "Unblank result: ",
err == OSSO_OK ? "Ok" : (err ==
OSSO_ERROR ? "Error" :
"Invalid context"));
@@ -33,7 +33,7 @@ osso_display_on(struct navit *this_)
static gboolean
osso_cb_hw_state_idle(struct cb_hw_state_trail * params)
{
- dbg(0, "(inact=%d, save=%d, shut=%d, memlow=%d, state=%d)\n",
+ dbg(lvl_error, "(inact=%d, save=%d, shut=%d, memlow=%d, state=%d)\n",
params->state->system_inactivity_ind,
params->state->save_unsaved_data_ind, params->state->shutdown_ind,
params->state->memory_low_ind, params->state->sig_device_mode_ind);
@@ -69,10 +69,10 @@ osso_cb_hw_state(osso_hw_state_t * state, gpointer data)
static void
osso_navit(struct navit *nav, int add)
{
- dbg(1, "Installing osso context for org.navit_project.navit\n");
+ dbg(lvl_warning, "Installing osso context for org.navit_project.navit\n");
osso_context = osso_initialize("org.navit_project.navit", version, TRUE, NULL);
if (osso_context == NULL) {
- dbg(0, "error initiating osso context\n");
+ dbg(lvl_error, "error initiating osso context\n");
}
osso_hw_set_event_cb(osso_context, NULL, osso_cb_hw_state, nav);
@@ -87,7 +87,7 @@ plugin_init(void)
{
//struct callback *cb;
- dbg(2, "enter\n");
+ dbg(lvl_info, "enter\n");
callback.u.callback = callback_new_attr_0(callback_cast(osso_navit), attr_navit);
config_add_attr(config, &callback);
diff --git a/navit/binding/dbus/binding_dbus.c b/navit/binding/dbus/binding_dbus.c
index b4bc4d183..ab2f9975d 100644
--- a/navit/binding/dbus/binding_dbus.c
+++ b/navit/binding/dbus/binding_dbus.c
@@ -84,7 +84,7 @@ object_new(char *type, void *object)
{
int id;
char *ret;
- dbg(1,"enter %s\n", type);
+ dbg(lvl_warning,"enter %s\n", type);
if ((ret=g_hash_table_lookup(object_hash_rev, object)))
return ret;
id=GPOINTER_TO_INT(g_hash_table_lookup(object_count, type));
@@ -92,7 +92,7 @@ object_new(char *type, void *object)
ret=g_strdup_printf("%s/%s/%d", object_path, type, id);
g_hash_table_insert(object_hash, ret, object);
g_hash_table_insert(object_hash_rev, object, ret);
- dbg(1,"return %s\n", ret);
+ dbg(lvl_warning,"return %s\n", ret);
return (ret);
}
@@ -134,7 +134,7 @@ resolve_object(const char *opath, char *type)
struct attr attr;
if (strncmp(opath, object_path, strlen(object_path))) {
- dbg(0,"wrong object path %s\n",opath);
+ dbg(lvl_error,"wrong object path %s\n",opath);
return NULL;
}
prefix=g_strdup_printf("%s/%s/", object_path, type);
@@ -151,7 +151,7 @@ resolve_object(const char *opath, char *type)
if (!config_get_attr(config, attr_navit, &navit, NULL))
return NULL;
if (!oprefix[0]) {
- dbg(0,"default_navit\n");
+ dbg(lvl_error,"default_navit\n");
return navit.u.navit;
}
if (!strncmp(oprefix,def_graphics,strlen(def_graphics))) {
@@ -382,42 +382,42 @@ dbus_dump_iter(char *prefix, DBusMessageIter *iter)
switch (arg) {
case DBUS_TYPE_INT32:
dbus_message_iter_get_basic(iter, &vali);
- dbg(0,"%sDBUS_TYPE_INT32: %d\n",prefix,vali);
+ dbg(lvl_error,"%sDBUS_TYPE_INT32: %d\n",prefix,vali);
break;
case DBUS_TYPE_STRING:
dbus_message_iter_get_basic(iter, &vals);
- dbg(0,"%sDBUS_TYPE_STRING: %s\n",prefix,vals);
+ dbg(lvl_error,"%sDBUS_TYPE_STRING: %s\n",prefix,vals);
break;
case DBUS_TYPE_STRUCT:
- dbg(0,"%sDBUS_TYPE_STRUCT:\n",prefix);
+ dbg(lvl_error,"%sDBUS_TYPE_STRUCT:\n",prefix);
prefixr=g_strdup_printf("%s ",prefix);
dbus_message_iter_recurse(iter, &iterr);
dbus_dump_iter(prefixr, &iterr);
g_free(prefixr);
break;
case DBUS_TYPE_VARIANT:
- dbg(0,"%sDBUS_TYPE_VARIANT:\n",prefix);
+ dbg(lvl_error,"%sDBUS_TYPE_VARIANT:\n",prefix);
prefixr=g_strdup_printf("%s ",prefix);
dbus_message_iter_recurse(iter, &iterr);
dbus_dump_iter(prefixr, &iterr);
g_free(prefixr);
break;
case DBUS_TYPE_DICT_ENTRY:
- dbg(0,"%sDBUS_TYPE_DICT_ENTRY:\n",prefix);
+ dbg(lvl_error,"%sDBUS_TYPE_DICT_ENTRY:\n",prefix);
prefixr=g_strdup_printf("%s ",prefix);
dbus_message_iter_recurse(iter, &iterr);
dbus_dump_iter(prefixr, &iterr);
g_free(prefixr);
break;
case DBUS_TYPE_ARRAY:
- dbg(0,"%sDBUS_TYPE_ARRAY:\n",prefix);
+ dbg(lvl_error,"%sDBUS_TYPE_ARRAY:\n",prefix);
prefixr=g_strdup_printf("%s ",prefix);
dbus_message_iter_recurse(iter, &iterr);
dbus_dump_iter(prefixr, &iterr);
g_free(prefixr);
break;
default:
- dbg(0,"%c\n",arg);
+ dbg(lvl_error,"%c\n",arg);
}
dbus_message_iter_next(iter);
}
@@ -517,7 +517,7 @@ decode_attr_type_from_iter(DBusMessageIter *iter)
dbus_message_iter_get_basic(iter, &attr_type);
dbus_message_iter_next(iter);
ret=attr_from_name(attr_type);
- dbg(1, "attr value: 0x%x string: %s\n", ret, attr_type);
+ dbg(lvl_warning, "attr value: 0x%x string: %s\n", ret, attr_type);
return ret;
}
@@ -534,7 +534,7 @@ decode_attr_from_iter(DBusMessageIter *iter, struct attr *attr)
dbus_message_iter_recurse(iter, &iterattr);
dbus_message_iter_next(iter);
- dbg(1, "seems valid. signature: %s\n", dbus_message_iter_get_signature(&iterattr));
+ dbg(lvl_warning, "seems valid. signature: %s\n", dbus_message_iter_get_signature(&iterattr));
if (attr->type >= attr_type_item_begin && attr->type <= attr_type_item_end)
return 0;
@@ -812,9 +812,9 @@ request_set_add_remove_attr(DBusConnection *connection, DBusMessage *message, ch
destroy_attr(&attr);
if (ret)
return empty_reply(connection, message);
- dbg(0,"failed to set/add/remove attr\n");
+ dbg(lvl_error,"failed to set/add/remove attr\n");
} else {
- dbg(0,"failed to decode attr\n");
+ dbg(lvl_error,"failed to decode attr\n");
}
return dbus_error_invalid_parameter(connection, message);
}
@@ -1121,7 +1121,7 @@ point_get_from_message(DBusMessage *message, DBusMessageIter *iter, struct point
{
DBusMessageIter iter2;
- dbg(0,"%s\n", dbus_message_iter_get_signature(iter));
+ dbg(lvl_error,"%s\n", dbus_message_iter_get_signature(iter));
dbus_message_iter_recurse(iter, &iter2);
@@ -1135,7 +1135,7 @@ point_get_from_message(DBusMessage *message, DBusMessageIter *iter, struct point
return 0;
dbus_message_iter_get_basic(&iter2, &p->y);
- dbg(0, " x -> %x y -> %x\n", p->x, p->y);
+ dbg(lvl_error, " x -> %x y -> %x\n", p->x, p->y);
dbus_message_iter_next(&iter2);
@@ -1268,7 +1268,7 @@ request_navit_zoom(DBusConnection *connection, DBusMessage *message)
return dbus_error_invalid_object_path(connection, message);
dbus_message_iter_init(message, &iter);
- dbg(0,"%s\n", dbus_message_iter_get_signature(&iter));
+ dbg(lvl_error,"%s\n", dbus_message_iter_get_signature(&iter));
dbus_message_iter_get_basic(&iter, &factor);
@@ -1313,7 +1313,7 @@ request_navit_route_export_gpx(DBusConnection *connection, DBusMessage *message)
pp=&p;
}
- dbg(1,"Dumping route from dbus to %s\n", filename);
+ dbg(lvl_warning,"Dumping route from dbus to %s\n", filename);
struct map * map=NULL;
struct navigation * nav = NULL;
@@ -1392,7 +1392,7 @@ request_navit_resize(DBusConnection *connection, DBusMessage *message)
return dbus_error_invalid_object_path(connection, message);
dbus_message_iter_init(message, &iter);
- dbg(0,"%s\n", dbus_message_iter_get_signature(&iter));
+ dbg(lvl_error,"%s\n", dbus_message_iter_get_signature(&iter));
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_INT32)
return dbus_error_invalid_parameter(connection, message);
@@ -1404,7 +1404,7 @@ request_navit_resize(DBusConnection *connection, DBusMessage *message)
return dbus_error_invalid_parameter(connection, message);
dbus_message_iter_get_basic(&iter, &h);
- dbg(0, " w -> %i h -> %i\n", w, h);
+ dbg(lvl_error, " w -> %i h -> %i\n", w, h);
navit_handle_resize(navit, w, h);
@@ -1503,7 +1503,7 @@ request_navit_set_destination(DBusConnection *connection, DBusMessage *message)
dbus_message_iter_next(&iter);
dbus_message_iter_get_basic(&iter, &description);
- dbg(0, " destination -> %s\n", description);
+ dbg(lvl_error, " destination -> %s\n", description);
navit_set_destination(navit, &pc, description, 1);
return empty_reply(connection, message);
@@ -1865,7 +1865,7 @@ introspect_path(const char *object)
if (strncmp(object, object_path, strlen(object_path)))
return NULL;
ret=g_strdup(object+strlen(object_path));
- dbg(1,"path=%s\n",ret);
+ dbg(lvl_warning,"path=%s\n",ret);
for (i = strlen(ret)-1 ; i >= 0 ; i--) {
if (ret[i] == '/' || (ret[i] >= '0' && ret[i] <= '9'))
ret[i]='\0';
@@ -1893,7 +1893,7 @@ generate_navitintrospectxml(const char *object)
char *path=introspect_path(object);
if (!path)
return NULL;
- dbg(1,"path=%s\n",path);
+ dbg(lvl_warning,"path=%s\n",path);
// write header and make navit introspectable
navitintrospectxml = g_strdup_printf("%s%s%s\n", navitintrospectxml_head1, object, navitintrospectxml_head2);
@@ -1936,11 +1936,11 @@ navit_handler_func(DBusConnection *connection, DBusMessage *message, void *user_
{
int i;
char *path;
- dbg(1,"type=%s interface=%s path=%s member=%s signature=%s\n", dbus_message_type_to_string(dbus_message_get_type(message)), dbus_message_get_interface(message), dbus_message_get_path(message), dbus_message_get_member(message), dbus_message_get_signature(message));
+ dbg(lvl_warning,"type=%s interface=%s path=%s member=%s signature=%s\n", dbus_message_type_to_string(dbus_message_get_type(message)), dbus_message_get_interface(message), dbus_message_get_path(message), dbus_message_get_member(message), dbus_message_get_signature(message));
if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Introspectable", "Introspect")) {
DBusMessage *reply;
char *navitintrospectxml = generate_navitintrospectxml(dbus_message_get_path(message));
- dbg(1,"Introspect %s:Result:%s\n",dbus_message_get_path(message), navitintrospectxml);
+ dbg(lvl_warning,"Introspect %s:Result:%s\n",dbus_message_get_path(message), navitintrospectxml);
if (navitintrospectxml) {
reply = dbus_message_new_method_return(message);
dbus_message_append_args(reply, DBUS_TYPE_STRING, &navitintrospectxml, DBUS_TYPE_INVALID);
@@ -1974,7 +1974,7 @@ static DBusObjectPathVTable dbus_navit_vtable = {
DBusHandlerResult
filter(DBusConnection *connection, DBusMessage *message, void *user_data)
{
- dbg(0,"type=%s interface=%s path=%s member=%s signature=%s\n", dbus_message_type_to_string(dbus_message_get_type(message)), dbus_message_get_interface(message), dbus_message_get_path(message), dbus_message_get_member(message), dbus_message_get_signature(message));
+ dbg(lvl_error,"type=%s interface=%s path=%s member=%s signature=%s\n", dbus_message_type_to_string(dbus_message_get_type(message)), dbus_message_get_interface(message), dbus_message_get_path(message), dbus_message_get_member(message), dbus_message_get_signature(message));
if (dbus_message_is_signal(message, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) {
}
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
@@ -1987,7 +1987,7 @@ dbus_cmd_send_signal(struct navit *navit, char *command, struct attr **in, struc
DBusMessage* msg;
char *opath=object_new("navit",navit);
char *interface=g_strdup_printf("%s%s", service_name, ".navit");
- dbg(0,"enter %s %s %s\n",opath,command,interface);
+ dbg(lvl_error,"enter %s %s %s\n",opath,command,interface);
msg = dbus_message_new_signal(opath, interface, "signal");
if (msg) {
DBusMessageIter iter1,iter2,iter3;
@@ -2042,7 +2042,7 @@ void plugin_init(void)
object_hash=g_hash_table_new(g_str_hash, g_str_equal);
object_hash_rev=g_hash_table_new(NULL, NULL);
object_count=g_hash_table_new(g_str_hash, g_str_equal);
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
dbus_error_init(&error);
#ifdef DBUS_USE_SYSTEM_BUS
connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
@@ -2050,7 +2050,7 @@ void plugin_init(void)
connection = dbus_bus_get(DBUS_BUS_SESSION, &error);
#endif
if (!connection) {
- dbg(0,"Failed to open connection to session message bus: %s\n", error.message);
+ dbg(lvl_error,"Failed to open connection to session message bus: %s\n", error.message);
dbus_error_free(&error);
return;
}
@@ -2062,7 +2062,7 @@ void plugin_init(void)
dbus_connection_register_fallback(connection, object_path, &dbus_navit_vtable, NULL);
dbus_bus_request_name(connection, service_name, 0, &error);
if (dbus_error_is_set(&error)) {
- dbg(0,"Failed to request name: %s", error.message);
+ dbg(lvl_error,"Failed to request name: %s", error.message);
dbus_error_free (&error);
}
callback.type=attr_callback;
diff --git a/navit/binding/python/config.c b/navit/binding/python/config.c
index ffcaed2cd..207dcdc4b 100644
--- a/navit/binding/python/config.c
+++ b/navit/binding/python/config.c
@@ -66,7 +66,7 @@ config_py(PyObject *self, PyObject *args)
{
configObject *ret;
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
ret=PyObject_NEW(configObject, &config_Type);
return (PyObject *)ret;
}
diff --git a/navit/binding/python/navit.c b/navit/binding/python/navit.c
index 413a6b938..ca87d7ffb 100644
--- a/navit/binding/python/navit.c
+++ b/navit/binding/python/navit.c
@@ -44,10 +44,10 @@ navit_get_attr_py(navitObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s", &name))
return NULL;
if (!navit_get_attr(self->navit, attr_from_name(name), &attr, NULL)) {
- dbg(0,"get_attr not ok\n");
+ dbg(lvl_error,"get_attr not ok\n");
Py_RETURN_NONE;
}
- dbg(0,"get_attr ok\n");
+ dbg(lvl_error,"get_attr ok\n");
return python_object_from_attr(&attr);
}
@@ -131,7 +131,7 @@ navit_py(PyObject *self, PyObject *args)
{
navitObject *ret;
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
ret=PyObject_NEW(navitObject, &navit_Type);
return (PyObject *)ret;
}
@@ -139,7 +139,7 @@ navit_py(PyObject *self, PyObject *args)
PyObject *
navit_py_ref(struct navit *navit)
{
- dbg(0,"navit=%p\n", navit);
+ dbg(lvl_error,"navit=%p\n", navit);
navitObject *ret=PyObject_NEW(navitObject, &navit_Type);
ret->navit=navit;
return (PyObject *)ret;
diff --git a/navit/binding/python/pcoord.c b/navit/binding/python/pcoord.c
index a4cb2640d..2ee4a9285 100644
--- a/navit/binding/python/pcoord.c
+++ b/navit/binding/python/pcoord.c
@@ -76,7 +76,7 @@ pcoord_py(PyObject *self, PyObject *args)
ret->pc.pro=pro;
ret->pc.x=c.x;
ret->pc.y=c.y;
- dbg(0,"0x%x,0x%x\n", c.x, c.y);
+ dbg(lvl_error,"0x%x,0x%x\n", c.x, c.y);
return (PyObject *)ret;
}
diff --git a/navit/binding/win32/binding_win32.c b/navit/binding/win32/binding_win32.c
index 5d33ec47e..835a2f6e2 100644
--- a/navit/binding/win32/binding_win32.c
+++ b/navit/binding/win32/binding_win32.c
@@ -60,10 +60,10 @@ struct win32_binding_private {
static int
win32_cmd_send_signal(struct navit *navit, char *command, struct attr **in, struct attr ***out)
{
- dbg(0,"this function is a stub\n");
+ dbg(lvl_error,"this function is a stub\n");
if (in) {
while (*in) {
- dbg(0,"another attribute to be sent\n");
+ dbg(lvl_error,"another attribute to be sent\n");
in++;
}
}
@@ -84,23 +84,23 @@ win32_wm_copydata(struct win32_binding_private *this, int *hwndSender, COPYDATAS
navit.type=attr_navit;
navit.u.navit=this->navit;
if(cpd->dwData!=NAVIT_BINDING_W32_DWDATA) {
- dbg(0,"COPYDATA message came with wrong DWDATA value, expected %d, got %d.\n",NAVIT_BINDING_W32_DWDATA,cpd->dwData);
+ dbg(lvl_error,"COPYDATA message came with wrong DWDATA value, expected %d, got %d.\n",NAVIT_BINDING_W32_DWDATA,cpd->dwData);
return;
}
if(cpd->cbData<sizeof(*msg)) {
- dbg(0,"COPYDATA message too short, expected >=%d, got %d.\n",sizeof(*msg),cpd->cbData);
+ dbg(lvl_error,"COPYDATA message too short, expected >=%d, got %d.\n",sizeof(*msg),cpd->cbData);
return;
}
msg=cpd->lpData;
if(cpd->dwData!=NAVIT_BINDING_W32_VERSION) {
- dbg(0,"Got request with wrong version number, expected %d, got %d.\n",NAVIT_BINDING_W32_VERSION,msg->version);
+ dbg(lvl_error,"Got request with wrong version number, expected %d, got %d.\n",NAVIT_BINDING_W32_VERSION,msg->version);
return;
}
if(strcmp(NAVIT_BINDING_W32_MAGIC,msg->magic)) {
- dbg(0,"Got request with wrong MAGIC, expected %s, got %*s.\n",NAVIT_BINDING_W32_MAGIC, msg->magic,sizeof(msg->magic));
+ dbg(lvl_error,"Got request with wrong MAGIC, expected %s, got %*s.\n",NAVIT_BINDING_W32_MAGIC, msg->magic,sizeof(msg->magic));
return;
}
- dbg(0,"Running command %s\n", msg->text);
+ dbg(lvl_error,"Running command %s\n", msg->text);
command_evaluate(&navit, msg->text);
}
@@ -120,9 +120,9 @@ static void
win32_main_navit(struct win32_binding_private *this, struct navit *navit, int added)
{
struct attr attr;
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
if (added==1) {
- dbg(0,"enter2\n");
+ dbg(lvl_error,"enter2\n");
this->navit=navit;
command_add_table_attr(commands, sizeof(commands)/sizeof(struct command_table), navit, &attr);
navit_add_attr(navit, &attr);
@@ -137,7 +137,7 @@ void plugin_init(void)
{
struct attr callback;
struct win32_binding_private *this=g_new0(struct win32_binding_private,1);
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
callback.type=attr_callback;
callback.u.callback=callback_new_attr_1(callback_cast(win32_main_navit),attr_navit,this);
config_add_attr(config, &callback);
diff --git a/navit/bookmarks.c b/navit/bookmarks.c
index 47ec279a2..9e411d792 100644
--- a/navit/bookmarks.c
+++ b/navit/bookmarks.c
@@ -83,7 +83,7 @@ struct bookmark_item_priv {
void bookmarks_move_root(struct bookmarks *this_) {
this_->current=this_->root;
this_->current->iter=g_list_first(this_->current->children);
- dbg(2,"Root list have %u entries\n",g_list_length(this_->current->children));
+ dbg(lvl_info,"Root list have %u entries\n",g_list_length(this_->current->children));
return;
}
void bookmarks_move_up(struct bookmarks *this_) {
@@ -103,7 +103,7 @@ int bookmarks_move_down(struct bookmarks *this_,const char* name) {
if (!strcmp(data->label,name)) {
this_->current=(struct bookmark_item_priv*)this_->current->iter->data;
this_->current->iter=g_list_first(this_->current->children);
- dbg(2,"%s list have %u entries\n",this_->current->label,g_list_length(this_->current->children));
+ dbg(lvl_info,"%s list have %u entries\n",this_->current->label,g_list_length(this_->current->children));
return 1;
}
this_->current->iter=g_list_next(this_->current->iter);
@@ -207,7 +207,7 @@ bookmarks_load_hash(struct bookmarks *this_) {
finder=b_item->label;
while ((pos=strchr(finder,'/'))) {
*pos=0x00;
- dbg(1,"Found path entry: %s\n",finder);
+ dbg(lvl_warning,"Found path entry: %s\n",finder);
if (!bookmarks_move_down(this_,finder)) {
struct bookmark_item_priv *path_item=g_new0(struct bookmark_item_priv,1);
path_item->type=type_bookmark_folder;
@@ -231,7 +231,7 @@ bookmarks_load_hash(struct bookmarks *this_) {
this_->bookmarks_list=g_list_append(this_->bookmarks_list,b_item);
this_->current->children=g_list_append(this_->current->children,b_item);
this_->current->children=g_list_first(this_->current->children);
- dbg(1,"Added %s to %s and current list now %u long\n",b_item->label,this_->current->label,g_list_length(this_->current->children));
+ dbg(lvl_warning,"Added %s to %s and current list now %u long\n",b_item->label,this_->current->label,g_list_length(this_->current->children));
}
bookmarks_move_root(this_);
}
@@ -327,7 +327,7 @@ bookmarks_store_bookmarks_to_file(struct bookmarks *this_, int limit,int replac
g_free(fullname);
fullname=g_strdup(pathHelper);
g_free(pathHelper);
- dbg(1,"full name: %s\n",fullname);
+ dbg(lvl_warning,"full name: %s\n",fullname);
}
}
@@ -760,7 +760,7 @@ write_former_destinations(GList* former_destinations, char *former_destination_f
}
fclose(f);
} else {
- dbg(0, "Error updating destinations file %s: %s\n", former_destination_file, strerror(errno));
+ dbg(lvl_error, "Error updating destinations file %s: %s\n", former_destination_file, strerror(errno));
}
}
/**
diff --git a/navit/cache.c b/navit/cache.c
index 0596a65f6..8e63b53cf 100644
--- a/navit/cache.c
+++ b/navit/cache.c
@@ -33,13 +33,13 @@ static void
cache_entry_dump(struct cache *cache, struct cache_entry *entry)
{
int i,size;
- dbg(0,"Usage: %d size %d\n",entry->usage, entry->size);
+ dbg(lvl_error,"Usage: %d size %d\n",entry->usage, entry->size);
if (cache)
size=cache->id_size;
else
size=5;
for (i = 0 ; i < size ; i++) {
- dbg(0,"0x%x\n", entry->id[i]);
+ dbg(lvl_error,"0x%x\n", entry->id[i]);
}
}
@@ -47,7 +47,7 @@ static void
cache_list_dump(char *str, struct cache *cache, struct cache_entry_list *list)
{
struct cache_entry *first=list->first;
- dbg(0,"dump %s %d\n",str, list->size);
+ dbg(lvl_error,"dump %s %d\n",str, list->size);
while (first) {
cache_entry_dump(cache, first);
first=first->next;
@@ -106,7 +106,7 @@ cache_new(int id_size, int size)
cache->hash=g_hash_table_new(cache_hash20, cache_equal20);
break;
default:
- dbg(0,"cache with id_size of %d not supported\n", id_size);
+ dbg(lvl_error,"cache with id_size of %d not supported\n", id_size);
g_free(cache);
cache=NULL;
}
@@ -152,7 +152,7 @@ cache_remove_from_list(struct cache_entry_list *list, struct cache_entry *entry)
static void
cache_remove(struct cache *cache, struct cache_entry *entry)
{
- dbg(1,"remove 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]);
+ dbg(lvl_warning,"remove 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]);
g_hash_table_remove(cache->hash, (gpointer)(entry->id));
g_slice_free1(entry->size, entry);
}
@@ -185,7 +185,7 @@ cache_remove_lru(struct cache *cache, struct cache_entry_list *list)
last=list->last;
if (! last || last->usage || seen >= list->size)
return NULL;
- dbg(1,"removing %d\n", last->id[0]);
+ dbg(lvl_warning,"removing %d\n", last->id[0]);
cache_remove_lru_helper(list);
if (cache) {
cache_remove(cache, last);
@@ -211,7 +211,7 @@ void
cache_entry_destroy(struct cache *cache, void *data)
{
struct cache_entry *entry=(struct cache_entry *)((char *)data-cache->entry_size);
- dbg(1,"destroy 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]);
+ dbg(lvl_warning,"destroy 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]);
entry->usage--;
}
@@ -219,8 +219,8 @@ static struct cache_entry *
cache_trim(struct cache *cache, struct cache_entry *entry)
{
struct cache_entry *new_entry;
- dbg(1,"trim 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]);
- dbg(1,"Trim %x from %d -> %d\n", entry->id[0], entry->size, cache->size);
+ dbg(lvl_warning,"trim 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]);
+ dbg(lvl_warning,"Trim %x from %d -> %d\n", entry->id[0], entry->size, cache->size);
if ( cache->entry_size < entry->size )
{
g_hash_table_remove(cache->hash, (gpointer)(entry->id));
@@ -256,11 +256,11 @@ static int
cache_replace(struct cache *cache)
{
if (cache->t1.size >= MAX(1,cache->t1_target)) {
- dbg(1,"replace 12\n");
+ dbg(lvl_warning,"replace 12\n");
if (!cache_move(cache, &cache->t1, &cache->b1))
cache_move(cache, &cache->t2, &cache->b2);
} else {
- dbg(1,"replace t2\n");
+ dbg(lvl_warning,"replace t2\n");
if (!cache_move(cache, &cache->t2, &cache->b2))
cache_move(cache, &cache->t1, &cache->b1);
}
@@ -298,17 +298,17 @@ void *
cache_lookup(struct cache *cache, void *id) {
struct cache_entry *entry;
- dbg(1,"get %d\n", ((int *)id)[0]);
+ dbg(lvl_warning,"get %d\n", ((int *)id)[0]);
entry=g_hash_table_lookup(cache->hash, id);
if (entry == NULL) {
cache->insert=&cache->t1;
#ifdef DEBUG_CACHE
fprintf(stderr,"-");
#endif
- dbg(1,"not in cache\n");
+ dbg(lvl_warning,"not in cache\n");
return NULL;
}
- dbg(1,"found 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]);
+ dbg(lvl_warning,"found 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]);
if (entry->where == &cache->t1 || entry->where == &cache->t2) {
cache->hits+=entry->size;
#ifdef DEBUG_CACHE
@@ -317,7 +317,7 @@ cache_lookup(struct cache *cache, void *id) {
else
fprintf(stderr,"H");
#endif
- dbg(1,"in cache %s\n", entry->where == &cache->t1 ? "T1" : "T2");
+ dbg(lvl_warning,"in cache %s\n", entry->where == &cache->t1 ? "T1" : "T2");
cache_remove_from_list(entry->where, entry);
cache_insert_mru(NULL, &cache->t2, entry);
entry->usage++;
@@ -327,18 +327,18 @@ cache_lookup(struct cache *cache, void *id) {
#ifdef DEBUG_CACHE
fprintf(stderr,"m");
#endif
- dbg(1,"in phantom cache B1\n");
+ dbg(lvl_warning,"in phantom cache B1\n");
cache->t1_target=MIN(cache->t1_target+MAX(cache->b2.size/cache->b1.size, 1),cache->size);
cache_remove_from_list(&cache->b1, entry);
} else if (entry->where == &cache->b2) {
#ifdef DEBUG_CACHE
fprintf(stderr,"M");
#endif
- dbg(1,"in phantom cache B2\n");
+ dbg(lvl_warning,"in phantom cache B2\n");
cache->t1_target=MAX(cache->t1_target-MAX(cache->b1.size/cache->b2.size, 1),0);
cache_remove_from_list(&cache->b2, entry);
} else {
- dbg(0,"**ERROR** invalid where\n");
+ dbg(lvl_error,"**ERROR** invalid where\n");
}
cache_replace(cache);
cache_remove(cache, entry);
@@ -351,7 +351,7 @@ void
cache_insert(struct cache *cache, void *data)
{
struct cache_entry *entry=(struct cache_entry *)((char *)data-cache->entry_size);
- dbg(1,"insert 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]);
+ dbg(lvl_warning,"insert 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]);
if (cache->insert == &cache->t1) {
if (cache->t1.size + cache->b1.size >= cache->size) {
if (cache->t1.size < cache->size) {
@@ -382,8 +382,8 @@ cache_insert_new(struct cache *cache, void *id, int size)
static void
cache_stats(struct cache *cache)
{
- dbg(0,"hits %d misses %d hitratio %d size %d entry_size %d id_size %d T1 target %d\n", cache->hits, cache->misses, cache->hits*100/(cache->hits+cache->misses), cache->size, cache->entry_size, cache->id_size, cache->t1_target);
- dbg(0,"T1:%d B1:%d T2:%d B2:%d\n", cache->t1.size, cache->b1.size, cache->t2.size, cache->b2.size);
+ dbg(lvl_error,"hits %d misses %d hitratio %d size %d entry_size %d id_size %d T1 target %d\n", cache->hits, cache->misses, cache->hits*100/(cache->hits+cache->misses), cache->size, cache->entry_size, cache->id_size, cache->t1_target);
+ dbg(lvl_error,"T1:%d B1:%d T2:%d B2:%d\n", cache->t1.size, cache->b1.size, cache->t2.size, cache->b2.size);
cache->hits=0;
cache->misses=0;
}
@@ -396,6 +396,6 @@ cache_dump(struct cache *cache)
cache_list_dump("B1", cache, &cache->b1);
cache_list_dump("T2", cache, &cache->t2);
cache_list_dump("B2", cache, &cache->b2);
- dbg(0,"dump end\n");
+ dbg(lvl_error,"dump end\n");
}
diff --git a/navit/callback.c b/navit/callback.c
index b5d0ed3c9..293fab0af 100644
--- a/navit/callback.c
+++ b/navit/callback.c
@@ -145,13 +145,13 @@ callback_call(struct callback *cb, int pcount, void **p)
if (! cb)
return;
if (cb->pcount + pcount <= 8) {
- dbg(3,"cb->pcount=%d\n", cb->pcount);
+ dbg(lvl_debug,"cb->pcount=%d\n", cb->pcount);
if (cb->pcount && cb->p)
- dbg(3,"cb->p[0]=%p\n", cb->p[0]);
- dbg(3,"pcount=%d\n", pcount);
+ dbg(lvl_debug,"cb->p[0]=%p\n", cb->p[0]);
+ dbg(lvl_debug,"pcount=%d\n", pcount);
if (pcount) {
dbg_assert(p!=NULL);
- dbg(3,"p[0]=%p\n", p[0]);
+ dbg(lvl_debug,"p[0]=%p\n", p[0]);
}
for (i = 0 ; i < cb->pcount ; i++)
pf[i]=cb->p[i];
@@ -195,7 +195,7 @@ callback_call(struct callback *cb, int pcount, void **p)
break;
}
} else {
- dbg(0,"too many parameters for callback (%d+%d)\n", cb->pcount, pcount);
+ dbg(lvl_error,"too many parameters for callback (%d+%d)\n", cb->pcount, pcount);
}
}
diff --git a/navit/command.c b/navit/command.c
index dc35c1691..a5d9f08d9 100644
--- a/navit/command.c
+++ b/navit/command.c
@@ -152,8 +152,8 @@ dump(struct result *res)
if (res->attrn)
strncpy(attribute, res->attrn, res->attrnlen);
attribute[res->attrnlen]='\0';
- dbg(0,"type:%s\n", attr_to_name(res->attr.type));
- dbg(0,"attribute '%s' from '%s'\n", attribute, object);
+ dbg(lvl_error,"type:%s\n", attr_to_name(res->attr.type));
+ dbg(lvl_error,"attribute '%s' from '%s'\n", attribute, object);
#endif
}
@@ -315,7 +315,7 @@ get_int_bool(struct context *ctx, int is_bool, struct result *res)
return res->attr.u.data != NULL;
if (is_bool && ATTR_IS_STRING(res->attr.type))
return res->attr.u.data != NULL;
- dbg(0,"bool %d %s\n",is_bool,attr_to_name(res->attr.type));
+ dbg(lvl_error,"bool %d %s\n",is_bool,attr_to_name(res->attr.type));
ctx->error=wrong_type;
return 0;
}
@@ -481,7 +481,7 @@ result_op(struct context *ctx, enum op_type op_type, const char *op, struct resu
default:
break;
}
- dbg(0,"Unkown op %d %s\n",op_type,op);
+ dbg(lvl_error,"Unkown op %d %s\n",op_type,op);
ctx->error=internal;
}
@@ -518,7 +518,7 @@ result_set(struct context *ctx, enum set_type set_type, const char *op, int len,
default:
break;
}
- dbg(0,"unknown set type %d %s\n",set_type,op);
+ dbg(lvl_error,"unknown set type %d %s\n",set_type,op);
ctx->error=internal;
}
@@ -605,7 +605,7 @@ eval_value(struct context *ctx, struct result *res) {
if (!*op)
ctx->error=eof_reached;
else {
- dbg(0,"illegal character 0x%x\n",*op);
+ dbg(lvl_error,"illegal character 0x%x\n",*op);
ctx->error=illegal_character;
}
}
@@ -657,7 +657,7 @@ command_call_function(struct context *ctx, struct result *res)
if (res->attrn)
strncpy(function, res->attrn, res->attrnlen);
function[res->attrnlen]='\0';
- dbg(1,"function=%s\n", function);
+ dbg(lvl_warning,"function=%s\n", function);
if (ctx->expr[0] != ')') {
list=eval_list(ctx);
if (ctx->error) {
@@ -686,7 +686,7 @@ command_call_function(struct context *ctx, struct result *res)
res->attr.u.num=list[0]->u.num;
res->allocated=0;
} else {
- dbg(0,"don't know how to create int of args\n");
+ dbg(lvl_error,"don't know how to create int of args\n");
}
} else if (ATTR_IS_STRING(attr_type)) {
if (list && list[0] && ATTR_IS_STRING(list[0]->type)) {
@@ -694,7 +694,7 @@ command_call_function(struct context *ctx, struct result *res)
res->attr.u.str=g_strdup(list[0]->u.str);
res->allocated=1;
} else {
- dbg(0,"don't know how to create string of args\n");
+ dbg(lvl_error,"don't know how to create string of args\n");
}
} else if (ATTR_IS_OBJECT(attr_type)) {
struct object_func *func=object_func_lookup(attr_type);
@@ -706,7 +706,7 @@ command_call_function(struct context *ctx, struct result *res)
res->allocated=1;
}
} else {
- dbg(0,"don't know how to create %s (%s)\n",attr_to_name(attr_type),function+4);
+ dbg(lvl_error,"don't know how to create %s (%s)\n",attr_to_name(attr_type),function+4);
}
} else if (!strcmp(function,"add_attr")) {
command_object_add_attr(ctx, &res->attr, list[0]);
@@ -716,10 +716,10 @@ command_call_function(struct context *ctx, struct result *res)
if (command_object_get_attr(ctx, &res->attr, attr_callback_list, &cbl)) {
int valid =0;
struct attr **out=NULL;
- dbg(1,"function call %s from %s\n",function, attr_to_name(res->attr.type));
+ dbg(lvl_warning,"function call %s from %s\n",function, attr_to_name(res->attr.type));
callback_list_call_attr_4(cbl.u.callback_list, attr_command, function, list, &out, &valid);
if (valid!=1){
- dbg(0, "invalid command ignored: \"%s\"; see http://wiki.navit-project.org/index.php/"
+ dbg(lvl_error, "invalid command ignored: \"%s\"; see http://wiki.navit-project.org/index.php/"
"The_Navit_Command_Interface for valid commands.\n", function);
}
if (out && out[0]) {
@@ -770,15 +770,15 @@ eval_postfix(struct context *ctx, struct result *res)
enum attr_type attr_type=command_attr_type(res);
void *obj=res->attr.u.data;
if (!obj) {
- dbg(0,"no object\n");
+ dbg(lvl_error,"no object\n");
return;
}
if (!obj_func) {
- dbg(0,"no object func\n");
+ dbg(lvl_error,"no object func\n");
return;
}
if (!obj_func->iter_new || !obj_func->iter_destroy) {
- dbg(0,"no iter func\n");
+ dbg(lvl_error,"no iter func\n");
return;
}
iter = obj_func->iter_new(NULL);
@@ -801,7 +801,7 @@ eval_postfix(struct context *ctx, struct result *res)
return;
}
} else if (op[0] == '(') {
- dbg(1,"function call\n");
+ dbg(lvl_warning,"function call\n");
resolve_object(ctx, res);
command_call_function(ctx, res);
}
@@ -989,7 +989,7 @@ eval_conditional(struct context *ctx, struct result *res)
memset(&tmp,0,sizeof(tmp));
if (!get_op(ctx,0,":",NULL)) {
- dbg(0,"ctxerr\n");
+ dbg(lvl_error,"ctxerr\n");
ctx->error=missing_colon;
return;
}
@@ -1110,7 +1110,7 @@ command_evaluate_to_attr(struct attr *attr, char *expr, int *error, struct attr
return attr_none;
resolve_object(&ctx, &res);
*ret=res.attr;
- dbg(1,"type %s\n",attr_to_name(command_attr_type(&res)));
+ dbg(lvl_warning,"type %s\n",attr_to_name(command_attr_type(&res)));
return command_attr_type(&res);
}
@@ -1280,15 +1280,15 @@ command_evaluate_single(struct context *ctx)
}
end=ctx->expr;
if (!obj) {
- dbg(0,"no object\n");
+ dbg(lvl_error,"no object\n");
return 0;
}
if (!obj_func) {
- dbg(0,"no object func\n");
+ dbg(lvl_error,"no object func\n");
return 0;
}
if (!obj_func->iter_new || !obj_func->iter_destroy) {
- dbg(0,"no iter func\n");
+ dbg(lvl_error,"no iter func\n");
return 0;
}
iter = obj_func->iter_new(NULL);
@@ -1372,7 +1372,7 @@ command_evaluate(struct attr *attr, const char *expr)
char expr[32];
strncpy(expr, ctx.expr, 32);
expr[31]='\0';
- dbg(0,"error %d starting at %s\n",ctx.error,expr);
+ dbg(lvl_error,"error %d starting at %s\n",ctx.error,expr);
}
g_free(expr_dup);
}
@@ -1507,7 +1507,7 @@ command_saved_callbacks_changed(struct command_saved *cs)
func = object_func_lookup(cs->cbs[i].attr.type);
if (!func->remove_attr) {
- dbg(0, "Could not remove command-evaluation callback because remove_attr is missing for type %i!\n", cs->cbs[i].attr.type);
+ dbg(lvl_error, "Could not remove command-evaluation callback because remove_attr is missing for type %i!\n", cs->cbs[i].attr.type);
continue;
}
@@ -1557,7 +1557,7 @@ command_register_callbacks(struct command_saved *cs)
cb = callback_new_attr_1(callback_cast(command_saved_evaluate), cs->res.attr.type, (void*)cs);
cs->ctx.attr = &cs->context_attr;
} else {
- dbg(0, "Error: Strange status returned from get_next_object()\n");
+ dbg(lvl_error, "Error: Strange status returned from get_next_object()\n");
}
cs->num_cbs++;
@@ -1571,7 +1571,7 @@ command_register_callbacks(struct command_saved *cs)
func->add_attr(prev.u.data, &cb_attr);
} else {
- dbg(0, "Could not add callback because add_attr is missing for type %i}n", prev.type);
+ dbg(lvl_error, "Could not add callback because add_attr is missing for type %i}n", prev.type);
}
}
diff --git a/navit/config_.c b/navit/config_.c
index 7fdb1302d..b33e227ce 100644
--- a/navit/config_.c
+++ b/navit/config_.c
@@ -60,7 +60,7 @@ config_destroy(struct config *this_)
static void
config_terminate(int sig)
{
- dbg(0,"terminating\n");
+ dbg(lvl_error,"terminating\n");
config_destroy(config);
}
@@ -142,11 +142,11 @@ struct config *
config_new(struct attr *parent, struct attr **attrs)
{
if (configured) {
- dbg(0,"only one config allowed\n");
+ dbg(lvl_error,"only one config allowed\n");
return config;
}
if (parent) {
- dbg(0,"no parent in config allowed\n");
+ dbg(lvl_error,"no parent in config allowed\n");
return NULL;
}
if (!config)
@@ -156,7 +156,7 @@ config_new(struct attr *parent, struct attr **attrs)
config->attrs=attr_generic_add_attr_list(config->attrs, attrs);
while (*attrs) {
if (!config_set_attr_int(config,*attrs)) {
- dbg(0,"failed to set attribute '%s'\n",attr_to_name((*attrs)->type));
+ dbg(lvl_error,"failed to set attribute '%s'\n",attr_to_name((*attrs)->type));
config_destroy(config);
config=NULL;
break;
diff --git a/navit/coord.c b/navit/coord.c
index e6a38f7ee..f53005201 100644
--- a/navit/coord.c
+++ b/navit/coord.c
@@ -104,7 +104,7 @@ coord_rect_overlap(struct coord_rect *r1, struct coord_rect *r2)
dbg_assert(r1->lu.y >= r1->rl.y);
dbg_assert(r2->lu.x <= r2->rl.x);
dbg_assert(r2->lu.y >= r2->rl.y);
- dbg(3,"0x%x,0x%x - 0x%x,0x%x vs 0x%x,0x%x - 0x%x,0x%x\n", r1->lu.x, r1->lu.y, r1->rl.x, r1->rl.y, r2->lu.x, r2->lu.y, r2->rl.x, r2->rl.y);
+ dbg(lvl_debug,"0x%x,0x%x - 0x%x,0x%x vs 0x%x,0x%x - 0x%x,0x%x\n", r1->lu.x, r1->lu.y, r1->rl.x, r1->rl.y, r2->lu.x, r2->lu.y, r2->rl.x, r2->rl.y);
if (r1->lu.x > r2->rl.x)
return 0;
if (r1->rl.x < r2->lu.x)
@@ -171,14 +171,14 @@ coord_parse(const char *coord_input, enum projection output_projection, struct c
struct coord c,offset;
enum projection str_pro=projection_none;
- dbg(1,"enter('%s',%d,%p)\n", coord_input, output_projection, result);
+ dbg(lvl_warning,"enter('%s',%d,%p)\n", coord_input, output_projection, result);
s=strchr(str,' ');
co=strchr(str,':');
if (co && co < s) {
proj=malloc(co-str+1);
strncpy(proj, str, co-str);
proj[co-str]='\0';
- dbg(1,"projection=%s\n", proj);
+ dbg(lvl_warning,"projection=%s\n", proj);
str=co+1;
s=strchr(str,' ');
if (!strcmp(proj, "geo"))
@@ -186,7 +186,7 @@ coord_parse(const char *coord_input, enum projection output_projection, struct c
else {
str_pro = projection_from_name(proj,&offset);
if (str_pro == projection_none) {
- dbg(0, "Unknown projection: %s\n", proj);
+ dbg(lvl_error, "Unknown projection: %s\n", proj);
goto out;
}
}
@@ -202,8 +202,8 @@ coord_parse(const char *coord_input, enum projection output_projection, struct c
args=sscanf(str, "%i %i%n",&c.x, &c.y, &ret);
if (args < 2)
goto out;
- dbg(1,"str='%s' x=0x%x y=0x%x c=%d\n", str, c.x, c.y, ret);
- dbg(1,"rest='%s'\n", str+ret);
+ dbg(lvl_warning,"str='%s' x=0x%x y=0x%x c=%d\n", str, c.x, c.y, ret);
+ dbg(lvl_warning,"rest='%s'\n", str+ret);
if (str_pro == projection_none)
str_pro=projection_mg;
@@ -215,13 +215,13 @@ coord_parse(const char *coord_input, enum projection output_projection, struct c
} else if (*s == 'N' || *s == 'n' || *s == 'S' || *s == 's') {
double lng, lat;
char ns, ew;
- dbg(1,"str='%s'\n", str);
+ dbg(lvl_warning,"str='%s'\n", str);
args=sscanf(str, "%lf %c %lf %c%n", &lat, &ns, &lng, &ew, &ret);
- dbg(1,"args=%d\n", args);
- dbg(1,"lat=%f %c lon=%f %c\n", lat, ns, lng, ew);
+ dbg(lvl_warning,"args=%d\n", args);
+ dbg(lvl_warning,"lat=%f %c lon=%f %c\n", lat, ns, lng, ew);
if (args < 4)
goto out;
- dbg(1,"projection=%d str_pro=%d projection_none=%d\n", output_projection, str_pro, projection_none);
+ dbg(lvl_warning,"projection=%d str_pro=%d projection_none=%d\n", output_projection, str_pro, projection_none);
if (str_pro == projection_none) {
g.lat=floor(lat/100);
lat-=g.lat*100;
@@ -233,12 +233,12 @@ coord_parse(const char *coord_input, enum projection output_projection, struct c
g.lat=-g.lat;
if (ew == 'w' || ew == 'W')
g.lng=-g.lng;
- dbg(1,"transform_from_geo(%f,%f)",g.lat,g.lng);
+ dbg(lvl_warning,"transform_from_geo(%f,%f)",g.lat,g.lng);
transform_from_geo(output_projection, &g, result);
- dbg(1,"result 0x%x,0x%x\n", result->x,result->y);
+ dbg(lvl_warning,"result 0x%x,0x%x\n", result->x,result->y);
}
- dbg(3,"str='%s' x=%f ns=%c y=%f ew=%c c=%d\n", str, lng, ns, lat, ew, ret);
- dbg(3,"rest='%s'\n", str+ret);
+ dbg(lvl_debug,"str='%s' x=%f ns=%c y=%f ew=%c c=%d\n", str, lng, ns, lat, ew, ret);
+ dbg(lvl_debug,"rest='%s'\n", str+ret);
} else if (str_pro == projection_utm) {
double x,y;
args=sscanf(str, "%lf %lf%n", &x, &y, &ret);
@@ -256,14 +256,14 @@ coord_parse(const char *coord_input, enum projection output_projection, struct c
args=sscanf(str, "%lf %lf%n", &lng, &lat, &ret);
if (args < 2)
goto out;
- dbg(1,"str='%s' x=%f y=%f c=%d\n", str, lng, lat, ret);
- dbg(1,"rest='%s'\n", str+ret);
+ dbg(lvl_warning,"str='%s' x=%f y=%f c=%d\n", str, lng, lat, ret);
+ dbg(lvl_warning,"rest='%s'\n", str+ret);
g.lng=lng;
g.lat=lat;
transform_from_geo(output_projection, &g, result);
}
ret+=str-coord_input;
- dbg(2, "ret=%d delta=%d ret_str='%s'\n", ret, GPOINTER_TO_INT(str-coord_input), coord_input+ret);
+ dbg(lvl_info, "ret=%d delta=%d ret_str='%s'\n", ret, GPOINTER_TO_INT(str-coord_input), coord_input+ret);
out:
free(proj);
return ret;
diff --git a/navit/debug.c b/navit/debug.c
index f4b0c45d1..85479d51a 100644
--- a/navit/debug.c
+++ b/navit/debug.c
@@ -52,9 +52,9 @@ static struct sockaddr_in debug_sin;
#endif
-int debug_level=0;
-#define GLOBAL_DEBUG_LEVEL_UNSET -1
-int global_debug_level=GLOBAL_DEBUG_LEVEL_UNSET;
+dbg_level debug_level=lvl_error;
+#define GLOBAL_DEBUG_LEVEL_UNSET lvl_unset
+dbg_level global_debug_level=GLOBAL_DEBUG_LEVEL_UNSET;
int segv_level=0;
int timestamp_prefix=0;
@@ -106,7 +106,7 @@ debug_update_level(gpointer key, gpointer value, gpointer user_data)
}
void
-debug_set_global_level(int level, int override_old_value ) {
+debug_set_global_level(dbg_level level, int override_old_value ) {
if (global_debug_level == GLOBAL_DEBUG_LEVEL_UNSET || override_old_value) {
global_debug_level=level;
if (debug_level < global_debug_level){
@@ -116,7 +116,7 @@ debug_set_global_level(int level, int override_old_value ) {
}
void
-debug_level_set(const char *name, int level)
+debug_level_set(const char *name, dbg_level level)
{
if (!strcmp(name, "segv")) {
segv_level=level;
@@ -172,11 +172,11 @@ debug_new(struct attr *parent, struct attr **attrs)
}
-int
+dbg_level
debug_level_get(const char *name)
{
if (!debug_hash)
- return 0;
+ return lvl_error;
return GPOINTER_TO_INT(g_hash_table_lookup(debug_hash, name));
}
@@ -207,7 +207,7 @@ static void debug_timestamp(char *buffer)
}
void
-debug_vprintf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, va_list ap)
+debug_vprintf(dbg_level level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, va_list ap)
{
#if defined HAVE_API_WIN32_CE || defined _MSC_VER
char buffer[4096];
@@ -256,7 +256,7 @@ debug_vprintf(int level, const char *module, const int mlen, const char *functio
}
void
-debug_printf(int level, const char *module, const int mlen,const char *function, const int flen, int prefix, const char *fmt, ...)
+debug_printf(dbg_level level, const char *module, const int mlen,const char *function, const int flen, int prefix, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
@@ -267,7 +267,7 @@ debug_printf(int level, const char *module, const int mlen,const char *function,
void
debug_assert_fail(const char *module, const int mlen,const char *function, const int flen, const char *file, int line, const char *expr)
{
- debug_printf(0,module,mlen,function,flen,1,"%s:%d assertion failed:%s\n", file, line, expr);
+ debug_printf(lvl_error,module,mlen,function,flen,1,"%s:%d assertion failed:%s\n", file, line, expr);
abort();
}
@@ -314,7 +314,7 @@ debug_dump_mallocs(void)
{
struct malloc_head *head=malloc_heads;
int i;
- dbg(0,"mallocs %d\n",mallocs);
+ dbg(lvl_error,"mallocs %d\n",mallocs);
while (head) {
fprintf(stderr,"unfreed malloc from %s of size %d\n",head->where,head->size);
for (i = 0 ; i < 8 ; i++)
@@ -337,7 +337,7 @@ debug_malloc(const char *where, int line, const char *func, int size)
debug_malloc_size+=size;
if (debug_malloc_size/(1024*1024) != debug_malloc_size_m) {
debug_malloc_size_m=debug_malloc_size/(1024*1024);
- dbg(0,"malloced %d kb\n",debug_malloc_size/1024);
+ dbg(lvl_error,"malloced %d kb\n",debug_malloc_size/1024);
}
head=malloc(size+sizeof(*head)+sizeof(*tail));
head->magic=0xdeadbeef;
diff --git a/navit/debug.h b/navit/debug.h
index 519e3e2e3..a42de4a71 100644
--- a/navit/debug.h
+++ b/navit/debug.h
@@ -38,7 +38,21 @@ extern "C" {
#endif
#endif
-extern int debug_level;
+/** Possible debug levels (inspired by SLF4J). */
+typedef enum {
+ /** Internal use only, do not use for logging. */
+ lvl_unset=-1,
+ /** Error: something did not work. */
+ lvl_error,
+ /** Warning: something may not have worked. */
+ lvl_warning,
+ /** Informational message. Should make sense to non-programmers. */
+ lvl_info,
+ /** Debug output: (almost) anything goes. */
+ lvl_debug
+} dbg_level;
+
+extern dbg_level debug_level;
#define dbg_str2(x) #x
#define dbg_str1(x) dbg_str2(x)
#define dbg_module dbg_str1(MODULE)
@@ -70,11 +84,11 @@ extern int debug_level;
struct attr;
struct debug;
void debug_init(const char *program_name);
-void debug_level_set(const char *name, int level);
+void debug_level_set(const char *name, dbg_level level);
struct debug *debug_new(struct attr *parent, struct attr **attrs);
-int debug_level_get(const char *name);
-void debug_vprintf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, va_list ap);
-void debug_printf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, ...)
+dbg_level debug_level_get(const char *name);
+void debug_vprintf(dbg_level level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, va_list ap);
+void debug_printf(dbg_level level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 7, 8)))
#endif
@@ -91,7 +105,7 @@ void debug_free(const char *where, int line, const char *func, void *ptr);
void debug_free_func(void *ptr);
void debug_finished(void);
void *debug_realloc(const char *where, int line, const char *func, void *ptr, int size);
-void debug_set_global_level(int level, int override_old_value);
+void debug_set_global_level(dbg_level level, int override_old_value);
/* end of prototypes */
#ifdef __cplusplus
diff --git a/navit/event.c b/navit/event.c
index 6481d7de9..550aa7fd6 100644
--- a/navit/event.c
+++ b/navit/event.c
@@ -32,7 +32,7 @@ static int has_quit;
void event_main_loop_run(void)
{
if (! event_methods.main_loop_run) {
- dbg(0,"no event system set\n");
+ dbg(lvl_error,"no event system set\n");
return;
}
event_methods.main_loop_run();
@@ -105,14 +105,14 @@ event_request_system(const char *system, const char *requestor)
void (*event_type_new)(struct event_methods *meth);
if (e_system) {
if (strcmp(e_system, system)) {
- dbg(0,"system '%s' already requested by '%s', can't set to '%s' as requested from '%s'\n", e_system, e_requestor, system, requestor);
+ dbg(lvl_error,"system '%s' already requested by '%s', can't set to '%s' as requested from '%s'\n", e_system, e_requestor, system, requestor);
return 0;
}
return 1;
}
event_type_new=plugin_get_event_type(system);
if (! event_type_new) {
- dbg(0,"unsupported event system '%s' requested from '%s'\n", system, requestor);
+ dbg(lvl_error,"unsupported event system '%s' requested from '%s'\n", system, requestor);
return 0;
}
event_type_new(&event_methods);
diff --git a/navit/file.c b/navit/file.c
index d1afd2c72..0545106a2 100644
--- a/navit/file.c
+++ b/navit/file.c
@@ -91,7 +91,7 @@ file_socket_connect(char *host, char *service)
hints.ai_protocol = 0;
s = getaddrinfo(host, service, &hints, &result);
if (s != 0) {
- dbg(0,"getaddrinfo error %s\n",gai_strerror(s));
+ dbg(lvl_error,"getaddrinfo error %s\n",gai_strerror(s));
return -1;
}
for (rp = result; rp != NULL; rp = rp->ai_next) {
@@ -112,7 +112,7 @@ file_http_request(struct file *file, char *method, char *host, char *path, char
{
char *request=g_strdup_printf("%s %s HTTP/1.0\r\nUser-Agent: navit %s\r\nHost: %s\r\n%s%s%s\r\n",method,path,version,host,persistent?"Connection: Keep-Alive\r\n":"",header?header:"",header?"\r\n":"");
write(file->fd, request, strlen(request));
- dbg(1,"%s\n",request);
+ dbg(lvl_warning,"%s\n",request);
file->requests++;
}
@@ -149,7 +149,7 @@ file_request_do(struct file *file, struct attr **options, int connect)
host[path-name-7]='\0';
if (port)
*port++='\0';
- dbg(1,"host=%s path=%s\n",host,path);
+ dbg(lvl_warning,"host=%s path=%s\n",host,path);
if (connect)
file->fd=file_socket_connect(host,port?port:"80");
file_http_request(file,method,host,path,header,persistent);
@@ -223,11 +223,11 @@ file_create(char *name, struct attr **options)
g_free(file);
return NULL;
}
- dbg(1,"fd=%d\n", file->fd);
+ dbg(lvl_warning,"fd=%d\n", file->fd);
file->size=lseek(file->fd, 0, SEEK_END);
if (file->size < 0)
file->size=0;
- dbg(1,"size="LONGLONG_FMT"\n", file->size);
+ dbg(lvl_warning,"size="LONGLONG_FMT"\n", file->size);
file->name_id = (long)atom(name);
}
#ifdef CACHE_SIZE
@@ -282,7 +282,7 @@ int file_mkdir(char *name, int pflag)
char *buffer=g_alloca(sizeof(char)*(strlen(name)+1));
int ret;
char *next;
- dbg(1,"enter %s %d\n",name,pflag);
+ dbg(lvl_warning,"enter %s %d\n",name,pflag);
if (!pflag) {
if (file_is_dir(name))
return 0;
@@ -380,7 +380,7 @@ file_process_headers(struct file *file, unsigned char *headers)
if (*sep == ' ')
sep++;
strtolower(tok, tok);
- dbg(1,"header '%s'='%s'\n",tok,sep);
+ dbg(lvl_warning,"header '%s'='%s'\n",tok,sep);
g_hash_table_insert(file->headers, tok, sep);
headers=NULL;
}
@@ -424,10 +424,10 @@ file_data_read_special(struct file *file, int size, int *size_ret)
eof=1;
}
if (file->requests) {
- dbg(1,"checking header\n");
+ dbg(lvl_warning,"checking header\n");
if ((hdr=file_http_header_end(file->buffer, file->buffer_len))) {
hdr[-1]='\0';
- dbg(1,"found %s\n",file->buffer);
+ dbg(lvl_warning,"found %s\n",file->buffer);
file_process_headers(file, file->buffer);
file_shift_buffer(file, hdr-file->buffer);
file->requests--;
@@ -461,7 +461,7 @@ file_data_flush(struct file *file, long long offset, int size)
if (file->cache) {
struct file_cache_id id={offset,size,file->name_id,0};
cache_flush(file_cache,&id);
- dbg(1,"Flushing "LONGLONG_FMT" %d bytes\n",offset,size);
+ dbg(lvl_warning,"Flushing "LONGLONG_FMT" %d bytes\n",offset,size);
}
}
@@ -545,7 +545,7 @@ file_data_read_compressed(struct file *file, long long offset, int size, int siz
ret=NULL;
} else {
if (uncompress_int(ret, &destLen, (Bytef *)buffer, size) != Z_OK) {
- dbg(0,"uncompress failed\n");
+ dbg(lvl_error,"uncompress failed\n");
g_free(ret);
ret=NULL;
}
@@ -604,7 +604,7 @@ file_data_read_encrypted(struct file *file, long long offset, int size, int size
datap=buffer+sizeof(salt)+sizeof(verify);
if (compressed) {
if (uncompress_int(ret, &destLen, (Bytef *)datap, size) != Z_OK) {
- dbg(0,"uncompress failed\n");
+ dbg(lvl_error,"uncompress failed\n");
g_free(ret);
ret=NULL;
}
@@ -612,7 +612,7 @@ file_data_read_encrypted(struct file *file, long long offset, int size, int size
if (size == destLen)
memcpy(ret, buffer, destLen);
else {
- dbg(0,"memcpy failed\n");
+ dbg(lvl_error,"memcpy failed\n");
g_free(ret);
ret=NULL;
}
@@ -832,7 +832,7 @@ file_wordexp_new(const char *pattern)
ret->pattern=g_strdup(pattern);
ret->err=wordexp(pattern, &ret->we, 0);
if (ret->err)
- dbg(0,"wordexp('%s') returned %d\n", pattern, ret->err);
+ dbg(lvl_error,"wordexp('%s') returned %d\n", pattern, ret->err);
return ret;
}
@@ -886,7 +886,7 @@ file_version(struct file *file, int mode)
file->mtime=st.st_mtime;
file->ctime=st.st_ctime;
file->version++;
- dbg(1,"%s now version %d\n", file->name, file->version);
+ dbg(lvl_warning,"%s now version %d\n", file->name, file->version);
}
}
return file->version;
@@ -920,6 +920,6 @@ file_init(void)
file_cache=cache_new(sizeof(struct file_cache_id), CACHE_SIZE);
#endif
if(sizeof(off_t)<8)
- dbg(0,"Maps larger than 2GB are not supported by this binary, sizeof(off_t)=%zu\n",sizeof(off_t));
+ dbg(lvl_error,"Maps larger than 2GB are not supported by this binary, sizeof(off_t)=%zu\n",sizeof(off_t));
}
diff --git a/navit/font/freetype/font_freetype.c b/navit/font/freetype/font_freetype.c
index e4453b592..bf8682e66 100644
--- a/navit/font/freetype/font_freetype.c
+++ b/navit/font/freetype/font_freetype.c
@@ -351,21 +351,21 @@ static FT_Error face_requester( FTC_FaceID face_id, FT_Library library, FT_Point
if (! face_id)
return FT_Err_Invalid_Handle;
fontfile=g_strdup((char *)face_id);
- dbg(1,"fontfile=%s\n", fontfile);
+ dbg(lvl_warning,"fontfile=%s\n", fontfile);
fontindex=strrchr(fontfile,'/');
if (! fontindex) {
g_free(fontfile);
return FT_Err_Invalid_Handle;
}
*fontindex++='\0';
- dbg(1,"new face %s %d\n", fontfile, atoi(fontindex));
+ dbg(lvl_warning,"new face %s %d\n", fontfile, atoi(fontindex));
ret = FT_New_Face( library, fontfile, atoi(fontindex), aface );
if(ret) {
- dbg(0,"Error while creating freetype face: %d\n", ret);
+ dbg(lvl_error,"Error while creating freetype face: %d\n", ret);
return ret;
}
if((ret = FT_Select_Charmap(*aface, FT_ENCODING_UNICODE))) {
- dbg(0,"Error while creating freetype face: %d\n", ret);
+ dbg(lvl_error,"Error while creating freetype face: %d\n", ret);
}
return 0;
}
@@ -412,7 +412,7 @@ font_freetype_font_new(struct graphics_priv *gr,
}
font->size=size;
#ifdef HAVE_FONTCONFIG
- dbg(2, " about to search for fonts, preferred = %s\n", fontfamily);
+ dbg(lvl_info, " about to search for fonts, preferred = %s\n", fontfamily);
family = g_malloc(sizeof(fontfamilies) + sizeof(fontfamily));
if (fontfamily) {
memcpy(family, &fontfamily, sizeof(fontfamily));
@@ -426,7 +426,7 @@ font_freetype_font_new(struct graphics_priv *gr,
while (*family && !found) {
- dbg(2, "Looking for font family %s. exact=%d\n",
+ dbg(lvl_info, "Looking for font family %s. exact=%d\n",
*family, exact);
FcPattern *required =
FcPatternBuild(NULL, FC_FAMILY, FcTypeString,
@@ -456,7 +456,7 @@ font_freetype_font_new(struct graphics_priv *gr,
if ((r1 == FcResultMatch)
&& (r2 == FcResultMatch)
&& (FcValueEqual(v1, v2) || !exact)) {
- dbg(2,
+ dbg(lvl_info,
"About to load font from file %s index %d\n",
fontfile, fontindex);
#if USE_CACHING
@@ -528,7 +528,7 @@ font_freetype_font_new(struct graphics_priv *gr,
g_free(name);
#endif /* HAVE_FONTCONFIG */
if (!found) {
- dbg(0,"Failed to load font, no labelling\n");
+ dbg(lvl_error,"Failed to load font, no labelling\n");
g_free(font);
return NULL;
}
diff --git a/navit/graphics.c b/navit/graphics.c
index fd7006a08..042d666bd 100644
--- a/navit/graphics.c
+++ b/navit/graphics.c
@@ -204,7 +204,7 @@ int
graphics_set_attr(struct graphics *gra, struct attr *attr)
{
int ret=1;
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
if (gra->meth.set_attr)
ret=gra->meth.set_attr(gra->priv, attr);
if (!ret)
@@ -646,7 +646,7 @@ image_new_helper(struct graphics *gra, struct graphics_image *this_, char *path,
this_->width=width;
this_->height=height;
- dbg(2,"Trying to load image '%s' for '%s' at %dx%d\n", new_name, path, width, height);
+ dbg(lvl_info,"Trying to load image '%s' for '%s' at %dx%d\n", new_name, path, width, height);
if (zip) {
unsigned char *start;
int len;
@@ -662,7 +662,7 @@ image_new_helper(struct graphics *gra, struct graphics_image *this_, char *path,
this_->priv=gra->meth.image_new(gra->priv, &this_->meth, new_name, &this_->width, &this_->height, &this_->hot, rotate);
}
if (this_->priv) {
- dbg(1,"Using image '%s' for '%s' at %dx%d\n", new_name, path, width, height);
+ dbg(lvl_warning,"Using image '%s' for '%s' at %dx%d\n", new_name, path, width, height);
g_free(new_name);
break;
}
@@ -687,7 +687,7 @@ struct graphics_image * graphics_image_new_scaled_rotated(struct graphics *gra,
if ( g_hash_table_lookup_extended( gra->image_cache_hash, hash_key, NULL, (gpointer)&this_) ) {
g_free(hash_key);
- dbg(3,"Found cached image%sfor '%s'\n",this_?" ":" miss ",path);
+ dbg(lvl_debug,"Found cached image%sfor '%s'\n",this_?" ":" miss ",path);
return this_;
}
@@ -763,7 +763,7 @@ struct graphics_image * graphics_image_new_scaled_rotated(struct graphics *gra,
}
if (! this_->priv) {
- dbg(0,"No image for '%s'\n", path);
+ dbg(lvl_error,"No image for '%s'\n", path);
g_free(this_);
this_=NULL;
}
@@ -1139,7 +1139,7 @@ static void label_line(struct graphics *gra, struct graphics_gc *fg, struct grap
p_t.x=x;
p_t.y=y;
#if 0
- dbg(0,"display_text: '%s', %d, %d, %d, %d %d\n", label, x, y, dx*0x10000/l, dy*0x10000/l, l);
+ dbg(lvl_error,"display_text: '%s', %d, %d, %d, %d %d\n", label, x, y, dx*0x10000/l, dy*0x10000/l, l);
#endif
if (x < gra->r.rl.x && x + tl > gra->r.lu.x && y + tl > gra->r.lu.y && y - tl < gra->r.rl.y)
gra->meth.draw_text(gra->priv, fg->priv, bg?bg->priv:NULL, font->priv, label, &p_t, dx*0x10000/l, dy*0x10000/l);
@@ -1186,11 +1186,11 @@ intersection(struct point * a1, int adx, int ady, struct point * b1, int bdx, in
struct point * res)
{
int n, a, b;
- dbg(1,"%d,%d - %d,%d x %d,%d-%d,%d\n",a1->x,a1->y,a1->x+adx,a1->y+ady,b1->x,b1->y,b1->x+bdx,b1->y+bdy);
+ dbg(lvl_warning,"%d,%d - %d,%d x %d,%d-%d,%d\n",a1->x,a1->y,a1->x+adx,a1->y+ady,b1->x,b1->y,b1->x+bdx,b1->y+bdy);
n = bdy * adx - bdx * ady;
a = bdx * (a1->y - b1->y) - bdy * (a1->x - b1->x);
b = adx * (a1->y - b1->y) - ady * (a1->x - b1->x);
- dbg(1,"a %d b %d n %d\n",a,b,n);
+ dbg(lvl_warning,"a %d b %d n %d\n",a,b,n);
if (n < 0) {
n = -n;
a = -a;
@@ -1206,7 +1206,7 @@ intersection(struct point * a1, int adx, int ady, struct point * b1, int bdx, in
return 0;
res->x = a1->x + a * adx / n;
res->y = a1->y + a * ady / n;
- dbg(1,"%d,%d\n",res->x,res->y);
+ dbg(lvl_warning,"%d,%d\n",res->x,res->y);
return 1;
}
@@ -1285,7 +1285,7 @@ draw_circle(struct point *pnt, int diameter, int scale, int start, int len, stru
struct circle *c;
#if 0
- dbg(0,"diameter=%d start=%d len=%d pos=%d dir=%d\n", diameter, start, len, *pos, dir);
+ dbg(lvl_error,"diameter=%d start=%d len=%d pos=%d dir=%d\n", diameter, start, len, *pos, dir);
#endif
int count=64;
int end=start+len;
@@ -1466,7 +1466,7 @@ draw_shape(struct draw_polyline_context *ctx, struct point *pnt, int wi)
struct draw_polyline_shape *prev=&ctx->prev_shape;
#if 0
- dbg(0,"enter %d,%d - %d,%d %d\n",pnt[0].x,pnt[0].y,pnt[1].x,pnt[1].y,wi);
+ dbg(lvl_error,"enter %d,%d - %d,%d %d\n",pnt[0].x,pnt[0].y,pnt[1].x,pnt[1].y,wi);
#endif
*prev=*shape;
@@ -1495,7 +1495,7 @@ draw_shape(struct draw_polyline_context *ctx, struct point *pnt, int wi)
l = int_sqrt((dxs+dys)*lscales);
#endif
shape->fow=fowler(-shape->dy, shape->dx);
- dbg(1,"fow=%d\n",shape->fow);
+ dbg(lvl_warning,"fow=%d\n",shape->fow);
if (! l)
l=1;
if (wi*lscale > 10000)
@@ -1544,7 +1544,7 @@ draw_middle(struct draw_polyline_context *ctx, struct point *p)
draw_point(&ctx->shape, p, &ctx->res[ctx->ppos++], 1);
return 1;
}
- dbg(1,"delta %d\n",delta);
+ dbg(lvl_warning,"delta %d\n",delta);
if (delta > 0) {
struct point pos,poso;
draw_point(&ctx->shape, p, &pos, 1);
@@ -1604,9 +1604,9 @@ graphics_draw_polyline_as_polygon(struct graphics_priv *gra_priv, struct graphic
if (count < 2)
return;
#if 0
- dbg(0,"count=%d\n",count);
+ dbg(lvl_error,"count=%d\n",count);
for (i = 0 ; i < count ; i++)
- dbg(0,"%d,%d width %d\n",pnt[i].x,pnt[i].y,width[i]);
+ dbg(lvl_error,"%d,%d width %d\n",pnt[i].x,pnt[i].y,width[i]);
#endif
ctx.shape.l=0;
ctx.res=g_alloca(sizeof(struct point)*maxpoints);
@@ -1753,10 +1753,10 @@ graphics_draw_polyline_clipped(struct graphics *gra, struct graphics_gc *gc, str
segment_end.x=pa[i].x;
segment_end.y=pa[i].y;
segment_end.w=width[i];
- dbg(3, "Segment: [%d, %d] - [%d, %d]...\n", segment_start.x, segment_start.y, segment_end.x, segment_end.y);
+ dbg(lvl_debug, "Segment: [%d, %d] - [%d, %d]...\n", segment_start.x, segment_start.y, segment_end.x, segment_end.y);
clip_result=clip_line(&segment_start, &segment_end, &r);
if (clip_result != CLIPRES_INVISIBLE) {
- dbg(3, "....clipped to [%d, %d] - [%d, %d]\n", segment_start.x, segment_start.y, segment_end.x, segment_end.y);
+ dbg(lvl_debug, "....clipped to [%d, %d] - [%d, %d]\n", segment_start.x, segment_start.y, segment_end.x, segment_end.y);
if ((i == 1) || (clip_result & CLIPRES_START_CLIPPED)) {
points_to_draw[points_to_draw_cnt].x=segment_start.x;
points_to_draw[points_to_draw_cnt].y=segment_start.y;
@@ -1939,7 +1939,7 @@ graphics_icon_path(const char *icon)
static char *navit_sharedir;
char *ret=NULL;
struct file_wordexp *wordexp=NULL;
- dbg(1,"enter %s\n",icon);
+ dbg(lvl_warning,"enter %s\n",icon);
if (strchr(icon, '$')) {
wordexp=file_wordexp_new(icon);
if (file_wordexp_get_count(wordexp))
@@ -1952,7 +1952,7 @@ graphics_icon_path(const char *icon)
// get resources for the correct screen density
//
// this part not needed, android unpacks only the correct version into res/drawable dir!
- // dbg(1,"android icon_path %s\n",icon);
+ // dbg(lvl_warning,"android icon_path %s\n",icon);
// static char *android_density;
// android_density = getenv("ANDROID_DENSITY");
// ret=g_strdup_printf("res/drawable-%s/%s",android_density ,icon);
@@ -2061,7 +2061,7 @@ displayitem_draw(struct displayitem *di, void *dummy, struct display_context *dc
if (font)
gra->meth.draw_text(gra->priv, gc->priv, gc_background?gc_background->priv:NULL, font->priv, di->label, &p, 0x10000, 0);
else
- dbg(0,"Failed to get font with size %d\n",e->text_size);
+ dbg(lvl_error,"Failed to get font with size %d\n",e->text_size);
}
}
break;
@@ -2077,7 +2077,7 @@ displayitem_draw(struct displayitem *di, void *dummy, struct display_context *dc
if (font)
label_line(gra, gc, gc_background, font, pa, count, di->label);
else
- dbg(0,"Failed to get font with size %d\n",e->text_size);
+ dbg(lvl_error,"Failed to get font with size %d\n",e->text_size);
}
break;
case element_icon:
@@ -2100,7 +2100,7 @@ displayitem_draw(struct displayitem *di, void *dummy, struct display_context *dc
if (img)
dc->img=img;
else
- dbg(0,"failed to load icon '%s'\n", path);
+ dbg(lvl_error,"failed to load icon '%s'\n", path);
g_free(path);
}
if (img) {
@@ -2116,19 +2116,19 @@ displayitem_draw(struct displayitem *di, void *dummy, struct display_context *dc
}
break;
case element_image:
- dbg(1,"image: '%s'\n", di->label);
+ dbg(lvl_warning,"image: '%s'\n", di->label);
if (gra->meth.draw_image_warp) {
img=graphics_image_new_scaled_rotated(gra, di->label, -1, -1, 0);
if (img)
gra->meth.draw_image_warp(gra->priv, gra->gc[0]->priv, pa, count, img->priv);
} else
- dbg(0,"draw_image_warp not supported by graphics driver drawing '%s'\n", di->label);
+ dbg(lvl_error,"draw_image_warp not supported by graphics driver drawing '%s'\n", di->label);
break;
case element_arrows:
display_draw_arrows(gra,gc,pa,count);
break;
default:
- dbg(0, "Unhandled element type %d\n", e->type);
+ dbg(lvl_error, "Unhandled element type %d\n", e->type);
}
di=di->next;
@@ -2193,7 +2193,7 @@ graphics_draw_itemgra(struct graphics *gra, struct itemgra *itm, struct transfor
struct element *e=es->data;
if (e->coord_count) {
if (e->coord_count > max_coord) {
- dbg(0,"maximum number of coords reached: %d > %d\n",e->coord_count,max_coord);
+ dbg(lvl_error,"maximum number of coords reached: %d > %d\n",e->coord_count,max_coord);
di->count=max_coord;
} else
di->count=e->coord_count;
@@ -2295,7 +2295,7 @@ displaylist_update_hash(struct displaylist *displaylist)
displaylist->max_offset=0;
clear_hash(displaylist);
displaylist_update_layers(displaylist, displaylist->layout->layers, displaylist->order);
- dbg(1,"max offset %d\n",displaylist->max_offset);
+ dbg(lvl_warning,"max offset %d\n",displaylist->max_offset);
}
@@ -2400,12 +2400,12 @@ do_draw(struct displaylist *displaylist, int cancel, int flags)
if (! count)
continue;
#if 0
- dbg(0,"%s 0x%x 0x%x\n",item_to_name(item->type), item->id_hi, item->id_lo);
+ dbg(lvl_error,"%s 0x%x 0x%x\n",item_to_name(item->type), item->id_hi, item->id_lo);
#endif
if (displaylist->dc.pro != pro)
transform_from_to_count(ca, displaylist->dc.pro, ca, pro, count);
if (count == max) {
- dbg(0,"point count overflow %d for %s "ITEM_ID_FMT"\n", count,item_to_name(item->type),ITEM_ID_ARGS(*item));
+ dbg(lvl_error,"point count overflow %d for %s "ITEM_ID_FMT"\n", count,item_to_name(item->type),ITEM_ID_ARGS(*item));
displaylist->dc.maxlen=max*2;
}
if (item_is_custom_poi(*item)) {
@@ -2510,14 +2510,14 @@ static void graphics_load_mapset(struct graphics *gra, struct displaylist *displ
{
int order=transform_get_order(trans);
- dbg(1,"enter");
+ dbg(lvl_warning,"enter");
if (displaylist->busy) {
if (async == 1)
return;
do_draw(displaylist, 1, flags);
}
xdisplay_free(displaylist);
- dbg(1,"order=%d\n", order);
+ dbg(lvl_warning,"order=%d\n", order);
displaylist->dc.gra=gra;
displaylist->ms=mapset;
diff --git a/navit/graphics/android/graphics_android.c b/navit/graphics/android/graphics_android.c
index 912fc30fe..0f1040356 100644
--- a/navit/graphics/android/graphics_android.c
+++ b/navit/graphics/android/graphics_android.c
@@ -89,7 +89,7 @@ find_class_global(char *name, jclass *ret)
{
*ret=(*jnienv)->FindClass(jnienv, name);
if (! *ret) {
- dbg(0,"Failed to get Class %s\n",name);
+ dbg(lvl_error,"Failed to get Class %s\n",name);
return 0;
}
*ret = (*jnienv)->NewGlobalRef(jnienv, *ret);
@@ -101,7 +101,7 @@ find_method(jclass class, char *name, char *args, jmethodID *ret)
{
*ret = (*jnienv)->GetMethodID(jnienv, class, name, args);
if (*ret == NULL) {
- dbg(0,"Failed to get Method %s with signature %s\n",name,args);
+ dbg(lvl_error,"Failed to get Method %s with signature %s\n",name,args);
return 0;
}
return 1;
@@ -112,7 +112,7 @@ find_static_method(jclass class, char *name, char *args, jmethodID *ret)
{
*ret = (*jnienv)->GetStaticMethodID(jnienv, class, name, args);
if (*ret == NULL) {
- dbg(0,"Failed to get static Method %s with signature %s\n",name,args);
+ dbg(lvl_error,"Failed to get static Method %s with signature %s\n",name,args);
return 0;
}
return 1;
@@ -222,18 +222,18 @@ image_new(struct graphics_priv *gra, struct graphics_image_methods *meth, char *
jclass localBitmap = NULL;
int id;
- dbg(1,"enter %s\n",path);
+ dbg(lvl_warning,"enter %s\n",path);
if (!strncmp(path,"res/drawable/",13)) {
jstring a=(*jnienv)->NewStringUTF(jnienv, "drawable");
char *path_noext=g_strdup(path+13);
char *pos=strrchr(path_noext, '.');
if (pos)
*pos='\0';
- dbg(1,"path_noext=%s\n",path_noext);
+ dbg(lvl_warning,"path_noext=%s\n",path_noext);
string = (*jnienv)->NewStringUTF(jnienv, path_noext);
g_free(path_noext);
id=(*jnienv)->CallIntMethod(jnienv, gra->Resources, gra->Resources_getIdentifier, string, a, gra->packageName);
- dbg(1,"id=%d\n",id);
+ dbg(lvl_warning,"id=%d\n",id);
if (id)
localBitmap=(*jnienv)->CallStaticObjectMethod(jnienv, gra->BitmapFactoryClass, gra->BitmapFactory_decodeResource, gra->Resources, id);
(*jnienv)->DeleteLocalRef(jnienv, a);
@@ -241,19 +241,19 @@ image_new(struct graphics_priv *gra, struct graphics_image_methods *meth, char *
string = (*jnienv)->NewStringUTF(jnienv, path);
localBitmap=(*jnienv)->CallStaticObjectMethod(jnienv, gra->BitmapFactoryClass, gra->BitmapFactory_decodeFile, string);
}
- dbg(1,"result=%p\n",localBitmap);
+ dbg(lvl_warning,"result=%p\n",localBitmap);
if (localBitmap) {
ret->Bitmap = (*jnienv)->NewGlobalRef(jnienv, localBitmap);
(*jnienv)->DeleteLocalRef(jnienv, localBitmap);
ret->width=(*jnienv)->CallIntMethod(jnienv, ret->Bitmap, gra->Bitmap_getWidth);
ret->height=(*jnienv)->CallIntMethod(jnienv, ret->Bitmap, gra->Bitmap_getHeight);
- dbg(1,"w=%d h=%d for %s\n",ret->width,ret->height,path);
+ dbg(lvl_warning,"w=%d h=%d for %s\n",ret->width,ret->height,path);
ret->hot.x=ret->width/2;
ret->hot.y=ret->height/2;
} else {
g_free(ret);
ret=NULL;
- dbg(1,"Failed to open %s\n",path);
+ dbg(lvl_warning,"Failed to open %s\n",path);
}
(*jnienv)->DeleteLocalRef(jnienv, string);
g_hash_table_insert(image_cache_hash, g_strdup( path ), (gpointer)ret );
@@ -346,7 +346,7 @@ static void
draw_text(struct graphics_priv *gra, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
{
int bgcolor=0;
- dbg(1,"enter %s\n", text);
+ dbg(lvl_warning,"enter %s\n", text);
initPaint(gra, fg);
if(bg)
bgcolor=(bg->a<<24)| (bg->r<<16) | (bg->g<<8) | bg->b;
@@ -358,7 +358,7 @@ draw_text(struct graphics_priv *gra, struct graphics_gc_priv *fg, struct graphic
static void
draw_image(struct graphics_priv *gra, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
{
- dbg(1,"enter %p\n",img);
+ dbg(lvl_warning,"enter %p\n",img);
initPaint(gra, fg);
(*jnienv)->CallVoidMethod(jnienv, gra->NavitGraphics, gra->NavitGraphics_draw_image, fg->gra->Paint, p->x, p->y, img->Bitmap);
@@ -467,7 +467,7 @@ static struct graphics_methods graphics_methods = {
static void
resize_callback(struct graphics_priv *gra, int w, int h)
{
- dbg(0,"w=%d h=%d ok\n",w,h);
+ dbg(lvl_error,"w=%d h=%d ok\n",w,h);
callback_list_call_attr_2(gra->cbl, attr_resize, (void *)w, (void *)h);
}
@@ -483,7 +483,7 @@ motion_callback(struct graphics_priv *gra, int x, int y)
static void
keypress_callback(struct graphics_priv *gra, char *s)
{
- dbg(0,"enter %s\n",s);
+ dbg(lvl_error,"enter %s\n",s);
callback_list_call_attr_1(gra->cbl, attr_keypress, s);
}
@@ -504,20 +504,20 @@ set_activity(jobject graphics)
jmethodID cid;
ActivityClass = (*jnienv)->GetObjectClass(jnienv, android_activity);
- dbg(0,"at 5\n");
+ dbg(lvl_error,"at 5\n");
if (ActivityClass == NULL) {
- dbg(0,"no activity class found\n");
+ dbg(lvl_error,"no activity class found\n");
return 0;
}
- dbg(0,"at 6\n");
+ dbg(lvl_error,"at 6\n");
cid = (*jnienv)->GetMethodID(jnienv, ActivityClass, "setContentView", "(Landroid/view/View;)V");
if (cid == NULL) {
- dbg(0,"no setContentView method found\n");
+ dbg(lvl_error,"no setContentView method found\n");
return 0;
}
- dbg(0,"at 7\n");
+ dbg(lvl_error,"at 7\n");
(*jnienv)->CallVoidMethod(jnienv, android_activity, cid, graphics);
- dbg(0,"at 8\n");
+ dbg(lvl_error,"at 8\n");
return 1;
}
@@ -527,7 +527,7 @@ graphics_android_init(struct graphics_priv *ret, struct graphics_priv *parent, s
struct callback *cb;
jmethodID cid, Context_getPackageName;
- dbg(0,"at 2 jnienv=%p\n",jnienv);
+ dbg(lvl_error,"at 2 jnienv=%p\n",jnienv);
if (!find_class_global("android/graphics/Paint", &ret->PaintClass))
return 0;
if (!find_method(ret->PaintClass, "<init>", "(I)V", &ret->Paint_init))
@@ -572,15 +572,15 @@ graphics_android_init(struct graphics_priv *ret, struct graphics_priv *parent, s
if (!find_class_global("org/navitproject/navit/NavitGraphics", &ret->NavitGraphicsClass))
return 0;
- dbg(0,"at 3\n");
+ dbg(lvl_error,"at 3\n");
cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "<init>", "(Landroid/app/Activity;Lorg/navitproject/navit/NavitGraphics;IIIIIII)V");
if (cid == NULL) {
- dbg(0,"no method found\n");
+ dbg(lvl_error,"no method found\n");
return 0; /* exception thrown */
}
- dbg(0,"at 4 android_activity=%p\n",android_activity);
+ dbg(lvl_error,"at 4 android_activity=%p\n",android_activity);
ret->NavitGraphics=(*jnienv)->NewObject(jnienv, ret->NavitGraphicsClass, cid, android_activity, parent ? parent->NavitGraphics : NULL, pnt ? pnt->x:0 , pnt ? pnt->y:0, w, h, alpha, wraparound, use_camera);
- dbg(0,"result=%p\n",ret->NavitGraphics);
+ dbg(lvl_error,"result=%p\n",ret->NavitGraphics);
if (ret->NavitGraphics)
ret->NavitGraphics = (*jnienv)->NewGlobalRef(jnienv, ret->NavitGraphics);
@@ -589,13 +589,13 @@ graphics_android_init(struct graphics_priv *ret, struct graphics_priv *parent, s
/* 0x101 = text kerning (default), antialiasing */
ret->Paint=(*jnienv)->NewObject(jnienv, ret->PaintClass, ret->Paint_init, 0x101);
- dbg(0,"result=%p\n",ret->Paint);
+ dbg(lvl_error,"result=%p\n",ret->Paint);
if (ret->Paint)
ret->Paint = (*jnienv)->NewGlobalRef(jnienv, ret->Paint);
cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setSizeChangedCallback", "(I)V");
if (cid == NULL) {
- dbg(0,"no SetResizeCallback method found\n");
+ dbg(lvl_error,"no SetResizeCallback method found\n");
return 0; /* exception thrown */
}
cb=callback_new_1(callback_cast(resize_callback), ret);
@@ -603,7 +603,7 @@ graphics_android_init(struct graphics_priv *ret, struct graphics_priv *parent, s
cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setButtonCallback", "(I)V");
if (cid == NULL) {
- dbg(0,"no SetButtonCallback method found\n");
+ dbg(lvl_error,"no SetButtonCallback method found\n");
return 0; /* exception thrown */
}
cb=callback_new_1(callback_cast(button_callback), ret);
@@ -611,7 +611,7 @@ graphics_android_init(struct graphics_priv *ret, struct graphics_priv *parent, s
cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setMotionCallback", "(I)V");
if (cid == NULL) {
- dbg(0,"no SetMotionCallback method found\n");
+ dbg(lvl_error,"no SetMotionCallback method found\n");
return 0; /* exception thrown */
}
cb=callback_new_1(callback_cast(motion_callback), ret);
@@ -619,7 +619,7 @@ graphics_android_init(struct graphics_priv *ret, struct graphics_priv *parent, s
cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setKeypressCallback", "(I)V");
if (cid == NULL) {
- dbg(0,"no SetKeypressCallback method found\n");
+ dbg(lvl_error,"no SetKeypressCallback method found\n");
return 0; /* exception thrown */
}
cb=callback_new_1(callback_cast(keypress_callback), ret);
@@ -666,7 +666,7 @@ graphics_android_fullscreen(struct window *win, int on)
static void
graphics_android_disable_suspend(struct window *win)
{
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
(*jnienv)->CallVoidMethod(jnienv, android_activity, Navit_disableSuspend);
}
@@ -691,7 +691,7 @@ graphics_android_new(struct navit *nav, struct graphics_methods *meth, struct at
}
image_cache_hash = g_hash_table_new(g_str_hash, g_str_equal);
if (graphics_android_init(ret, NULL, NULL, 0, 0, 0, 0, use_camera)) {
- dbg(0,"returning %p\n",ret);
+ dbg(lvl_error,"returning %p\n",ret);
return ret;
} else {
g_free(ret);
@@ -705,7 +705,7 @@ overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct poin
struct graphics_priv *ret=g_new0(struct graphics_priv, 1);
*meth=graphics_methods;
if (graphics_android_init(ret, gr, p, w, h, alpha, wraparound, 0)) {
- dbg(0,"returning %p\n",ret);
+ dbg(lvl_error,"returning %p\n",ret);
return ret;
} else {
g_free(ret);
@@ -717,12 +717,12 @@ overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct poin
static void
event_android_main_loop_run(void)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
}
static void event_android_main_loop_quit(void)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
(*jnienv)->CallVoidMethod(jnienv, android_activity, Navit_exit);
}
@@ -744,7 +744,7 @@ static void do_poll(JNIEnv *env, int fd, int cond)
{
struct pollfd pfd;
pfd.fd=fd;
- dbg(1,"%p poll called for %d %d\n", fd, cond);
+ dbg(lvl_warning,"%p poll called for %d %d\n", fd, cond);
switch ((enum event_watch_cond)cond) {
case event_watch_cond_read:
pfd.events=POLLIN;
@@ -767,7 +767,7 @@ event_android_add_watch(int h, enum event_watch_cond cond, struct callback *cb)
{
jobject ret;
ret=(*jnienv)->NewObject(jnienv, NavitWatchClass, NavitWatch_init, (int)do_poll, h, (int) cond, (int)cb);
- dbg(0,"result for %d,%d,%p=%p\n",h,cond,cb,ret);
+ dbg(lvl_error,"result for %d,%d,%p=%p\n",h,cond,cb,ret);
if (ret)
ret = (*jnienv)->NewGlobalRef(jnienv, ret);
return (struct event_watch *)ret;
@@ -776,7 +776,7 @@ event_android_add_watch(int h, enum event_watch_cond cond, struct callback *cb)
static void
event_android_remove_watch(struct event_watch *ev)
{
- dbg(0,"enter %p\n",ev);
+ dbg(lvl_error,"enter %p\n",ev);
if (ev) {
jobject obj=(jobject )ev;
(*jnienv)->CallVoidMethod(jnienv, obj, NavitWatch_remove);
@@ -828,9 +828,9 @@ event_android_add_idle(int priority, struct callback *cb)
{
#if 0
jobject ret;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
ret=(*jnienv)->NewObject(jnienv, NavitIdleClass, NavitIdle_init, (int)cb);
- dbg(1,"result for %p=%p\n",cb,ret);
+ dbg(lvl_warning,"result for %p=%p\n",cb,ret);
if (ret)
ret = (*jnienv)->NewGlobalRef(jnienv, ret);
return (struct event_idle *)ret;
@@ -842,7 +842,7 @@ static void
event_android_remove_idle(struct event_idle *ev)
{
#if 0
- dbg(1,"enter %p\n",ev);
+ dbg(lvl_warning,"enter %p\n",ev);
if (ev) {
jobject obj=(jobject )ev;
(*jnienv)->CallVoidMethod(jnienv, obj, NavitIdle_remove);
@@ -855,7 +855,7 @@ event_android_remove_idle(struct event_idle *ev)
static void
event_android_call_callback(struct callback_list *cb)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
}
static struct event_methods event_android_methods = {
@@ -873,7 +873,7 @@ static struct event_methods event_android_methods = {
static struct event_priv *
event_android_new(struct event_methods *meth)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
if (!find_class_global("org/navitproject/navit/NavitTimeout", &NavitTimeoutClass))
return NULL;
NavitTimeout_init = (*jnienv)->GetMethodID(jnienv, NavitTimeoutClass, "<init>", "(IZI)V");
@@ -913,7 +913,7 @@ event_android_new(struct event_methods *meth)
Navit_fullscreen = (*jnienv)->GetMethodID(jnienv, NavitClass, "fullscreen", "(I)V");
if (Navit_fullscreen == NULL)
return NULL;
- dbg(0,"ok\n");
+ dbg(lvl_error,"ok\n");
*meth=event_android_methods;
return NULL;
}
@@ -922,7 +922,7 @@ event_android_new(struct event_methods *meth)
void
plugin_init(void)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
plugin_register_graphics_type("android", graphics_android_new);
plugin_register_event_type("android", event_android_new);
}
diff --git a/navit/graphics/gd/graphics_gd.c b/navit/graphics/gd/graphics_gd.c
index 256b60741..621683ed8 100644
--- a/navit/graphics/gd/graphics_gd.c
+++ b/navit/graphics/gd/graphics_gd.c
@@ -516,7 +516,7 @@ draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
if (gr->flags & 2) {
struct shmem_header *next=shm_next(gr);
gr->shm_header->flag=1;
- dbg(1,"next flag is %d\n",next->flag);
+ dbg(lvl_warning,"next flag is %d\n",next->flag);
if (!next->flag) {
gr->shm_header=next;
image_setup(gr);
@@ -531,15 +531,15 @@ draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
while (sockets) {
int fd=socket(PF_INET, SOCK_STREAM, 0);
if (fd < 0) {
- dbg(0,"socket failed\n");
+ dbg(lvl_error,"socket failed\n");
} else {
if (connect(fd, (struct sockaddr *)sockets->data, sizeof(struct sockaddr_in)) < 0) {
- dbg(0,"connect failed\n");
+ dbg(lvl_error,"connect failed\n");
} else {
size_written=write(fd, data, size);
- dbg(0,"size %d vs %d\n",size, size_written);
+ dbg(lvl_error,"size %d vs %d\n",size, size_written);
if (shutdown(fd, SHUT_RDWR) < 0)
- dbg(0,"shutdown failed\n");
+ dbg(lvl_error,"shutdown failed\n");
}
close(fd);
}
@@ -591,7 +591,7 @@ get_data(struct graphics_priv *this, char *type)
int b;
struct point p;
gdImagePtr im = this->im;
- dbg(1,"type=%s\n",type);
+ dbg(lvl_warning,"type=%s\n",type);
if (!strcmp(type,"window"))
return &this->window;
if (!strcmp(type,"image_png")) {
@@ -613,11 +613,11 @@ get_data(struct graphics_priv *this, char *type)
return &this->image;
}
if (sscanf(type,"click_%d_%d_%d",&p.x,&p.y,&b) == 3) {
- dbg(1,"click %d %d %d\n",p.x,p.y,b);
+ dbg(lvl_warning,"click %d %d %d\n",p.x,p.y,b);
callback_list_call_attr_3(this->cbl, attr_button, (void *)b, (void *)1, (void *)&p);
}
if (sscanf(type,"move_%d_%d",&p.x,&p.y) == 2) {
- dbg(1,"move %d %d\n",p.x,p.y);
+ dbg(lvl_warning,"move %d %d\n",p.x,p.y);
callback_list_call_attr_1(this->cbl, attr_motion, (void *)&p);
}
return NULL;
@@ -634,13 +634,13 @@ image_free(struct graphics_priv *gr, struct graphics_image_priv *priv)
static void
overlay_disable(struct graphics_priv *gr, int disable)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
}
static void
overlay_resize(struct graphics_priv *gr, struct point *p, int w, int h, int alpha, int wraparound)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
}
struct shmem_header *
@@ -648,10 +648,10 @@ shm_next(struct graphics_priv *gr)
{
char *next=(char *)gr->shm_header+gr->shmoffset;
if (next+gr->shmoffset > (char *)gr->shm+gr->shmsize) {
- dbg(1,"wraparound\n");
+ dbg(lvl_warning,"wraparound\n");
return gr->shm;
}
- dbg(1,"next 0x%x (offset 0x%x)\n",next-(char *)gr->shm,gr->shmoffset);
+ dbg(lvl_warning,"next 0x%x (offset 0x%x)\n",next-(char *)gr->shm,gr->shmoffset);
return (struct shmem_header *)next;
}
@@ -672,17 +672,17 @@ image_setup(struct graphics_priv *gr)
static void
image_create(struct graphics_priv *gr)
{
- dbg(0,"shmkey %d\n",gr->shmkey);
+ dbg(lvl_error,"shmkey %d\n",gr->shmkey);
#ifdef HAVE_SHMEM
if (gr->shmkey) {
int size=gr->h*gr->w*sizeof(int);
int shmid=shmget(gr->shmkey, size, 0666);
- dbg(0,"shmid for key 0x%x is 0x%x\n",gr->shmkey, shmid);
+ dbg(lvl_error,"shmid for key 0x%x is 0x%x\n",gr->shmkey, shmid);
if (shmid < 0)
- dbg(0,"shmget\n");
+ dbg(lvl_error,"shmget\n");
gr->shm=shmat(shmid, NULL, 0);
if (!gr->shm)
- dbg(0,"shmat\n");
+ dbg(lvl_error,"shmat\n");
gr->shm_header=gr->shm;
gr->im=g_new0(gdImage,1);
gr->im->tpixels=g_new(int *,gr->h);
@@ -759,7 +759,7 @@ set_attr_do(struct graphics_priv *gr, struct attr *attr, int init)
g_list_free(gr->sockets);
gr->sockets=NULL;
c=s=g_strdup(attr->u.str);
- dbg(0,"s=%s\n",s);
+ dbg(lvl_error,"s=%s\n",s);
while (c) {
n=strchr(c,',');
if (n)
@@ -773,12 +773,12 @@ set_attr_do(struct graphics_priv *gr, struct attr *attr, int init)
if (inet_aton(c, &sin->sin_addr)) {
gr->sockets=g_list_append(gr->sockets, sin);
} else {
- dbg(0,"error in %s\n",c);
+ dbg(lvl_error,"error in %s\n",c);
g_free(sin);
}
- dbg(0,"host=%s port=%s\n",c,p);
+ dbg(lvl_error,"host=%s port=%s\n",c,p);
} else
- dbg(0,"error in format: %s\n",p);
+ dbg(lvl_error,"error in format: %s\n",p);
c=n;
}
g_free(s);
@@ -827,7 +827,7 @@ overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct poin
struct font_priv * (*font_freetype_new)(void *meth);
struct graphics_priv *ret;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
ret=g_new0(struct graphics_priv, 1);
*meth=graphics_methods;
font_freetype_new=plugin_get_font_type("freetype");
diff --git a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c
index 8ae69edba..dea33aedb 100644
--- a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c
+++ b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c
@@ -114,13 +114,13 @@ struct graphics_image_priv {
static void
graphics_destroy(struct graphics_priv *gr)
{
- dbg(3,"enter parent %p\n",gr->parent);
+ dbg(lvl_debug,"enter parent %p\n",gr->parent);
gr->freetype_methods.destroy();
if (!gr->parent) {
- dbg(3,"enter win %p\n",gr->win);
+ dbg(lvl_debug,"enter win %p\n",gr->win);
if (gr->win)
gtk_widget_destroy(gr->win);
- dbg(3,"widget %p\n",gr->widget);
+ dbg(lvl_debug,"widget %p\n",gr->widget);
if (gr->widget)
gtk_widget_destroy(gr->widget);
g_free(gr->window_title);
@@ -404,7 +404,7 @@ draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics
if (! font)
{
- dbg(0,"no font, returning\n");
+ dbg(lvl_error,"no font, returning\n");
return;
}
#if 0 /* Temporarily disabled because it destroys text rendering of overlays and in gui internal in some places */
@@ -470,7 +470,7 @@ draw_image_warp(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct po
{
int w,h;
static struct graphics_priv *imlib_gr;
- dbg(1,"draw_image_warp data=%p\n", img);
+ dbg(lvl_warning,"draw_image_warp data=%p\n", img);
if (imlib_gr != gr) {
imlib_context_set_display(gdk_x11_drawable_get_xdisplay(gr->widget->window));
imlib_context_set_colormap(gdk_x11_colormap_get_xcolormap(gtk_widget_get_colormap(gr->widget)));
@@ -490,7 +490,7 @@ draw_image_warp(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct po
img->image=imlib_create_image(w, h);
imlib_context_set_image(img->image);
if (gdk_pixbuf_get_colorspace(img->pixbuf) != GDK_COLORSPACE_RGB || gdk_pixbuf_get_bits_per_sample(img->pixbuf) != 8) {
- dbg(0,"implement me\n");
+ dbg(lvl_error,"implement me\n");
} else if (gdk_pixbuf_get_has_alpha(img->pixbuf) && gdk_pixbuf_get_n_channels(img->pixbuf) == 4) {
for (y=0 ; y < h ; y++) {
unsigned int *dst=imlib_image_get_data()+y*w;
@@ -510,7 +510,7 @@ draw_image_warp(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct po
}
}
} else {
- dbg(0,"implement me\n");
+ dbg(lvl_error,"implement me\n");
}
} else
@@ -577,9 +577,9 @@ overlay_draw(struct graphics_priv *parent, struct graphics_priv *overlay, GdkRec
if (parent->overlay_disabled || overlay->overlay_disabled || overlay->overlay_autodisabled)
return;
- dbg(1,"r->x=%d r->y=%d r->width=%d r->height=%d\n", re->x, re->y, re->width, re->height);
+ dbg(lvl_warning,"r->x=%d r->y=%d r->width=%d r->height=%d\n", re->x, re->y, re->width, re->height);
overlay_rect(parent, overlay, 0, &or);
- dbg(1,"or.x=%d or.y=%d or.width=%d or.height=%d\n", or.x, or.y, or.width, or.height);
+ dbg(lvl_warning,"or.x=%d or.y=%d or.width=%d or.height=%d\n", or.x, or.y, or.width, or.height);
if (! gdk_rectangle_intersect(re, &or, &ir))
return;
or.x-=re->x;
@@ -719,7 +719,7 @@ configure(GtkWidget * widget, GdkEventConfigure * event, gpointer user_data)
gra->background_ready = 0;
}
#ifndef _WIN32
- dbg(1,"window=%lu\n", GDK_WINDOW_XID(widget->window));
+ dbg(lvl_warning,"window=%lu\n", GDK_WINDOW_XID(widget->window));
#endif
gra->width=widget->allocation.width;
gra->height=widget->allocation.height;
@@ -871,7 +871,7 @@ static gint
delete(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
struct graphics_priv *this=user_data;
- dbg(3,"enter this->win=%p\n",this->win);
+ dbg(lvl_debug,"enter this->win=%p\n",this->win);
if (this->delay & 2) {
if (this->win)
this->win=NULL;
@@ -947,7 +947,7 @@ keypress(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
if (key[0])
callback_list_call_attr_1(this->cbl, attr_keypress, (void *)key);
else
- dbg(3,"keyval 0x%x\n", event->keyval);
+ dbg(lvl_debug,"keyval 0x%x\n", event->keyval);
return FALSE;
}
@@ -1032,7 +1032,7 @@ get_data_window(struct graphics_priv *this, unsigned int xid)
if (!gtk_widget_get_parent(this->widget))
gtk_widget_ref(this->widget);
gtk_window_set_default_size(GTK_WINDOW(this->win), this->win_w, this->win_h);
- dbg(1,"h= %i, w= %i\n",this->win_h, this->win_w);
+ dbg(lvl_warning,"h= %i, w= %i\n",this->win_h, this->win_w);
gtk_window_set_title(GTK_WINDOW(this->win), this->window_title);
gtk_window_set_wmclass (GTK_WINDOW (this->win), "navit", this->window_title);
gtk_widget_realize(this->win);
@@ -1051,7 +1051,7 @@ get_data_window(struct graphics_priv *this, unsigned int xid)
static int
set_attr(struct graphics_priv *gr, struct attr *attr)
{
- dbg(3,"enter\n");
+ dbg(lvl_debug,"enter\n");
switch (attr->type) {
case attr_windowid:
get_data_window(gr, attr->u.num);
@@ -1127,7 +1127,7 @@ graphics_gtk_drawing_area_disable_suspend(struct window *w)
if (gr->pid)
kill(gr->pid, SIGWINCH);
#else
- dbg(1, "failed to kill() under Windows\n");
+ dbg(lvl_warning, "failed to kill() under Windows\n");
#endif
}
@@ -1156,7 +1156,7 @@ get_data(struct graphics_priv *this, char const *type)
f=popen("pidof /usr/bin/ipaq-sleep","r");
if (f) {
fscanf(f,"%d",&this->pid);
- dbg(1,"ipaq_sleep pid=%d\n", this->pid);
+ dbg(lvl_warning,"ipaq_sleep pid=%d\n", this->pid);
pclose(f);
}
#endif
diff --git a/navit/graphics/null/graphics_null.c b/navit/graphics/null/graphics_null.c
index 30d887415..183712b84 100644
--- a/navit/graphics/null/graphics_null.c
+++ b/navit/graphics/null/graphics_null.c
@@ -261,7 +261,7 @@ graphics_null_new(struct navit *nav, struct graphics_methods *meth, struct attr
event_loop_system = attr_search(attrs, NULL, attr_event_loop_system);
if (event_loop_system && event_loop_system->u.str) {
- dbg(1, "event_system is %s\n", event_loop_system->u.str);
+ dbg(lvl_warning, "event_system is %s\n", event_loop_system->u.str);
if (!event_request_system(event_loop_system->u.str, "graphics_null"))
return NULL;
} else {
@@ -277,7 +277,7 @@ static void
event_null_main_loop_run(void)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
for (;;)
sleep(1);
@@ -285,54 +285,54 @@ event_null_main_loop_run(void)
static void event_null_main_loop_quit(void)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
}
static struct event_watch *
event_null_add_watch(int h, enum event_watch_cond cond, struct callback *cb)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
return NULL;
}
static void
event_null_remove_watch(struct event_watch *ev)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
}
static struct event_timeout *
event_null_add_timeout(int timeout, int multi, struct callback *cb)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
return NULL;
}
static void
event_null_remove_timeout(struct event_timeout *to)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
}
static struct event_idle *
event_null_add_idle(int priority, struct callback *cb)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
return NULL;
}
static void
event_null_remove_idle(struct event_idle *ev)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
}
static void
event_null_call_callback(struct callback_list *cb)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
}
static struct event_methods event_null_methods = {
diff --git a/navit/graphics/opengl/graphics_opengl.c b/navit/graphics/opengl/graphics_opengl.c
index 68fa4a580..e5cf37862 100644
--- a/navit/graphics/opengl/graphics_opengl.c
+++ b/navit/graphics/opengl/graphics_opengl.c
@@ -527,7 +527,7 @@ image_new(struct graphics_priv *gr, struct graphics_image_methods *meth,
return gi;
}
#else
- dbg(0,"FreeImage not available - cannot load any images.\n", path);
+ dbg(lvl_error,"FreeImage not available - cannot load any images.\n", path);
return NULL;
#endif
}
@@ -748,7 +748,7 @@ getPrimitiveType(GLenum type)
void APIENTRY
tessBeginCB(GLenum which)
{
- dbg(1, "glBegin( %s );\n", getPrimitiveType(which));
+ dbg(lvl_warning, "glBegin( %s );\n", getPrimitiveType(which));
tess_type=which;
tess_count=0;
}
@@ -758,7 +758,7 @@ tessBeginCB(GLenum which)
void APIENTRY
tessEndCB(void)
{
- dbg(1, "glEnd();\n");
+ dbg(lvl_warning, "glEnd();\n");
draw_array(graphics_priv_root, tess_array, tess_count, tess_type);
}
@@ -769,14 +769,14 @@ tessVertexCB(const GLvoid * data)
{
// cast back to double type
const GLdouble *ptr = (const GLdouble *) data;
- dbg(1, " glVertex3d();\n");
+ dbg(lvl_warning, " glVertex3d();\n");
tess_array[tess_count].x=ptr[0];
tess_array[tess_count].y=ptr[1];
if (tess_count < 511)
tess_count++;
else
- dbg(0,"overflow\n");
+ dbg(lvl_error,"overflow\n");
}
void APIENTRY
@@ -1032,7 +1032,7 @@ draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg,
int color = 1;
if (!font) {
- dbg(0, "no font, returning\n");
+ dbg(lvl_error, "no font, returning\n");
return;
}
@@ -1499,7 +1499,7 @@ static void
click_notify_do(struct graphics_priv *priv, int button, int state, int x, int y)
{
struct point p={x,y};
- dbg(0,"enter state %d button %d\n",state,button);
+ dbg(lvl_error,"enter state %d button %d\n",state,button);
callback_list_call_attr_3(priv->cbl, attr_button, (void *) state, (void *)button, (void *) &p);
}
#endif
@@ -1743,61 +1743,61 @@ graphics_opengl_new(struct navit *nav, struct graphics_methods *meth,
static void
event_opengl_main_loop_run(void)
{
- dbg(2, "enter\n");
+ dbg(lvl_info, "enter\n");
}
static void
event_opengl_main_loop_quit(void)
{
- dbg(0, "enter\n");
+ dbg(lvl_error, "enter\n");
}
static struct event_watch *
event_opengl_add_watch(int fd, enum event_watch_cond cond,
struct callback *cb)
{
- dbg(0, "enter\n");
+ dbg(lvl_error, "enter\n");
return NULL;
}
static void
event_opengl_remove_watch(struct event_watch *ev)
{
- dbg(0, "enter\n");
+ dbg(lvl_error, "enter\n");
}
static struct event_timeout *
event_opengl_add_timeout(int timeout, int multi, struct callback *cb)
{
- dbg(0, "enter\n");
+ dbg(lvl_error, "enter\n");
return NULL;
}
static void
event_opengl_remove_timeout(struct event_timeout *to)
{
- dbg(0, "enter\n");
+ dbg(lvl_error, "enter\n");
}
static struct event_idle *
event_opengl_add_idle(int priority, struct callback *cb)
{
- dbg(0, "enter\n");
+ dbg(lvl_error, "enter\n");
return NULL;
}
static void
event_opengl_remove_idle(struct event_idle *ev)
{
- dbg(0, "enter\n");
+ dbg(lvl_error, "enter\n");
}
static void
event_opengl_call_callback(struct callback_list *cb)
{
- dbg(0, "enter\n");
+ dbg(lvl_error, "enter\n");
}
static struct event_methods event_opengl_methods = {
diff --git a/navit/graphics/opengl/graphics_opengl_egl.c b/navit/graphics/opengl/graphics_opengl_egl.c
index 91cef83be..28e370615 100644
--- a/navit/graphics/opengl/graphics_opengl_egl.c
+++ b/navit/graphics/opengl/graphics_opengl_egl.c
@@ -61,31 +61,31 @@ graphics_opengl_egl_new(void *display, void *window, struct graphics_opengl_plat
*methods=&graphics_opengl_egl_methods;
ret->egldisplay = eglGetDisplay((EGLNativeDisplayType)display);
if (!ret->egldisplay) {
- dbg(0, "can't get display\n");
+ dbg(lvl_error, "can't get display\n");
goto error;
}
if (!eglInitialize(ret->egldisplay, &major, &minor)) {
- dbg(0, "eglInitialize failed\n");
+ dbg(lvl_error, "eglInitialize failed\n");
goto error;
}
- dbg(0,"eglInitialize ok with version %d.%d\n",major,minor);
+ dbg(lvl_error,"eglInitialize ok with version %d.%d\n",major,minor);
eglBindAPI(EGL_OPENGL_ES_API);
if (!eglChooseConfig(ret->egldisplay, attributeList, ret->config, sizeof(ret->config)/sizeof(EGLConfig), &nconfig)) {
- dbg(0, "eglChooseConfig failed\n");
+ dbg(lvl_error, "eglChooseConfig failed\n");
goto error;
}
if (nconfig != 1) {
- dbg(0, "unexpected number of configs %d\n",nconfig);
+ dbg(lvl_error, "unexpected number of configs %d\n",nconfig);
goto error;
}
ret->eglwindow = eglCreateWindowSurface(ret->egldisplay, ret->config[0], (NativeWindowType) window, NULL);
if (ret->eglwindow == EGL_NO_SURFACE) {
- dbg(0, "eglCreateWindowSurface failed");
+ dbg(lvl_error, "eglCreateWindowSurface failed");
goto error;
}
ret->context = eglCreateContext(ret->egldisplay, ret->config[0], EGL_NO_CONTEXT, aEGLContextAttributes);
if (ret->context == EGL_NO_CONTEXT) {
- dbg(0, "eglCreateContext failed");
+ dbg(lvl_error, "eglCreateContext failed");
goto error;
}
eglMakeCurrent(ret->egldisplay, ret->eglwindow, ret->eglwindow, ret->context);
diff --git a/navit/graphics/opengl/graphics_opengl_x11.c b/navit/graphics/opengl/graphics_opengl_x11.c
index 1495d542a..cca4bf4c9 100644
--- a/navit/graphics/opengl/graphics_opengl_x11.c
+++ b/navit/graphics/opengl/graphics_opengl_x11.c
@@ -86,29 +86,29 @@ graphics_opengl_x11_watch(struct graphics_opengl_window_system *x11)
x11->button(x11->data,event.xbutton.button,0,event.xbutton.x,event.xbutton.y);
break;
case ConfigureNotify:
- dbg(0,"ConfigureNotify\n");
+ dbg(lvl_error,"ConfigureNotify\n");
break;
case Expose:
- dbg(0,"Expose\n");
+ dbg(lvl_error,"Expose\n");
break;
case KeyPress:
- dbg(0,"KeyPress\n");
+ dbg(lvl_error,"KeyPress\n");
break;
case KeyRelease:
- dbg(0,"KeyRelease\n");
+ dbg(lvl_error,"KeyRelease\n");
break;
case MapNotify:
- dbg(0,"MapNotify\n");
+ dbg(lvl_error,"MapNotify\n");
break;
case MotionNotify:
if (x11->motion)
x11->motion(x11->data,event.xmotion.x,event.xmotion.y);
break;
case ReparentNotify:
- dbg(0,"ReparentNotify\n");
+ dbg(lvl_error,"ReparentNotify\n");
break;
default:
- dbg(0,"type %d\n",event.type);
+ dbg(lvl_error,"type %d\n",event.type);
}
}
}
@@ -126,14 +126,14 @@ graphics_opengl_x11_new(void *displayname, int w, int h, int depth, struct graph
*methods=&graphics_opengl_x11_methods;
ret->display=XOpenDisplay(displayname);
if (!ret->display) {
- dbg(0,"failed to open display\n");
+ dbg(lvl_error,"failed to open display\n");
goto error;
}
ret->watch=event_add_watch(ConnectionNumber(ret->display), event_watch_cond_read, ret->cb);
ret->screen=XDefaultScreen(ret->display);
ret->root_window=RootWindow(ret->display, ret->screen);
if (!XMatchVisualInfo(ret->display, ret->screen, depth, TrueColor, &ret->visual)) {
- dbg(0,"failed to find visual\n");
+ dbg(lvl_error,"failed to find visual\n");
goto error;
}
ret->colormap=XCreateColormap(ret->display, ret->root_window, ret->visual.visual, AllocNone);
diff --git a/navit/graphics/qt_qpainter/RenderArea.cpp b/navit/graphics/qt_qpainter/RenderArea.cpp
index 8ea80d4a0..d394b6e5e 100644
--- a/navit/graphics/qt_qpainter/RenderArea.cpp
+++ b/navit/graphics/qt_qpainter/RenderArea.cpp
@@ -98,7 +98,7 @@ bool RenderArea::event(QEvent *event)
{
#if QT_VERSION >= 0x040700
if (event->type() == QEvent::Gesture) {
- dbg(0,"gesture\n");
+ dbg(lvl_error,"gesture\n");
return true;
}
#endif
@@ -135,8 +135,8 @@ void RenderArea::do_resize(QSize size)
QPainter painter(pixmap);
QBrush brush;
painter.fillRect(0, 0, size.width(), size.height(), brush);
- dbg(0,"size %dx%d\n", size.width(), size.height());
- dbg(0,"pixmap %p %dx%d\n", pixmap, pixmap->width(), pixmap->height());
+ dbg(lvl_error,"size %dx%d\n", size.width(), size.height());
+ dbg(lvl_error,"pixmap %p %dx%d\n", pixmap, pixmap->width(), pixmap->height());
callback_list_call_attr_2(this->cbl, attr_resize, GINT_TO_POINTER(size.width()), GINT_TO_POINTER(size.height()));
}
@@ -240,9 +240,9 @@ void RenderArea::keyPressEvent(QKeyEvent *event)
#else
const char *text=str.toUtf8().constData();
#endif
- dbg(0,"enter text='%s' 0x%x (%zu) key=%d\n", text, text[0], strlen(text), event->key());
+ dbg(lvl_error,"enter text='%s' 0x%x (%zu) key=%d\n", text, text[0], strlen(text), event->key());
if (!text || !text[0] || text[0] == 0x7f) {
- dbg(0,"special key\n");
+ dbg(lvl_error,"special key\n");
switch (event->key()) {
case 4099:
{
@@ -305,7 +305,7 @@ void RenderArea::watchEvent(int fd)
{
#ifdef QT_QPAINTER_USE_EVENT_QT
struct event_watch *ev=(struct event_watch *)g_hash_table_lookup(watches, (void *)fd);
- dbg(1,"fd=%d ev=%p cb=%p\n", fd, ev, ev->cb);
+ dbg(lvl_warning,"fd=%d ev=%p cb=%p\n", fd, ev, ev->cb);
callback_call_0(ev->cb);
#endif
}
diff --git a/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp b/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp
index d5e30fac1..f4d8c18da 100644
--- a/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp
+++ b/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp
@@ -65,7 +65,7 @@ qt_qpainter_draw(struct graphics_priv *gr, const QRect *r, int paintev)
{
if (!paintev) {
#ifndef QT_QPAINTER_NO_WIDGET
- dbg(1,"update %d,%d %d x %d\n", r->x(), r->y(), r->width(), r->height());
+ dbg(lvl_warning,"update %d,%d %d x %d\n", r->x(), r->y(), r->width(), r->height());
if (r->x() <= -r->width())
return;
if (r->y() <= -r->height())
@@ -74,7 +74,7 @@ qt_qpainter_draw(struct graphics_priv *gr, const QRect *r, int paintev)
return;
if (r->y() > gr->widget->pixmap->height())
return;
- dbg(1,"update valid %d,%d %dx%d\n", r->x(), r->y(), r->width(), r->height());
+ dbg(lvl_warning,"update valid %d,%d %dx%d\n", r->x(), r->y(), r->width(), r->height());
gr->widget->update(*r);
#endif
return;
@@ -380,7 +380,7 @@ static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc,
//##############################################################################################################
static void draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
{
- dbg(1,"gr=%p gc=%p %d,%d,%d,%d\n", gr, gc, p->x, p->y, w, h);
+ dbg(lvl_warning,"gr=%p gc=%p %d,%d,%d,%d\n", gr, gc, p->x, p->y, w, h);
gr->painter->fillRect(p->x,p->y, w, h, *gc->brush);
}
@@ -547,7 +547,7 @@ static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
//##############################################################################################################
static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
{
- dbg(1,"mode for %p %d\n", gr, mode);
+ dbg(lvl_warning,"mode for %p %d\n", gr, mode);
QRect r;
if (mode == draw_mode_begin) {
#if QT_VERSION >= 0x040000
@@ -652,7 +652,7 @@ static void * get_data(struct graphics_priv *this_, const char *type)
bool ok;
if (!strcmp(type, "resize")) {
- dbg(0,"resize %d %d\n",this_->w,this_->h);
+ dbg(lvl_error,"resize %d %d\n",this_->w,this_->h);
QSize size(this_->w,this_->h);
this_->widget->do_resize(size);
}
@@ -821,14 +821,14 @@ event_qt_main_loop_run(void)
static void event_qt_main_loop_quit(void)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
exit(0);
}
static struct event_watch *
event_qt_add_watch(int fd, enum event_watch_cond cond, struct callback *cb)
{
- dbg(1,"enter fd=%d\n",(int)(long)fd);
+ dbg(lvl_warning,"enter fd=%d\n",(int)(long)fd);
struct event_watch *ret=g_new0(struct event_watch, 1);
ret->fd=fd;
ret->cb=cb;
@@ -868,21 +868,21 @@ event_qt_remove_timeout(struct event_timeout *ev)
static struct event_idle *
event_qt_add_idle(int priority, struct callback *cb)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
return (struct event_idle *)event_qt_add_timeout(0, 1, cb);
}
static void
event_qt_remove_idle(struct event_idle *ev)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
event_qt_remove_timeout((struct event_timeout *) ev);
}
static void
event_qt_call_callback(struct callback_list *cb)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
}
static struct event_methods event_qt_methods = {
@@ -903,7 +903,7 @@ struct event_priv {
struct event_priv *
event_qt_new(struct event_methods *meth)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
*meth=event_qt_methods;
return NULL;
}
@@ -920,7 +920,7 @@ static struct graphics_priv * graphics_qt_qpainter_new(struct navit *nav, struct
struct font_priv * (*font_freetype_new)(void *meth);
struct attr *attr;
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
#ifdef QT_QPAINTER_USE_EVENT_QT
if (event_gr)
return NULL;
@@ -934,7 +934,7 @@ static struct graphics_priv * graphics_qt_qpainter_new(struct navit *nav, struct
#ifdef QT_QPAINTER_USE_FREETYPE
font_freetype_new=(struct font_priv *(*)(void *))plugin_get_font_type("freetype");
if (!font_freetype_new) {
- dbg(0,"no freetype\n");
+ dbg(lvl_error,"no freetype\n");
return NULL;
}
#endif
@@ -987,7 +987,7 @@ static struct graphics_priv * graphics_qt_qpainter_new(struct navit *nav, struct
else
ret->window_title=g_strdup("Navit");
- dbg(0,"return\n");
+ dbg(lvl_error,"return\n");
return ret;
}
diff --git a/navit/graphics/sdl/event.c b/navit/graphics/sdl/event.c
index 235ed829b..b4b58911e 100644
--- a/navit/graphics/sdl/event.c
+++ b/navit/graphics/sdl/event.c
@@ -48,7 +48,7 @@ static void sdl_accelerometer_handler(void* param) {
int zAxis = SDL_JoystickGetAxis(accelerometer, 2);
unsigned char new_orientation;
- dbg(2, "x(%d) y(%d) z(%d) c(%d)\n", xAxis, yAxis, zAxis,
+ dbg(lvl_info, "x(%d) y(%d) z(%d) c(%d)\n", xAxis, yAxis, zAxis,
sdl_orientation_count);
if (zAxis > -30000) {
@@ -74,7 +74,7 @@ static void sdl_accelerometer_handler(void* param) {
sdl_orientation_count++;
if (new_orientation != orientation) {
- dbg(1, "x(%d) y(%d) z(%d) o(%d)\n", xAxis, yAxis, zAxis,
+ dbg(lvl_warning, "x(%d) y(%d) z(%d) o(%d)\n", xAxis, yAxis, zAxis,
new_orientation);
orientation = new_orientation;
@@ -100,7 +100,7 @@ static void sdl_accelerometer_handler(void* param) {
static Uint32 sdl_timer_callback(Uint32 interval, void* param) {
struct event_timeout *timeout = (struct event_timeout*) param;
- dbg(1, "timer(%p) multi(%d) interval(%d) fired\n", param, timeout->multi,
+ dbg(lvl_warning, "timer(%p) multi(%d) interval(%d) fired\n", param, timeout->multi,
interval);
SDL_Event event;
@@ -169,7 +169,7 @@ static void event_sdl_watch_thread(GPtrArray *watch_list) {
for (idx = 0; idx < watch_list->len; idx++) {
if (pfds[idx].revents == pfds[idx].events) { /* The requested event happened, notify mainloop! */
ew = g_ptr_array_index(watch_list, idx);
- dbg(1, "watch(%p) event(%d) encountered\n", ew,
+ dbg(lvl_warning, "watch(%p) event(%d) encountered\n", ew,
pfds[idx].revents);
SDL_Event event;
@@ -194,7 +194,7 @@ static void event_sdl_watch_thread(GPtrArray *watch_list) {
}
static void event_sdl_watch_startthread(GPtrArray *watch_list) {
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
if (sdl_watch_thread)
event_sdl_watch_stopthread();
@@ -206,7 +206,7 @@ static void event_sdl_watch_startthread(GPtrArray *watch_list) {
}
static void event_sdl_watch_stopthread() {
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
if (sdl_watch_thread) {
/* Notify the watch thread that the list of FDs will change */
pthread_kill(sdl_watch_thread, SIGUSR1);
@@ -217,7 +217,7 @@ static void event_sdl_watch_stopthread() {
static struct event_watch *
event_sdl_add_watch(int fd, enum event_watch_cond cond, struct callback *cb) {
- dbg(1, "fd(%d) cond(%x) cb(%x)\n", fd, cond, cb);
+ dbg(lvl_warning, "fd(%d) cond(%x) cb(%x)\n", fd, cond, cb);
event_sdl_watch_stopthread();
@@ -253,7 +253,7 @@ event_sdl_add_watch(int fd, enum event_watch_cond cond, struct callback *cb) {
}
static void event_sdl_remove_watch(struct event_watch *ew) {
- dbg(1, "enter %p\n", ew);
+ dbg(lvl_warning, "enter %p\n", ew);
event_sdl_watch_stopthread();
@@ -272,7 +272,7 @@ event_sdl_add_timeout(int timeout, int multi, struct callback *cb) {
struct event_timeout * ret = g_new0(struct event_timeout, 1);
if (!ret)
return ret;
- dbg(1, "timer(%p) multi(%d) interval(%d) cb(%p) added\n", ret, multi,
+ dbg(lvl_warning, "timer(%p) multi(%d) interval(%d) cb(%p) added\n", ret, multi,
timeout, cb);
ret->multi = multi;
ret->cb = cb;
@@ -282,14 +282,14 @@ event_sdl_add_timeout(int timeout, int multi, struct callback *cb) {
}
static void event_sdl_remove_timeout(struct event_timeout *to) {
- dbg(2, "enter %p\n", to);
+ dbg(lvl_info, "enter %p\n", to);
if (to != NULL) {
int ret = to->id ? SDL_RemoveTimer(to->id) : SDL_TRUE;
if (ret == SDL_FALSE) {
- dbg(0, "SDL_RemoveTimer (%p) failed\n", to->id);
+ dbg(lvl_error, "SDL_RemoveTimer (%p) failed\n", to->id);
} else {
g_free(to);
- dbg(1, "timer(%p) removed\n", to);
+ dbg(lvl_warning, "timer(%p) removed\n", to);
}
}
}
@@ -309,7 +309,7 @@ static gint sdl_sort_idle_tasks(gconstpointer parama, gconstpointer paramb) {
static struct event_idle *
event_sdl_add_idle(int priority, struct callback *cb) {
- dbg(1, "add idle priority(%d) cb(%p)\n", priority, cb);
+ dbg(lvl_warning, "add idle priority(%d) cb(%p)\n", priority, cb);
struct idle_task *task = g_new0(struct idle_task, 1);
task->priority = priority;
@@ -321,7 +321,7 @@ event_sdl_add_idle(int priority, struct callback *cb) {
SDL_Event event;
SDL_UserEvent userevent;
- dbg(1, "poking eventloop because of new idle_events\n");
+ dbg(lvl_warning, "poking eventloop because of new idle_events\n");
userevent.type = SDL_USEREVENT;
userevent.code = SDL_USEREVENT_CODE_IDLE_EVENT;
@@ -340,14 +340,14 @@ event_sdl_add_idle(int priority, struct callback *cb) {
}
static void event_sdl_remove_idle(struct event_idle *task) {
- dbg(1, "remove task(%p)\n", task);
+ dbg(lvl_warning, "remove task(%p)\n", task);
g_ptr_array_remove(idle_tasks, (gpointer) task);
}
/* callback */
static void event_sdl_call_callback(struct callback_list *cbl) {
- dbg(1, "call_callback cbl(%p)\n", cbl);
+ dbg(lvl_warning, "call_callback cbl(%p)\n", cbl);
SDL_Event event;
SDL_UserEvent userevent;
diff --git a/navit/graphics/sdl/event_sdl.c b/navit/graphics/sdl/event_sdl.c
index 6e1daef52..068c95758 100644
--- a/navit/graphics/sdl/event_sdl.c
+++ b/navit/graphics/sdl/event_sdl.c
@@ -48,7 +48,7 @@ sdl_timer_callback(Uint32 interval, void* param)
{
struct event_timeout *timeout=(struct event_timeout*)param;
- dbg(1,"timer(%p) multi(%d) interval(%d) fired\n", param, timeout->multi, interval);
+ dbg(lvl_warning,"timer(%p) multi(%d) interval(%d) fired\n", param, timeout->multi, interval);
SDL_Event event;
SDL_UserEvent userevent;
@@ -104,7 +104,7 @@ event_sdl_watch_thread (GPtrArray *watch_list)
for (idx = 0; idx < watch_list->len; idx++ ) {
if (pfds[idx].revents == pfds[idx].events) { /* The requested event happened, notify mainloop! */
ew = g_ptr_array_index (watch_list, idx);
- dbg(1,"watch(%p) event(%d) encountered\n", ew, pfds[idx].revents);
+ dbg(lvl_warning,"watch(%p) event(%d) encountered\n", ew, pfds[idx].revents);
SDL_Event event;
SDL_UserEvent userevent;
@@ -130,7 +130,7 @@ event_sdl_watch_thread (GPtrArray *watch_list)
static void
event_sdl_watch_startthread(GPtrArray *watch_list)
{
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
if (sdl_watch_thread)
event_sdl_watch_stopthread();
@@ -143,7 +143,7 @@ event_sdl_watch_startthread(GPtrArray *watch_list)
static void
event_sdl_watch_stopthread()
{
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
if (sdl_watch_thread) {
/* Notify the watch thread that the list of FDs will change */
pthread_kill(sdl_watch_thread, SIGUSR1);
@@ -155,7 +155,7 @@ event_sdl_watch_stopthread()
static struct event_watch *
event_sdl_add_watch(int fd, enum event_watch_cond cond, struct callback *cb)
{
- dbg(1,"fd(%d) cond(%x) cb(%x)\n", fd, cond, cb);
+ dbg(lvl_warning,"fd(%d) cond(%x) cb(%x)\n", fd, cond, cb);
event_sdl_watch_stopthread();
@@ -193,7 +193,7 @@ event_sdl_add_watch(int fd, enum event_watch_cond cond, struct callback *cb)
static void
event_sdl_remove_watch(struct event_watch *ew)
{
- dbg(1,"enter %p\n",ew);
+ dbg(lvl_warning,"enter %p\n",ew);
event_sdl_watch_stopthread();
@@ -212,10 +212,10 @@ event_sdl_add_timeout(int timeout, int multi, struct callback *cb)
{
struct event_timeout * ret = g_new0(struct event_timeout, 1);
if(!ret) {
- dbg (0,"g_new0 failed\n");
+ dbg(lvl_error,"g_new0 failed\n");
return ret;
}
- dbg(1,"timer(%p) multi(%d) interval(%d) cb(%p) added\n",ret, multi, timeout, cb);
+ dbg(lvl_warning,"timer(%p) multi(%d) interval(%d) cb(%p) added\n",ret, multi, timeout, cb);
ret->multi = multi;
ret->cb = cb;
ret->id = SDL_AddTimer(timeout, sdl_timer_callback, ret);
@@ -226,17 +226,17 @@ event_sdl_add_timeout(int timeout, int multi, struct callback *cb)
static void
event_sdl_remove_timeout(struct event_timeout *to)
{
- dbg(2,"enter %p\n", to);
+ dbg(lvl_info,"enter %p\n", to);
if(to)
{
/* do not SDL_RemoveTimer if oneshot timer has already fired */
int ret = to->id == 0 ? SDL_TRUE : SDL_RemoveTimer(to->id);
if (ret == SDL_FALSE)
- dbg(0,"SDL_RemoveTimer (%p) failed\n", to->id);
+ dbg(lvl_error,"SDL_RemoveTimer (%p) failed\n", to->id);
g_free(to);
- dbg(1,"timer(%p) removed\n", to);
+ dbg(lvl_warning,"timer(%p) removed\n", to);
}
}
@@ -258,7 +258,7 @@ sdl_sort_idle_tasks(gconstpointer parama, gconstpointer paramb)
static struct event_idle *
event_sdl_add_idle(int priority, struct callback *cb)
{
- dbg(1,"add idle priority(%d) cb(%p)\n", priority, cb);
+ dbg(lvl_warning,"add idle priority(%d) cb(%p)\n", priority, cb);
struct idle_task *task = g_new0(struct idle_task, 1);
task->priority = priority;
@@ -271,7 +271,7 @@ event_sdl_add_idle(int priority, struct callback *cb)
SDL_Event event;
SDL_UserEvent userevent;
- dbg(1,"poking eventloop because of new idle_events\n");
+ dbg(lvl_warning,"poking eventloop because of new idle_events\n");
userevent.type = SDL_USEREVENT;
userevent.code = SDL_USEREVENT_CODE_IDLE_EVENT;
@@ -292,7 +292,7 @@ event_sdl_add_idle(int priority, struct callback *cb)
static void
event_sdl_remove_idle(struct event_idle *task)
{
- dbg(1,"remove task(%p)\n", task);
+ dbg(lvl_warning,"remove task(%p)\n", task);
g_ptr_array_remove(idle_tasks, (gpointer)task);
}
@@ -301,7 +301,7 @@ event_sdl_remove_idle(struct event_idle *task)
static void
event_sdl_call_callback(struct callback_list *cbl)
{
- dbg(1,"call_callback cbl(%p)\n",cbl);
+ dbg(lvl_warning,"call_callback cbl(%p)\n",cbl);
SDL_Event event;
SDL_UserEvent userevent;
diff --git a/navit/graphics/sdl/graphics_sdl.c b/navit/graphics/sdl/graphics_sdl.c
index 170f203a0..573dcdfdc 100644
--- a/navit/graphics/sdl/graphics_sdl.c
+++ b/navit/graphics/sdl/graphics_sdl.c
@@ -187,7 +187,7 @@ struct graphics_image_priv {
static void
graphics_destroy(struct graphics_priv *gr)
{
- dbg(0, "graphics_destroy %p %u\n", gr, gr->overlay_mode);
+ dbg(lvl_error, "graphics_destroy %p %u\n", gr, gr->overlay_mode);
if(gr->overlay_mode)
{
@@ -222,7 +222,7 @@ gc_destroy(struct graphics_gc_priv *gc)
static void
gc_set_linewidth(struct graphics_gc_priv *gc, int w)
{
- dbg(1, "gc_set_linewidth %p %d\n", gc, w);
+ dbg(lvl_warning, "gc_set_linewidth %p %d\n", gc, w);
gc->linewidth = w;
}
@@ -235,7 +235,7 @@ gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *das
static void
gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
{
- dbg(1, "gc_set_foreground: %p %d %d %d %d\n", gc, c->a, c->r, c->g, c->b);
+ dbg(lvl_warning, "gc_set_foreground: %p %d %d %d %d\n", gc, c->a, c->r, c->g, c->b);
gc->fore_r = c->r/256;
gc->fore_g = c->g/256;
gc->fore_b = c->b/256;
@@ -245,7 +245,7 @@ gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
static void
gc_set_background(struct graphics_gc_priv *gc, struct color *c)
{
- dbg(1, "gc_set_background: %p %d %d %d %d\n", gc, c->a, c->r, c->g, c->b);
+ dbg(lvl_warning, "gc_set_background: %p %d %d %d %d\n", gc, c->a, c->r, c->g, c->b);
gc->back_r = c->r/256;
gc->back_g = c->g/256;
gc->back_b = c->b/256;
@@ -294,7 +294,7 @@ image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *n
else
{
/* TODO: debug "colour parse errors" on xpm */
- dbg(0,"image_new on '%s' failed: %s\n", name, IMG_GetError());
+ dbg(lvl_error,"image_new on '%s' failed: %s\n", name, IMG_GetError());
g_free(gi);
gi = NULL;
}
@@ -331,7 +331,7 @@ draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point
vx[i] = x;
vy[i] = y;
- dbg(1, "draw_polygon: %p %i %d,%d\n", gc, i, p[i].x, p[i].y);
+ dbg(lvl_warning, "draw_polygon: %p %i %d,%d\n", gc, i, p[i].x, p[i].y);
}
if(gr->aa)
@@ -362,7 +362,7 @@ draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct poi
return;
}
- dbg(1, "draw_rectangle: %d %d %d %d r=%d g=%d b=%d a=%d\n", p->x, p->y, w, h,
+ dbg(lvl_warning, "draw_rectangle: %d %d %d %d r=%d g=%d b=%d a=%d\n", p->x, p->y, w, h,
gc->fore_r, gc->fore_g, gc->fore_b, gc->fore_a);
if(w > gr->screen->w)
{
@@ -495,10 +495,10 @@ draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *
y_lw_adj = round(cos(angle)*(float)lw/2.0);
if((x_lw_adj < 0) || (y_lw_adj < 0))
{
- dbg(1, "i=%d\n", i);
- dbg(1, " %d,%d->%d,%d\n", p[i].x, p[i].y, p[i+1].x, p[i+1].y);
- dbg(1, " lw=%d angle=%f\n", lw, 180.0 * angle / M_PI);
- dbg(1, " x_lw_adj=%d y_lw_adj=%d\n", x_lw_adj, y_lw_adj);
+ dbg(lvl_warning, "i=%d\n", i);
+ dbg(lvl_warning, " %d,%d->%d,%d\n", p[i].x, p[i].y, p[i+1].x, p[i+1].y);
+ dbg(lvl_warning, " lw=%d angle=%f\n", lw, 180.0 * angle / M_PI);
+ dbg(lvl_warning, " x_lw_adj=%d y_lw_adj=%d\n", x_lw_adj, y_lw_adj);
}
}
@@ -588,7 +588,7 @@ resize_ft_buffer (unsigned int new_size)
if (new_size > ft_buffer_size) {
g_free (ft_buffer);
ft_buffer = g_malloc (new_size);
- dbg(1, "old_size(%u) new_size(%u) ft_buffer(%p)\n", ft_buffer_size, new_size, ft_buffer);
+ dbg(lvl_warning, "old_size(%u) new_size(%u) ft_buffer(%p)\n", ft_buffer_size, new_size, ft_buffer);
ft_buffer_size = new_size;
}
}
@@ -746,7 +746,7 @@ draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg,
int color = 1;
if (!font) {
- dbg(0, "no font, returning\n");
+ dbg(lvl_error, "no font, returning\n");
return;
}
t = gr->freetype_methods.text_new(text,
@@ -782,13 +782,13 @@ draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *
static void
draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
{
- dbg(1, "draw_restore\n");
+ dbg(lvl_warning, "draw_restore\n");
}
static void
background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
{
- dbg(1, "background_gc\n");
+ dbg(lvl_warning, "background_gc\n");
}
@@ -805,7 +805,7 @@ draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
}
else
{
- dbg(1, "draw_mode: %d\n", mode);
+ dbg(lvl_warning, "draw_mode: %d\n", mode);
if(mode == draw_mode_end)
{
@@ -934,11 +934,11 @@ overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct poin
}
if(i == OVERLAY_MAX)
{
- dbg(0, "too many overlays! increase OVERLAY_MAX\n");
+ dbg(lvl_error, "too many overlays! increase OVERLAY_MAX\n");
return NULL;
}
- dbg(1, "overlay_new %d %d %d %u %u (%x, %x, %x ,%x, %d)\n", i,
+ dbg(lvl_warning, "overlay_new %d %d %d %u %u (%x, %x, %x ,%x, %d)\n", i,
p->x,
p->y,
w,
@@ -1032,7 +1032,7 @@ static gboolean graphics_sdl_idle(void *data)
gr = the_graphics;
}
else {
- dbg(0,"graphics_idle: graphics not set!\n");
+ dbg(lvl_error,"graphics_idle: graphics not set!\n");
return FALSE;
}
}
@@ -1077,7 +1077,7 @@ static gboolean graphics_sdl_idle(void *data)
if (idle_tasks_idx >= idle_tasks->len)
idle_tasks_idx = 0;
- dbg(3,"idle_tasks_idx(%d)\n",idle_tasks_idx);
+ dbg(lvl_debug,"idle_tasks_idx(%d)\n",idle_tasks_idx);
task = (struct idle_task *)g_ptr_array_index(idle_tasks,idle_tasks_idx);
if (idle_tasks_idx == 0) // only execute tasks with lowest priority value
@@ -1102,7 +1102,7 @@ static gboolean graphics_sdl_idle(void *data)
}
#ifdef USE_WEBOS
- dbg(5,"SDL_Event %d\n", ev.type);
+ dbg(lvl_debug,"SDL_Event %d\n", ev.type);
#endif
switch(ev.type)
{
@@ -1227,7 +1227,7 @@ static gboolean graphics_sdl_idle(void *data)
key_mod &= ~(WEBOS_KEY_MOD_ORANGE_STICKY);
}
else {
- dbg(0,"Unknown key sym: %x\n", ev.key.keysym.sym);
+ dbg(lvl_error,"Unknown key sym: %x\n", ev.key.keysym.sym);
}
#else
/* return unicode chars when they can be converted to ascii */
@@ -1237,7 +1237,7 @@ static gboolean graphics_sdl_idle(void *data)
}
}
- dbg(2,"key mod: 0x%x\n", key_mod);
+ dbg(lvl_info,"key mod: 0x%x\n", key_mod);
if (keybuf[0]) {
callback_list_call_attr_1(gr->cbl, attr_keypress, (void *)keybuf);
@@ -1252,7 +1252,7 @@ static gboolean graphics_sdl_idle(void *data)
case SDL_MOUSEBUTTONDOWN:
{
- dbg(1, "SDL_MOUSEBUTTONDOWN %d %d %d %d %d\n",
+ dbg(lvl_warning, "SDL_MOUSEBUTTONDOWN %d %d %d %d %d\n",
ev.button.which,
ev.button.button,
ev.button.state,
@@ -1267,7 +1267,7 @@ static gboolean graphics_sdl_idle(void *data)
case SDL_MOUSEBUTTONUP:
{
- dbg(1, "SDL_MOUSEBUTTONUP %d %d %d %d %d\n",
+ dbg(lvl_warning, "SDL_MOUSEBUTTONUP %d %d %d %d %d\n",
ev.button.which,
ev.button.button,
ev.button.state,
@@ -1309,7 +1309,7 @@ static gboolean graphics_sdl_idle(void *data)
case SDL_USEREVENT:
{
SDL_UserEvent userevent = ev.user;
- dbg(9,"received SDL_USEREVENT type(%x) code(%x)\n",userevent.type,userevent.code);
+ dbg(lvl_info,"received SDL_USEREVENT type(%x) code(%x)\n",userevent.type,userevent.code);
if (userevent.type != SDL_USEREVENT)
break;
@@ -1329,28 +1329,28 @@ static gboolean graphics_sdl_idle(void *data)
else if(userevent.code == SDL_USEREVENT_CODE_TIMER)
{
struct callback *cb = (struct callback *)userevent.data1;
- dbg(1, "SDL_USEREVENT timer received cb(%p)\n", cb);
+ dbg(lvl_warning, "SDL_USEREVENT timer received cb(%p)\n", cb);
callback_call_0(cb);
}
else if(userevent.code == SDL_USEREVENT_CODE_WATCH)
{
struct callback *cb = (struct callback *)userevent.data1;
- dbg(1, "SDL_USEREVENT watch received cb(%p)\n", cb);
+ dbg(lvl_warning, "SDL_USEREVENT watch received cb(%p)\n", cb);
callback_call_0(cb);
}
else if(userevent.code == SDL_USEREVENT_CODE_CALL_CALLBACK)
{
struct callback_list *cbl = (struct callback_list *)userevent.data1;
- dbg(1, "SDL_USEREVENT call_callback received cbl(%p)\n", cbl);
+ dbg(lvl_warning, "SDL_USEREVENT call_callback received cbl(%p)\n", cbl);
callback_list_call_0(cbl);
}
else if(userevent.code == SDL_USEREVENT_CODE_IDLE_EVENT) {
- dbg(1, "SDL_USEREVENT idle_event received\n");
+ dbg(lvl_warning, "SDL_USEREVENT idle_event received\n");
}
#ifdef USE_WEBOS_ACCELEROMETER
else if(userevent.code == SDL_USEREVENT_CODE_ROTATE)
{
- dbg(1, "SDL_USEREVENT rotate received\n");
+ dbg(lvl_warning, "SDL_USEREVENT rotate received\n");
switch(gr->orientation)
{
case WEBOS_ORIENTATION_PORTRAIT:
@@ -1373,14 +1373,14 @@ static gboolean graphics_sdl_idle(void *data)
}
#endif
else
- dbg(1, "unknown SDL_USEREVENT\n");
+ dbg(lvl_warning, "unknown SDL_USEREVENT\n");
break;
}
#endif
default:
{
- dbg(1, "SDL_Event %d\n", ev.type);
+ dbg(lvl_warning, "SDL_Event %d\n", ev.type);
break;
}
}
@@ -1430,7 +1430,7 @@ graphics_sdl_new(struct navit *nav, struct graphics_methods *meth, struct attr *
int)) this->freetype_methods.font_new;
meth->get_text_bbox = (void*) this->freetype_methods.get_text_bbox;
- dbg(1,"Calling SDL_Init\n");
+ dbg(lvl_warning,"Calling SDL_Init\n");
#ifdef USE_WEBOS
# ifdef USE_WEBOS_ACCELEROMETER
ret = SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_JOYSTICK);
@@ -1442,18 +1442,18 @@ graphics_sdl_new(struct navit *nav, struct graphics_methods *meth, struct attr *
#endif
if(ret < 0)
{
- dbg(0,"SDL_Init failed %d\n", ret);
+ dbg(lvl_error,"SDL_Init failed %d\n", ret);
this->freetype_methods.destroy();
g_free(this);
return NULL;
}
#ifdef USE_WEBOS
- dbg(1,"Calling PDL_Init(0)\n");
+ dbg(lvl_warning,"Calling PDL_Init(0)\n");
ret = PDL_Init(0);
if(ret < 0)
{
- dbg(0,"PDL_Init failed %d\n", ret);
+ dbg(lvl_error,"PDL_Init failed %d\n", ret);
this->freetype_methods.destroy();
g_free(this);
return NULL;
@@ -1463,7 +1463,7 @@ graphics_sdl_new(struct navit *nav, struct graphics_methods *meth, struct attr *
#else
if (! event_request_system("glib","graphics_sdl_new")) {
#endif
- dbg(0,"event_request_system failed");
+ dbg(lvl_error,"event_request_system failed");
this->freetype_methods.destroy();
g_free(this);
return NULL;
@@ -1496,7 +1496,7 @@ graphics_sdl_new(struct navit *nav, struct graphics_methods *meth, struct attr *
if(this->screen == NULL)
{
- dbg(0,"SDL_SetVideoMode failed\n");
+ dbg(lvl_error,"SDL_SetVideoMode failed\n");
this->freetype_methods.destroy();
g_free(this);
#ifdef USE_WEBOS
@@ -1510,7 +1510,7 @@ graphics_sdl_new(struct navit *nav, struct graphics_methods *meth, struct attr *
w = this->screen->w;
h = this->screen->h;
- dbg(0, "using screen %ix%i@%i\n",
+ dbg(lvl_error, "using screen %ix%i@%i\n",
this->screen->w, this->screen->h,
this->screen->format->BytesPerPixel * 8);
#ifdef USE_WEBOS_ACCELEROMETER
@@ -1537,7 +1537,7 @@ graphics_sdl_new(struct navit *nav, struct graphics_methods *meth, struct attr *
#ifdef USE_WEBOS
if(the_graphics!=NULL) {
- dbg(0,"graphics_sdl_new: graphics struct already set: %d!\n", the_graphics_count);
+ dbg(lvl_error,"graphics_sdl_new: graphics struct already set: %d!\n", the_graphics_count);
}
the_graphics = this;
the_graphics_count++;
@@ -1563,7 +1563,7 @@ sdl_timer_callback(Uint32 interval, void* param)
{
struct event_timeout *timeout=(struct event_timeout*)param;
- dbg(1,"timer(%p) multi(%d) interval(%d) fired\n", param, timeout->multi, interval);
+ dbg(lvl_warning,"timer(%p) multi(%d) interval(%d) fired\n", param, timeout->multi, interval);
SDL_Event event;
SDL_UserEvent userevent;
@@ -1620,7 +1620,7 @@ event_sdl_watch_thread (GPtrArray *watch_list)
for (idx = 0; idx < watch_list->len; idx++ ) {
if (pfds[idx].revents == pfds[idx].events) { /* The requested event happened, notify mainloop! */
ew = g_ptr_array_index (watch_list, idx);
- dbg(1,"watch(%p) event(%d) encountered\n", ew, pfds[idx].revents);
+ dbg(lvl_warning,"watch(%p) event(%d) encountered\n", ew, pfds[idx].revents);
SDL_Event event;
SDL_UserEvent userevent;
@@ -1646,7 +1646,7 @@ event_sdl_watch_thread (GPtrArray *watch_list)
static void
event_sdl_watch_startthread(GPtrArray *watch_list)
{
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
if (sdl_watch_thread)
event_sdl_watch_stopthread();
@@ -1659,7 +1659,7 @@ event_sdl_watch_startthread(GPtrArray *watch_list)
static void
event_sdl_watch_stopthread()
{
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
if (sdl_watch_thread) {
/* Notify the watch thread that the list of FDs will change */
pthread_kill(sdl_watch_thread, SIGUSR1);
@@ -1671,7 +1671,7 @@ event_sdl_watch_stopthread()
static struct event_watch *
event_sdl_add_watch(int fd, enum event_watch_cond cond, struct callback *cb)
{
- dbg(1,"fd(%d) cond(%x) cb(%x)\n", fd, cond, cb);
+ dbg(lvl_warning,"fd(%d) cond(%x) cb(%x)\n", fd, cond, cb);
event_sdl_watch_stopthread();
@@ -1709,7 +1709,7 @@ event_sdl_add_watch(int fd, enum event_watch_cond cond, struct callback *cb)
static void
event_sdl_remove_watch(struct event_watch *ew)
{
- dbg(1,"enter %p\n",ew);
+ dbg(lvl_warning,"enter %p\n",ew);
event_sdl_watch_stopthread();
@@ -1728,10 +1728,10 @@ event_sdl_add_timeout(int timeout, int multi, struct callback *cb)
{
struct event_timeout * ret = g_new0(struct event_timeout, 1);
if(!ret) {
- dbg (0,"g_new0 failed\n");
+ dbg(lvl_error,"g_new0 failed\n");
return ret;
}
- dbg(1,"timer(%p) multi(%d) interval(%d) cb(%p) added\n",ret, multi, timeout, cb);
+ dbg(lvl_warning,"timer(%p) multi(%d) interval(%d) cb(%p) added\n",ret, multi, timeout, cb);
ret->multi = multi;
ret->cb = cb;
ret->id = SDL_AddTimer(timeout, sdl_timer_callback, ret);
@@ -1742,17 +1742,17 @@ event_sdl_add_timeout(int timeout, int multi, struct callback *cb)
static void
event_sdl_remove_timeout(struct event_timeout *to)
{
- dbg(2,"enter %p\n", to);
+ dbg(lvl_info,"enter %p\n", to);
if(to)
{
/* do not SDL_RemoveTimer if oneshot timer has already fired */
int ret = to->id == 0 ? SDL_TRUE : SDL_RemoveTimer(to->id);
if (ret == SDL_FALSE)
- dbg(0,"SDL_RemoveTimer (%p) failed\n", to->id);
+ dbg(lvl_error,"SDL_RemoveTimer (%p) failed\n", to->id);
g_free(to);
- dbg(1,"timer(%p) removed\n", to);
+ dbg(lvl_warning,"timer(%p) removed\n", to);
}
}
@@ -1774,7 +1774,7 @@ sdl_sort_idle_tasks(gconstpointer parama, gconstpointer paramb)
static struct event_idle *
event_sdl_add_idle(int priority, struct callback *cb)
{
- dbg(1,"add idle priority(%d) cb(%p)\n", priority, cb);
+ dbg(lvl_warning,"add idle priority(%d) cb(%p)\n", priority, cb);
struct idle_task *task = g_new0(struct idle_task, 1);
task->priority = priority;
@@ -1787,7 +1787,7 @@ event_sdl_add_idle(int priority, struct callback *cb)
SDL_Event event;
SDL_UserEvent userevent;
- dbg(1,"poking eventloop because of new idle_events\n");
+ dbg(lvl_warning,"poking eventloop because of new idle_events\n");
userevent.type = SDL_USEREVENT;
userevent.code = SDL_USEREVENT_CODE_IDLE_EVENT;
@@ -1808,7 +1808,7 @@ event_sdl_add_idle(int priority, struct callback *cb)
static void
event_sdl_remove_idle(struct event_idle *task)
{
- dbg(1,"remove task(%p)\n", task);
+ dbg(lvl_warning,"remove task(%p)\n", task);
g_ptr_array_remove(idle_tasks, (gpointer)task);
}
@@ -1817,7 +1817,7 @@ event_sdl_remove_idle(struct event_idle *task)
static void
event_sdl_call_callback(struct callback_list *cbl)
{
- dbg(1,"call_callback cbl(%p)\n",cbl);
+ dbg(lvl_warning,"call_callback cbl(%p)\n",cbl);
SDL_Event event;
SDL_UserEvent userevent;
diff --git a/navit/graphics/win32/graphics_win32.c b/navit/graphics/win32/graphics_win32.c
index c10fdfb74..f59446f6c 100644
--- a/navit/graphics/win32/graphics_win32.c
+++ b/navit/graphics/win32/graphics_win32.c
@@ -228,7 +228,7 @@ static void ErrorExit(LPTSTR lpszFunction)
(lstrlen((LPCTSTR)lpMsgBuf)+lstrlen((LPCTSTR)lpszFunction)+40)*sizeof(TCHAR));
_tprintf((LPTSTR)lpDisplayBuf, TEXT("%s failed with error %d: %s"), lpszFunction, dw, lpMsgBuf);
- dbg(0, "%s failed with error %d: %s", lpszFunction, dw, lpMsgBuf);
+ dbg(lvl_error, "%s failed with error %d: %s", lpszFunction, dw, lpMsgBuf);
MessageBox(NULL, (LPCTSTR)lpDisplayBuf, TEXT("Error"), MB_OK);
LocalFree(lpMsgBuf);
@@ -274,7 +274,7 @@ static void create_memory_dc(struct graphics_priv *gr)
hdc = GetDC( gr->wnd_handle );
// Creates memory DC
gr->hMemDC = CreateCompatibleDC(hdc);
- dbg(1, "resize memDC to: %d %d \n", gr->width, gr->height );
+ dbg(lvl_warning, "resize memDC to: %d %d \n", gr->width, gr->height );
#ifndef FAST_TRANSPARENCY
@@ -311,7 +311,7 @@ static void HandleKeyChar(struct graphics_priv *gra_priv, WPARAM wParam)
TCHAR key = (TCHAR) wParam;
char *s=NULL;
char k[]={0,0};
- dbg(1,"HandleKey %d\n",key);
+ dbg(lvl_warning,"HandleKey %d\n",key);
switch (key) {
default:
k[0]=key;
@@ -330,7 +330,7 @@ static void HandleKeyDown(struct graphics_priv *gra_priv, WPARAM wParam)
char left[]={NAVIT_KEY_LEFT,0};
char right[]={NAVIT_KEY_RIGHT,0};
char *s=NULL;
- dbg(1,"HandleKey %d\n",key);
+ dbg(lvl_warning,"HandleKey %d\n",key);
switch (key) {
case 37:
s=left;
@@ -410,7 +410,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
gra_priv->width = LOWORD( lParam );
gra_priv->height = HIWORD( lParam );
create_memory_dc(gra_priv);
- dbg(0, "resize gfx to: %d %d \n", gra_priv->width, gra_priv->height );
+ dbg(lvl_error, "resize gfx to: %d %d \n", gra_priv->width, gra_priv->height );
callback_list_call_attr_2(gra_priv->cbl, attr_resize, (void *)gra_priv->width, (void *)gra_priv->height);
}
break;
@@ -434,7 +434,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
PAINTSTRUCT ps = { 0 };
HDC hdc;
profile(0, NULL);
- dbg(1, "WM_PAINT\n");
+ dbg(lvl_warning, "WM_PAINT\n");
overlay = gra_priv->overlays;
#ifndef FAST_TRANSPARENCY
@@ -535,13 +535,13 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
case WM_LBUTTONDOWN:
{
- dbg(1, "LBUTTONDOWN\n");
+ dbg(lvl_warning, "LBUTTONDOWN\n");
HandleButtonClick( gra_priv, 1, 1, lParam);
}
break;
case WM_LBUTTONUP:
{
- dbg(1, "LBUTTONUP\n");
+ dbg(lvl_warning, "LBUTTONUP\n");
HandleButtonClick( gra_priv, 0, 1, lParam);
}
break;
@@ -552,7 +552,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
HandleButtonClick( gra_priv, 0, 3,lParam );
break;
case WM_LBUTTONDBLCLK:
- dbg(1, "LBUTTONDBLCLK\n");
+ dbg(lvl_warning, "LBUTTONDBLCLK\n");
HandleButtonClick( gra_priv, 1, 6,lParam );
break;
case WM_CHAR:
@@ -562,7 +562,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
HandleKeyDown( gra_priv, wParam);
break;
case WM_COPYDATA:
- dbg(0,"got WM_COPYDATA\n");
+ dbg(lvl_error,"got WM_COPYDATA\n");
callback_list_call_attr_2(gra_priv->cbl, attr_wm_copydata, (void *)wParam, (void*)lParam);
break;
#ifdef HAVE_API_WIN32_CE
@@ -689,7 +689,7 @@ static HANDLE CreateGraphicsWindows( struct graphics_priv* gr, HMENU hMenu )
if (!RegisterClassEx(&wc))
#endif
{
- dbg(0, "Window registration failed\n");
+ dbg(lvl_error, "Window registration failed\n");
return NULL;
}
@@ -732,7 +732,7 @@ static HANDLE CreateGraphicsWindows( struct graphics_priv* gr, HMENU hMenu )
#endif
if (hwnd == NULL)
{
- dbg(0, "Window creation failed: %d\n", GetLastError());
+ dbg(lvl_error, "Window creation failed: %d\n", GetLastError());
return NULL;
}
/* For Vista, we need here ChangeWindowMessageFilter(WM_COPYDATA,MSGFLT_ADD); since Win7 we need above one or ChangeWindowMessageFilterEx (MSDN), both are
@@ -939,7 +939,7 @@ static void draw_drag(struct graphics_priv *gr, struct point *p)
static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
{
- dbg( 1, "set draw_mode to %x, %d\n", gr, (int)mode );
+ dbg(lvl_warning, "set draw_mode to %x, %d\n", gr, (int)mode );
if ( mode == draw_mode_begin )
{
@@ -951,7 +951,7 @@ static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
{
if ( gr->hMemDC )
{
- dbg(1, "Erase dc: %x, w: %d, h: %d, bg_color: %x\n", gr, gr->width, gr->height, gr->bg_color);
+ dbg(lvl_warning, "Erase dc: %x, w: %d, h: %d, bg_color: %x\n", gr, gr->width, gr->height, gr->bg_color);
#ifdef FAST_TRANSPARENCY
if ( gr->hPrebuildDC )
{
@@ -1143,11 +1143,11 @@ pngdecode(struct graphics_priv *gr, char *name, struct graphics_image_priv *img)
BITMAPINFO pnginfo;
HDC dc;
- dbg(1,"enter %s\n",name);
+ dbg(lvl_warning,"enter %s\n",name);
png_file=fopen(name, "rb");
if (!png_file)
{
- dbg(1,"failed to open %s\n",name);
+ dbg(lvl_warning,"failed to open %s\n",name);
return FALSE;
}
@@ -1285,7 +1285,7 @@ pngdecode(struct graphics_priv *gr, char *name, struct graphics_image_priv *img)
g_free (row_pointers);
img->hot.x=img->width/2-1;
img->hot.y=img->height/2-1;
- dbg(1,"ok\n");
+ dbg(lvl_warning,"ok\n");
fclose(png_file);
return TRUE;
@@ -1433,7 +1433,7 @@ static struct graphics_image_priv *image_new(struct graphics_priv *gr, struct gr
if (len >= 4)
{
char *ext;
- dbg(2, "loading image '%s'\n", name );
+ dbg(lvl_info, "loading image '%s'\n", name );
ret = g_new0( struct graphics_image_priv, 1 );
ext = name+len-4;
if (!strcmp(ext,".xpm")) {
@@ -1443,7 +1443,7 @@ static struct graphics_image_priv *image_new(struct graphics_priv *gr, struct gr
}
}
if (!rc) {
- dbg(1, "failed loading '%s'\n", name );
+ dbg(lvl_warning, "failed loading '%s'\n", name );
g_free(ret);
ret=NULL;
}
@@ -1486,7 +1486,7 @@ static struct graphics_priv *
static void overlay_resize(struct graphics_priv *gr, struct point *p, int w, int h, int alpha, int wraparound)
{
- dbg(1, "resize overlay: %x, x: %d, y: %d, w: %d, h: %d, alpha: %x, wraparound: %d\n", gr, p->x, p->y, w, h, alpha, wraparound);
+ dbg(lvl_warning, "resize overlay: %x, x: %d, y: %d, w: %d, h: %d, alpha: %x, wraparound: %d\n", gr, p->x, p->y, w, h, alpha, wraparound);
if ( gr->width != w || gr->height != h )
{
@@ -1504,7 +1504,7 @@ static struct graphics_priv *
overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int alpha, int wraparound)
{
struct graphics_priv *this=graphics_win32_new_helper(meth);
- dbg(1, "overlay: %x, x: %d, y: %d, w: %d, h: %d, alpha: %x, wraparound: %d\n", this, p->x, p->y, w, h, alpha, wraparound);
+ dbg(lvl_warning, "overlay: %x, x: %d, y: %d, w: %d, h: %d, alpha: %x, wraparound: %d\n", this, p->x, p->y, w, h, alpha, wraparound);
this->width = w;
this->height = h;
this->parent = gr;
@@ -1538,7 +1538,7 @@ static struct graphics_priv *
static void overlay_disable(struct graphics_priv *gr, int disable)
{
- dbg(1, "overlay: %x, disable: %d\n", gr, disable);
+ dbg(lvl_warning, "overlay: %x, disable: %d\n", gr, disable);
gr->disabled = disable;
}
@@ -1550,7 +1550,7 @@ static void get_text_bbox(struct graphics_priv *gr, struct graphics_font_priv *f
int yMax = 13*font->size/256;
int xMax = 9*font->size*len/256;
- dbg(2, "Get bbox for %s\n", text);
+ dbg(lvl_info, "Get bbox for %s\n", text);
ret[0].x = xMin;
ret[0].y = -yMin;
@@ -1616,7 +1616,7 @@ static void bind_late(struct graphics_priv* gra_priv)
gra_priv->AlphaBlend = (FP_AlphaBlend)GetProcAddress(gra_priv->hCoreDll, TEXT("AlphaBlend") );
if (!gra_priv->AlphaBlend)
{
- dbg(1, "AlphaBlend not supported\n");
+ dbg(lvl_warning, "AlphaBlend not supported\n");
}
#if HAVE_API_WIN32_CE
gra_priv->SetStretchBltMode= (FP_SetStretchBltMode)GetProcAddress(gra_priv->hCoreDll, TEXT("SetStretchBltMode") );
@@ -1625,12 +1625,12 @@ static void bind_late(struct graphics_priv* gra_priv)
#endif
if (!gra_priv->SetStretchBltMode)
{
- dbg(1, "SetStretchBltMode not supported\n");
+ dbg(lvl_warning, "SetStretchBltMode not supported\n");
}
}
else
{
- dbg(0, "Error loading coredll\n");
+ dbg(lvl_error, "Error loading coredll\n");
}
if(gra_priv->hUser32Dll) {
@@ -1684,7 +1684,7 @@ event_win32_main_loop_run(void)
{
MSG msg;
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
while (GetMessage(&msg, 0, 0, 0))
{
TranslateMessage(&msg); /* Keyboard input. */
@@ -1700,7 +1700,7 @@ static void event_win32_main_loop_quit(void)
HWND hwndSip;
#endif
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
#ifdef HAVE_API_WIN32_CE
hwndTaskbar = FindWindow(L"HHTaskBar", NULL);
@@ -1716,14 +1716,14 @@ static void event_win32_main_loop_quit(void)
static struct event_watch *
event_win32_add_watch(int h, enum event_watch_cond cond, struct callback *cb)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
return NULL;
}
static void
event_win32_remove_watch(struct event_watch *ev)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
}
static GList *timers;
@@ -1746,7 +1746,7 @@ static void run_timer(UINT_PTR idEvent)
if (t->timer_id == idEvent)
{
struct callback *cb = t->cb;
- dbg(2, "Timer %d (multi: %d)\n", t->timer_id, t->multi);
+ dbg(lvl_info, "Timer %d (multi: %d)\n", t->timer_id, t->multi);
if (!t->multi)
{
KillTimer(NULL, t->timer_id);
@@ -1758,7 +1758,7 @@ static void run_timer(UINT_PTR idEvent)
}
l = g_list_next(l);
}
- dbg(0, "timer %d not found\n", idEvent);
+ dbg(lvl_error, "timer %d not found\n", idEvent);
}
static VOID CALLBACK win32_timer_cb(HWND hwnd, UINT uMsg,
@@ -1779,7 +1779,7 @@ static struct event_timeout *
timers = g_list_prepend(timers, t);
t->cb = cb;
t->timer_id = SetTimer(NULL, 0, timeout, win32_timer_cb);
- dbg(1, "Started timer %d for %d (multi: %d)\n", t->timer_id, timeout, multi);
+ dbg(lvl_warning, "Started timer %d for %d (multi: %d)\n", t->timer_id, timeout, multi);
return t;
}
@@ -1790,7 +1790,7 @@ event_win32_remove_timeout(struct event_timeout *to)
{
GList *l;
struct event_timeout *t=NULL;
- dbg(1, "Try stopping timer %d\n", to->timer_id);
+ dbg(lvl_warning, "Try stopping timer %d\n", to->timer_id);
l = timers;
while (l)
{
@@ -1805,7 +1805,7 @@ event_win32_remove_timeout(struct event_timeout *to)
}
l = g_list_next(l);
}
- dbg(0, "Timer %d not found\n", to->timer_id);
+ dbg(lvl_error, "Timer %d not found\n", to->timer_id);
g_free(to);
}
}
diff --git a/navit/gui.c b/navit/gui.c
index 340e3db2d..24fa93329 100644
--- a/navit/gui.c
+++ b/navit/gui.c
@@ -145,12 +145,12 @@ int
gui_add_bookmark(struct gui *gui, struct pcoord *c, char *description)
{
int ret;
- dbg(2,"enter\n");
+ dbg(lvl_info,"enter\n");
if (! gui->meth.add_bookmark)
return 0;
ret=gui->meth.add_bookmark(gui->priv, c, description);
- dbg(2,"ret=%d\n", ret);
+ dbg(lvl_info,"ret=%d\n", ret);
return ret;
}
diff --git a/navit/gui/gtk/datawindow.c b/navit/gui/gtk/datawindow.c
index 8a1327332..ea5dc6e73 100644
--- a/navit/gui/gtk/datawindow.c
+++ b/navit/gui/gtk/datawindow.c
@@ -48,7 +48,7 @@ select_row(GtkTreeView *tree, GtkTreePath *path, GtkTreeViewColumn *column, stru
GtkTreeModel *model;
int i;
- dbg(0,"win=%p\n", win);
+ dbg(lvl_error,"win=%p\n", win);
model=gtk_tree_view_get_model(tree);
gtk_tree_model_get_iter(model, &iter, path);
diff --git a/navit/gui/gtk/destination.c b/navit/gui/gtk/destination.c
index 4cac3bf65..f5bffd068 100644
--- a/navit/gui/gtk/destination.c
+++ b/navit/gui/gtk/destination.c
@@ -164,7 +164,7 @@ static void row_activated(GtkWidget *widget, GtkTreePath *p1, GtkTreeViewColumn
char *str;
int column;
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview), &path, &focus_column);
if(!path)
return;
@@ -184,11 +184,11 @@ static void row_activated(GtkWidget *widget, GtkTreePath *p1, GtkTreeViewColumn
column=4;
break;
default:
- dbg(0,"Unknown mode\n");
+ dbg(lvl_error,"Unknown mode\n");
return;
}
gtk_tree_model_get(search->liststore2, &iter, column, &str, -1);
- dbg(0,"str=%s\n", str);
+ dbg(lvl_error,"str=%s\n", str);
search->partial=0;
gtk_entry_set_text(GTK_ENTRY(entry_widget), str);
}
@@ -222,13 +222,13 @@ static void changed(GtkWidget *widget, struct search_param *search)
printf("changed %s partial %d\n", search->attr.u.str, search->partial);
if (widget == search->entry_country) {
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (search->liststore2), 3, GTK_SORT_ASCENDING);
- dbg(0,"country\n");
+ dbg(lvl_error,"country\n");
search->attr.type=attr_country_all;
set_columns(search, 0);
}
if (widget == search->entry_postal) {
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (search->liststore2), 1, GTK_SORT_ASCENDING);
- dbg(0,"postal\n");
+ dbg(lvl_error,"postal\n");
search->attr.type=attr_town_postal;
if (strlen(search->attr.u.str) < 2)
return;
@@ -236,14 +236,14 @@ static void changed(GtkWidget *widget, struct search_param *search)
}
if (widget == search->entry_city) {
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (search->liststore2), 2, GTK_SORT_ASCENDING);
- dbg(0,"town\n");
+ dbg(lvl_error,"town\n");
search->attr.type=attr_town_name;
if (strlen(search->attr.u.str) < 3)
return;
set_columns(search, 1);
}
if (widget == search->entry_street) {
- dbg(0,"street\n");
+ dbg(lvl_error,"street\n");
search->attr.type=attr_street_name;
// Searching for a street by just its first letter generates too many hits to be useful,
// plus it causes the GUI to become unresponsive because the search is single-threaded.
@@ -575,7 +575,7 @@ int destination_address(struct navit *nav)
gtk_entry_set_text(GTK_ENTRY(search->entry_country), country_name.u.str);
country_search_destroy(cs);
} else {
- dbg(0,"warning: no default country found\n");
+ dbg(lvl_error,"warning: no default country found\n");
}
search->partial=1;
return 0;
diff --git a/navit/gui/gtk/gui_gtk_action.c b/navit/gui/gtk/gui_gtk_action.c
index 17597f0c1..951f1138a 100644
--- a/navit/gui/gtk/gui_gtk_action.c
+++ b/navit/gui/gtk/gui_gtk_action.c
@@ -110,7 +110,7 @@ cursor_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
attr.type=attr_cursor;
attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
if(!navit_set_attr(gui->nav, &attr)) {
- dbg(0, "Failed to set attr_cursor\n");
+ dbg(lvl_error, "Failed to set attr_cursor\n");
}
}
@@ -122,7 +122,7 @@ tracking_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
attr.type=attr_tracking;
attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
if(!navit_set_attr(gui->nav, &attr)) {
- dbg(0, "Failed to set attr_tracking\n");
+ dbg(lvl_error, "Failed to set attr_tracking\n");
}
}
@@ -134,7 +134,7 @@ orient_north_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
attr.type=attr_orientation;
attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w)) ? 0:-1;
if(!navit_set_attr(gui->nav, &attr)) {
- dbg(0, "Failed to set attr_orientation\n");
+ dbg(lvl_error, "Failed to set attr_orientation\n");
}
}
diff --git a/navit/gui/gtk/gui_gtk_poi.c b/navit/gui/gtk/gui_gtk_poi.c
index 198b91f78..fa73c5ff8 100644
--- a/navit/gui/gtk/gui_gtk_poi.c
+++ b/navit/gui/gtk/gui_gtk_poi.c
@@ -55,7 +55,7 @@ geticon(const char *name){
GError *error=NULL;
icon=gdk_pixbuf_new_from_file(graphics_icon_path(name),&error);
if (error) {
- dbg(0, "failed to load icon '%s': %s\n", name, error->message);
+ dbg(lvl_error, "failed to load icon '%s': %s\n", name, error->message);
}
return icon;
}
@@ -228,7 +228,7 @@ button_destination_clicked(GtkWidget *widget, struct gtk_poi_search *search)
dest.y=lon;
dest.pro=1;
navit_set_destination(search->nav, &dest, buffer, 1);
- dbg(1,_("Set destination to %ld, %ld \n"),lat,lon);
+ dbg(lvl_warning,_("Set destination to %ld, %ld \n"),lat,lon);
}
/* Show the POI's position in the map. */
@@ -251,7 +251,7 @@ button_map_clicked(GtkWidget *widget, struct gtk_poi_search *search)
dest.y=lon;
dest.pro=1;
navit_set_center(search->nav, &dest,1);
- dbg(1,_("Set map to %ld, %ld \n"),lat,lon);
+ dbg(lvl_warning,_("Set map to %ld, %ld \n"),lat,lon);
}
/** Set POI as the first "visit before". */
@@ -268,7 +268,7 @@ button_visit_clicked(GtkWidget *widget, struct gtk_poi_search *search)
if(!gtk_tree_model_get_iter(GTK_TREE_MODEL(search->store_poi_sorted), &iter, path)) return;
gtk_tree_model_get(GTK_TREE_MODEL(search->store_poi_sorted), &iter, 3, &lat, -1);
gtk_tree_model_get(GTK_TREE_MODEL(search->store_poi_sorted), &iter, 4, &lon, -1);
- dbg(1,_("Set next visit to %ld, %ld \n"),lat,lon);
+ dbg(lvl_warning,_("Set next visit to %ld, %ld \n"),lat,lon);
struct pcoord dest;
dest.x=lat;
diff --git a/navit/gui/gtk/gui_gtk_window.c b/navit/gui/gtk/gui_gtk_window.c
index e9e55551a..8bca142d9 100644
--- a/navit/gui/gtk/gui_gtk_window.c
+++ b/navit/gui/gtk/gui_gtk_window.c
@@ -85,7 +85,7 @@ keypress(GtkWidget *widget, GdkEventKey *event, struct gui_priv *this)
struct point p;
if (event->type != GDK_KEY_PRESS)
return FALSE;
- dbg(1,"keypress 0x%x\n", event->keyval);
+ dbg(lvl_warning,"keypress 0x%x\n", event->keyval);
transform_get_size(navit_get_trans(this->nav), &w, &h);
switch (event->keyval) {
case GDK_KP_Enter:
@@ -313,19 +313,19 @@ gui_gtk_toggle_init(struct gui_priv *this)
toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "CursorAction"));
gtk_toggle_action_set_active(toggle_action, attr.u.num);
} else {
- dbg(1, "Unable to locate CursorAction\n");
+ dbg(lvl_warning, "Unable to locate CursorAction\n");
}
if (navit_get_attr(this->nav, attr_orientation, &attr, NULL)) {
toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "OrientationAction"));
gtk_toggle_action_set_active(toggle_action, attr.u.num != -1);
} else {
- dbg(0, "Unable to locate OrientationAction\n");
+ dbg(lvl_error, "Unable to locate OrientationAction\n");
}
if (navit_get_attr(this->nav, attr_tracking, &attr, NULL)) {
toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "TrackingAction"));
gtk_toggle_action_set_active(toggle_action, attr.u.num);
} else {
- dbg(0, "Unable to locate TrackingAction\n");
+ dbg(lvl_error, "Unable to locate TrackingAction\n");
}
}
@@ -478,7 +478,7 @@ gui_gtk_vehicles_update(struct gui_priv *this)
char *name;
GList *curr;
struct gui_menu_info *meninfo;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
curr = g_list_first(this->vehicle_menuitems);
diff --git a/navit/gui/internal/gui_internal.c b/navit/gui/internal/gui_internal.c
index f426c033d..7c2f35290 100644
--- a/navit/gui/internal/gui_internal.c
+++ b/navit/gui/internal/gui_internal.c
@@ -130,10 +130,10 @@ image_new_scaled(struct gui_priv *this, const char *name, int w, int h)
char *full_path=NULL;
full_path=graphics_icon_path(name);
ret=graphics_image_new_scaled(this->gra, full_path, w, h);
- dbg(1,"Trying to load image '%s' (w=%d, h=%d): %s\n", name, w, h, ret ? "OK" : "NOT FOUND");
+ dbg(lvl_warning,"Trying to load image '%s' (w=%d, h=%d): %s\n", name, w, h, ret ? "OK" : "NOT FOUND");
g_free(full_path);
if (!ret) {
- dbg(0,"Failed to load image for '%s' (w=%d, h=%d)\n", name, w, h);
+ dbg(lvl_error,"Failed to load image for '%s' (w=%d, h=%d)\n", name, w, h);
full_path=graphics_icon_path("unknown");
ret=graphics_image_new_scaled(this->gra, full_path, w, h);
g_free(full_path);
@@ -498,7 +498,7 @@ gui_internal_apply_config(struct gui_priv *this)
{
struct gui_config_settings * current_config=0;
- dbg(1,"w=%d h=%d\n", this->root.w, this->root.h);
+ dbg(lvl_warning,"w=%d h=%d\n", this->root.w, this->root.h);
/**
* Select default values from profile based on the screen.
*/
@@ -583,7 +583,7 @@ static void
gui_internal_cmd_set_destination(struct gui_priv *this, struct widget *wm, void *data)
{
char *name=data;
- dbg(2,"c=%d:0x%x,0x%x\n", wm->c.pro, wm->c.x, wm->c.y);
+ dbg(lvl_info,"c=%d:0x%x,0x%x\n", wm->c.pro, wm->c.x, wm->c.y);
navit_set_destination(this->nav, &wm->c, name, 1);
if (this->flags & 512) {
struct attr follow;
@@ -837,13 +837,13 @@ gui_internal_cmd_view_attributes(struct gui_priv *this, struct widget *wm, void
char *text;
int count=0;
- dbg(2,"item=%p 0x%x 0x%x\n", wm->item.map,wm->item.id_hi, wm->item.id_lo);
+ dbg(lvl_info,"item=%p 0x%x 0x%x\n", wm->item.map,wm->item.id_hi, wm->item.id_lo);
wb=gui_internal_menu(this, "Attributes");
w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
gui_internal_widget_append(wb, w);
mr=map_rect_new(wm->item.map, NULL);
item = map_rect_get_item_byid(mr, wm->item.id_hi, wm->item.id_lo);
- dbg(2,"item=%p\n", item);
+ dbg(lvl_info,"item=%p\n", item);
if (item) {
text=g_strdup_printf("%s:%s", _("Item type"), item_to_name(item->type));
gui_internal_widget_append(w,
@@ -885,10 +885,10 @@ gui_internal_cmd_view_in_browser(struct gui_priv *this, struct widget *wm, void
char *cmd=NULL;
if (!wm->name) {
- dbg(2,"item=%p 0x%x 0x%x\n", wm->item.map,wm->item.id_hi, wm->item.id_lo);
+ dbg(lvl_info,"item=%p 0x%x 0x%x\n", wm->item.map,wm->item.id_hi, wm->item.id_lo);
mr=map_rect_new(wm->item.map, NULL);
item = map_rect_get_item_byid(mr, wm->item.id_hi, wm->item.id_lo);
- dbg(2,"item=%p\n", item);
+ dbg(lvl_info,"item=%p\n", item);
if (item) {
while(item_attr_get(item, attr_url_local, &attr)) {
if (! cmd)
@@ -903,7 +903,7 @@ gui_internal_cmd_view_in_browser(struct gui_priv *this, struct widget *wm, void
#ifdef HAVE_SYSTEM
system(cmd);
#else
- dbg(0,"Error: External commands were disabled during compilation, cannot call '%s'.\n",cmd);
+ dbg(lvl_error,"Error: External commands were disabled during compilation, cannot call '%s'.\n",cmd);
#endif
g_free(cmd);
}
@@ -993,7 +993,7 @@ gui_internal_cmd_results_to_map(struct gui_priv *this, struct widget *wm, void *
if(!w) {
map_rect_destroy(mr);
- dbg(1,"Can't find the results table - only map clean up is done.\n");
+ dbg(lvl_warning,"Can't find the results table - only map clean up is done.\n");
return;
}
@@ -1005,7 +1005,7 @@ gui_internal_cmd_results_to_map(struct gui_priv *this, struct widget *wm, void *
struct item* it;
if(wi->name==NULL)
continue;
- dbg(2,"%s\n",wi->name);
+ dbg(lvl_info,"%s\n",wi->name);
it=map_rect_create_item(mr,type_found_item);
if(it) {
struct coord c;
@@ -1106,7 +1106,7 @@ gui_internal_cmd_position_do(struct gui_priv *this, struct pcoord *pc_in, struct
pc=*pc_in;
c.x=pc.x;
c.y=pc.y;
- dbg(2,"x=0x%x y=0x%x\n", c.x, c.y);
+ dbg(lvl_info,"x=0x%x y=0x%x\n", c.x, c.y);
transform_to_geo(pc.pro, &c, &g);
} else if (g_in) {
struct attr attr;
@@ -1551,7 +1551,7 @@ gui_internal_cmd_bookmarks(struct gui_priv *this, struct widget *wm, void *data)
while ((item=bookmarks_get_item(mattr.u.bookmarks))) {
if (!item_attr_get(item, attr_label, &attr)) continue;
label_full=map_convert_string_tmp(item->map,attr.u.str);
- dbg(2,"full_labled: %s\n",label_full);
+ dbg(lvl_info,"full_labled: %s\n",label_full);
// hassub == 1 if the item type is a sub-folder
if (item->type == type_bookmark_folder) {
@@ -1624,7 +1624,7 @@ gui_internal_keypress_do(struct gui_priv *this, char *key)
}
return;
} else if (*key == NAVIT_KEY_BACKSPACE) {
- dbg(1,"backspace\n");
+ dbg(lvl_warning,"backspace\n");
if (wi->text && wi->text[0]) {
len=g_utf8_prev_char(wi->text+strlen(wi->text))-wi->text;
wi->text[len]='\0';
@@ -1632,11 +1632,11 @@ gui_internal_keypress_do(struct gui_priv *this, char *key)
}
} else {
if (wi->state & STATE_CLEAR) {
- dbg(2,"wi->state=0x%x\n", wi->state);
+ dbg(lvl_info,"wi->state=0x%x\n", wi->state);
g_free(wi->text);
wi->text=NULL;
wi->state &= ~STATE_CLEAR;
- dbg(2,"wi->state=0x%x\n", wi->state);
+ dbg(lvl_info,"wi->state=0x%x\n", wi->state);
}
text=g_strdup_printf("%s%s", wi->text ? wi->text : "", key);
}
@@ -1720,7 +1720,7 @@ gui_internal_set(char *remove, char *add)
int len=strlen(line);
if (len > 0 && line[len-1] == '\n')
line[len-1]='\0';
- dbg(1,"line=%s\n",line);
+ dbg(lvl_warning,"line=%s\n",line);
if (!gui_internal_match(remove, line))
fprintf(fo,"%s\n",line);
}
@@ -1779,12 +1779,12 @@ gui_internal_cmd_map_download_do(struct gui_priv *this, struct widget *wm, void
sel.range.max=type_last;
mr=map_rect_new(map, &sel);
while ((item=map_rect_get_item(mr))) {
- dbg(2,"item\n");
+ dbg(lvl_info,"item\n");
}
map_rect_destroy(mr);
}
- dbg(2,"bbox=%s\n",wm->prefix);
+ dbg(lvl_info,"bbox=%s\n",wm->prefix);
gui_internal_menu_render(this);
}
@@ -1798,7 +1798,7 @@ gui_internal_cmd_map_download(struct gui_priv *this, struct widget *wm, void *da
char *search,buffer[256];
int found,sp_match=0;
- dbg(1,"wm=%p prefix=%s\n",wm,wm->prefix);
+ dbg(lvl_warning,"wm=%p prefix=%s\n",wm,wm->prefix);
search=wm->prefix;
if (search) {
@@ -2007,14 +2007,14 @@ gui_internal_cmd_set_active_profile(struct gui_priv *this, struct
vehicle_get_attr(v, attr_name, &vehicle_name_attr, NULL);
vehicle_name = vehicle_name_attr.u.str;
- dbg(1, "Changing vehicle %s to profile %s\n", vehicle_name,
+ dbg(lvl_warning, "Changing vehicle %s to profile %s\n", vehicle_name,
profilename);
// Change the profile name
profilename_attr.type = attr_profilename;
profilename_attr.u.str = profilename;
if(!vehicle_set_attr(v, &profilename_attr)) {
- dbg(0, "Unable to set the vehicle's profile name\n");
+ dbg(lvl_error, "Unable to set the vehicle's profile name\n");
}
// Notify Navit that the routing should be re-done if this is the
@@ -2056,7 +2056,7 @@ gui_internal_add_vehicle_profile(struct gui_priv *this, struct widget
// Figure out the profile name
attr = attr_search(profile->attrs, NULL, attr_name);
if (!attr) {
- dbg(0, "Adding vehicle profile failed. attr==NULL");
+ dbg(lvl_error, "Adding vehicle profile failed. attr==NULL");
return;
}
name = attr->u.str;
@@ -2066,7 +2066,7 @@ gui_internal_add_vehicle_profile(struct gui_priv *this, struct widget
active_profile = profile_attr.u.str;
active = active_profile != NULL && !strcmp(name, active_profile);
- dbg(1, "Adding vehicle profile %s, active=%s/%i\n", name,
+ dbg(lvl_warning, "Adding vehicle profile %s, active=%s/%i\n", name,
active_profile, active);
// Build a translatable label.
@@ -2213,7 +2213,7 @@ gui_internal_set_click_coord(struct gui_priv *this, struct point *p)
if (p) {
trans=navit_get_trans(this->nav);
transform_reverse(trans, p, &c);
- dbg(1,"x=0x%x y=0x%x\n", c.x, c.y);
+ dbg(lvl_warning,"x=0x%x y=0x%x\n", c.x, c.y);
this->clickp.pro=transform_get_projection(trans);
this->clickp.x=c.x;
this->clickp.y=c.y;
@@ -2254,7 +2254,7 @@ gui_internal_enter_setup(struct gui_priv *this)
void
gui_internal_cmd_menu(struct gui_priv *this, int ignore, char *href)
{
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
gui_internal_enter(this, ignore);
gui_internal_enter_setup(this);
// draw menu
@@ -2374,7 +2374,7 @@ gui_internal_set_attr(struct gui_priv *this, struct attr *attr)
this->on_map_click=g_strdup(attr->u.str);
return 1;
default:
- dbg(0,"Unknown attribute: %s\n",attr_to_name(attr->type));
+ dbg(lvl_error,"Unknown attribute: %s\n",attr_to_name(attr->type));
return 1;
}
}
@@ -2442,7 +2442,7 @@ gui_internal_coordinate_parse(char *s, char plus, char minus, double *x)
sscanf(degree, "%lf", x);
if(strchr(degree, plus) || strchr(degree, minus)) {
- dbg(3,"degree %c/%c found\n",plus,minus);
+ dbg(lvl_debug,"degree %c/%c found\n",plus,minus);
} else {/* DEGREES_MINUTES */
if(!minute)
return 0;
@@ -2450,7 +2450,7 @@ gui_internal_coordinate_parse(char *s, char plus, char minus, double *x)
sscanf(minute, "%lf", &tmp);
*x+=tmp/60;
if(strchr(minute, plus) || strchr(minute, minus)) {
- dbg(3,"minute %c/%c found\n",plus,minus);
+ dbg(lvl_debug,"minute %c/%c found\n",plus,minus);
} else { /* DEGREES_MINUTES_SECONDS */
second=strtok(NULL,"");
if(!second)
@@ -2474,7 +2474,7 @@ gui_internal_cmd_enter_coord_do(struct gui_priv *this, struct widget *widget)
char *lat, *lng;
char *widgettext;
double latitude, longitude;
- dbg(1,"text entered:%s\n", widget->text);
+ dbg(lvl_warning,"text entered:%s\n", widget->text);
/* possible entry can be identical to coord_format output but only space between lat and lng is allowed */
widgettext=g_ascii_strup(widget->text,-1);
@@ -2507,7 +2507,7 @@ gui_internal_cmd_enter_coord_do(struct gui_priv *this, struct widget *widget)
void
gui_internal_cmd_enter_coord_clicked(struct gui_priv *this, struct widget *widget, void *data)
{
- dbg(1,"entered\n");
+ dbg(lvl_warning,"entered\n");
gui_internal_cmd_enter_coord_do(this, widget->data);
}
@@ -2527,18 +2527,18 @@ static void gui_internal_button(void *data, int pressed, int button, struct poin
struct gui_priv *this=data;
struct graphics *gra=this->gra;
- dbg(1,"enter %d %d\n", pressed, button);
+ dbg(lvl_warning,"enter %d %d\n", pressed, button);
// if still on the map (not in the menu, yet):
- dbg(1,"children=%p ignore_button=%d\n",this->root.children,this->ignore_button);
+ dbg(lvl_warning,"children=%p ignore_button=%d\n",this->root.children,this->ignore_button);
if (!this->root.children || this->ignore_button) {
this->ignore_button=0;
// check whether the position of the mouse changed during press/release OR if it is the scrollwheel
if (!navit_handle_button(this->nav, pressed, button, p, NULL)) {
- dbg(1,"navit has handled button\n");
+ dbg(lvl_warning,"navit has handled button\n");
return;
}
- dbg(1,"menu_on_map_click=%d\n",this->menu_on_map_click);
+ dbg(lvl_warning,"menu_on_map_click=%d\n",this->menu_on_map_click);
if (button != 1)
return;
if (this->on_map_click || this->menu_on_map_click) {
@@ -2639,7 +2639,7 @@ static void gui_internal_resize(void *data, int w, int h)
this->root.h=h;
changed=1;
}
- dbg(1,"w=%d h=%d children=%p\n", w, h, this->root.children);
+ dbg(lvl_warning,"w=%d h=%d children=%p\n", w, h, this->root.children);
navit_handle_resize(this->nav, w, h);
if (this->root.children) {
if (changed) {
@@ -2688,7 +2688,7 @@ gui_internal_keynav_find_closest(struct widget *wi, struct point *p, int dx, int
if (dist1 < 0)
dist1=-dist1;
}
- dbg(1,"checking %d,%d %d %d against %d,%d-%d,%d result %d,%d\n", p->x, p->y, dx, dy, wi->p.x, wi->p.y, wi->p.x+wi->w, wi->p.y+wi->h, dist1, dist2);
+ dbg(lvl_warning,"checking %d,%d %d %d against %d,%d-%d,%d result %d,%d\n", p->x, p->y, dx, dy, wi->p.x, wi->p.y, wi->p.x+wi->w, wi->p.y+wi->h, dist1, dist2);
if (dist1 >= 0) {
if (dist2 < 0)
dist1-=dist2;
@@ -2723,13 +2723,13 @@ gui_internal_keynav_highlight_next(struct gui_priv *this, int dx, int dy)
gui_internal_keynav_find_closest(menu, &p, 0, 0, &distance, &result);
if (result) {
gui_internal_keynav_point(result, dx, dy, &p);
- dbg(1,"result origin=%p p=%d,%d\n", result, p.x, p.y);
+ dbg(lvl_warning,"result origin=%p p=%d,%d\n", result, p.x, p.y);
}
}
result=NULL;
distance=INT_MAX;
gui_internal_keynav_find_closest(menu, &p, dx, dy, &distance, &result);
- dbg(1,"result=%p\n", result);
+ dbg(lvl_warning,"result=%p\n", result);
if (! result) {
if (dx < 0)
p.x=this->root.w;
@@ -2742,7 +2742,7 @@ gui_internal_keynav_highlight_next(struct gui_priv *this, int dx, int dy)
result=NULL;
distance=INT_MAX;
gui_internal_keynav_find_closest(menu, &p, dx, dy, &distance, &result);
- dbg(1,"wraparound result=%p\n", result);
+ dbg(lvl_warning,"wraparound result=%p\n", result);
}
gui_internal_highlight_do(this, result);
if (result)
@@ -3003,9 +3003,9 @@ line_intersection(struct coord* a1, struct coord *a2, struct coord * b1, struct
if (a > n || b > n)
return 0;
if (n == 0) {
- dbg(2,"a=%d b=%d n=%d\n", a, b, n);
- dbg(2,"a1=0x%x,0x%x ad %d,%d\n", a1->x, a1->y, adx, ady);
- dbg(2,"b1=0x%x,0x%x bd %d,%d\n", b1->x, b1->y, bdx, bdy);
+ dbg(lvl_info,"a=%d b=%d n=%d\n", a, b, n);
+ dbg(lvl_info,"a1=0x%x,0x%x ad %d,%d\n", a1->x, a1->y, adx, ady);
+ dbg(lvl_info,"b1=0x%x,0x%x bd %d,%d\n", b1->x, b1->y, bdx, bdy);
dbg_assert(n != 0);
}
res->x = a1->x + a * adx / n;
diff --git a/navit/gui/internal/gui_internal_bookmark.c b/navit/gui/internal/gui_internal_bookmark.c
index 26d338f96..64351b323 100644
--- a/navit/gui/internal/gui_internal_bookmark.c
+++ b/navit/gui/internal/gui_internal_bookmark.c
@@ -21,7 +21,7 @@ gui_internal_cmd_add_bookmark_do(struct gui_priv *this, struct widget *widget)
{
GList *l;
struct attr attr;
- dbg(1,"text='%s'\n", widget->text);
+ dbg(lvl_warning,"text='%s'\n", widget->text);
if (widget->text && strlen(widget->text)){
navit_get_attr(this->nav, attr_bookmarks, &attr, NULL);
bookmarks_add_bookmark(attr.u.bookmarks, &widget->c, widget->text);
@@ -37,7 +37,7 @@ gui_internal_cmd_add_bookmark_folder_do(struct gui_priv *this, struct widget *wi
{
GList *l;
struct attr attr;
- dbg(1,"text='%s'\n", widget->text);
+ dbg(lvl_warning,"text='%s'\n", widget->text);
if (widget->text && strlen(widget->text)){
navit_get_attr(this->nav, attr_bookmarks, &attr, NULL);
bookmarks_add_bookmark(attr.u.bookmarks, NULL, widget->text);
@@ -66,7 +66,7 @@ gui_internal_cmd_rename_bookmark_clicked(struct gui_priv *this, struct widget *w
struct widget *w=(struct widget*)widget->data;
GList *l;
struct attr attr;
- dbg(1,"text='%s'\n", w->text);
+ dbg(lvl_warning,"text='%s'\n", w->text);
if (w->text && strlen(w->text)){
navit_get_attr(this->nav, attr_bookmarks, &attr, NULL);
bookmarks_rename_bookmark(attr.u.bookmarks, w->name, w->text);
diff --git a/navit/gui/internal/gui_internal_command.c b/navit/gui/internal/gui_internal_command.c
index 2d1e13cd2..9c7b33609 100644
--- a/navit/gui/internal/gui_internal_command.c
+++ b/navit/gui/internal/gui_internal_command.c
@@ -134,11 +134,11 @@ gui_internal_cmd_escape(struct gui_priv *this, char *function, struct attr **in,
{
struct attr escaped;
if (!in || !in[0]) {
- dbg(0,"first parameter missing or wrong type\n");
+ dbg(lvl_error,"first parameter missing or wrong type\n");
return;
}
if (!out) {
- dbg(0,"output missing\n");
+ dbg(lvl_error,"output missing\n");
return;
}
if (ATTR_IS_STRING(in[0]->type)) {
@@ -148,10 +148,10 @@ gui_internal_cmd_escape(struct gui_priv *this, char *function, struct attr **in,
escaped.type=attr_type_string_begin;
escaped.u.str=g_strdup_printf("%ld",in[0]->u.num);
} else {
- dbg(0,"first parameter wrong type\n");
+ dbg(lvl_error,"first parameter wrong type\n");
return;
}
- dbg(1,"in %s result %s\n",in[0]->u.str,escaped.u.str);
+ dbg(lvl_warning,"in %s result %s\n",in[0]->u.str,escaped.u.str);
*out=attr_generic_add_attr(*out, attr_dup(&escaped));
g_free(escaped.u.str);
}
@@ -514,7 +514,7 @@ gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *function, st
diagram_point->c.y=heightline->height;
diagram_point->next=diagram_points;
diagram_points=diagram_point;
- dbg(2,"%d %d\n", diagram_point->c.x, diagram_point->c.y);
+ dbg(lvl_info,"%d %d\n", diagram_point->c.x, diagram_point->c.y);
}
}
}
@@ -548,12 +548,12 @@ gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *function, st
coord_rect_extend(&dbbox, &diagram_point->c);
diagram_point=diagram_point->next;
}
- dbg(2,"%d %d %d %d\n", dbbox.lu.x, dbbox.lu.y, dbbox.rl.x, dbbox.rl.y);
+ dbg(lvl_info,"%d %d %d %d\n", dbbox.lu.x, dbbox.lu.y, dbbox.rl.x, dbbox.rl.y);
if (dbbox.rl.x > dbbox.lu.x && dbbox.lu.x*100/(dbbox.rl.x-dbbox.lu.x) <= 25)
dbbox.lu.x=0;
if (dbbox.lu.y > dbbox.rl.y && dbbox.rl.y*100/(dbbox.lu.y-dbbox.rl.y) <= 25)
dbbox.rl.y=0;
- dbg(2,"%d,%d %dx%d\n", box->p.x, box->p.y, box->w, box->h);
+ dbg(lvl_info,"%d,%d %dx%d\n", box->p.x, box->p.y, box->w, box->h);
x=dbbox.lu.x;
first=1;
for (;;) {
@@ -569,7 +569,7 @@ gui_internal_cmd2_route_height_profile(struct gui_priv *this, char *function, st
break;
p[1].x=(min->c.x-dbbox.lu.x)*(box->w-10)/(dbbox.rl.x-dbbox.lu.x)+box->p.x+5;
p[1].y=(min->c.y-dbbox.rl.y)*(box->h-10)/(dbbox.lu.y-dbbox.rl.y)+box->p.y+5;
- dbg(2,"%d,%d=%d,%d\n",min->c.x, min->c.y, p[1].x,p[1].y);
+ dbg(lvl_info,"%d,%d=%d,%d\n",min->c.x, min->c.y, p[1].x,p[1].y);
graphics_draw_circle(this->gra, this->foreground, &p[1], 2);
if (first)
first=0;
@@ -630,7 +630,7 @@ gui_internal_cmd2_pois(struct gui_priv *this, char *function, struct attr **in,
struct attr pro;
struct coord c;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
if (!in || !in[0])
return;
if (!ATTR_IS_COORD_GEO(in[0]->type))
@@ -871,7 +871,7 @@ gui_internal_cmd2_position(struct gui_priv *this, char *function, struct attr **
const char *name=_("Position");
int flags=-1;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
if (!in || !in[0])
return;
if (!ATTR_IS_COORD_GEO(in[0]->type))
@@ -881,7 +881,7 @@ gui_internal_cmd2_position(struct gui_priv *this, char *function, struct attr **
if (in[2] && ATTR_IS_INT(in[2]->type))
flags=in[2]->u.num;
}
- dbg(1,"flags=0x%x\n",flags);
+ dbg(lvl_warning,"flags=0x%x\n",flags);
gui_internal_cmd_position_do(this, NULL, in[0]->u.coord_geo, NULL, name, flags);
}
@@ -904,14 +904,14 @@ gui_internal_cmd2_set(struct gui_priv *this, char *function, struct attr **in, s
{
char *pattern,*command=NULL;
if (!in || !in[0] || !ATTR_IS_STRING(in[0]->type)) {
- dbg(0,"first parameter missing or wrong type\n");
+ dbg(lvl_error,"first parameter missing or wrong type\n");
return;
}
pattern=in[0]->u.str;
- dbg(1,"pattern %s\n",pattern);
+ dbg(lvl_warning,"pattern %s\n",pattern);
if (in[1]) {
command=gui_internal_cmd_match_expand(pattern, in+1);
- dbg(1,"expand %s\n",command);
+ dbg(lvl_warning,"expand %s\n",command);
gui_internal_set(pattern, command);
command_evaluate(&this->self, command);
g_free(command);
@@ -955,7 +955,7 @@ static void
gui_internal_cmd_write(struct gui_priv * this, char *function, struct attr **in, struct attr ***out, int *valid)
{
char *str=NULL;
- dbg(1,"enter %s %p %p %p\n",function,in,out,valid);
+ dbg(lvl_warning,"enter %s %p %p %p\n",function,in,out,valid);
if (!in)
return;
while (*in) {
@@ -965,7 +965,7 @@ gui_internal_cmd_write(struct gui_priv * this, char *function, struct attr **in,
if (str) {
str=g_strdup_printf("<html>%s</html>\n",str);
#if 0
- dbg(0,"%s\n",str);
+ dbg(lvl_error,"%s\n",str);
#endif
gui_internal_html_parse_text(this, str);
}
@@ -988,11 +988,11 @@ gui_internal_onclick(struct attr ***in, char **onclick, char *set)
char format[4],*end=strchr(c+2,'}'),*replacement=NULL,*new_str;
int is_arg;
if (!end) {
- dbg(0,"Missing closing brace in format string %s\n",c);
+ dbg(lvl_error,"Missing closing brace in format string %s\n",c);
goto error;
}
if (end-c > sizeof(format)) {
- dbg(0,"Invalid format string %s\n",c);
+ dbg(lvl_error,"Invalid format string %s\n",c);
goto error;
}
strncpy(format, c+2, end-c-2);
@@ -1019,7 +1019,7 @@ gui_internal_onclick(struct attr ***in, char **onclick, char *set)
}
}
if (!replacement) {
- dbg(0,"Unsupported format string %s\n",format);
+ dbg(lvl_error,"Unsupported format string %s\n",format);
goto error;
}
new_str=g_strconcat(str, replacement, end+1, NULL);
@@ -1063,7 +1063,7 @@ gui_internal_cmd_img(struct gui_priv * this, char *function, struct attr **in, s
str=gui_internal_append_attr(str, escape_mode_string|escape_mode_html, " class=", *in, "");
in++;
} else {
- dbg(0,"argument error: class argument not string\n");
+ dbg(lvl_error,"argument error: class argument not string\n");
goto error;
}
if (ATTR_IS_STRING((*in)->type) && (*in)->u.str) {
@@ -1072,7 +1072,7 @@ gui_internal_cmd_img(struct gui_priv * this, char *function, struct attr **in, s
}
in++;
} else {
- dbg(0,"argument error: image argument not string\n");
+ dbg(lvl_error,"argument error: image argument not string\n");
goto error;
}
if (ATTR_IS_STRING((*in)->type) && (*in)->u.str) {
@@ -1083,7 +1083,7 @@ gui_internal_cmd_img(struct gui_priv * this, char *function, struct attr **in, s
}
in++;
} else {
- dbg(0,"argument error: text argument not string\n");
+ dbg(lvl_error,"argument error: text argument not string\n");
goto error;
}
gui_internal_onclick(&in,&onclick,NULL);
@@ -1096,7 +1096,7 @@ gui_internal_cmd_img(struct gui_priv * this, char *function, struct attr **in, s
}
g_free(onclick);
html=g_strdup_printf("<html>%s%s</html>\n",str,suffix);
- dbg(1,"return %s",html);
+ dbg(lvl_warning,"return %s",html);
gui_internal_html_parse_text(this, html);
g_free(html);
error:
@@ -1109,16 +1109,16 @@ static void
gui_internal_cmd_debug(struct gui_priv * this, char *function, struct attr **in, struct attr ***out, int *valid)
{
char *str;
- dbg(0,"begin\n");
+ dbg(lvl_error,"begin\n");
if (in) {
while (*in) {
str=attr_to_text(*in, NULL, 0);
- dbg(0,"%s:%s\n",attr_to_name((*in)->type),str);
+ dbg(lvl_error,"%s:%s\n",attr_to_name((*in)->type),str);
in++;
g_free(str);
}
}
- dbg(0,"done\n");
+ dbg(lvl_error,"done\n");
}
static void
diff --git a/navit/gui/internal/gui_internal_gesture.c b/navit/gui/internal/gui_internal_gesture.c
index 5eec83da9..d0f129b7d 100644
--- a/navit/gui/internal/gui_internal_gesture.c
+++ b/navit/gui/internal/gui_internal_gesture.c
@@ -61,7 +61,7 @@ gui_internal_gesture_ring_add(struct gui_priv *this, struct point *p)
}
this->gesture_ring[this->gesture_ring_last].p=*p;
this->gesture_ring[this->gesture_ring_last].msec=msec;
- dbg(2,"msec="LONGLONG_FMT" x=%d y=%d\n",msec,p->x,p->y);
+ dbg(lvl_info,"msec="LONGLONG_FMT" x=%d y=%d\n",msec,p->x,p->y);
};
int
@@ -89,7 +89,7 @@ gui_internal_gesture_get_vector(struct gui_priv *this, long long msec, struct po
*p0=g->p;
}
msec=g->msec;
- dbg(2,LONGLONG_FMT" %d %d\n",g->msec, g->p.x, g->p.y);
+ dbg(lvl_info,LONGLONG_FMT" %d %d\n",g->msec, g->p.x, g->p.y);
for(i=1;(g=gui_internal_gesture_ring_get(this,i))!=NULL;i++) {
if( msec-g->msec > 1000 )
break;
@@ -99,7 +99,7 @@ gui_internal_gesture_get_vector(struct gui_priv *this, long long msec, struct po
if(p0) {
*p0=g->p;
}
- dbg(2,LONGLONG_FMT" %d %d\n",g->msec, g->p.x, g->p.y);
+ dbg(lvl_info,LONGLONG_FMT" %d %d\n",g->msec, g->p.x, g->p.y);
}
return dt;
}
@@ -114,7 +114,7 @@ gui_internal_gesture_do(struct gui_priv *this)
if( abs(dx) > this->icon_s*3 && abs(dy) < this->icon_s ) {
struct widget *wt;
- dbg(1,"horizontal dx=%d dy=%d\n",dx,dy);
+ dbg(lvl_warning,"horizontal dx=%d dy=%d\n",dx,dy);
/* Prevent swiping if widget was scrolled beforehand */
if(this->pressed==2)
@@ -133,11 +133,11 @@ gui_internal_gesture_do(struct gui_priv *this)
gui_internal_table_button_prev(this,NULL,wt);
return 1;
} else if( abs(dy) > this->icon_s*3 && abs(dx) < this->icon_s ) {
- dbg(1,"vertical dx=%d dy=%d\n",dx,dy);
+ dbg(lvl_warning,"vertical dx=%d dy=%d\n",dx,dy);
} else if (dt>300 && abs(dx) <this->icon_s && abs(dy) <this->icon_s ) {
- dbg(1,"longtap dx=%d dy=%d\n",dx,dy);
+ dbg(lvl_warning,"longtap dx=%d dy=%d\n",dx,dy);
} else {
- dbg(1,"none dx=%d dy=%d\n",dx,dy);
+ dbg(lvl_warning,"none dx=%d dy=%d\n",dx,dy);
}
return 0;
diff --git a/navit/gui/internal/gui_internal_html.c b/navit/gui/internal/gui_internal_html.c
index b87c6c230..291b1701d 100644
--- a/navit/gui/internal/gui_internal_html.c
+++ b/navit/gui/internal/gui_internal_html.c
@@ -96,7 +96,7 @@ gui_internal_html_submit(struct gui_priv *this, struct widget *w, void *data)
struct widget *menu;
GList *l;
- dbg(1,"enter form %p %s\n",w->form,w->form->onsubmit);
+ dbg(lvl_warning,"enter form %p %s\n",w->form,w->form->onsubmit);
l=g_list_last(this->root.children);
menu=l->data;
graphics_draw_mode(this->gra, draw_mode_begin);
@@ -113,7 +113,7 @@ gui_internal_html_load_href(struct gui_priv *this, char *href, int replace)
if (replace)
gui_internal_prune_menu_count(this, 1, 0);
if (href && href[0] == '#') {
- dbg(1,"href=%s\n",href);
+ dbg(lvl_warning,"href=%s\n",href);
g_free(this->href);
this->href=g_strdup(href);
gui_internal_html_menu(this, this->html_text, href+1);
@@ -376,22 +376,22 @@ gui_internal_refresh_callback_called(struct gui_priv *this, struct menu_data *me
static void
gui_internal_set_refresh_callback(struct gui_priv *this, char *cond)
{
- dbg(2,"cond=%s\n",cond);
+ dbg(lvl_info,"cond=%s\n",cond);
if (cond) {
enum attr_type type;
struct object_func *func;
struct menu_data *menu_data=gui_internal_menu_data(this);
- dbg(2,"navit=%p\n",this->nav);
+ dbg(lvl_info,"navit=%p\n",this->nav);
type=command_evaluate_to_attr(&this->self, cond, NULL, &menu_data->refresh_callback_obj);
if (type == attr_none) {
- dbg(0,"can't get type of '%s'\n",cond);
+ dbg(lvl_error,"can't get type of '%s'\n",cond);
return;
}
func=object_func_lookup(menu_data->refresh_callback_obj.type);
if (!func)
- dbg(0,"'%s' has no functions\n",cond);
+ dbg(lvl_error,"'%s' has no functions\n",cond);
if (func && !func->add_attr)
- dbg(0,"'%s' has no add_attr function\n",cond);
+ dbg(lvl_error,"'%s' has no add_attr function\n",cond);
if (!func || !func->add_attr)
return;
menu_data->refresh_callback.type=attr_callback;
@@ -461,7 +461,7 @@ gui_internal_html_text(xml_context *dummy, const char *text, gsize len, void *da
}
break;
case html_tag_script:
- dbg(1,"execute %s\n",text_stripped);
+ dbg(lvl_warning,"execute %s\n",text_stripped);
gui_internal_evaluate(this,text_stripped);
break;
default:
diff --git a/navit/gui/internal/gui_internal_menu.c b/navit/gui/internal/gui_internal_menu.c
index b72b00aea..3777d124c 100644
--- a/navit/gui/internal/gui_internal_menu.c
+++ b/navit/gui/internal/gui_internal_menu.c
@@ -118,7 +118,7 @@ gui_internal_menu(struct gui_priv *this, const char *label)
struct widget *wlb,*wb,*wm=w;
wm->flags=gravity_center|orientation_vertical|flags_expand|flags_fill;
w=gui_internal_box_new(this, gravity_center|orientation_horizontal|flags_expand|flags_fill);
- dbg(2,"topbox->menu_data=%p\n", topbox->menu_data);
+ dbg(lvl_info,"topbox->menu_data=%p\n", topbox->menu_data);
gui_internal_widget_append(wm, w);
wb=gui_internal_box_new(this, gravity_right_center|orientation_horizontal|flags_fill);
wb->bl=6;
@@ -260,7 +260,7 @@ gui_internal_top_bar(struct gui_priv *this)
use_sep=1;
else
use_sep=0;
- dbg(1,"%d (%s) + %d + %d + %d > %d\n", wcn->w, wc->text, width_used, w->spx, use_sep ? sep_len : 0, width);
+ dbg(lvl_warning,"%d (%s) + %d + %d + %d > %d\n", wcn->w, wc->text, width_used, w->spx, use_sep ? sep_len : 0, width);
if (wcn->w + width_used + w->spx + (use_sep ? sep_len : 0) + (g_list_previous(l) ? dots_len : 0) > width) {
incomplete=1;
gui_internal_widget_destroy(this, wcn);
diff --git a/navit/gui/internal/gui_internal_poi.c b/navit/gui/internal/gui_internal_poi.c
index dac6e7e18..261e1646e 100644
--- a/navit/gui/internal/gui_internal_poi.c
+++ b/navit/gui/internal/gui_internal_poi.c
@@ -122,7 +122,7 @@ gui_internal_poi_icon(struct gui_priv *this, struct item *item)
icon=g_strdup(el->u.icon.src);
}
char *dot=g_strrstr(icon,".");
- dbg(2,"%s %s\n", item_to_name(item->type),icon);
+ dbg(lvl_info,"%s %s\n", item_to_name(item->type),icon);
if(dot)
*dot=0;
img=image_new_xs(this,icon);
@@ -573,7 +573,7 @@ gui_internal_cmd_pois(struct gui_priv *this, struct widget *wm, void *data)
char buffer[32];
struct poi_param *paramnew;
struct attr route;
-dbg(0,"POIs...");
+dbg(lvl_error,"POIs...");
if(data) {
param = data;
} else {
@@ -596,7 +596,7 @@ dbg(0,"POIs...");
items= g_new0( struct item_data, maxitem);
- dbg(2, "Params: sel = %i, selnb = %i, pagenb = %i, dist = %i, filterstr = %s, AddressFilterType= %d\n",
+ dbg(lvl_info, "Params: sel = %i, selnb = %i, pagenb = %i, dist = %i, filterstr = %s, AddressFilterType= %d\n",
param->sel, param->selnb, param->pagenb, param->dist, param->filterstr, param->AddressFilterType);
wb=gui_internal_menu(this, isel ? isel->name : _("POIs"));
@@ -614,7 +614,7 @@ dbg(0,"POIs...");
while ((m=mapset_next(h, 1))) {
selm=map_selection_dup_pro(sel, pro, map_projection(m));
mr=map_rect_new(m, selm);
- dbg(2,"mr=%p\n", mr);
+ dbg(lvl_info,"mr=%p\n", mr);
if (mr) {
while ((item=map_rect_get_item(mr))) {
if (gui_internal_cmd_pois_item_selected(param, item) &&
@@ -685,10 +685,10 @@ dbg(0,"POIs...");
struct item_data *data = fh_extractmin(fh);
if (data == NULL)
{
- dbg(2, "Empty heap: maxitem = %i, it = %i, dist = %i\n", maxitem, it, dist);
+ dbg(lvl_info, "Empty heap: maxitem = %i, it = %i, dist = %i\n", maxitem, it, dist);
break;
}
- dbg(2, "dist1: %i, dist2: %i\n", data->dist, (-key)>>10);
+ dbg(lvl_info, "dist1: %i, dist2: %i\n", data->dist, (-key)>>10);
if(i==(it-pagesize*pagenb) && data->dist>prevdist)
prevdist=data->dist;
wi=gui_internal_cmd_pois_item(this, &center, &data->item, &data->c, route.u.route, data->dist, data->label);
@@ -767,13 +767,13 @@ dbg(0,"POIs...");
while(firstrow>=0) {
int currow=g_list_index(wtable->children, td->bottom_row->data) - firstrow;
if(currow<0) {
- dbg(0,"Can't find bottom row in children list. Stop paging.\n");
+ dbg(lvl_error,"Can't find bottom row in children list. Stop paging.\n");
break;
}
if(currow>=param->count)
break;
if(!(td->scroll_buttons.next_button->state & STATE_SENSITIVE)) {
- dbg(0,"Reached last page but item %i not found. Stop paging.\n",param->count);
+ dbg(lvl_error,"Reached last page but item %i not found. Stop paging.\n",param->count);
break;
}
gui_internal_table_button_next(this, td->scroll_buttons.next_button, NULL);
diff --git a/navit/gui/internal/gui_internal_search.c b/navit/gui/internal/gui_internal_search.c
index 0539fcf35..9969e0edb 100644
--- a/navit/gui/internal/gui_internal_search.c
+++ b/navit/gui/internal/gui_internal_search.c
@@ -87,7 +87,7 @@ gui_internal_search_cmp(gconstpointer _a, gconstpointer _b)
sa=removecase(a->text);
sb=removecase(b->text);
r=strcmp(sa,sb);
- dbg(1,"%s %s %d\n",sa,sb,r);
+ dbg(lvl_warning,"%s %s %d\n",sa,sb,r);
g_free(sa);
g_free(sb);
return r;
@@ -202,7 +202,7 @@ gui_internal_find_next_possible_key(char *search_text, char *wm_name, char *poss
possible_keys[len]=trunk_name[strlen(search_text)];
possible_keys[len+1]='\0';
}
- dbg(2,"searching for %s, found: %s, currently possible_keys: %s \n", search_text, item_name, possible_keys);
+ dbg(lvl_info,"searching for %s, found: %s, currently possible_keys: %s \n", search_text, item_name, possible_keys);
}
}
}
@@ -260,7 +260,7 @@ gui_internal_get_match_quality(char *item_name, char* search_text, int is_house_
if(!exp)
continue;
if(!strcmp(exp,folded_query)) {
- dbg(1,"exact match for the whole string %s\n", exp);
+ dbg(lvl_warning,"exact match for the whole string %s\n", exp);
match_quality=full_string_match;
g_free(exp);
break;
@@ -268,7 +268,7 @@ gui_internal_get_match_quality(char *item_name, char* search_text, int is_house_
if((p=strstr(exp,folded_query))!=NULL) {
p+=strlen(folded_query);
if(!*p||strchr(LINGUISTICS_WORD_SEPARATORS_ASCII,*p)) {
- dbg(1,"exact matching word found inside string %s\n",exp);
+ dbg(lvl_warning,"exact matching word found inside string %s\n",exp);
match_quality=word_match;
}
}
@@ -352,7 +352,7 @@ gui_internal_search_idle(struct gui_priv *this, char *wm_name, struct widget *se
widget_name=g_strdup(result_main_label);
}
if(!item_name) {
- dbg(0, "Skipping nameless item in search (search type: %s). Please report this as a bug.\n", wm_name);
+ dbg(lvl_error, "Skipping nameless item in search (search type: %s). Please report this as a bug.\n", wm_name);
return;
}
@@ -411,13 +411,13 @@ gui_internal_search_changed(struct gui_priv *this, struct widget *wm, void *data
param=(void *)5;
if (! strcmp(wm->name,"House number"))
param=(void *)6;
- dbg(1,"%s now '%s'\n", wm->name, wm->text);
+ dbg(lvl_warning,"%s now '%s'\n", wm->name, wm->text);
gui_internal_search_idle_end(this);
if (wm->text && g_utf8_strlen(wm->text, -1) >= minlen) {
struct attr search_attr;
- dbg(1,"process\n");
+ dbg(lvl_warning,"process\n");
if (! strcmp(wm->name,"Country"))
search_attr.type=attr_country_all;
if (! strcmp(wm->name,"Town"))
@@ -452,7 +452,7 @@ gui_internal_search_list_set_default_country(struct gui_priv *this)
item=country_search_get_item(cs);
if (item && item_attr_get(item, attr_country_name, &country_name)) {
search_attr.type=attr_country_all;
- dbg(1,"country %s\n", country_name.u.str);
+ dbg(lvl_warning,"country %s\n", country_name.u.str);
search_attr.u.str=country_name.u.str;
search_list_search(this->sl, &search_attr, 0);
while((res=search_list_get_result(this->sl)));
@@ -465,9 +465,9 @@ gui_internal_search_list_set_default_country(struct gui_priv *this)
}
country_search_destroy(cs);
} else {
- dbg(0,"warning: no default country found\n");
+ dbg(lvl_error,"warning: no default country found\n");
if (this->country_iso2) {
- dbg(0,"attempting to use country '%s'\n",this->country_iso2);
+ dbg(lvl_error,"attempting to use country '%s'\n",this->country_iso2);
search_attr.type=attr_country_iso2;
search_attr.u.str=this->country_iso2;
search_list_search(this->sl, &search_attr, 0);
@@ -566,7 +566,7 @@ gui_internal_search(struct gui_priv *this, const char *what, const char *type, i
void
gui_internal_search_house_number_in_street(struct gui_priv *this, struct widget *widget, void *data)
{
- dbg(2,"id %d\n", widget->selection_id);
+ dbg(lvl_info,"id %d\n", widget->selection_id);
search_list_select(this->sl, attr_street_name, 0, 0);
search_list_select(this->sl, attr_street_name, widget->selection_id, 1);
gui_internal_search(this,_("House number"),"House number",0);
@@ -575,7 +575,7 @@ gui_internal_search_house_number_in_street(struct gui_priv *this, struct widget
void
gui_internal_search_street_in_town(struct gui_priv *this, struct widget *widget, void *data)
{
- dbg(2,"id %d\n", widget->selection_id);
+ dbg(lvl_info,"id %d\n", widget->selection_id);
search_list_select(this->sl, attr_town_or_district_name, 0, 0);
search_list_select(this->sl, attr_town_or_district_name, widget->selection_id, 1);
gui_internal_search(this,_("Street"),"Street",0);
@@ -585,7 +585,7 @@ void
gui_internal_search_town_in_country(struct gui_priv *this, struct widget *widget)
{
struct search_list_common *slc;
- dbg(2,"id %d\n", widget->selection_id);
+ dbg(lvl_info,"id %d\n", widget->selection_id);
search_list_select(this->sl, attr_country_all, 0, 0);
slc=search_list_select(this->sl, attr_country_all, widget->selection_id, 1);
if (slc) {
diff --git a/navit/gui/internal/gui_internal_widget.c b/navit/gui/internal/gui_internal_widget.c
index d677d3ca8..d8888b12e 100644
--- a/navit/gui/internal/gui_internal_widget.c
+++ b/navit/gui/internal/gui_internal_widget.c
@@ -248,7 +248,7 @@ gui_internal_highlight_do(struct gui_priv *this, struct widget *found)
this->highlighted_menu=g_list_last(this->root.children)->data;
this->highlighted->state |= STATE_HIGHLIGHTED;
gui_internal_widget_render(this, this->highlighted);
- dbg(1,"%d,%d %dx%d\n", found->p.x, found->p.y, found->w, found->h);
+ dbg(lvl_warning,"%d,%d %dx%d\n", found->p.x, found->p.y, found->w, found->h);
}
graphics_draw_mode(this->gra, draw_mode_end);
}
@@ -474,7 +474,7 @@ static void gui_internal_box_pack(struct gui_priv *this, struct widget *w)
* will be used.
*/
if(!w->w && !w->h)
- dbg(0,"Warning width and height of a widget are 0");
+ dbg(lvl_error,"Warning width and height of a widget are 0");
break;
}
if (! w->w && ! w->h) {
@@ -550,7 +550,7 @@ static void gui_internal_box_pack(struct gui_priv *this, struct widget *w)
wc->p.x=x-wc->w;
#if 0
if (w->flags & flags_scrolly)
- dbg(0,"%d - %d vs %d - %d\n",y,y+wc->h,w->p.y,w->p.y+w->h-hb);
+ dbg(lvl_error,"%d - %d vs %d - %d\n",y,y+wc->h,w->p.y,w->p.y+w->h-hb);
if (y+wc->h > w->p.y+w->h-hb || y+wc->h < w->p.y)
wc->state |= STATE_OFFSCREEN;
else
@@ -605,7 +605,7 @@ static void gui_internal_box_pack(struct gui_priv *this, struct widget *w)
w->scroll_buttons->button_box->p.x=w->p.x;
w->scroll_buttons->button_box->p.y=w->p.y+w->h-w->scroll_buttons->button_box->h;
gui_internal_widget_pack(this, w->scroll_buttons->button_box);
- dbg(0,"needs buttons %d vs %d\n",y,w->h);
+ dbg(lvl_error,"needs buttons %d vs %d\n",y,w->h);
gui_internal_box_pack(this, w);
return;
}
diff --git a/navit/gui/qml/bookmarksProxy.h b/navit/gui/qml/bookmarksProxy.h
index 6fe95bd20..96ed32e8a 100644
--- a/navit/gui/qml/bookmarksProxy.h
+++ b/navit/gui/qml/bookmarksProxy.h
@@ -72,7 +72,7 @@ public slots:
entries.appendChild(entry);
}
- dbg(2,"%s\n",retDoc.toString().toLocal8Bit().constData());
+ dbg(lvl_info,"%s\n",retDoc.toString().toLocal8Bit().constData());
return retDoc.toString();
}
QString AddFolder(QString description) {
@@ -144,7 +144,7 @@ public slots:
if (!item_attr_get(item, attr_label, &attr)) continue;
label=QString::fromLocal8Bit(attr.u.str);
- dbg(0,"Bookmark is %s\n",bookmark.toStdString().c_str());
+ dbg(lvl_error,"Bookmark is %s\n",bookmark.toStdString().c_str());
if (label.compare(bookmark)) continue;
item_coord_get(item, &c, 1);
if (this->object->currentPoint!=NULL) {
diff --git a/navit/gui/qml/gui_qml.cpp b/navit/gui/qml/gui_qml.cpp
index 7beca4264..98132c756 100644
--- a/navit/gui/qml/gui_qml.cpp
+++ b/navit/gui/qml/gui_qml.cpp
@@ -161,11 +161,11 @@ static void gui_qml_button(void *data, int pressed, int button, struct point *p)
// check whether the position of the mouse changed during press/release OR if it is the scrollwheel
if (!navit_handle_button(this_->nav, pressed, button, p, NULL)) {
- dbg(1,"navit has handled button\n");
+ dbg(lvl_warning,"navit has handled button\n");
return;
}
- dbg(1,"enter %d %d\n", pressed, button);
+ dbg(lvl_warning,"enter %d %d\n", pressed, button);
if (this_->signal_on_map_click) {
gui_qml_dbus_signal(this_, p);
return;
@@ -278,7 +278,7 @@ static int gui_qml_set_graphics(struct gui_priv *this_, struct graphics *gra)
if (xid.length()>0) {
_mainWindow->embedInto(xid.toULong(&ok,0));
}else{
- dbg(0, "\nFATAL: Environment variable NAVIT_XID not set.\n"
+ dbg(lvl_error, "\nFATAL: Environment variable NAVIT_XID not set.\n"
" Please set NAVIT_XID to the window ID of the window to embed into.\n");
exit(1);
}
@@ -322,7 +322,7 @@ static int gui_qml_set_graphics(struct gui_priv *this_, struct graphics *gra)
QString mainQml = QString(this_->source)+"/"+this_->skin+"/main.qml";
if (!QFile(mainQml).exists()){
- dbg(0, "FATAL: QML file %s not found. Navit is not installed correctly.\n", mainQml.toAscii().constData());
+ dbg(lvl_error, "FATAL: QML file %s not found. Navit is not installed correctly.\n", mainQml.toAscii().constData());
exit(1);
}
this_->guiWidget->setSource(QUrl::fromLocalFile(mainQml));
@@ -380,7 +380,7 @@ gui_qml_set_attr(struct gui_priv *this_, struct attr *attr)
this_->radius=attr->u.num;
return 1;
default:
- dbg(0,"unknown attr: %s\n",attr_to_name(attr->type));
+ dbg(lvl_error,"unknown attr: %s\n",attr_to_name(attr->type));
return 1;
}
}
diff --git a/navit/gui/qml/navitProxy.h b/navit/gui/qml/navitProxy.h
index 359009206..48197eeb5 100644
--- a/navit/gui/qml/navitProxy.h
+++ b/navit/gui/qml/navitProxy.h
@@ -82,7 +82,7 @@ public slots:
dropIterFunc(iter);
- dbg(0,QString::number(_itemId).toStdString().c_str());
+ dbg(lvl_error,QString::number(_itemId).toStdString().c_str());
return retDoc.toString();
}
diff --git a/navit/gui/qml/ngqpoint.h b/navit/gui/qml/ngqpoint.h
index e7202000d..05142e5bf 100644
--- a/navit/gui/qml/ngqpoint.h
+++ b/navit/gui/qml/ngqpoint.h
@@ -248,7 +248,7 @@ public slots:
}
map_selection_destroy(sel);
mapset_close(h);
- dbg(2,"%s\n",retDoc.toString().toLocal8Bit().constData());
+ dbg(lvl_info,"%s\n",retDoc.toString().toLocal8Bit().constData());
return retDoc.toString();
}
protected:
diff --git a/navit/gui/qml/proxy.h b/navit/gui/qml/proxy.h
index ba45cb446..d2e00b95c 100644
--- a/navit/gui/qml/proxy.h
+++ b/navit/gui/qml/proxy.h
@@ -55,7 +55,7 @@ public slots:
struct attr attr_value;
double *helper;
- dbg(1,"Setting %s to %s\n",attr_name.toStdString().c_str(),attr_string.toStdString().c_str());
+ dbg(lvl_warning,"Setting %s to %s\n",attr_name.toStdString().c_str(),attr_string.toStdString().c_str());
getAttrFunc(attr_from_name(attr_name.toStdString().c_str()), &attr_value, NULL);
if (ATTR_IS_INT(attr_value.type)) {
diff --git a/navit/gui/qml/routeProxy.h b/navit/gui/qml/routeProxy.h
index 77defd2d3..2492fda23 100644
--- a/navit/gui/qml/routeProxy.h
+++ b/navit/gui/qml/routeProxy.h
@@ -30,10 +30,10 @@ public slots:
QList<struct attr> destinations=this->_routeDestinations();
for (QList<struct attr>::const_iterator iter=destinations.begin();iter!=destinations.end();iter++) {
NGQPoint helperPoint(this->object,iter->u.pcoord,MapPoint);
- dbg(0,"Added destination %s\n",helperPoint.coordString().toLocal8Bit().constData());
+ dbg(lvl_error,"Added destination %s\n",helperPoint.coordString().toLocal8Bit().constData());
}
- //dbg(0,QString::number(_itemId).toStdString().c_str());
+ //dbg(lvl_error,QString::number(_itemId).toStdString().c_str());
//return retDoc.toString();
return QString();
diff --git a/navit/gui/qml/searchProxy.h b/navit/gui/qml/searchProxy.h
index 19a6c93a9..49fadd5e3 100644
--- a/navit/gui/qml/searchProxy.h
+++ b/navit/gui/qml/searchProxy.h
@@ -33,7 +33,7 @@ public:
item=country_search_get_item(cs);
if (item && item_attr_get(item, attr_country_name, &country_name)) {
search_attr.type=attr_country_all;
- dbg(0,"country %s\n", country_name.u.str);
+ dbg(lvl_error,"country %s\n", country_name.u.str);
this->country_name=QString::fromLocal8Bit(country_name.u.str);
search_attr.u.str=country_name.u.str;
search_list_search(this->sl, &search_attr, 0);
@@ -44,9 +44,9 @@ public:
}
country_search_destroy(cs);
} else {
- dbg(0,"warning: no default country found\n");
+ dbg(lvl_error,"warning: no default country found\n");
if (!this->country_iso2.isEmpty()) {
- dbg(0,"attempting to use country '%s'\n",this->country_iso2.toStdString().c_str());
+ dbg(lvl_error,"attempting to use country '%s'\n",this->country_iso2.toStdString().c_str());
search_attr.type=attr_country_iso2;
search_attr.u.str=(char*)this->country_iso2.toStdString().c_str();
search_list_search(this->sl, &search_attr, 0);
diff --git a/navit/gui/win32/gui_win32.c b/navit/gui/win32/gui_win32.c
index 3596496a2..1e7c941ec 100644
--- a/navit/gui/win32/gui_win32.c
+++ b/navit/gui/win32/gui_win32.c
@@ -185,7 +185,7 @@ static void window_layout( HWND hwnd )
rcClient.top += iToolHeight;
- dbg(0, "resize gui to: %d %d %d %d \n", rcClient.left, rcClient.right, rcClient.top, rcClient.bottom );
+ dbg(lvl_error, "resize gui to: %d %d %d %d \n", rcClient.left, rcClient.right, rcClient.top, rcClient.bottom );
hChild = GetDlgItem(hwnd, ID_CHILD_GFX);
@@ -285,7 +285,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
attr.type=attr_cursor;
// TODO attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
if(!navit_set_attr(gui->nav, &attr)) {
- dbg(0, "Failed to set attr_cursor\n");
+ dbg(lvl_error, "Failed to set attr_cursor\n");
}
return 0;
}
@@ -298,7 +298,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
// attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
attr.u.num = 0; // TODO
if(!navit_set_attr(gui->nav, &attr)) {
- dbg(0, "Failed to set attr_orientation\n");
+ dbg(lvl_error, "Failed to set attr_orientation\n");
}
return 0;
}
diff --git a/navit/gui/win32/win32_gui_destination.c b/navit/gui/win32/win32_gui_destination.c
index a9465c9a0..196bf7298 100644
--- a/navit/gui/win32/win32_gui_destination.c
+++ b/navit/gui/win32/win32_gui_destination.c
@@ -200,7 +200,7 @@ static void notify_textchange(struct datawindow_priv *datawindow, int param1, in
}
break;
default:
- dbg(0, "Unhandled search type");
+ dbg(lvl_error, "Unhandled search type");
}
lvI.iItem = listIndex;
@@ -212,7 +212,7 @@ static void notify_textchange(struct datawindow_priv *datawindow, int param1, in
(void)ListView_InsertItem(datawindow->hwndList, &lvI);
ListView_SetItemText(datawindow->hwndList, listIndex, 1, tcharBuffer);
g_free(tcharBuffer);
- dbg(0,"%s\n", res->country->name);
+ dbg(lvl_error,"%s\n", res->country->name);
listIndex++;
}
}
@@ -307,7 +307,7 @@ BOOL register_destination_window()
if (!RegisterClass(&wc))
{
- dbg(0, "Window Registration Failed!\n");
+ dbg(lvl_error, "Window Registration Failed!\n");
return FALSE;
}
return TRUE;
@@ -339,7 +339,7 @@ HANDLE create_destination_window( struct navit *nav )
if (this_->hwnd == NULL)
{
- dbg(0, "Window Creation Failed!\n");
+ dbg(lvl_error, "Window Creation Failed!\n");
return 0;
}
diff --git a/navit/item.c b/navit/item.c
index 5b72d023f..3f865c19d 100644
--- a/navit/item.c
+++ b/navit/item.c
@@ -393,7 +393,7 @@ item_hash_insert(struct item_hash *h, struct item *item, void *val)
{
struct item *hitem=g_new(struct item, 1);
*hitem=*item;
- dbg(2,"inserting (0x%x,0x%x) into %p\n", item->id_hi, item->id_lo, h->h);
+ dbg(lvl_info,"inserting (0x%x,0x%x) into %p\n", item->id_hi, item->id_lo, h->h);
g_hash_table_insert(h->h, hitem, val);
}
@@ -402,9 +402,9 @@ item_hash_remove(struct item_hash *h, struct item *item)
{
int ret;
- dbg(2,"removing (0x%x,0x%x) from %p\n", item->id_hi, item->id_lo, h->h);
+ dbg(lvl_info,"removing (0x%x,0x%x) from %p\n", item->id_hi, item->id_lo, h->h);
ret=g_hash_table_remove(h->h, item);
- dbg(2,"ret=%d\n", ret);
+ dbg(lvl_info,"ret=%d\n", ret);
return ret;
}
diff --git a/navit/layout.c b/navit/layout.c
index f0cafad54..c78e7c79d 100644
--- a/navit/layout.c
+++ b/navit/layout.c
@@ -202,7 +202,7 @@ cursor_new(struct attr *parent, struct attr **attrs)
else {
this->sequence_range=NULL;
}
- dbg(2,"ret=%p\n", this);
+ dbg(lvl_info,"ret=%p\n", this);
return this;
}
@@ -252,7 +252,7 @@ layer_set_attr_do(struct layer *l, struct attr *attr, int init)
l->ref=NULL;
obj=(struct navit_object *)l->navit;
if (obj==NULL){
- dbg(0, "Invalid layer reference '%s': Only layers inside a layout can use references.\n", attr->u.str);
+ dbg(lvl_error, "Invalid layer reference '%s': Only layers inside a layout can use references.\n", attr->u.str);
return 0;
}
iter=obj->func->iter_new(obj);
@@ -263,7 +263,7 @@ layer_set_attr_do(struct layer *l, struct attr *attr, int init)
}
}
if (l->ref==NULL){
- dbg(0, "Ignoring reference to unknown layer '%s' in layer '%s'.\n", attr->u.str, l->name);
+ dbg(lvl_error, "Ignoring reference to unknown layer '%s' in layer '%s'.\n", attr->u.str, l->name);
}
obj->func->iter_destroy(iter);
default:
@@ -287,7 +287,7 @@ struct layer * layer_new(struct attr *parent, struct attr **attrs)
layer_set_attr_do(l, *attrs, 1);
}
if (l->name==NULL){
- dbg(0, "Ignoring layer without name.\n");
+ dbg(lvl_error, "Ignoring layer without name.\n");
g_free(l);
return NULL;
}
@@ -397,7 +397,7 @@ itemgra_add_attr(struct itemgra *itemgra, struct attr *attr)
itemgra->elements = g_list_append(itemgra->elements, attr->u.element);
return 1;
default:
- dbg(0,"unknown: %s\n", attr_to_name(attr->type));
+ dbg(lvl_error,"unknown: %s\n", attr_to_name(attr->type));
return 0;
}
}
diff --git a/navit/linguistics.c b/navit/linguistics.c
index d249cdab9..4314b5345 100644
--- a/navit/linguistics.c
+++ b/navit/linguistics.c
@@ -317,7 +317,7 @@ linguistics_casefold(const char *in)
}
*dest=0;
if(*src)
- dbg(0,"Casefolded string for '%s' needs extra space, result is trucated to '%s'.\n",in,ret);
+ dbg(lvl_error,"Casefolded string for '%s' needs extra space, result is trucated to '%s'.\n",in,ret);
return ret;
}
@@ -423,7 +423,7 @@ linguistics_expand_special(const char *str, int mode)
out=new_ret+(out-ret);
ret=new_ret;
}
- dbg(1,"found %s %s %d %s %d\n",in,spc[0],len,replace,replace_len);
+ dbg(lvl_warning,"found %s %s %d %s %d\n",in,spc[0],len,replace,replace_len);
strcpy(out, replace);
out+=replace_len;
match=1;
diff --git a/navit/log.c b/navit/log.c
index c6de884a9..d37396ccd 100644
--- a/navit/log.c
+++ b/navit/log.c
@@ -349,7 +349,7 @@ log_timer(struct log *this_)
int delta;
gettimeofday(&tv, NULL);
delta=(tv.tv_sec-this_->last_flush.tv_sec)*1000+(tv.tv_usec-this_->last_flush.tv_usec)/1000;
- dbg(1,"delta=%d flush_time=%d\n", delta, this_->flush_time);
+ dbg(lvl_warning,"delta=%d flush_time=%d\n", delta, this_->flush_time);
if (this_->flush_time && delta >= this_->flush_time*1000)
log_flush(this_,0);
#endif
@@ -386,7 +386,7 @@ log_new(struct attr * parent,struct attr **attrs)
struct file_wordexp *wexp;
char *filename, **wexp_data;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
ret->func=&log_func;
navit_object_ref((struct navit_object *)ret);
data=attr_search(attrs, NULL, attr_data);
@@ -418,7 +418,7 @@ log_new(struct attr * parent,struct attr **attrs)
if (flush_time)
ret->flush_time=flush_time->u.num;
if (ret->flush_time) {
- dbg(1,"interval %d\n", ret->flush_time*1000);
+ dbg(lvl_warning,"interval %d\n", ret->flush_time*1000);
ret->timer_callback=callback_new_1(callback_cast(log_timer), ret);
ret->timer=event_add_timeout(ret->flush_time*1000, 1, ret->timer_callback);
}
@@ -492,15 +492,15 @@ log_set_trailer(struct log *this_, char *data, int len)
void
log_write(struct log *this_, char *data, int len, enum log_flags flags)
{
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
if (log_change_required(this_)) {
- dbg(1,"log_change");
+ dbg(lvl_warning,"log_change");
log_change(this_);
}
if (flags & log_flag_replace_buffer)
this_->data.len=0;
if (this_->data.len + len > this_->data.max_len) {
- dbg(2,"overflow\n");
+ dbg(lvl_info,"overflow\n");
this_->data.max_len+=16384; // FIXME: what if len exceeds this->data.max_len by more than 16384 bytes?
this_->data.data=g_realloc(this_->data.data,this_->data.max_len);
}
@@ -561,7 +561,7 @@ log_printf(struct log *this_, char *fmt, ...)
void
log_destroy(struct log *this_)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
attr_list_free(this_->attrs);
callback_destroy(this_->timer_callback);
event_remove_timeout(this_->timer);
diff --git a/navit/main.c b/navit/main.c
index bd228b325..229ccb1bc 100644
--- a/navit/main.c
+++ b/navit/main.c
@@ -315,13 +315,13 @@ win_set_nls(void)
#endif
while (nls_table[i][0]) {
if (!strcmp(nls_table[i][0], lang) && !(strcmp(nls_table[i][1], country))) {
- dbg(1,"Setting LANG=%s for Lang %s Country %s\n",nls_table[i][2], lang, country);
+ dbg(lvl_warning,"Setting LANG=%s for Lang %s Country %s\n",nls_table[i][2], lang, country);
setenv("LANG",nls_table[i][2],0);
return;
}
i++;
}
- dbg(1,"Lang %s Country %s not found\n",lang,country);
+ dbg(lvl_warning,"Lang %s Country %s not found\n",lang,country);
}
#endif
diff --git a/navit/map.c b/navit/map.c
index fbc7fba87..bb8a52385 100644
--- a/navit/map.c
+++ b/navit/map.c
@@ -96,12 +96,12 @@ map_new(struct attr *parent, struct attr **attrs)
struct attr *type=attr_search(attrs, NULL, attr_type);
if (! type) {
- dbg(0,"missing type\n");
+ dbg(lvl_error,"missing type\n");
return NULL;
}
maptype_new=plugin_get_map_type(type->u.str);
if (! maptype_new) {
- dbg(0,"invalid type '%s'\n", type->u.str);
+ dbg(lvl_error,"invalid type '%s'\n", type->u.str);
return NULL;
}
@@ -227,7 +227,7 @@ map_convert_string_tmp(struct map *this_, char *str)
return str;
map_converted_string_tmp=g_convert(str, -1, "utf-8", this_->meth.charset, NULL, NULL, NULL);
if(!map_converted_string_tmp) {
- dbg(0,"Error converting '%s' from %s to utf-8\n", str, this_->meth.charset);
+ dbg(lvl_error,"Error converting '%s' from %s to utf-8\n", str, this_->meth.charset);
return str;
}
return map_converted_string_tmp;
@@ -442,8 +442,8 @@ struct map_search *
map_search_new(struct map *m, struct item *item, struct attr *search_attr, int partial)
{
struct map_search *this_;
- dbg(1,"enter(%p,%p,%p,%d)\n", m, item, search_attr, partial);
- dbg(1,"0x%x 0x%x 0x%x\n", attr_country_all, search_attr->type, attr_country_name);
+ dbg(lvl_warning,"enter(%p,%p,%p,%d)\n", m, item, search_attr, partial);
+ dbg(lvl_warning,"0x%x 0x%x 0x%x\n", attr_country_all, search_attr->type, attr_country_name);
this_=g_new0(struct map_search,1);
this_->m=m;
this_->search_attr=*search_attr;
@@ -712,7 +712,7 @@ map_dump_file(struct map *map, const char *file)
map_dump_filedesc(map, f);
fclose(f);
} else
- dbg(0,"failed to open file '%s'\n",file);
+ dbg(lvl_error,"failed to open file '%s'\n",file);
}
void
diff --git a/navit/map/binfile/binfile.c b/navit/map/binfile/binfile.c
index c5e283cd8..1abc14c23 100644
--- a/navit/map/binfile/binfile.c
+++ b/navit/map/binfile/binfile.c
@@ -241,9 +241,9 @@ binfile_read_eoc(struct file *fi)
eoc=(struct zip_eoc *)file_data_read(fi,fi->size-sizeof(struct zip_eoc), sizeof(struct zip_eoc));
if (eoc) {
eoc_to_cpu(eoc);
- dbg(1,"sig 0x%x\n", eoc->zipesig);
+ dbg(lvl_warning,"sig 0x%x\n", eoc->zipesig);
if (eoc->zipesig != zip_eoc_sig) {
- dbg(0,"eoc signature check failed: 0x%x vs 0x%x\n",eoc->zipesig,zip_eoc_sig);
+ dbg(lvl_error,"eoc signature check failed: 0x%x vs 0x%x\n",eoc->zipesig,zip_eoc_sig);
file_data_free(fi,(unsigned char *)eoc);
eoc=NULL;
}
@@ -259,20 +259,20 @@ binfile_read_eoc64(struct file *fi)
eocl=(struct zip64_eocl *)file_data_read(fi,fi->size-sizeof(struct zip_eoc)-sizeof(struct zip64_eocl), sizeof(struct zip64_eocl));
if (!eocl)
return NULL;
- dbg(1,"sig 0x%x\n", eocl->zip64lsig);
+ dbg(lvl_warning,"sig 0x%x\n", eocl->zip64lsig);
if (eocl->zip64lsig != zip64_eocl_sig) {
file_data_free(fi,(unsigned char *)eocl);
- dbg(1,"eocl wrong\n");
+ dbg(lvl_warning,"eocl wrong\n");
return NULL;
}
eoc=(struct zip64_eoc *)file_data_read(fi,eocl->zip64lofst, sizeof(struct zip64_eoc));
if (eoc) {
if (eoc->zip64esig != zip64_eoc_sig) {
file_data_free(fi,(unsigned char *)eoc);
- dbg(1,"eoc wrong\n");
+ dbg(lvl_warning,"eoc wrong\n");
eoc=NULL;
}
- dbg(1,"eoc64 ok 0x"LONGLONG_HEX_FMT " 0x"LONGLONG_HEX_FMT "\n",eoc->zip64eofst,eoc->zip64ecsz);
+ dbg(lvl_warning,"eoc64 ok 0x"LONGLONG_HEX_FMT " 0x"LONGLONG_HEX_FMT "\n",eoc->zip64eofst,eoc->zip64ecsz);
}
file_data_free(fi,(unsigned char *)eocl);
return eoc;
@@ -297,9 +297,9 @@ binfile_read_cd(struct map_priv *m, int offset, int len)
}
cd=(struct zip_cd *)file_data_read(m->fi,cdoffset+offset, sizeof(*cd)+len);
if (cd) {
- dbg(1,"cd at "LONGLONG_FMT" %zu bytes\n",cdoffset+offset, sizeof(*cd)+len);
+ dbg(lvl_warning,"cd at "LONGLONG_FMT" %zu bytes\n",cdoffset+offset, sizeof(*cd)+len);
cd_to_cpu(cd);
- dbg(1,"sig 0x%x\n", cd->zipcensig);
+ dbg(lvl_warning,"sig 0x%x\n", cd->zipcensig);
if (cd->zipcensig != zip_cd_sig) {
file_data_free(m->fi,(unsigned char *)cd);
cd=NULL;
@@ -389,12 +389,12 @@ binfile_read_content(struct map_priv *m, struct file *fi, long long offset, stru
ret=file_data_read_encrypted(fi, offset, lfh->zipsize, lfh->zipuncmp, 1, m->passwd);
break;
default:
- dbg(0,"Unknown encrypted compression method %d\n",enc->compress_method);
+ dbg(lvl_error,"Unknown encrypted compression method %d\n",enc->compress_method);
}
file_data_free(fi, (unsigned char *)enc);
break;
default:
- dbg(0,"Unknown compression method %d\n", lfh->zipmthd);
+ dbg(lvl_error,"Unknown compression method %d\n", lfh->zipmthd);
}
return ret;
}
@@ -408,7 +408,7 @@ binfile_search_cd(struct map_priv *m, int offset, char *name, int partial, int s
long long cdoffset=m->eoc64?m->eoc64->zip64eofst:m->eoc->zipeofst;
struct zip_cd *cd;
#if 0
- dbg(0,"end=%d\n",end);
+ dbg(lvl_error,"end=%d\n",end);
#endif
while (offset < end) {
cd=(struct zip_cd *)(m->search_data+offset-m->search_offset);
@@ -418,7 +418,7 @@ binfile_search_cd(struct map_priv *m, int offset, char *name, int partial, int s
offset-m->search_offset+sizeof(*cd)+cd->zipcfnl+cd->zipcxtl > m->search_size
) {
#if 0
- dbg(0,"reload %p %d %d\n", m->search_data, m->search_offset, offset);
+ dbg(lvl_error,"reload %p %d %d\n", m->search_data, m->search_offset, offset);
#endif
if (m->search_data)
file_data_free(m->fi,m->search_data);
@@ -430,8 +430,8 @@ binfile_search_cd(struct map_priv *m, int offset, char *name, int partial, int s
cd=(struct zip_cd *)m->search_data;
}
#if 0
- dbg(0,"offset=%d search_offset=%d search_size=%d search_data=%p cd=%p\n", offset, m->search_offset, m->search_size, m->search_data, cd);
- dbg(0,"offset=%d fn='%s'\n",offset,cd->zipcfn);
+ dbg(lvl_error,"offset=%d search_offset=%d search_size=%d search_data=%p cd=%p\n", offset, m->search_offset, m->search_size, m->search_data, cd);
+ dbg(lvl_error,"offset=%d fn='%s'\n",offset,cd->zipcfn);
#endif
if (!skip &&
(partial || cd->zipcfnl == len) &&
@@ -447,7 +447,7 @@ binfile_search_cd(struct map_priv *m, int offset, char *name, int partial, int s
static void
map_destroy_binfile(struct map_priv *m)
{
- dbg(1,"map_destroy_binfile\n");
+ dbg(lvl_warning,"map_destroy_binfile\n");
if (m->fi)
map_binfile_close(m);
map_binfile_destroy(m);
@@ -542,7 +542,7 @@ binfile_extract(struct map_priv *m, char *dir, char *filename, int partial)
if (full[len-2] != '/') {
lfh=binfile_read_lfh(m->fi, binfile_cd_offset(cd));
start=binfile_read_content(m, m->fi, binfile_cd_offset(cd), lfh);
- dbg(0,"fopen '%s'\n", full);
+ dbg(lvl_error,"fopen '%s'\n", full);
f=fopen(full,"w");
fwrite(start, lfh->zipuncmp, 1, f);
fclose(f);
@@ -588,7 +588,7 @@ binfile_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
mr->label_attr[4]=t->pos_attr;
if (type == attr_type || attr_type == attr_any) {
if (attr_type == attr_any) {
- dbg(1,"pos %p attr %s size %d\n", t->pos_attr-1, attr_to_name(type), size);
+ dbg(lvl_warning,"pos %p attr %s size %d\n", t->pos_attr-1, attr_to_name(type), size);
}
attr->type=type;
if (ATTR_IS_GROUP(type)) {
@@ -666,13 +666,13 @@ binfile_item_dup(struct map_priv *m, struct item *item, struct tile *t, int exte
entry->id.id_hi=item->id_hi;
entry->id.id_lo=item->id_lo;
entry->flags=1;
- dbg(0,"id 0x%x,0x%x\n",entry->id.id_hi,entry->id.id_lo);
+ dbg(lvl_error,"id 0x%x,0x%x\n",entry->id.id_hi,entry->id.id_lo);
memcpy(ret, t->pos, (size+1)*sizeof(int));
if (!m->changes)
m->changes=g_hash_table_new_full(binfile_hash_entry_hash, binfile_hash_entry_equal, g_free, NULL);
g_hash_table_replace(m->changes, entry, entry);
- dbg(0,"ret %p\n",ret);
+ dbg(lvl_error,"ret %p\n",ret);
return ret;
}
@@ -687,15 +687,15 @@ binfile_coord_set(void *priv_data, struct coord *c, int count, enum change_mode
{
int *i=t->pos,j=0;
- dbg(0,"Before: pos_coord=%td\n",t->pos_coord-i);
+ dbg(lvl_error,"Before: pos_coord=%td\n",t->pos_coord-i);
while (i < t->pos_next)
- dbg(0,"%d:0x%x\n",j++,*i++);
+ dbg(lvl_error,"%d:0x%x\n",j++,*i++);
}
aoffset=t->pos_attr-t->pos_attr_start;
coffset=t->pos_coord-t->pos_coord_start-2;
clen=t->pos_attr_start-t->pos_coord+2;
- dbg(0,"coffset=%d clen=%d\n",coffset,clen);
+ dbg(lvl_error,"coffset=%d clen=%d\n",coffset,clen);
switch (mode) {
case change_mode_delete:
if (count*2 > clen)
@@ -732,7 +732,7 @@ binfile_coord_set(void *priv_data, struct coord *c, int count, enum change_mode
default:
return 0;
}
- dbg(0,"delta %d\n",delta);
+ dbg(lvl_error,"delta %d\n",delta);
data=binfile_item_dup(mr->m, &mr->item, t, delta > 0 ? delta:0);
data[0]=cpu_to_le32(le32_to_cpu(data[0])+delta);
data[2]=cpu_to_le32(le32_to_cpu(data[2])+delta);
@@ -744,18 +744,18 @@ binfile_coord_set(void *priv_data, struct coord *c, int count, enum change_mode
tn=mr->t;
tn->pos_coord=tn->pos_coord_start+coffset;
tn->pos_attr=tn->pos_attr_start+aoffset;
- dbg(0,"moving %d ints from offset %td to %td\n",move_len,tn->pos_coord_start+move_offset-data,tn->pos_coord_start+move_offset+delta-data);
+ dbg(lvl_error,"moving %d ints from offset %td to %td\n",move_len,tn->pos_coord_start+move_offset-data,tn->pos_coord_start+move_offset+delta-data);
memmove(tn->pos_coord_start+move_offset+delta, tn->pos_coord_start+move_offset, move_len*4);
{
int *i=tn->pos,j=0;
- dbg(0,"After move: pos_coord=%td\n",tn->pos_coord-i);
+ dbg(lvl_error,"After move: pos_coord=%td\n",tn->pos_coord-i);
while (i < tn->pos_next)
- dbg(0,"%d:0x%x\n",j++,*i++);
+ dbg(lvl_error,"%d:0x%x\n",j++,*i++);
}
if (mode != change_mode_append)
tn->pos_coord+=move_offset;
if (mode != change_mode_delete) {
- dbg(0,"writing %d ints at offset %td\n",count*2,write_offset+tn->pos_coord_start-data);
+ dbg(lvl_error,"writing %d ints at offset %td\n",count*2,write_offset+tn->pos_coord_start-data);
for (i = 0 ; i < count ; i++) {
tn->pos_coord_start[write_offset++]=c[i].x;
tn->pos_coord_start[write_offset++]=c[i].y;
@@ -764,9 +764,9 @@ binfile_coord_set(void *priv_data, struct coord *c, int count, enum change_mode
}
{
int *i=tn->pos,j=0;
- dbg(0,"After: pos_coord=%td\n",tn->pos_coord-i);
+ dbg(lvl_error,"After: pos_coord=%td\n",tn->pos_coord-i);
while (i < tn->pos_next)
- dbg(0,"%d:0x%x\n",j++,*i++);
+ dbg(lvl_error,"%d:0x%x\n",j++,*i++);
}
return 1;
}
@@ -783,9 +783,9 @@ binfile_attr_set(void *priv_data, struct attr *attr, enum change_mode mode)
{
int *i=t->pos,j=0;
- dbg(0,"Before: pos_attr=%td\n",t->pos_attr-i);
+ dbg(lvl_error,"Before: pos_attr=%td\n",t->pos_attr-i);
while (i < t->pos_next)
- dbg(0,"%d:0x%x\n",j++,*i++);
+ dbg(lvl_error,"%d:0x%x\n",j++,*i++);
}
@@ -796,7 +796,7 @@ binfile_attr_set(void *priv_data, struct attr *attr, enum change_mode mode)
oattr_len=0;
if (!naoffset) {
if (mode == change_mode_delete || mode == change_mode_modify) {
- dbg(0,"no attribute selected\n");
+ dbg(lvl_error,"no attribute selected\n");
return 0;
}
if (mode == change_mode_append)
@@ -804,7 +804,7 @@ binfile_attr_set(void *priv_data, struct attr *attr, enum change_mode mode)
}
while (offset < naoffset) {
oattr_len=le32_to_cpu(t->pos_attr_start[offset])+1;
- dbg(0,"len %d\n",oattr_len);
+ dbg(lvl_error,"len %d\n",oattr_len);
write_offset=offset;
offset+=oattr_len;
}
@@ -837,7 +837,7 @@ binfile_attr_set(void *priv_data, struct attr *attr, enum change_mode mode)
delta=nattr_len-oattr_len;
else
delta=nattr_len;
- dbg(0,"delta %d oattr_len %d nattr_len %d\n",delta,oattr_len, nattr_len);
+ dbg(lvl_error,"delta %d oattr_len %d nattr_len %d\n",delta,oattr_len, nattr_len);
data=binfile_item_dup(mr->m, &mr->item, t, delta > 0 ? delta:0);
data[0]=cpu_to_le32(le32_to_cpu(data[0])+delta);
new.pos=new.start=data;
@@ -848,20 +848,20 @@ binfile_attr_set(void *priv_data, struct attr *attr, enum change_mode mode)
tn=mr->t;
tn->pos_coord=tn->pos_coord_start+coffset;
tn->pos_attr=tn->pos_attr_start+offset;
- dbg(0,"attr start %td offset %d\n",tn->pos_attr_start-data,offset);
- dbg(0,"moving %d ints from offset %td to %td\n",move_len,tn->pos_attr_start+move_offset-data,tn->pos_attr_start+move_offset+delta-data);
+ dbg(lvl_error,"attr start %td offset %d\n",tn->pos_attr_start-data,offset);
+ dbg(lvl_error,"moving %d ints from offset %td to %td\n",move_len,tn->pos_attr_start+move_offset-data,tn->pos_attr_start+move_offset+delta-data);
memmove(tn->pos_attr_start+move_offset+delta, tn->pos_attr_start+move_offset, move_len*4);
if (mode != change_mode_append)
tn->pos_attr+=delta;
{
int *i=tn->pos,j=0;
- dbg(0,"After move: pos_attr=%td\n",tn->pos_attr-i);
+ dbg(lvl_error,"After move: pos_attr=%td\n",tn->pos_attr-i);
while (i < tn->pos_next)
- dbg(0,"%d:0x%x\n",j++,*i++);
+ dbg(lvl_error,"%d:0x%x\n",j++,*i++);
}
if (nattr_len) {
int *nattr=tn->pos_attr_start+write_offset;
- dbg(0,"writing %d ints at %td\n",nattr_len,nattr-data);
+ dbg(lvl_error,"writing %d ints at %td\n",nattr_len,nattr-data);
nattr[0]=cpu_to_le32(nattr_len-1);
nattr[1]=cpu_to_le32(attr->type);
memcpy(nattr+2, attr_data_get(attr), nattr_size);
@@ -869,11 +869,11 @@ binfile_attr_set(void *priv_data, struct attr *attr, enum change_mode mode)
}
{
int *i=tn->pos,j=0;
- dbg(0,"After: pos_attr=%td\n",tn->pos_attr-i);
+ dbg(lvl_error,"After: pos_attr=%td\n",tn->pos_attr-i);
while (i < tn->pos_next)
- dbg(0,"After: pos_attr=%td\n",tn->pos_attr-i);
+ dbg(lvl_error,"After: pos_attr=%td\n",tn->pos_attr-i);
while (i < tn->pos_next)
- dbg(0,"%d:0x%x\n",j++,*i++);
+ dbg(lvl_error,"%d:0x%x\n",j++,*i++);
}
return 1;
}
@@ -910,7 +910,7 @@ pop_tile(struct map_rect_priv *mr)
file_data_free(mr->m->fi, (unsigned char *)(mr->t->start));
#ifdef DEBUG_SIZE
#if DEBUG_SIZE > 0
- dbg(0,"leave %d\n",mr->t->zipfile_num);
+ dbg(lvl_error,"leave %d\n",mr->t->zipfile_num);
#endif
#endif
mr->t=&mr->tiles[--mr->tile_depth-1];
@@ -925,8 +925,8 @@ zipfile_to_tile(struct map_priv *m, struct zip_cd *cd, struct tile *t)
struct zip_lfh *lfh;
char *zipfn;
struct file *fi;
- dbg(1,"enter %p %p %p\n", m, cd, t);
- dbg(1,"cd->zipofst=0x"LONGLONG_HEX_FMT "\n", binfile_cd_offset(cd));
+ dbg(lvl_warning,"enter %p %p %p\n", m, cd, t);
+ dbg(lvl_warning,"cd->zipofst=0x"LONGLONG_HEX_FMT "\n", binfile_cd_offset(cd));
t->start=NULL;
t->mode=1;
if (m->fis)
@@ -957,7 +957,7 @@ map_binfile_handle_redirect(struct map_priv *m)
if (m->redirect)
return 0;
m->redirect=1;
- dbg(0,"redirected from %s to %s\n",m->url,location);
+ dbg(lvl_error,"redirected from %s to %s\n",m->url,location);
g_free(m->url);
m->url=g_strdup(location);
file_destroy(m->http);
@@ -1006,7 +1006,7 @@ map_binfile_download_size(struct map_priv *m)
} while (map_binfile_handle_redirect(m));
ret=file_size(m->http);
- dbg(1,"file size "LONGLONG_FMT"\n",ret);
+ dbg(lvl_warning,"file size "LONGLONG_FMT"\n",ret);
return ret;
}
@@ -1052,7 +1052,7 @@ map_binfile_download_range(struct map_priv *m, long long offset, int size)
ret=file_data_read_special(http, size, &size_ret);
if (size_ret != size) {
- dbg(0,"size %d vs %d\n",size,size_ret);
+ dbg(lvl_error,"size %d vs %d\n",size,size_ret);
g_free(ret);
return NULL;
}
@@ -1066,7 +1066,7 @@ download_cd(struct map_download *download)
struct zip64_eoc *zip64_eoc=(struct zip64_eoc *)file_data_read(m->fi, 0, sizeof(*zip64_eoc));
struct zip_cd *cd=(struct zip_cd *)map_binfile_download_range(m, zip64_eoc->zip64eofst+download->zipfile*m->cde_size,m->cde_size);
file_data_free(m->fi, (unsigned char *)zip64_eoc);
- dbg(0,"needed cd, result %p\n",cd);
+ dbg(lvl_error,"needed cd, result %p\n",cd);
return cd;
}
@@ -1080,7 +1080,7 @@ download_request(struct map_download *download)
if(!download->m->download_enabled)
{
- dbg(0,"Tried downloading while it's not allowed\n");
+ dbg(lvl_error,"Tried downloading while it's not allowed\n");
return 0;
}
attrs[0]=&url;
@@ -1099,7 +1099,7 @@ download_request(struct map_download *download)
attrs[3]=NULL;
download->dl_size=size;
}
- dbg(0,"encountered missing tile %d %s(%s), Downloading %d bytes at "LONGLONG_FMT"\n",download->zipfile, url.u.str,(char *)(download->cd_copy+1), download->dl_size, download->offset);
+ dbg(lvl_error,"encountered missing tile %d %s(%s), Downloading %d bytes at "LONGLONG_FMT"\n",download->zipfile, url.u.str,(char *)(download->cd_copy+1), download->dl_size, download->offset);
map_binfile_http_request(download->m, attrs);
g_free(url.u.str);
download->http=download->m->http;
@@ -1147,7 +1147,7 @@ download_download(struct map_download *download)
return 0;
}
- dbg(1,"got %d bytes writing at offset "LONGLONG_FMT"\n",size_ret,download->offset);
+ dbg(lvl_warning,"got %d bytes writing at offset "LONGLONG_FMT"\n",size_ret,download->offset);
if (size_ret <= 0) {
g_free(data);
return 1;
@@ -1189,7 +1189,7 @@ download_finish(struct map_download *download)
g_free(download->cd_copy);
download->cd=(struct zip_cd *)(file_data_read(download->file, download->m->eoc->zipeofst + download->zipfile*download->m->cde_size, download->m->cde_size));
cd_to_cpu(download->cd);
- dbg(1,"Offset %d\n",download->cd->zipofst);
+ dbg(lvl_warning,"Offset %d\n",download->cd->zipofst);
return 1;
}
@@ -1197,7 +1197,7 @@ static int
download_planet_size(struct map_download *download)
{
download->size=map_binfile_download_size(download->m);
- dbg(0,"Planet size "LONGLONG_FMT"\n",download->size);
+ dbg(lvl_error,"Planet size "LONGLONG_FMT"\n",download->size);
if (!download->size)
return 0;
return 1;
@@ -1213,7 +1213,7 @@ download_eoc(struct map_download *download)
download->zip_eoc=(struct zip_eoc *)(download->zip64_eocl+1);
if (download->zip64_eoc->zip64esig != zip64_eoc_sig || download->zip64_eocl->zip64lsig != zip64_eocl_sig || download->zip_eoc->zipesig != zip_eoc_sig)
{
- dbg(0,"wrong signature on zip64_eoc downloaded from "LONGLONG_FMT"\n",download->size-98);
+ dbg(lvl_error,"wrong signature on zip64_eoc downloaded from "LONGLONG_FMT"\n",download->size-98);
g_free(download->zip64_eoc);
return 0;
}
@@ -1240,11 +1240,11 @@ download_directory_do(struct map_download *download)
struct zip_cd *cd;
cd=(struct zip_cd *)file_data_read_special(download->http, sizeof(*cd), &size_ret);
cd->zipcunc=0;
- dbg(1,"size_ret=%d\n",size_ret);
+ dbg(lvl_warning,"size_ret=%d\n",size_ret);
if (!size_ret)
return 0;
if (size_ret != sizeof(*cd) || cd->zipcensig != zip_cd_sig) {
- dbg(0,"error1 size=%d vs %zu\n",size_ret, sizeof(*cd));
+ dbg(lvl_error,"error1 size=%d vs %zu\n",size_ret, sizeof(*cd));
return 0;
}
file_data_write(download->file, download->offset, sizeof(*cd), (unsigned char *)cd);
@@ -1252,7 +1252,7 @@ download_directory_do(struct map_download *download)
cd_xlen=cd->zipcfnl+cd->zipcxtl;
cd_data=file_data_read_special(download->http, cd_xlen, &size_ret);
if (size_ret != cd_xlen) {
- dbg(0,"error2 size=%d vs %d\n",size_ret,cd_xlen);
+ dbg(lvl_error,"error2 size=%d vs %d\n",size_ret,cd_xlen);
return 0;
}
file_data_write(download->file, download->offset, cd_xlen, cd_data);
@@ -1297,14 +1297,14 @@ push_zipfile_tile_do(struct map_rect_priv *mr, struct zip_cd *cd, int zipfile, i
struct map_priv *m=mr->m;
struct file *f=m->fi;
- dbg(1,"enter %p %d\n", mr, zipfile);
+ dbg(lvl_warning,"enter %p %d\n", mr, zipfile);
#ifdef DEBUG_SIZE
#if DEBUG_SIZE > 0
{
char filename[cd->zipcfnl+1];
memcpy(filename, cd+1, cd->zipcfnl);
filename[cd->zipcfnl]='\0';
- dbg(0,"enter %d (%s) %d\n",zipfile, filename, cd->zipcunc);
+ dbg(lvl_error,"enter %d (%s) %d\n",zipfile, filename, cd->zipcunc);
}
#endif
mr->size+=cd->zipcunc;
@@ -1360,10 +1360,10 @@ download(struct map_priv *m, struct map_rect_priv *mr, struct zip_cd *cd, int zi
return NULL;
}
for (;;) {
- dbg(0,"state=%d\n",download->state);
+ dbg(lvl_error,"state=%d\n",download->state);
switch (download->state) {
case 0:
- dbg(0,"error\n");
+ dbg(lvl_error,"error\n");
break;
case 1:
if (download_start(download))
@@ -1413,7 +1413,7 @@ download(struct map_priv *m, struct map_rect_priv *mr, struct zip_cd *cd, int zi
if (download_eoc(download))
download->state=6;
else {
- dbg(0,"download of eoc failed\n");
+ dbg(lvl_error,"download of eoc failed\n");
download->state=0;
}
break;
@@ -1462,7 +1462,7 @@ push_zipfile_tile(struct map_rect_priv *mr, int zipfile, int offset, int length,
struct file *f=m->fi;
long long cdoffset=m->eoc64?m->eoc64->zip64eofst:m->eoc->zipeofst;
struct zip_cd *cd=(struct zip_cd *)(file_data_read(f, cdoffset + zipfile*m->cde_size, m->cde_size));
- dbg(1,"read from "LONGLONG_FMT" %d bytes\n",cdoffset + zipfile*m->cde_size, m->cde_size);
+ dbg(lvl_warning,"read from "LONGLONG_FMT" %d bytes\n",cdoffset + zipfile*m->cde_size, m->cde_size);
cd_to_cpu(cd);
if (!cd->zipcunc && m->url) {
cd=download(m, mr, cd, zipfile, offset, length, async);
@@ -1479,7 +1479,7 @@ map_rect_new_binfile_int(struct map_priv *map, struct map_selection *sel)
struct map_rect_priv *mr;
binfile_check_version(map);
- dbg(1,"map_rect_new_binfile\n");
+ dbg(lvl_warning,"map_rect_new_binfile\n");
if (!map->fi && !map->url)
return NULL;
map_binfile_http_close(map);
@@ -1567,7 +1567,7 @@ map_rect_new_binfile(struct map_priv *map, struct map_selection *sel)
{
struct map_rect_priv *mr=map_rect_new_binfile_int(map, sel);
struct tile t;
- dbg(1,"zip_members=%d\n", map->zip_members);
+ dbg(lvl_warning,"zip_members=%d\n", map->zip_members);
if (map->url && map->fi && sel && sel->order == 255) {
map_download_selection(map, mr, sel);
}
@@ -1599,7 +1599,7 @@ write_changes_do(gpointer key, gpointer value, gpointer user_data)
if (entry->flags) {
entry->flags=0;
fwrite(entry, sizeof(*entry)+(le32_to_cpu(entry->data[0])+1)*4, 1, out);
- dbg(0,"yes\n");
+ dbg(lvl_error,"yes\n");
}
}
@@ -1652,7 +1652,7 @@ map_rect_destroy_binfile(struct map_rect_priv *mr)
write_changes(mr->m);
while (pop_tile(mr));
#ifdef DEBUG_SIZE
- dbg(0,"size=%d kb\n",mr->size/1024);
+ dbg(lvl_error,"size=%d kb\n",mr->size/1024);
#endif
if (mr->tiles[0].fi && mr->tiles[0].start)
file_data_free(mr->tiles[0].fi, (unsigned char *)(mr->tiles[0].start));
@@ -1668,11 +1668,11 @@ setup_pos(struct map_rect_priv *mr)
struct tile *t=mr->t;
size=le32_to_cpu(t->pos[0]);
if (size > 1024*1024 || size < 0) {
- dbg(0,"size=0x%x\n", size);
+ dbg(lvl_error,"size=0x%x\n", size);
#if 0
fprintf(stderr,"offset=%d\n", (unsigned char *)(mr->pos)-mr->m->f->begin);
#endif
- dbg(0,"size error\n");
+ dbg(lvl_error,"size error\n");
}
t->pos_next=t->pos+size+1;
mr->item.type=le32_to_cpu(t->pos[1]);
@@ -1690,7 +1690,7 @@ selection_contains(struct map_selection *sel, struct coord_rect *r, struct range
while (sel) {
if (coord_rect_overlap(r, &sel->u.c_rect)) {
order=sel->order;
- dbg(1,"min %d max %d order %d\n", mima->min, mima->max, order);
+ dbg(lvl_warning,"min %d max %d order %d\n", mima->min, mima->max, order);
if (!mima->min && !mima->max)
return 1;
if (order >= mima->min && order <= mima->max)
@@ -1722,13 +1722,13 @@ map_parse_country_binfile(struct map_rect_priv *mr)
struct attr af, al;
if(binfile_attr_get(mr->item.priv_data, attr_first_key, &af)) {
if(linguistics_compare(af.u.str,search->u.str,linguistics_cmp_partial)>0) {
- dbg(1,"Skipping index item with first_key='%s'\n", af.u.str);
+ dbg(lvl_warning,"Skipping index item with first_key='%s'\n", af.u.str);
return;
}
}
if(binfile_attr_get(mr->item.priv_data, attr_last_key, &al)) {
if(linguistics_compare(al.u.str,search->u.str,linguistics_cmp_partial)<0) {
- dbg(1,"Skipping index item with first_key='%s', last_key='%s'\n", af.u.str, al.u.str);
+ dbg(lvl_warning,"Skipping index item with first_key='%s', last_key='%s'\n", af.u.str, al.u.str);
return;
}
}
@@ -1763,7 +1763,7 @@ map_parse_submap(struct map_rect_priv *mr, int async)
return 0;
if (!binfile_attr_get(mr->item.priv_data, attr_zipfile_ref, &at))
return 0;
- dbg(1,"pushing zipfile %ld from %d\n", at.u.num, mr->t->zipfile_num);
+ dbg(lvl_warning,"pushing zipfile %ld from %d\n", at.u.num, mr->t->zipfile_num);
return push_zipfile_tile(mr, at.u.num, 0, 0, async);
}
@@ -2108,7 +2108,7 @@ binmap_search_new(struct map_priv *map, struct item *item, struct attr *search,
map_rect_destroy_binfile(map_rec);
break;
case attr_house_number:
- dbg(1,"case house_number");
+ dbg(lvl_warning,"case house_number");
if (! item->map)
break;
if (!map_priv_is(item->map, map))
@@ -2131,12 +2131,12 @@ binmap_search_new(struct map_priv *map, struct item *item, struct attr *search,
msp->mr = binmap_search_street_by_place(map, town, &c, &msp->ms, &msp->boundaries);
map_rect_destroy_binfile(map_rec);
if (msp->boundaries)
- dbg(0, "using map town boundaries\n");
+ dbg(lvl_error, "using map town boundaries\n");
if (!msp->boundaries && town)
{
binmap_get_estimated_boundaries(town, &msp->boundaries);
if (msp->boundaries)
- dbg(0, "using estimated boundaries\n");
+ dbg(lvl_error, "using estimated boundaries\n");
}
/* start searching in area around the street segment even if town boundaries are available */
msp->mr=binmap_search_housenumber_by_estimate(map, &c, &msp->ms);
@@ -2144,7 +2144,7 @@ binmap_search_new(struct map_priv *map, struct item *item, struct attr *search,
msp->rect_new=msp->ms.u.c_rect;
if(item_attr_get(msp->item, attr_street_name, &attr))
msp->parent_name=g_strdup(attr.u.str);
- dbg(0,"pn=%s\n",msp->parent_name);
+ dbg(lvl_error,"pn=%s\n",msp->parent_name);
}
}
if (idx != 3) {
@@ -2432,7 +2432,7 @@ binmap_search_get_item(struct map_search_priv *map_search)
map_search->ms.u.c_rect=map_search->rect_new;
map_rect_destroy_binfile(map_search->mr);
map_search->mr=map_rect_new_binfile(map_search->map, &map_search->ms);
- dbg(0,"Extended house number search region to %d x %d, restarting...\n",map_search->ms.u.c_rect.rl.x - map_search->ms.u.c_rect.lu.x, map_search->ms.u.c_rect.lu.y-map_search->ms.u.c_rect.rl.y);
+ dbg(lvl_error,"Extended house number search region to %d x %d, restarting...\n",map_search->ms.u.c_rect.rl.x - map_search->ms.u.c_rect.lu.x, map_search->ms.u.c_rect.lu.y-map_search->ms.u.c_rect.rl.y);
continue;
}
}
@@ -2564,7 +2564,7 @@ map_binfile_zip_setup(struct map_priv *m, char *filename, int mmap)
struct zip_cd *first_cd;
int i;
if (!(m->eoc=binfile_read_eoc(m->fi))) {
- dbg(0,"unable to read eoc\n");
+ dbg(lvl_error,"unable to read eoc\n");
return 0;
}
dbg_assert(m->eoc->zipedsk == m->eoc->zipecen);
@@ -2580,20 +2580,20 @@ map_binfile_zip_setup(struct map_priv *m, char *filename, int mmap)
m->fis[m->eoc->zipedsk-1]=m->fi;
g_free(tmpfilename);
}
- dbg(1,"num_disk %d\n",m->eoc->zipedsk);
+ dbg(lvl_warning,"num_disk %d\n",m->eoc->zipedsk);
m->eoc64=binfile_read_eoc64(m->fi);
if (!binfile_get_index(m)) {
- dbg(0,"no index found\n");
+ dbg(lvl_error,"no index found\n");
return 0;
}
if (!(first_cd=binfile_read_cd(m, 0, 0))) {
- dbg(0,"unable to get first cd\n");
+ dbg(lvl_error,"unable to get first cd\n");
return 0;
}
m->cde_size=sizeof(struct zip_cd)+first_cd->zipcfnl+first_cd->zipcxtl;
m->zip_members=m->index_offset/m->cde_size+1;
- dbg(1,"cde_size %d\n", m->cde_size);
- dbg(1,"members %d\n",m->zip_members);
+ dbg(lvl_warning,"cde_size %d\n", m->cde_size);
+ dbg(lvl_warning,"members %d\n",m->zip_members);
file_data_free(m->fi, (unsigned char *)first_cd);
if (mmap)
file_mmap(m->fi);
@@ -2692,12 +2692,12 @@ map_binfile_open(struct map_priv *m)
struct attr readwrite={attr_readwrite, {(void *)1}};
struct attr *attrs[]={&readwrite, NULL};
- dbg(1,"file_create %s\n", m->filename);
+ dbg(lvl_warning,"file_create %s\n", m->filename);
m->fi=file_create(m->filename, m->url?attrs:NULL);
if (! m->fi && m->url)
return 0;
if (! m->fi) {
- dbg(0,"Failed to load '%s'\n", m->filename);
+ dbg(lvl_error,"Failed to load '%s'\n", m->filename);
return 0;
}
if (m->check_version)
@@ -2711,13 +2711,13 @@ map_binfile_open(struct map_priv *m)
*magic = le32_to_cpu(*magic);
if (*magic == zip_lfh_sig || *magic == zip_split_sig || *magic == zip_cd_sig || *magic == zip64_eoc_sig) {
if (!map_binfile_zip_setup(m, m->filename, m->flags & 1)) {
- dbg(0,"invalid file format for '%s'\n", m->filename);
+ dbg(lvl_error,"invalid file format for '%s'\n", m->filename);
file_destroy(m->fi);
m->fi=NULL;
return 0;
}
} else if (*magic == zip_lfh_sig_rev || *magic == zip_split_sig_rev || *magic == zip_cd_sig_rev || *magic == zip64_eoc_sig_rev) {
- dbg(0,"endianness mismatch\n");
+ dbg(lvl_error,"endianness mismatch\n");
file_destroy(m->fi);
m->fi=NULL;
return 0;
@@ -2735,7 +2735,7 @@ map_binfile_open(struct map_priv *m)
if (binfile_attr_get(item->priv_data, attr_map_release, &attr))
m->map_release=g_strdup(attr.u.str);
if (m->url && binfile_attr_get(item->priv_data, attr_url, &attr)) {
- dbg(0,"url config %s map %s\n",m->url,attr.u.str);
+ dbg(lvl_error,"url config %s map %s\n",m->url,attr.u.str);
if (strcmp(m->url, attr.u.str))
m->update_available=1;
g_free(m->url);
@@ -2744,7 +2744,7 @@ map_binfile_open(struct map_priv *m)
}
map_rect_destroy_binfile(mr);
if (m->map_version >= 16) {
- dbg(0,"Warning: This map is incompatible with your navit version. Please update navit.\n");
+ dbg(lvl_error,"Warning: This map is incompatible with your navit version. Please update navit.\n");
return 0;
}
}
@@ -2807,7 +2807,7 @@ map_new_binfile(struct map_methods *meth, struct attr **attrs, struct callback_l
wexp=file_wordexp_new(data->u.str);
wexp_data=file_wordexp_get_array(wexp);
- dbg(1,"map_new_binfile %s\n", data->u.str);
+ dbg(lvl_warning,"map_new_binfile %s\n", data->u.str);
*meth=map_methods_binfile;
m=g_new0(struct map_priv, 1);
@@ -2843,9 +2843,9 @@ map_new_binfile(struct map_methods *meth, struct attr **attrs, struct callback_l
void
plugin_init(void)
{
- dbg(1,"binfile: plugin_init\n");
+ dbg(lvl_warning,"binfile: plugin_init\n");
if (sizeof(struct zip_cd) != 46) {
- dbg(0,"error: sizeof(struct zip_cd)=%zu\n",sizeof(struct zip_cd));
+ dbg(lvl_error,"error: sizeof(struct zip_cd)=%zu\n",sizeof(struct zip_cd));
}
plugin_register_map_type("binfile", map_new_binfile);
}
diff --git a/navit/map/csv/csv.c b/navit/map/csv/csv.c
index e8d7a9879..8cb677839 100644
--- a/navit/map/csv/csv.c
+++ b/navit/map/csv/csv.c
@@ -88,7 +88,7 @@ save_map_csv(struct map_priv *m)
struct quadtree_item *qitem;
if( ! (fp=fopen(filename,"w+"))) {
- dbg(0, "Error opening csv file to write new entries");
+ dbg(lvl_error, "Error opening csv file to write new entries");
return;
}
/*query the world*/
@@ -126,11 +126,11 @@ save_map_csv(struct map_priv *m)
} else if(ATTR_IS_STRING(*at)) {
tmpstr = g_strdup(found_attr->u.str);
} else {
- dbg(0,"Cant represent attribute %s\n",attr_to_name(*at));
+ dbg(lvl_error,"Cant represent attribute %s\n",attr_to_name(*at));
tmpstr=g_strdup("");
}
} else {
- dbg(0,"No value defined for the atribute %s, assuming empty string\n",attr_to_name(*at));
+ dbg(lvl_error,"No value defined for the atribute %s, assuming empty string\n",attr_to_name(*at));
tmpstr=g_strdup("");
}
}
@@ -149,7 +149,7 @@ save_map_csv(struct map_priv *m)
if(m->charset) {
tmpstr=g_convert(csv_line, -1,m->charset,"utf-8",NULL,NULL,NULL);
if(!tmpstr)
- dbg(0,"Error converting '%s' to %s\n",csv_line, m->charset);
+ dbg(lvl_error,"Error converting '%s' to %s\n",csv_line, m->charset);
} else
tmpstr=csv_line;
@@ -181,7 +181,7 @@ static const int zoom_max = 18;
static void
map_destroy_csv(struct map_priv *m)
{
- dbg(1,"map_destroy_csv\n");
+ dbg(lvl_warning,"map_destroy_csv\n");
/*save if changed */
save_map_csv(m);
g_hash_table_destroy(m->qitem_hash);
@@ -355,10 +355,10 @@ static int
csv_type_set(void *priv_data, enum item_type type)
{
struct map_rect_priv* mr = (struct map_rect_priv*)priv_data;
- dbg(1,"Enter %d\n", type);
+ dbg(lvl_warning,"Enter %d\n", type);
if(!mr || !mr->qitem) {
- dbg(1,"Nothing to do\n");
+ dbg(lvl_warning,"Nothing to do\n");
return 0;
}
@@ -366,7 +366,7 @@ csv_type_set(void *priv_data, enum item_type type)
return 0;
mr->qitem->deleted=1;
- dbg(1,"Item %p is deleted\n",mr->qitem);
+ dbg(lvl_warning,"Item %p is deleted\n",mr->qitem);
return 1;
}
@@ -395,7 +395,7 @@ csv_coord_set(void *priv_data, struct coord *c, int count, enum change_mode mode
struct map_priv* m;
struct quadtree_item* qi;
GList* new_it;
- dbg(1,"Set coordinates %d %d\n", c->x, c->y);
+ dbg(lvl_warning,"Set coordinates %d %d\n", c->x, c->y);
/* for now we only support coord modification only */
if( ! change_mode_modify) {
@@ -430,7 +430,7 @@ csv_coord_set(void *priv_data, struct coord *c, int count, enum change_mode mode
qi->longitude = cg.lng;
qi->latitude = cg.lat;
quadtree_add( m->tree_root, qi, mr->qiter);
- dbg(1,"Set coordinates %f %f\n", cg.lng, cg.lat);
+ dbg(lvl_warning,"Set coordinates %f %f\n", cg.lng, cg.lat);
m->new_items = g_list_remove_link(m->new_items,new_it);
m->dirty=1;
save_map_csv(m);
@@ -493,11 +493,11 @@ static void map_csv_debug_dump_hash_item(gpointer key, gpointer value, gpointer
{
struct quadtree_item *qi=value;
GList *attrs;
- dbg(3,"%p del=%d ref=%d\n", qi,qi->deleted, qi->ref_count);
+ dbg(lvl_debug,"%p del=%d ref=%d\n", qi,qi->deleted, qi->ref_count);
attrs=((struct quadtree_data *)qi->data)->attr_list;
while(attrs) {
if(((struct attr*)attrs->data)->type==attr_label)
- dbg(3,"... %s\n",((struct attr*)attrs->data)->u.str);
+ dbg(lvl_debug,"... %s\n",((struct attr*)attrs->data)->u.str);
attrs=g_list_next(attrs);
}
}
@@ -518,7 +518,7 @@ map_rect_new_csv(struct map_priv *map, struct map_selection *sel)
struct coord_geo lu;
struct coord_geo rl;
struct quadtree_iter *res = NULL;
- dbg(1,"map_rect_new_csv\n");
+ dbg(lvl_warning,"map_rect_new_csv\n");
if(debug_level_get("map_csv")>2) {
map_csv_debug_dump(map);
}
@@ -725,7 +725,7 @@ map_new_csv(struct map_methods *meth, struct attr **attrs, struct callback_list
charset = attr_search(attrs, NULL, attr_charset);
if(charset) {
- dbg(1,"charset:%s\n",charset->u.str);
+ dbg(lvl_warning,"charset:%s\n",charset->u.str);
m->charset=g_strdup(charset->u.str);
} else {
m->charset=g_strdup(map_methods_csv.charset);
@@ -757,7 +757,7 @@ map_new_csv(struct map_methods *meth, struct attr **attrs, struct callback_list
FILE *fp;
wexp=file_wordexp_new(data->u.str);
wexp_data=file_wordexp_get_array(wexp);
- dbg(1,"map_new_csv %s\n", data->u.str);
+ dbg(lvl_warning,"map_new_csv %s\n", data->u.str);
m->filename=g_strdup(wexp_data[0]);
file_wordexp_destroy(wexp);
@@ -774,7 +774,7 @@ map_new_csv(struct map_methods *meth, struct attr **attrs, struct callback_list
int col_cnt=0;
char *tok;
if(!line) {
- dbg(0,"Error converting '%s' to utf-8 from %s\n",linebuf, m->charset);
+ dbg(lvl_error,"Error converting '%s' to utf-8 from %s\n",linebuf, m->charset);
continue;
}
if(line[strlen(line)-1]=='\n' || line[strlen(line)-1]=='\r') {
@@ -847,7 +847,7 @@ map_new_csv(struct map_methods *meth, struct attr **attrs, struct callback_list
*pID = m->next_item_idx;
g_hash_table_insert(m->qitem_hash, pID,qi);
++m->next_item_idx;
- dbg(1,"%s\n",line);
+ dbg(lvl_warning,"%s\n",line);
}
else {
g_free(curr_item);
@@ -855,7 +855,7 @@ map_new_csv(struct map_methods *meth, struct attr **attrs, struct callback_list
}
else {
- dbg(0,"ERROR: Non-matching attr count and column count: %d %d SKIPPING line: %s\n",col_cnt, attr_cnt,line);
+ dbg(lvl_error,"ERROR: Non-matching attr count and column count: %d %d SKIPPING line: %s\n",col_cnt, attr_cnt,line);
}
g_free(line);
g_free(line2);
@@ -864,20 +864,20 @@ map_new_csv(struct map_methods *meth, struct attr **attrs, struct callback_list
fclose(fp);
}
else {
- dbg(0,"Error opening csv map file %s, starting with empty map\n", m->filename);
+ dbg(lvl_error,"Error opening csv map file %s, starting with empty map\n", m->filename);
}
} else {
- dbg(1,"No data attribute, starting with in-memory map\n");
+ dbg(lvl_warning,"No data attribute, starting with in-memory map\n");
}
- dbg(2,"%p\n",tree_root);
+ dbg(lvl_info,"%p\n",tree_root);
return m;
}
void
plugin_init(void)
{
- dbg(1,"csv: plugin_init\n");
+ dbg(lvl_warning,"csv: plugin_init\n");
plugin_register_map_type("csv", map_new_csv);
}
diff --git a/navit/map/csv/quadtree.c b/navit/map/csv/quadtree.c
index 1becab7ce..f7b3fdc30 100644
--- a/navit/map/csv/quadtree.c
+++ b/navit/map/csv/quadtree.c
@@ -379,7 +379,7 @@ void quadtree_node_drop_garbage(struct quadtree_node* node, struct quadtree_iter
{
int i,j;
int node_num=node->node_num;
- dbg(1,"Processing unreferenced subnode children...\n");
+ dbg(lvl_warning,"Processing unreferenced subnode children...\n");
for(i=0,j=0;i<node_num;i++) {
if(node->items[i]->deleted && !node->items[i]->ref_count) {
if(iter->item_free) {
@@ -426,7 +426,7 @@ quadtree_add(struct quadtree_node* this_, struct quadtree_item* item, struct qua
}
if (bSame) {
//FIXME: memleak and items thrown away if more than QUADTREE_NODE_CAPACITY-1 items with same coordinates added.
- dbg(0,"Unable to add another item with same coordinates. Throwing item to the ground. Will leak %p.\n",item);
+ dbg(lvl_error,"Unable to add another item with same coordinates. Throwing item to the ground. Will leak %p.\n",item);
return;
}
this_->items[this_->node_num++] = item;
@@ -561,7 +561,7 @@ struct quadtree_iter *quadtree_query(struct quadtree_node *this_, double dXMin,
ret->xmax=dXMax;
ret->ymin=dYMin;
ret->ymax=dYMax;
- dbg(1,"%f %f %f %f\n",dXMin,dXMax,dYMin,dYMax)
+ dbg(lvl_warning,"%f %f %f %f\n",dXMin,dXMax,dYMin,dYMax)
ret->item_free=item_free;
ret->item_free_context=item_free_context;
n->node=this_;
@@ -577,7 +577,7 @@ struct quadtree_iter *quadtree_query(struct quadtree_node *this_, double dXMin,
}
this_->ref_count++;
- dbg(1,"Query %p \n",this_)
+ dbg(lvl_warning,"Query %p \n",this_)
return ret;
}
@@ -627,16 +627,16 @@ struct quadtree_item * quadtree_item_next(struct quadtree_iter *iter)
if(iter_node->is_leaf) {
/* Try to find undeleted item in the current node */
- dbg(1,"find item %p %p ...\n",iter->iter_nodes,iter->iter_nodes->data);
+ dbg(lvl_warning,"find item %p %p ...\n",iter->iter_nodes,iter->iter_nodes->data);
while(iter_node->item<iter_node->node_num) {
- dbg(1,"%d %d\n",iter_node->item,iter_node->items[iter_node->item]->deleted);
+ dbg(lvl_warning,"%d %d\n",iter_node->item,iter_node->items[iter_node->item]->deleted);
if(iter_node->items[iter_node->item]->deleted) {
iter_node->item++;
continue;
}
iter->item=iter_node->items[iter_node->item];
iter_node->item++;
- dbg(1,"Returning %p\n",iter->item);
+ dbg(lvl_warning,"Returning %p\n",iter->item);
iter->item->ref_count++;
return iter->item;
}
@@ -654,13 +654,13 @@ struct quadtree_item * quadtree_item_next(struct quadtree_iter *iter)
i=iter_node->subnode;
if(!nodes[i] || !rects_overlap(nodes[i]->xmin, nodes[i]->ymin, nodes[i]->xmax, nodes[i]->ymax, iter->xmin, iter->ymin, iter->xmax, iter->ymax))
continue;
- dbg(1,"%f %f %f %f\n",nodes[i]->xmin, nodes[i]->xmax, nodes[i]->ymin, nodes[i]->ymax)
+ dbg(lvl_warning,"%f %f %f %f\n",nodes[i]->xmin, nodes[i]->xmax, nodes[i]->ymin, nodes[i]->ymax)
subnode=nodes[i];
}
if(subnode) {
/* Go one level deeper */
- dbg(1,"Go one level deeper...\n");
+ dbg(lvl_warning,"Go one level deeper...\n");
iter_node=g_new0(struct quadtree_iter_node, 1);
iter_node->node=subnode;
iter_node->is_leaf=subnode->is_leaf;
@@ -692,7 +692,7 @@ struct quadtree_item * quadtree_item_next(struct quadtree_iter *iter)
/* 2. remove empty leaf subnode if it's unreferenced */
if(!subnode->ref_count && !subnode->node_num && subnode->is_leaf ) {
- dbg(1,"Going to delete an empty unreferenced leaf subnode...\n");
+ dbg(lvl_warning,"Going to delete an empty unreferenced leaf subnode...\n");
if(subnode->parent) {
if(subnode->parent->aa==subnode) {
@@ -704,19 +704,19 @@ struct quadtree_item * quadtree_item_next(struct quadtree_iter *iter)
} else if(subnode->parent->bb==subnode) {
subnode->parent->bb=NULL;
} else {
- dbg(0,"Found Quadtree structure corruption while trying to free an empty node.\n");
+ dbg(lvl_error,"Found Quadtree structure corruption while trying to free an empty node.\n");
}
if(!subnode->parent->aa && !subnode->parent->ab && !subnode->parent->ba && !subnode->parent->bb )
subnode->parent->is_leaf=1;
g_free(subnode);
} else
- dbg(1,"Quadtree is empty. NOT deleting the root subnode...\n");
+ dbg(lvl_warning,"Quadtree is empty. NOT deleting the root subnode...\n");
}
/* Go one step towards root */
- dbg(2,"Going towards root...\n");
+ dbg(lvl_info,"Going towards root...\n");
g_free(iter->iter_nodes->data);
iter->iter_nodes=g_list_delete_link(iter->iter_nodes,iter->iter_nodes);
}
diff --git a/navit/map/filter/filter.c b/navit/map/filter/filter.c
index 2b9bceb98..cf083c85a 100644
--- a/navit/map/filter/filter.c
+++ b/navit/map/filter/filter.c
@@ -319,7 +319,7 @@ map_filter_rect_get_item(struct map_rect_priv *mr)
static struct item *
map_filter_rect_get_item_byid(struct map_rect_priv *mr, int id_hi, int id_lo)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
mr->parent_item=map_rect_get_item_byid(mr->parent, id_hi, id_lo);
if (!mr->parent_item)
return NULL;
@@ -332,21 +332,21 @@ map_filter_rect_get_item_byid(struct map_rect_priv *mr, int id_hi, int id_lo)
static struct map_search_priv *
map_filter_search_new(struct map_priv *map, struct item *item, struct attr *search, int partial)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
return NULL;
}
static struct item *
map_filter_search_get_item(struct map_search_priv *map_search)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
return NULL;
}
static void
map_filter_search_destroy(struct map_search_priv *ms)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
}
static void
@@ -429,7 +429,7 @@ map_filter_new(struct map_methods *meth, struct attr **attrs, struct callback_li
void
plugin_init(void)
{
- dbg(1,"filter: plugin_init\n");
+ dbg(lvl_warning,"filter: plugin_init\n");
plugin_register_map_type("filter", map_filter_new);
}
diff --git a/navit/map/mg/block.c b/navit/map/mg/block.c
index 988865728..f18e77863 100644
--- a/navit/map/mg/block.c
+++ b/navit/map/mg/block.c
@@ -77,7 +77,7 @@ block_get_byid(struct file *file, int id, unsigned char **p_ret)
int
block_get_byindex(struct file *file, int idx, struct block_priv *blk)
{
- dbg(1,"idx=%d\n", idx);
+ dbg(lvl_warning,"idx=%d\n", idx);
blk->b=block_get_byid(file, idx, &blk->p);
blk->block_start=(unsigned char *)(blk->b);
blk->p_start=blk->p;
@@ -177,7 +177,7 @@ block_next_lin(struct map_rect_priv *mr)
else
mr->b.p=mr->b.block_start+block_get_blocks(mr->b.b)*512;
if (mr->b.p >= mr->file->end) {
- dbg(1,"end of blocks %p vs %p\n", mr->b.p, mr->file->end);
+ dbg(lvl_warning,"end of blocks %p vs %p\n", mr->b.p, mr->file->end);
return 0;
}
mr->b.block_start=mr->b.p;
@@ -185,17 +185,17 @@ block_next_lin(struct map_rect_priv *mr)
mr->b.p_start=mr->b.p;
mr->b.end=mr->b.block_start+block_get_size(mr->b.b);
if (block_get_count(mr->b.b) == -1) {
- dbg(1,"empty blocks\n");
+ dbg(lvl_warning,"empty blocks\n");
return 0;
}
block_get_r(mr->b.b, &r);
if (!mr->cur_sel || coord_rect_overlap(&mr->cur_sel->u.c_rect, &r)) {
block_active_count++;
block_active_mem+=block_get_blocks(mr->b.b)*512-sizeof(struct block *);
- dbg(1,"block ok\n");
+ dbg(lvl_warning,"block ok\n");
return 1;
}
- dbg(2,"block not in cur_sel\n");
+ dbg(lvl_info,"block not in cur_sel\n");
}
}
@@ -210,14 +210,14 @@ block_next(struct map_rect_priv *mr)
return block_next_lin(mr);
for (;;) {
if (! bt->p) {
- dbg(1,"block 0x%x\n", bt->next);
+ dbg(lvl_warning,"block 0x%x\n", bt->next);
if (bt->next == -1)
return 0;
bt->b=block_get_byid(mr->file, bt->next, &bt->p);
bt->end=(unsigned char *)mr->b.bt.b+block_get_size(mr->b.bt.b);
bt->next=block_get_next(bt->b);
bt->order=0;
- dbg(1,"size 0x%x next 0x%x\n", block_get_size(bt->b), block_get_next(bt->b));
+ dbg(lvl_warning,"size 0x%x next 0x%x\n", block_get_size(bt->b), block_get_next(bt->b));
if (! mr->b.bt.block_count) {
#if 0
if (debug) {
@@ -238,8 +238,8 @@ block_next(struct map_rect_priv *mr)
blk_num=get_u32(&mr->b.bt.p);
coord=get_u32(&mr->b.bt.p);
block_mem+=8;
- dbg(1,"%p vs %p coord 0x%x ", mr->b.bt.end, mr->b.bt.p, coord);
- dbg(1,"block 0x%x", blk_num);
+ dbg(lvl_warning,"%p vs %p coord 0x%x ", mr->b.bt.end, mr->b.bt.p, coord);
+ dbg(lvl_warning,"block 0x%x", blk_num);
r_w=bt->r_curr.rl.x-bt->r_curr.lu.x;
r_h=bt->r_curr.lu.y-bt->r_curr.rl.y;
diff --git a/navit/map/mg/map.c b/navit/map/mg/map.c
index 682b6917c..b5a67fd09 100644
--- a/navit/map/mg/map.c
+++ b/navit/map/mg/map.c
@@ -289,7 +289,7 @@ map_rect_get_item_mg(struct map_rect_priv *mr)
}
if (file_next(mr))
continue;
- dbg(1,"lin_count %d idx_count %d active_count %d %d kB (%d kB)\n", block_lin_count, block_idx_count, block_active_count, (block_mem+block_active_mem)/1024, block_active_mem/1024);
+ dbg(lvl_warning,"lin_count %d idx_count %d active_count %d %d kB (%d kB)\n", block_lin_count, block_idx_count, block_active_count, (block_mem+block_active_mem)/1024, block_active_mem/1024);
return NULL;
}
}
@@ -361,7 +361,7 @@ map_search_mg_convert_special(char *str)
*c++='u';
break;
default:
- dbg(1,"0x%x\n", *str);
+ dbg(lvl_warning,"0x%x\n", *str);
*c++=*str;
break;
}
@@ -375,11 +375,11 @@ static int
map_search_setup(struct map_rect_priv *mr)
{
char *prefix;
- dbg(1,"%s\n", attr_to_name(mr->search_type));
+ dbg(lvl_warning,"%s\n", attr_to_name(mr->search_type));
switch (mr->search_type) {
case attr_town_postal:
if (mr->search_item.type != type_country_label) {
- dbg(0,"wrong parent type %s\n", item_to_name(mr->search_item.type));
+ dbg(lvl_error,"wrong parent type %s\n", item_to_name(mr->search_item.type));
return 0;
}
prefix=mg_country_postal_prefix(mr->search_item.id_lo);
@@ -388,12 +388,12 @@ map_search_setup(struct map_rect_priv *mr)
tree_search_init(mr->m->dirname, "town.b1", &mr->ts, 0);
mr->current_file=file_town_twn;
mr->search_str=g_strdup_printf("%s%s",prefix,mr->search_attr->u.str);
- dbg(0,"search_str='%s'\n",mr->search_str);
+ dbg(lvl_error,"search_str='%s'\n",mr->search_str);
mr->search_country=mg_country_from_isonum(mr->search_item.id_lo);
break;
case attr_town_name:
if (mr->search_item.type != type_country_label) {
- dbg(0,"wrong parent type %s\n", item_to_name(mr->search_item.type));
+ dbg(lvl_error,"wrong parent type %s\n", item_to_name(mr->search_item.type));
return 0;
}
tree_search_init(mr->m->dirname, "town.b2", &mr->ts, 0x1000);
@@ -403,7 +403,7 @@ map_search_setup(struct map_rect_priv *mr)
break;
case attr_district_name:
if (mr->search_item.type != type_country_label) {
- dbg(0,"wrong parent type %s\n", item_to_name(mr->search_item.type));
+ dbg(lvl_error,"wrong parent type %s\n", item_to_name(mr->search_item.type));
return 0;
}
tree_search_init(mr->m->dirname, "town.b3", &mr->ts, 0x1000);
@@ -434,11 +434,11 @@ map_search_setup(struct map_rect_priv *mr)
return 0;
}
} else {
- dbg(0,"wrong parent type %s %p 0x%x 0x%x\n", item_to_name(mr->search_item.type), item, mr->search_item.id_hi, mr->search_item.id_lo);
+ dbg(lvl_error,"wrong parent type %s %p 0x%x 0x%x\n", item_to_name(mr->search_item.type), item, mr->search_item.id_hi, mr->search_item.id_lo);
return 0;
}
}
- dbg(1,"street_assoc=0x%x\n", mr->search_item.id_lo);
+ dbg(lvl_warning,"street_assoc=0x%x\n", mr->search_item.id_lo);
tree_search_init(mr->m->dirname, "strname.b1", &mr->ts, 0);
mr->current_file=file_strname_stn;
mr->search_str=g_strdup(mr->search_attr->u.str);
@@ -447,12 +447,12 @@ map_search_setup(struct map_rect_priv *mr)
if (!map_priv_is(mr->search_item.map, mr->m))
return 0;
if (!housenumber_search_setup(mr)) {
- dbg(0,"failed to search for attr_house_number\n");
+ dbg(lvl_error,"failed to search for attr_house_number\n");
return 0;
}
break;
default:
- dbg(0,"unknown search %s\n",attr_to_name(mr->search_type));
+ dbg(lvl_error,"unknown search %s\n",attr_to_name(mr->search_type));
return 0;
}
mr->file=mr->m->file[mr->current_file];
@@ -467,9 +467,9 @@ static struct map_search_priv *
map_search_new_mg(struct map_priv *map, struct item *item, struct attr *search, int partial)
{
struct map_rect_priv *mr=g_new0(struct map_rect_priv, 1);
- dbg(1,"searching for %s '%s'\n", attr_to_name(search->type), search->u.str);
- dbg(1,"id_lo=0x%x\n", item->id_lo);
- dbg(1,"search=%s\n", search->u.str);
+ dbg(lvl_warning,"searching for %s '%s'\n", attr_to_name(search->type), search->u.str);
+ dbg(lvl_warning,"id_lo=0x%x\n", item->id_lo);
+ dbg(lvl_warning,"search=%s\n", search->u.str);
mr->m=map;
mr->search_attr=attr_dup(search);
mr->search_type=search->type;
@@ -480,7 +480,7 @@ map_search_new_mg(struct map_priv *map, struct item *item, struct attr *search,
mr->search_type_next=attr_district_name;
}
if (!map_search_setup(mr)) {
- dbg(1,"map_search_new_mg failed\n");
+ dbg(lvl_warning,"map_search_new_mg failed\n");
g_free(mr);
return NULL;
}
@@ -507,7 +507,7 @@ map_search_destroy_mg(struct map_search_priv *ms)
{
struct map_rect_priv *mr=(struct map_rect_priv *)ms;
- dbg(1,"mr=%p\n", mr);
+ dbg(lvl_warning,"mr=%p\n", mr);
if (! mr)
return;
map_search_cleanup(mr);
@@ -538,7 +538,7 @@ map_search_get_item_mg(struct map_search_priv *ms)
ret=housenumber_search_get_item(mr);
break;
default:
- dbg(0,"unknown search %s\n",attr_to_name(mr->search_type));
+ dbg(lvl_error,"unknown search %s\n",attr_to_name(mr->search_type));
break;
}
if (!ret && mr->search_type_next != attr_none) {
@@ -595,7 +595,7 @@ map_new_mg(struct map_methods *meth, struct attr **attrs, struct callback_list *
if (! m->file[i]) {
maybe_missing=(i == file_border_ply || i == file_height_ply || i == file_sea_ply);
if (! maybe_missing)
- dbg(0,"Failed to load %s\n", filename);
+ dbg(lvl_error,"Failed to load %s\n", filename);
} else
file_mmap(m->file[i]);
g_free(filename);
diff --git a/navit/map/mg/poly.c b/navit/map/mg/poly.c
index 5bd08303f..43256a295 100644
--- a/navit/map/mg/poly.c
+++ b/navit/map/mg/poly.c
@@ -225,7 +225,7 @@ poly_get(struct map_rect_priv *mr, struct poly_priv *poly, struct item *item)
item->type=type_rail;
break;
default:
- dbg(0,"Unknown poly type 0x%x '%s' 0x%x,0x%x\n", poly->type,poly->name,r.lu.x,r.lu.y);
+ dbg(lvl_error,"Unknown poly type 0x%x '%s' 0x%x,0x%x\n", poly->type,poly->name,r.lu.x,r.lu.y);
item->type=type_street_unkn;
}
if (!map_selection_contains_item(mr->cur_sel, 0, item->type)) {
@@ -235,10 +235,10 @@ poly_get(struct map_rect_priv *mr, struct poly_priv *poly, struct item *item)
}
} else
mr->b.p=poly->subpoly_next;
- dbg(1,"%d %d %s\n", poly->subpoly_num_all, mr->b.block_num, poly->name);
+ dbg(lvl_warning,"%d %d %s\n", poly->subpoly_num_all, mr->b.block_num, poly->name);
item->id_lo=poly->subpoly_num_all | (mr->b.block_num << 16);
item->id_hi=(mr->current_file << 16);
- dbg(1,"0x%x 0x%x\n", item->id_lo, item->id_hi);
+ dbg(lvl_warning,"0x%x 0x%x\n", item->id_lo, item->id_hi);
poly->subpoly_next=mr->b.p+L(poly->count[poly->subpoly_num])*sizeof(struct coord);
poly->subpoly_num++;
poly->subpoly_num_all++;
diff --git a/navit/map/mg/street.c b/navit/map/mg/street.c
index 363980be4..9a43ca14a 100644
--- a/navit/map/mg/street.c
+++ b/navit/map/mg/street.c
@@ -208,7 +208,7 @@ static int street_get_coord(unsigned char **pos, int bytes, struct coord_rect *r
if (f) {
f->x=ref->lu.x+x;
f->y=ref->rl.y+y;
- dbg(1,"0x%x,0x%x + 0x%x,0x%x = 0x%x,0x%x\n", x, y, ref->lu.x, ref->rl.y, f->x, f->y);
+ dbg(lvl_warning,"0x%x,0x%x + 0x%x,0x%x = 0x%x,0x%x\n", x, y, ref->lu.x, ref->rl.y, f->x, f->y);
}
*pos=p;
return flags;
@@ -282,14 +282,14 @@ street_coord_get(void *priv_data, struct coord *c, int count)
if (segid == 0x15)
debug=1;
if (debug) {
- dbg(0,"enter 0x%x\n",segid);
+ dbg(lvl_error,"enter 0x%x\n",segid);
}
#endif
while (count > 0) {
if (street_coord_get_helper(street, c)) {
#ifdef DEBUG_COORD_GET
if (debug) {
- dbg(0,"0x%x,0x%x\n", c->x, c->y);
+ dbg(lvl_error,"0x%x,0x%x\n", c->x, c->y);
}
#endif
c++;
@@ -316,7 +316,7 @@ street_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
struct street_priv *street=priv_data;
int nameid;
- dbg(1,"segid 0x%x\n", street_str_get_segid(street->str));
+ dbg(lvl_warning,"segid 0x%x\n", street_str_get_segid(street->str));
attr->type=attr_type;
switch (attr_type) {
case attr_any:
@@ -516,7 +516,7 @@ street_get(struct map_rect_priv *mr, struct street_priv *street, struct item *it
break;
default:
item->type=type_street_unkn;
- dbg(0,"unknown type 0x%x\n",street_str_get_type(street->str));
+ dbg(lvl_error,"unknown type 0x%x\n",street_str_get_type(street->str));
}
flags=item_get_default_flags(item->type);
if (flags)
@@ -557,12 +557,12 @@ street_get_byid(struct map_rect_priv *mr, struct street_priv *street, int id_hi,
int country=id_hi & 0xffff;
int res;
struct coord_rect r;
- dbg(1,"enter(%p,%p,0x%x,0x%x,%p)\n", mr, street, id_hi, id_lo, item);
+ dbg(lvl_warning,"enter(%p,%p,0x%x,0x%x,%p)\n", mr, street, id_hi, id_lo, item);
if (! country)
return 0;
if (! tree_search_hv(mr->m->dirname, "street", (id_lo >> 8) | (country << 24), id_lo & 0xff, &res))
return 0;
- dbg(1,"res=0x%x (blk=0x%x)\n", res, res >> 12);
+ dbg(lvl_warning,"res=0x%x (blk=0x%x)\n", res, res >> 12);
block_get_byindex(mr->m->file[mr->current_file], res >> 12, &mr->b);
street_get_data(street, &mr->b.p);
street->name_file=mr->m->file[file_strname_stn];
@@ -578,7 +578,7 @@ street_get_byid(struct map_rect_priv *mr, struct street_priv *street, int id_hi,
item->meth=&street_meth;
item->priv_data=street;
street->str+=(res & 0xfff)-1;
- dbg(1,"segid 0x%x\n", street_str_get_segid(&street->str[1]));
+ dbg(lvl_warning,"segid 0x%x\n", street_str_get_segid(&street->str[1]));
return street_get(mr, street, item);
#if 0
mr->b.p=mr->b.block_start+(res & 0xffff);
@@ -620,7 +620,7 @@ latin1_tolower_ascii(unsigned char c)
return 'u';
default:
if (ret >= 0x80)
- dbg(1,"ret=0x%x\n",c);
+ dbg(lvl_warning,"ret=0x%x\n",c);
return ret;
}
}
@@ -662,27 +662,27 @@ street_search_compare_do(struct map_rect_priv *mr, int country, int town_assoc,
{
int d,len;
- dbg(1,"enter");
- dbg(1,"country 0x%x town_assoc 0x%x name '%s'\n", country, town_assoc, name);
+ dbg(lvl_warning,"enter");
+ dbg(lvl_warning,"country 0x%x town_assoc 0x%x name '%s'\n", country, town_assoc, name);
d=(mr->search_item.id_hi & 0xffff)-country;
- dbg(1,"country %d (%d vs %d)\n", d, mr->search_item.id_hi & 0xffff, country);
+ dbg(lvl_warning,"country %d (%d vs %d)\n", d, mr->search_item.id_hi & 0xffff, country);
if (!d) {
if (mr->search_item.id_lo == town_assoc ) {
- dbg(1,"town_assoc match (0x%x)\n", town_assoc);
+ dbg(lvl_warning,"town_assoc match (0x%x)\n", town_assoc);
len=mr->search_partial ? strlen(mr->search_str):INT_MAX;
d=strncasecmp_latin1(mr->search_str, name, len);
if (!strncasecmp_latin1_ascii(mr->search_str, name, len))
d=0;
- dbg(1,"string %d\n", d);
+ dbg(lvl_warning,"string %d\n", d);
} else {
if (town_assoc < mr->search_item.id_lo)
d=1;
else
d=-1;
- dbg(1,"assoc %d 0x%x-0x%x\n",d, mr->search_item.id_lo, town_assoc);
+ dbg(lvl_warning,"assoc %d 0x%x-0x%x\n",d, mr->search_item.id_lo, town_assoc);
}
}
- dbg(1,"d=%d\n", d);
+ dbg(lvl_warning,"d=%d\n", d);
return d;
}
@@ -692,11 +692,11 @@ street_search_compare(unsigned char **p, struct map_rect_priv *mr)
struct street_name_index *i;
int ret;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
i=(struct street_name_index *)(*p);
*p+=sizeof(*i)+strlen(i->name)+1;
- dbg(1,"block 0x%x\n", i->block);
+ dbg(lvl_warning,"block 0x%x\n", i->block);
ret=street_search_compare_do(mr, i->country, i->town_assoc, i->name);
if (ret <= 0)
@@ -725,7 +725,7 @@ street_name_coord_get(void *priv_data, struct coord *c, int count)
struct street_name_numbers snns;
unsigned char *p=mr->street.name.aux_data;
- dbg(1,"aux_data=%p\n", p);
+ dbg(lvl_warning,"aux_data=%p\n", p);
if (count) {
street_name_numbers_get(&snns, &p);
street_name_numbers_get_coord(&snns, c);
@@ -801,7 +801,7 @@ street_name_attr_get(void *priv_data, enum attr_type attr_type, struct attr *att
return 0;
return item_attr_get(mr->search_item_tmp, attr_type, attr);
default:
- dbg(0,"unknown attr %s\n",attr_to_name(attr_type));
+ dbg(lvl_error,"unknown attr %s\n",attr_to_name(attr_type));
return 0;
}
}
@@ -830,7 +830,7 @@ street_name_get_byid(struct map_rect_priv *mr, struct street_priv *street, int i
item->map=NULL;
item->priv_data=mr;
mr->b.p=street->name_file->begin+item->id_lo;
- dbg(1,"last %p map %p file %d begin %p\n", mr->b.p, mr->m, mr->current_file, mr->m->file[mr->current_file]->begin);
+ dbg(lvl_warning,"last %p map %p file %d begin %p\n", mr->b.p, mr->m, mr->current_file, mr->m->file[mr->current_file]->begin);
street_name_get(&street->name, &mr->b.p);
return 1;
}
@@ -841,30 +841,30 @@ street_search_get_item_street_name(struct map_rect_priv *mr)
int dir=1,leaf;
unsigned char *last;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
if (! mr->search_blk_count) {
- dbg(1,"partial 0x%x '%s' ***\n", mr->town.street_assoc, mr->search_str);
+ dbg(lvl_warning,"partial 0x%x '%s' ***\n", mr->town.street_assoc, mr->search_str);
if (mr->search_linear)
return NULL;
- dbg(1,"tree_search_next\n");
+ dbg(lvl_warning,"tree_search_next\n");
mr->search_block=-1;
while ((leaf=tree_search_next(&mr->ts, &mr->search_p, dir)) != -1) {
dir=street_search_compare(&mr->search_p, mr);
}
- dbg(1,"dir=%d mr->search_block=0x%x\n", dir, mr->search_block);
+ dbg(lvl_warning,"dir=%d mr->search_block=0x%x\n", dir, mr->search_block);
if (mr->search_block == -1)
return NULL;
mr->search_blk_count=1;
block_get_byindex(mr->m->file[file_strname_stn], mr->search_block, &mr->b);
mr->b.p=mr->b.block_start+12;
}
- dbg(1,"name id %td\n", mr->b.p-mr->m->file[file_strname_stn]->begin);
+ dbg(lvl_warning,"name id %td\n", mr->b.p-mr->m->file[file_strname_stn]->begin);
if (! mr->search_blk_count)
return NULL;
for (;;) {
if (mr->b.p >= mr->b.end) {
if (!block_next_lin(mr)) {
- dbg(1,"end of blocks in %p, %p\n", mr->m->file[file_strname_stn]->begin, mr->m->file[file_strname_stn]->end);
+ dbg(lvl_warning,"end of blocks in %p, %p\n", mr->m->file[file_strname_stn]->begin, mr->m->file[file_strname_stn]->end);
return NULL;
}
mr->b.p=mr->b.block_start+12;
@@ -873,23 +873,23 @@ street_search_get_item_street_name(struct map_rect_priv *mr)
last=mr->b.p;
street_name_get(&mr->street.name, &mr->b.p);
dir=street_search_compare_do(mr, mr->street.name.country, mr->street.name.townassoc, mr->street.name.name2);
- dbg(1,"country 0x%x assoc 0x%x name1 '%s' name2 '%s' dir=%d\n", mr->street.name.country, mr->street.name.townassoc, mr->street.name.name1, mr->street.name.name2, dir);
+ dbg(lvl_warning,"country 0x%x assoc 0x%x name1 '%s' name2 '%s' dir=%d\n", mr->street.name.country, mr->street.name.townassoc, mr->street.name.name1, mr->street.name.name2, dir);
if (dir < 0) {
- dbg(1,"end of data\n");
+ dbg(lvl_warning,"end of data\n");
mr->search_blk_count=0;
return NULL;
}
if (!dir) {
- dbg(1,"result country 0x%x assoc 0x%x name1 '%s' name2 '%s' dir=%d aux_data=%p len=0x%x\n", mr->street.name.country, mr->street.name.townassoc, mr->street.name.name1, mr->street.name.name2, dir, mr->street.name.aux_data, mr->street.name.aux_len);
+ dbg(lvl_warning,"result country 0x%x assoc 0x%x name1 '%s' name2 '%s' dir=%d aux_data=%p len=0x%x\n", mr->street.name.country, mr->street.name.townassoc, mr->street.name.name1, mr->street.name.name2, dir, mr->street.name.aux_data, mr->street.name.aux_len);
mr->item.type = type_street_name;
mr->item.id_hi=(file_strname_stn << 16);
mr->item.id_lo=last-mr->m->file[file_strname_stn]->begin;
- dbg(1,"id 0x%x 0x%x last %p map %p file %d begin %p\n", mr->item.id_hi, mr->item.id_lo, last, mr->m, mr->current_file, mr->m->file[mr->current_file]->begin);
+ dbg(lvl_warning,"id 0x%x 0x%x last %p map %p file %d begin %p\n", mr->item.id_hi, mr->item.id_lo, last, mr->m, mr->current_file, mr->m->file[mr->current_file]->begin);
mr->item.meth=&street_name_meth;
mr->item.map=NULL;
mr->item.priv_data=mr;
/* debug(mr); */
- dbg(1,"last %p\n",last);
+ dbg(lvl_warning,"last %p\n",last);
return &mr->item;
}
}
@@ -920,7 +920,7 @@ street_name_numbers_next(struct map_rect_priv *mr)
{
if (street_name_eod(&mr->street.name))
return 0;
- dbg(1,"%p vs %p\n",mr->street.name.tmp_data, mr->street.name.aux_data);
+ dbg(lvl_warning,"%p vs %p\n",mr->street.name.tmp_data, mr->street.name.aux_data);
street_name_numbers_get(&mr->street.name_numbers, &mr->street.name.tmp_data);
return 1;
}
@@ -975,7 +975,7 @@ housenumber_attr_get(void *priv_data, enum attr_type attr_type, struct attr *att
return 0;
return item_attr_get(mr->search_item_tmp, attr_type, attr);
default:
- dbg(0,"unknown attr %s\n",attr_to_name(attr_type));
+ dbg(lvl_error,"unknown attr %s\n",attr_to_name(attr_type));
return 0;
}
}
@@ -991,20 +991,20 @@ static struct item_methods housenumber_meth = {
int
housenumber_search_setup(struct map_rect_priv *mr)
{
- dbg(1,"enter (0x%x,0x%x)\n",mr->search_item.id_hi,mr->search_item.id_lo);
+ dbg(lvl_warning,"enter (0x%x,0x%x)\n",mr->search_item.id_hi,mr->search_item.id_lo);
int id=mr->search_item.id_hi & 0xff;
mr->current_file=file_strname_stn;
mr->street.name_file=mr->m->file[mr->current_file];
mr->b.p=mr->street.name_file->begin+mr->search_item.id_lo;
mr->search_str=g_strdup(mr->search_attr->u.str);
- dbg(1,"last %p\n",mr->b.p);
+ dbg(lvl_warning,"last %p\n",mr->b.p);
street_name_get(&mr->street.name, &mr->b.p);
#if 0
debug(mr);
#endif
while (id > 0) {
id--;
- dbg(1,"loop\n");
+ dbg(lvl_warning,"loop\n");
if (!street_name_numbers_next(mr))
return 0;
}
@@ -1015,10 +1015,10 @@ housenumber_search_setup(struct map_rect_priv *mr)
if (!id)
mr->item.id_hi+=1;
mr->item.id_lo=mr->search_item.id_lo;
- dbg(1,"getting name_number %p vs %p + %d\n",mr->street.name_numbers.tmp_data,mr->street.name_numbers.aux_data, mr->street.name_numbers.aux_len);
+ dbg(lvl_warning,"getting name_number %p vs %p + %d\n",mr->street.name_numbers.tmp_data,mr->street.name_numbers.aux_data, mr->street.name_numbers.aux_len);
if (!street_name_number_next(mr))
return 0;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
// debug(mr);
return 1;
}
@@ -1055,7 +1055,7 @@ struct item *
housenumber_search_get_item(struct map_rect_priv *mr)
{
int d;
- dbg(1,"enter %s %s\n",mr->street.first_number,mr->street.last_number);
+ dbg(lvl_warning,"enter %s %s\n",mr->street.first_number,mr->street.last_number);
for (;;) {
if (!house_number_next(mr->street.current_number, mr->street.first_number, mr->street.last_number, 0, NULL)) {
if (!street_name_number_next(mr))
diff --git a/navit/map/mg/town.c b/navit/map/mg/town.c
index 8ef5e808e..ab7a19786 100644
--- a/navit/map/mg/town.c
+++ b/navit/map/mg/town.c
@@ -105,7 +105,7 @@ town_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
twn->attr_next=attr_none;
return 1;
default:
- dbg(1, "Don't know about attribute %d[%04X]=%s yet\n",
+ dbg(lvl_warning, "Don't know about attribute %d[%04X]=%s yet\n",
attr_type, attr_type, attr_to_name(attr_type));
return 0;
}
@@ -222,12 +222,12 @@ town_search_compare(unsigned char **p, struct map_rect_priv *mr)
d=0;
} else {
country=get_u16_unal(p);
- dbg(1,"country 0x%x ", country);
+ dbg(lvl_warning,"country 0x%x ", country);
name=get_string(p);
- dbg(1,"name '%s' ",name);
+ dbg(lvl_warning,"name '%s' ",name);
mr->search_blk_count=get_u32_unal(p);
mr->search_blk_off=(struct block_offset *)(*p);
- dbg(1,"len %d ", mr->search_blk_count);
+ dbg(lvl_warning,"len %d ", mr->search_blk_count);
(*p)+=mr->search_blk_count*4;
d=mr->search_country-country;
}
@@ -237,7 +237,7 @@ town_search_compare(unsigned char **p, struct map_rect_priv *mr)
else
d=strcasecmp(mr->search_str, name);
}
- dbg(1,"%d \n",d);
+ dbg(lvl_warning,"%d \n",d);
return d;
}
@@ -250,7 +250,7 @@ town_search_get_item(struct map_rect_priv *mr)
int dir=1,leaf;
if (! mr->search_blk_count) {
- dbg(1,"partial %d 0x%x '%s' ***\n", mr->search_partial, mr->search_country, mr->search_str);
+ dbg(lvl_warning,"partial %d 0x%x '%s' ***\n", mr->search_partial, mr->search_country, mr->search_str);
if (! mr->search_linear) {
while ((leaf=tree_search_next(&mr->ts, &mr->search_p, dir)) != -1) {
dir=town_search_compare(&mr->search_p, mr);
@@ -261,23 +261,23 @@ town_search_get_item(struct map_rect_priv *mr)
}
}
if (! mr->search_linear) {
- dbg(1,"not found\n");
+ dbg(lvl_warning,"not found\n");
return NULL;
}
}
if (! tree_search_next_lin(&mr->ts, &mr->search_p)) {
- dbg(1,"linear not found\n");
+ dbg(lvl_warning,"linear not found\n");
return NULL;
}
if (town_search_compare(&mr->search_p, mr)) {
- dbg(1,"no match\n");
+ dbg(lvl_warning,"no match\n");
return NULL;
}
- dbg(1,"found %d blocks\n",mr->search_blk_count);
+ dbg(lvl_warning,"found %d blocks\n",mr->search_blk_count);
}
if (! mr->search_blk_count)
return NULL;
- dbg(1,"block 0x%x offset 0x%x\n", block_offset_get_block(mr->search_blk_off), block_offset_get_offset(mr->search_blk_off));
+ dbg(lvl_warning,"block 0x%x offset 0x%x\n", block_offset_get_block(mr->search_blk_off), block_offset_get_offset(mr->search_blk_off));
block_get_byindex(mr->m->file[mr->current_file], block_offset_get_block(mr->search_blk_off), &mr->b);
mr->b.p=mr->b.block_start+block_offset_get_offset(mr->search_blk_off);
town_get(mr, &mr->town, &mr->item);
diff --git a/navit/map/mg/tree.c b/navit/map/mg/tree.c
index 3b6a2c2d0..27100007c 100644
--- a/navit/map/mg/tree.c
+++ b/navit/map/mg/tree.c
@@ -78,22 +78,22 @@ tree_search_h(struct file *file, unsigned int search)
struct tree_hdr_h *thdr;
struct tree_leaf_h *tleaf;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
while (i++ < 1000) {
thdr=(struct tree_hdr_h *)p;
p+=sizeof(*thdr);
end=p+tree_hdr_h_get_size(thdr);
- dbg(1,"@%td\n", p-file->begin);
+ dbg(lvl_warning,"@%td\n", p-file->begin);
last=0;
while (p < end) {
tleaf=(struct tree_leaf_h *)p;
p+=sizeof(*tleaf);
- dbg(1,"low:0x%x high:0x%x match:0x%x val:0x%x search:0x%x\n", tree_leaf_h_get_lower(tleaf), tree_leaf_h_get_higher(tleaf), tree_leaf_h_get_match(tleaf), tree_leaf_h_get_value(tleaf), search);
+ dbg(lvl_warning,"low:0x%x high:0x%x match:0x%x val:0x%x search:0x%x\n", tree_leaf_h_get_lower(tleaf), tree_leaf_h_get_higher(tleaf), tree_leaf_h_get_match(tleaf), tree_leaf_h_get_value(tleaf), search);
value=tree_leaf_h_get_value(tleaf);
if (value == search)
return tree_leaf_h_get_match(tleaf);
if (value > search) {
- dbg(1,"lower\n");
+ dbg(lvl_warning,"lower\n");
lower=tree_leaf_h_get_lower(tleaf);
if (lower)
last=lower;
@@ -119,11 +119,11 @@ tree_search_v(struct file *file, int offset, int search)
thdr=(struct tree_hdr_v *)p;
p+=sizeof(*thdr);
count=tree_hdr_v_get_count(thdr);
- dbg(1,"offset=%td count=0x%x\n", p-file->begin, count);
+ dbg(lvl_warning,"offset=%td count=0x%x\n", p-file->begin, count);
while (count--) {
tleaf=(struct tree_leaf_v *)p;
p+=sizeof(*tleaf);
- dbg(1,"0x%x 0x%x\n", tleaf->key, search);
+ dbg(lvl_warning,"0x%x 0x%x\n", tleaf->key, search);
if (tleaf->key == search)
return tree_leaf_v_get_value(tleaf);
}
@@ -142,32 +142,32 @@ tree_search_hv(char *dirname, char *filename, unsigned int search_h, unsigned in
char buffer[4096];
int h,v;
- dbg(1,"enter(%s, %s, 0x%x, 0x%x, %p)\n",dirname, filename, search_h, search_v, result);
+ dbg(lvl_warning,"enter(%s, %s, 0x%x, 0x%x, %p)\n",dirname, filename, search_h, search_v, result);
sprintf(buffer, "%s/%s.h1", dirname, filename);
f_idx_h=file_create_caseinsensitive(buffer, 0);
if ((!f_idx_h) || (!file_mmap(f_idx_h)))
return 0;
sprintf(buffer, "%s/%s.v1", dirname, filename);
f_idx_v=file_create_caseinsensitive(buffer, 0);
- dbg(1,"%p %p\n", f_idx_h, f_idx_v);
+ dbg(lvl_warning,"%p %p\n", f_idx_h, f_idx_v);
if ((!f_idx_v) || (!file_mmap(f_idx_v))) {
file_destroy(f_idx_h);
return 0;
}
if ((h=tree_search_h(f_idx_h, search_h))) {
- dbg(1,"h=0x%x\n", h);
+ dbg(lvl_warning,"h=0x%x\n", h);
if ((v=tree_search_v(f_idx_v, h, search_v))) {
- dbg(1,"v=0x%x\n", v);
+ dbg(lvl_warning,"v=0x%x\n", v);
*result=v;
file_destroy(f_idx_v);
file_destroy(f_idx_h);
- dbg(1,"return 1\n");
+ dbg(lvl_warning,"return 1\n");
return 1;
}
}
file_destroy(f_idx_v);
file_destroy(f_idx_h);
- dbg(1,"return 0\n");
+ dbg(lvl_warning,"return 0\n");
return 0;
}
@@ -183,7 +183,7 @@ tree_search_enter(struct tree_search *ts, int offset)
tsn->end=p+tree_hdr_get_size(tsn->hdr);
tsn->low=tree_hdr_get_low(tsn->hdr);
tsn->high=tree_hdr_get_low(tsn->hdr);
- dbg(1,"pos %td addr 0x%ux size 0x%ux low 0x%ux end %tu\n", p-ts->f->begin, tree_hdr_get_addr(tsn->hdr), tree_hdr_get_size(tsn->hdr), tree_hdr_get_low(tsn->hdr), tsn->end-ts->f->begin);
+ dbg(lvl_warning,"pos %td addr 0x%ux size 0x%ux low 0x%ux end %tu\n", p-ts->f->begin, tree_hdr_get_addr(tsn->hdr), tree_hdr_get_size(tsn->hdr), tree_hdr_get_low(tsn->hdr), tsn->end-ts->f->begin);
return tsn;
}
@@ -193,17 +193,17 @@ int tree_search_next(struct tree_search *ts, unsigned char **p, int dir)
if (! *p)
*p=tsn->p;
- dbg(1,"next *p=%p dir=%d\n", *p, dir);
- dbg(1,"low1=0x%x high1=0x%x\n", tsn->low, tsn->high);
+ dbg(lvl_warning,"next *p=%p dir=%d\n", *p, dir);
+ dbg(lvl_warning,"low1=0x%x high1=0x%x\n", tsn->low, tsn->high);
if (dir <= 0) {
- dbg(1,"down 0x%x\n", tsn->low);
+ dbg(lvl_warning,"down 0x%x\n", tsn->low);
if (tsn->low != 0xffffffff) {
tsn=tree_search_enter(ts, tsn->low);
*p=tsn->p;
tsn->high=get_u32(p);
ts->last_node=ts->curr_node;
- dbg(1,"saving last2 %d %td\n", ts->curr_node, tsn->last-ts->f->begin);
- dbg(1,"high2=0x%x\n", tsn->high);
+ dbg(lvl_warning,"saving last2 %d %td\n", ts->curr_node, tsn->last-ts->f->begin);
+ dbg(lvl_warning,"high2=0x%x\n", tsn->high);
return 0;
}
return -1;
@@ -211,18 +211,18 @@ int tree_search_next(struct tree_search *ts, unsigned char **p, int dir)
tsn->low=tsn->high;
tsn->last=*p;
tsn->high=get_u32_unal(p);
- dbg(1,"saving last3 %d %p\n", ts->curr_node, tsn->last);
+ dbg(lvl_warning,"saving last3 %d %p\n", ts->curr_node, tsn->last);
if (*p < tsn->end)
return (tsn->low == 0xffffffff ? 1 : 0);
- dbg(1,"end reached high=0x%x\n",tsn->high);
+ dbg(lvl_warning,"end reached high=0x%x\n",tsn->high);
if (tsn->low != 0xffffffff) {
- dbg(1,"low 0x%x\n", tsn->low);
+ dbg(lvl_warning,"low 0x%x\n", tsn->low);
tsn=tree_search_enter(ts, tsn->low);
*p=tsn->p;
tsn->high=get_u32_unal(p);
ts->last_node=ts->curr_node;
- dbg(1,"saving last4 %d %td\n", ts->curr_node, tsn->last-ts->f->begin);
- dbg(1,"high4=0x%x\n", tsn->high);
+ dbg(lvl_warning,"saving last4 %d %td\n", ts->curr_node, tsn->last-ts->f->begin);
+ dbg(lvl_warning,"high4=0x%x\n", tsn->high);
return 0;
}
return -1;
@@ -233,7 +233,7 @@ int tree_search_next_lin(struct tree_search *ts, unsigned char **p)
struct tree_search_node *tsn=&ts->nodes[ts->curr_node];
int high;
- dbg(1,"pos=%d %td\n", ts->curr_node, *p-ts->f->begin);
+ dbg(lvl_warning,"pos=%d %td\n", ts->curr_node, *p-ts->f->begin);
if (*p)
ts->nodes[ts->last_node].last=*p;
*p=tsn->last;
@@ -243,12 +243,12 @@ int tree_search_next_lin(struct tree_search *ts, unsigned char **p)
ts->last_node=ts->curr_node;
while (high != 0xffffffff) {
tsn=tree_search_enter(ts, high);
- dbg(1,"reload %d\n",ts->curr_node);
+ dbg(lvl_warning,"reload %d\n",ts->curr_node);
high=tsn->low;
}
return 1;
}
- dbg(1,"eon %d %td %td\n", ts->curr_node, *p-ts->f->begin, tsn->end-ts->f->begin);
+ dbg(lvl_warning,"eon %d %td %td\n", ts->curr_node, *p-ts->f->begin, tsn->end-ts->f->begin);
if (! ts->curr_node)
break;
ts->curr_node--;
diff --git a/navit/map/shapefile/shapefile.c b/navit/map/shapefile/shapefile.c
index 7f4872d62..f311d514e 100644
--- a/navit/map/shapefile/shapefile.c
+++ b/navit/map/shapefile/shapefile.c
@@ -76,7 +76,7 @@ struct map_rect_priv {
static void
map_destroy_shapefile(struct map_priv *m)
{
- dbg(1,"map_destroy_shapefile\n");
+ dbg(lvl_warning,"map_destroy_shapefile\n");
g_free(m);
}
@@ -328,7 +328,7 @@ build_match(struct longest_match *lm, struct longest_match_list *lml, char *line
{
struct longest_match_list_item *lmli;
char *kvl=NULL,*i=NULL,*p,*kv;
- dbg(1,"line=%s\n",line);
+ dbg(lvl_warning,"line=%s\n",line);
kvl=line;
p=strchr(line,'\t');
if (p) {
@@ -424,7 +424,7 @@ attr_resolve(struct map_rect_priv *mr, enum attr_type attr_type, struct attr *at
}
if (!value[0])
return -1;
- dbg(1,"name=%s value=%s\n",name,value);
+ dbg(lvl_warning,"name=%s value=%s\n",name,value);
attr_free(mr->attr);
mr->attr=attr_new_from_text(name,value);
if (mr->attr) {
@@ -524,14 +524,14 @@ map_rect_new_shapefile(struct map_priv *map, struct map_selection *sel)
}
file_destroy(file);
} else {
- dbg(0,"Failed to open %s\n",dbfmapfile);
+ dbg(lvl_error,"Failed to open %s\n",dbfmapfile);
if (map->dbfmap_data) {
changed=1;
g_free(map->dbfmap_data);
map->dbfmap_data=NULL;
}
}
- dbg(1,"%s changed %d old %p\n",dbfmapfile,changed,map->dbfmap_data);
+ dbg(lvl_warning,"%s changed %d old %p\n",dbfmapfile,changed,map->dbfmap_data);
if (changed) {
longest_match_destroy(map->lm,1);
map->lm=NULL;
@@ -539,7 +539,7 @@ map_rect_new_shapefile(struct map_priv *map, struct map_selection *sel)
build_matches(map,map->dbfmap_data);
}
}
- dbg(1,"map_rect_new_shapefile\n");
+ dbg(lvl_warning,"map_rect_new_shapefile\n");
mr=g_new0(struct map_rect_priv, 1);
mr->m=map;
mr->idx=0;
@@ -595,12 +595,12 @@ map_rect_get_item_shapefile(struct map_rect_priv *mr)
if (count) {
mr->line=lines[0];
if (attr_from_line(mr->line,"type",NULL,type,NULL)) {
- dbg(1,"type='%s'\n", type);
+ dbg(lvl_warning,"type='%s'\n", type);
mr->item.type=item_from_name(type);
if (mr->item.type == type_none && strcmp(type,"none"))
- dbg(0,"Warning: type '%s' unknown\n", type);
+ dbg(lvl_error,"Warning: type '%s' unknown\n", type);
} else {
- dbg(0,"failed to get attribute type\n");
+ dbg(lvl_error,"failed to get attribute type\n");
}
} else
mr->line=NULL;
@@ -649,7 +649,7 @@ map_new_shapefile(struct map_methods *meth, struct attr **attrs, struct callback
char *shapefile,*dbffile;
if (! data)
return NULL;
- dbg(1,"map_new_shapefile %s\n", data->u.str);
+ dbg(lvl_warning,"map_new_shapefile %s\n", data->u.str);
wdata=g_strdup(data->u.str);
wexp=file_wordexp_new(wdata);
wexp_data=file_wordexp_get_array(wexp);
@@ -665,7 +665,7 @@ map_new_shapefile(struct map_methods *meth, struct attr **attrs, struct callback
m->hDBF=DBFOpen(dbffile, "rb");
m->nFields=DBFGetFieldCount(m->hDBF);
g_free(dbffile);
- dbg(1,"map_new_shapefile %s %s\n", m->filename, wdata);
+ dbg(lvl_warning,"map_new_shapefile %s %s\n", m->filename, wdata);
if (charset) {
m->charset=g_strdup(charset->u.str);
meth->charset=m->charset;
@@ -681,7 +681,7 @@ map_new_shapefile(struct map_methods *meth, struct attr **attrs, struct callback
void
plugin_init(void)
{
- dbg(1,"shapefile: plugin_init\n");
+ dbg(lvl_warning,"shapefile: plugin_init\n");
plugin_register_map_type("shapefile", map_new_shapefile);
}
@@ -759,7 +759,7 @@ static int VSI_SHP_Close( SAFile file )
static void VSI_SHP_Error( const char *message )
{
- dbg(0,"error:%s\n", message);
+ dbg(lvl_error,"error:%s\n", message);
}
/************************************************************************/
diff --git a/navit/map/textfile/textfile.c b/navit/map/textfile/textfile.c
index b019aaab2..558c86219 100644
--- a/navit/map/textfile/textfile.c
+++ b/navit/map/textfile/textfile.c
@@ -54,11 +54,11 @@ get_line(struct map_rect_priv *mr)
else
mr->pos+=mr->lastlen;
fgets(mr->line, TEXTFILE_LINE_SIZE, mr->f);
- dbg(1,"read textfile line: %s\n", mr->line);
+ dbg(lvl_warning,"read textfile line: %s\n", mr->line);
remove_comment_line(mr->line);
mr->lastlen=strlen(mr->line)+1;
if (strlen(mr->line) >= TEXTFILE_LINE_SIZE-1)
- dbg(0, "line too long: %s\n", mr->line);
+ dbg(lvl_error, "line too long: %s\n", mr->line);
}
}
@@ -94,12 +94,12 @@ textfile_coord_get(void *priv_data, struct coord *c, int count)
{
struct map_rect_priv *mr=priv_data;
int ret=0;
- dbg(1,"enter, count: %d\n",count);
+ dbg(lvl_warning,"enter, count: %d\n",count);
while (count--) {
if (mr->f && !feof(mr->f) && (!mr->item.id_hi || !mr->eoc) && parse_line(mr, mr->item.id_hi)) {
if (c){
*c=mr->c;
- dbg(1,"c=0x%x,0x%x\n", c->x, c->y);
+ dbg(lvl_warning,"c=0x%x,0x%x\n", c->x, c->y);
c++;
}
ret++;
@@ -136,31 +136,31 @@ textfile_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
{
struct map_rect_priv *mr=priv_data;
char *str=NULL;
- dbg(1,"mr=%p attrs='%s' ", mr, mr->attrs);
+ dbg(lvl_warning,"mr=%p attrs='%s' ", mr, mr->attrs);
if (attr_type != mr->attr_last) {
- dbg(1,"reset attr_pos\n");
+ dbg(lvl_warning,"reset attr_pos\n");
mr->attr_pos=0;
mr->attr_last=attr_type;
}
if (attr_type == attr_any) {
- dbg(1,"attr_any");
+ dbg(lvl_warning,"attr_any");
if (attr_from_line(mr->attrs,NULL,&mr->attr_pos,mr->attr, mr->attr_name)) {
attr_type=attr_from_name(mr->attr_name);
- dbg(1,"found attr '%s' 0x%x\n", mr->attr_name, attr_type);
+ dbg(lvl_warning,"found attr '%s' 0x%x\n", mr->attr_name, attr_type);
attr->type=attr_type;
textfile_encode_attr(mr->attr, attr_type, attr);
return 1;
}
} else {
str=attr_to_name(attr_type);
- dbg(1,"attr='%s' ",str);
+ dbg(lvl_warning,"attr='%s' ",str);
if (attr_from_line(mr->attrs,str,&mr->attr_pos,mr->attr, NULL)) {
textfile_encode_attr(mr->attr, attr_type, attr);
- dbg(1,"found\n");
+ dbg(lvl_warning,"found\n");
return 1;
}
}
- dbg(1,"not found\n");
+ dbg(lvl_warning,"not found\n");
return 0;
}
@@ -176,7 +176,7 @@ map_rect_new_textfile(struct map_priv *map, struct map_selection *sel)
{
struct map_rect_priv *mr;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
mr=g_new0(struct map_rect_priv, 1);
mr->m=map;
mr->sel=sel;
@@ -204,20 +204,20 @@ map_rect_new_textfile(struct map_priv *map, struct map_selection *sel)
}
sel=sel->next;
}
- dbg(1,"popen args %s\n", args);
+ dbg(lvl_warning,"popen args %s\n", args);
mr->args=args;
mr->f=popen(mr->args, "r");
mr->pos=0;
mr->lastlen=0;
#else
- dbg(0,"unable to work with pipes %s\n",map->filename);
+ dbg(lvl_error,"unable to work with pipes %s\n",map->filename);
#endif
} else {
mr->f=fopen(map->filename, "r");
}
if(!mr->f) {
if (!(errno == ENOENT && map->no_warning_if_map_file_missing)) {
- dbg(0, "error opening textfile %s: %s\n", map->filename, strerror(errno));
+ dbg(lvl_error, "error opening textfile %s: %s\n", map->filename, strerror(errno));
}
}
get_line(mr);
@@ -245,7 +245,7 @@ static struct item *
map_rect_get_item_textfile(struct map_rect_priv *mr)
{
char *p,type[TEXTFILE_LINE_SIZE];
- dbg(1,"map_rect_get_item_textfile id_hi=%d line=%s", mr->item.id_hi, mr->line);
+ dbg(lvl_warning,"map_rect_get_item_textfile id_hi=%d line=%s", mr->item.id_hi, mr->line);
if (!mr->f) {
return NULL;
}
@@ -255,7 +255,7 @@ map_rect_get_item_textfile(struct map_rect_priv *mr)
}
for(;;) {
if (feof(mr->f)) {
- dbg(1,"map_rect_get_item_textfile: eof %d\n",mr->item.id_hi);
+ dbg(lvl_warning,"map_rect_get_item_textfile: eof %d\n",mr->item.id_hi);
if (mr->m->flags & 1) {
if (!mr->item.id_hi)
return NULL;
@@ -286,7 +286,7 @@ map_rect_get_item_textfile(struct map_rect_priv *mr)
get_line(mr);
continue;
}
- dbg(1,"map_rect_get_item_textfile: point found\n");
+ dbg(lvl_warning,"map_rect_get_item_textfile: point found\n");
mr->eoc=0;
mr->item.id_lo=mr->pos;
} else {
@@ -294,7 +294,7 @@ map_rect_get_item_textfile(struct map_rect_priv *mr)
get_line(mr);
continue;
}
- dbg(1,"map_rect_get_item_textfile: line found\n");
+ dbg(lvl_warning,"map_rect_get_item_textfile: line found\n");
if (! mr->line[0]) {
get_line(mr);
continue;
@@ -302,21 +302,21 @@ map_rect_get_item_textfile(struct map_rect_priv *mr)
mr->item.id_lo=mr->pos;
strcpy(mr->attrs, mr->line);
get_line(mr);
- dbg(1,"mr=%p attrs=%s\n", mr, mr->attrs);
+ dbg(lvl_warning,"mr=%p attrs=%s\n", mr, mr->attrs);
}
- dbg(1,"get_attrs %s\n", mr->attrs);
+ dbg(lvl_warning,"get_attrs %s\n", mr->attrs);
if (attr_from_line(mr->attrs,"type",NULL,type,NULL)) {
- dbg(1,"type='%s'\n", type);
+ dbg(lvl_warning,"type='%s'\n", type);
mr->item.type=item_from_name(type);
if (mr->item.type == type_none)
- dbg(0, "Warning: type '%s' unknown\n", type);
+ dbg(lvl_error, "Warning: type '%s' unknown\n", type);
} else {
get_line(mr);
continue;
}
mr->attr_last=attr_none;
mr->more=1;
- dbg(1,"return attr='%s'\n", mr->attrs);
+ dbg(lvl_warning,"return attr='%s'\n", mr->attrs);
return &mr->item;
}
}
@@ -362,7 +362,7 @@ map_new_textfile(struct map_methods *meth, struct attr **attrs, struct callback_
char **wexp_data;
if (! data)
return NULL;
- dbg(1,"map_new_textfile %s\n", data->u.str);
+ dbg(lvl_warning,"map_new_textfile %s\n", data->u.str);
wdata=g_strdup(data->u.str);
len=strlen(wdata);
if (len && wdata[len-1] == '|') {
@@ -380,7 +380,7 @@ map_new_textfile(struct map_methods *meth, struct attr **attrs, struct callback_
m->no_warning_if_map_file_missing=(no_warn!=NULL) && (no_warn->u.num);
if (flags)
m->flags=flags->u.num;
- dbg(1,"map_new_textfile %s %s\n", m->filename, wdata);
+ dbg(lvl_warning,"map_new_textfile %s %s\n", m->filename, wdata);
if (charset) {
m->charset=g_strdup(charset->u.str);
meth->charset=m->charset;
@@ -393,7 +393,7 @@ map_new_textfile(struct map_methods *meth, struct attr **attrs, struct callback_
void
plugin_init(void)
{
- dbg(1,"textfile: plugin_init\n");
+ dbg(lvl_warning,"textfile: plugin_init\n");
plugin_register_map_type("textfile", map_new_textfile);
}
diff --git a/navit/maps.c b/navit/maps.c
index 54723917b..fa5b5e24d 100644
--- a/navit/maps.c
+++ b/navit/maps.c
@@ -32,14 +32,14 @@ maps_new(struct attr *parent, struct attr **attrs)
{
struct attr *data,**attrs_dup;
if (!parent) {
- dbg(0,"No parent\n");
+ dbg(lvl_error,"No parent\n");
return NULL;
}
if (parent->type != attr_mapset) {
- dbg(0,"Parent must be mapset\n");
+ dbg(lvl_error,"Parent must be mapset\n");
return NULL;
}
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
attrs_dup=attr_list_dup(attrs);
data=attr_search(attrs_dup, NULL, attr_data);
if (data) {
@@ -79,7 +79,7 @@ maps_new(struct attr *parent, struct attr **attrs)
}
file_wordexp_destroy(wexp);
} else {
- dbg(0,"no data attribute\n");
+ dbg(lvl_error,"no data attribute\n");
}
attr_list_free(attrs_dup);
return NULL;
diff --git a/navit/mapset.c b/navit/mapset.c
index 45ccbe907..7033745dc 100644
--- a/navit/mapset.c
+++ b/navit/mapset.c
@@ -310,7 +310,7 @@ struct mapset_search *
mapset_search_new(struct mapset *ms, struct item *item, struct attr *search_attr, int partial)
{
struct mapset_search *this;
- dbg(1,"enter(%p,%p,%p,%d)\n", ms, item, search_attr, partial);
+ dbg(lvl_warning,"enter(%p,%p,%p,%d)\n", ms, item, search_attr, partial);
this=g_new0(struct mapset_search,1);
if(this != NULL && ms!=NULL )
{
diff --git a/navit/maptool/ch.c b/navit/maptool/ch.c
index 0465fd39f..dffee3058 100644
--- a/navit/maptool/ch.c
+++ b/navit/maptool/ch.c
@@ -252,7 +252,7 @@ ch_process_node(FILE *out, int node, int resolve)
item_bin=init_item(type_ch_node);
oldnode=GPOINTER_TO_INT(g_hash_table_lookup(newnode_hash, GINT_TO_POINTER(node)));
#if 0
- dbg(0,"0x%x,0x%x\n",node_index[oldnode].x,node_index[oldnode].y);
+ dbg(lvl_error,"0x%x,0x%x\n",node_index[oldnode].x,node_index[oldnode].y);
#endif
item_bin_add_coord(item_bin, &node_index[oldnode], 1);
fwd.first=oldnode;
@@ -279,7 +279,7 @@ ch_process_node(FILE *out, int node, int resolve)
} else {
ch_edge.middle=*id;
#if 0
- dbg(0,"middle street id for is "ITEM_ID_FMT"\n",ITEM_ID_ARGS(*id));
+ dbg(lvl_error,"middle street id for is "ITEM_ID_FMT"\n",ITEM_ID_ARGS(*id));
#endif
}
} else {
@@ -288,12 +288,12 @@ ch_process_node(FILE *out, int node, int resolve)
dbg_assert(id != NULL);
ch_edge.middle=*id;
#if 0
- dbg(0,"middle node id for is "ITEM_ID_FMT"\n",ITEM_ID_ARGS(*id));
+ dbg(lvl_error,"middle node id for is "ITEM_ID_FMT"\n",ITEM_ID_ARGS(*id));
#endif
}
id=g_hash_table_lookup(sgr_nodes_hash, GINT_TO_POINTER((int)edge->target));
#if 0
- dbg(0,"id for %d is "ITEM_ID_FMT"\n",edge->target,ITEM_ID_ARGS(*id));
+ dbg(lvl_error,"id for %d is "ITEM_ID_FMT"\n",edge->target,ITEM_ID_ARGS(*id));
#endif
if (id == NULL) {
fprintf(stderr,"Failed to look up target %d\n",edge->target);
@@ -511,7 +511,7 @@ ch_assemble_map(char *map_suffix, char *suffix, struct zip_info *zip_info)
struct item_id *id2=g_slice_new(struct item_id);
*id2=id;
#if 0
- dbg(0,"%d is "ITEM_ID_FMT"\n",nodeid,ITEM_ID_ARGS(*id2));
+ dbg(lvl_error,"%d is "ITEM_ID_FMT"\n",nodeid,ITEM_ID_ARGS(*id2));
#endif
g_hash_table_insert(sgr_nodes_hash, GINT_TO_POINTER(nodeid), id2);
nodeid++;
diff --git a/navit/maptool/coastline.c b/navit/maptool/coastline.c
index 8e1df8142..74c07aa90 100644
--- a/navit/maptool/coastline.c
+++ b/navit/maptool/coastline.c
@@ -49,15 +49,14 @@ find_next(struct rect *bbox, GList *segments, struct coord *c, int exclude, stru
GList *curr;
int i;
struct geom_poly_segment *ret=NULL;
- int dbgl=1;
for (i = 0 ; i < 2 ; i++) {
curr=segments;
- dbg(dbgl,"search distance %d\n",search);
+ dbg(lvl_warning,"search distance %d\n",search);
while (curr) {
struct geom_poly_segment *seg=curr->data;
int dist=distance_from_ll(seg->first, bbox);
- dbg(dbgl,"0x%x 0x%x dist %d\n",seg->first->x,seg->first->y,dist);
+ dbg(lvl_warning,"0x%x 0x%x dist %d\n",seg->first->x,seg->first->y,dist);
if (dist != -1 && seg->first != seg->last && dist < min && (dist >= search)) {
min=dist;
ci[0]=*seg->first;
@@ -177,7 +176,6 @@ tile_collector_process_tile(char *tile, int *tile_data, struct coastline_tile_da
struct geom_poly_segment *first;
struct item_bin *ib=NULL;
struct item_bin_sink *out=data->sink->priv_data[1];
- int dbgl=1;
int edges=0,flags;
GList *sorted_segments,*curr;
struct item_bin *ibt=(struct item_bin *)(tile_data+1);
@@ -257,7 +255,7 @@ tile_collector_process_tile(char *tile, int *tile_data, struct coastline_tile_da
for (;;) {
search++;
// item_bin_write_debug_point_to_sink(out, &end, "Search %d",search);
- dbg(dbgl,"searching next polygon from 0x%x 0x%x\n",end.x,end.y);
+ dbg(lvl_warning,"searching next polygon from 0x%x 0x%x\n",end.x,end.y);
first=find_next(&bbox, sorted_segments, &end, exclude, cn);
exclude=1;
if (!first)
@@ -267,7 +265,7 @@ tile_collector_process_tile(char *tile, int *tile_data, struct coastline_tile_da
tile_start_valid=1;
} else {
if (cn[0].x == tile_start.x && cn[0].y == tile_start.y) {
- dbg(dbgl,"end of tile reached\n");
+ dbg(lvl_warning,"end of tile reached\n");
break;
}
}
@@ -276,7 +274,7 @@ tile_collector_process_tile(char *tile, int *tile_data, struct coastline_tile_da
continue;
}
poly_start_valid=0;
- dbg(dbgl,"start of polygon 0x%x 0x%x\n",cn[0].x,cn[0].y);
+ dbg(lvl_warning,"start of polygon 0x%x 0x%x\n",cn[0].x,cn[0].y);
for (;;) {
if (!poly_start_valid) {
poly_start=cn[0];
@@ -285,7 +283,7 @@ tile_collector_process_tile(char *tile, int *tile_data, struct coastline_tile_da
} else {
close_polygon(ib, &end, &cn[0], 1, &bbox, &edges);
if (cn[0].x == poly_start.x && cn[0].y == poly_start.y) {
- dbg(dbgl,"poly end reached\n");
+ dbg(lvl_warning,"poly end reached\n");
item_bin_add_attr_longlong(ib, attr_osm_wayid, ct->wayid);
item_bin_write_to_sink(ib, out, NULL);
end=cn[0];
@@ -298,11 +296,11 @@ tile_collector_process_tile(char *tile, int *tile_data, struct coastline_tile_da
first->type=geom_poly_segment_type_none;
end=cn[1];
if (distance_from_ll(&end, &bbox) == -1) {
- dbg(dbgl,"incomplete\n");
+ dbg(lvl_warning,"incomplete\n");
break;
}
first=find_next(&bbox, sorted_segments, &end, 1, cn);
- dbg(dbgl,"next segment of polygon 0x%x 0x%x\n",cn[0].x,cn[0].y);
+ dbg(lvl_warning,"next segment of polygon 0x%x 0x%x\n",cn[0].x,cn[0].y);
}
if (search > 55)
break;
diff --git a/navit/navigation.c b/navit/navigation.c
index 179e37663..6876cd9b9 100644
--- a/navit/navigation.c
+++ b/navit/navigation.c
@@ -144,7 +144,7 @@ navigation_get_attr(struct navigation *this_, enum attr_type type, struct attr *
{
struct map_rect *mr;
struct item *item;
- dbg(1,"enter %s\n", attr_to_name(type));
+ dbg(lvl_warning,"enter %s\n", attr_to_name(type));
switch (type) {
case attr_map:
attr->u.map=this_->map;
@@ -242,7 +242,7 @@ navigation_set_announce(struct navigation *this_, enum item_type type, int *leve
{
int i;
if (type < route_item_first || type > route_item_last) {
- dbg(0,"street type %d out of range [%d,%d]", type, route_item_first, route_item_last);
+ dbg(lvl_error,"street type %d out of range [%d,%d]", type, route_item_first, route_item_last);
return 0;
}
for (i = 0 ; i < 3 ; i++)
@@ -313,7 +313,7 @@ static int
road_angle(struct coord *c1, struct coord *c2, int dir)
{
int ret=transform_get_angle_delta(c1, c2, dir);
- dbg(1, "road_angle(0x%x,0x%x - 0x%x,0x%x)=%d\n", c1->x, c1->y, c2->x, c2->y, ret);
+ dbg(lvl_warning, "road_angle(0x%x,0x%x - 0x%x,0x%x)=%d\n", c1->x, c1->y, c2->x, c2->y, ret);
return ret;
}
@@ -414,7 +414,7 @@ round_for_vocabulary(int vocabulary, int dist, int factor)
break;
i++;
}
- dbg(0,"converted %d to %d with factor %d\n",dist,distances[m],factor);
+ dbg(lvl_error,"converted %d to %d with factor %d\n",dist,distances[m],factor);
dist=distances[m];
}
return dist*factor;
@@ -526,7 +526,7 @@ calculate_angle(struct navigation_way *w)
ritem = map_rect_get_item_byid(mr, w->item.id_hi, w->item.id_lo);
if (!ritem) {
- dbg(1,"Item from segment not found on map!\n");
+ dbg(lvl_warning,"Item from segment not found on map!\n");
map_rect_destroy(mr);
return;
}
@@ -550,7 +550,7 @@ calculate_angle(struct navigation_way *w)
if (w->dir < 0) {
if (item_coord_get(ritem, cbuf, 2) != 2) {
- dbg(1,"Using calculate_angle() with a less-than-two-coords-item?\n");
+ dbg(lvl_warning,"Using calculate_angle() with a less-than-two-coords-item?\n");
map_rect_destroy(mr);
return;
}
@@ -562,7 +562,7 @@ calculate_angle(struct navigation_way *w)
} else {
if (item_coord_get(ritem, cbuf, 2) != 2) {
- dbg(1,"Using calculate_angle() with a less-than-two-coords-item?\n");
+ dbg(lvl_warning,"Using calculate_angle() with a less-than-two-coords-item?\n");
map_rect_destroy(mr);
return;
}
@@ -680,7 +680,7 @@ navigation_itm_ways_update(struct navigation_itm *itm, struct map *graph_map)
}
if (!item_attr_get(i,attr_street_item,&sitem_attr)) {
- dbg(1, "Got no street item for route graph item in entering_straight()\n");
+ dbg(lvl_warning, "Got no street item for route graph item in entering_straight()\n");
continue;
}
@@ -714,12 +714,12 @@ navigation_destroy_itms_cmds(struct navigation *this_, struct navigation_itm *en
{
struct navigation_itm *itm;
struct navigation_command *cmd;
- dbg(2,"enter this_=%p this_->first=%p this_->cmd_first=%p end=%p\n", this_, this_->first, this_->cmd_first, end);
+ dbg(lvl_info,"enter this_=%p this_->first=%p this_->cmd_first=%p end=%p\n", this_, this_->first, this_->cmd_first, end);
if (this_->cmd_first)
- dbg(2,"this_->cmd_first->itm=%p\n", this_->cmd_first->itm);
+ dbg(lvl_info,"this_->cmd_first->itm=%p\n", this_->cmd_first->itm);
while (this_->first && this_->first != end) {
itm=this_->first;
- dbg(3,"destroying %p\n", itm);
+ dbg(lvl_debug,"destroying %p\n", itm);
item_hash_remove(this_->hash, &itm->way.item);
this_->first=itm->next;
if (this_->first)
@@ -740,8 +740,8 @@ navigation_destroy_itms_cmds(struct navigation *this_, struct navigation_itm *en
if (! this_->first)
this_->last=NULL;
if (! this_->first && end)
- dbg(0,"end wrong\n");
- dbg(2,"ret this_->first=%p this_->cmd_first=%p\n",this_->first, this_->cmd_first);
+ dbg(lvl_error,"end wrong\n");
+ dbg(lvl_info,"ret this_->first=%p this_->cmd_first=%p\n",this_->first, this_->cmd_first);
}
static void
@@ -750,19 +750,19 @@ navigation_itm_update(struct navigation_itm *itm, struct item *ritem)
struct attr length, time, speed;
if (! item_attr_get(ritem, attr_length, &length)) {
- dbg(0,"no length\n");
+ dbg(lvl_error,"no length\n");
return;
}
if (! item_attr_get(ritem, attr_time, &time)) {
- dbg(0,"no time\n");
+ dbg(lvl_error,"no time\n");
return;
}
if (! item_attr_get(ritem, attr_speed, &speed)) {
- dbg(0,"no time\n");
+ dbg(lvl_error,"no time\n");
return;
}
- dbg(1,"length=%ld time=%ld speed=%ld\n", length.u.num, time.u.num, speed.u.num);
+ dbg(lvl_warning,"length=%ld time=%ld speed=%ld\n", length.u.num, time.u.num, speed.u.num);
itm->length=length.u.num;
itm->time=time.u.num;
itm->speed=speed.u.num;
@@ -839,7 +839,7 @@ navigation_itm_new(struct navigation *this_, struct item *ritem)
if (ritem) {
ret->streetname_told=0;
if (! item_attr_get(ritem, attr_street_item, &street_item)) {
- dbg(1, "no street item\n");
+ dbg(lvl_warning, "no street item\n");
g_free(ret);
ret = NULL;
return ret;
@@ -865,7 +865,7 @@ navigation_itm_new(struct navigation *this_, struct item *ritem)
navigation_itm_update(ret, ritem);
while (item_coord_get(ritem, &c[i], 1)) {
- dbg(1, "coord %d 0x%x 0x%x\n", i, c[i].x ,c[i].y);
+ dbg(lvl_warning, "coord %d 0x%x 0x%x\n", i, c[i].x ,c[i].y);
if (i < 4)
i++;
@@ -874,7 +874,7 @@ navigation_itm_new(struct navigation *this_, struct item *ritem)
c[3]=c[4];
}
}
- dbg(1,"count=%d\n", i);
+ dbg(lvl_warning,"count=%d\n", i);
i--;
ret->way.angle2=road_angle(&c[0], &c[1], 0);
@@ -889,7 +889,7 @@ navigation_itm_new(struct navigation *this_, struct item *ritem)
ret->way.flags |= AF_ROUNDABOUT;
}
- dbg(1,"i=%d start %d end %d '%s' '%s'\n", i, ret->way.angle2, ret->angle_end, ret->way.name1, ret->way.name2);
+ dbg(lvl_warning,"i=%d start %d end %d '%s' '%s'\n", i, ret->way.angle2, ret->angle_end, ret->way.name1, ret->way.name2);
map_rect_destroy(mr);
} else {
if (this_->last)
@@ -904,7 +904,7 @@ navigation_itm_new(struct navigation *this_, struct item *ritem)
navigation_itm_ways_update(ret,graph_map);
}
}
- dbg(1,"ret=%p\n", ret);
+ dbg(lvl_warning,"ret=%p\n", ret);
this_->last=ret;
return ret;
}
@@ -975,21 +975,21 @@ calculate_dest_distance(struct navigation *this_, int incr)
{
int len=0, time=0, count=0;
struct navigation_itm *next,*itm=this_->last;
- dbg(1, "enter this_=%p, incr=%d\n", this_, incr);
+ dbg(lvl_warning, "enter this_=%p, incr=%d\n", this_, incr);
if (incr) {
if (itm) {
- dbg(2, "old values: (%p) time=%d lenght=%d\n", itm, itm->dest_length, itm->dest_time);
+ dbg(lvl_info, "old values: (%p) time=%d lenght=%d\n", itm, itm->dest_length, itm->dest_time);
} else {
- dbg(2, "old values: itm is null\n");
+ dbg(lvl_info, "old values: itm is null\n");
}
itm=this_->first;
next=itm->next;
- dbg(2, "itm values: time=%d lenght=%d\n", itm->length, itm->time);
- dbg(2, "next values: (%p) time=%d lenght=%d\n", next, next->dest_length, next->dest_time);
+ dbg(lvl_info, "itm values: time=%d lenght=%d\n", itm->length, itm->time);
+ dbg(lvl_info, "next values: (%p) time=%d lenght=%d\n", next, next->dest_length, next->dest_time);
itm->dest_length=next->dest_length+itm->length;
itm->dest_count=next->dest_count+1;
itm->dest_time=next->dest_time+itm->time;
- dbg(2, "new values: time=%d lenght=%d\n", itm->dest_length, itm->dest_time);
+ dbg(lvl_info, "new values: time=%d lenght=%d\n", itm->dest_length, itm->dest_time);
return;
}
while (itm) {
@@ -1000,7 +1000,7 @@ calculate_dest_distance(struct navigation *this_, int incr)
itm->dest_count=count++;
itm=itm->prev;
}
- dbg(1,"len %d time %d\n", len, time);
+ dbg(lvl_warning,"len %d time %d\n", len, time);
}
/**
@@ -1018,14 +1018,14 @@ static int
is_same_street2(char *old_name1, char *old_name2, char *new_name1, char *new_name2)
{
if (old_name1 && new_name1 && !strcmp(old_name1, new_name1)) {
- dbg(1,"is_same_street: '%s' '%s' vs '%s' '%s' yes (1.)\n", old_name2, new_name2, old_name1, new_name1);
+ dbg(lvl_warning,"is_same_street: '%s' '%s' vs '%s' '%s' yes (1.)\n", old_name2, new_name2, old_name1, new_name1);
return 1;
}
if (old_name2 && new_name2 && !strcmp(old_name2, new_name2)) {
- dbg(1,"is_same_street: '%s' '%s' vs '%s' '%s' yes (2.)\n", old_name2, new_name2, old_name1, new_name1);
+ dbg(lvl_warning,"is_same_street: '%s' '%s' vs '%s' '%s' yes (2.)\n", old_name2, new_name2, old_name1, new_name1);
return 1;
}
- dbg(1,"is_same_street: '%s' '%s' vs '%s' '%s' no\n", old_name2, new_name2, old_name1, new_name1);
+ dbg(lvl_warning,"is_same_street: '%s' '%s' vs '%s' '%s' no\n", old_name2, new_name2, old_name1, new_name1);
return 0;
}
@@ -1094,10 +1094,10 @@ maneuver_straight(struct navigation_itm *new, int diff)
struct navigation_way *w;
w = new->way.next;
- dbg(1,"diff=%d\n", diff);
+ dbg(lvl_warning,"diff=%d\n", diff);
while (w) {
curr_diff=abs(angle_delta(new->prev->angle_end, w->angle2));
- dbg(1,"curr_diff=%d\n", curr_diff);
+ dbg(lvl_warning,"curr_diff=%d\n", curr_diff);
if (curr_diff < diff) {
return 0;
}
@@ -1214,7 +1214,7 @@ maneuver_required2(struct navigation *nav, struct navigation_itm *old, struct na
int num_new_motorways = 0; /* number of motorway-like ways */
int num_other = 0; /* number of ways which are neither motorway-like nor ramps */
- dbg(1,"enter %p %p %p\n",old, new, delta);
+ dbg(lvl_warning,"enter %p %p %p\n",old, new, delta);
d=angle_delta(old->angle_end, new->way.angle2);
if (!new->way.next) {
/* No announcement necessary */
@@ -1407,9 +1407,9 @@ maneuver_required2(struct navigation *nav, struct navigation_itm *old, struct na
if (left < -dlim && right > dlim)
is_unambiguous=1;
if (dc != d) {
- dbg(1,"d %d vs dc %d\n",d,dc);
+ dbg(lvl_warning,"d %d vs dc %d\n",d,dc);
d-=(dc+d+1)/2;
- dbg(1,"result %d\n",d);
+ dbg(lvl_warning,"result %d\n",d);
is_unambiguous=0;
}
if (!is_same_street && is_unambiguous < 1) {
@@ -1433,7 +1433,7 @@ maneuver_required2(struct navigation *nav, struct navigation_itm *old, struct na
if (new->item.type == old->item.type || (new->item.type != type_ramp && old->item.type != type_ramp)) {
if (is_same_street2(old, new)) {
if (! entering_straight(new, abs(*delta))) {
- dbg(1, "maneuver_required: Not driving straight: yes\n");
+ dbg(lvl_warning, "maneuver_required: Not driving straight: yes\n");
if (reason)
*reason="yes: Not driving straight";
return 1;
@@ -1449,17 +1449,17 @@ maneuver_required2(struct navigation *nav, struct navigation_itm *old, struct na
*reason="yes: delta > ext_limit for same name";
return 1;
} else {
- dbg(1, "maneuver_required: Staying on the same street: no\n");
+ dbg(lvl_warning, "maneuver_required: Staying on the same street: no\n");
if (reason)
*reason="no: Staying on same street";
return 0;
}
}
} else
- dbg(1, "maneuver_required: old or new is ramp\n");
+ dbg(lvl_warning, "maneuver_required: old or new is ramp\n");
#if 0
if (old->item.type == type_ramp && (new->item.type == type_highway_city || new->item.type == type_highway_land)) {
- dbg(1, "no_maneuver_required: old is ramp new is highway\n");
+ dbg(lvl_warning, "no_maneuver_required: old is ramp new is highway\n");
if (reason)
*reason="no: old is ramp new is highway";
return 0;
@@ -1467,13 +1467,13 @@ maneuver_required2(struct navigation *nav, struct navigation_itm *old, struct na
#endif
#if 0
if (old->crossings_end == 2) {
- dbg(1, "maneuver_required: only 2 connections: no\n");
+ dbg(lvl_warning, "maneuver_required: only 2 connections: no\n");
return 0;
}
#endif
- dbg(1,"delta=%d-%d=%d\n", new->way.angle2, old->angle_end, *delta);
+ dbg(lvl_warning,"delta=%d-%d=%d\n", new->way.angle2, old->angle_end, *delta);
if ((new->item.type == type_highway_land || new->item.type == type_highway_city || old->item.type == type_highway_land || old->item.type == type_highway_city) && (!is_same_street_systematic(old, new) || (old->name2 != NULL && new->name2 == NULL))) {
- dbg(1, "maneuver_required: highway changed name\n");
+ dbg(lvl_warning, "maneuver_required: highway changed name\n");
if (reason)
*reason="yes: highway changed name";
return 1;
@@ -1482,11 +1482,11 @@ maneuver_required2(struct navigation *nav, struct navigation_itm *old, struct na
if (! entering_straight(new,abs(*delta))) {
if (reason)
*reason="yes: not straight";
- dbg(1, "maneuver_required: not driving straight: yes\n");
+ dbg(lvl_warning, "maneuver_required: not driving straight: yes\n");
return 1;
}
- dbg(1, "maneuver_required: delta(%d) < %d: no\n", *delta, straight_limit);
+ dbg(lvl_warning, "maneuver_required: delta(%d) < %d: no\n", *delta, straight_limit);
if (reason)
*reason="no: delta < limit";
return 0;
@@ -1500,13 +1500,13 @@ maneuver_required2(struct navigation *nav, struct navigation_itm *old, struct na
}
if (! check_multiple_streets(new)) {
- dbg(1, "maneuver_required: only one possibility: no\n");
+ dbg(lvl_warning, "maneuver_required: only one possibility: no\n");
if (reason)
*reason="no: only one possibility";
return 0;
}
- dbg(1, "maneuver_required: delta=%d: yes\n", *delta);
+ dbg(lvl_warning, "maneuver_required: delta=%d: yes\n", *delta);
if (reason)
*reason="yes: delta >= limit";
return 1;
@@ -1517,7 +1517,7 @@ static struct navigation_command *
command_new(struct navigation *this_, struct navigation_itm *itm, int delta)
{
struct navigation_command *ret=g_new0(struct navigation_command, 1);
- dbg(1,"enter this_=%p itm=%p delta=%d\n", this_, itm, delta);
+ dbg(lvl_warning,"enter this_=%p itm=%p delta=%d\n", this_, itm, delta);
ret->delta=delta;
ret->itm=itm;
if (itm && itm->prev && itm->way.next && itm->prev->way.next && !(itm->way.flags & AF_ROUNDABOUT) && (itm->prev->way.flags & AF_ROUNDABOUT)) {
@@ -1526,7 +1526,7 @@ command_new(struct navigation *this_, struct navigation_itm *itm, int delta)
int entry_angle;
struct navigation_itm *itm2=itm->prev;
int exit_angle=angle_median(itm->prev->angle_end, itm->way.next->angle2);
- dbg(1,"exit %d median from %d,%d\n", exit_angle,itm->prev->angle_end, itm->way.next->angle2);
+ dbg(lvl_warning,"exit %d median from %d,%d\n", exit_angle,itm->prev->angle_end, itm->way.next->angle2);
while (itm2 && (itm2->way.flags & AF_ROUNDABOUT)) {
len+=itm2->length;
angle=itm2->angle_end;
@@ -1535,11 +1535,11 @@ command_new(struct navigation *this_, struct navigation_itm *itm, int delta)
if (itm2 && itm2->next && itm2->next->way.next) {
itm2=itm2->next;
entry_angle=angle_median(angle_opposite(itm2->way.angle2), itm2->way.next->angle2);
- dbg(1,"entry %d median from %d(%d),%d\n", entry_angle,angle_opposite(itm2->way.angle2), itm2->way.angle2, itm2->way.next->angle2);
+ dbg(lvl_warning,"entry %d median from %d(%d),%d\n", entry_angle,angle_opposite(itm2->way.angle2), itm2->way.angle2, itm2->way.next->angle2);
} else {
entry_angle=angle_opposite(angle);
}
- dbg(0,"entry %d exit %d\n", entry_angle, exit_angle);
+ dbg(lvl_error,"entry %d exit %d\n", entry_angle, exit_angle);
ret->roundabout_delta=angle_delta(entry_angle, exit_angle);
ret->length=len+roundabout_extra_length;
}
@@ -1622,7 +1622,7 @@ navigation_item_destination(struct navigation *nav, struct navigation_itm *itm,
if (!vocabulary2)
n2=NULL;
if(!n1 && !n2 && itm->way.item.type == type_ramp && vocabulary2) {
- dbg(1,">> Next is ramp %x current is %x \n", itm->way.item.type, next->way.item.type);
+ dbg(lvl_warning,">> Next is ramp %x current is %x \n", itm->way.item.type, next->way.item.type);
if(next->way.item.type == type_ramp)
return NULL;
@@ -1755,7 +1755,7 @@ show_maneuver(struct navigation *nav, struct navigation_itm *itm, struct navigat
/* TRANSLATORS: Don't forget the ending space */
strength=_("really strongly ");
} else {
- dbg(1,"delta=%d\n", delta);
+ dbg(lvl_warning,"delta=%d\n", delta);
/* TRANSLATORS: Don't forget the ending space */
strength=_("unknown ");
}
@@ -1771,7 +1771,7 @@ show_maneuver(struct navigation *nav, struct navigation_itm *itm, struct navigat
if (!connect) {
level=navigation_get_announce_level_cmd(nav, itm, cmd, distance-cmd->length);
}
- dbg(1,"distance=%d level=%d type=0x%x\n", distance, level, itm->way.item.type);
+ dbg(lvl_warning,"distance=%d level=%d type=0x%x\n", distance, level, itm->way.item.type);
}
if (cmd->itm->prev->way.flags & AF_ROUNDABOUT) {
@@ -1986,10 +1986,10 @@ navigation_call_callbacks(struct navigation *this_, int force_speech)
if (!this_->cmd_first)
return;
callback_list_call(this_->callback, 1, &p);
- dbg(1,"force_speech=%d turn_around=%d turn_around_limit=%d\n", force_speech, this_->turn_around, this_->turn_around_limit);
+ dbg(lvl_warning,"force_speech=%d turn_around=%d turn_around_limit=%d\n", force_speech, this_->turn_around, this_->turn_around_limit);
distance=round_distance(this_->first->dest_length-this_->cmd_first->itm->dest_length);
if (this_->turn_around_limit && this_->turn_around == this_->turn_around_limit) {
- dbg(1,"distance=%d distance_turn=%d\n", distance, this_->distance_turn);
+ dbg(lvl_warning,"distance=%d distance_turn=%d\n", distance, this_->distance_turn);
while (distance > this_->distance_turn) {
this_->level_last=4;
level=4;
@@ -2007,8 +2007,8 @@ navigation_call_callbacks(struct navigation *this_, int force_speech)
/* only tell if the level is valid for more than 3 seconds */
int speed_distance=this_->first->speed*30/36;
if (distance < speed_distance || navigation_get_announce_level_cmd(this_, this_->first, this_->cmd_first, distance-speed_distance) == level) {
- dbg(1,"distance %d speed_distance %d\n",distance,speed_distance);
- dbg(1,"level %d < %d\n", level, this_->level_last);
+ dbg(lvl_warning,"distance %d speed_distance %d\n",distance,speed_distance);
+ dbg(lvl_warning,"level %d < %d\n", level, this_->level_last);
this_->level_last=level;
force_speech=3;
}
@@ -2030,7 +2030,7 @@ navigation_call_callbacks(struct navigation *this_, int force_speech)
if (force_speech) {
this_->level_last=level;
this_->curr_delay=0;
- dbg(1,"force_speech=%d distance=%d level=%d type=0x%x\n", force_speech, distance, level, this_->first->way.item.type);
+ dbg(lvl_warning,"force_speech=%d distance=%d level=%d type=0x%x\n", force_speech, distance, level, this_->first->way.item.type);
callback_list_call(this_->callback_speech, 1, &p);
}
}
@@ -2049,7 +2049,7 @@ navigation_update(struct navigation *this_, struct route *route, struct attr *at
if (attr->type != attr_route_status)
return;
- dbg(1,"enter %d\n", mode);
+ dbg(lvl_warning,"enter %d\n", mode);
if (attr->u.num == route_status_no_destination || attr->u.num == route_status_not_found || attr->u.num == route_status_path_done_new)
navigation_flush(this_);
if (attr->u.num != route_status_path_done_new && attr->u.num != route_status_path_done_incremental)
@@ -2067,7 +2067,7 @@ navigation_update(struct navigation *this_, struct route *route, struct attr *at
this_->vehicleprofile=vehicleprofile.u.vehicleprofile;
else
this_->vehicleprofile=NULL;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
while ((ritem=map_rect_get_item(mr))) {
if (ritem->type == type_route_start && this_->turn_around > -this_->turn_around_limit+1)
this_->turn_around--;
@@ -2080,11 +2080,11 @@ navigation_update(struct navigation *this_, struct route *route, struct attr *at
if (!item_attr_get(ritem, attr_direction, &street_direction))
street_direction.u.num=0;
sitem=street_item.u.item;
- dbg(1,"sitem=%p\n", sitem);
+ dbg(lvl_warning,"sitem=%p\n", sitem);
itm=item_hash_lookup(this_->hash, sitem);
- dbg(2,"itm for item with id (0x%x,0x%x) is %p\n", sitem->id_hi, sitem->id_lo, itm);
+ dbg(lvl_info,"itm for item with id (0x%x,0x%x) is %p\n", sitem->id_hi, sitem->id_lo, itm);
if (itm && itm->way.dir != street_direction.u.num) {
- dbg(2,"wrong direction\n");
+ dbg(lvl_info,"wrong direction\n");
itm=NULL;
}
navigation_destroy_itms_cmds(this_, itm);
@@ -2092,11 +2092,11 @@ navigation_update(struct navigation *this_, struct route *route, struct attr *at
navigation_itm_update(itm, ritem);
break;
}
- dbg(1,"not on track\n");
+ dbg(lvl_warning,"not on track\n");
}
navigation_itm_new(this_, ritem);
}
- dbg(2,"turn_around=%d\n", this_->turn_around);
+ dbg(lvl_info,"turn_around=%d\n", this_->turn_around);
if (first)
navigation_destroy_itms_cmds(this_, NULL);
else {
@@ -2486,7 +2486,7 @@ navigation_map_get_item(struct map_rect_priv *priv)
l=type_nav_roundabout_l8;
break;
}
- dbg(1,"delta %d\n",priv->cmd->delta);
+ dbg(lvl_warning,"delta %d\n",priv->cmd->delta);
if (priv->cmd->delta < 0)
ret->type=l;
else
@@ -2520,7 +2520,7 @@ navigation_map_get_item(struct map_rect_priv *priv)
navigation_map_item_attr_rewind(priv);
ret->id_lo=priv->itm->dest_count;
- dbg(1,"type=%d\n", ret->type);
+ dbg(lvl_warning,"type=%d\n", ret->type);
return ret;
}
diff --git a/navit/navit.c b/navit/navit.c
index 9917b585b..c2fade753 100644
--- a/navit/navit.c
+++ b/navit/navit.c
@@ -203,7 +203,7 @@ navit_get_mapset(struct navit *this_)
if(this_->mapsets){
return this_->mapsets->data;
} else {
- dbg(0,"No mapsets enabled! Is it on purpose? Navit can't draw a map. Please check your navit.xml\n");
+ dbg(lvl_error,"No mapsets enabled! Is it on purpose? Navit can't draw a map. Please check your navit.xml\n");
}
return NULL;
}
@@ -229,9 +229,9 @@ navit_get_user_data_directory(int create) {
char *dir;
dir = getenv("NAVIT_USER_DATADIR");
if (create && !file_exists(dir)) {
- dbg(0,"creating dir %s\n", dir);
+ dbg(lvl_error,"creating dir %s\n", dir);
if (file_mkdir(dir,0)) {
- dbg(0,"failed creating dir %s\n", dir);
+ dbg(lvl_error,"failed creating dir %s\n", dir);
return NULL;
}
}
@@ -421,7 +421,7 @@ update_transformation(struct transformation *tr, struct point *old, struct point
center_new.x=center_old->x+coord_old.x-coord_new.x;
center_new.y=center_old->y+coord_old.y-coord_new.y;
navit_restrict_map_center_to_world_boundingbox(tr, &center_new);
- dbg(1,"change center from 0x%x,0x%x to 0x%x,0x%x\n", center_old->x, center_old->y, center_new.x, center_new.y);
+ dbg(lvl_warning,"change center from 0x%x,0x%x to 0x%x,0x%x\n", center_old->x, center_old->y, center_new.x, center_new.y);
transform_set_center(tr, &center_new);
}
@@ -439,7 +439,7 @@ navit_handle_button(struct navit *this_, int pressed, int button, struct point *
{
int border=16;
- dbg(1,"button %d %s (ignore: %d)\n",button,pressed?"pressed":"released",this_->ignore_button);
+ dbg(lvl_warning,"button %d %s (ignore: %d)\n",button,pressed?"pressed":"released",this_->ignore_button);
callback_list_call_attr_4(this_->attr_cbl, attr_button, this_, GINT_TO_POINTER(pressed), GINT_TO_POINTER(button), p);
if (this_->ignore_button) {
this_->ignore_button=0;
@@ -483,7 +483,7 @@ navit_handle_button(struct navit *this_, int pressed, int button, struct point *
this_->motion_timeout=NULL;
}
if (this_->moved) {
- dbg(1, "mouse drag (%d, %d)->(%d, %d)\n", this_->pressed.x, this_->pressed.y, p->x, p->y);
+ dbg(lvl_warning, "mouse drag (%d, %d)->(%d, %d)\n", this_->pressed.x, this_->pressed.y, p->x, p->y);
update_transformation(this_->trans, &this_->pressed, p);
graphics_draw_drag(this_->gra, NULL);
transform_copy(this_->trans, this_->trans_cursor);
@@ -501,7 +501,7 @@ static void
navit_button(void *data, int pressed, int button, struct point *p)
{
struct navit *this=data;
- dbg(1,"enter %d %d ignore %d\n",pressed,button,this->ignore_graphics_events);
+ dbg(lvl_warning,"enter %d %d ignore %d\n",pressed,button,this->ignore_graphics_events);
if (!this->ignore_graphics_events) {
if (! this->popup_callback)
this->popup_callback=callback_new_1(callback_cast(navit_popup), this);
@@ -797,7 +797,7 @@ navit_cmd_set_attr_var(struct navit *this, char *function, struct attr **in, str
key = g_strdup(in[0]->u.str);
g_hash_table_insert(cmd_attr_var_hash, key, val);
} else {
- dbg(1, "Wrong parameters for set_attr_var() command function\n");
+ dbg(lvl_warning, "Wrong parameters for set_attr_var() command function\n");
}
}
@@ -868,12 +868,12 @@ navit_cmd_map_add_curr_pos(struct navit *this, char *function, struct attr **in,
) {
if(!(ms=navit_get_mapset(this))) {
- dbg(0, "Command function map_add_curr_pos(): there is no active mapset\n");
+ dbg(lvl_error, "Command function map_add_curr_pos(): there is no active mapset\n");
return;
}
if((item_type = item_from_name(in[1]->u.str))==type_none) {
- dbg(0, "Command function map_add_curr_pos(): unknown item type\n");
+ dbg(lvl_error, "Command function map_add_curr_pos(): unknown item type\n");
return;
}
@@ -881,7 +881,7 @@ navit_cmd_map_add_curr_pos(struct navit *this, char *function, struct attr **in,
//no map with the given name found
if( ! curr_map) {
- dbg(0, "Command function map_add_curr_pos(): map not found\n");
+ dbg(lvl_error, "Command function map_add_curr_pos(): map not found\n");
return;
}
@@ -890,11 +890,11 @@ navit_cmd_map_add_curr_pos(struct navit *this, char *function, struct attr **in,
if(vehicle_get_attr(this->vehicle->vehicle,attr_position_coord_geo,&pos_attr,NULL)) {
transform_from_geo(projection_mg, pos_attr.u.coord_geo, &curr_coord);
} else {
- dbg(0, "Command function map_add_curr_pos(): vehicle position is not accessible\n");
+ dbg(lvl_error, "Command function map_add_curr_pos(): vehicle position is not accessible\n");
return;
}
} else {
- dbg(0, "Command function map_add_curr_pos(): no vehicle\n");
+ dbg(lvl_error, "Command function map_add_curr_pos(): no vehicle\n");
return;
}
@@ -980,11 +980,11 @@ navit_cmd_map_item_set_attr(struct navit *this, char *function, struct attr **in
}
map_rect_destroy(mr);
} else {
- dbg(4,"Error in command function item_set_attr()\n");
- dbg(4,"Command function item_set_attr(): map cond: %d\n",(in[0] && ATTR_IS_STRING(in[0]->type) && in[0]->u.str)?1:0);
- dbg(4,"Command function item_set_attr(): item cond: %d\n",(in[1] && ATTR_IS_ITEM(in[1]->type))?1:0);
- dbg(4,"Command function item_set_attr(): attr type cond: %d\n",(in[2] && ATTR_IS_STRING(in[2]->type) && in[2]->u.str)?1:0);
- dbg(4,"Command function item_set_attr(): attr val cond: %d\n",(in[3] && ATTR_IS_STRING(in[3]->type) && in[3]->u.str)?1:0);
+ dbg(lvl_debug,"Error in command function item_set_attr()\n");
+ dbg(lvl_debug,"Command function item_set_attr(): map cond: %d\n",(in[0] && ATTR_IS_STRING(in[0]->type) && in[0]->u.str)?1:0);
+ dbg(lvl_debug,"Command function item_set_attr(): item cond: %d\n",(in[1] && ATTR_IS_ITEM(in[1]->type))?1:0);
+ dbg(lvl_debug,"Command function item_set_attr(): attr type cond: %d\n",(in[2] && ATTR_IS_STRING(in[2]->type) && in[2]->u.str)?1:0);
+ dbg(lvl_debug,"Command function item_set_attr(): attr val cond: %d\n",(in[3] && ATTR_IS_STRING(in[3]->type) && in[3]->u.str)?1:0);
}
}
@@ -1308,7 +1308,7 @@ navit_cmd_spawn(struct navit *this, char *function, struct attr **in, struct att
if(in[i]->type!=attr_none ) {
argv[j++]=attr_to_text(in[i],NULL,1);
} else {
- dbg(0,"Parameter #%i is attr_none - skipping\n",i);
+ dbg(lvl_error,"Parameter #%i is attr_none - skipping\n",i);
}
}
argv[j]=NULL;
@@ -1317,15 +1317,15 @@ navit_cmd_spawn(struct navit *this, char *function, struct attr **in, struct att
// spawn_process() testing suite - uncomment following code to test.
//sleep(3);
// example of non-blocking wait
- //int st=spawn_process_check_status(pi,0);dbg(0,"status %i\n",st);
+ //int st=spawn_process_check_status(pi,0);dbg(lvl_error,"status %i\n",st);
// example of blocking wait
- //st=spawn_process_check_status(pi,1);dbg(0,"status %i\n",st);
+ //st=spawn_process_check_status(pi,1);dbg(lvl_error,"status %i\n",st);
// example of wait after process is finished and status is
// already tested
- //st=spawn_process_check_status(pi,1);dbg(0,"status %i\n",st);
+ //st=spawn_process_check_status(pi,1);dbg(lvl_error,"status %i\n",st);
// example of wait after process is finished and status is
// already tested - unblocked
- //st=spawn_process_check_status(pi,0);dbg(0,"status %i\n",st);
+ //st=spawn_process_check_status(pi,0);dbg(lvl_error,"status %i\n",st);
// End testing suite
spawn_process_info_free(pi);
@@ -1424,7 +1424,7 @@ navit_new(struct attr *parent, struct attr **attrs)
this_->messages = messagelist_new(attrs);
- dbg(1,"return %p\n",this_);
+ dbg(lvl_warning,"return %p\n",this_);
return this_;
}
@@ -1439,7 +1439,7 @@ navit_set_gui(struct navit *this_, struct gui *gui)
if (! main_loop_gui) {
main_loop_gui=this_->gui;
} else {
- dbg(0,"gui with main loop already active, ignoring this instance");
+ dbg(lvl_error,"gui with main loop already active, ignoring this instance");
return 0;
}
}
@@ -1515,7 +1515,7 @@ navit_mark_navigation_stopped(char *former_destination_file){
fprintf(f,"%s", TEXTFILE_COMMENT_NAVI_STOPPED);
fclose(f);
}else{
- dbg(0, "Error setting mark in destination file %s: %s\n", former_destination_file, strerror(errno));
+ dbg(lvl_error, "Error setting mark in destination file %s: %s\n", former_destination_file, strerror(errno));
}
}
@@ -1537,7 +1537,7 @@ navit_set_destination(struct navit *this_, struct pcoord *c, const char *descrip
this_->destination=*c;
this_->destination_valid=1;
- dbg(1, "c=(%i,%i)\n", c->x,c->y);
+ dbg(lvl_warning, "c=(%i,%i)\n", c->x,c->y);
bookmarks_append_destinations(this_->former_destination, destination_file, c, 1, type_former_destination, description, this_->recentdest_count);
} else {
this_->destination_valid=0;
@@ -1822,7 +1822,7 @@ navit_say(struct navit *this_, const char *text)
if(this_->speech) {
if (!speech_get_attr(this_->speech, attr_active, &attr, NULL))
attr.u.num = 1;
- dbg(1, "this_.speech->active %ld\n", attr.u.num);
+ dbg(lvl_warning, "this_.speech->active %ld\n", attr.u.num);
if(attr.u.num)
speech_say(this_->speech, text);
}
@@ -1869,7 +1869,7 @@ navit_speak(struct navit *this_)
if (!speech_get_attr(this_->speech, attr_active, &attr, NULL))
attr.u.num = 1;
- dbg(1, "this_.speech->active %ld\n", attr.u.num);
+ dbg(lvl_warning, "this_.speech->active %ld\n", attr.u.num);
if(!attr.u.num)
return;
@@ -1899,31 +1899,31 @@ navit_window_roadbook_update(struct navit *this_)
struct param_list param[5];
int secs;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
datawindow_mode(this_->roadbook_window, 1);
if (nav)
map=navigation_get_map(nav);
if (map)
mr=map_rect_new(map, NULL);
- dbg(0,"nav=%p map=%p mr=%p\n", nav, map, mr);
+ dbg(lvl_error,"nav=%p map=%p mr=%p\n", nav, map, mr);
if (mr) {
- dbg(0,"while loop\n");
+ dbg(lvl_error,"while loop\n");
while ((item=map_rect_get_item(mr))) {
- dbg(0,"item=%p\n", item);
+ dbg(lvl_error,"item=%p\n", item);
attr.u.str=NULL;
if (item->type != type_nav_position) {
item_attr_get(item, attr_navigation_long, &attr);
if (attr.u.str == NULL) {
continue;
}
- dbg(2, "Command='%s'\n", attr.u.str);
+ dbg(lvl_info, "Command='%s'\n", attr.u.str);
param[0].value=g_strdup(attr.u.str);
} else
param[0].value=_("Position");
param[0].name=_("Command");
item_attr_get(item, attr_length, &attr);
- dbg(2, "Length=%ld\n", attr.u.num);
+ dbg(lvl_info, "Length=%ld\n", attr.u.num);
param[1].name=_("Length");
if ( attr.u.num >= 2000 )
@@ -1936,7 +1936,7 @@ navit_window_roadbook_update(struct navit *this_)
}
item_attr_get(item, attr_time, &attr);
- dbg(2, "Time=%ld\n", attr.u.num);
+ dbg(lvl_info, "Time=%ld\n", attr.u.num);
secs=attr.u.num/10;
param[2].name=_("Time");
if ( secs >= 3600 )
@@ -1949,7 +1949,7 @@ navit_window_roadbook_update(struct navit *this_)
}
item_attr_get(item, attr_destination_length, &attr);
- dbg(2, "Destlength=%ld\n", attr.u.num);
+ dbg(lvl_info, "Destlength=%ld\n", attr.u.num);
param[3].name=_("Destination Length");
if ( attr.u.num >= 2000 )
{
@@ -1961,7 +1961,7 @@ navit_window_roadbook_update(struct navit *this_)
}
item_attr_get(item, attr_destination_time, &attr);
- dbg(2, "Desttime=%ld\n", attr.u.num);
+ dbg(lvl_info, "Desttime=%ld\n", attr.u.num);
secs=attr.u.num/10;
param[4].name=_("Destination Time");
if ( secs >= 3600 )
@@ -1982,7 +1982,7 @@ navit_window_roadbook_update(struct navit *this_)
void
navit_window_roadbook_destroy(struct navit *this_)
{
- dbg(0, "enter\n");
+ dbg(lvl_error, "enter\n");
navigation_unregister_callback(this_->navigation, attr_navigation_long, this_->roadbook_callback);
callback_destroy(this_->roadbook_callback);
this_->roadbook_window=NULL;
@@ -2009,24 +2009,24 @@ navit_init(struct navit *this_)
int callback;
char *center_file;
- dbg(2,"enter gui %p graphics %p\n",this_->gui,this_->gra);
+ dbg(lvl_info,"enter gui %p graphics %p\n",this_->gui,this_->gra);
if (!this_->gui && !(this_->flags & 2)) {
- dbg(0,"Warning: No GUI available.\n");
+ dbg(lvl_error,"Warning: No GUI available.\n");
return;
}
if (!this_->gra && !(this_->flags & 1)) {
- dbg(0,"Warning: No graphics subsystem available.\n");
+ dbg(lvl_error,"Warning: No graphics subsystem available.\n");
return;
}
- dbg(2,"Connecting gui to graphics\n");
+ dbg(lvl_info,"Connecting gui to graphics\n");
if (this_->gui && this_->gra && gui_set_graphics(this_->gui, this_->gra)) {
struct attr attr_type_gui, attr_type_graphics;
gui_get_attr(this_->gui, attr_type, &attr_type_gui, NULL);
graphics_get_attr(this_->gra, attr_type, &attr_type_graphics, NULL);
- dbg(0,"failed to connect graphics '%s' to gui '%s'\n", attr_type_graphics.u.str, attr_type_gui.u.str);
- dbg(0," Please see http://wiki.navit-project.org/index.php/Failed_to_connect_graphics_to_gui\n");
- dbg(0," for explanations and solutions\n");
+ dbg(lvl_error,"failed to connect graphics '%s' to gui '%s'\n", attr_type_graphics.u.str, attr_type_gui.u.str);
+ dbg(lvl_error," Please see http://wiki.navit-project.org/index.php/Failed_to_connect_graphics_to_gui\n");
+ dbg(lvl_error," for explanations and solutions\n");
return;
}
if (this_->speech && this_->navigation) {
@@ -2035,10 +2035,10 @@ navit_init(struct navit *this_)
speech.u.speech=this_->speech;
navigation_set_attr(this_->navigation, &speech);
}
- dbg(2,"Initializing graphics\n");
- dbg(2,"Setting Vehicle\n");
+ dbg(lvl_info,"Initializing graphics\n");
+ dbg(lvl_info,"Setting Vehicle\n");
navit_set_vehicle(this_, this_->vehicle);
- dbg(2,"Adding dynamic maps to mapset %p\n",this_->mapsets);
+ dbg(lvl_info,"Adding dynamic maps to mapset %p\n",this_->mapsets);
if (this_->mapsets) {
struct mapset_handle *msh;
ms=this_->mapsets->data;
@@ -2099,7 +2099,7 @@ navit_init(struct navit *this_)
}
navit_add_former_destinations_from_file(this_);
} else {
- dbg(0, "FATAL: No mapset available. Please add a (valid) mapset to your configuration.\n");
+ dbg(lvl_error, "FATAL: No mapset available. Please add a (valid) mapset to your configuration.\n");
exit(1);
}
if (this_->route) {
@@ -2117,7 +2117,7 @@ navit_init(struct navit *this_)
if (this_->route)
navigation_set_route(this_->navigation, this_->route);
}
- dbg(2,"Setting Center\n");
+ dbg(lvl_info,"Setting Center\n");
center_file = bookmarks_get_center_file(FALSE);
bookmarks_set_center_from_file(this_->bookmarks, center_file);
g_free(center_file);
@@ -2142,7 +2142,7 @@ navit_init(struct navit *this_)
callback_list_call_attr_1(this_->attr_cbl, attr_navit, this_);
callback=(this_->ready == 2);
this_->ready|=1;
- dbg(2,"ready=%d\n",this_->ready);
+ dbg(lvl_info,"ready=%d\n",this_->ready);
if (this_->ready == 3)
navit_draw_async(this_, 1);
if (callback)
@@ -2162,15 +2162,15 @@ navit_zoom_to_rect(struct navit *this_, struct coord_rect *r)
c.y=(r->rl.y+r->lu.y)/2;
transform_set_center(this_->trans, &c);
transform_get_size(this_->trans, &w, &h);
- dbg(0,"center 0x%x,0x%x w %d h %d\n",c.x,c.y,w,h);
- dbg(0,"%x,%x-%x,%x\n", r->lu.x,r->lu.y,r->rl.x,r->rl.y);
+ dbg(lvl_error,"center 0x%x,0x%x w %d h %d\n",c.x,c.y,w,h);
+ dbg(lvl_error,"%x,%x-%x,%x\n", r->lu.x,r->lu.y,r->rl.x,r->rl.y);
while (scale < 1<<20) {
struct point p1,p2;
transform_set_scale(this_->trans, scale);
transform_setup_source_rect(this_->trans);
transform(this_->trans, transform_get_projection(this_->trans), &r->lu, &p1, 1, 0, 0, NULL);
transform(this_->trans, transform_get_projection(this_->trans), &r->rl, &p2, 1, 0, 0, NULL);
- dbg(0,"%d,%d-%d,%d\n",p1.x,p1.y,p2.x,p2.y);
+ dbg(lvl_error,"%d,%d-%d,%d\n",p1.x,p1.y,p2.x,p2.y);
if (p1.x < 0 || p2.x < 0 || p1.x > w || p2.x > w ||
p1.y < 0 || p2.y < 0 || p1.y > h || p2.y > h)
scale*=2;
@@ -2178,7 +2178,7 @@ navit_zoom_to_rect(struct navit *this_, struct coord_rect *r)
break;
}
- dbg(0,"scale=%d (0x%x) of %d (0x%x)\n",scale,scale,1<<20,1<<20);
+ dbg(lvl_error,"scale=%d (0x%x) of %d (0x%x)\n",scale,scale,1<<20,1<<20);
if (this_->ready == 3)
navit_draw_async(this_,0);
}
@@ -2194,17 +2194,17 @@ navit_zoom_to_route(struct navit *this_, int orientation)
int count=0;
if (! this_->route)
return;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
map=route_get_map(this_->route);
- dbg(1,"map=%p\n",map);
+ dbg(lvl_warning,"map=%p\n",map);
if (map)
mr=map_rect_new(map, NULL);
- dbg(1,"mr=%p\n",mr);
+ dbg(lvl_warning,"mr=%p\n",mr);
if (mr) {
while ((item=map_rect_get_item(mr))) {
- dbg(1,"item=%s\n", item_to_name(item->type));
+ dbg(lvl_warning,"item=%s\n", item_to_name(item->type));
while (item_coord_get(item, &c, 1)) {
- dbg(1,"coord\n");
+ dbg(lvl_warning,"coord\n");
if (!count)
r.lu=r.rl=c;
else
@@ -2440,7 +2440,7 @@ navit_set_attr_do(struct navit *this_, struct attr *attr, int init)
break;
case attr_center:
transform_from_geo(transform_get_projection(this_->trans), attr->u.coord_geo, &co);
- dbg(1,"0x%x,0x%x\n",co.x,co.y);
+ dbg(lvl_warning,"0x%x,0x%x\n",co.x,co.y);
transform_set_center(this_->trans, &co);
break;
case attr_drag_bitmap:
@@ -2516,7 +2516,7 @@ navit_set_attr_do(struct navit *this_, struct attr *attr, int init)
}
break;
case attr_osd_configuration:
- dbg(0,"setting osd_configuration to %ld (was %d)\n", attr->u.num, this_->osd_configuration);
+ dbg(lvl_error,"setting osd_configuration to %ld (was %d)\n", attr->u.num, this_->osd_configuration);
attr_updated=(this_->osd_configuration != attr->u.num);
this_->osd_configuration=attr->u.num;
break;
@@ -3335,7 +3335,7 @@ navit_layout_switch(struct navit *n)
//Check that we aren't calculating too fast
if (vehicle_get_attr(n->vehicle->vehicle, attr_position_time_iso8601,&iso8601_attr,NULL)==1) {
currTs=iso8601_to_secs(iso8601_attr.u.str);
- dbg(1,"currTs: %u:%u\n",currTs%86400/3600,((currTs%86400)%3600)/60);
+ dbg(lvl_warning,"currTs: %u:%u\n",currTs%86400/3600,((currTs%86400)%3600)/60);
}
if (currTs-(n->prevTs)<60) {
//We've have to wait a little
@@ -3354,13 +3354,13 @@ navit_layout_switch(struct navit *n)
//We calculate sunrise anyway, cause it is needed both for day and for night
if (__sunriset__(year,month,day,geo_attr.u.coord_geo->lng,geo_attr.u.coord_geo->lat,-5,1,&trise,&tset)!=0) {
//near the pole sun never rises/sets, so we should never switch profiles
- dbg(1,"trise: %u:%u, sun never visible, never switch profile\n",HOURS(trise),MINUTES(trise));
+ dbg(lvl_warning,"trise: %u:%u, sun never visible, never switch profile\n",HOURS(trise),MINUTES(trise));
n->prevTs=currTs;
return;
}
trise_actual=trise;
- dbg(1,"trise: %u:%u\n",HOURS(trise),MINUTES(trise));
+ dbg(lvl_warning,"trise: %u:%u\n",HOURS(trise),MINUTES(trise));
if (l->dayname) {
if ((HOURS(trise)*60+MINUTES(trise)==(currTs%86400)/60) ||
@@ -3374,11 +3374,11 @@ navit_layout_switch(struct navit *n)
if (l->nightname) {
if (__sunriset__(year,month,day,geo_attr.u.coord_geo->lng,geo_attr.u.coord_geo->lat,-5,1,&trise,&tset)!=0) {
//near the pole sun never rises/sets, so we should never switch profiles
- dbg(1,"tset: %u:%u, sun always visible, never switch profile\n",HOURS(tset),MINUTES(tset));
+ dbg(lvl_warning,"tset: %u:%u, sun always visible, never switch profile\n",HOURS(tset),MINUTES(tset));
n->prevTs=currTs;
return;
}
- dbg(1,"tset: %u:%u\n",HOURS(tset),MINUTES(tset));
+ dbg(lvl_warning,"tset: %u:%u\n",HOURS(tset),MINUTES(tset));
if (HOURS(tset)*60+MINUTES(tset)==((currTs%86400)/60)
|| (n->prevTs==0 && (((HOURS(tset)*60+MINUTES(tset)<(currTs%86400)/60)) ||
((HOURS(trise_actual)*60+MINUTES(trise_actual)>(currTs%86400)/60))))) {
@@ -3483,7 +3483,7 @@ int navit_get_blocked(struct navit *this_)
void
navit_destroy(struct navit *this_)
{
- dbg(0,"enter %p\n",this_);
+ dbg(lvl_error,"enter %p\n",this_);
graphics_draw_cancel(this_->gra, this_->displaylist);
callback_list_call_attr_1(this_->attr_cbl, attr_destroy, this_);
attr_list_free(this_->attrs);
diff --git a/navit/osd.c b/navit/osd.c
index 33a577694..a01cc0c70 100644
--- a/navit/osd.c
+++ b/navit/osd.c
@@ -70,7 +70,7 @@ osd_new(struct attr *parent, struct attr **attrs)
g_free(o);
o=NULL;
}
- dbg(3,"new osd %p\n",o);
+ dbg(lvl_debug,"new osd %p\n",o);
return o;
}
@@ -128,7 +128,7 @@ osd_evaluate_command(struct osd_item *this, struct navit *nav)
struct attr navit;
navit.type=attr_navit;
navit.u.navit=nav;
- dbg(1, "calling command '%s'\n", this->command);
+ dbg(lvl_warning, "calling command '%s'\n", this->command);
command_evaluate(&navit, this->command);
}
@@ -222,12 +222,12 @@ osd_std_keypress(struct osd_item *item, struct navit *nav, char *key)
{
#if 0
int i;
- dbg(0,"key=%s\n",key);
+ dbg(lvl_error,"key=%s\n",key);
for (i = 0 ; i < strlen(key) ; i++) {
- dbg(0,"key:0x%02x\n",key[i]);
+ dbg(lvl_error,"key:0x%02x\n",key[i]);
}
for (i = 0 ; i < strlen(item->accesskey) ; i++) {
- dbg(0,"accesskey:0x%02x\n",item->accesskey[i]);
+ dbg(lvl_error,"accesskey:0x%02x\n",item->accesskey[i]);
}
#endif
if ( ! graphics_is_disabled(item->gr) && item->accesskey && key && !strcmp(key, item->accesskey))
@@ -242,7 +242,7 @@ osd_std_reconfigure(struct osd_item *item, struct command_saved *cs)
if (item->gr && !(item->flags & 16))
graphics_overlay_disable(item->gr, !item->configured);
} else {
- dbg(0, "Error in saved command: %i\n", command_saved_error(cs));
+ dbg(lvl_error, "Error in saved command: %i\n", command_saved_error(cs));
}
}
@@ -350,7 +350,7 @@ void
osd_std_config(struct osd_item *item, struct navit *navit)
{
struct attr attr;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
if (item->enable_cs) {
item->reconfig_cb = callback_new_1(callback_cast(osd_std_reconfigure), item);
command_saved_set_cb(item->enable_cs, item->reconfig_cb);
@@ -358,7 +358,7 @@ osd_std_config(struct osd_item *item, struct navit *navit)
if (!command_saved_error(item->enable_cs)) {
item->configured = !! command_saved_get_int(item->enable_cs);
} else {
- dbg(0, "Error in saved command: %i.\n", command_saved_error(item->enable_cs));
+ dbg(lvl_error, "Error in saved command: %i.\n", command_saved_error(item->enable_cs));
}
} else {
if (!navit_get_attr(navit, attr_osd_configuration, &attr, NULL))
@@ -381,7 +381,7 @@ void
osd_set_keypress(struct navit *nav, struct osd_item *item)
{
struct graphics *navit_gr = navit_get_graphics(nav);
- dbg(2,"accesskey %s\n",item->accesskey);
+ dbg(lvl_info,"accesskey %s\n",item->accesskey);
if (item->accesskey) {
item->keypress_cb=callback_new_attr_2(callback_cast(osd_std_keypress), attr_keypress, item, nav);
graphics_add_callback(navit_gr, item->keypress_cb);
diff --git a/navit/osd/core/osd_core.c b/navit/osd/core/osd_core.c
index 9df205578..bc38282ec 100644
--- a/navit/osd/core/osd_core.c
+++ b/navit/osd/core/osd_core.c
@@ -1454,7 +1454,7 @@ osd_button_draw(struct osd_priv_common *opc, struct navit *nav)
gra = navit_get_graphics(nav);
this->img = graphics_image_new(gra, this->src);
if (!this->img) {
- dbg(1, "failed to load '%s'\n", this->src);
+ dbg(lvl_warning, "failed to load '%s'\n", this->src);
return;
}
@@ -1479,10 +1479,10 @@ osd_button_init(struct osd_priv_common *opc, struct navit *nav)
struct osd_button *this = (struct osd_button *)opc->data;
struct graphics *gra = navit_get_graphics(nav);
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
this->img = graphics_image_new(gra, this->src);
if (!this->img) {
- dbg(1, "failed to load '%s'\n", this->src);
+ dbg(lvl_warning, "failed to load '%s'\n", this->src);
return;
}
if (!opc->osd_item.w)
@@ -1540,7 +1540,7 @@ osd_button_set_attr(struct osd_priv_common *opc, struct attr* attr)
gra = navit_get_graphics(nav);
this_->img = graphics_image_new(gra, this_->src);
if (!this_->img) {
- dbg(1, "failed to load '%s'\n", this_->src);
+ dbg(lvl_warning, "failed to load '%s'\n", this_->src);
return 0;
}
if (!opc->osd_item.w)
@@ -1581,7 +1581,7 @@ osd_button_new(struct navit *nav, struct osd_methods *meth,
osd_set_std_attr(attrs, &opc->osd_item, this->use_overlay ? 1:(1|16));
if (!opc->osd_item.command) {
- dbg(0, "no command\n");
+ dbg(lvl_error, "no command\n");
goto error;
}
attr = attr_search(attrs, NULL, attr_src_dir);
@@ -1591,7 +1591,7 @@ osd_button_new(struct navit *nav, struct osd_methods *meth,
this->src_dir=NULL;
attr = attr_search(attrs, NULL, attr_src);
if (!attr) {
- dbg(0, "no src\n");
+ dbg(lvl_error, "no src\n");
goto error;
}
@@ -1617,10 +1617,10 @@ osd_image_init(struct osd_priv_common *opc, struct navit *nav)
struct osd_button *this = (struct osd_button *)opc->data;
struct graphics *gra = navit_get_graphics(nav);
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
this->img = graphics_image_new(gra, this->src);
if (!this->img) {
- dbg(1, "failed to load '%s'\n", this->src);
+ dbg(lvl_warning, "failed to load '%s'\n", this->src);
return;
}
if (!opc->osd_item.w)
@@ -1668,7 +1668,7 @@ osd_image_new(struct navit *nav, struct osd_methods *meth,
this->use_overlay=attr->u.num;
attr = attr_search(attrs, NULL, attr_src);
if (!attr) {
- dbg(0, "no src\n");
+ dbg(lvl_error, "no src\n");
goto error;
}
@@ -1719,7 +1719,7 @@ osd_nav_next_turn_draw(struct osd_priv_common *opc, struct navit *navit,
&& (item->type == type_nav_position || item->type == type_nav_none || level-- > 0));
if (item) {
name = item_to_name(item->type);
- dbg(1, "name=%s\n", name);
+ dbg(lvl_warning, "name=%s\n", name);
if (this->active != 1 || this->last_name != name) {
this->active = 1;
this->last_name = name;
@@ -1738,13 +1738,13 @@ osd_nav_next_turn_draw(struct osd_priv_common *opc, struct navit *navit,
osd_std_draw(&opc->osd_item);
if (this->active) {
image = g_strdup_printf(this->icon_src, name);
- dbg(1, "image=%s\n", image);
+ dbg(lvl_warning, "image=%s\n", image);
gr_image =
graphics_image_new_scaled(opc->osd_item.gr,
image, this->icon_w,
this->icon_h);
if (!gr_image) {
- dbg(0,"failed to load %s in %dx%d\n",image,this->icon_w,this->icon_h);
+ dbg(lvl_error,"failed to load %s in %dx%d\n",image,this->icon_w,this->icon_h);
g_free(image);
image = graphics_icon_path("unknown.png");
gr_image =
@@ -1755,7 +1755,7 @@ osd_nav_next_turn_draw(struct osd_priv_common *opc, struct navit *navit,
this->
icon_h);
}
- dbg(1, "gr_image=%p\n", gr_image);
+ dbg(lvl_warning, "gr_image=%p\n", gr_image);
if (gr_image) {
p.x =
(opc->osd_item.w -
@@ -1888,7 +1888,7 @@ osd_nav_toggle_announcer_draw(struct osd_priv_common *opc, struct navit *navit,
gr_image = graphics_image_new_scaled(opc->osd_item.gr, path, this->icon_w, this->icon_h);
}
- dbg(1, "gr_image=%p\n", gr_image);
+ dbg(lvl_warning, "gr_image=%p\n", gr_image);
if (gr_image)
{
@@ -2777,8 +2777,8 @@ osd_text_draw(struct osd_priv_common *opc, struct navit *navit, struct vehicle *
}
if (item) {
- dbg(1,"name %s\n", item_to_name(item->type));
- dbg(1,"type %s\n", attr_to_name(oti->attr_typ));
+ dbg(lvl_warning,"name %s\n", item_to_name(item->type));
+ dbg(lvl_warning,"type %s\n", attr_to_name(oti->attr_typ));
if (item_attr_get(item, oti->attr_typ, &attr))
value=osd_text_format_attr(&attr, oti->format, imperial);
}
@@ -2891,7 +2891,7 @@ osd_text_draw(struct osd_priv_common *opc, struct navit *navit, struct vehicle *
last++;
}
- dbg(1,"this->align=%d\n", this->align);
+ dbg(lvl_warning,"this->align=%d\n", this->align);
switch (this->align & 51) {
case 1:
p.y=0;
@@ -3175,7 +3175,7 @@ osd_gps_status_draw(struct osd_priv_common *opc, struct navit *navit,
case 2:
strength=2;
if (vehicle_get_attr(vehicle_attr.u.vehicle, attr_position_sats_used, &attr, NULL)) {
- dbg(1,"num=%ld\n", attr.u.num);
+ dbg(lvl_warning,"num=%ld\n", attr.u.num);
if (attr.u.num >= 3)
strength=attr.u.num-1;
if (strength > 5)
@@ -3490,7 +3490,7 @@ osd_scale_init(struct osd_priv_common *opc, struct navit *nav)
struct color color_white={COLOR_WHITE_};
struct color color_black={COLOR_BLACK_};
struct graphics *gra = navit_get_graphics(nav);
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
if (this->use_overlay) {
osd_set_std_graphic(nav, &opc->osd_item, (struct osd_priv *)opc);
} else {
@@ -3564,7 +3564,7 @@ osd_auxmap_draw(struct osd_priv_common *opc)
memset(&sel, 0, sizeof(sel));
sel.u.p_rect.rl.x=opc->osd_item.w;
sel.u.p_rect.rl.y=opc->osd_item.h;
- dbg(1,"osd_auxmap_draw: sel.u.p_rect.rl=(%d, %d)\n", opc->osd_item.w, opc->osd_item.h);
+ dbg(lvl_warning,"osd_auxmap_draw: sel.u.p_rect.rl=(%d, %d)\n", opc->osd_item.w, opc->osd_item.h);
transform_set_screen_selection(this->trans, &sel);
graphics_set_rect(opc->osd_item.gr, &sel.u.p_rect);
}
diff --git a/navit/plugin.c b/navit/plugin.c
index 9ab56b4bc..ad3f03147 100644
--- a/navit/plugin.c
+++ b/navit/plugin.c
@@ -170,20 +170,20 @@ plugin_load(struct plugin *pl)
GModule *mod;
if (pl->mod) {
- dbg(0,"can't load '%s', already loaded\n", pl->name);
+ dbg(lvl_error,"can't load '%s', already loaded\n", pl->name);
return 0;
}
mod=g_module_open(pl->name, G_MODULE_BIND_LOCAL | (pl->lazy ? G_MODULE_BIND_LAZY : 0));
if (! mod) {
- dbg(0,"can't load '%s', Error '%s'\n", pl->name, g_module_error());
+ dbg(lvl_error,"can't load '%s', Error '%s'\n", pl->name, g_module_error());
return 0;
}
if (!g_module_symbol(mod, "plugin_init", &init)) {
- dbg(0,"can't load '%s', plugin_init not found\n", pl->name);
+ dbg(lvl_error,"can't load '%s', plugin_init not found\n", pl->name);
g_module_close(mod);
return 0;
} else {
- dbg(1, "loaded module %s\n", pl->name);
+ dbg(lvl_warning, "loaded module %s\n", pl->name);
pl->mod=mod;
pl->init=init;
}
@@ -278,7 +278,7 @@ plugin_new(struct attr *parent, struct attr **attrs) {
pls=parent->u.plugins;
if (! (path_attr=attr_search(attrs, NULL, attr_path))) {
- dbg(0,"missing path\n");
+ dbg(lvl_error,"missing path\n");
return NULL;
}
if ( (attr=attr_search(attrs, NULL, attr_active))) {
@@ -290,20 +290,20 @@ plugin_new(struct attr *parent, struct attr **attrs) {
if ( (attr=attr_search(attrs, NULL, attr_ondemand))) {
ondemand=attr->u.num;
}
- dbg(1, "path=\"%s\", active=%d, lazy=%d, ondemand=%d\n",path_attr->u.str, active, lazy, ondemand);
+ dbg(lvl_warning, "path=\"%s\", active=%d, lazy=%d, ondemand=%d\n",path_attr->u.str, active, lazy, ondemand);
we=file_wordexp_new(path_attr->u.str);
count=file_wordexp_get_count(we);
array=file_wordexp_get_array(we);
- dbg(2,"expanded to %d words\n",count);
+ dbg(lvl_info,"expanded to %d words\n",count);
if (count != 1 || file_exists(array[0])) {
for (i = 0 ; i < count ; i++) {
name=array[i];
- dbg(2,"found plugin module file [%d]: '%s'\n", i, name);
+ dbg(lvl_info,"found plugin module file [%d]: '%s'\n", i, name);
if (! (pls && (pl=g_hash_table_lookup(pls->hash, name)))) {
pl=plugin_new_from_path(name);
if (! pl) {
- dbg(0,"failed to create plugin from file '%s'\n", name);
+ dbg(lvl_error,"failed to create plugin from file '%s'\n", name);
continue;
}
if (pls) {
@@ -355,7 +355,7 @@ plugins_init(struct plugins *pls)
l=g_list_next(l);
}
} else {
- dbg(0, "Warning: No plugins found. Is Navit installed correctly?\n");
+ dbg(lvl_error, "Warning: No plugins found. Is Navit installed correctly?\n");
}
#endif
}
@@ -385,7 +385,7 @@ plugin_get_type(enum plugin_type type, const char *type_name, const char *name)
struct plugin *pl;
char *mod_name, *filename=NULL, *corename=NULL;
- dbg(1, "type=\"%s\", name=\"%s\"\n", type_name, name);
+ dbg(lvl_warning, "type=\"%s\", name=\"%s\"\n", type_name, name);
l=plugin_types[type];
while (l) {
@@ -405,9 +405,9 @@ plugin_get_type(enum plugin_type type, const char *type_name, const char *name)
mod_name++;
else
mod_name=pl->name;
- dbg(2,"compare '%s' with '%s'\n", mod_name, filename);
+ dbg(lvl_info,"compare '%s' with '%s'\n", mod_name, filename);
if (!g_ascii_strncasecmp(mod_name, filename, strlen(filename)) || !g_ascii_strncasecmp(mod_name, corename, strlen(corename))) {
- dbg(1, "Loading module \"%s\"\n",pl->name) ;
+ dbg(lvl_warning, "Loading module \"%s\"\n",pl->name) ;
if (plugin_get_active(pl))
if (!plugin_load(pl))
plugin_set_active(pl, 0);
diff --git a/navit/plugin/pedestrian/pedestrian.c b/navit/plugin/pedestrian/pedestrian.c
index 683b1a0f3..72ed7e75b 100644
--- a/navit/plugin/pedestrian/pedestrian.c
+++ b/navit/plugin/pedestrian/pedestrian.c
@@ -92,13 +92,13 @@ pedestrian_rocket_idle(struct rocket *rocket)
transform_set_hog(rocket->trans, rocket->hog);
graphics_displaylist_draw(rocket->gra, rocket->dl, rocket->trans, rocket->layout, 0);
rocket->v+=rocket->a-rocket->g;
- dbg(0,"enter v=%d\n",rocket->v);
+ dbg(lvl_error,"enter v=%d\n",rocket->v);
if (rocket->t > 0)
rocket->t--;
else
rocket->a=0;
rocket->hog+=rocket->v/rocket->vscale;
- dbg(0,"hog=%d\n",rocket->hog);
+ dbg(lvl_error,"hog=%d\n",rocket->hog);
if (rocket->hog < 0) {
transform_set_hog(rocket->trans, 0);
transform_set_order_base(rocket->trans, 14);
@@ -192,7 +192,7 @@ osd_rocket_init(struct navit *nav)
if (navit_get_attr(nav, attr_layout, &attr, NULL))
rocket->layout=attr.u.layout;
if (navit_get_attr(nav, attr_callback_list, &attr, NULL)) {
- dbg(0,"ok\n");
+ dbg(lvl_error,"ok\n");
command_add_table(attr.u.callback_list, commands, sizeof(commands)/sizeof(struct command_table), rocket);
}
}
@@ -207,7 +207,7 @@ osd_marker_draw(struct marker *this, struct navit *nav)
#if 0
struct attr graphics;
struct point p;
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
if (!navit_get_attr(nav, attr_graphics, &graphics, NULL))
return;
p.x=40;
@@ -401,7 +401,7 @@ static void
map_route_occluded_check_buildings(struct coord *c0)
{
struct building *b=buildings;
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
int i,count;
struct coord *c;
#if 1
@@ -414,7 +414,7 @@ map_route_occluded_check_buildings(struct coord *c0)
count=b->sd->count;
if (c[count-1].x == c[0].x && c[count-1].y == c[0].y) {
#if 0
- dbg(0,"closed\n");
+ dbg(lvl_error,"closed\n");
#endif
count--;
}
@@ -457,11 +457,11 @@ intersect(struct coord *p1, struct coord *p2, struct coord *p3, struct coord *p4
num=-num;
den=-den;
}
- dbg(1,"num=%f den=%f\n", num, den);
+ dbg(lvl_warning,"num=%f den=%f\n", num, den);
if (i) {
i->x=p1->x+(num/den)*(p2->x-p1->x)+0.5;
i->y=p1->y+(num/den)*(p2->y-p1->y)+0.5;
- dbg(1,"i=0x%x,0x%x\n", i->x, i->y);
+ dbg(lvl_warning,"i=0x%x,0x%x\n", i->x, i->y);
if (debug2)
fprintf(debug2, "0x%x 0x%x type=town_label_5e3\n", i->x, i->y);
}
@@ -489,18 +489,18 @@ is_visible_line(struct coord *c0, struct coord *c1, struct coord *c2)
struct building *b=buildings;
struct coord cn;
#ifdef DEBUG_VISIBLE
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
#endif
while (b) {
if (side(&b->left, &b->right, c1) < 0 || side(&b->left, &b->right, c2) < 0) {
#ifdef DEBUG_VISIBLE
- dbg(0,"sides left: start %d end %d right: start %d end %d\n", side(c0, &b->left, c1), side(c0, &b->left, c2), side(c0, &b->right, c1), side(c0, &b->right, c2));
+ dbg(lvl_error,"sides left: start %d end %d right: start %d end %d\n", side(c0, &b->left, c1), side(c0, &b->left, c2), side(c0, &b->right, c1), side(c0, &b->right, c2));
#endif
for (;;) {
if (side(c0, &b->left, c1) <= 0) {
if (side(c0, &b->left, c2) > 0) {
#ifdef DEBUG_VISIBLE
- dbg(0,"visible: start is left of left corner and end is right of left corner, clipping end\n");
+ dbg(lvl_error,"visible: start is left of left corner and end is right of left corner, clipping end\n");
#endif
res=intersect(c0, &b->left, c1, c2, &cn);
if (res < 256)
@@ -516,7 +516,7 @@ is_visible_line(struct coord *c0, struct coord *c1, struct coord *c2)
if (side(c0, &b->right, c1) >= 0) {
if (side(c0, &b->right, c2) < 0) {
#ifdef DEBUG_VISIBLE
- dbg(0,"visible: start is right of right corner and end is left of right corner, clipping end\n");
+ dbg(lvl_error,"visible: start is right of right corner and end is left of right corner, clipping end\n");
#endif
res=intersect(c0, &b->right, c1, c2, &cn);
if (res < 256)
@@ -532,7 +532,7 @@ is_visible_line(struct coord *c0, struct coord *c1, struct coord *c2)
if (side(c0, &b->left, c2) <= 0) {
if (side(c0, &b->left, c1) > 0) {
#ifdef DEBUG_VISIBLE
- dbg(0,"visible: end is left of left corner and start is right of left corner, clipping start\n");
+ dbg(lvl_error,"visible: end is left of left corner and start is right of left corner, clipping start\n");
#endif
res=intersect(c0, &b->left, c1, c2, &cn);
if (res < 256)
@@ -548,7 +548,7 @@ is_visible_line(struct coord *c0, struct coord *c1, struct coord *c2)
if (side(c0, &b->right, c2) >= 0) {
if (side(c0, &b->right, c1) < 0) {
#ifdef DEBUG_VISIBLE
- dbg(0,"visible: end is right of right corner and start is left of right corner, clipping start\n");
+ dbg(lvl_error,"visible: end is right of right corner and start is left of right corner, clipping start\n");
#endif
res=intersect(c0, &b->right, c1, c2, &cn);
if (res < 256)
@@ -562,7 +562,7 @@ is_visible_line(struct coord *c0, struct coord *c1, struct coord *c2)
break;
}
#ifdef DEBUG_VISIBLE
- dbg(0,"visible: not visible\n");
+ dbg(lvl_error,"visible: not visible\n");
#endif
return 4;
}
@@ -570,7 +570,7 @@ is_visible_line(struct coord *c0, struct coord *c1, struct coord *c2)
b=b->next;
}
#ifdef DEBUG_VISIBLE
- dbg(0,"return %d\n",ret);
+ dbg(lvl_error,"return %d\n",ret);
#endif
return ret;
}
@@ -579,7 +579,7 @@ static void
map_route_occluded_coord_rewind(void *priv_data)
{
struct map_rect_priv *mr = priv_data;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
mr->idx=mr->idx_base;
mr->first=1;
mr->lseg_done=mr->lseg_done_base;
@@ -594,7 +594,7 @@ static void
map_route_occluded_attr_rewind(void *priv_data)
{
struct map_rect_priv *mr=priv_data;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
item_attr_rewind(mr->route_item);
}
@@ -602,7 +602,7 @@ static int
map_route_occluded_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
{
struct map_rect_priv *mr=priv_data;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
return item_attr_get(mr->route_item, attr_type, attr);
}
@@ -625,7 +625,7 @@ map_route_occluded_coord_get(void *priv_data, struct coord *c, int count)
char buffer[4096];
#ifdef DEBUG_COORD_GET
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
#endif
dbg_assert(count >= 2);
if (! mr->checked) {
@@ -635,11 +635,11 @@ map_route_occluded_coord_get(void *priv_data, struct coord *c, int count)
}
while (ret < count && !mr->last) {
#ifdef DEBUG_COORD_GET
- dbg(1,"coord first %d lseg_done %d\n",mr->first,mr->lseg_done);
+ dbg(lvl_warning,"coord first %d lseg_done %d\n",mr->first,mr->lseg_done);
#endif
if (mr->lseg_done) {
#ifdef DEBUG_COORD_GET
- dbg(1,"loading %d of %d from id_lo %d\n", mr->idx, mr->sd->count, mr->sd->item.id_lo);
+ dbg(lvl_warning,"loading %d of %d from id_lo %d\n", mr->idx, mr->sd->count, mr->sd->item.id_lo);
#endif
if (!mr->idx) {
if (coord_next(mr, &mr->lseg[0])) {
@@ -663,7 +663,7 @@ map_route_occluded_coord_get(void *priv_data, struct coord *c, int count)
l0=mr->c_next;
l1=mr->lseg[1];
#ifdef DEBUG_COORD_GET
- dbg(1,"line (0x%x,0x%x)-(0x%x,0x%x)\n", l0.x,l0.y,l1.x,l1.y);
+ dbg(lvl_warning,"line (0x%x,0x%x)-(0x%x,0x%x)\n", l0.x,l0.y,l1.x,l1.y);
#endif
vis=is_visible_line(&mr->c0, &l0, &l1);
if (debug) {
@@ -672,7 +672,7 @@ map_route_occluded_coord_get(void *priv_data, struct coord *c, int count)
fprintf(debug,"0x%x 0x%x\n", l1.x, l1.y);
}
#ifdef DEBUG_COORD_GET
- dbg(1,"vis=%d line (0x%x,0x%x)-(0x%x,0x%x)\n", vis, l0.x,l0.y,l1.x,l1.y);
+ dbg(lvl_warning,"vis=%d line (0x%x,0x%x)-(0x%x,0x%x)\n", vis, l0.x,l0.y,l1.x,l1.y);
#endif
mr->idx_base=mr->idx;
mr->c_next_base=mr->c_next;
@@ -683,11 +683,11 @@ map_route_occluded_coord_get(void *priv_data, struct coord *c, int count)
case 0:
mr->c_next_base=mr->c_next;
#ifdef DEBUG_COORD_GET
- dbg(1,"out 0x%x,0x%x\n", l0.x, l1.y);
+ dbg(lvl_warning,"out 0x%x,0x%x\n", l0.x, l1.y);
#endif
c[ret++]=l0;
#ifdef DEBUG_COORD_GET
- dbg(1,"out 0x%x,0x%x\n", l1.x, l1.y);
+ dbg(lvl_warning,"out 0x%x,0x%x\n", l1.x, l1.y);
#endif
c[ret++]=l1;
mr->lseg_done_base=mr->lseg_done=1;
@@ -695,12 +695,12 @@ map_route_occluded_coord_get(void *priv_data, struct coord *c, int count)
break;
case 1:
#ifdef DEBUG_COORD_GET
- dbg(1,"begin clipped\n");
- dbg(1,"out 0x%x,0x%x\n", l0.x, l1.y);
+ dbg(lvl_warning,"begin clipped\n");
+ dbg(lvl_warning,"out 0x%x,0x%x\n", l0.x, l1.y);
#endif
c[ret++]=l0;
#ifdef DEBUG_COORD_GET
- dbg(1,"out 0x%x,0x%x\n", l1.x, l1.y);
+ dbg(lvl_warning,"out 0x%x,0x%x\n", l1.x, l1.y);
#endif
c[ret++]=l1;
mr->c_next_base=mr->c_next=l1;
@@ -708,15 +708,15 @@ map_route_occluded_coord_get(void *priv_data, struct coord *c, int count)
break;
case 2:
#ifdef DEBUG_COORD_GET
- dbg(1,"end clipped\n");
+ dbg(lvl_warning,"end clipped\n");
#endif
mr->c_next_base=mr->c_next;
#ifdef DEBUG_COORD_GET
- dbg(1,"out 0x%x,0x%x\n", l0.x, l1.y);
+ dbg(lvl_warning,"out 0x%x,0x%x\n", l0.x, l1.y);
#endif
c[ret++]=l0;
#ifdef DEBUG_COORD_GET
- dbg(1,"out 0x%x,0x%x\n", l1.x, l1.y);
+ dbg(lvl_warning,"out 0x%x,0x%x\n", l1.x, l1.y);
#endif
c[ret++]=l1;
mr->c_next_base=mr->c_next=l1;
@@ -724,15 +724,15 @@ map_route_occluded_coord_get(void *priv_data, struct coord *c, int count)
break;
case 3:
#ifdef DEBUG_COORD_GET
- dbg(1,"both clipped\n");
+ dbg(lvl_warning,"both clipped\n");
#endif
mr->c_next_base=mr->c_next;
#ifdef DEBUG_COORD_GET
- dbg(1,"out 0x%x,0x%x\n", l0.x, l1.y);
+ dbg(lvl_warning,"out 0x%x,0x%x\n", l0.x, l1.y);
#endif
c[ret++]=l0;
#ifdef DEBUG_COORD_GET
- dbg(1,"out 0x%x,0x%x\n", l1.x, l1.y);
+ dbg(lvl_warning,"out 0x%x,0x%x\n", l1.x, l1.y);
#endif
c[ret++]=l1;
mr->c_next_base=mr->c_next=l1;
@@ -745,21 +745,21 @@ map_route_occluded_coord_get(void *priv_data, struct coord *c, int count)
#if 0
case 2:
- dbg(1,"visible up to 0x%x,0x%x\n",l1.x,l1.y);
+ dbg(lvl_warning,"visible up to 0x%x,0x%x\n",l1.x,l1.y);
if (mr->first) {
mr->first=0;
c[ret++]=mr->c_out;
- dbg(1,"out 0x%x,0x%x\n", mr->c_out.x, mr->c_out.y);
+ dbg(lvl_warning,"out 0x%x,0x%x\n", mr->c_out.x, mr->c_out.y);
}
c[ret++]=mr->c_out=l1;
- dbg(1,"out 0x%x,0x%x\n", l1.x, l1.y);
+ dbg(lvl_warning,"out 0x%x,0x%x\n", l1.x, l1.y);
mr->last=1;
mr->route_item_done=1;
break;
case 1:
case 3:
case 4:
- dbg(1,"invisible\n");
+ dbg(lvl_warning,"invisible\n");
mr->c_out=l1;
mr->idx++;
mr->last=1;
@@ -772,7 +772,7 @@ map_route_occluded_coord_get(void *priv_data, struct coord *c, int count)
}
}
#ifdef DEBUG_COORD_GET
- dbg(1,"ret=%d last=%d\n", ret, mr->last);
+ dbg(lvl_warning,"ret=%d last=%d\n", ret, mr->last);
#endif
return ret;
}
@@ -801,16 +801,16 @@ map_route_occluded_rect_new(struct map_priv *priv, struct map_selection *sel)
struct map_rect *route_map_rect;
struct coord_rect r;
if (!navit_get_attr(priv->navit, attr_route, &route, NULL)) {
- dbg(0,"no route in navit\n");
+ dbg(lvl_error,"no route in navit\n");
return NULL;
}
if (!route_get_attr(route.u.route, attr_map, &route_map, NULL)) {
- dbg(0,"no map in route\n");
+ dbg(lvl_error,"no map in route\n");
return NULL;
}
route_map_rect=map_rect_new(route_map.u.map, sel);
if (!route_map_rect) {
- dbg(0,"no route map rect\n");
+ dbg(lvl_error,"no route map rect\n");
return NULL;
}
map_dump_file(route_map.u.map, "route.txt");
@@ -865,17 +865,17 @@ map_route_occluded_rect_destroy(struct map_rect_priv *mr)
static struct item *
map_route_occluded_get_item(struct map_rect_priv *mr)
{
- dbg(1,"enter last=%d\n",mr->last);
+ dbg(lvl_warning,"enter last=%d\n",mr->last);
while (!mr->last) {
struct coord c[128];
map_route_occluded_coord_get(mr, c, 128);
}
if (mr->route_item_done) {
- dbg(1,"next route item\n");
+ dbg(lvl_warning,"next route item\n");
do {
mr->route_item=map_rect_get_item(mr->route_map_rect);
} while (mr->route_item && mr->route_item->type != type_street_route);
- dbg(1,"item %p\n", mr->route_item);
+ dbg(lvl_warning,"item %p\n", mr->route_item);
if (!mr->route_item)
return NULL;
mr->item.type=type_street_route_occluded;
@@ -889,7 +889,7 @@ map_route_occluded_get_item(struct map_rect_priv *mr)
return NULL;
#endif
map_route_occluded_coord_rewind(mr);
- dbg(1,"type %s\n", item_to_name(mr->route_item->type));
+ dbg(lvl_warning,"type %s\n", item_to_name(mr->route_item->type));
return &mr->item;
}
@@ -921,14 +921,14 @@ map_route_occluded_new(struct map_methods *meth, struct attr **attrs)
{
struct map_priv *ret;
struct attr *navit;
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
navit=attr_search(attrs, NULL, attr_navit);
if (! navit)
return NULL;
ret=g_new0(struct map_priv, 1);
*meth=map_route_occluded_methods;
ret->navit=navit->u.navit;
- dbg(0,"m=%p navit=%p\n", ret, ret->navit);
+ dbg(lvl_error,"m=%p navit=%p\n", ret, ret->navit);
return ret;
}
@@ -977,16 +977,16 @@ pedestrian_draw_arrows(struct graphics *gra)
if (orientation == 2)
return;
if (!navit_get_attr(pedestrian_data.nav, attr_route, &route, NULL)) {
- dbg(0,"no route in navit\n");
+ dbg(lvl_error,"no route in navit\n");
return;
}
if (!route_get_attr(route.u.route, attr_map, &route_map, NULL)) {
- dbg(0,"no map in route\n");
+ dbg(lvl_error,"no map in route\n");
return;
}
route_map_rect=map_rect_new(route_map.u.map, NULL);
if (!route_map_rect) {
- dbg(0,"no route map rect\n");
+ dbg(lvl_error,"no route map rect\n");
return;
}
while ((item=map_rect_get_item(route_map_rect))) {
@@ -1042,7 +1042,7 @@ pedestrian_write_tilt(int fd, int axis)
ret=write(fd, buffer+axis, 1);
if (ret != 2) {
- dbg(0,"ret=%d\n",ret);
+ dbg(lvl_error,"ret=%d\n",ret);
}
}
@@ -1062,7 +1062,7 @@ pedestrian_read_tilt(int fd, struct navit *nav, struct tilt_data *data)
data->len=0;
if (navit_get_attr(nav, attr_transformation, &attr, NULL)) {
struct transformation *trans=attr.u.transformation;
- dbg(0,"ok axis=%d val=0x%x\n", data->axis, val);
+ dbg(lvl_error,"ok axis=%d val=0x%x\n", data->axis, val);
if (data->axis != 1) {
transform_set_pitch(trans, 90+(val-0x80));
} else {
@@ -1093,7 +1093,7 @@ pedestrian_setup_tilt(struct navit *nav)
char buffer[32];
fd=open("/dev/tiltsensor",O_RDWR);
if (fd == -1) {
- dbg(0,"Failed to set up tilt sensor, error %d\n",errno);
+ dbg(lvl_error,"Failed to set up tilt sensor, error %d\n",errno);
return;
}
tcgetattr(fd, &t);
@@ -1126,7 +1126,7 @@ android_sensors(struct navit *nav, int sensor, float *x, float *y, float *z)
sensors[sensor-1][2]=*z;
if (sensors_locked)
return;
- dbg(1,"enter %d %f %f %f\n",sensor,*x,*y,*z);
+ dbg(lvl_warning,"enter %d %f %f %f\n",sensor,*x,*y,*z);
if (sensor == 1) {
if (*x > 7.5)
orientation=1; /* landscape */
@@ -1134,7 +1134,7 @@ android_sensors(struct navit *nav, int sensor, float *x, float *y, float *z)
orientation=0; /* portrait */
if (*z > 7.5)
orientation=2; /* flat */
- dbg(1,"orientation=%d\n",orientation);
+ dbg(lvl_warning,"orientation=%d\n",orientation);
}
if ((orientation_old == 2) != (orientation == 2)) {
struct attr attr, flags_graphics, osd_configuration;
@@ -1179,7 +1179,7 @@ android_sensors(struct navit *nav, int sensor, float *x, float *y, float *z)
if (orientation != 2)
pitch+=2.0;
transform_set_pitch(trans, (int)pitch);
- dbg(1,"pich %d %f\n",orientation,pitch);
+ dbg(lvl_warning,"pich %d %f\n",orientation,pitch);
} else {
struct attr attr;
attr.type=attr_orientation;
@@ -1188,7 +1188,7 @@ android_sensors(struct navit *nav, int sensor, float *x, float *y, float *z)
attr.u.num+=360;
pedestrian_data.yaw=attr.u.num;
navit_set_attr(nav, &attr);
- dbg(1,"yaw %d %f\n",orientation,yaw);
+ dbg(lvl_warning,"yaw %d %f\n",orientation,yaw);
if (orientation == 2)
navit_set_center_cursor(nav, 1, 0);
}
@@ -1220,7 +1220,7 @@ vehicle_changed(struct vehicle *v, struct transformation *trans)
struct attr attr;
if (vehicle_get_attr(v, attr_position_direction, &attr, NULL)) {
int dir=(int)(*attr.u.numd);
- dbg(0,"enter %d\n",dir);
+ dbg(lvl_error,"enter %d\n",dir);
transform_set_pitch(trans, 90);
transform_set_yaw(trans, dir);
}
@@ -1245,15 +1245,15 @@ pedestrian_navit_init(struct navit *nav)
jmethodID cid;
jobject navitsensors;
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
if (android_find_class_global("org/navitproject/navit/NavitSensors", &navitsensorsclass)) {
- dbg(0,"class found\n");
+ dbg(lvl_error,"class found\n");
cid = (*jnienv)->GetMethodID(jnienv, navitsensorsclass, "<init>", "(Landroid/content/Context;I)V");
- dbg(0,"cid=%p\n",cid);
+ dbg(lvl_error,"cid=%p\n",cid);
if (cid) {
cb=callback_new_1(callback_cast(android_sensors), nav);
navitsensors=(*jnienv)->NewObject(jnienv, navitsensorsclass, cid, android_activity, cb);
- dbg(0,"object=%p\n",navitsensors);
+ dbg(lvl_error,"object=%p\n",navitsensors);
if (navitsensors)
navitsensors = (*jnienv)->NewGlobalRef(jnienv, navitsensors);
}
@@ -1288,14 +1288,14 @@ pedestrian_navit_init(struct navit *nav)
return;
if (!route_get_attr(route.u.route, attr_map, &route_map, NULL))
return;
- dbg(0,"enter 1\n");
+ dbg(lvl_error,"enter 1\n");
#if 0
struct attr active;
active.type=attr_active;
active.u.num=0;
if (!map_set_attr(route_map.u.map, &active))
return;
- dbg(0,"enter 2\n");
+ dbg(lvl_error,"enter 2\n");
#endif
if (!navit_get_attr(nav, attr_mapset, &mapset, NULL))
return;
@@ -1318,7 +1318,7 @@ pedestrian_navit_init(struct navit *nav)
iter=navit_attr_iter_new();
while(navit_get_attr(nav, attr_layout, &attr, iter)) {
if (!strcmp(attr.u.layout->name, "Route")) {
- dbg(0,"found %s\n",attr_to_name(attr.type));
+ dbg(lvl_error,"found %s\n",attr_to_name(attr.type));
main_layout=attr;
#if 1
navit_set_attr(nav, &attr);
@@ -1344,7 +1344,7 @@ pedestrian_navit_init(struct navit *nav)
static void
pedestrian_navit(struct navit *nav, int add)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
struct attr callback;
if (add) {
callback.type=attr_callback;
@@ -1363,10 +1363,10 @@ plugin_init(void)
jmethodID Activity_setRequestedOrientation;
if (!android_find_class_global("android/app/Activity", &ActivityClass))
- dbg(0,"failed to get class android/app/Activity\n");
+ dbg(lvl_error,"failed to get class android/app/Activity\n");
Activity_setRequestedOrientation = (*jnienv)->GetMethodID(jnienv, ActivityClass, "setRequestedOrientation", "(I)V");
if (Activity_setRequestedOrientation == NULL)
- dbg(0,"failed to get method setRequestedOrientation from android/app/Activity\n");
+ dbg(lvl_error,"failed to get method setRequestedOrientation from android/app/Activity\n");
(*jnienv)->CallVoidMethod(jnienv, android_activity, Activity_setRequestedOrientation, 0);
#endif
diff --git a/navit/popup.c b/navit/popup.c
index 10e7bc236..38824912e 100644
--- a/navit/popup.c
+++ b/navit/popup.c
@@ -87,7 +87,7 @@ popup_traffic_distortion(struct item *item, char *attr)
}
else
{
- dbg(0,"could not open file for distortions !!");
+ dbg(lvl_error,"could not open file for distortions !!");
} /* else - if (map) */
g_free(dist_filename); /* free the file name */
@@ -99,7 +99,7 @@ popup_traffic_distortion(struct item *item, char *attr)
static void
popup_traffic_distortion_blocked(struct item *item)
{
- dbg(0,"item=%p\n",item);
+ dbg(lvl_error,"item=%p\n",item);
popup_traffic_distortion(item, "maxspeed=0");
}
@@ -180,7 +180,7 @@ extern void *vehicle;
static void
popup_set_position(struct navit *nav, struct pcoord *pc)
{
- dbg(1,"%p %p\n", nav, pc);
+ dbg(lvl_warning,"%p %p\n", nav, pc);
navit_set_position(nav, pc);
}
@@ -214,7 +214,7 @@ popup_printf_cb(void *menu, enum menu_type type, struct callback *cb, const char
va_start(ap, fmt);
str=g_strdup_vprintf(fmt, ap);
- dbg(0,"%s\n", str);
+ dbg(lvl_error,"%s\n", str);
us=str;
while (*us) {
if (*us == '_')
@@ -310,7 +310,7 @@ popup_item_dump(struct item *item)
struct map_rect *mr;
mr=map_rect_new(item->map,NULL);
item=map_rect_get_item_byid(mr, item->id_hi, item->id_lo);
- dbg(0,"item=%p\n",item);
+ dbg(lvl_error,"item=%p\n",item);
item_dump_filedesc(item,item->map,stdout);
map_rect_destroy(mr);
}
@@ -349,7 +349,7 @@ popup_show_item(struct navit *nav, void *popup, struct displayitem *di)
if (diitem->map) {
mr=map_rect_new(diitem->map,NULL);
item=map_rect_get_item_byid(mr, diitem->id_hi, diitem->id_lo);
- dbg(1,"item=%p\n", item);
+ dbg(lvl_warning,"item=%p\n", item);
if (item) {
popup_show_attrs(item->map, menu_item, item);
popup_printf_cb(menu_item, menu_type_menu, callback_new_1(callback_cast(popup_item_dump), diitem), "Dump");
@@ -425,7 +425,7 @@ popup(struct navit *nav, int button, struct point *p)
coord_format(g.lat,g.lng,DEGREES_MINUTES_SECONDS,buffer,sizeof(buffer));
popup_printf(men, menu_type_menu, "%s", buffer);
popup_printf(men, menu_type_menu, "%f %f", g.lat, g.lng);
- dbg(1,"%p %p\n", nav, &c);
+ dbg(lvl_warning,"%p %p\n", nav, &c);
c.pro = transform_get_projection(navit_get_trans(nav));
c.x = co.x;
c.y = co.y;
diff --git a/navit/profile.c b/navit/profile.c
index 736dd724c..b6d95cd1f 100644
--- a/navit/profile.c
+++ b/navit/profile.c
@@ -50,7 +50,7 @@ profile_timer(int level, const char *module, const char *function, const char *f
sprintf(buffer, "profile:%s", module);
debug_vprintf(1, buffer, strlen(buffer), function, strlen(function), 1, fmt, ap);
if (msec >= 100)
- debug_printf(1, buffer, strlen(buffer), function, strlen(function), 0, " %d msec\n", msec);
+ debug_printf(lvl_warning, buffer, strlen(buffer), function, strlen(function), 0, " %d msec\n", msec);
else {
usec=(curr.tv_usec-last[level].tv_usec)+(curr.tv_sec-last[level].tv_sec)*1000*1000;
debug_printf(1, buffer, strlen(buffer), function, strlen(function), 0, " %d.%d msec\n", usec/1000, usec%1000);
diff --git a/navit/profile_option.c b/navit/profile_option.c
index b9cffefab..cf77fbd9f 100644
--- a/navit/profile_option.c
+++ b/navit/profile_option.c
@@ -34,7 +34,7 @@ profile_option_new(struct attr *parent, struct attr **attrs)
po->func=&profile_option_func;
navit_object_ref((struct navit_object *)po);
po->attrs=attr_list_dup(attrs);
- dbg(0,"return %p\n",po);
+ dbg(lvl_error,"return %p\n",po);
return po;
}
diff --git a/navit/projection.c b/navit/projection.c
index 1e56e5524..976af28ed 100644
--- a/navit/projection.c
+++ b/navit/projection.c
@@ -77,20 +77,20 @@ projection_from_name(const char *name, struct coord *utm_offset)
if (sscanf(name,"utmref%d%c%c%c",&zone,&zone_field,&square_x,&square_y)) {
i=utmref_letter(zone_field);
if (i < 2 || i > 21) {
- dbg(0,"invalid zone field '%c' in '%s'\n",zone_field,name);
+ dbg(lvl_error,"invalid zone field '%c' in '%s'\n",zone_field,name);
return projection_none;
}
i-=12;
- dbg(1,"zone_field %d\n",i);
+ dbg(lvl_warning,"zone_field %d\n",i);
baserow=i*887.6/100;
utm_offset->x=zone*1000000;
i=utmref_letter(square_x);
utm_offset->x+=((i%8)+1)*100000;
i=utmref_letter(square_y);
- dbg(1,"baserow %d\n",baserow);
+ dbg(lvl_warning,"baserow %d\n",baserow);
if (!(zone % 2))
i-=5;
- dbg(1,"i=%d\n",i);
+ dbg(lvl_warning,"i=%d\n",i);
i=(i-baserow+100)%20+baserow;
utm_offset->y=i*100000;
return projection_utm;
diff --git a/navit/route.c b/navit/route.c
index 825f26f34..2985f7101 100644
--- a/navit/route.c
+++ b/navit/route.c
@@ -795,7 +795,7 @@ route_path_update_done(struct route *this, int new_graph)
/* FIXME */
int seg_time=route_time_seg(this->vehicleprofile, seg->data, NULL);
if (seg_time == INT_MAX) {
- dbg(1,"error\n");
+ dbg(lvl_warning,"error\n");
} else
path_time+=seg_time;
path_len+=seg->data->len;
@@ -834,9 +834,9 @@ route_path_update_done(struct route *this, int new_graph)
static void
route_path_update_flags(struct route *this, enum route_path_flags flags)
{
- dbg(1,"enter %d\n", flags);
+ dbg(lvl_warning,"enter %d\n", flags);
if (! this->pos || ! this->destinations) {
- dbg(1,"destroy\n");
+ dbg(lvl_warning,"destroy\n");
route_path_destroy(this->path2,1);
this->path2 = NULL;
return;
@@ -848,21 +848,21 @@ route_path_update_flags(struct route *this, enum route_path_flags flags)
/* the graph is destroyed when setting the destination */
if (this->graph) {
if (this->graph->busy) {
- dbg(1,"busy building graph\n");
+ dbg(lvl_warning,"busy building graph\n");
return;
}
// we can try to update
- dbg(1,"try update\n");
+ dbg(lvl_warning,"try update\n");
route_path_update_done(this, 0);
} else {
route_path_destroy(this->path2,1);
this->path2 = NULL;
}
if (!this->graph || (!this->path2 && !(flags & route_path_flag_no_rebuild))) {
- dbg(0,"rebuild graph %p %p\n",this->graph,this->path2);
+ dbg(lvl_error,"rebuild graph %p %p\n",this->graph,this->path2);
if (! this->route_graph_flood_done_cb)
this->route_graph_flood_done_cb=callback_new_2(callback_cast(route_path_update_done), this, (long)1);
- dbg(1,"route_graph_update\n");
+ dbg(lvl_warning,"route_graph_update\n");
route_graph_update(this, this->route_graph_flood_done_cb, !!(flags & route_path_flag_async));
}
}
@@ -919,7 +919,7 @@ route_set_position_flags(struct route *this, struct pcoord *pos, enum route_path
if (!this->pos) return 0;
this->pos->street_direction=0;
- dbg(1,"this->pos=%p\n", this->pos);
+ dbg(lvl_warning,"this->pos=%p\n", this->pos);
route_info_distances(this->pos, pos->pro);
route_path_update_flags(this, flags);
return 1;
@@ -953,7 +953,7 @@ route_set_position_from_tracking(struct route *this, struct tracking *tracking,
struct route_info *ret;
struct street_data *sd;
- dbg(2,"enter\n");
+ dbg(lvl_info,"enter\n");
c=tracking_get_pos(tracking);
ret=g_new0(struct route_info, 1);
if (!ret) {
@@ -972,13 +972,13 @@ route_set_position_from_tracking(struct route *this, struct tracking *tracking,
ret->street=street_data_dup(sd);
route_info_distances(ret, pro);
}
- dbg(3,"position 0x%x,0x%x item 0x%x,0x%x direction %d pos %d lenpos %d lenneg %d\n",c->x,c->y,sd?sd->item.id_hi:0,sd?sd->item.id_lo:0,ret->street_direction,ret->pos,ret->lenpos,ret->lenneg);
- dbg(3,"c->x=0x%x, c->y=0x%x pos=%d item=(0x%x,0x%x)\n", c->x, c->y, ret->pos, ret->street?ret->street->item.id_hi:0, ret->street?ret->street->item.id_lo:0);
- dbg(3,"street 0=(0x%x,0x%x) %d=(0x%x,0x%x)\n", ret->street?ret->street->c[0].x:0, ret->street?ret->street->c[0].y:0, ret->street?ret->street->count-1:0, ret->street?ret->street->c[ret->street->count-1].x:0, ret->street?ret->street->c[ret->street->count-1].y:0);
+ dbg(lvl_debug,"position 0x%x,0x%x item 0x%x,0x%x direction %d pos %d lenpos %d lenneg %d\n",c->x,c->y,sd?sd->item.id_hi:0,sd?sd->item.id_lo:0,ret->street_direction,ret->pos,ret->lenpos,ret->lenneg);
+ dbg(lvl_debug,"c->x=0x%x, c->y=0x%x pos=%d item=(0x%x,0x%x)\n", c->x, c->y, ret->pos, ret->street?ret->street->item.id_hi:0, ret->street?ret->street->item.id_lo:0);
+ dbg(lvl_debug,"street 0=(0x%x,0x%x) %d=(0x%x,0x%x)\n", ret->street?ret->street->c[0].x:0, ret->street?ret->street->c[0].y:0, ret->street?ret->street->count-1:0, ret->street?ret->street->c[ret->street->count-1].x:0, ret->street?ret->street->c[ret->street->count-1].y:0);
this->pos=ret;
if (this->destinations)
route_path_update(this, 0, 1);
- dbg(2,"ret\n");
+ dbg(lvl_info,"ret\n");
}
/* Used for debuging of route_rect, what routing sees */
@@ -999,7 +999,7 @@ route_rect(int order, struct coord *c1, struct coord *c2, int rel, int abs)
sel->order=order;
sel->range.min=route_item_first;
sel->range.max=route_item_last;
- dbg(1,"%p %p\n", c1, c2);
+ dbg(lvl_warning,"%p %p\n", c1, c2);
dx=c1->x-c2->x;
dy=c1->y-c2->y;
if (dx < 0) {
@@ -1730,7 +1730,7 @@ route_path_add_line(struct route_path *this, struct coord *start, struct coord *
struct route_path_segment *segment;
int seg_size,seg_dat_size;
- dbg(1,"line from 0x%x,0x%x-0x%x,0x%x\n", start->x, start->y, end->x, end->y);
+ dbg(lvl_warning,"line from 0x%x,0x%x-0x%x,0x%x\n", start->x, start->y, end->x, end->y);
seg_size=sizeof(*segment) + sizeof(struct coord) * ccnt;
seg_dat_size=sizeof(struct route_segment_data);
segment=g_malloc0(seg_size + seg_dat_size);
@@ -1775,7 +1775,7 @@ route_path_add_item_from_graph(struct route_path *this, struct route_path *oldpa
if (rgs->data.flags & AF_SEGMENTED)
offset=RSD_OFFSET(&rgs->data);
- dbg(1,"enter (0x%x,0x%x) dir=%d pos=%p dst=%p\n", rgs->data.item.id_hi, rgs->data.item.id_lo, dir, pos, dst);
+ dbg(lvl_warning,"enter (0x%x,0x%x) dir=%d pos=%p dst=%p\n", rgs->data.item.id_hi, rgs->data.item.id_lo, dir, pos, dst);
if (oldpath) {
segment=item_hash_lookup(oldpath->path_hash, &rgs->data.item);
if (segment && segment->direction == dir) {
@@ -1805,9 +1805,9 @@ route_path_add_item_from_graph(struct route_path *this, struct route_path *oldpa
}
} else {
extra=1;
- dbg(1,"pos dir=%d\n", dir);
- dbg(1,"pos pos=%d\n", pos->pos);
- dbg(1,"pos count=%d\n", pos->street->count);
+ dbg(lvl_warning,"pos dir=%d\n", dir);
+ dbg(lvl_warning,"pos pos=%d\n", pos->pos);
+ dbg(lvl_warning,"pos count=%d\n", pos->street->count);
if (dir > 0) {
c=pos->street->c+pos->pos+1;
ccnt=pos->street->count-pos->pos-1;
@@ -1821,8 +1821,8 @@ route_path_add_item_from_graph(struct route_path *this, struct route_path *oldpa
pos->dir=dir;
} else if (dst) {
extra=1;
- dbg(1,"dst dir=%d\n", dir);
- dbg(1,"dst pos=%d\n", dst->pos);
+ dbg(lvl_warning,"dst dir=%d\n", dir);
+ dbg(lvl_warning,"dst pos=%d\n", dst->pos);
if (dir > 0) {
c=dst->street->c;
ccnt=dst->pos+1;
@@ -2035,7 +2035,7 @@ route_value_seg(struct vehicleprofile *profile, struct route_graph_point *from,
int ret;
struct route_traffic_distortion dist,*distp=NULL;
#if 0
- dbg(0,"flags 0x%x mask 0x%x flags 0x%x\n", over->flags, dir >= 0 ? profile->flags_forward_mask : profile->flags_reverse_mask, profile->flags);
+ dbg(lvl_error,"flags 0x%x mask 0x%x flags 0x%x\n", over->flags, dir >= 0 ? profile->flags_forward_mask : profile->flags_reverse_mask, profile->flags);
#endif
if ((over->data.flags & (dir >= 0 ? profile->flags_forward_mask : profile->flags_reverse_mask)) != profile->flags)
return INT_MAX;
@@ -2150,14 +2150,14 @@ route_process_turn_restriction(struct route_graph *this, struct item *item)
count=item_coord_get(item, c, 5);
if (count != 3 && count != 4) {
- dbg(0,"wrong count %d\n",count);
+ dbg(lvl_error,"wrong count %d\n",count);
return;
}
if (count == 4)
return;
for (i = 0 ; i < count ; i++)
pnt[i]=route_graph_add_point(this,&c[i]);
- dbg(1,"%s: (0x%x,0x%x)-(0x%x,0x%x)-(0x%x,0x%x) %p-%p-%p\n",item_to_name(item->type),c[0].x,c[0].y,c[1].x,c[1].y,c[2].x,c[2].y,pnt[0],pnt[1],pnt[2]);
+ dbg(lvl_warning,"%s: (0x%x,0x%x)-(0x%x,0x%x)-(0x%x,0x%x) %p-%p-%p\n",item_to_name(item->type),c[0].x,c[0].y,c[1].x,c[1].y,c[2].x,c[2].y,pnt[0],pnt[1],pnt[2]);
data.item=item;
data.flags=0;
data.len=0;
@@ -2433,7 +2433,7 @@ route_graph_flood(struct route_graph *this, struct route_info *dst, struct vehic
}
fh_deleteheap(heap);
callback_call_0(cb);
- dbg(1,"return\n");
+ dbg(lvl_warning,"return\n");
}
/**
@@ -2544,7 +2544,7 @@ route_path_new(struct route_graph *this, struct route_path *oldpath, struct rout
struct route_path *ret;
if (! pos->street || ! dst->street) {
- dbg(0,"pos or dest not set\n");
+ dbg(lvl_error,"pos or dest not set\n");
return NULL;
}
@@ -2554,12 +2554,12 @@ route_path_new(struct route_graph *this, struct route_path *oldpath, struct rout
val=route_value_seg(profile, NULL, s, 2);
if (val != INT_MAX && s->end->value != INT_MAX) {
val=val*(100-pos->percent)/100;
- dbg(1,"val1 %d\n",val);
+ dbg(lvl_warning,"val1 %d\n",val);
if (route_graph_segment_match(s,this->avoid_seg) && pos->street_direction < 0)
val+=profile->turn_around_penalty;
- dbg(1,"val1 %d\n",val);
+ dbg(lvl_warning,"val1 %d\n",val);
val1_new=s->end->value+val;
- dbg(1,"val1 +%d=%d\n",s->end->value,val1_new);
+ dbg(lvl_warning,"val1 +%d=%d\n",s->end->value,val1_new);
if (val1_new < val1) {
val1=val1_new;
s1=s;
@@ -2568,12 +2568,12 @@ route_path_new(struct route_graph *this, struct route_path *oldpath, struct rout
val=route_value_seg(profile, NULL, s, -2);
if (val != INT_MAX && s->start->value != INT_MAX) {
val=val*pos->percent/100;
- dbg(1,"val2 %d\n",val);
+ dbg(lvl_warning,"val2 %d\n",val);
if (route_graph_segment_match(s,this->avoid_seg) && pos->street_direction > 0)
val+=profile->turn_around_penalty;
- dbg(1,"val2 %d\n",val);
+ dbg(lvl_warning,"val2 %d\n",val);
val2_new=s->start->value+val;
- dbg(1,"val2 +%d=%d\n",s->start->value,val2_new);
+ dbg(lvl_warning,"val2 +%d=%d\n",s->start->value,val2_new);
if (val2_new < val2) {
val2=val2_new;
s2=s;
@@ -2581,7 +2581,7 @@ route_path_new(struct route_graph *this, struct route_path *oldpath, struct rout
}
}
if (val1 == INT_MAX && val2 == INT_MAX) {
- dbg(0,"no route found, pos blocked\n");
+ dbg(lvl_error,"no route found, pos blocked\n");
return NULL;
}
if (val1 == val2) {
@@ -2599,7 +2599,7 @@ route_path_new(struct route_graph *this, struct route_path *oldpath, struct rout
}
if (pos->street_direction && dir != pos->street_direction && profile->turn_around_penalty) {
if (!route_graph_segment_match(this->avoid_seg,s)) {
- dbg(0,"avoid current segment\n");
+ dbg(lvl_error,"avoid current segment\n");
if (this->avoid_seg)
route_graph_set_traffic_distortion(this, this->avoid_seg, 0);
this->avoid_seg=s;
@@ -2640,7 +2640,7 @@ route_path_new(struct route_graph *this, struct route_path *oldpath, struct rout
}
if (dst->lenextra)
route_path_add_line(ret, &dst->lp, &dst->c, dst->lenextra);
- dbg(1, "%d segments\n", segs);
+ dbg(lvl_warning, "%d segments\n", segs);
return ret;
}
@@ -2680,29 +2680,29 @@ is_turn_allowed(struct route_graph_point *p, struct route_graph_segment *from, s
(tmp1->data.item.type == type_street_turn_restriction_no ||
tmp1->data.item.type == type_street_turn_restriction_only)) {
tmp2=p->start;
- dbg(1,"found %s (0x%x,0x%x) (0x%x,0x%x)-(0x%x,0x%x) %p-%p\n",item_to_name(tmp1->data.item.type),tmp1->data.item.id_hi,tmp1->data.item.id_lo,tmp1->start->c.x,tmp1->start->c.y,tmp1->end->c.x,tmp1->end->c.y,tmp1->start,tmp1->end);
+ dbg(lvl_warning,"found %s (0x%x,0x%x) (0x%x,0x%x)-(0x%x,0x%x) %p-%p\n",item_to_name(tmp1->data.item.type),tmp1->data.item.id_hi,tmp1->data.item.id_lo,tmp1->start->c.x,tmp1->start->c.y,tmp1->end->c.x,tmp1->end->c.y,tmp1->start,tmp1->end);
while (tmp2) {
- dbg(1,"compare %s (0x%x,0x%x) (0x%x,0x%x)-(0x%x,0x%x) %p-%p\n",item_to_name(tmp2->data.item.type),tmp2->data.item.id_hi,tmp2->data.item.id_lo,tmp2->start->c.x,tmp2->start->c.y,tmp2->end->c.x,tmp2->end->c.y,tmp2->start,tmp2->end);
+ dbg(lvl_warning,"compare %s (0x%x,0x%x) (0x%x,0x%x)-(0x%x,0x%x) %p-%p\n",item_to_name(tmp2->data.item.type),tmp2->data.item.id_hi,tmp2->data.item.id_lo,tmp2->start->c.x,tmp2->start->c.y,tmp2->end->c.x,tmp2->end->c.y,tmp2->start,tmp2->end);
if (item_is_equal(tmp1->data.item, tmp2->data.item))
break;
tmp2=tmp2->start_next;
}
- dbg(1,"tmp2=%p\n",tmp2);
+ dbg(lvl_warning,"tmp2=%p\n",tmp2);
if (tmp2) {
- dbg(1,"%s tmp2->end=%p next=%p\n",item_to_name(tmp1->data.item.type),tmp2->end,next);
+ dbg(lvl_warning,"%s tmp2->end=%p next=%p\n",item_to_name(tmp1->data.item.type),tmp2->end,next);
}
if (tmp1->data.item.type == type_street_turn_restriction_no && tmp2 && tmp2->end->c.x == next->c.x && tmp2->end->c.y == next->c.y) {
- dbg(1,"from 0x%x,0x%x over 0x%x,0x%x to 0x%x,0x%x not allowed (no)\n",prev->c.x,prev->c.y,p->c.x,p->c.y,next->c.x,next->c.y);
+ dbg(lvl_warning,"from 0x%x,0x%x over 0x%x,0x%x to 0x%x,0x%x not allowed (no)\n",prev->c.x,prev->c.y,p->c.x,p->c.y,next->c.x,next->c.y);
return 0;
}
if (tmp1->data.item.type == type_street_turn_restriction_only && tmp2 && (tmp2->end->c.x != next->c.x || tmp2->end->c.y != next->c.y)) {
- dbg(1,"from 0x%x,0x%x over 0x%x,0x%x to 0x%x,0x%x not allowed (only)\n",prev->c.x,prev->c.y,p->c.x,p->c.y,next->c.x,next->c.y);
+ dbg(lvl_warning,"from 0x%x,0x%x over 0x%x,0x%x to 0x%x,0x%x not allowed (only)\n",prev->c.x,prev->c.y,p->c.x,p->c.y,next->c.x,next->c.y);
return 0;
}
}
tmp1=tmp1->end_next;
}
- dbg(1,"from 0x%x,0x%x over 0x%x,0x%x to 0x%x,0x%x allowed\n",prev->c.x,prev->c.y,p->c.x,p->c.y,next->c.x,next->c.y);
+ dbg(lvl_warning,"from 0x%x,0x%x over 0x%x,0x%x to 0x%x,0x%x allowed\n",prev->c.x,prev->c.y,p->c.x,p->c.y,next->c.x,next->c.y);
return 1;
}
@@ -2719,7 +2719,7 @@ route_graph_clone_segment(struct route_graph *this, struct route_graph_segment *
data.maxspeed=RSD_MAXSPEED(&s->data);
if (s->data.flags & AF_SEGMENTED)
data.offset=RSD_OFFSET(&s->data);
- dbg(1,"cloning segment from %p (0x%x,0x%x) to %p (0x%x,0x%x)\n",start,start->c.x,start->c.y, end, end->c.x, end->c.y);
+ dbg(lvl_warning,"cloning segment from %p (0x%x,0x%x) to %p (0x%x,0x%x)\n",start,start->c.x,start->c.y, end, end->c.x, end->c.y);
route_graph_add_segment(this, start, end, &data);
}
@@ -2733,19 +2733,19 @@ route_graph_process_restriction_segment(struct route_graph *this, struct route_g
int dy=0;
c.x+=dx;
c.y+=dy;
- dbg(1,"From %s %d,%d\n",item_to_name(s->data.item.type),dx,dy);
+ dbg(lvl_warning,"From %s %d,%d\n",item_to_name(s->data.item.type),dx,dy);
pn=route_graph_point_new(this, &c);
if (dir > 0) { /* going away */
- dbg(1,"other 0x%x,0x%x\n",s->end->c.x,s->end->c.y);
+ dbg(lvl_warning,"other 0x%x,0x%x\n",s->end->c.x,s->end->c.y);
if (s->data.flags & AF_ONEWAY) {
- dbg(1,"Not possible\n");
+ dbg(lvl_warning,"Not possible\n");
return;
}
route_graph_clone_segment(this, s, pn, s->end, AF_ONEWAYREV);
} else { /* coming in */
- dbg(1,"other 0x%x,0x%x\n",s->start->c.x,s->start->c.y);
+ dbg(lvl_warning,"other 0x%x,0x%x\n",s->start->c.x,s->start->c.y);
if (s->data.flags & AF_ONEWAYREV) {
- dbg(1,"Not possible\n");
+ dbg(lvl_warning,"Not possible\n");
return;
}
route_graph_clone_segment(this, s, s->start, pn, AF_ONEWAY);
@@ -2756,7 +2756,7 @@ route_graph_process_restriction_segment(struct route_graph *this, struct route_g
tmp->data.item.type != type_street_turn_restriction_only &&
!(tmp->data.flags & AF_ONEWAYREV) && is_turn_allowed(p, s, tmp)) {
route_graph_clone_segment(this, tmp, pn, tmp->end, AF_ONEWAY);
- dbg(1,"To start %s\n",item_to_name(tmp->data.item.type));
+ dbg(lvl_warning,"To start %s\n",item_to_name(tmp->data.item.type));
}
tmp=tmp->start_next;
}
@@ -2766,7 +2766,7 @@ route_graph_process_restriction_segment(struct route_graph *this, struct route_g
tmp->data.item.type != type_street_turn_restriction_only &&
!(tmp->data.flags & AF_ONEWAY) && is_turn_allowed(p, s, tmp)) {
route_graph_clone_segment(this, tmp, tmp->start, pn, AF_ONEWAYREV);
- dbg(1,"To end %s\n",item_to_name(tmp->data.item.type));
+ dbg(lvl_warning,"To end %s\n",item_to_name(tmp->data.item.type));
}
tmp=tmp->end_next;
}
@@ -2777,7 +2777,7 @@ route_graph_process_restriction_point(struct route_graph *this, struct route_gra
{
struct route_graph_segment *tmp;
tmp=p->start;
- dbg(1,"node 0x%x,0x%x\n",p->c.x,p->c.y);
+ dbg(lvl_warning,"node 0x%x,0x%x\n",p->c.x,p->c.y);
while (tmp) {
if (tmp->data.item.type != type_street_turn_restriction_no &&
tmp->data.item.type != type_street_turn_restriction_only)
@@ -2799,7 +2799,7 @@ route_graph_process_restrictions(struct route_graph *this)
{
struct route_graph_point *curr;
int i;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
for (i = 0 ; i < HASH_SIZE ; i++) {
curr=this->hash[i];
while (curr) {
@@ -2813,7 +2813,7 @@ route_graph_process_restrictions(struct route_graph *this)
static void
route_graph_build_done(struct route_graph *rg, int cancel)
{
- dbg(1,"cancel=%d\n",cancel);
+ dbg(lvl_warning,"cancel=%d\n",cancel);
if (rg->idle_ev)
event_remove_idle(rg->idle_ev);
if (rg->idle_cb)
@@ -2880,7 +2880,7 @@ route_graph_build(struct mapset *ms, struct coord *c, int count, struct callback
{
struct route_graph *ret=g_new0(struct route_graph, 1);
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
ret->sel=route_calc_selection(c, count, profile);
ret->h=mapset_open(ms);
@@ -3083,7 +3083,7 @@ route_find_nearest_street(struct vehicleprofile *vehicleprofile, struct mapset *
ret->lp=lp;
ret->pos=pos;
ret->street=sd;
- dbg(1,"dist=%d id 0x%x 0x%x pos=%d\n", dist, item->id_hi, item->id_lo, pos);
+ dbg(lvl_warning,"dist=%d id 0x%x 0x%x pos=%d\n", dist, item->id_hi, item->id_lo, pos);
} else {
street_data_free(sd);
}
@@ -3097,7 +3097,7 @@ route_find_nearest_street(struct vehicleprofile *vehicleprofile, struct mapset *
if (!ret->street || mindist > max_dist*max_dist) {
if (ret->street) {
street_data_free(ret->street);
- dbg(1,"Much too far %d > %d\n", mindist, max_dist);
+ dbg(lvl_warning,"Much too far %d > %d\n", mindist, max_dist);
}
g_free(ret);
ret = NULL;
@@ -3318,7 +3318,7 @@ rm_coord_get(void *priv_data, struct coord *c, int count)
c[i] = seg->c[mr->last_coord++];
rc++;
}
- dbg(1,"return %d\n",rc);
+ dbg(lvl_warning,"return %d\n",rc);
return rc;
}
@@ -3348,7 +3348,7 @@ rp_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
switch (attr_type) {
case attr_any: // works only with rg_points for now
while (mr->attr_next != attr_none) {
- dbg(0,"querying %s\n", attr_to_name(mr->attr_next));
+ dbg(lvl_error,"querying %s\n", attr_to_name(mr->attr_next));
if (rp_attr_get(priv_data, mr->attr_next, attr))
return 1;
}
@@ -3543,7 +3543,7 @@ static struct map_rect_priv *
rm_rect_new(struct map_priv *priv, struct map_selection *sel)
{
struct map_rect_priv * mr;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
#if 0
if (! route_get_pos(priv->route))
return NULL;
@@ -3587,7 +3587,7 @@ rp_rect_new(struct map_priv *priv, struct map_selection *sel)
{
struct map_rect_priv * mr;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
if (! priv->route->graph)
return NULL;
mr=g_new0(struct map_rect_priv, 1);
@@ -3933,7 +3933,7 @@ route_set_attr(struct route *this_, struct attr *attr)
}
break;
default:
- dbg(0,"unsupported attribute: %s\n",attr_to_name(attr->type));
+ dbg(lvl_error,"unsupported attribute: %s\n",attr_to_name(attr->type));
return 0;
}
if (attr_updated)
@@ -3956,7 +3956,7 @@ route_add_attr(struct route *this_, struct attr *attr)
int
route_remove_attr(struct route *this_, struct attr *attr)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
switch (attr->type) {
case attr_callback:
callback_list_remove(this_->cbl2, attr->u.callback);
@@ -4004,7 +4004,7 @@ route_get_attr(struct route *this_, enum attr_type type, struct attr *attr, stru
case attr_vehicle:
attr->u.vehicle=this_->v;
ret=(this_->v != NULL);
- dbg(0,"get vehicle %p\n",this_->v);
+ dbg(lvl_error,"get vehicle %p\n",this_->v);
break;
case attr_vehicleprofile:
attr->u.vehicleprofile=this_->vehicleprofile;
@@ -4021,7 +4021,7 @@ route_get_attr(struct route *this_, enum attr_type type, struct attr *attr, stru
attr->u.num+=path->path_time;
path=path->next;
}
- dbg(1,"path_time %ld\n",attr->u.num);
+ dbg(lvl_warning,"path_time %ld\n",attr->u.num);
} else
ret=0;
break;
diff --git a/navit/routech.c b/navit/routech.c
index 4f8c77add..b5afc0961 100644
--- a/navit/routech.c
+++ b/navit/routech.c
@@ -447,17 +447,17 @@ routech_find_edge(struct map_rect *mr, struct item_id *from, struct item_id *to,
struct item *item=map_rect_get_item_byid(mr, from->id_hi, from->id_lo);
struct attr edge_attr;
dbg_assert(item->type == type_ch_node);
- dbg(1,"type %s\n",item_to_name(item->type));
- dbg(1,"segment item=%p\n",item);
+ dbg(lvl_warning,"type %s\n",item_to_name(item->type));
+ dbg(lvl_warning,"segment item=%p\n",item);
while (item_attr_get(item, attr_ch_edge, &edge_attr)) {
struct ch_edge *edge=edge_attr.u.data;
- dbg(1,"flags=%d\n",edge->flags);
+ dbg(lvl_warning,"flags=%d\n",edge->flags);
if (edge->target.id_hi == to->id_hi && edge->target.id_lo == to->id_lo) {
*middle=edge->middle;
return edge->flags;
}
}
- dbg(0,"** not found\n");
+ dbg(lvl_error,"** not found\n");
return 0;
}
@@ -470,7 +470,7 @@ routech_resolve(struct map_rect *mr, struct item_id *from, struct item_id *to, i
res=routech_find_edge(mr, to, from, &middle_node);
else
res=routech_find_edge(mr, from, to, &middle_node);
- dbg(1,"res=%d\n",res);
+ dbg(lvl_warning,"res=%d\n",res);
if (res & 4) {
routech_resolve(mr, from, &middle_node, 1);
routech_resolve(mr, &middle_node, to, 0);
@@ -483,7 +483,7 @@ routech_find_path(struct map_rect *mr, struct routech_search *search)
{
struct item_id *curr_node=search->via;
GList *i,*n,*list=NULL;
- dbg(1,"node %p\n",curr_node);
+ dbg(lvl_warning,"node %p\n",curr_node);
for (;;) {
int element=GPOINTER_TO_INT(g_hash_table_lookup(search->hash, curr_node));
struct item_id *next_node=pq_get_parent_node_id(search->pq,element);
@@ -491,8 +491,8 @@ routech_find_path(struct map_rect *mr, struct routech_search *search)
list=g_list_append(list, curr_node);
else
list=g_list_prepend(list, curr_node);
- dbg(1,"element %d\n",element);
- dbg(1,"next node %p\n",next_node);
+ dbg(lvl_warning,"element %d\n",element);
+ dbg(lvl_warning,"next node %p\n",next_node);
if (!next_node)
break;
curr_node=next_node;
@@ -551,16 +551,16 @@ routech_test(struct navit *navit)
curr=search[search_id];
opposite=search[1-search_id];
if (pq_is_empty(curr->pq)) {
- dbg(0,"empty\n");
+ dbg(lvl_error,"empty\n");
break;
}
routech_relax(mr, curr, opposite);
if (pq_min(curr->pq) > curr->upper) {
- dbg(0,"min %d upper %d\n",pq_min(curr->pq), curr->upper);
+ dbg(lvl_error,"min %d upper %d\n",pq_min(curr->pq), curr->upper);
curr->finished=1;
}
if (curr->finished && opposite->finished) {
- dbg(0,"finished\n");
+ dbg(lvl_error,"finished\n");
break;
}
}
diff --git a/navit/script.c b/navit/script.c
index 841ec6fc2..92abda500 100644
--- a/navit/script.c
+++ b/navit/script.c
@@ -40,10 +40,10 @@ script_run(struct script *scr)
struct attr *xml_text=attr_search(scr->attrs, NULL, attr_xml_text);
int error;
if (!xml_text || !xml_text->u.str) {
- dbg(0,"no text\n");
+ dbg(lvl_error,"no text\n");
return;
}
- dbg(0,"running '%s'\n",xml_text->u.str);
+ dbg(lvl_error,"running '%s'\n",xml_text->u.str);
command_evaluate_to_void(&scr->parent, xml_text->u.str, &error);
}
@@ -52,7 +52,7 @@ script_set_attr_int(struct script *scr, struct attr *attr)
{
switch (attr->type) {
case attr_refresh_cond:
- dbg(0,"refresh_cond\n");
+ dbg(lvl_error,"refresh_cond\n");
if (scr->cs)
command_saved_destroy(scr->cs);
scr->cs=command_saved_attr_new(attr->u.str, &scr->parent, scr->cb, 0);
@@ -79,14 +79,14 @@ script_new(struct attr *parent, struct attr **attrs)
scr->parent=*parent;
while (attrs && *attrs)
script_set_attr_int(scr, *attrs++);
- dbg(0,"return %p\n",scr);
+ dbg(lvl_error,"return %p\n",scr);
return scr;
}
static void
script_destroy(struct script *scr)
{
- dbg(0,"enter %p\n",scr);
+ dbg(lvl_error,"enter %p\n",scr);
if (scr->timeout)
event_remove_timeout(scr->timeout);
if (scr->cs)
diff --git a/navit/search.c b/navit/search.c
index cee831308..17418b167 100644
--- a/navit/search.c
+++ b/navit/search.c
@@ -138,7 +138,7 @@ search_list_level(enum attr_type attr_type)
case attr_postal:
return -1;
default:
- dbg(0,"unknown search '%s'\n",attr_to_name(attr_type));
+ dbg(lvl_error,"unknown search '%s'\n",attr_to_name(attr_type));
return -1;
}
}
@@ -225,10 +225,10 @@ search_phrase_used(struct phrase *p, GList *used_phrases)
{
while (used_phrases) {
struct phrase *pu=used_phrases->data;
- dbg(1,"'%s'-'%s' vs '%s'-'%s'\n",p->start,p->end,pu->start,pu->end);
+ dbg(lvl_warning,"'%s'-'%s' vs '%s'-'%s'\n",p->start,p->end,pu->start,pu->end);
if (p->start < pu->end && p->end > pu->start)
return 1;
- dbg(1,"unused\n");
+ dbg(lvl_warning,"unused\n");
used_phrases=g_list_next(used_phrases);
}
return 0;
@@ -255,7 +255,7 @@ search_by_address_attr(GList *results, struct search_list *sl, GList *phrases, G
int count=0,wordcount_all=wordcount+p->wordcount;
struct search_list_result *slr;
attr.u.str=search_phrase_str(p);
- dbg(1,"%s phrase '%s'\n",attr_to_name(attr_type),attr.u.str);
+ dbg(lvl_warning,"%s phrase '%s'\n",attr_to_name(attr_type),attr.u.str);
search_list_search(sl, &attr, 0);
while ((slr=search_list_get_result(sl))) {
if (attr_type != attr_country_all) {
@@ -265,7 +265,7 @@ search_by_address_attr(GList *results, struct search_list *sl, GList *phrases, G
}
count++;
}
- dbg(1,"%d results wordcount %d\n",count,wordcount_all);
+ dbg(lvl_warning,"%d results wordcount %d\n",count,wordcount_all);
if (count) {
GList *used=g_list_prepend(g_list_copy(exclude), tmp->data);
enum attr_type new_attr_type=attr_none;
@@ -348,7 +348,7 @@ search_list_search(struct search_list *this_, struct attr *search_attr, int part
{
struct search_list_level *le;
int level;
- dbg(2,"Starting search for '=%s' of type %s\n", search_attr->u.str, attr_to_name(search_attr->type));
+ dbg(lvl_info,"Starting search for '=%s' of type %s\n", search_attr->u.str, attr_to_name(search_attr->type));
search_address_results_free(this_);
if (search_attr->type == attr_address) {
search_by_address(this_, search_attr->u.str);
@@ -392,7 +392,7 @@ search_list_select(struct search_list *this_, enum attr_type attr_type, int id,
curr=le->list;
if (mode > 0 || !id)
le->selected=mode;
- //dbg(0,"enter level=%d %d %d %p\n", level, id, mode, curr);
+ //dbg(lvl_error,"enter level=%d %d %d %p\n", level, id, mode, curr);
num = 0;
while (curr) {
num++;
@@ -401,13 +401,13 @@ search_list_select(struct search_list *this_, enum attr_type attr_type, int id,
slc->selected=mode;
if (id) {
le->last=curr;
- //dbg(0,"found\n");
+ //dbg(lvl_error,"found\n");
return slc;
}
}
curr=g_list_next(curr);
}
- //dbg(0,"not found\n");
+ //dbg(lvl_error,"not found\n");
return NULL;
}
@@ -566,7 +566,7 @@ search_list_town_new(struct item *item)
ret->itemt=*item;
ret->common.item=ret->common.unique=*item;
if (item_attr_get(item, attr_town_streets_item, &attr)) {
- dbg(1,"town_assoc 0x%x 0x%x\n", attr.u.item->id_hi, attr.u.item->id_lo);
+ dbg(lvl_warning,"town_assoc 0x%x 0x%x\n", attr.u.item->id_hi, attr.u.item->id_lo);
ret->common.unique=*attr.u.item;
}
search_list_common_new(item, &ret->common);
@@ -760,7 +760,7 @@ search_postal_merge(char *mask, char *new)
{
int i;
char *ret=NULL;
- dbg(1,"enter %s %s\n", mask, new);
+ dbg(lvl_warning,"enter %s %s\n", mask, new);
if (!new)
return NULL;
if (!mask)
@@ -777,7 +777,7 @@ search_postal_merge(char *mask, char *new)
while (mask[i])
ret[i++]='.';
}
- dbg(1,"merged %s with %s as %s\n", mask, new, ret);
+ dbg(lvl_warning,"merged %s with %s as %s\n", mask, new, ret);
return ret;
}
@@ -861,24 +861,24 @@ search_list_get_result(struct search_list *this_)
return ret;
}
- //dbg(0,"enter\n");
+ //dbg(lvl_error,"enter\n");
le=&this_->levels[level];
- //dbg(0,"le=%p\n", le);
+ //dbg(lvl_error,"le=%p\n", le);
for (;;)
{
- //dbg(0,"le->search=%p\n", le->search);
+ //dbg(lvl_error,"le->search=%p\n", le->search);
if (! le->search)
{
- //dbg(0,"partial=%d level=%d\n", le->partial, level);
+ //dbg(lvl_error,"partial=%d level=%d\n", le->partial, level);
if (! level)
le->parent=NULL;
else
{
leu=&this_->levels[level-1];
- //dbg(0,"leu->curr=%p\n", leu->curr);
+ //dbg(lvl_error,"leu->curr=%p\n", leu->curr);
for (;;)
{
- //dbg(0,"*********########");
+ //dbg(lvl_error,"*********########");
struct search_list_common *slc;
if (! leu->curr)
@@ -897,23 +897,23 @@ search_list_get_result(struct search_list *this_)
}
if (le->parent)
{
- //dbg(0,"mapset_search_new with item(%d,%d)\n", le->parent->item.id_hi, le->parent->item.id_lo);
+ //dbg(lvl_error,"mapset_search_new with item(%d,%d)\n", le->parent->item.id_hi, le->parent->item.id_lo);
}
- //dbg(0,"############## attr=%s\n", attr_to_name(le->attr->type));
+ //dbg(lvl_error,"############## attr=%s\n", attr_to_name(le->attr->type));
le->search=mapset_search_new(this_->ms, &le->parent->item, le->attr, le->partial);
le->hash=g_hash_table_new(search_item_hash_hash, search_item_hash_equal);
}
- //dbg(0,"le->search=%p\n", le->search);
+ //dbg(lvl_error,"le->search=%p\n", le->search);
if (!this_->item)
{
- //dbg(0,"sssss 1");
+ //dbg(lvl_error,"sssss 1");
this_->item=mapset_search_get_item(le->search);
- //dbg(0,"sssss 1 %p\n",this_->item);
+ //dbg(lvl_error,"sssss 1 %p\n",this_->item);
}
if (this_->item)
{
void *p=NULL;
- //dbg(0,"id_hi=%d id_lo=%d\n", this_->item->id_hi, this_->item->id_lo);
+ //dbg(lvl_error,"id_hi=%d id_lo=%d\n", this_->item->id_hi, this_->item->id_lo);
if (this_->postal)
{
struct attr postal;
@@ -929,11 +929,11 @@ search_list_get_result(struct search_list *this_)
this_->result.town=NULL;
this_->result.street=NULL;
this_->result.c=NULL;
- //dbg(0,"case x LEVEL start %d\n",level);
+ //dbg(lvl_error,"case x LEVEL start %d\n",level);
switch (level)
{
case 0:
- //dbg(0,"case 0 COUNTRY");
+ //dbg(lvl_error,"case 0 COUNTRY");
p=search_list_country_new(this_->item);
this_->result.country=p;
this_->result.country->common.parent=NULL;
@@ -943,7 +943,7 @@ search_list_get_result(struct search_list *this_)
this_->item=NULL;
break;
case 1:
- //dbg(0,"case 1 TOWN");
+ //dbg(lvl_error,"case 1 TOWN");
p=search_list_town_new(this_->item);
this_->result.town=p;
this_->result.town->common.parent=this_->levels[0].last->data;
@@ -954,7 +954,7 @@ search_list_get_result(struct search_list *this_)
this_->item=NULL;
break;
case 2:
- //dbg(0,"case 2 STREET");
+ //dbg(lvl_error,"case 2 STREET");
p=search_list_street_new(this_->item);
this_->result.street=p;
this_->result.street->common.parent=this_->levels[1].last->data;
@@ -965,13 +965,13 @@ search_list_get_result(struct search_list *this_)
this_->item=NULL;
break;
case 3:
- dbg(1,"case 3 HOUSENUMBER\n");
+ dbg(lvl_warning,"case 3 HOUSENUMBER\n");
has_street_name=0;
// if this housenumber has a streetname tag, set the name now
if (item_attr_get(this_->item, attr_street_name, &attr2))
{
- dbg(1,"streetname: %s\n",attr2.u.str);
+ dbg(lvl_warning,"streetname: %s\n",attr2.u.str);
has_street_name=1;
}
@@ -988,7 +988,7 @@ search_list_get_result(struct search_list *this_)
{
this_->item=NULL;
} else {
- dbg(0,"interpolation!\n");
+ dbg(lvl_error,"interpolation!\n");
}
if(le->parent && has_street_name) {
diff --git a/navit/search_houseno_interpol.c b/navit/search_houseno_interpol.c
index 03b1d6427..0cfb044e3 100644
--- a/navit/search_houseno_interpol.c
+++ b/navit/search_houseno_interpol.c
@@ -79,7 +79,7 @@ house_number_interpolation_clear_all(struct house_number_interpolation *inter)
static char *
search_next_house_number_curr_interpol_with_ends(struct house_number_interpolation *inter)
{
- dbg(1,"interpolate %s-%s %s\n",inter->first,inter->last,inter->curr);
+ dbg(lvl_warning,"interpolate %s-%s %s\n",inter->first,inter->last,inter->curr);
if (!inter->first || !inter->last)
return NULL;
if (!inter->curr)
@@ -97,7 +97,7 @@ search_next_house_number_curr_interpol_with_ends(struct house_number_interpolati
inter->curr=NULL;
}
}
- dbg(1,"interpolate result %s\n",inter->curr);
+ dbg(lvl_warning,"interpolate result %s\n",inter->curr);
return inter->curr;
}
@@ -141,7 +141,7 @@ search_house_number_interpolation_split(char *str, struct house_number_interpola
strncpy(first, str, len);
first[len]='\0';
last=g_strdup(pos+1);
- dbg(1,"%s = %s - %s\n",str, first, last);
+ dbg(lvl_warning,"%s = %s - %s\n",str, first, last);
if (atoi(first) > atoi(last)) {
inter->first=last;
inter->last=first;
@@ -158,7 +158,7 @@ search_house_number_coordinate(struct item *item, struct house_number_interpolat
{
struct pcoord *ret=g_new(struct pcoord, 1);
ret->pro = map_projection(item->map);
- dbg(1,"%s\n",item_to_name(item->type));
+ dbg(lvl_warning,"%s\n",item_to_name(item->type));
if (!inter) {
struct coord c;
if (item_coord_get(item, &c, 1)) {
@@ -183,29 +183,29 @@ search_house_number_coordinate(struct item *item, struct house_number_interpolat
if (count) {
int i,distance_sum=0,hn_distance;
int *distances=g_alloca(sizeof(int)*(count-1));
- dbg(1,"count=%d hn_length=%d hn_pos=%d (%s of %s-%s)\n",count,hn_length,hn_pos,inter->curr,inter->first,inter->last);
+ dbg(lvl_warning,"count=%d hn_length=%d hn_pos=%d (%s of %s-%s)\n",count,hn_length,hn_pos,inter->curr,inter->first,inter->last);
if (!hn_length) {
hn_length=2;
hn_pos=1;
}
if (count == max)
- dbg(0,"coordinate overflow\n");
+ dbg(lvl_error,"coordinate overflow\n");
for (i = 0 ; i < count-1 ; i++) {
distances[i]=navit_sqrt(transform_distance_sq(&c[i],&c[i+1]));
distance_sum+=distances[i];
- dbg(1,"distance[%d]=%d\n",i,distances[i]);
+ dbg(lvl_warning,"distance[%d]=%d\n",i,distances[i]);
}
- dbg(1,"sum=%d\n",distance_sum);
+ dbg(lvl_warning,"sum=%d\n",distance_sum);
#if 0
hn_distance=distance_sum*hn_pos/hn_length;
#else
hn_distance=(distance_sum*hn_pos+distance_sum*inter_increment/2)/(hn_length+inter_increment);
#endif
- dbg(1,"hn_distance=%d\n",hn_distance);
+ dbg(lvl_warning,"hn_distance=%d\n",hn_distance);
i=0;
while (i < count-1 && hn_distance > distances[i])
hn_distance-=distances[i++];
- dbg(1,"remaining distance=%d from %d\n",hn_distance,distances[i]);
+ dbg(lvl_warning,"remaining distance=%d from %d\n",hn_distance,distances[i]);
ret->x=(c[i+1].x-c[i].x)*hn_distance/distances[i]+c[i].x;
ret->y=(c[i+1].y-c[i].y)*hn_distance/distances[i]+c[i].y;
}
diff --git a/navit/speech.c b/navit/speech.c
index 8b03f3c4b..159203b87 100644
--- a/navit/speech.c
+++ b/navit/speech.c
@@ -41,25 +41,25 @@ speech_new(struct attr *parent, struct attr **attrs)
attr=attr_search(attrs, NULL, attr_type);
if (! attr) {
- dbg(0,"type missing\n");
+ dbg(lvl_error,"type missing\n");
return NULL;
}
- dbg(1,"type='%s'\n", attr->u.str);
+ dbg(lvl_warning,"type='%s'\n", attr->u.str);
speech_new=plugin_get_speech_type(attr->u.str);
- dbg(1,"new=%p\n", speech_new);
+ dbg(lvl_warning,"new=%p\n", speech_new);
if (! speech_new) {
- dbg(0,"wrong type '%s'\n", attr->u.str);
+ dbg(lvl_error,"wrong type '%s'\n", attr->u.str);
return NULL;
}
this_=(struct speech *)navit_object_new(attrs, &speech_func, sizeof(struct speech));
this_->priv=speech_new(&this_->meth, this_->attrs, parent);
- dbg(1, "say=%p\n", this_->meth.say);
- dbg(1,"priv=%p\n", this_->priv);
+ dbg(lvl_warning, "say=%p\n", this_->meth.say);
+ dbg(lvl_warning,"priv=%p\n", this_->priv);
if (! this_->priv) {
speech_destroy(this_);
return NULL;
}
- dbg(1,"return %p\n", this_);
+ dbg(lvl_warning,"return %p\n", this_);
return this_;
}
@@ -75,7 +75,7 @@ speech_destroy(struct speech *this_)
int
speech_say(struct speech *this_, const char *text)
{
- dbg(1, "this_=%p text='%s' calling %p\n", this_, text, this_->meth.say);
+ dbg(lvl_warning, "this_=%p text='%s' calling %p\n", this_, text, this_->meth.say);
return (this_->meth.say)(this_->priv, text);
}
diff --git a/navit/speech/android/speech_android.c b/navit/speech/android/speech_android.c
index 86c9894fa..e5a7f6130 100644
--- a/navit/speech/android/speech_android.c
+++ b/navit/speech/android/speech_android.c
@@ -73,7 +73,7 @@ speech_android_say(struct speech_priv *this, const char *text)
}
}
string = (*jnienv)->NewStringUTF(jnienv, str);
- dbg(0,"enter %s\n",str);
+ dbg(lvl_error,"enter %s\n",str);
(*jnienv)->CallVoidMethod(jnienv, this->NavitSpeech, this->NavitSpeech_say, string);
(*jnienv)->DeleteLocalRef(jnienv, string);
g_free(str);
@@ -101,20 +101,20 @@ speech_android_init(struct speech_priv *ret)
class="org/navitproject/navit/NavitSpeech";
if (!android_find_class_global(class, &ret->NavitSpeechClass)) {
- dbg(0,"No class found\n");
+ dbg(lvl_error,"No class found\n");
return 0;
}
- dbg(0,"at 3\n");
+ dbg(lvl_error,"at 3\n");
cid = (*jnienv)->GetMethodID(jnienv, ret->NavitSpeechClass, "<init>", "(Lorg/navitproject/navit/Navit;)V");
if (cid == NULL) {
- dbg(0,"no method found\n");
+ dbg(lvl_error,"no method found\n");
return 0; /* exception thrown */
}
if (!android_find_method(ret->NavitSpeechClass, "say", "(Ljava/lang/String;)V", &ret->NavitSpeech_say))
return 0;
- dbg(0,"at 4 android_activity=%p\n",android_activity);
+ dbg(lvl_error,"at 4 android_activity=%p\n",android_activity);
ret->NavitSpeech=(*jnienv)->NewObject(jnienv, ret->NavitSpeechClass, cid, android_activity);
- dbg(0,"result=%p\n",ret->NavitSpeech);
+ dbg(lvl_error,"result=%p\n",ret->NavitSpeech);
if (!ret->NavitSpeech)
return 0;
if (ret->NavitSpeech)
@@ -131,7 +131,7 @@ speech_android_new(struct speech_methods *meth, struct attr **attrs, struct attr
if (android_version < 4)
this->flags=3;
if (!speech_android_init(this)) {
- dbg(0,"Failed to init speech %p\n",this->NavitSpeechClass);
+ dbg(lvl_error,"Failed to init speech %p\n",this->NavitSpeechClass);
g_free(this);
this=NULL;
}
diff --git a/navit/speech/cmdline/speech_cmdline.c b/navit/speech/cmdline/speech_cmdline.c
index 1eb39d0a5..9a334d020 100644
--- a/navit/speech/cmdline/speech_cmdline.c
+++ b/navit/speech/cmdline/speech_cmdline.c
@@ -63,7 +63,7 @@ speech_cmdline_search(GList *samples, int suffix_len, const char *text, int deco
{
GList *loop_samples=samples,*result=NULL,*recursion_result;
int shortest_result_length=INT_MAX;
- dbg(1,"searching samples for text: '%s'\n",text);
+ dbg(lvl_warning,"searching samples for text: '%s'\n",text);
while (loop_samples) {
char *sample_name=loop_samples->data;
int sample_name_len;
@@ -77,7 +77,7 @@ speech_cmdline_search(GList *samples, int suffix_len, const char *text, int deco
const char *remaining_text=text+sample_name_len;
while (*remaining_text == ' ' || *remaining_text == ',')
remaining_text++;
- dbg(1,"sample '%s' matched; remaining text: '%s'\n",sample_name,remaining_text);
+ dbg(lvl_warning,"sample '%s' matched; remaining text: '%s'\n",sample_name,remaining_text);
if (*remaining_text) {
recursion_result=speech_cmdline_search(samples, suffix_len, remaining_text, decode);
if (recursion_result && g_list_length(recursion_result) < shortest_result_length) {
@@ -86,7 +86,7 @@ speech_cmdline_search(GList *samples, int suffix_len, const char *text, int deco
result=g_list_prepend(result, loop_samples->data);
shortest_result_length=g_list_length(result);
} else {
- dbg(1,"no (shorter) result found for remaining text '%s', "
+ dbg(lvl_warning,"no (shorter) result found for remaining text '%s', "
"trying next sample\n", remaining_text);
g_list_free(recursion_result);
}
@@ -141,15 +141,15 @@ speechd_say(struct speech_priv *this, const char *text)
argl=speech_cmdline_search(this->samples, strlen(this->sample_suffix), text, !!(this->flags & 1));
samplesmode=1;
listlen=g_list_length(argl);
- dbg(1,"For text: '%s', found %d samples.\n",text,listlen);
+ dbg(lvl_warning,"For text: '%s', found %d samples.\n",text,listlen);
if (!listlen){
- dbg(0,"No matching samples found. Cannot speak text: '%s'\n",text);
+ dbg(lvl_error,"No matching samples found. Cannot speak text: '%s'\n",text);
}
} else {
listlen=1;
}
if(listlen>0) {
- dbg(1,"Speaking text '%s'\n",text);
+ dbg(lvl_warning,"Speaking text '%s'\n",text);
int argc;
char**argv;
int j;
@@ -168,7 +168,7 @@ speechd_say(struct speech_priv *this, const char *text)
while(l) {
char *new_arg;
new_arg=g_strdup_printf("%s/%s",this->sample_dir,(char *)l->data);
- dbg(1,"new_arg %s\n",new_arg);
+ dbg(lvl_warning,"new_arg %s\n",new_arg);
argv[j++]=g_strdup_printf(cmdv[i],new_arg);
g_free(new_arg);
l=g_list_next(l);
@@ -242,7 +242,7 @@ speechd_new(struct speech_methods *meth, struct attr **attrs, struct attr *paren
int len=strlen(name);
if (len > suffix_len) {
if (!strcmp(name+len-suffix_len, this->sample_suffix)) {
- dbg(1,"found %s\n",name);
+ dbg(lvl_warning,"found %s\n",name);
this->samples=g_list_prepend(this->samples, g_strdup(name));
}
}
diff --git a/navit/speech/espeak/speak.c b/navit/speech/espeak/speak.c
index 18edd8cd9..58813590a 100644
--- a/navit/speech/espeak/speak.c
+++ b/navit/speech/espeak/speak.c
@@ -166,11 +166,11 @@ static BOOL initialise(void)
{
if(result == -1)
{
- dbg(0, "Failed to load espeak-data\n");
+ dbg(lvl_error, "Failed to load espeak-data\n");
return FALSE;
}
else
- dbg(0, "Wrong version of espeak-data 0x%x (expects 0x%x) at %s\n",result,version_phdata,path_home);
+ dbg(lvl_error, "Wrong version of espeak-data 0x%x (expects 0x%x) at %s\n",result,version_phdata,path_home);
}
LoadConfig();
SetVoiceStack(NULL);
@@ -214,7 +214,7 @@ static void start_speaking(struct speech_priv* sp_priv)
static LRESULT CALLBACK speech_message_handler( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
- dbg(1, "message_handler called\n");
+ dbg(lvl_warning, "message_handler called\n");
switch (uMsg)
{
@@ -234,7 +234,7 @@ static LRESULT CALLBACK speech_message_handler( HWND hwnd, UINT uMsg, WPARAM wPa
{
WAVEHDR *WaveHeader = (WAVEHDR *)lParam;
struct speech_priv* sp_priv;
- dbg(2, "Wave buffer done\n");
+ dbg(lvl_info, "Wave buffer done\n");
sp_priv = (struct speech_priv*)WaveHeader->dwUser;
sp_priv->free_buffers = g_list_append(sp_priv->free_buffers, WaveHeader);
@@ -282,7 +282,7 @@ static void speech_message_dispatcher( struct speech_priv * sp_priv)
{
if (bRet == -1)
{
- dbg(0, "Error getting message from queue\n");
+ dbg(lvl_error, "Error getting message from queue\n");
break;
}
else
@@ -336,7 +336,7 @@ static DWORD startThread( LPVOID sp_priv)
if (!RegisterClass(&wc))
{
- dbg(0, "Window registration for message queue failed\n");
+ dbg(lvl_error, "Window registration for message queue failed\n");
return 1;
}
@@ -361,7 +361,7 @@ static DWORD startThread( LPVOID sp_priv)
if (hwnd == NULL)
{
- dbg(0, "Window creation failed: %d\n", GetLastError());
+ dbg(lvl_error, "Window creation failed: %d\n", GetLastError());
return 1;
}
@@ -371,7 +371,7 @@ static DWORD startThread( LPVOID sp_priv)
if(!waveout_open(this))
{
- dbg(0, "Can't open wave output\n");
+ dbg(lvl_error, "Can't open wave output\n");
return 1;
}
@@ -387,11 +387,11 @@ static int
espeak_say(struct speech_priv *this, const char *text)
{
char *phrase = g_strdup(text);
- dbg(1, "Speak: '%s'\n", text);
+ dbg(lvl_warning, "Speak: '%s'\n", text);
if (!PostMessage(this->h_queue, msg_say, (WPARAM)this, (LPARAM)phrase))
{
- dbg(0, "PostThreadMessage 'say' failed\n");
+ dbg(lvl_error, "PostThreadMessage 'say' failed\n");
}
return 0;
@@ -440,7 +440,7 @@ espeak_new(struct speech_methods *meth, struct attr **attrs, struct attr *parent
strcpy(path_home,path->u.str);
else
sprintf(path_home,"%s/espeak-data",getenv("NAVIT_SHAREDIR"));
- dbg(0,"path_home set to %s\n",path_home);
+ dbg(lvl_error,"path_home set to %s\n",path_home);
if ( !initialise() )
{
@@ -467,12 +467,12 @@ espeak_new(struct speech_methods *meth, struct attr **attrs, struct attr *parent
}
file1=g_strdup_printf("%s/voices/%s",path_home,lang_full);
file2=g_strdup_printf("%s/voices/%s/%s",path_home,lang,lang_full);
- dbg(0,"Testing %s and %s\n",file1,file2);
+ dbg(lvl_error,"Testing %s and %s\n",file1,file2);
if (file_exists(file1) || file_exists(file2))
lang_str=g_strdup(lang_full);
else
lang_str=g_strdup(lang);
- dbg(0,"Language full %s lang %s result %s\n",lang_full,lang,lang_str);
+ dbg(lvl_error,"Language full %s lang %s result %s\n",lang_full,lang,lang_str);
g_free(lang_full);
g_free(lang);
g_free(file1);
@@ -481,12 +481,12 @@ espeak_new(struct speech_methods *meth, struct attr **attrs, struct attr *parent
}
if(lang_str && SetVoiceByName(lang_str) != EE_OK)
{
- dbg(0, "Error setting language to: '%s',falling back to default\n", lang_str);
+ dbg(lvl_error, "Error setting language to: '%s',falling back to default\n", lang_str);
g_free(lang_str);
lang_str=NULL;
}
if(!lang_str && SetVoiceByName("default") != EE_OK) {
- dbg(0, "Error setting language to default\n");
+ dbg(lvl_error, "Error setting language to default\n");
}
diff --git a/navit/start_real.c b/navit/start_real.c
index 8abd0bbd1..66958410c 100644
--- a/navit/start_real.c
+++ b/navit/start_real.c
@@ -184,12 +184,12 @@ int main_real(int argc, char * const* argv)
for (;;) {
if (li == NULL) {
// We have not found an existing config file from all possibilities
- dbg(0, "%s", _("No config file navit.xml, navit.xml.local found\n"));
+ dbg(lvl_error, "%s", _("No config file navit.xml, navit.xml.local found\n"));
return 4;
}
// Try the next config file possibility from the list
config_file = li->data;
- dbg(1,"trying %s\n",config_file);
+ dbg(lvl_warning,"trying %s\n",config_file);
if (file_exists(config_file)) {
break;
}
@@ -197,14 +197,14 @@ int main_real(int argc, char * const* argv)
li = g_list_next(li);
}
- dbg(0,"Loading %s\n",config_file);
+ dbg(lvl_error,"Loading %s\n",config_file);
if (!config_load(config_file, &error)) {
- dbg(0, _("Error parsing config file '%s': %s\n"), config_file, error ? error->message : "");
+ dbg(lvl_error, _("Error parsing config file '%s': %s\n"), config_file, error ? error->message : "");
} else {
- dbg(0, _("Using config file '%s'\n"), config_file);
+ dbg(lvl_error, _("Using config file '%s'\n"), config_file);
}
if (! config) {
- dbg(0, _("Error: No configuration found in config file '%s'\n"), config_file);
+ dbg(lvl_error, _("Error: No configuration found in config file '%s'\n"), config_file);
}
while (li) {
g_free(li->data);
@@ -212,7 +212,7 @@ int main_real(int argc, char * const* argv)
}
g_list_free(list);
if (! (config && config_get_attr(config, attr_navit, &navit, NULL))) {
- dbg(0, "%s", _("Internal initialization failed, exiting. Check previous error messages.\n"));
+ dbg(lvl_error, "%s", _("Internal initialization failed, exiting. Check previous error messages.\n"));
exit(5);
}
conf.type=attr_config;
diff --git a/navit/support/libc/stat.c b/navit/support/libc/stat.c
index e6ed452e0..393b9f7cf 100644
--- a/navit/support/libc/stat.c
+++ b/navit/support/libc/stat.c
@@ -120,13 +120,13 @@ _stat (const char *path, struct _stat *st)
size_t len;
int exec;
- dbg(0,"path=%s\n",path);
+ dbg(lvl_error,"path=%s\n",path);
mbstowcs (pathw, path, MAX_PATH);
- dbg(0,"wide path=%S\n",pathw);
+ dbg(lvl_error,"wide path=%S\n",pathw);
if((h = FindFirstFileW (pathw, &fd)) == INVALID_HANDLE_VALUE)
{
DWORD dwError = GetLastError ();
- dbg(0,"no file\n");
+ dbg(lvl_error,"no file\n");
if(dwError == ERROR_NO_MORE_FILES)
/* Convert error to something more sensible. */
SetLastError (ERROR_FILE_NOT_FOUND);
@@ -139,7 +139,7 @@ _stat (const char *path, struct _stat *st)
exec = (len >= 4
&& strcasecmp (path + len - 4, ".exe") == 0);
ret = __stat_by_file_info (&sfi, st, exec);
- dbg(0,"ret=%d\n",ret);
+ dbg(lvl_error,"ret=%d\n",ret);
FindClose (h);
return ret;
}
diff --git a/navit/support/win32/serial_io.c b/navit/support/win32/serial_io.c
index 33ca5fe68..c2461949b 100644
--- a/navit/support/win32/serial_io.c
+++ b/navit/support/win32/serial_io.c
@@ -51,7 +51,7 @@ int serial_io_init( const char* port, const char* strsettings )
0,
NULL
);
- dbg(1, "return (fd) : '-1' : serial_io_init error : '%s'\n", lpMsgBuf);
+ dbg(lvl_warning, "return (fd) : '-1' : serial_io_init error : '%s'\n", lpMsgBuf);
LocalFree( lpMsgBuf ); // Free the buffer.
return -1;
@@ -72,7 +72,7 @@ int serial_io_init( const char* port, const char* strsettings )
SetCommTimeouts(hCom, &sCT);
- dbg(1, "serial_io_init return (fd) : '%d'\n", (int)hCom);
+ dbg(lvl_warning, "serial_io_init return (fd) : '%d'\n", (int)hCom);
return (int)hCom;
}
@@ -94,12 +94,12 @@ int serial_io_init( const char* port, const char* strsettings )
int serial_io_read( int fd, char * buffer, int buffer_size )
{
DWORD dwBytesIn = 0;
- dbg(1, "serial_io_read fd = %d buffer_size = %d\n", fd, buffer_size);
+ dbg(lvl_warning, "serial_io_read fd = %d buffer_size = %d\n", fd, buffer_size);
if (fd <= 0)
{
- dbg(0, "serial_io_read return (dwBytesIn) : '0'\n");
+ dbg(lvl_error, "serial_io_read return (dwBytesIn) : '0'\n");
*buffer = 0;
return 0;
}
@@ -117,11 +117,11 @@ int serial_io_read( int fd, char * buffer, int buffer_size )
}
if (dwBytesIn > 0)
{
- dbg(1,"GPS < %s\n",buffer );
+ dbg(lvl_warning,"GPS < %s\n",buffer );
}
buffer[buffer_size - 1] = 0;
- dbg(2, "serial_io_read return (dwBytesIn) : '%d'\n", dwBytesIn);
+ dbg(lvl_info, "serial_io_read return (dwBytesIn) : '%d'\n", dwBytesIn);
return dwBytesIn;
}
@@ -139,7 +139,7 @@ int serial_io_read( int fd, char * buffer, int buffer_size )
int serial_io_write(int fd, const char * buffer)
{
DWORD dwBytesOut = 0;
- dbg(1, "serial_io_write fd = %d buffer = '%s'\n",fd, buffer);
+ dbg(lvl_warning, "serial_io_write fd = %d buffer = '%s'\n",fd, buffer);
WriteFile((HANDLE)fd, buffer, strlen(buffer), &dwBytesOut, NULL);
@@ -157,7 +157,7 @@ int serial_io_write(int fd, const char * buffer)
**/
void serial_io_shutdown(int fd )
{
- dbg(1, "serial_io_shutdown fd = %d\n",fd);
+ dbg(lvl_warning, "serial_io_shutdown fd = %d\n",fd);
if (fd > 0)
{
diff --git a/navit/support/wordexp/glob.c b/navit/support/wordexp/glob.c
index 6c935f447..d6282c4a5 100644
--- a/navit/support/wordexp/glob.c
+++ b/navit/support/wordexp/glob.c
@@ -130,7 +130,7 @@ glob_recursive(const char *path1, const char *path2, const char *pattern, int fl
strcat(path, "/");
strcat(path, path2);
if (!strlen(pattern)) {
- dbg(1,"found %s\n",path);
+ dbg(lvl_warning,"found %s\n",path);
pglob->gl_pathv=realloc(pglob->gl_pathv, (pglob->gl_pathc+1)*sizeof(char *));
if (!pglob->gl_pathv) {
pglob->gl_pathc=0;
@@ -139,7 +139,7 @@ glob_recursive(const char *path1, const char *path2, const char *pattern, int fl
pglob->gl_pathv[pglob->gl_pathc++]=path;
return 0;
}
- dbg(1,"searching for %s in %s\n",pattern,path);
+ dbg(lvl_warning,"searching for %s in %s\n",pattern,path);
flen=strcspn(pattern,"/");
next=pattern+flen;
if (*next == '/')
@@ -150,7 +150,7 @@ glob_recursive(const char *path1, const char *path2, const char *pattern, int fl
if (glob_requires_match(fname, 0)) {
DIR *dh;
struct dirent *de;
- dbg(1,"in dir %s search for %s\n",path,fname);
+ dbg(lvl_warning,"in dir %s search for %s\n",path,fname);
dh=opendir(path);
if (dh) {
while ((de=readdir(dh))) {
diff --git a/navit/track.c b/navit/track.c
index 4a6a28524..7b73f29fb 100644
--- a/navit/track.c
+++ b/navit/track.c
@@ -155,7 +155,7 @@ tracking_process_cdf(struct cdf_data *cdf, struct pcoord *pin, struct pcoord *po
int speed_num,i;
if (cdf->hist_size == 0) {
- dbg(1,"No CDF.\n");
+ dbg(lvl_warning,"No CDF.\n");
*pout = *pin;
*dirout = dirin;
return;
@@ -338,7 +338,7 @@ tracking_get_attr(struct tracking *_this, enum attr_type type, struct attr *attr
struct tracking_line *tl;
int result=0;
- dbg(1,"enter %s\n",attr_to_name(type));
+ dbg(lvl_warning,"enter %s\n",attr_to_name(type));
if (_this->attr) {
attr_free(_this->attr);
_this->attr=NULL;
@@ -471,7 +471,7 @@ tracking_doupdate_lines(struct tracking *tr, struct coord *pc, enum projection p
struct coord_geo g;
struct coord cc;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
h=mapset_open(tr->ms);
while ((m=mapset_next(h,2))) {
cc.x = pc->x;
@@ -501,7 +501,7 @@ tracking_doupdate_lines(struct tracking *tr, struct coord *pc, enum projection p
map_rect_destroy(mr);
}
mapset_close(h);
- dbg(1, "exit\n");
+ dbg(lvl_warning, "exit\n");
}
@@ -509,7 +509,7 @@ void
tracking_flush(struct tracking *tr)
{
struct tracking_line *tl=tr->lines,*next;
- dbg(1,"enter(tr=%p)\n", tr);
+ dbg(lvl_warning,"enter(tr=%p)\n", tr);
while (tl) {
next=tl->next;
@@ -603,7 +603,7 @@ tracking_value(struct tracking *tr, struct tracking_line *t, int offset, struct
{
int value=0;
struct street_data *sd=t->street;
- dbg(2, "%d: (0x%x,0x%x)-(0x%x,0x%x)\n", offset, sd->c[offset].x, sd->c[offset].y, sd->c[offset+1].x, sd->c[offset+1].y);
+ dbg(lvl_info, "%d: (0x%x,0x%x)-(0x%x,0x%x)\n", offset, sd->c[offset].x, sd->c[offset].y, sd->c[offset+1].x, sd->c[offset+1].y);
if (flags & 1) {
struct coord c1, c2, cp;
c1.x = sd->c[offset].x;
@@ -665,7 +665,7 @@ tracking_update(struct tracking *tr, struct vehicle *v, struct vehicleprofile *v
!vehicle_get_attr(tr->vehicle, attr_position_direction, &direction_attr, NULL) ||
!vehicle_get_attr(tr->vehicle, attr_position_coord_geo, &coord_geo, NULL) ||
!vehicle_get_attr(tr->vehicle, attr_position_time_iso8601, &time_attr, NULL)) {
- dbg(0,"failed to get position data %d %d %d %d\n",
+ dbg(lvl_error,"failed to get position data %d %d %d %d\n",
vehicle_get_attr(tr->vehicle, attr_position_speed, &speed_attr, NULL),
vehicle_get_attr(tr->vehicle, attr_position_direction, &direction_attr, NULL),
vehicle_get_attr(tr->vehicle, attr_position_coord_geo, &coord_geo, NULL),
@@ -685,45 +685,45 @@ tracking_update(struct tracking *tr, struct vehicle *v, struct vehicleprofile *v
if (!vehicleprofile_get_attr(vehicleprofile,attr_static_speed,&static_speed,NULL) || !vehicleprofile_get_attr(vehicleprofile,attr_static_distance,&static_distance,NULL)) {
static_speed.u.num=3;
static_distance.u.num=10;
- dbg(1,"Using defaults for static position detection\n");
+ dbg(lvl_warning,"Using defaults for static position detection\n");
}
- dbg(2,"Static speed: %ld, static distance: %ld\n",static_speed.u.num, static_distance.u.num);
+ dbg(lvl_info,"Static speed: %ld, static distance: %ld\n",static_speed.u.num, static_distance.u.num);
time=iso8601_to_secs(time_attr.u.str);
speed=*speed_attr.u.numd;
direction=*direction_attr.u.numd;
tr->valid=attr_position_valid_valid;
transform_from_geo(pro, coord_geo.u.coord_geo, &tr->curr_in);
if ((speed < static_speed.u.num && transform_distance(pro, &tr->last_in, &tr->curr_in) < static_distance.u.num )) {
- dbg(1,"static speed %f coord 0x%x,0x%x vs 0x%x,0x%x\n",speed,tr->last_in.x,tr->last_in.y, tr->curr_in.x, tr->curr_in.y);
+ dbg(lvl_warning,"static speed %f coord 0x%x,0x%x vs 0x%x,0x%x\n",speed,tr->last_in.x,tr->last_in.y, tr->curr_in.x, tr->curr_in.y);
tr->valid=attr_position_valid_static;
tr->speed=0;
return;
}
if (tr->tunnel) {
tr->curr_in=tr->curr_out;
- dbg(0,"tunnel extrapolation speed %f dir %f\n",tr->speed,tr->direction);
- dbg(0,"old 0x%x,0x%x\n",tr->curr_in.x, tr->curr_in.y);
+ dbg(lvl_error,"tunnel extrapolation speed %f dir %f\n",tr->speed,tr->direction);
+ dbg(lvl_error,"old 0x%x,0x%x\n",tr->curr_in.x, tr->curr_in.y);
speed=tr->speed;
direction=tr->curr_line->angle[tr->pos];
transform_project(pro, &tr->curr_in, tr->speed*tr->tunnel_extrapolation/36, tr->direction, &tr->curr_in);
- dbg(0,"new 0x%x,0x%x\n",tr->curr_in.x, tr->curr_in.y);
+ dbg(lvl_error,"new 0x%x,0x%x\n",tr->curr_in.x, tr->curr_in.y);
} else if (vehicle_get_attr(tr->vehicle, attr_lag, &lag, NULL) && lag.u.num > 0) {
double espeed;
int edirection;
if (time-tr->time == 1) {
- dbg(1,"extrapolating speed from %f and %f (%f)\n",tr->speed, speed, speed-tr->speed);
+ dbg(lvl_warning,"extrapolating speed from %f and %f (%f)\n",tr->speed, speed, speed-tr->speed);
espeed=speed+(speed-tr->speed)*lag.u.num/10;
- dbg(1,"extrapolating angle from %f and %f (%d)\n",tr->direction, direction, tracking_angle_diff(direction,tr->direction,360));
+ dbg(lvl_warning,"extrapolating angle from %f and %f (%d)\n",tr->direction, direction, tracking_angle_diff(direction,tr->direction,360));
edirection=direction+tracking_angle_diff(direction,tr->direction,360)*lag.u.num/10;
} else {
- dbg(1,"no speed and direction extrapolation\n");
+ dbg(lvl_warning,"no speed and direction extrapolation\n");
espeed=speed;
edirection=direction;
}
- dbg(1,"lag %ld speed %f direction %d\n",lag.u.num,espeed,edirection);
- dbg(1,"old 0x%x,0x%x\n",tr->curr_in.x, tr->curr_in.y);
+ dbg(lvl_warning,"lag %ld speed %f direction %d\n",lag.u.num,espeed,edirection);
+ dbg(lvl_warning,"old 0x%x,0x%x\n",tr->curr_in.x, tr->curr_in.y);
transform_project(pro, &tr->curr_in, espeed*lag.u.num/36, edirection, &tr->curr_in);
- dbg(1,"new 0x%x,0x%x\n",tr->curr_in.x, tr->curr_in.y);
+ dbg(lvl_warning,"new 0x%x,0x%x\n",tr->curr_in.x, tr->curr_in.y);
}
tr->time=time;
tr->pro=pro;
@@ -738,11 +738,11 @@ tracking_update(struct tracking *tr, struct vehicle *v, struct vehicleprofile *v
tr->last[0]=tr->curr[0];
tr->last[1]=tr->curr[1];
if (!tr->lines || transform_distance(pro, &tr->last_updated, &tr->curr_in) > 500) {
- dbg(1, "update\n");
+ dbg(lvl_warning, "update\n");
tracking_flush(tr);
tracking_doupdate_lines(tr, &tr->curr_in, pro);
tr->last_updated=tr->curr_in;
- dbg(1,"update end\n");
+ dbg(lvl_warning,"update end\n");
}
tr->street_direction=0;
@@ -761,7 +761,7 @@ tracking_update(struct tracking *tr, struct vehicle *v, struct vehicleprofile *v
tr->curr[0]=sd->c[i];
tr->curr[1]=sd->c[i+1];
tr->direction_matched=t->angle[i];
- dbg(1,"lpnt.x=0x%x,lpnt.y=0x%x pos=%d %d+%d+%d+%d=%d\n", lpnt.x, lpnt.y, i,
+ dbg(lvl_warning,"lpnt.x=0x%x,lpnt.y=0x%x pos=%d %d+%d+%d+%d=%d\n", lpnt.x, lpnt.y, i,
transform_distance_line_sq(&sd->c[i], &sd->c[i+1], &cin, &lpnt_tmp),
tracking_angle_delta(tr, tr->curr_angle, t->angle[i], 0)*tr->angle_pref,
tracking_is_connected(tr, tr->last, &sd->c[i]) ? tr->connected_pref : 0,
@@ -782,7 +782,7 @@ tracking_update(struct tracking *tr, struct vehicle *v, struct vehicleprofile *v
}
t=t->next;
}
- dbg(1,"tr->curr_line=%p min=%d\n", tr->curr_line, min);
+ dbg(lvl_warning,"tr->curr_line=%p min=%d\n", tr->curr_line, min);
if (!tr->curr_line || min > tr->offroad_limit_pref) {
tr->curr_out=tr->curr_in;
tr->coord_geo_valid=0;
@@ -794,7 +794,7 @@ tracking_update(struct tracking *tr, struct vehicle *v, struct vehicleprofile *v
} else if (tr->tunnel) {
tr->speed=0;
}
- dbg(1,"found 0x%x,0x%x\n", tr->curr_out.x, tr->curr_out.y);
+ dbg(lvl_warning,"found 0x%x,0x%x\n", tr->curr_out.x, tr->curr_out.y);
callback_list_call_attr_0(tr->callback_list, attr_position_coord_geo);
}
@@ -981,7 +981,7 @@ tracking_map_item_coord_get(void *priv_data, struct coord *c, int count)
struct map_rect_priv *this=priv_data;
enum projection pro;
int ret=0;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
while (this->ccount < 2 && count > 0) {
pro = map_projection(this->curr->street->item.map);
if (projection_mg != pro) {
@@ -990,7 +990,7 @@ tracking_map_item_coord_get(void *priv_data, struct coord *c, int count)
c ,projection_mg);
} else
*c=this->curr->street->c[this->ccount+this->coord];
- dbg(1,"coord %d 0x%x,0x%x\n",this->ccount,c->x,c->y);
+ dbg(lvl_warning,"coord %d 0x%x,0x%x\n",this->ccount,c->x,c->y);
this->ccount++;
ret++;
c++;
@@ -1168,7 +1168,7 @@ tracking_map_get_item(struct map_rect_priv *priv)
priv->item.type=type_tracking_10;
else
priv->item.type=type_tracking_0;
- dbg(1,"item %d %d points\n", priv->coord, priv->curr->street->count);
+ dbg(lvl_warning,"item %d %d points\n", priv->coord, priv->curr->street->count);
tracking_map_item_coord_rewind(priv);
tracking_map_item_attr_rewind(priv);
return ret;
diff --git a/navit/transform.c b/navit/transform.c
index 07eb6404a..a266b9e09 100644
--- a/navit/transform.c
+++ b/navit/transform.c
@@ -104,7 +104,7 @@ transform_setup_matrix(struct transformation *t)
int scale=t->scale;
int order_dir=-1;
- dbg(1,"yaw=%d pitch=%d center=0x%x,0x%x\n", t->yaw, t->pitch, t->map_center.x, t->map_center.y);
+ dbg(lvl_warning,"yaw=%d pitch=%d center=0x%x,0x%x\n", t->yaw, t->pitch, t->map_center.x, t->map_center.y);
t->znear=1 << POST_SHIFT;
t->zfar=300*t->znear;
t->scale_shift=0;
@@ -122,7 +122,7 @@ transform_setup_matrix(struct transformation *t)
scale >>= 1;
}
fac=(1 << POST_SHIFT) * (1 << t->scale_shift) / t->scale;
- dbg(1,"scale_shift=%d order=%d scale=%f fac=%f\n", t->scale_shift, t->order,t->scale,fac);
+ dbg(lvl_warning,"scale_shift=%d order=%d scale=%f fac=%f\n", t->scale_shift, t->order,t->scale,fac);
t->m00=rollc*yawc*fac;
t->m01=rollc*yaws*fac;
@@ -139,7 +139,7 @@ transform_setup_matrix(struct transformation *t)
if (t->pitch) {
t->ddd=1;
t->offz=t->screen_dist;
- dbg(1,"near %d far %d\n",t->znear,t->zfar);
+ dbg(lvl_warning,"near %d far %d\n",t->znear,t->zfar);
t->xscale=t->xscale3d;
t->yscale=t->yscale3d;
t->wscale=t->wscale3d;
@@ -196,7 +196,7 @@ transform_set_hog(struct transformation *this_, int hog)
#ifdef ENABLE_ROLL
this_->hog=hog;
#else
- dbg(0,"not supported\n");
+ dbg(lvl_error,"not supported\n");
#endif
}
@@ -451,7 +451,7 @@ transform_rotate(struct transformation *t, struct coord c)
result.y=c.x*t->m10+c.y*t->m11+HOG(*t)*t->m12;
result.z=(c.x*t->m20+c.y*t->m21+HOG(*t)*t->m22);
result.z+=t->offz << POST_SHIFT;
- dbg(3, "result: (%d,%d,%d)\n", result.x,result.y,result.z);
+ dbg(lvl_debug, "result: (%d,%d,%d)\n", result.x,result.y,result.z);
return result;
}
@@ -460,11 +460,11 @@ transform_z_clip(struct coord_3d c, struct coord_3d c_old, int zlimit)
{
struct coord_3d result;
float clip_factor = ((float)zlimit-c.z)/(c_old.z-c.z);
- dbg(3,"in (%d,%d,%d) - (%d,%d,%d)\n", c.x,c.y,c.z, c_old.x,c_old.y,c_old.z);
+ dbg(lvl_debug,"in (%d,%d,%d) - (%d,%d,%d)\n", c.x,c.y,c.z, c_old.x,c_old.y,c_old.z);
result.x=c.x+(c_old.x-c.x)*clip_factor;
result.y=c.y+(c_old.y-c.y)*clip_factor;
result.z=zlimit;
- dbg(3,"clip result: (%d,%d,%d)\n", result.x, result.y, result.z);
+ dbg(lvl_debug,"clip result: (%d,%d,%d)\n", result.x, result.y, result.z);
return result;
}
@@ -473,7 +473,7 @@ transform_project_onto_view_plane(struct transformation *t, struct coord_3d c)
{
struct point result;
#if 0
- dbg(0,"z=%d\n",c.z);
+ dbg(lvl_error,"z=%d\n",c.z);
#endif
result.x = (long long)c.x*t->xscale/c.z;
result.y = (long long)c.y*t->yscale/c.z;
@@ -530,9 +530,9 @@ transform(struct transformation *t, enum projection required_projection, struct
int zlimit=t->znear;
struct z_clip_result clip_result, clip_result_old={{0,0}, -1, 0, 0};
int i,result_idx = 0,result_idx_last=0;
- dbg(3,"count=%d\n", count);
+ dbg(lvl_debug,"count=%d\n", count);
for (i=0; i < count; i++) {
- dbg(3, "input coord %d: (%d, %d)\n", i, input[i].x, input[i].y);
+ dbg(lvl_debug, "input coord %d: (%d, %d)\n", i, input[i].x, input[i].y);
#if 0 /* doesn't work as wanted */
if (i && input[i].x == input[0].x && input[i].y == input[0].y && result_idx && !width_result) {
result[result_idx++]=result[0];
@@ -561,7 +561,7 @@ transform(struct transformation *t, enum projection required_projection, struct
}
screen_point.x+=t->offx;
screen_point.y+=t->offy;
- dbg(3,"result: (%d, %d)\n", screen_point.x, screen_point.y);
+ dbg(lvl_debug,"result: (%d, %d)\n", screen_point.x, screen_point.y);
if (i != 0 && i != count-1 &&
(input[i+1].x != input[0].x || input[i+1].y != input[0].y)) {
@@ -572,7 +572,7 @@ transform(struct transformation *t, enum projection required_projection, struct
result[result_idx]=screen_point;
if (width_result) {
if (t->ddd) {
- dbg(3,"width %d * %d / %d\n",width,t->wscale,clip_result.clipped_coord.z);
+ dbg(lvl_debug,"width %d * %d / %d\n",width,t->wscale,clip_result.clipped_coord.z);
width_result[result_idx]=width*t->wscale/clip_result.clipped_coord.z;
} else
width_result[result_idx]=width;
@@ -628,7 +628,7 @@ static int
transform_reverse_near_far(struct transformation *t, struct point *p, struct coord *c, int near, int far)
{
double xc,yc;
- dbg(1,"%d,%d\n",p->x,p->y);
+ dbg(lvl_warning,"%d,%d\n",p->x,p->y);
if (t->ddd) {
struct coord_geo_cart nearc,farc,nears,fars,intersection;
transform_screen_to_3d(t, p, near, &nearc);
@@ -727,12 +727,12 @@ transform_get_selection(struct transformation *this_, enum projection pro, int o
if (this_->pro != pro) {
transform_to_geo(this_->pro, &curri->u.c_rect.lu, &g);
transform_from_geo(pro, &g, &curro->u.c_rect.lu);
- dbg(1,"%f,%f", g.lat, g.lng);
+ dbg(lvl_warning,"%f,%f", g.lat, g.lng);
transform_to_geo(this_->pro, &curri->u.c_rect.rl, &g);
transform_from_geo(pro, &g, &curro->u.c_rect.rl);
- dbg(1,": - %f,%f\n", g.lat, g.lng);
+ dbg(lvl_warning,": - %f,%f\n", g.lat, g.lng);
}
- dbg(1,"transform rect for %d is %d,%d - %d,%d\n", pro, curro->u.c_rect.lu.x, curro->u.c_rect.lu.y, curro->u.c_rect.rl.x, curro->u.c_rect.rl.y);
+ dbg(lvl_warning,"transform rect for %d is %d,%d - %d,%d\n", pro, curro->u.c_rect.lu.x, curro->u.c_rect.lu.y, curro->u.c_rect.rl.x, curro->u.c_rect.rl.y);
curro->order+=order;
#if 0
curro->u.c_rect.lu.x-=500;
@@ -798,7 +798,7 @@ transform_set_roll(struct transformation *this_,int roll)
this_->roll=roll;
transform_setup_matrix(this_);
#else
- dbg(0,"not supported\n");
+ dbg(lvl_error,"not supported\n");
#endif
}
@@ -920,7 +920,7 @@ transform_setup_source_rect(struct transformation *t)
if (transform_zplane_intersection(&cg[edgenodes[i*2]], &cg[edgenodes[i*2+1]], HOG(*t), &tmp) == 1) {
c.x=tmp.x*(1 << t->scale_shift)+t->map_center.x;
c.y=tmp.y*(1 << t->scale_shift)+t->map_center.y;
- dbg(1,"intersection with edge %d at 0x%x,0x%x\n",i,c.x,c.y);
+ dbg(lvl_warning,"intersection with edge %d at 0x%x,0x%x\n",i,c.x,c.y);
if (valid)
coord_rect_extend(&msm->u.c_rect, &c);
else {
@@ -928,20 +928,20 @@ transform_setup_source_rect(struct transformation *t)
msm->u.c_rect.rl=c;
valid=1;
}
- dbg(1,"rect 0x%x,0x%x - 0x%x,0x%x\n",msm->u.c_rect.lu.x,msm->u.c_rect.lu.y,msm->u.c_rect.rl.x,msm->u.c_rect.rl.y);
+ dbg(lvl_warning,"rect 0x%x,0x%x - 0x%x,0x%x\n",msm->u.c_rect.lu.x,msm->u.c_rect.lu.y,msm->u.c_rect.rl.x,msm->u.c_rect.rl.y);
}
}
} else {
for (i = 0 ; i < 4 ; i++) {
transform_reverse(t, &screen_pnt[i], &screen[i]);
- dbg(1,"map(%d) %d,%d=0x%x,0x%x\n", i,screen_pnt[i].x, screen_pnt[i].y, screen[i].x, screen[i].y);
+ dbg(lvl_warning,"map(%d) %d,%d=0x%x,0x%x\n", i,screen_pnt[i].x, screen_pnt[i].y, screen[i].x, screen[i].y);
}
msm->u.c_rect.lu.x=min4(screen[0].x,screen[1].x,screen[2].x,screen[3].x);
msm->u.c_rect.rl.x=max4(screen[0].x,screen[1].x,screen[2].x,screen[3].x);
msm->u.c_rect.rl.y=min4(screen[0].y,screen[1].y,screen[2].y,screen[3].y);
msm->u.c_rect.lu.y=max4(screen[0].y,screen[1].y,screen[2].y,screen[3].y);
}
- dbg(1,"%dx%d\n", msm->u.c_rect.rl.x-msm->u.c_rect.lu.x,
+ dbg(lvl_warning,"%dx%d\n", msm->u.c_rect.rl.x-msm->u.c_rect.lu.x,
msm->u.c_rect.lu.y-msm->u.c_rect.rl.y);
*msm_last=msm;
msm_last=&msm->next;
@@ -966,7 +966,7 @@ transform_set_scale(struct transformation *t, long scale)
int
transform_get_order(struct transformation *t)
{
- dbg(1,"order %d\n", t->order);
+ dbg(lvl_warning,"order %d\n", t->order);
return t->order;
}
@@ -1086,7 +1086,7 @@ transform_distance(enum projection pro, struct coord *c1, struct coord *c2)
} else if (pro == projection_garmin) {
return transform_distance_garmin(c1, c2);
} else {
- dbg(0,"Unknown projection: %d\n", pro);
+ dbg(lvl_error,"Unknown projection: %d\n", pro);
return 0;
}
}
@@ -1102,7 +1102,7 @@ transform_project(enum projection pro, struct coord *c, int distance, int angle,
res->y=c->y+distance*cos(angle*M_PI/180)*scale;
break;
default:
- dbg(0,"Unsupported projection: %d\n", pro);
+ dbg(lvl_error,"Unsupported projection: %d\n", pro);
return;
}
diff --git a/navit/util.c b/navit/util.c
index 1859d38b1..a51c804b5 100644
--- a/navit/util.c
+++ b/navit/util.c
@@ -62,7 +62,7 @@ navit_utf8_strcasecmp(const char *s1, const char *s2)
s1_folded=g_utf8_casefold(s1,-1);
s2_folded=g_utf8_casefold(s2,-1);
cmpres=strcmp(s1_folded,s2_folded);
- dbg(3,"Compared %s with %s, got %d\n",s1_folded,s2_folded,cmpres);
+ dbg(lvl_debug,"Compared %s with %s, got %d\n",s1_folded,s2_folded,cmpres);
g_free(s1_folded);
g_free(s2_folded);
return cmpres;
@@ -509,7 +509,7 @@ spawn_process(char **argv)
pid_t pid;
sigset_t set, old;
- dbg(1,"spawning process for '%s'\n", argv[0]);
+ dbg(lvl_warning,"spawning process for '%s'\n", argv[0]);
sigemptyset(&set);
sigaddset(&set,SIGCHLD);
spawn_process_sigmask(SIG_BLOCK,&set,&old);
@@ -523,7 +523,7 @@ spawn_process(char **argv)
r->pid=pid;
spawn_process_children=g_list_prepend(spawn_process_children,r);
} else {
- dbg(0,"fork() returned error.");
+ dbg(lvl_error,"fork() returned error.");
g_free(r);
r=NULL;
}
@@ -550,7 +550,7 @@ spawn_process(char **argv)
args=newSysString(cmdline);
cmd = newSysString(argv[0]);
dwRet=CreateProcess(cmd, args, NULL, NULL, 0, 0, NULL, NULL, NULL, &(r->pr));
- dbg(0, "CreateProcess(%s,%s), PID=%i\n",argv[0],cmdline,r->pr.dwProcessId);
+ dbg(lvl_error, "CreateProcess(%s,%s), PID=%i\n",argv[0],cmdline,r->pr.dwProcessId);
g_free(cmd);
#else
TCHAR* args;
@@ -560,7 +560,7 @@ spawn_process(char **argv)
cmdline=spawn_process_compose_cmdline(argv);
args=newSysString(cmdline);
dwRet=CreateProcess(NULL, args, NULL, NULL, 0, 0, NULL, NULL, &startupInfo, &(r->pr));
- dbg(0, "CreateProcess(%s), PID=%i\n",cmdline,r->pr.dwProcessId);
+ dbg(lvl_error, "CreateProcess(%s), PID=%i\n",cmdline,r->pr.dwProcessId);
#endif
g_free(cmdline);
g_free(args);
@@ -570,7 +570,7 @@ spawn_process(char **argv)
{
char *cmdline=spawn_process_compose_cmdline(argv);
int status;
- dbg(0,"Unblocked spawn_process isn't availiable on this platform.\n");
+ dbg(lvl_error,"Unblocked spawn_process isn't availiable on this platform.\n");
status=system(cmdline);
g_free(cmdline);
r->status=status;
@@ -593,7 +593,7 @@ spawn_process(char **argv)
int spawn_process_check_status(struct spawn_process_info *pi, int block)
{
if(pi==NULL) {
- dbg(0,"Trying to get process status of NULL, assuming process is terminated.\n");
+ dbg(lvl_error,"Trying to get process status of NULL, assuming process is terminated.\n");
return 255;
}
#ifdef HAVE_API_WIN32_BASE
@@ -606,7 +606,7 @@ int spawn_process_check_status(struct spawn_process_info *pi, int block)
break;
}
} else {
- dbg(0,"GetExitCodeProcess failed. Assuming the process is terminated.");
+ dbg(lvl_error,"GetExitCodeProcess failed. Assuming the process is terminated.");
return 255;
}
if(!block)
@@ -614,7 +614,7 @@ int spawn_process_check_status(struct spawn_process_info *pi, int block)
dw=WaitForSingleObject(pi->pr.hProcess,INFINITE);
if(dw==WAIT_FAILED && failcount++==1) {
- dbg(0,"WaitForSingleObject failed twice. Assuming the process is terminated.");
+ dbg(lvl_error,"WaitForSingleObject failed twice. Assuming the process is terminated.");
return 0;
break;
}
@@ -633,9 +633,9 @@ int spawn_process_check_status(struct spawn_process_info *pi, int block)
pi->status=WEXITSTATUS(status);
return pi->status;
if(WIFSTOPPED(status)) {
- dbg(0,"child is stopped by %i signal\n",WSTOPSIG(status));
+ dbg(lvl_error,"child is stopped by %i signal\n",WSTOPSIG(status));
} else if (WIFSIGNALED(status)) {
- dbg(0,"child terminated by signal %i\n",WEXITSTATUS(status));
+ dbg(lvl_error,"child terminated by signal %i\n",WEXITSTATUS(status));
pi->status=255;
return 255;
}
@@ -647,12 +647,12 @@ int spawn_process_check_status(struct spawn_process_info *pi, int block)
} else {
if(pi->status!=-1) // Signal handler has changed pi->status while in this function
return pi->status;
- dbg(0,"waitpid() indicated error, reporting process termination.\n");
+ dbg(lvl_error,"waitpid() indicated error, reporting process termination.\n");
return 255;
}
}
#else
- dbg(0, "Non-blocking spawn_process isn't availiable for this platform, repoting process exit status.\n");
+ dbg(lvl_error, "Non-blocking spawn_process isn't availiable for this platform, repoting process exit status.\n");
return pi->status;
#endif
#endif
diff --git a/navit/vehicle.c b/navit/vehicle.c
index c18460095..19ad1020e 100644
--- a/navit/vehicle.c
+++ b/navit/vehicle.c
@@ -109,10 +109,10 @@ vehicle_new(struct attr *parent, struct attr **attrs)
char *type, *colon;
struct pcoord center;
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
source = attr_search(attrs, NULL, attr_source);
if (!source) {
- dbg(0, "incomplete vehicle definition: missing attribute 'source'\n");
+ dbg(lvl_error, "incomplete vehicle definition: missing attribute 'source'\n");
return NULL;
}
@@ -120,11 +120,11 @@ vehicle_new(struct attr *parent, struct attr **attrs)
colon = strchr(type, ':');
if (colon)
*colon = '\0';
- dbg(1, "source='%s' type='%s'\n", source->u.str, type);
+ dbg(lvl_warning, "source='%s' type='%s'\n", source->u.str, type);
vehicletype_new = plugin_get_vehicle_type(type);
if (!vehicletype_new) {
- dbg(0, "invalid source '%s': unknown type '%s'\n", source->u.str, type);
+ dbg(lvl_error, "invalid source '%s': unknown type '%s'\n", source->u.str, type);
g_free(type);
return NULL;
}
@@ -135,7 +135,7 @@ vehicle_new(struct attr *parent, struct attr **attrs)
this_->cbl = callback_list_new();
this_->priv = vehicletype_new(&this_->meth, this_->cbl, attrs);
if (!this_->priv) {
- dbg(0, "vehicletype_new failed\n");
+ dbg(lvl_error, "vehicletype_new failed\n");
callback_list_destroy(this_->cbl);
g_free(this_);
return NULL;
@@ -148,7 +148,7 @@ vehicle_new(struct attr *parent, struct attr **attrs)
this_->trans=transform_new(&center, 16, 0);
vehicle_set_default_name(this_);
- dbg(1, "leave\n");
+ dbg(lvl_warning, "leave\n");
this_->log_to_cb=g_hash_table_new(NULL,NULL);
return this_;
}
@@ -161,7 +161,7 @@ vehicle_new(struct attr *parent, struct attr **attrs)
void
vehicle_destroy(struct vehicle *this_)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
if (this_->animate_callback) {
callback_destroy(this_->animate_callback);
event_remove_timeout(this_->animate_timer);
@@ -373,8 +373,8 @@ vehicle_draw(struct vehicle *this_, struct graphics *gra, struct point *pnt, int
{
if (angle < 0)
angle+=360;
- dbg(1,"enter this=%p gra=%p pnt=%p lazy=%d dir=%d speed=%d\n", this_, gra, pnt, lazy, angle, speed);
- dbg(1,"point %d,%d\n", pnt->x, pnt->y);
+ dbg(lvl_warning,"enter this=%p gra=%p pnt=%p lazy=%d dir=%d speed=%d\n", this_, gra, pnt, lazy, angle, speed);
+ dbg(lvl_warning,"point %d,%d\n", pnt->x, pnt->y);
this_->cursor_pnt=*pnt;
this_->angle=angle;
this_->speed=speed;
@@ -413,7 +413,7 @@ static void vehicle_set_default_name(struct vehicle *this_)
// Safe cast: attr_generic_set_attr does not modify its parameter.
default_name.u.str=(char*)_("Unnamed vehicle");
this_->attrs=attr_generic_set_attr(this_->attrs, &default_name);
- dbg(0, "Incomplete vehicle definition: missing attribute 'name'. Default name set.\n");
+ dbg(lvl_error, "Incomplete vehicle definition: missing attribute 'name'. Default name set.\n");
}
}
@@ -448,7 +448,7 @@ vehicle_draw_do(struct vehicle *this_, int lazy)
while (*attr) {
if ((*attr)->type == attr_itemgra) {
struct itemgra *itm=(*attr)->u.itemgra;
- dbg(1,"speed %d-%d %d\n", itm->speed_range.min, itm->speed_range.max, speed);
+ dbg(lvl_warning,"speed %d-%d %d\n", itm->speed_range.min, itm->speed_range.max, speed);
if (speed >= itm->speed_range.min && speed <= itm->speed_range.max &&
angle >= itm->angle_range.min && angle <= itm->angle_range.max &&
sequence >= itm->sequence_range.min && sequence <= itm->sequence_range.max) {
@@ -669,7 +669,7 @@ vehicle_log_binfile(struct vehicle *this_, struct log *log)
buffer_new=g_malloc((buffer[0]+3)*sizeof(int));
memcpy(buffer_new, buffer, (buffer[0]+1)*sizeof(int));
}
- dbg(1,"c=0x%x,0x%x\n",c.x,c.y);
+ dbg(lvl_warning,"c=0x%x,0x%x\n",c.x,c.y);
buffer_new[buffer_new[0]+1]=c.x;
buffer_new[buffer_new[0]+2]=c.y;
buffer_new[0]+=2;
diff --git a/navit/vehicle/android/vehicle_android.c b/navit/vehicle/android/vehicle_android.c
index 34ba7a304..31f130315 100644
--- a/navit/vehicle/android/vehicle_android.c
+++ b/navit/vehicle/android/vehicle_android.c
@@ -67,7 +67,7 @@ struct vehicle_priv {
static void
vehicle_android_destroy(struct vehicle_priv *priv)
{
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
g_free(priv);
}
@@ -83,7 +83,7 @@ static int
vehicle_android_position_attr_get(struct vehicle_priv *priv,
enum attr_type type, struct attr *attr)
{
- dbg(1,"enter %s\n",attr_to_name(type));
+ dbg(lvl_warning,"enter %s\n",attr_to_name(type));
switch (type) {
case attr_position_fix_type:
attr->u.num = priv->fix_type;
@@ -120,7 +120,7 @@ vehicle_android_position_attr_get(struct vehicle_priv *priv,
default:
return 0;
}
- dbg(1,"ok\n");
+ dbg(lvl_warning,"ok\n");
attr->type = type;
return 1;
}
@@ -142,7 +142,7 @@ static void
vehicle_android_position_callback(struct vehicle_priv *v, jobject location) {
time_t tnow;
struct tm *tm;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
v->geo.lat = (*jnienv)->CallDoubleMethod(jnienv, location, v->Location_getLatitude);
v->geo.lng = (*jnienv)->CallDoubleMethod(jnienv, location, v->Location_getLongitude);
@@ -153,7 +153,7 @@ vehicle_android_position_callback(struct vehicle_priv *v, jobject location) {
tnow=(*jnienv)->CallLongMethod(jnienv, location, v->Location_getTime)/1000;
tm = gmtime(&tnow);
strftime(v->fixiso8601, sizeof(v->fixiso8601), "%Y-%m-%dT%TZ", tm);
- dbg(1,"lat %f lon %f time %s\n",v->geo.lat,v->geo.lng,v->fixiso8601);
+ dbg(lvl_warning,"lat %f lon %f time %s\n",v->geo.lat,v->geo.lng,v->fixiso8601);
if (v->valid != attr_position_valid_valid) {
v->valid = attr_position_valid_valid;
callback_list_call_attr_0(v->cbl, attr_position_valid);
@@ -235,15 +235,33 @@ vehicle_android_init(struct vehicle_priv *ret)
return 0;
if (!android_find_class_global("org/navitproject/navit/NavitVehicle", &ret->NavitVehicleClass))
return 0;
+<<<<<<< HEAD
dbg(0,"at 3\n");
cid = (*jnienv)->GetMethodID(jnienv, ret->NavitVehicleClass, "<init>", "(Landroid/content/Context;III)V");
+||||||| merged common ancestors
+ dbg(0,"at 3\n");
+ cid = (*jnienv)->GetMethodID(jnienv, ret->NavitVehicleClass, "<init>", "(Landroid/content/Context;I)V");
+=======
+ dbg(lvl_error,"at 3\n");
+ cid = (*jnienv)->GetMethodID(jnienv, ret->NavitVehicleClass, "<init>", "(Landroid/content/Context;I)V");
+>>>>>>> Refactor:core:Introduce enum for debug levels, and use it everywhere.|First part of #1269.
if (cid == NULL) {
- dbg(0,"no method found\n");
+ dbg(lvl_error,"no method found\n");
return 0; /* exception thrown */
}
+<<<<<<< HEAD
dbg(0,"at 4 android_activity=%p\n",android_activity);
ret->NavitVehicle=(*jnienv)->NewObject(jnienv, ret->NavitVehicleClass, cid, android_activity, (int) ret->pcb, (int) ret->scb, (int) ret->fcb);
dbg(0,"result=%p\n",ret->NavitVehicle);
+||||||| merged common ancestors
+ dbg(0,"at 4 android_activity=%p\n",android_activity);
+ ret->NavitVehicle=(*jnienv)->NewObject(jnienv, ret->NavitVehicleClass, cid, android_activity, (int) ret->cb);
+ dbg(0,"result=%p\n",ret->NavitVehicle);
+=======
+ dbg(lvl_error,"at 4 android_activity=%p\n",android_activity);
+ ret->NavitVehicle=(*jnienv)->NewObject(jnienv, ret->NavitVehicleClass, cid, android_activity, (int) ret->cb);
+ dbg(lvl_error,"result=%p\n",ret->NavitVehicle);
+>>>>>>> Refactor:core:Introduce enum for debug levels, and use it everywhere.|First part of #1269.
if (!ret->NavitVehicle)
return 0;
if (ret->NavitVehicle)
@@ -267,7 +285,7 @@ vehicle_android_new_android(struct vehicle_methods *meth,
{
struct vehicle_priv *ret;
- dbg(0, "enter\n");
+ dbg(lvl_error, "enter\n");
ret = g_new0(struct vehicle_priv, 1);
ret->cbl = cbl;
ret->pcb = callback_new_1(callback_cast(vehicle_android_position_callback), ret);
@@ -278,7 +296,7 @@ vehicle_android_new_android(struct vehicle_methods *meth,
ret->sats_used = 0;
*meth = vehicle_android_methods;
vehicle_android_init(ret);
- dbg(0, "return\n");
+ dbg(lvl_error, "return\n");
return ret;
}
@@ -290,6 +308,6 @@ vehicle_android_new_android(struct vehicle_methods *meth,
void
plugin_init(void)
{
- dbg(0, "enter\n");
+ dbg(lvl_error, "enter\n");
plugin_register_vehicle_type("android", vehicle_android_new_android);
}
diff --git a/navit/vehicle/demo/vehicle_demo.c b/navit/vehicle/demo/vehicle_demo.c
index ecaa08001..f25918524 100644
--- a/navit/vehicle/demo/vehicle_demo.c
+++ b/navit/vehicle/demo/vehicle_demo.c
@@ -163,7 +163,7 @@ vehicle_demo_set_attr_do(struct vehicle_priv *priv, struct attr *attr)
callback_list_call_attr_0(priv->cbl, attr_position_valid);
}
priv->position_set=1;
- dbg(1,"position_set %f %f\n", priv->geo.lat, priv->geo.lng);
+ dbg(lvl_warning,"position_set %f %f\n", priv->geo.lat, priv->geo.lng);
break;
case attr_profilename:
case attr_source:
@@ -171,7 +171,7 @@ vehicle_demo_set_attr_do(struct vehicle_priv *priv, struct attr *attr)
// Ignore; used by Navit's infrastructure, but not relevant for this vehicle.
break;
default:
- dbg(0,"unsupported attribute %s\n",attr_to_name(attr->type));
+ dbg(lvl_error,"unsupported attribute %s\n",attr_to_name(attr->type));
return 0;
}
return 1;
@@ -200,7 +200,7 @@ vehicle_demo_timer(struct vehicle_priv *priv)
struct item *item=NULL;
len = (priv->config_speed * priv->interval / 1000)/ 3.6;
- dbg(1, "###### Entering simulation loop\n");
+ dbg(lvl_warning, "###### Entering simulation loop\n");
if (!priv->config_speed)
return;
if (priv->route)
@@ -219,10 +219,10 @@ vehicle_demo_timer(struct vehicle_priv *priv)
item=map_rect_get_item(mr);
if (item && item_coord_get(item, &pos, 1)) {
priv->position_set=0;
- dbg(1, "current pos=0x%x,0x%x\n", pos.x, pos.y);
- dbg(1, "last pos=0x%x,0x%x\n", priv->last.x, priv->last.y);
+ dbg(lvl_warning, "current pos=0x%x,0x%x\n", pos.x, pos.y);
+ dbg(lvl_warning, "last pos=0x%x,0x%x\n", priv->last.x, priv->last.y);
if (priv->last.x == pos.x && priv->last.y == pos.y) {
- dbg(1, "endless loop\n");
+ dbg(lvl_warning, "endless loop\n");
}
priv->last = pos;
while (item && priv->config_speed) {
@@ -230,9 +230,9 @@ vehicle_demo_timer(struct vehicle_priv *priv)
item=map_rect_get_item(mr);
continue;
}
- dbg(1, "next pos=0x%x,0x%x\n", c.x, c.y);
+ dbg(lvl_warning, "next pos=0x%x,0x%x\n", c.x, c.y);
slen = transform_distance(projection_mg, &pos, &c);
- dbg(1, "len=%d slen=%d\n", len, slen);
+ dbg(lvl_warning, "len=%d slen=%d\n", len, slen);
if (slen < len) {
len -= slen;
pos = c;
@@ -249,9 +249,9 @@ vehicle_demo_timer(struct vehicle_priv *priv)
ci.x = pos.x;
ci.y = pos.y;
priv->speed=0;
- dbg(0,"destination reached\n");
+ dbg(lvl_error,"destination reached\n");
}
- dbg(1, "ci=0x%x,0x%x\n", ci.x, ci.y);
+ dbg(lvl_warning, "ci=0x%x,0x%x\n", ci.x, ci.y);
transform_to_geo(projection_mg, &ci,
&priv->geo);
if (priv->valid != attr_position_valid_valid) {
@@ -279,7 +279,7 @@ vehicle_demo_new(struct vehicle_methods
{
struct vehicle_priv *ret;
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
ret = g_new0(struct vehicle_priv, 1);
ret->cbl = cbl;
ret->interval=1000;
@@ -297,6 +297,6 @@ vehicle_demo_new(struct vehicle_methods
void
plugin_init(void)
{
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
plugin_register_vehicle_type("demo", vehicle_demo_new);
}
diff --git a/navit/vehicle/file/vehicle_file.c b/navit/vehicle/file/vehicle_file.c
index 4df7b500c..f82e33fd5 100644
--- a/navit/vehicle/file/vehicle_file.c
+++ b/navit/vehicle/file/vehicle_file.c
@@ -148,7 +148,7 @@ static int vehicle_win32_serial_track(struct vehicle_priv *priv)
int rc = 0;
int dwBytes;
- dbg(1, "enter, *priv='%x', priv->source='%s'\n", priv, priv->source);
+ dbg(lvl_warning, "enter, *priv='%x', priv->source='%s'\n", priv, priv->source);
if ( priv->no_data_count > 5 )
{
@@ -194,7 +194,7 @@ static int vehicle_win32_serial_track(struct vehicle_priv *priv)
priv->no_data_count = 0;
callback_list_call_attr_0(priv->cbl, attr_position_coord_geo);
if (rc > 1)
- dbg(0, "Can not keep with gps data delay is %d seconds\n", rc - 1);
+ dbg(lvl_error, "Can not keep with gps data delay is %d seconds\n", rc - 1);
}
}
@@ -202,7 +202,7 @@ static int vehicle_win32_serial_track(struct vehicle_priv *priv)
{
priv->no_data_count++;
}
- dbg(2, "leave, return '1', priv->no_data_count='%d'\n", priv->no_data_count);
+ dbg(lvl_info, "leave, return '1', priv->no_data_count='%d'\n", priv->no_data_count);
return 1;
}
#endif
@@ -264,7 +264,7 @@ vehicle_file_open(struct vehicle_priv *priv)
struct sockaddr_in sin;
p=strchr(s,':');
if (!p) {
- dbg(0,"port number missing in %s\n",s);
+ dbg(lvl_error,"port number missing in %s\n",s);
g_free(s);
return 0;
}
@@ -272,14 +272,14 @@ vehicle_file_open(struct vehicle_priv *priv)
sin.sin_family=AF_INET;
sin.sin_port=ntohs(atoi(p));
if (!inet_aton(s, &sin.sin_addr)) {
- dbg(0,"failed to parse %s\n",s);
+ dbg(lvl_error,"failed to parse %s\n",s);
g_free(s);
return 0;
}
priv->fd = socket(PF_INET, SOCK_STREAM, 0);
if (priv->fd != -1) {
if (connect(priv->fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
- dbg(0,"failed to connect to %s:%s\n",s,p);
+ dbg(lvl_error,"failed to connect to %s:%s\n",s,p);
g_free(s);
return 0;
}
@@ -309,7 +309,7 @@ vehicle_file_open(struct vehicle_priv *priv)
g_free( raw_setting_str );
priv->file_type = file_type_serial;
// Add the callback
- dbg(2, "Add the callback ...\n", priv->source);
+ dbg(lvl_info, "Add the callback ...\n", priv->source);
priv->timeout_callback=callback_new_1(callback_cast(vehicle_win32_serial_track), priv);
#else
//TODO - add linux serial
@@ -329,7 +329,7 @@ vehicle_file_open(struct vehicle_priv *priv)
static void
vehicle_file_close(struct vehicle_priv *priv)
{
- dbg(1, "enter, priv->fd='%d'\n", priv->fd);
+ dbg(lvl_warning, "enter, priv->fd='%d'\n", priv->fd);
vehicle_file_disable_watch(priv);
#ifdef _WIN32
if(priv->file_type == file_type_serial)
@@ -369,7 +369,7 @@ vehicle_file_close(struct vehicle_priv *priv)
static int
vehicle_file_enable_watch_timer(struct vehicle_priv *priv)
{
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
vehicle_file_enable_watch(priv);
return FALSE;
@@ -400,10 +400,10 @@ vehicle_file_parse(struct vehicle_priv *priv, char *buffer)
int valid=0;
int ret = 0;
- dbg(2, "enter: buffer='%s'\n", buffer);
+ dbg(lvl_info, "enter: buffer='%s'\n", buffer);
for (;;) {
if (len < 4) {
- dbg(0, "'%s' too short\n", buffer);
+ dbg(lvl_error, "'%s' too short\n", buffer);
return ret;
}
if (buffer[len - 1] == '\r' || buffer[len - 1] == '\n') {
@@ -414,22 +414,22 @@ vehicle_file_parse(struct vehicle_priv *priv, char *buffer)
break;
}
if (buffer[0] != '$') {
- dbg(0, "no leading $ in '%s'\n", buffer);
+ dbg(lvl_error, "no leading $ in '%s'\n", buffer);
return ret;
}
if (buffer[len - 3] != '*') {
- dbg(0, "no *XX in '%s'\n", buffer);
+ dbg(lvl_error, "no *XX in '%s'\n", buffer);
return ret;
}
for (i = 1; i < len - 3; i++) {
csum ^= (unsigned char) (buffer[i]);
}
if (!sscanf(buffer + len - 2, "%x", &bcsum) && priv->checksum_ignore != 2) {
- dbg(0, "no checksum in '%s'\n", buffer);
+ dbg(lvl_error, "no checksum in '%s'\n", buffer);
return ret;
}
if (bcsum != csum && priv->checksum_ignore == 0) {
- dbg(0, "wrong checksum in '%s was %x should be %x'\n", buffer,bcsum,csum);
+ dbg(lvl_error, "wrong checksum in '%s was %x should be %x'\n", buffer,bcsum,csum);
return ret;
}
@@ -438,7 +438,7 @@ vehicle_file_parse(struct vehicle_priv *priv, char *buffer)
g_free(priv->nmea_data_buf);
priv->nmea_data_buf=nmea_data_buf;
} else {
- dbg(0, "nmea buffer overflow (len %zu), discarding '%s'\n", priv->nmea_data_buf?strlen(priv->nmea_data_buf):-1,buffer);
+ dbg(lvl_error, "nmea buffer overflow (len %zu), discarding '%s'\n", priv->nmea_data_buf?strlen(priv->nmea_data_buf):-1,buffer);
}
i = 0;
p = buffer;
@@ -475,7 +475,7 @@ vehicle_file_parse(struct vehicle_priv *priv, char *buffer)
if (!g_ascii_strcasecmp(item[5],"W"))
priv->geo.lng=-priv->geo.lng;
priv->valid=attr_position_valid_valid;
- dbg(2, "latitude '%2.4f' longitude %2.4f\n", priv->geo.lat, priv->geo.lng);
+ dbg(lvl_info, "latitude '%2.4f' longitude %2.4f\n", priv->geo.lat, priv->geo.lng);
} else
priv->valid=attr_position_valid_invalid;
@@ -513,7 +513,7 @@ vehicle_file_parse(struct vehicle_priv *priv, char *buffer)
if (valid) {
priv->direction = g_ascii_strtod( item[1], NULL );
priv->speed = g_ascii_strtod( item[7], NULL );
- dbg(2,"direction %lf, speed %2.1lf\n", priv->direction, priv->speed);
+ dbg(lvl_info,"direction %lf, speed %2.1lf\n", priv->direction, priv->speed);
}
}
if (!strncmp(buffer, "$GPRMC", 6)) {
@@ -603,7 +603,7 @@ vehicle_file_parse(struct vehicle_priv *priv, char *buffer)
*/
if (item[1]) {
priv->magnetic_direction = g_ascii_strtod( item[1], NULL );
- dbg(1,"magnetic %d\n", priv->magnetic_direction);
+ dbg(lvl_warning,"magnetic %d\n", priv->magnetic_direction);
}
}
return ret;
@@ -624,7 +624,7 @@ vehicle_file_io(struct vehicle_priv *priv)
{
int size, rc = 0;
char *str, *tok;
- dbg(1, "vehicle_file_io : enter\n");
+ dbg(lvl_warning, "vehicle_file_io : enter\n");
if (priv->process_statefile) {
unsigned char *data;
@@ -657,12 +657,12 @@ vehicle_file_io(struct vehicle_priv *priv)
}
priv->buffer_pos += size;
priv->buffer[priv->buffer_pos] = '\0';
- dbg(1, "size=%d pos=%d buffer='%s'\n", size,
+ dbg(lvl_warning, "size=%d pos=%d buffer='%s'\n", size,
priv->buffer_pos, priv->buffer);
str = priv->buffer;
while ((tok = strchr(str, '\n'))) {
*tok++ = '\0';
- dbg(1, "line='%s'\n", str);
+ dbg(lvl_warning, "line='%s'\n", str);
rc +=vehicle_file_parse(priv, str);
str = tok;
if (priv->file_type == file_type_file && rc)
@@ -673,10 +673,10 @@ vehicle_file_io(struct vehicle_priv *priv)
size = priv->buffer + priv->buffer_pos - str;
memmove(priv->buffer, str, size + 1);
priv->buffer_pos = size;
- dbg(1, "now pos=%d buffer='%s'\n",
+ dbg(lvl_warning, "now pos=%d buffer='%s'\n",
priv->buffer_pos, priv->buffer);
} else if (priv->buffer_pos == buffer_size - 1) {
- dbg(0,
+ dbg(lvl_error,
"Overflow. Most likely wrong baud rate or no nmea protocol\n");
priv->buffer_pos = 0;
}
@@ -695,7 +695,7 @@ vehicle_file_io(struct vehicle_priv *priv)
static void
vehicle_file_enable_watch(struct vehicle_priv *priv)
{
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
#ifdef _WIN32
// add an event : don't use glib timers and g_timeout_add
if (priv->file_type == file_type_serial)
@@ -703,7 +703,7 @@ vehicle_file_enable_watch(struct vehicle_priv *priv)
if (priv->timeout_callback != NULL)
priv->timeout = event_add_timeout(500, 1, priv->timeout_callback);
else
- dbg(1, "error : watch not enabled : priv->timeout_callback is null\n"); }
+ dbg(lvl_warning, "error : watch not enabled : priv->timeout_callback is null\n"); }
else
#endif
{
@@ -723,7 +723,7 @@ vehicle_file_enable_watch(struct vehicle_priv *priv)
static void
vehicle_file_disable_watch(struct vehicle_priv *priv)
{
- dbg(1, "vehicle_file_disable_watch : enter\n");
+ dbg(lvl_warning, "vehicle_file_disable_watch : enter\n");
#ifdef _WIN32
if(priv->file_type == file_type_serial)
{
@@ -844,7 +844,7 @@ vehicle_file_position_attr_get(struct vehicle_priv *priv,
attr->u.str=priv->fixiso8601;
break;
case attr_position_sat_item:
- dbg(0,"at here\n");
+ dbg(lvl_error,"at here\n");
priv->sat_item.id_lo++;
if (priv->sat_item.id_lo > priv->current_count) {
priv->sat_item.id_lo=0;
@@ -951,11 +951,11 @@ vehicle_file_new_file(struct vehicle_methods
struct attr *checksum_ignore;
struct attr *state_file;
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
source = attr_search(attrs, NULL, attr_source);
if(source == NULL){
- dbg(0,"Missing source attribute");
+ dbg(lvl_error,"Missing source attribute");
return NULL;
}
ret = g_new0(struct vehicle_priv, 1); // allocate and initialize to 0
@@ -1009,7 +1009,7 @@ vehicle_file_new_file(struct vehicle_methods
ret->on_eof=1;
if (on_eof && !g_ascii_strcasecmp(on_eof->u.str, "exit"))
ret->on_eof=2;
- dbg(0,"on_eof=%d\n", ret->on_eof);
+ dbg(lvl_error,"on_eof=%d\n", ret->on_eof);
*meth = vehicle_file_methods;
ret->cb=callback_new_1(callback_cast(vehicle_file_io), ret);
ret->cbt=callback_new_1(callback_cast(vehicle_file_enable_watch_timer), ret);
@@ -1025,15 +1025,15 @@ vehicle_file_new_file(struct vehicle_methods
ret->no_data_count = 0;
#endif
- dbg(1, "vehicle_file_new_file:open\n");
+ dbg(lvl_warning, "vehicle_file_new_file:open\n");
if (!vehicle_file_open(ret)) {
- dbg(0, "Failed to open '%s'\n", ret->source);
+ dbg(lvl_error, "Failed to open '%s'\n", ret->source);
}
vehicle_file_enable_watch(ret);
// vehicle_file_destroy(ret);
// return NULL;
- dbg(1, "leave\n");
+ dbg(lvl_warning, "leave\n");
return ret;
}
@@ -1045,7 +1045,7 @@ vehicle_file_new_file(struct vehicle_methods
**/
void plugin_init(void)
{
- dbg(1, "vehicle_file:plugin_init:enter\n");
+ dbg(lvl_warning, "vehicle_file:plugin_init:enter\n");
plugin_register_vehicle_type("file", vehicle_file_new_file);
plugin_register_vehicle_type("pipe", vehicle_file_new_file);
plugin_register_vehicle_type("socket", vehicle_file_new_file);
diff --git a/navit/vehicle/gpsd/vehicle_gpsd.c b/navit/vehicle/gpsd/vehicle_gpsd.c
index 5bb39b7b4..a871cb074 100644
--- a/navit/vehicle/gpsd/vehicle_gpsd.c
+++ b/navit/vehicle/gpsd/vehicle_gpsd.c
@@ -97,11 +97,11 @@ vehicle_gpsd_callback(struct gps_data_t *data, const char *buf, size_t len,
g_free(priv->nmea_data_buf);
priv->nmea_data_buf=nmea_data_buf;
} else {
- dbg(0, "nmea buffer overflow, discarding '%s'\n", buffer);
+ dbg(lvl_error, "nmea buffer overflow, discarding '%s'\n", buffer);
}
}
}
- dbg(1,"data->set="LONGLONG_HEX_FMT"\n", data->set);
+ dbg(lvl_warning,"data->set="LONGLONG_HEX_FMT"\n", data->set);
if (data->set & SPEED_SET) {
priv->speed = data->fix.speed * 3.6;
if(!isnan(data->fix.speed))
@@ -164,12 +164,12 @@ vehicle_gpsd_callback(struct gps_data_t *data, const char *buf, size_t len,
}
#ifdef HAVE_LIBGPS19
if (data->set & DOP_SET) {
- dbg(1, "pdop : %g\n", data->dop.pdop);
+ dbg(lvl_warning, "pdop : %g\n", data->dop.pdop);
priv->hdop = data->dop.pdop;
data->set &= ~DOP_SET;
#else
if (data->set & PDOP_SET) {
- dbg(1, "pdop : %g\n", data->pdop);
+ dbg(lvl_warning, "pdop : %g\n", data->pdop);
priv->hdop = data->hdop;
data->set &= ~PDOP_SET;
#endif
@@ -177,7 +177,7 @@ vehicle_gpsd_callback(struct gps_data_t *data, const char *buf, size_t len,
if (data->set & LATLON_SET) {
priv->geo.lat = data->fix.latitude;
priv->geo.lng = data->fix.longitude;
- dbg(1,"lat=%f lng=%f\n", priv->geo.lat, priv->geo.lng);
+ dbg(lvl_warning,"lat=%f lng=%f\n", priv->geo.lat, priv->geo.lng);
g_free(priv->nmea_data);
priv->nmea_data=priv->nmea_data_buf;
priv->nmea_data_buf=NULL;
@@ -187,7 +187,7 @@ vehicle_gpsd_callback(struct gps_data_t *data, const char *buf, size_t len,
if (! isnan(data->fix.speed) && priv->fix_type > 0) {
callback_list_call_attr_0(priv->cbl, attr_position_coord_geo);
}
- dbg(2,"speed ok\n");
+ dbg(lvl_info,"speed ok\n");
}
/**
@@ -205,7 +205,7 @@ vehicle_gpsd_try_open(struct vehicle_priv *priv)
*colon = '\0';
port=colon+1;
}
- dbg(0,"Trying to connect to %s:%s\n",source+7,port?port:"default");
+ dbg(lvl_error,"Trying to connect to %s:%s\n",source+7,port?port:"default");
#if GPSD_API_MAJOR_VERSION >= 5
/* gps_open returns 0 on success */
@@ -214,7 +214,7 @@ vehicle_gpsd_try_open(struct vehicle_priv *priv)
priv->gps = gps_open(source + 7, port);
if(!priv->gps) {
#endif
- dbg(0,"gps_open failed for '%s'. Retrying in %d seconds. Have you started gpsd?\n", priv->source, priv->retry_interval);
+ dbg(lvl_error,"gps_open failed for '%s'. Retrying in %d seconds. Have you started gpsd?\n", priv->source, priv->retry_interval);
g_free(source);
return TRUE;
}
@@ -236,9 +236,9 @@ vehicle_gpsd_try_open(struct vehicle_priv *priv)
priv->cbt = callback_new_1(callback_cast(vehicle_gpsd_try_open), priv);
priv->evwatch = event_add_watch(priv->gps->gps_fd, event_watch_cond_read, priv->cb);
if (!priv->gps->gps_fd) {
- dbg(0,"Warning: gps_fd is 0, most likely you have used a gps.h incompatible to libgps");
+ dbg(lvl_error,"Warning: gps_fd is 0, most likely you have used a gps.h incompatible to libgps");
}
- dbg(0,"Connected to gpsd fd=%d evwatch=%p\n", priv->gps->gps_fd, priv->evwatch);
+ dbg(lvl_error,"Connected to gpsd fd=%d evwatch=%p\n", priv->gps->gps_fd, priv->evwatch);
event_remove_timeout(priv->retry_timer2);
priv->retry_timer2=NULL;
return FALSE;
@@ -257,11 +257,11 @@ vehicle_gpsd_open(struct vehicle_priv *priv)
memset(&priv->context, 0, sizeof(gpsbt_t));
if(gpsbt_start(NULL, 0, 0, 0, errstr, sizeof(errstr),
0, &priv->context) < 0) {
- dbg(0,"Error connecting to GPS with gpsbt: (%d) %s (%s)\n",
+ dbg(lvl_error,"Error connecting to GPS with gpsbt: (%d) %s (%s)\n",
errno, strerror(errno), errstr);
}
sleep(1); /* give gpsd time to start */
- dbg(1,"gpsbt_start: completed\n");
+ dbg(lvl_warning,"gpsbt_start: completed\n");
#endif
priv->retry_timer2=NULL;
if (vehicle_gpsd_try_open(priv))
@@ -301,21 +301,21 @@ vehicle_gpsd_close(struct vehicle_priv *priv)
#ifdef HAVE_GPSBT
err = gpsbt_stop(&priv->context);
if (err < 0) {
- dbg(0,"Error %d while gpsbt_stop", err);
+ dbg(lvl_error,"Error %d while gpsbt_stop", err);
}
- dbg(1,"gpsbt_stop: completed, (%d)",err);
+ dbg(lvl_warning,"gpsbt_stop: completed, (%d)",err);
#endif
}
static void
vehicle_gpsd_io(struct vehicle_priv *priv)
{
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
if (priv->gps) {
vehicle_last = priv;
#if GPSD_API_MAJOR_VERSION >= 5
if(gps_read(priv->gps)==-1) {
- dbg(0,"gps_poll failed\n");
+ dbg(lvl_error,"gps_poll failed\n");
vehicle_gpsd_close(priv);
vehicle_gpsd_open(priv);
}
@@ -326,7 +326,7 @@ vehicle_gpsd_io(struct vehicle_priv *priv)
}
#else
if (gps_poll(priv->gps)) {
- dbg(0,"gps_poll failed\n");
+ dbg(lvl_error,"gps_poll failed\n");
vehicle_gpsd_close(priv);
vehicle_gpsd_open(priv);
}
@@ -427,7 +427,7 @@ vehicle_gpsd_new_gpsd(struct vehicle_methods
struct vehicle_priv *ret;
struct attr *source, *query, *retry_int;
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
source = attr_search(attrs, NULL, attr_source);
ret = g_new0(struct vehicle_priv, 1);
#if GPSD_API_MAJOR_VERSION >= 5
@@ -440,16 +440,16 @@ vehicle_gpsd_new_gpsd(struct vehicle_methods
} else {
ret->gpsd_query = g_strdup("w+x\n");
}
- dbg(1,"Format string for gpsd_query: %s\n",ret->gpsd_query);
+ dbg(lvl_warning,"Format string for gpsd_query: %s\n",ret->gpsd_query);
retry_int = attr_search(attrs, NULL, attr_retry_interval);
if (retry_int) {
ret->retry_interval = retry_int->u.num;
if (ret->retry_interval < MIN_RETRY_INTERVAL) {
- dbg(0, "Retry interval %d too small, setting to %d\n", ret->retry_interval, MIN_RETRY_INTERVAL);
+ dbg(lvl_error, "Retry interval %d too small, setting to %d\n", ret->retry_interval, MIN_RETRY_INTERVAL);
ret->retry_interval = MIN_RETRY_INTERVAL;
}
} else {
- dbg(1, "Retry interval not defined, setting to %d\n", DEFAULT_RETRY_INTERVAL);
+ dbg(lvl_warning, "Retry interval not defined, setting to %d\n", DEFAULT_RETRY_INTERVAL);
ret->retry_interval = DEFAULT_RETRY_INTERVAL;
}
ret->cbl = cbl;
@@ -462,6 +462,6 @@ vehicle_gpsd_new_gpsd(struct vehicle_methods
void
plugin_init(void)
{
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
plugin_register_vehicle_type("gpsd", vehicle_gpsd_new_gpsd);
}
diff --git a/navit/vehicle/gpsd_dbus/vehicle_gpsd_dbus.c b/navit/vehicle/gpsd_dbus/vehicle_gpsd_dbus.c
index fb1a99727..c599d3cc4 100644
--- a/navit/vehicle/gpsd_dbus/vehicle_gpsd_dbus.c
+++ b/navit/vehicle/gpsd_dbus/vehicle_gpsd_dbus.c
@@ -114,7 +114,7 @@ vehicle_gpsd_dbus_open(struct vehicle_priv *priv)
priv->connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
}
if (!priv->connection) {
- dbg(0,"Failed to open connection to %s message bus: %s\n", priv->address?priv->address:"session",error.message);
+ dbg(lvl_error,"Failed to open connection to %s message bus: %s\n", priv->address?priv->address:"session",error.message);
dbus_error_free(&error);
return 0;
}
@@ -122,12 +122,12 @@ vehicle_gpsd_dbus_open(struct vehicle_priv *priv)
dbus_bus_add_match(priv->connection,"type='signal',interface='org.gpsd'",&error);
dbus_connection_flush(priv->connection);
if (dbus_error_is_set(&error)) {
- dbg(0,"Failed to add match to connection: %s\n", error.message);
+ dbg(lvl_error,"Failed to add match to connection: %s\n", error.message);
vehicle_gpsd_dbus_close(priv);
return 0;
}
if (!dbus_connection_add_filter(priv->connection, vehicle_gpsd_dbus_filter, priv, NULL)) {
- dbg(0,"Failed to add filter to connection\n");
+ dbg(lvl_error,"Failed to add filter to connection\n");
vehicle_gpsd_dbus_close(priv);
return 0;
}
@@ -187,7 +187,7 @@ vehicle_gpsd_dbus_set_attr_do(struct vehicle_priv *priv, struct attr *attr, int
switch (attr->type) {
case attr_source:
if (strncmp(vehicle_gpsd_dbus_prefix,attr->u.str,strlen(vehicle_gpsd_dbus_prefix))) {
- dbg(0,"source must start with '%s'\n", vehicle_gpsd_dbus_prefix);
+ dbg(lvl_error,"source must start with '%s'\n", vehicle_gpsd_dbus_prefix);
return 0;
}
g_free(priv->source);
@@ -243,6 +243,6 @@ vehicle_gpsd_dbus_new(struct vehicle_methods
void
plugin_init(void)
{
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
plugin_register_vehicle_type("gpsd_dbus", vehicle_gpsd_dbus_new);
}
diff --git a/navit/vehicle/gypsy/vehicle_gypsy.c b/navit/vehicle/gypsy/vehicle_gypsy.c
index 3fbb8baeb..f63312bda 100644
--- a/navit/vehicle/gypsy/vehicle_gypsy.c
+++ b/navit/vehicle/gypsy/vehicle_gypsy.c
@@ -286,7 +286,7 @@ vehicle_gypsy_try_open(gpointer *data)
}
vehicle_last = priv;
- dbg(0,"gypsy connected to %d\n", source+8);
+ dbg(lvl_error,"gypsy connected to %d\n", source+8);
g_free(source);
return FALSE;
}
@@ -457,11 +457,11 @@ vehicle_gypsy_new_gypsy(struct vehicle_methods *meth,
dbus_message_unref(message);
dbus_connection_unref(conn);
} else {
- dbg(0,"failed to connect to session bus\n");
+ dbg(lvl_error,"failed to connect to session bus\n");
}
}
#endif
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
source = attr_search(attrs, NULL, attr_source);
ret = g_new0(struct vehicle_priv, 1);
ret->have_cords = 0;
@@ -471,11 +471,11 @@ vehicle_gypsy_new_gypsy(struct vehicle_methods *meth,
if (retry_int) {
ret->retry_interval = retry_int->u.num;
if (ret->retry_interval < MIN_RETRY_INTERVAL) {
- dbg(0, "Retry interval %d too small, setting to %d\n", ret->retry_interval, MIN_RETRY_INTERVAL);
+ dbg(lvl_error, "Retry interval %d too small, setting to %d\n", ret->retry_interval, MIN_RETRY_INTERVAL);
ret->retry_interval = MIN_RETRY_INTERVAL;
}
} else {
- dbg(0, "Retry interval not defined, setting to %d\n", DEFAULT_RETRY_INTERVAL);
+ dbg(lvl_error, "Retry interval not defined, setting to %d\n", DEFAULT_RETRY_INTERVAL);
ret->retry_interval = DEFAULT_RETRY_INTERVAL;
}
ret->cbl = cbl;
@@ -492,6 +492,6 @@ vehicle_gypsy_new_gypsy(struct vehicle_methods *meth,
void
plugin_init(void)
{
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
plugin_register_vehicle_type("gypsy", vehicle_gypsy_new_gypsy);
}
diff --git a/navit/vehicle/iphone/vehicle_iphone.c b/navit/vehicle/iphone/vehicle_iphone.c
index e69747a1c..ad5fd6ea1 100644
--- a/navit/vehicle/iphone/vehicle_iphone.c
+++ b/navit/vehicle/iphone/vehicle_iphone.c
@@ -119,7 +119,7 @@ vehicle_iphone_update(void *arg,
strcpy(priv->str_time, str_time);
priv->radius = radius;
- dbg(0,"position_get lat:%f lng:%f (spd:%f dir:%f time:%s)\n", priv->geo.lat, priv->geo.lng, priv->speed, priv->direction, priv->str_time);
+ dbg(lvl_error,"position_get lat:%f lng:%f (spd:%f dir:%f time:%s)\n", priv->geo.lat, priv->geo.lng, priv->speed, priv->direction, priv->str_time);
callback_list_call_attr_0(priv->cbl, attr_position_coord_geo);
}
@@ -133,7 +133,7 @@ vehicle_iphone_new(struct vehicle_methods
struct vehicle_priv *ret;
struct attr *interval,*speed,*position_coord_geo;
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
ret = g_new0(struct vehicle_priv, 1);
ret->cbl = cbl;
ret->interval=1000;
@@ -146,7 +146,7 @@ vehicle_iphone_new(struct vehicle_methods
if ((position_coord_geo=attr_search(attrs, NULL, attr_position_coord_geo))) {
ret->geo=*(position_coord_geo->u.coord_geo);
ret->position_set=1;
- dbg(0,"position_set %f %f\n", ret->geo.lat, ret->geo.lng);
+ dbg(lvl_error,"position_set %f %f\n", ret->geo.lat, ret->geo.lng);
}
*meth = vehicle_iphone_methods;
ret->str_time[0] = '\0';
@@ -160,6 +160,6 @@ vehicle_iphone_new(struct vehicle_methods
void
plugin_init(void)
{
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
plugin_register_vehicle_type("iphone", vehicle_iphone_new);
}
diff --git a/navit/vehicle/maemo/vehicle_maemo.c b/navit/vehicle/maemo/vehicle_maemo.c
index ff5fd5e81..67a311862 100644
--- a/navit/vehicle/maemo/vehicle_maemo.c
+++ b/navit/vehicle/maemo/vehicle_maemo.c
@@ -67,7 +67,7 @@ static void vehicle_maemo_callback(LocationGPSDevice *device, gpointer user_data
priv->sats_used=device->satellites_in_use;
callback_list_call_attr_0(priv->cbl, attr_position_sats);
- dbg(1,"Got update with %u/%u satellites\n",priv->sats_used,priv->sats);
+ dbg(lvl_warning,"Got update with %u/%u satellites\n",priv->sats_used,priv->sats);
if (device->fix) {
switch(device->fix->mode) {
@@ -86,28 +86,28 @@ static void vehicle_maemo_callback(LocationGPSDevice *device, gpointer user_data
priv->geo.lng=device->fix->longitude;
priv->hdop=device->fix->eph/100;
callback_list_call_attr_0(priv->cbl, attr_position_coord_geo);
- dbg(1,"Position: %f %f with error %f meters\n",priv->geo.lat,priv->geo.lng,priv->hdop);
+ dbg(lvl_warning,"Position: %f %f with error %f meters\n",priv->geo.lat,priv->geo.lng,priv->hdop);
}
if (device->fix->fields & LOCATION_GPS_DEVICE_SPEED_SET) {
priv->speed=device->fix->speed;
callback_list_call_attr_0(priv->cbl, attr_position_speed);
- dbg(1,"Speed: %f\n ",priv->speed);
+ dbg(lvl_warning,"Speed: %f\n ",priv->speed);
}
if (device->fix->fields & LOCATION_GPS_DEVICE_TRACK_SET) {
priv->direction=device->fix->track;
- dbg(1,"Direction: %f\n",priv->direction);
+ dbg(lvl_warning,"Direction: %f\n",priv->direction);
}
if (device->fix->fields & LOCATION_GPS_DEVICE_TIME_SET) {
priv->fix_time=device->fix->time;
- dbg(1,"Time: %f\n",priv->fix_time);
+ dbg(lvl_warning,"Time: %f\n",priv->fix_time);
}
if (device->fix->fields & LOCATION_GPS_DEVICE_ALTITUDE_SET) {
priv->height=device->fix->altitude;
- dbg(1,"Elevation: %f\n",priv->height);
+ dbg(lvl_warning,"Elevation: %f\n",priv->height);
}
}
@@ -119,19 +119,19 @@ static void vehicle_maemo_error(LocationGPSDControl *control, LocationGPSDContro
{
switch (error) {
case LOCATION_ERROR_USER_REJECTED_DIALOG:
- dbg(0,"User didn't enable requested methods\n");
+ dbg(lvl_error,"User didn't enable requested methods\n");
break;
case LOCATION_ERROR_USER_REJECTED_SETTINGS:
- dbg(0,"User changed settings, which disabled location\n");
+ dbg(lvl_error,"User changed settings, which disabled location\n");
break;
case LOCATION_ERROR_BT_GPS_NOT_AVAILABLE:
- dbg(0,"Problems with BT GPS\n");
+ dbg(lvl_error,"Problems with BT GPS\n");
break;
case LOCATION_ERROR_METHOD_NOT_ALLOWED_IN_OFFLINE_MODE:
- dbg(0,"Requested method is not allowed in offline mode\n");
+ dbg(lvl_error,"Requested method is not allowed in offline mode\n");
break;
case LOCATION_ERROR_SYSTEM:
- dbg(0,"System error\n");
+ dbg(lvl_error,"System error\n");
break;
}
}
@@ -148,54 +148,54 @@ vehicle_maemo_open(struct vehicle_priv *priv)
if (!strcasecmp(priv->source+8,"cwp")) {
g_object_set(G_OBJECT(priv->control), "preferred-method", LOCATION_METHOD_CWP, NULL);
- dbg(1,"Method set: CWP\n");
+ dbg(lvl_warning,"Method set: CWP\n");
} else if (!strcasecmp(priv->source+8,"acwp")) {
g_object_set(G_OBJECT(priv->control), "preferred-method", LOCATION_METHOD_ACWP, NULL);
- dbg(1,"Method set: ACWP\n");
+ dbg(lvl_warning,"Method set: ACWP\n");
} else if (!strcasecmp(priv->source+8,"gnss")) {
g_object_set(G_OBJECT(priv->control), "preferred-method", LOCATION_METHOD_GNSS, NULL);
- dbg(1,"Method set: GNSS\n");
+ dbg(lvl_warning,"Method set: GNSS\n");
} else if (!strcasecmp(priv->source+8,"agnss")) {
g_object_set(G_OBJECT(priv->control), "preferred-method", LOCATION_METHOD_AGNSS, NULL);
- dbg(1,"Method set: AGNSS\n");
+ dbg(lvl_warning,"Method set: AGNSS\n");
} else {
g_object_set(G_OBJECT(priv->control), "preferred-method", LOCATION_METHOD_USER_SELECTED, NULL);
- dbg(1,"Method set: ANY\n");
+ dbg(lvl_warning,"Method set: ANY\n");
}
switch (priv->retry_interval) {
case 2:
g_object_set(G_OBJECT(priv->control), "preferred-interval", LOCATION_INTERVAL_2S, NULL);
- dbg(1,"Interval set: 2s\n");
+ dbg(lvl_warning,"Interval set: 2s\n");
break;
case 5:
g_object_set(G_OBJECT(priv->control), "preferred-interval", LOCATION_INTERVAL_5S, NULL);
- dbg(1,"Interval set: 5s\n");
+ dbg(lvl_warning,"Interval set: 5s\n");
break;
case 10:
g_object_set(G_OBJECT(priv->control), "preferred-interval", LOCATION_INTERVAL_10S, NULL);
- dbg(1,"Interval set: 10s\n");
+ dbg(lvl_warning,"Interval set: 10s\n");
break;
case 20:
g_object_set(G_OBJECT(priv->control), "preferred-interval", LOCATION_INTERVAL_20S, NULL);
- dbg(1,"Interval set: 20s\n");
+ dbg(lvl_warning,"Interval set: 20s\n");
break;
case 30:
g_object_set(G_OBJECT(priv->control), "preferred-interval", LOCATION_INTERVAL_30S, NULL);
- dbg(1,"Interval set: 30s\n");
+ dbg(lvl_warning,"Interval set: 30s\n");
break;
case 60:
g_object_set(G_OBJECT(priv->control), "preferred-interval", LOCATION_INTERVAL_60S, NULL);
- dbg(1,"Interval set: 60s\n");
+ dbg(lvl_warning,"Interval set: 60s\n");
break;
case 120:
g_object_set(G_OBJECT(priv->control), "preferred-interval", LOCATION_INTERVAL_120S, NULL);
- dbg(1,"Interval set: 120s\n");
+ dbg(lvl_warning,"Interval set: 120s\n");
break;
case 1:
default:
g_object_set(G_OBJECT(priv->control), "preferred-interval", LOCATION_INTERVAL_1S, NULL);
- dbg(1,"Interval set: 1s\n");
+ dbg(lvl_warning,"Interval set: 1s\n");
break;
}
@@ -225,41 +225,41 @@ vehicle_maemo_position_attr_get(struct vehicle_priv *priv,
struct attr * active=NULL;
switch (type) {
case attr_position_fix_type:
- dbg(1,"Attr requested: position_fix_type\n");
+ dbg(lvl_warning,"Attr requested: position_fix_type\n");
attr->u.num = priv->fix_type;
break;
case attr_position_height:
- dbg(1,"Attr requested: position_height\n");
+ dbg(lvl_warning,"Attr requested: position_height\n");
attr->u.numd = &priv->height;
break;
case attr_position_speed:
- dbg(1,"Attr requested: position_speed\n");
+ dbg(lvl_warning,"Attr requested: position_speed\n");
attr->u.numd = &priv->speed;
break;
case attr_position_direction:
- dbg(1,"Attr requested: position_direction\n");
+ dbg(lvl_warning,"Attr requested: position_direction\n");
attr->u.numd = &priv->direction;
break;
case attr_position_hdop:
- dbg(1,"Attr requested: position_hdop\n");
+ dbg(lvl_warning,"Attr requested: position_hdop\n");
attr->u.numd = &priv->hdop;
break;
case attr_position_sats:
- dbg(1,"Attr requested: position_sats\n");
+ dbg(lvl_warning,"Attr requested: position_sats\n");
attr->u.num = priv->sats;
break;
case attr_position_sats_used:
- dbg(1,"Attr requested: position_sats_used\n");
+ dbg(lvl_warning,"Attr requested: position_sats_used\n");
attr->u.num = priv->sats_used;
break;
case attr_position_coord_geo:
- dbg(1,"Attr requested: position_coord_geo\n");
+ dbg(lvl_warning,"Attr requested: position_coord_geo\n");
attr->u.coord_geo = &priv->geo;
break;
case attr_position_time_iso8601:
{
struct tm tm;
- dbg(1,"Attr requested: position_time_iso8601\n");
+ dbg(lvl_warning,"Attr requested: position_time_iso8601\n");
if (!priv->fix_time)
return 0;
if (gmtime_r(&priv->fix_time, &tm)) {
@@ -271,7 +271,7 @@ vehicle_maemo_position_attr_get(struct vehicle_priv *priv,
}
break;
case attr_active:
- dbg(1,"Attr requested: position_active\n");
+ dbg(lvl_warning,"Attr requested: position_active\n");
active = attr_search(priv->attrs,NULL,attr_active);
if(active != NULL) {
attr->u.num=active->u.num;
@@ -299,7 +299,7 @@ vehicle_maemo_new_maemo(struct vehicle_methods
struct vehicle_priv *ret;
struct attr *source, *retry_int;
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
source = attr_search(attrs, NULL, attr_source);
ret = g_new0(struct vehicle_priv, 1);
ret->source = g_strdup(source->u.str);
@@ -307,13 +307,13 @@ vehicle_maemo_new_maemo(struct vehicle_methods
if (retry_int) {
ret->retry_interval = retry_int->u.num;
if (ret->retry_interval !=1 && ret->retry_interval !=2 && ret->retry_interval !=5 && ret->retry_interval !=10 && ret->retry_interval !=20 && ret->retry_interval !=30 && ret->retry_interval !=60 && ret->retry_interval !=120 ) {
- dbg(0, "Retry interval %d invalid, setting to 1\n", ret->retry_interval,1);
+ dbg(lvl_error, "Retry interval %d invalid, setting to 1\n", ret->retry_interval,1);
ret->retry_interval = 1;
}
} else {
ret->retry_interval = 1;
}
- dbg(1,"source: %s, interval: %u\n",ret->source,ret->retry_interval);
+ dbg(lvl_warning,"source: %s, interval: %u\n",ret->source,ret->retry_interval);
ret->cbl = cbl;
*meth = vehicle_maemo_methods;
ret->attrs = attrs;
@@ -324,6 +324,6 @@ vehicle_maemo_new_maemo(struct vehicle_methods
void
plugin_init(void)
{
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
plugin_register_vehicle_type("maemo", vehicle_maemo_new_maemo);
}
diff --git a/navit/vehicle/null/vehicle_null.c b/navit/vehicle/null/vehicle_null.c
index 79d15bcd2..30e9a4d97 100644
--- a/navit/vehicle/null/vehicle_null.c
+++ b/navit/vehicle/null/vehicle_null.c
@@ -59,7 +59,7 @@ struct vehicle_priv {
static void
vehicle_null_destroy(struct vehicle_priv *priv)
{
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
g_free(priv);
}
@@ -75,7 +75,7 @@ static int
vehicle_null_position_attr_get(struct vehicle_priv *priv,
enum attr_type type, struct attr *attr)
{
- dbg(1,"enter %s\n",attr_to_name(type));
+ dbg(lvl_warning,"enter %s\n",attr_to_name(type));
switch (type) {
#if 0
case attr_position_fix_type:
@@ -114,7 +114,7 @@ vehicle_null_position_attr_get(struct vehicle_priv *priv,
default:
return 0;
}
- dbg(1,"ok\n");
+ dbg(lvl_warning,"ok\n");
attr->type = type;
return 1;
}
@@ -162,11 +162,11 @@ vehicle_null_new_null(struct vehicle_methods *meth,
{
struct vehicle_priv *ret;
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
ret = g_new0(struct vehicle_priv, 1);
ret->cbl = cbl;
*meth = vehicle_null_methods;
- dbg(1, "return\n");
+ dbg(lvl_warning, "return\n");
return ret;
}
@@ -178,6 +178,6 @@ vehicle_null_new_null(struct vehicle_methods *meth,
void
plugin_init(void)
{
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
plugin_register_vehicle_type("null", vehicle_null_new_null);
}
diff --git a/navit/vehicle/webos/bluetooth.c b/navit/vehicle/webos/bluetooth.c
index 122711415..13534237d 100644
--- a/navit/vehicle/webos/bluetooth.c
+++ b/navit/vehicle/webos/bluetooth.c
@@ -25,10 +25,10 @@ static void
mlPDL_ServiceCall_callback(struct callback_list *cbl, char *service, char *parameters/*, struct callback *fail_cb*/)
{
PDL_Err err;
- dbg(1,"PDL_ServiceCall(%s) parameters(%s)\n",service,parameters);
+ dbg(lvl_warning,"PDL_ServiceCall(%s) parameters(%s)\n",service,parameters);
err = PDL_ServiceCall(service, parameters);
if (err != PDL_NOERROR) {
- dbg(0,"PDL_ServiceCall to (%s) with (%s) failed with (%d): (%s)\n", service, parameters, err, PDL_GetError());
+ dbg(lvl_error,"PDL_ServiceCall to (%s) with (%s) failed with (%d): (%s)\n", service, parameters, err, PDL_GetError());
}
callback_list_destroy(cbl);
@@ -50,7 +50,7 @@ mlPDL_ServiceCall(const char *service, const char *parameters/*, struct callback
callback_list_add(cbl, cb);
-dbg(0,"event_call_callback(%p)\n",cbl);
+dbg(lvl_error,"event_call_callback(%p)\n",cbl);
event_call_callback(cbl);
}
@@ -65,10 +65,10 @@ mlPDL_ServiceCallWithCallback_callback(struct callback_list *cbl,
PDL_bool removeAfterResponse)
{
PDL_Err err;
- dbg(1,"PDL_ServiceCallWithCallback(%s) parameters(%s)\n",service,parameters);
+ dbg(lvl_warning,"PDL_ServiceCallWithCallback(%s) parameters(%s)\n",service,parameters);
err = PDL_ServiceCallWithCallback(service, parameters, callback, user, removeAfterResponse);
if (err != PDL_NOERROR) {
- dbg(0,"PDL_ServiceCallWithCallback to (%s) with (%s) failed with (%d): (%s)\n", service, parameters, err, PDL_GetError());
+ dbg(lvl_error,"PDL_ServiceCallWithCallback to (%s) with (%s) failed with (%d): (%s)\n", service, parameters, err, PDL_GetError());
}
callback_list_destroy(cbl);
@@ -94,7 +94,7 @@ mlPDL_ServiceCallWithCallback(const char *service,
callback_list_add(cbl, cb);
- dbg(0,"event_call_callback(%p)\n",cbl);
+ dbg(lvl_error,"event_call_callback(%p)\n",cbl);
event_call_callback(cbl);
}
@@ -107,11 +107,11 @@ vehicle_webos_init_pdl_locationtracking_callback(struct vehicle_priv *priv, stru
priv->gps_type = param ? GPS_TYPE_INT: GPS_TYPE_NONE;
- dbg(1,"Calling PDL_EnableLocationTracking(%i)\n",param);
+ dbg(lvl_warning,"Calling PDL_EnableLocationTracking(%i)\n",param);
err = PDL_EnableLocationTracking(param);
if (err != PDL_NOERROR) {
- dbg(0,"PDL_EnableLocationTracking failed with (%d): (%s)\n", err, PDL_GetError());
+ dbg(lvl_error,"PDL_EnableLocationTracking failed with (%d): (%s)\n", err, PDL_GetError());
// vehicle_webos_close(priv);
// return 0;
}
@@ -146,10 +146,10 @@ vehicle_webos_parse_nmea(struct vehicle_priv *priv, char *buffer)
int valid=0;
int ret = 0;
- dbg(2, "enter: buffer='%s'\n", buffer);
+ dbg(lvl_info, "enter: buffer='%s'\n", buffer);
for (;;) {
if (len < 4) {
- dbg(0, "'%s' too short\n", buffer);
+ dbg(lvl_error, "'%s' too short\n", buffer);
return ret;
}
if (buffer[len - 1] == '\r' || buffer[len - 1] == '\n') {
@@ -160,22 +160,22 @@ vehicle_webos_parse_nmea(struct vehicle_priv *priv, char *buffer)
break;
}
if (buffer[0] != '$') {
- dbg(0, "no leading $ in '%s'\n", buffer);
+ dbg(lvl_error, "no leading $ in '%s'\n", buffer);
return ret;
}
if (buffer[len - 3] != '*') {
- dbg(0, "no *XX in '%s'\n", buffer);
+ dbg(lvl_error, "no *XX in '%s'\n", buffer);
return ret;
}
for (i = 1; i < len - 3; i++) {
csum ^= (unsigned char) (buffer[i]);
}
if (!sscanf(buffer + len - 2, "%x", &bcsum) /*&& priv->checksum_ignore != 2*/) {
- dbg(0, "no checksum in '%s'\n", buffer);
+ dbg(lvl_error, "no checksum in '%s'\n", buffer);
return ret;
}
if (bcsum != csum /*&& priv->checksum_ignore == 0*/) {
- dbg(0, "wrong checksum in '%s was %x should be %x'\n", buffer,bcsum,csum);
+ dbg(lvl_error, "wrong checksum in '%s was %x should be %x'\n", buffer,bcsum,csum);
return ret;
}
@@ -184,7 +184,7 @@ vehicle_webos_parse_nmea(struct vehicle_priv *priv, char *buffer)
g_free(priv->nmea_data_buf);
priv->nmea_data_buf=nmea_data_buf;
} else {
- dbg(0, "nmea buffer overflow, discarding '%s'\n", buffer);
+ dbg(lvl_error, "nmea buffer overflow, discarding '%s'\n", buffer);
}
i = 0;
p = buffer;
@@ -203,7 +203,7 @@ vehicle_webos_parse_nmea(struct vehicle_priv *priv, char *buffer)
priv->delta = 0; // (unsigned int)difftime(tv.tv_sec, priv->fix_time);
// priv->fix_time = tv.tv_sec;
-// dbg(2,"delta(%i)\n",priv->delta);
+// dbg(lvl_info,"delta(%i)\n",priv->delta);
// }
if (!strncmp(buffer, "$GPGGA", 6)) {
@@ -230,7 +230,7 @@ vehicle_webos_parse_nmea(struct vehicle_priv *priv, char *buffer)
if (!g_strcasecmp(item[5],"W"))
priv->geo.lng=-priv->geo.lng;
priv->valid=attr_position_valid_valid;
- dbg(2, "latitude '%2.4f' longitude %2.4f\n", priv->geo.lat, priv->geo.lng);
+ dbg(lvl_info, "latitude '%2.4f' longitude %2.4f\n", priv->geo.lat, priv->geo.lng);
} else
priv->valid=attr_position_valid_invalid;
@@ -275,7 +275,7 @@ vehicle_webos_parse_nmea(struct vehicle_priv *priv, char *buffer)
if (valid) {
priv->track = g_ascii_strtod( item[1], NULL );
priv->speed = g_ascii_strtod( item[7], NULL );
- dbg(2,"direction %lf, speed %2.1lf\n", priv->track, priv->speed);
+ dbg(lvl_info,"direction %lf, speed %2.1lf\n", priv->track, priv->speed);
}
}
if (!strncmp(buffer, "$GPRMC", 6)) {
@@ -380,7 +380,7 @@ vehicle_webos_parse_nmea(struct vehicle_priv *priv, char *buffer)
*/
if (item[1]) {
priv->magnetic_direction = g_ascii_strtod( item[1], NULL );
- dbg(1,"magnetic %d\n", priv->magnetic_direction);
+ dbg(lvl_warning,"magnetic %d\n", priv->magnetic_direction);
}
}
return ret;
@@ -396,14 +396,14 @@ vehicle_webos_spp_handle_read(PDL_ServiceParameters *params, void *user)
//PDL_Err err;
size = PDL_GetParamInt(params, "dataLength");
if (size > buffer_size) {
- dbg(0, "read returned too much data\n");
+ dbg(lvl_error, "read returned too much data\n");
return;
}
char buffer[buffer_size];
PDL_GetParamString(params,"data",buffer,buffer_size);
- dbg(9,"data(%s) dataLength(%i)\n",buffer,size);
+ dbg(lvl_debug,"data(%s) dataLength(%i)\n",buffer,size);
memmove(priv->buffer + priv->buffer_pos, buffer, size);
@@ -411,12 +411,12 @@ vehicle_webos_spp_handle_read(PDL_ServiceParameters *params, void *user)
priv->buffer_pos += size;
priv->buffer[priv->buffer_pos] = '\0';
- dbg(1, "size=%d pos=%d buffer='%s'\n", size,
+ dbg(lvl_warning, "size=%d pos=%d buffer='%s'\n", size,
priv->buffer_pos, priv->buffer);
str = priv->buffer;
while ((tok = strchr(str, '\n'))) {
*tok++ = '\0';
- dbg(1, "line='%s'\n", str);
+ dbg(lvl_warning, "line='%s'\n", str);
rc += vehicle_webos_parse_nmea(priv, str);
str = tok;
// if (priv->file_type == file_type_file && rc)
@@ -427,10 +427,10 @@ vehicle_webos_spp_handle_read(PDL_ServiceParameters *params, void *user)
size = priv->buffer + priv->buffer_pos - str;
memmove(priv->buffer, str, size + 1);
priv->buffer_pos = size;
- dbg(1,"now pos=%d buffer='%s'\n",
+ dbg(lvl_warning,"now pos=%d buffer='%s'\n",
priv->buffer_pos, priv->buffer);
} else if (priv->buffer_pos == buffer_size - 1) {
- dbg(0,"Overflow. Most likely wrong baud rate or no nmea protocol\n");
+ dbg(lvl_error,"Overflow. Most likely wrong baud rate or no nmea protocol\n");
priv->buffer_pos = 0;
}
if (rc) {
@@ -466,7 +466,7 @@ vehicle_webos_spp_init_read(struct vehicle_priv *priv, unsigned int length)
);
#if 0
if (err != PDL_NOERROR) {
- dbg(0,"PDL_ServiceCall failed with (%d): (%s)\n", err, PDL_GetError());
+ dbg(lvl_error,"PDL_ServiceCall failed with (%d): (%s)\n", err, PDL_GetError());
vehicle_webos_close(priv);
return;
}
@@ -481,7 +481,7 @@ vehicle_webos_spp_handle_open(PDL_ServiceParameters *params, void *user)
if (!priv->buffer)
priv->buffer = g_malloc(buffer_size);
- dbg(1,"instanceId(%i)\n",priv->spp_instance_id);
+ dbg(lvl_warning,"instanceId(%i)\n",priv->spp_instance_id);
priv->gps_type = GPS_TYPE_BT;
@@ -497,27 +497,27 @@ vehicle_webos_spp_notify(PDL_ServiceParameters *params, void *user)
char parameters[128];
const char *params_json = PDL_GetParamJson(params);
- dbg(2,"params_json(%s)\n", params_json);
+ dbg(lvl_info,"params_json(%s)\n", params_json);
if (PDL_ParamExists(params, "errorText")) {
PDL_GetParamString(params, "errorText", notification, sizeof(notification));
- dbg(0,"errorText(%s)\n",notification);
+ dbg(lvl_error,"errorText(%s)\n",notification);
return;
}
PDL_GetParamString(params, "notification", notification, sizeof(notification));
notification[sizeof(notification)-1] = '\0';
- dbg(1,"notification(%s) %i\n",notification,PDL_ParamExists(params, "notification"));
+ dbg(lvl_warning,"notification(%s) %i\n",notification,PDL_ParamExists(params, "notification"));
if(strcmp(notification,"notifnservicenames") == 0) {
int instance_id = PDL_GetParamInt(params, "instanceId");
- dbg(1,"instanceId(%i)\n", instance_id);
+ dbg(lvl_warning,"instanceId(%i)\n", instance_id);
cJSON *root = cJSON_Parse(params_json);
if (!root) {
- dbg(0,"parsing json failed\n");
+ dbg(lvl_error,"parsing json failed\n");
return;
}
@@ -544,7 +544,7 @@ vehicle_webos_spp_notify(PDL_ServiceParameters *params, void *user)
PDL_TRUE);
}
else {
- dbg(0,"notifnconnected error(%i)\n",PDL_GetParamInt(params,"error"));
+ dbg(lvl_error,"notifnconnected error(%i)\n",PDL_GetParamInt(params,"error"));
}
}
else if(strcmp(notification,"notifndisconnected") == 0) {
@@ -563,7 +563,7 @@ vehicle_webos_init_bt_gps(struct vehicle_priv *priv, char *addr)
{
char parameters[128];
- dbg(1,"subscribeNotifications\n");
+ dbg(lvl_warning,"subscribeNotifications\n");
mlPDL_ServiceCallWithCallback("palm://com.palm.bluetooth/spp/subscribenotifications",
"{\"subscribe\":true}",
(PDL_ServiceCallbackFunc)vehicle_webos_spp_notify,
@@ -571,7 +571,7 @@ vehicle_webos_init_bt_gps(struct vehicle_priv *priv, char *addr)
PDL_FALSE);
#if 0
if (err != PDL_NOERROR) {
- dbg(0,"PDL_ServiceCallWithCallback failed with (%d): (%s)\n", err, PDL_GetError());
+ dbg(lvl_error,"PDL_ServiceCallWithCallback failed with (%d): (%s)\n", err, PDL_GetError());
vehicle_webos_close(priv);
return;
}
@@ -581,7 +581,7 @@ vehicle_webos_init_bt_gps(struct vehicle_priv *priv, char *addr)
mlPDL_ServiceCall("palm://com.palm.bluetooth/spp/connect", parameters);
#if 0
if (err != PDL_NOERROR) {
- dbg(0,"PDL_ServiceCall failed with (%d): (%s)\n", err, PDL_GetError());
+ dbg(lvl_error,"PDL_ServiceCall failed with (%d): (%s)\n", err, PDL_GetError());
vehicle_webos_close(priv);
return;
}
@@ -598,38 +598,38 @@ vehicle_webos_bt_gap_callback(PDL_ServiceParameters *params, void *param)
char *device_addr = NULL;
cJSON *root;
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
PDL_Err err;
err = PDL_GetParamInt(params, "errorCode");
if (err != PDL_NOERROR) {
- dbg(0,"BT GAP Callback errorCode %d\n", err);
+ dbg(lvl_error,"BT GAP Callback errorCode %d\n", err);
return /*PDL_EOTHER*/;
}
params_json = PDL_GetParamJson(params);
- dbg(2,"params_json(%s)\n",params_json);
+ dbg(lvl_info,"params_json(%s)\n",params_json);
root = cJSON_Parse(params_json);
if (!root) {
- dbg(0,"parsing json failed\n");
+ dbg(lvl_error,"parsing json failed\n");
return;
}
cJSON *trusted_devices = cJSON_GetObjectItem(root, "trusteddevices");
unsigned int i,c = cJSON_GetArraySize(trusted_devices);
- dbg(1, "trusted_devices(%i)\n",c);
+ dbg(lvl_warning, "trusted_devices(%i)\n",c);
for(i=0; i < c && !device_addr; i++) {
cJSON *device = cJSON_GetArrayItem(trusted_devices,i);
char *name = cJSON_GetObjectItem(device, "name")->valuestring;
char *address = cJSON_GetObjectItem(device, "address")->valuestring;
char *status = cJSON_GetObjectItem(device, "status")->valuestring;
- dbg(1,"i(%i) name(%s) address(%s) status(%s)\n",i,name,address,status);
+ dbg(lvl_warning,"i(%i) name(%s) address(%s) status(%s)\n",i,name,address,status);
if (/*strncmp(status, "connected",9) == 0 && */strstr(name, "GPS") != NULL) {
- dbg(1,"choose name(%s) address(%s)\n",name,address);
+ dbg(lvl_warning,"choose name(%s) address(%s)\n",name,address);
device_addr = g_strdup(address);
break;
}
@@ -649,7 +649,7 @@ vehicle_webos_bt_open(struct vehicle_priv *priv)
{
// Try to connect to BT GPS, or use PDL method
- dbg(1,"enter\n");
+ dbg(lvl_warning,"enter\n");
PDL_Err err;
err = PDL_ServiceCallWithCallback("palm://com.palm.bluetooth/gap/gettrusteddevices",
@@ -658,7 +658,7 @@ vehicle_webos_bt_open(struct vehicle_priv *priv)
priv,
PDL_TRUE);
if (err != PDL_NOERROR) {
- dbg(0,"PDL_ServiceCallWithCallback failed with (%d): (%s)\n", err, PDL_GetError());
+ dbg(lvl_error,"PDL_ServiceCallWithCallback failed with (%d): (%s)\n", err, PDL_GetError());
vehicle_webos_close(priv);
return 0;
}
@@ -668,7 +668,7 @@ vehicle_webos_bt_open(struct vehicle_priv *priv)
void
vehicle_webos_bt_close(struct vehicle_priv *priv)
{
- dbg(0,"XXX\n");
+ dbg(lvl_error,"XXX\n");
char parameters[128];
if (priv->spp_instance_id) {
snprintf(parameters, sizeof(parameters), "{\"instanceId\":%i}", priv->spp_instance_id);
diff --git a/navit/vehicle/webos/vehicle_webos.c b/navit/vehicle/webos/vehicle_webos.c
index bfbf11338..f4fcb0f90 100644
--- a/navit/vehicle/webos/vehicle_webos.c
+++ b/navit/vehicle/webos/vehicle_webos.c
@@ -51,7 +51,7 @@ vehicle_webos_callback(PDL_ServiceParameters *params, void *priv)
err = PDL_GetParamInt(params, "errorCode");
if (err != 0) {
- dbg(0,"Location Callback errorCode %d\n", err);
+ dbg(lvl_error,"Location Callback errorCode %d\n", err);
return /*PDL_EOTHER*/;
}
@@ -85,14 +85,14 @@ vehicle_webos_gps_update(struct vehicle_priv *priv, PDL_Location *location)
gettimeofday(&tv,NULL);
priv->delta = (int)difftime(tv.tv_sec, priv->fix_time);
- dbg(2,"delta(%i)\n",priv->delta);
+ dbg(lvl_info,"delta(%i)\n",priv->delta);
priv->fix_time = tv.tv_sec;
priv->geo.lat = location->latitude;
/* workaround for webOS GPS bug following */
priv->geo.lng = (priv->pdk_version >= 200 && location->longitude >= -1 && location->longitude <= 1) ?
-location->longitude : location->longitude;
- dbg(2,"Location: %f %f %f %.12g %.12g +-%fm\n",
+ dbg(lvl_info,"Location: %f %f %f %.12g %.12g +-%fm\n",
location->altitude,
location->velocity,
location->heading,
@@ -126,7 +126,7 @@ vehicle_webos_timeout_callback(struct vehicle_priv *priv)
int delta = (int)difftime(tv.tv_sec, priv->fix_time);
if (delta >= priv->delta*2) {
- dbg(1, "GPS timeout triggered cb(%p) delta(%d)\n", priv->timeout_cb, delta);
+ dbg(lvl_warning, "GPS timeout triggered cb(%p) delta(%d)\n", priv->timeout_cb, delta);
priv->delta = -1;
@@ -157,7 +157,7 @@ vehicle_webos_open(struct vehicle_priv *priv)
PDL_Err err;
priv->pdk_version = PDL_GetPDKVersion();
- dbg(1,"pdk_version(%d)\n", priv->pdk_version);
+ dbg(lvl_warning,"pdk_version(%d)\n", priv->pdk_version);
if (priv->pdk_version <= 100) {
// Use Location Service via callback interface
@@ -167,7 +167,7 @@ vehicle_webos_open(struct vehicle_priv *priv)
priv,
PDL_FALSE);
if (err != PDL_NOERROR) {
- dbg(0,"PDL_ServiceCallWithCallback failed with (%d): (%s)\n", err, PDL_GetError());
+ dbg(lvl_error,"PDL_ServiceCallWithCallback failed with (%d): (%s)\n", err, PDL_GetError());
vehicle_webos_close(priv);
return 0;
}
@@ -176,7 +176,7 @@ vehicle_webos_open(struct vehicle_priv *priv)
PDL_Err err;
err = PDL_EnableLocationTracking(PDL_TRUE);
if (err != PDL_NOERROR) {
- dbg(0,"PDL_EnableLocationTracking failed with (%d): (%s)\n", err, PDL_GetError());
+ dbg(lvl_error,"PDL_EnableLocationTracking failed with (%d): (%s)\n", err, PDL_GetError());
// vehicle_webos_close(priv);
// return 0;
}
@@ -206,15 +206,15 @@ vehicle_webos_position_attr_get(struct vehicle_priv *priv,
{
switch (type) {
case attr_position_height:
- dbg(2,"Altitude: %f\n", priv->altitude);
+ dbg(lvl_info,"Altitude: %f\n", priv->altitude);
attr->u.numd = &priv->altitude;
break;
case attr_position_speed:
- dbg(2,"Speed: %f\n", priv->speed);
+ dbg(lvl_info,"Speed: %f\n", priv->speed);
attr->u.numd = &priv->speed;
break;
case attr_position_direction:
- dbg(2,"Direction: %f\n", priv->track);
+ dbg(lvl_info,"Direction: %f\n", priv->track);
attr->u.numd = &priv->track;
break;
case attr_position_magnetic_direction:
@@ -238,11 +238,11 @@ vehicle_webos_position_attr_get(struct vehicle_priv *priv,
}
break;
case attr_position_coord_geo:
- dbg(2,"Coord: %.12g %.12g\n", priv->geo.lat, priv->geo.lng);
+ dbg(lvl_info,"Coord: %.12g %.12g\n", priv->geo.lat, priv->geo.lng);
attr->u.coord_geo = &priv->geo;
break;
case attr_position_radius:
- dbg(2,"Radius: %f\n", priv->radius);
+ dbg(lvl_info,"Radius: %f\n", priv->radius);
attr->u.numd = &priv->radius;
break;
case attr_position_time_iso8601:
@@ -257,10 +257,10 @@ vehicle_webos_position_attr_get(struct vehicle_priv *priv,
priv->fix_time = 0;
return 0;
}
- dbg(2,"Fix Time: %d %s\n", priv->fix_time, priv->fixiso8601);
+ dbg(lvl_info,"Fix Time: %d %s\n", priv->fix_time, priv->fixiso8601);
}
else {
- dbg(2,"Fix Time: %d\n", priv->fix_time);
+ dbg(lvl_info,"Fix Time: %d\n", priv->fix_time);
return 0;
}
@@ -318,7 +318,7 @@ vehicle_webos_set_attr_do(struct vehicle_priv *priv, struct attr *attr, int init
switch (attr->type) {
case attr_source:
if (strncmp(vehicle_webos_prefix,attr->u.str,strlen(vehicle_webos_prefix))) {
- dbg(1,"source must start with '%s'\n", vehicle_webos_prefix);
+ dbg(lvl_warning,"source must start with '%s'\n", vehicle_webos_prefix);
return 0;
}
g_free(priv->source);
@@ -380,7 +380,7 @@ vehicle_webos_new(struct vehicle_methods
void
plugin_init(void)
{
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
plugin_register_vehicle_type("webos", vehicle_webos_new);
}
diff --git a/navit/vehicle/wince/vehicle_wince.c b/navit/vehicle/wince/vehicle_wince.c
index 1f3f42f43..be68cd940 100644
--- a/navit/vehicle/wince/vehicle_wince.c
+++ b/navit/vehicle/wince/vehicle_wince.c
@@ -146,7 +146,7 @@ static void initBth(struct vehicle_priv *priv)
priv->BthSetMode = (PFN_BthSetMode)GetProcAddress(priv->hBthDll, TEXT("BthSetMode") );
if( priv->BthSetMode && priv->BthSetMode(1) == ERROR_SUCCESS )
{
- dbg(1, "bluetooth activated\n");
+ dbg(lvl_warning, "bluetooth activated\n");
succeeded = TRUE;
}
}
@@ -154,13 +154,13 @@ static void initBth(struct vehicle_priv *priv)
}
else
{
- dbg(0, "Bluetooth library notfound\n");
+ dbg(lvl_error, "Bluetooth library notfound\n");
}
if ( !succeeded )
{
- dbg(1, "Bluetooth already enabled or failed to enable it.\n");
+ dbg(lvl_warning, "Bluetooth already enabled or failed to enable it.\n");
priv->BthSetMode = NULL;
if ( priv->hBthDll )
{
@@ -178,7 +178,7 @@ static int initDevice(struct vehicle_priv *priv)
if ( priv->file_type == file_type_device )
{
- dbg(0, "Init Device\n");
+ dbg(lvl_error, "Init Device\n");
/* GPD0 is the control port for the GPS driver */
hGPS = CreateFile(L"GPD0:", GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (hGPS != INVALID_HANDLE_VALUE) {
@@ -199,7 +199,7 @@ static int initDevice(struct vehicle_priv *priv)
NULL, OPEN_EXISTING, 0, 0)) == INVALID_HANDLE_VALUE)
{
Sleep(1000);
- dbg(0, "Waiting to connect to %s\n", priv->source);
+ dbg(lvl_error, "Waiting to connect to %s\n", priv->source);
}
GetCommTimeouts (priv->m_hGPSDevice, &commTiming);
commTiming.ReadIntervalTimeout = 20;
@@ -230,11 +230,11 @@ static int initDevice(struct vehicle_priv *priv)
}
else
{
- dbg(0, "Open File\n");
+ dbg(lvl_error, "Open File\n");
priv->m_hGPSDevice = CreateFileW( A2W(priv->source),
GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0);
if ( priv->m_hGPSDevice == INVALID_HANDLE_VALUE) {
- dbg(0, "Could not open %s\n", priv->source);
+ dbg(lvl_error, "Could not open %s\n", priv->source);
return 0;
}
}
@@ -264,7 +264,7 @@ static DWORD WINAPI wince_reader_thread (LPVOID lParam)
DWORD bytes_read;
int waitcounter;
- dbg(0, "GPS Port:[%s]\n", priv->source);
+ dbg(lvl_error, "GPS Port:[%s]\n", priv->source);
priv->thread_up = 1;
if ( !initDevice(priv) ) {
@@ -272,7 +272,7 @@ static DWORD WINAPI wince_reader_thread (LPVOID lParam)
}
while (priv->is_running)
{
- dbg(1,"readfile\n");
+ dbg(lvl_warning,"readfile\n");
waitcounter = 0;
status = ReadFile(priv->m_hGPSDevice,
chunk_buffer, sizeof(chunk_buffer),
@@ -280,7 +280,7 @@ static DWORD WINAPI wince_reader_thread (LPVOID lParam)
if ( !status )
{
- dbg(0,"Error reading file/device. Try again.\n");
+ dbg(lvl_error,"Error reading file/device. Try again.\n");
initDevice(priv);
continue;
}
@@ -290,24 +290,24 @@ static DWORD WINAPI wince_reader_thread (LPVOID lParam)
/* TODO (rikky#1#): should use blocking */
if ( priv->file_type != file_type_file )
{
- dbg(3, "GPS data comes too fast. Have to wait here\n");
+ dbg(lvl_debug, "GPS data comes too fast. Have to wait here\n");
}
Sleep(50);
waitcounter++;
if ( waitcounter % 8 == 0 )
{
- dbg(1, "Remind them of the data\n");
+ dbg(lvl_warning, "Remind them of the data\n");
event_call_callback(priv->priv_cbl);
}
if(waitcounter % 200 == 0) {
- dbg(0,"Will main thread ever be ready for the GPS data? Already %d intervals gone.\n",waitcounter);
+ dbg(lvl_error,"Will main thread ever be ready for the GPS data? Already %d intervals gone.\n",waitcounter);
}
}
if(waitcounter>2)
- dbg(0,"Sent GPS data to the main thread after %d intervals delay.\n",waitcounter);
+ dbg(lvl_error,"Sent GPS data to the main thread after %d intervals delay.\n",waitcounter);
g_mutex_lock(&priv->lock);
memcpy(priv->read_buffer + priv->read_buffer_pos , chunk_buffer, bytes_read );
@@ -348,11 +348,11 @@ vehicle_wince_available_ports(void)
regdevtype_length = sizeof(devicetype);
if ( RegQueryValueEx( hkSubResult, L"Key", NULL, NULL, (LPBYTE)devicetype, &regdevtype_length) == ERROR_SUCCESS )
{
- dbg(0, "Found device '%s' (%s)\n", W2A(devicename), W2A(devicetype));
+ dbg(lvl_error, "Found device '%s' (%s)\n", W2A(devicename), W2A(devicetype));
}
else
{
- dbg(0, "Found device '%s'\n", W2A(devicename));
+ dbg(lvl_error, "Found device '%s'\n", W2A(devicename));
}
}
RegCloseKey(hkSubResult);
@@ -372,7 +372,7 @@ vehicle_wince_open(struct vehicle_priv *priv)
char* strport;
char* strsettings;
- dbg(1, "enter vehicle_wince_open, priv->source='%s'\n", priv->source);
+ dbg(lvl_warning, "enter vehicle_wince_open, priv->source='%s'\n", priv->source);
if (priv->source ) {
@@ -391,7 +391,7 @@ vehicle_wince_open(struct vehicle_priv *priv)
*strsettings = '\0';
strsettings++;
- dbg(0, "serial('%s', '%s')\n", strport, strsettings );
+ dbg(lvl_error, "serial('%s', '%s')\n", strport, strsettings );
}
if (raw_setting_str)
g_free( raw_setting_str );
@@ -402,7 +402,7 @@ vehicle_wince_open(struct vehicle_priv *priv)
static void
vehicle_wince_close(struct vehicle_priv *priv)
{
- dbg(1,"enter");
+ dbg(lvl_warning,"enter");
}
static int
@@ -416,10 +416,10 @@ vehicle_wince_parse(struct vehicle_priv *priv, char *buffer)
int valid=0;
int ret = 0;
- dbg(2, "enter: buffer='%s'\n", buffer);
+ dbg(lvl_info, "enter: buffer='%s'\n", buffer);
for (;;) {
if (len < 4) {
- dbg(0, "'%s' too short\n", buffer);
+ dbg(lvl_error, "'%s' too short\n", buffer);
return ret;
}
if (buffer[len - 1] == '\r' || buffer[len - 1] == '\n') {
@@ -430,22 +430,22 @@ vehicle_wince_parse(struct vehicle_priv *priv, char *buffer)
break;
}
if (buffer[0] != '$') {
- dbg(0, "no leading $ in '%s'\n", buffer);
+ dbg(lvl_error, "no leading $ in '%s'\n", buffer);
return ret;
}
if (buffer[len - 3] != '*') {
- dbg(0, "no *XX in '%s'\n", buffer);
+ dbg(lvl_error, "no *XX in '%s'\n", buffer);
return ret;
}
for (i = 1; i < len - 3; i++) {
csum ^= (unsigned char) (buffer[i]);
}
if (!sscanf(buffer + len - 2, "%x", &bcsum) && priv->checksum_ignore != 2) {
- dbg(0, "no checksum in '%s'\n", buffer);
+ dbg(lvl_error, "no checksum in '%s'\n", buffer);
return ret;
}
if (bcsum != csum && priv->checksum_ignore == 0) {
- dbg(0, "wrong checksum in '%s'\n", buffer);
+ dbg(lvl_error, "wrong checksum in '%s'\n", buffer);
return ret;
}
@@ -454,7 +454,7 @@ vehicle_wince_parse(struct vehicle_priv *priv, char *buffer)
g_free(priv->nmea_data_buf);
priv->nmea_data_buf=nmea_data_buf;
} else {
- dbg(0, "nmea buffer overflow, discarding '%s'\n", buffer);
+ dbg(lvl_error, "nmea buffer overflow, discarding '%s'\n", buffer);
}
i = 0;
p = buffer;
@@ -491,7 +491,7 @@ vehicle_wince_parse(struct vehicle_priv *priv, char *buffer)
if (!g_strcasecmp(item[5],"W"))
priv->geo.lng=-priv->geo.lng;
priv->valid=attr_position_valid_valid;
- dbg(2, "latitude '%2.4f' longitude %2.4f\n", priv->geo.lat, priv->geo.lng);
+ dbg(lvl_info, "latitude '%2.4f' longitude %2.4f\n", priv->geo.lat, priv->geo.lng);
} else
priv->valid=attr_position_valid_invalid;
@@ -523,7 +523,7 @@ vehicle_wince_parse(struct vehicle_priv *priv, char *buffer)
if (valid) {
priv->direction = g_ascii_strtod( item[1], NULL );
priv->speed = g_ascii_strtod( item[7], NULL );
- dbg(2,"direction %lf, speed %2.1lf\n", priv->direction, priv->speed);
+ dbg(lvl_info,"direction %lf, speed %2.1lf\n", priv->direction, priv->speed);
}
}
if (!strncmp(buffer, "$GPRMC", 6)) {
@@ -613,7 +613,7 @@ vehicle_wince_parse(struct vehicle_priv *priv, char *buffer)
*/
if (item[1]) {
priv->magnetic_direction = g_ascii_strtod( item[1], NULL );
- dbg(1,"magnetic %d\n", priv->magnetic_direction);
+ dbg(lvl_warning,"magnetic %d\n", priv->magnetic_direction);
}
}
return ret;
@@ -625,7 +625,7 @@ vehicle_wince_io(struct vehicle_priv *priv)
int size, rc = 0;
char *str, *tok;
- dbg(1, "vehicle_file_io : enter\n");
+ dbg(lvl_warning, "vehicle_file_io : enter\n");
size = read_win32(priv, priv->buffer + priv->buffer_pos, buffer_size - priv->buffer_pos - 1);
@@ -646,12 +646,12 @@ vehicle_wince_io(struct vehicle_priv *priv)
}
priv->buffer_pos += size;
priv->buffer[priv->buffer_pos] = '\0';
- dbg(1, "size=%d pos=%d buffer='%s'\n", size,
+ dbg(lvl_warning, "size=%d pos=%d buffer='%s'\n", size,
priv->buffer_pos, priv->buffer);
str = priv->buffer;
while ((tok = strchr(str, '\n'))) {
*tok++ = '\0';
- dbg(1, "line='%s'\n", str);
+ dbg(lvl_warning, "line='%s'\n", str);
rc +=vehicle_wince_parse(priv, str);
str = tok;
if (priv->file_type == file_type_file && rc)
@@ -662,10 +662,10 @@ vehicle_wince_io(struct vehicle_priv *priv)
size = priv->buffer + priv->buffer_pos - str;
memmove(priv->buffer, str, size + 1);
priv->buffer_pos = size;
- dbg(2, "now pos=%d buffer='%s'\n",
+ dbg(lvl_info, "now pos=%d buffer='%s'\n",
priv->buffer_pos, priv->buffer);
} else if (priv->buffer_pos == buffer_size - 1) {
- dbg(0,
+ dbg(lvl_error,
"Overflow. Most likely wrong baud rate or no nmea protocol\n");
priv->buffer_pos = 0;
}
@@ -676,7 +676,7 @@ vehicle_wince_io(struct vehicle_priv *priv)
static void
vehicle_wince_enable_watch(struct vehicle_priv *priv)
{
- dbg(1, "enter");
+ dbg(lvl_warning, "enter");
vehicle_wince_disable_watch(priv);
priv->is_running = 1;
@@ -697,7 +697,7 @@ vehicle_wince_disable_watch(struct vehicle_priv *priv)
{
int wait = 5000;
- dbg(1, "enter");
+ dbg(lvl_warning, "enter");
priv->is_running = 0;
while (wait-- > 0 && priv->thread_up) {
@@ -791,7 +791,7 @@ vehicle_wince_position_attr_get(struct vehicle_priv *priv,
attr->u.str=priv->fixiso8601;
break;
case attr_position_sat_item:
- dbg(0,"at here\n");
+ dbg(lvl_error,"at here\n");
priv->sat_item.id_lo++;
if (priv->sat_item.id_lo > priv->current_count) {
priv->sat_item.id_lo=0;
@@ -881,7 +881,7 @@ vehicle_wince_new(struct vehicle_methods
struct attr *handle_bluetooth;
char *cp;
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
source = attr_search(attrs, NULL, attr_source);
ret = g_new0(struct vehicle_priv, 1);
ret->fd = -1;
@@ -918,7 +918,7 @@ vehicle_wince_new(struct vehicle_methods
ret->on_eof=1;
if (on_eof && !g_strcasecmp(on_eof->u.str, "exit"))
ret->on_eof=2;
- dbg(0,"on_eof=%d\n", ret->on_eof);
+ dbg(lvl_error,"on_eof=%d\n", ret->on_eof);
*meth = vehicle_wince_methods;
ret->priv_cbl = callback_list_new();
callback_list_add(ret->priv_cbl, callback_new_1(callback_cast(vehicle_wince_io), ret));
@@ -937,7 +937,7 @@ vehicle_wince_new(struct vehicle_methods
vehicle_wince_enable_watch(ret);
return ret;
}
- dbg(0, "Failed to open '%s'\n", ret->source);
+ dbg(lvl_error, "Failed to open '%s'\n", ret->source);
vehicle_wince_destroy(ret);
return NULL;
}
@@ -948,7 +948,7 @@ vehicle_wince_new(struct vehicle_methods
void
plugin_init(void)
{
- dbg(1, "enter\n");
+ dbg(lvl_warning, "enter\n");
plugin_register_vehicle_type("wince", vehicle_wince_new);
plugin_register_vehicle_type("file", vehicle_wince_new);
}
diff --git a/navit/vehicleprofile.c b/navit/vehicleprofile.c
index e1ad9c638..9850e27bf 100644
--- a/navit/vehicleprofile.c
+++ b/navit/vehicleprofile.c
@@ -30,7 +30,7 @@
static void
vehicleprofile_set_attr_do(struct vehicleprofile *this_, struct attr *attr)
{
- dbg(1,"%s:%ld\n", attr_to_name(attr->type), attr->u.num);
+ dbg(lvl_warning,"%s:%ld\n", attr_to_name(attr->type), attr->u.num);
switch (attr->type) {
case attr_flags:
this_->flags=attr->u.num;
@@ -147,14 +147,14 @@ vehicleprofile_apply_roadprofile(struct vehicleprofile *this_, struct navit_obje
struct navit_object *oldrp;
/* Maptool won't place any access flags for roads which don't have default access flags set. Warn user. */
if(!item_get_default_flags(*types))
- dbg(0,"On '%s' roads used in '%s' vehicleprofile access restrictions are ignored. You might even be directed to drive in wrong direction on a one-way road. "
+ dbg(lvl_error,"On '%s' roads used in '%s' vehicleprofile access restrictions are ignored. You might even be directed to drive in wrong direction on a one-way road. "
"Please define default access flags for above road type to item.c and rebuild the map.\n", item_to_name(*types), this_->name);
oldrp=g_hash_table_lookup(this_->roadprofile_hash, (void *)(long)(*types));
if (is_option && oldrp) {
struct navit_object *newrp;
struct attr_iter *iter=rp->func->iter_new(NULL);
struct attr attr;
- dbg(1,"patching roadprofile\n");
+ dbg(lvl_warning,"patching roadprofile\n");
newrp=oldrp->func->dup(oldrp);
while (rp->func->get_attr(rp, attr_any, &attr, iter))
newrp->func->set_attr(newrp, &attr);
@@ -177,7 +177,7 @@ vehicleprofile_apply_attrs(struct vehicleprofile *this_, struct navit_object *ob
struct attr attr;
struct attr_iter *iter=obj->func->iter_new(NULL);
while (obj->func->get_attr(obj, attr_any, &attr, iter)) {
- dbg(1,"%s\n",attr_to_name(attr.type));
+ dbg(lvl_warning,"%s\n",attr_to_name(attr.type));
if (attr.type == attr_roadprofile)
vehicleprofile_apply_roadprofile(this_, attr.u.navit_object, is_option);
else if (attr.type != attr_profile_option)
@@ -190,7 +190,7 @@ static void
vehicleprofile_debug_roadprofile(gpointer key, gpointer value, gpointer user_data)
{
struct roadprofile *rp=value;
- dbg(3,"type %s avg %d weight %d max %d\n",item_to_name((int)(long)key),rp->speed,rp->route_weight,rp->maxspeed);
+ dbg(lvl_debug,"type %s avg %d weight %d max %d\n",item_to_name((int)(long)key),rp->speed,rp->route_weight,rp->maxspeed);
}
static void
@@ -198,7 +198,7 @@ vehicleprofile_update(struct vehicleprofile *this_)
{
struct attr_iter *iter=vehicleprofile_attr_iter_new();
struct attr profile_option;
- dbg(3,"enter\n");
+ dbg(lvl_debug,"enter\n");
vehicleprofile_clear(this_);
vehicleprofile_apply_attrs(this_, (struct navit_object *)this_, 0);
while (vehicleprofile_get_attr(this_, attr_profile_option, &profile_option, iter)) {
@@ -206,13 +206,13 @@ vehicleprofile_update(struct vehicleprofile *this_)
if (!profile_option.u.navit_object->func->get_attr(profile_option.u.navit_object, attr_active, &active, NULL))
active.u.num=0;
if (profile_option.u.navit_object->func->get_attr(profile_option.u.navit_object, attr_name, &name, NULL))
- dbg(3,"%p %s %ld\n",profile_option.u.navit_object,name.u.str,active.u.num);
+ dbg(lvl_debug,"%p %s %ld\n",profile_option.u.navit_object,name.u.str,active.u.num);
if (active.u.num)
vehicleprofile_apply_attrs(this_, profile_option.u.navit_object, 1);
}
vehicleprofile_attr_iter_destroy(iter);
- dbg(3,"result l %d w %d h %d wg %d awg %d pen %d\n",this_->length,this_->width,this_->height,this_->weight,this_->axle_weight,this_->through_traffic_penalty);
- dbg(3,"m %d fwd 0x%x rev 0x%x flags 0x%x max %d stsp %d stdst %d dg %d\n",this_->mode,this_->flags_forward_mask,this_->flags_reverse_mask, this_->flags, this_->maxspeed_handling, this_->static_speed, this_->static_distance, this_->dangerous_goods);
+ dbg(lvl_debug,"result l %d w %d h %d wg %d awg %d pen %d\n",this_->length,this_->width,this_->height,this_->weight,this_->axle_weight,this_->through_traffic_penalty);
+ dbg(lvl_debug,"m %d fwd 0x%x rev 0x%x flags 0x%x max %d stsp %d stdst %d dg %d\n",this_->mode,this_->flags_forward_mask,this_->flags_reverse_mask, this_->flags, this_->maxspeed_handling, this_->static_speed, this_->static_distance, this_->dangerous_goods);
g_hash_table_foreach(this_->roadprofile_hash, vehicleprofile_debug_roadprofile, NULL);
}
diff --git a/navit/xmlconfig.c b/navit/xmlconfig.c
index fccf94ca3..00ce94325 100644
--- a/navit/xmlconfig.c
+++ b/navit/xmlconfig.c
@@ -118,7 +118,7 @@ static struct attr ** convert_to_attrs(struct xmlstate *state, struct attr_fixme
if (! strcmp(name, attr_fixme[0])) {
name=attr_fixme[1];
if (fixme_count++ < 10)
- dbg(0,"Please change attribute '%s' to '%s' in <%s />\n", attr_fixme[0], attr_fixme[1], fixme->element);
+ dbg(lvl_error,"Please change attribute '%s' to '%s' in <%s />\n", attr_fixme[0], attr_fixme[1], fixme->element);
break;
}
attr_fixme+=2;
@@ -128,12 +128,12 @@ static struct attr ** convert_to_attrs(struct xmlstate *state, struct attr_fixme
if (ret[count])
count++;
else if (strcmp(*attribute_name,"enabled") && strcmp(*attribute_name,"xmlns:xi"))
- dbg(0,"failed to create attribute '%s' with value '%s'\n", *attribute_name,*attribute_value);
+ dbg(lvl_error,"failed to create attribute '%s' with value '%s'\n", *attribute_name,*attribute_value);
attribute_name++;
attribute_value++;
}
ret[count]=NULL;
- dbg(3,"ret=%p\n", ret);
+ dbg(lvl_debug,"ret=%p\n", ret);
return ret;
}
@@ -209,7 +209,7 @@ xmlconfig_announce(struct xmlstate *state)
if (itype!=type_none) {
navigation_set_announce(state->parent->element_attr.u.data, itype, level);
} else {
- dbg(0, "Invalid type for announcement: %s\n",tok);
+ dbg(lvl_error, "Invalid type for announcement: %s\n",tok);
}
str=NULL;
}
@@ -586,7 +586,7 @@ start_element(xml_context *context,
const char *parent_name=NULL;
char *s,*sep="",*possible_parents;
struct attr *parent_attr;
- dbg(2,"name='%s' parent='%s'\n", element_name, *parent ? (*parent)->element:NULL);
+ dbg(lvl_info,"name='%s' parent='%s'\n", element_name, *parent ? (*parent)->element:NULL);
if (!strcmp(element_name,"xml"))
return;
@@ -604,7 +604,7 @@ start_element(xml_context *context,
if (!strcmp(element_name,element_fixme[0])) {
element_name=element_fixme[1];
if (fixme_count++ < 10)
- dbg(0,"Please change <%s /> to <%s /> in config file\n", element_fixme[0], element_fixme[1]);
+ dbg(lvl_error,"Please change <%s /> to <%s /> in config file\n", element_fixme[0], element_fixme[1]);
}
element_fixme+=2;
}
@@ -676,7 +676,7 @@ start_element(xml_context *context,
return;
new->element_attr.type=attr_from_name(element_name);
if (new->element_attr.type == attr_none)
- dbg(0,"failed to create object of type '%s'\n", element_name);
+ dbg(lvl_error,"failed to create object of type '%s'\n", element_name);
if (new->element_attr.type == attr_tracking)
new->element_attr.type=attr_trackingo;
if (new->parent && new->parent->object_func && new->parent->object_func->add_attr)
@@ -697,7 +697,7 @@ end_element (xml_context *context,
if (!strcmp(element_name,"xml"))
return;
- dbg(2,"name='%s'\n", element_name);
+ dbg(lvl_info,"name='%s'\n", element_name);
curr=*state;
if (curr->object_func && curr->object_func->init)
curr->object_func->init(curr->element_attr.u.data);
@@ -752,27 +752,27 @@ xinclude(xml_context *context, const gchar **attribute_names, const gchar **attr
doc_new.level=doc_old->level+1;
doc_new.user_data=doc_old->user_data;
if (! href) {
- dbg(1,"no href, using '%s'\n", doc_old->href);
+ dbg(lvl_warning,"no href, using '%s'\n", doc_old->href);
doc_new.href=doc_old->href;
if (file_exists(doc_new.href)) {
parse_file(&doc_new, error);
} else {
- dbg(0,"Unable to include %s\n",doc_new.href);
+ dbg(lvl_error,"Unable to include %s\n",doc_new.href);
}
} else {
- dbg(1,"expanding '%s'\n", href);
+ dbg(lvl_warning,"expanding '%s'\n", href);
we=file_wordexp_new(href);
we_files=file_wordexp_get_array(we);
count=file_wordexp_get_count(we);
- dbg(1,"%d results\n", count);
+ dbg(lvl_warning,"%d results\n", count);
if (file_exists(we_files[0])) {
for (i = 0 ; i < count ; i++) {
- dbg(1,"result[%d]='%s'\n", i, we_files[i]);
+ dbg(lvl_warning,"result[%d]='%s'\n", i, we_files[i]);
doc_new.href=we_files[i];
parse_file(&doc_new, error);
}
} else {
- dbg(0,"Unable to include %s\n",we_files[0]);
+ dbg(lvl_error,"Unable to include %s\n",we_files[0]);
}
file_wordexp_destroy(we);
@@ -787,7 +787,7 @@ strncmp_len(const char *s1, int s1len, const char *s2)
char c[s1len+1];
strncpy(c, s1, s1len);
c[s1len]='\0';
- dbg(0,"'%s' vs '%s'\n", c, s2);
+ dbg(lvl_error,"'%s' vs '%s'\n", c, s2);
#endif
ret=strncmp(s1, s2, s1len);
@@ -832,7 +832,7 @@ xpointer_test(const char *test, int len, struct xistate *elem)
strncpy(test2, test, len);
test2[len]='\0';
- dbg(0,"%s\n", test2);
+ dbg(lvl_error,"%s\n", test2);
#endif
if (!len)
return 0;
@@ -886,7 +886,7 @@ xpointer_xpointer_match(const char *xpointer, int len, struct xistate *first)
{
const char *c;
int s;
- dbg(2,"%s\n", xpointer);
+ dbg(lvl_info,"%s\n", xpointer);
if (xpointer[0] != '/')
return 0;
c=xpointer+1;
@@ -1067,12 +1067,12 @@ xml_parse_text(const char *document, void *data,
context = g_markup_parse_context_new (&parser, 0, data, NULL);
if (!document){
- dbg(0, "FATAL: No XML data supplied (looks like incorrect configuration for internal GUI).\n");
+ dbg(lvl_error, "FATAL: No XML data supplied (looks like incorrect configuration for internal GUI).\n");
exit(1);
}
result = g_markup_parse_context_parse (context, document, strlen(document), NULL);
if (!result){
- dbg(0, "FATAL: Cannot parse data as XML: '%s'\n", document);
+ dbg(lvl_error, "FATAL: Cannot parse data as XML: '%s'\n", document);
exit(1);
}
g_markup_parse_context_free (context);
@@ -1115,7 +1115,7 @@ parse_file(struct xmldocument *document, xmlerror **error)
gboolean result;
char *xmldir,*newxmldir,*xmlfile,*newxmlfile,*sep;
- dbg(1,"enter filename='%s'\n", document->href);
+ dbg(lvl_warning,"enter filename='%s'\n", document->href);
#if GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 12
#define G_MARKUP_TREAT_CDATA_AS_TEXT 0
#endif
@@ -1159,7 +1159,7 @@ parse_file(struct xmldocument *document, xmlerror **error)
unsetenv("XMLFILE");
g_free(newxmldir);
g_free(newxmlfile);
- dbg(1,"return %d\n", result);
+ dbg(lvl_warning,"return %d\n", result);
return result;
}
@@ -1219,7 +1219,7 @@ gboolean config_load(const char *filename, xmlerror **error)
item_create_hash();
initStatic();
- dbg(1,"enter filename='%s'\n", filename);
+ dbg(lvl_warning,"enter filename='%s'\n", filename);
memset(&document, 0, sizeof(document));
document.href=filename;
document.user_data=&curr;
@@ -1230,7 +1230,7 @@ gboolean config_load(const char *filename, xmlerror **error)
}
attr_destroy_hash();
item_destroy_hash();
- dbg(1,"return %d\n", result);
+ dbg(lvl_warning,"return %d\n", result);
return result;
}
@@ -1264,7 +1264,7 @@ struct navit_object *
navit_object_ref(struct navit_object *obj)
{
obj->refcount++;
- dbg(1,"refcount %s %p %d\n",attr_to_name(obj->func->type),obj,obj->refcount);
+ dbg(lvl_warning,"refcount %s %p %d\n",attr_to_name(obj->func->type),obj,obj->refcount);
return obj;
}
@@ -1273,7 +1273,7 @@ navit_object_unref(struct navit_object *obj)
{
if (obj) {
obj->refcount--;
- dbg(1,"refcount %s %p %d\n",attr_to_name(obj->func->type),obj,obj->refcount);
+ dbg(lvl_warning,"refcount %s %p %d\n",attr_to_name(obj->func->type),obj,obj->refcount);
if (obj->refcount <= 0 && obj->func && obj->func->destroy)
obj->func->destroy(obj);
}