cway->data->int_ref=g_strdup(v);
else if (strcasecmp(k, "oneway")==0)
cway->flags|=W_ONEWAY;
+ else if (strcasecmp(k, "noexit")==0)
+ cway->flags|=W_NOEXIT;
else if (strcasecmp(k, "layer")==0)
cway->data->layer=atoi(v);
else if ((strcasecmp(k, "junction")==0) && (strcasecmp(v, "roundabout")==0)) {
break;
}
}
+ } else {
+#ifdef VERBOSE_UNHANDLED_WAY_TAGS
+ g_printf("Unhandled tag: [%s == %s]\n", k, v);
+#endif
}
}
g_printf("Segments: %d\n", seg_cnt);
}
break;
+ case IN_OSM_TAG:
+ g_printf("Planet loaded.\n");
+ break;
default:;
}
}
+/************************************************************************/
+
gint osm_planet_parse_file(gchar *pfile)
{
int f, r, res;
return res;
}
-inline gint
+/************************************************************************/
+
+static gint
print_fail(const gchar *msg, gint ret)
{
g_printf("ERROR: %s\n", msg);
/************************************************************************/
-int main (int argc, char **argv)
+static void
+print_memory_usage(void)
{
-
+g_print("Memory usage:\n");
g_printf("Node size: %d\n", sizeof(node));
g_printf("Seg size: %d\n", sizeof(segment));
g_printf("Way size: %d\n", sizeof(way));
+}
+
+static void
+storage_init(void)
+{
+osm_nodes=g_hash_table_new(g_direct_hash, g_direct_equal);
+osm_segments=g_hash_table_new(g_direct_hash, g_direct_equal);
+}
+
+static void
+storage_free(void)
+{
+g_hash_table_unref(osm_nodes);
+g_hash_table_unref(osm_segments);
+}
+
+/************************************************************************/
+int main (int argc, char **argv)
+{
if (argc!=2) {
return print_fail("No planet XML file given", 1);
} else {
return print_fail("Database open failed", 2);
db_prepare();
-osm_nodes=g_hash_table_new(g_direct_hash, g_direct_equal);
-osm_segments=g_hash_table_new(g_direct_hash, g_direct_equal);
+print_memory_usage();
+
+storage_init();
osm_planet_parse_file(argv[1]);
osm_planet_save_to_db();
-g_hash_table_unref(osm_nodes);
-g_hash_table_unref(osm_segments);
+storage_free();
sqlite3_close(db);
sync();