From 08daa8471572f442428114084eb6a6e7de3c8de3 Mon Sep 17 00:00:00 2001 From: martin-s Date: Fri, 6 Jul 2007 13:15:23 +0000 Subject: [PATCH] Removed old files git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@272 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/src/Makefile.am | 4 +- navit/src/block.c | 211 --------------- navit/src/block.h | 30 --- navit/src/destination.c | 682 ----------------------------------------------- navit/src/display.c | 284 -------------------- navit/src/main.h | 1 - navit/src/map-common.c | 442 ------------------------------ navit/src/map-skelimpl.c | 286 -------------------- navit/src/map-skels.c | 184 ------------- navit/src/map-stubs.c | 135 ---------- navit/src/map.idl | 25 -- navit/src/map.ior | 1 - navit/src/poly.c | 110 -------- navit/src/poly.h | 13 - navit/src/street.c | 616 ------------------------------------------ navit/src/street_data.h | 62 ----- navit/src/street_name.c | 260 ------------------ navit/src/street_name.h | 52 ---- navit/src/toolbar.h | 3 - navit/src/town.c | 261 ------------------ navit/src/town.h | 34 --- navit/src/tree.c | 326 ---------------------- 22 files changed, 2 insertions(+), 4020 deletions(-) delete mode 100644 navit/src/block.c delete mode 100644 navit/src/block.h delete mode 100644 navit/src/destination.c delete mode 100644 navit/src/display.c delete mode 100644 navit/src/main.h delete mode 100644 navit/src/map-common.c delete mode 100644 navit/src/map-skelimpl.c delete mode 100644 navit/src/map-skels.c delete mode 100644 navit/src/map-stubs.c delete mode 100644 navit/src/map.idl delete mode 100644 navit/src/map.ior delete mode 100644 navit/src/poly.c delete mode 100644 navit/src/poly.h delete mode 100644 navit/src/street.c delete mode 100644 navit/src/street_data.h delete mode 100644 navit/src/street_name.c delete mode 100644 navit/src/street_name.h delete mode 100644 navit/src/toolbar.h delete mode 100644 navit/src/town.c delete mode 100644 navit/src/town.h delete mode 100644 navit/src/tree.c diff --git a/navit/src/Makefile.am b/navit/src/Makefile.am index 985d75a..d33db0f 100644 --- a/navit/src/Makefile.am +++ b/navit/src/Makefile.am @@ -15,10 +15,10 @@ navit_SOURCES = attr.c callback.c compass.c coord.c country.c cursor.c data_wind profile.c python.c route.c search.c speech.c transform.c track.c \ util.c vehicle.c xmlconfig.c attr.h attr_def.h callback.h color.h compass.h coord.h country.h \ cursor.h data.h data_window.h data_window_int.h debug.h destination.h draw_info.h \ - file.h graphics.h gtkext.h gui.h item.h item_def.h log.h layer.h layout.h main.h map-share.h map.h\ + file.h graphics.h gtkext.h gui.h item.h item_def.h log.h layer.h layout.h map-share.h map.h\ map_data.h mapset.h maptype.h menu.h navigation.h navit.h \ param.h phrase.h plugin.h point.h plugin_def.h projection.h popup.h route.h profile.h search.h speech.h statusbar.h \ - toolbar.h transform.h track.h util.h vehicle.h xmlconfig.h + transform.h track.h util.h vehicle.h xmlconfig.h navit_LDADD = @NAVIT_LIBS@ @GPSD_LIBS@ @SPEECHD_LIBS@ -Lfib-1.1 -lfib diff --git a/navit/src/block.c b/navit/src/block.c deleted file mode 100644 index 0c7d0f2..0000000 --- a/navit/src/block.c +++ /dev/null @@ -1,211 +0,0 @@ -#include -#include -#include -#include -#include "file.h" -#include "block.h" -#include "data.h" - - -struct file_private { - int binarytree; -}; - -struct block_index_item { - u32 blocknum; - u32 blocks; -}; - -struct block_index { - u32 blocks; - u32 size; - u32 next; - struct block_index_item list[0]; -}; - - -struct block * -block_get(unsigned char **p) -{ - struct block *ret=(struct block *)(*p); - *p += sizeof(*ret); - return ret; -} - -struct block * -block_get_byindex(struct file *file, int idx, unsigned char **p_ret) -{ - struct block_index *blk_idx; - int blk_num,max; - - blk_idx=(struct block_index *)(file->begin+0x1000); - max=(blk_idx->size-sizeof(struct block_index))/sizeof(struct block_index_item); - while (idx >= max) { - blk_idx=(struct block_index *)(file->begin+blk_idx->next*512); - idx-=max; - } - blk_num=blk_idx->list[idx].blocknum; - - *p_ret=file->begin+blk_num*512; - return block_get(p_ret); -} - -static int -block_binarytree_walk(struct block **block, unsigned char **p, struct coord *c, int ign, struct block_info *blk_inf, struct transformation *t, - void *data, void(*func)(struct block_info *, unsigned char *, unsigned char *, void *)) -{ - struct coord ca[2],cb[2]; - struct block *blk; - int blk_num,val,dx,dy; - int ret=0; - - ca[0].x=c[0].x; - ca[0].y=c[0].y; - ca[1].x=c[1].x; - ca[1].y=c[1].y; - cb[0].x=c[0].x; - cb[0].y=c[0].y; - cb[1].x=c[1].x; - cb[1].y=c[1].y; - - if (*p >= (unsigned char *)(*block)+(*block)->size) { - *block=block_get_byindex(blk_inf->file, (*block)->next, p); - *p-=20; - } - blk_num=get_u32(p); - val=get_u32(p); - - if (blk_num != -1) - ret++; - - if (blk_num != -1 && (t == NULL || is_visible(t, c))) { - unsigned char *t,*end; - blk=block_get_byindex(blk_inf->file, blk_num, &t); - if (c[0].x != blk->c[0].x || c[0].y != blk->c[0].y || c[1].x != blk->c[1].x || c[1].y != blk->c[1].y) { - printf("ERROR3\n"); - printf("!= 0x%lx,0x%lx-0x%lx,0x%lx\n", blk->c[0].x,blk->c[0].y,blk->c[1].x,blk->c[1].y); - } - end=(unsigned char *)blk; - end+=blk->size; - blk_inf->block=blk; - blk_inf->block_number=blk_num; - (*func)(blk_inf, t, end, data); - } - - if (val != -1) { - dx=c[1].x-c[0].x; - dy=c[0].y-c[1].y; - if (dy > dx) { - ca[0].y=val; - cb[1].y=val+1; - } else { - ca[1].x=val; - cb[0].x=val+1; - } - ret+=block_binarytree_walk(block, p, ca, ign, blk_inf, t, data, func); - ret+=block_binarytree_walk(block, p, cb, ign, blk_inf, t, data, func); - } - return ret; -} - -static void -block_file_private_setup(struct file *file) -{ - int len; - unsigned char *p,*t; - char *str; - struct file_private *file_priv; - - file_priv=g_malloc0(sizeof(*file_priv)); - file->private=file_priv; - - p=file->begin+0x0c; - while (*p) { - str=get_string(&p); - len=get_u32(&p); - t=p; - if (! strcmp(str,"binaryTree")) { - file_priv->binarytree=get_u32(&t); - } - p+=len; - } -} - -static void -block_foreach_visible_linear(struct block_info *blk_inf, struct transformation *t, void *data, - void(*func)(struct block_info *blk_inf, unsigned char *, unsigned char *, void *)) -{ - unsigned char *p,*start,*end; - struct block *blk; - - blk_inf->block_number=0; - p=blk_inf->file->begin+0x2000; - while (p < blk_inf->file->end) { - blk_inf->block_number++; - start=p; - end=p; - blk=block_get(&p); - end+=blk->size; - if (blk->count == -1) - break; - if (t == NULL || is_visible(t, blk->c)) { - blk_inf->block=blk; - (*func)(blk_inf, p, end, data); - } - p=start+blk->blocks*512; - } -} - -void -block_foreach_visible(struct block_info *blk_inf, struct transformation *t, int limit, void *data, - void(*func)(struct block_info *, unsigned char *, unsigned char *, void *)) -{ - struct file_private *file_priv=blk_inf->file->private; - - if (! file_priv) { - block_file_private_setup(blk_inf->file); - file_priv=blk_inf->file->private; - } - if (! file_priv->binarytree) { - block_foreach_visible_linear(blk_inf, t, data, func); - } else { - unsigned char *p,*p2; - int dummy1,dummy2,xy,i,count; - struct block *block=block_get_byindex(blk_inf->file, file_priv->binarytree, &p); - p2=p; - dummy1=get_u32(&p2); - if (block->count != -1 || dummy1 != -1) { - printf("ERROR2 0x%x\n", block->count); - } - xy=1; - p=p2; - for (i = 0 ; i < limit ; i++) { - p2=p; - dummy1=get_u32(&p2); - dummy2=get_u32(&p2); - assert((dummy1 == -1 && dummy2 == -1) || i < 32) ; - if (block->c[0].x > block->c[1].x || block->c[1].y > block->c[0].y) - break; - count=block_binarytree_walk(&block, &p, block->c, 0, blk_inf, t, data, func); - } - } -} - -int -block_get_param(struct block_info *blk_inf, struct param_list *param, int count) -{ - int i=count; - param_add_hex("Number", blk_inf->block_number, ¶m, &count); - param_add_hex("Addr", (unsigned char *)blk_inf->block-blk_inf->file->begin, ¶m, &count); - param_add_hex("Blocks", blk_inf->block->blocks, ¶m, &count); - param_add_hex("Size", blk_inf->block->size, ¶m, &count); - param_add_hex("Next", blk_inf->block->next, ¶m, &count); - param_add_hex_sig("L", blk_inf->block->c[0].x, ¶m, &count); - param_add_hex_sig("T", blk_inf->block->c[0].y, ¶m, &count); - param_add_hex_sig("R", blk_inf->block->c[1].x, ¶m, &count); - param_add_hex_sig("B", blk_inf->block->c[1].y, ¶m, &count); - param_add_hex("W", blk_inf->block->c[1].x-blk_inf->block->c[0].x, ¶m, &count); - param_add_hex("H", blk_inf->block->c[0].y-blk_inf->block->c[1].y, ¶m, &count); - param_add_hex("Count", blk_inf->block->count, ¶m, &count); - return i-count; -} diff --git a/navit/src/block.h b/navit/src/block.h deleted file mode 100644 index ddc7426..0000000 --- a/navit/src/block.h +++ /dev/null @@ -1,30 +0,0 @@ -#include "coord.h" -#include "transform.h" - -struct block { - u32 blocks; - u32 size; - u32 next; - struct coord c[2]; - int count; -}; - -struct block_info { - struct map_data *mdata; - struct file *file; - struct block *block; - int block_number; -}; - -struct segment { - struct block_info blk_inf; - void *data[4]; -}; - -struct param_list; - -struct block * block_get(unsigned char **p); -void block_foreach_visible(struct block_info *blk_inf, struct transformation *t, int limit, void *data, - void(*func)(struct block_info *blk_inf, unsigned char *, unsigned char *, void *)); -int block_get_param(struct block_info *blk_inf, struct param_list *param, int count); -struct block *block_get_byindex(struct file *file, int idx, unsigned char **p_ret); diff --git a/navit/src/destination.c b/navit/src/destination.c deleted file mode 100644 index c8c33ce..0000000 --- a/navit/src/destination.c +++ /dev/null @@ -1,682 +0,0 @@ -#include -#include -#include -#include -#include "coord.h" -#include "transform.h" -#include "block.h" -#include "data_window.h" -#include "country.h" -#include "town.h" -#include "street.h" -#include "street_name.h" -#include "gui/gtk/gtkeyboard.h" -#include "cursor.h" -#include "route.h" -#include "statusbar.h" -#include "unistd.h" -#include "destination.h" -#include "coord.h" -#include "container.h" -#include "graphics.h" - -extern gint track_focus(gpointer data); - - - -GtkWidget *entry_country, *entry_postal, *entry_city, *entry_district; -GtkWidget *entry_street, *entry_number; -GtkWidget *listbox, *current=NULL; -int row_count=8; - -int selected; - -struct search_param { - struct map_data *map_data; - char *country; - GHashTable *country_hash; - char *town; - GHashTable *town_hash; - GHashTable *district_hash; - char *street; - GHashTable *street_hash; - const char *number; - int number_low, number_high; - GtkWidget *clist; - int count; -} search_param2; - -struct destination { - struct town *town; - struct street_name *street_name; - struct coord *c; -}; - -struct country_list *country_list; - -static void -select_row(GtkCList *clist, int row, int column, GdkEventButton *event, struct data_window *win) -{ - selected=row; - gchar *text; - printf("Selected row %d, column %d\n", row, column); - - if(current==entry_country) { - gtk_clist_get_text(GTK_CLIST(clist),row,0,&text); - gtk_entry_set_text(GTK_ENTRY(entry_country),g_strdup(text)); - } - else if( current==entry_city) { - gtk_clist_get_text(GTK_CLIST(clist),row,5,&text); - gtk_entry_set_text(GTK_ENTRY(entry_city),g_strdup(text)); - } - else if( current==entry_street) { - gtk_clist_get_text(GTK_CLIST(clist),row,4,&text); - gtk_entry_set_text(GTK_ENTRY(entry_street),g_strdup(text)); - } - else if( current==entry_number) { - gtk_clist_get_text(GTK_CLIST(clist),row,8,&text); - gtk_entry_set_text(GTK_ENTRY(entry_number),g_strdup(text)); - } -} - -int -destination_set(struct container *co, enum destination_type type, char *text, struct coord *pos) -{ - route_set_position(co->route, cursor_pos_get(co->cursor)); - route_set_destination(co->route, pos); - graphics_redraw(co); - if (co->statusbar && co->statusbar->statusbar_route_update) - co->statusbar->statusbar_route_update(co->statusbar, co->route); - return 0; -} - -static int -get_position(struct search_param *search, struct coord *c) -{ - struct destination *dest; - - if (selected == -1) - selected=0; - dest=gtk_clist_get_row_data (GTK_CLIST(search->clist), selected); - - printf("row %d dest %p dest:0x%lx,0x%lx\n", selected, dest, dest->c->x, dest->c->y); - *c=*dest->c; - return 0; -} - -static void button_map(GtkWidget *widget, struct container *co) -{ - struct coord c; - - if (!get_position(&search_param2, &c)) { - graphics_set_view(co, &c.x, &c.y, NULL); - } -} - -static void button_destination(GtkWidget *widget, struct container *co) -{ - struct coord c; - - if (!get_position(&search_param2, &c)) { - route_set_position(co->route, cursor_pos_get(co->cursor)); - route_set_destination(co->route, &c); - graphics_redraw(co); - } -} - -struct dest_town { - int country; - int assoc; - char *name; - char postal_code[16]; - struct town town; -}; - -static guint -destination_town_hash(gconstpointer key) -{ - const struct dest_town *hash=key; - gconstpointer hashkey=(gconstpointer)(hash->country^hash->assoc); - return g_direct_hash(hashkey); -} - -static gboolean -destination_town_equal(gconstpointer a, gconstpointer b) -{ - const struct dest_town *t_a=a; - const struct dest_town *t_b=b; - if (t_a->assoc == t_b->assoc && t_a->country == t_b->country) { - if (t_a->name && t_b->name && strcmp(t_a->name, t_b->name)) - return FALSE; - return TRUE; - } - return FALSE; -} - -static GHashTable * -destination_town_new(void) -{ - return g_hash_table_new_full(destination_town_hash, destination_town_equal, NULL, g_free); -} - -static void -destination_town_set(const struct dest_town *town, char **rows, int full) -{ - char country[32]; - struct country *cou; - if ((cou=country_get_by_id(town->country))) { - rows[1]=cou->car; - } else { - sprintf(country,"(%d)", town->country); - rows[1]=country; - } - if (full) { - rows[4]=(char *)(town->town.postal_code2); - rows[5]=g_convert(town->town.name,-1,"utf-8","iso8859-1",NULL,NULL,NULL); - if (town->town.district[0]) - rows[6]=g_convert(town->town.district,-1,"utf-8","iso8859-1",NULL,NULL,NULL); - else - rows[6]=NULL; - } else { - rows[4]=(char *)(town->postal_code); - rows[5]=g_convert(town->name,-1,"utf-8","iso8859-1",NULL,NULL,NULL); - } -} - -static void -destination_town_show(gpointer key, gpointer value, gpointer user_data) -{ - struct dest_town *town=value; - struct search_param *search=(struct search_param *)user_data; - char *rows[9]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}; - int row; - - if (search->count > 0) { - struct destination *dest=g_new(struct destination, 1); - dest->town=&town->town; - dest->street_name=NULL; - dest->c=town->town.c; - destination_town_set(town, rows, 0); - row=gtk_clist_append(GTK_CLIST(search->clist), rows); - printf("town row %d %p dest:0x%lx,0x%lx\n", row, dest, dest->c->x, dest->c->y); - gtk_clist_set_row_data(GTK_CLIST(search->clist), row, dest); - search->count--; - } -} - -static GHashTable * -destination_country_new(void) -{ - return g_hash_table_new_full(NULL, NULL, NULL, g_free); -} - -static int -destination_country_add(struct country *cou, void *data) -{ - struct search_param *search=data; - struct country *cou2; - - void *first; - first=g_hash_table_lookup(search->country_hash, (void *)(cou->id)); - if (! first) { - cou2=g_new(struct country, 1); - *cou2=*cou; - g_hash_table_insert(search->country_hash, (void *)(cou->id), cou2); - } - return 0; -} - -static void -destination_country_show(gpointer key, gpointer value, gpointer user_data) -{ - struct country *cou=value; - struct search_param *search=(struct search_param *)user_data; - char *rows[9]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}; - if (search->count > 0) { - rows[0]=cou->name; - rows[1]=cou->car; - rows[2]=cou->iso2; - rows[3]=cou->iso3; - gtk_clist_append(GTK_CLIST(search->clist), rows); - search->count--; - } -} - -static int -destination_town_add(struct town *town, void *data) -{ - struct search_param *search=data; - struct dest_town *first; - - struct dest_town cmp; - char *zip1, *zip2; - - if (town->id == 0x1d546b7e) { - printf("found\n"); - } - cmp.country=town->country; - cmp.assoc=town->street_assoc; - cmp.name=town->name; - first=g_hash_table_lookup(search->town_hash, &cmp); - if (! first) { - first=g_new(struct dest_town, 1); - first->country=cmp.country; - first->assoc=cmp.assoc; - strcpy(first->postal_code, town->postal_code2); - first->name=town->name; - first->town=*town; - g_hash_table_insert(search->town_hash, first, first); - } else { - zip1=town->postal_code2; - zip2=first->postal_code; - while (*zip1 && *zip2) { - if (*zip1 != *zip2) { - while (*zip2) { - *zip2++='.'; - } - break; - } - zip1++; - zip2++; - } - } - cmp.name=NULL; - cmp.assoc=town->id; - first=g_hash_table_lookup(search->district_hash, &cmp); - if (! first) { - first=g_new(struct dest_town, 1); - first->country=cmp.country; - first->assoc=cmp.assoc; - first->name=NULL; - first->town=*town; - g_hash_table_insert(search->district_hash, first, first); - } - return 0; -} - -static void -destination_town_search(gpointer key, gpointer value, gpointer user_data) -{ - struct country *cou=value; - struct search_param *search=(struct search_param *)user_data; - town_search_by_name(search->map_data, cou->id, search->town, 1, destination_town_add, search); - -} - -static GHashTable * -destination_street_new(void) -{ - return g_hash_table_new_full(NULL, NULL, NULL, g_free); -} - - -static int -destination_street_add(struct street_name *name, void *data) -{ - struct search_param *search=data; - struct street_name *name2; - - name2=g_new(struct street_name, 1); - *name2=*name; - g_hash_table_insert(search->street_hash, name2, name2); - return 0; -} - -static int -number_partial(int search, int ref, int ext) -{ - int max=1; - - printf("number_partial(%d,%d,%d)", search, ref, ext); - if (ref >= 10) - max=10; - if (ref >= 100) - max=100; - if (ref >= 1000) - max=1000; - while (search < max) { - search*=10; - search+=ext; - } - printf("max=%d result=%d\n", max, search); - return search; -} - -static int -check_number(int low, int high, int s_low, int s_high) -{ - printf("check_number(%d,%d,%d,%d)\n", low, high, s_low, s_high); - if (low <= s_high && high >= s_low) - return 1; - if (s_low == s_high) { - if (low <= number_partial(s_high, high, 9) && high >= number_partial(s_low, low, 0)) - return 1; - } - printf("return 0\n"); - return 0; -} - -static void -destination_street_show_common(gpointer key, gpointer value, gpointer user_data, int number) -{ - struct street_name *name=value; - struct search_param *search=(struct search_param *)user_data; - char *utf8; - struct dest_town cmp; - struct dest_town *town; - int row; - char buffer[32]; - char *rows[9]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}; - struct street_name_info info; - struct street_name_number_info num_info; - - name->tmp_len=name->aux_len; - name->tmp_data=name->aux_data; - while (street_name_get_info(&info, name) && search->count > 0) { - struct destination *dest; - cmp.country=info.country; - cmp.assoc=info.dist; - cmp.name=NULL; - town=g_hash_table_lookup(search->district_hash, &cmp); - printf("town=%p\n", town); - if (town) { - destination_town_set(town, rows, 1); - utf8=g_convert(name->name2,-1,"utf-8","iso8859-1",NULL,NULL,NULL); - rows[4]=utf8; - if (number) { - info.tmp_len=info.aux_len; - info.tmp_data=info.aux_data; - while (street_name_get_number_info(&num_info, &info) && search->count > 0) { - dest=g_new(struct destination, 1); - dest->town=&town->town; - dest->street_name=name; - dest->c=num_info.c; - if (check_number(num_info.first, num_info.last, search->number_low, search->number_high)) { - if (num_info.first == num_info.last) - sprintf(buffer,"%d",num_info.first); - else - sprintf(buffer,"%d-%d",num_info.first,num_info.last); - rows[8]=buffer; - printf("'%s','%s','%s','%s','%s','%s'\n", rows[0],rows[1],rows[2],rows[3],rows[4],rows[5]); - row=gtk_clist_append(GTK_CLIST(listbox), rows); - gtk_clist_set_row_data(GTK_CLIST(listbox), row, dest); - search->count--; - } - } - } else { - row=gtk_clist_append(GTK_CLIST(listbox), rows); - dest=g_new(struct destination, 1); - dest->town=&town->town; - dest->street_name=name; - dest->c=info.c; - gtk_clist_set_row_data(GTK_CLIST(listbox), row, dest); - search->count--; - } - g_free(utf8); - } else { - printf("Town for '%s' not found\n", name->name2); - } - } -} - -static void -destination_street_show(gpointer key, gpointer value, gpointer user_data) -{ - destination_street_show_common(key, value, user_data, 0); -} - -static void -destination_street_show_number(gpointer key, gpointer value, gpointer user_data) -{ - destination_street_show_common(key, value, user_data, 1); -} - -static void -destination_street_search(gpointer key, gpointer value, gpointer user_data) -{ - const struct dest_town *town=value; - struct search_param *search=(struct search_param *)user_data; - street_name_search(search->map_data, town->country, town->assoc, search->street, 1, destination_street_add, search); -} - - - -static void changed(GtkWidget *widget, struct search_param *search) -{ - char *str; - char *empty[9]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}; - char *dash; - - current=widget; - - gtk_clist_freeze(GTK_CLIST(listbox)); - gtk_clist_clear(GTK_CLIST(listbox)); - - selected=-1; - - search->count=row_count; - - str=g_convert(gtk_entry_get_text(GTK_ENTRY(widget)),-1,"iso8859-1","utf-8",NULL,NULL,NULL); - /*FIXME free buffers with g_free() after search or when the dialog gets closed. */ - - if (widget == entry_country) { - if (search->country_hash) g_hash_table_destroy(search->country_hash); - search->country_hash=NULL; - } - if (widget == entry_country || widget == entry_city) { - if (search->town_hash) g_hash_table_destroy(search->town_hash); - if (search->district_hash) g_hash_table_destroy(search->district_hash); - search->town_hash=NULL; - search->district_hash=NULL; - } - - if (widget == entry_country || widget == entry_city || widget == entry_street) { - if (search->street_hash) g_hash_table_destroy(search->street_hash); - search->street_hash=NULL; - } - - if (widget != entry_number) { - gtk_entry_set_text(GTK_ENTRY(entry_number),""); - if (widget != entry_street) { - gtk_entry_set_text(GTK_ENTRY(entry_street),""); - if (widget != entry_city) { - gtk_entry_set_text(GTK_ENTRY(entry_city),""); - } - } - } - - if (widget == entry_country) { - search->country_hash=destination_country_new(); - g_free(str); - if (search->country) g_free(search->country); - search->country = str = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget))); - country_search_by_name(str, 1, destination_country_add, search); - country_search_by_car(str, 1, destination_country_add, search); - country_search_by_iso2(str, 1, destination_country_add, search); - country_search_by_iso3(str, 1, destination_country_add, search); - g_hash_table_foreach(search->country_hash, destination_country_show, search); - } - if (widget == entry_city) { - int i; - for(i = 0 ;i < strlen(str); i++) { - unsigned char u = str[i]; - - if (u == 0xc4 || u == 0xe4) str[i] = 'a'; - if (u == 0xd6 || u == 0xf6) str[i] = 'o'; - if (u == 0xdc || u == 0xfc) str[i] = 'u'; - if (u == 0xdf) { - char *tmp; - str[i] = '\0'; - tmp = g_strjoin(NULL, str, "ss", str+i+1, NULL); - g_free(str); - str = tmp; - i++; - } - printf("\"%s\"\n",str); - } - printf("Town: '%s'\n", str); - if (strlen(str) > 1) { - if (search->town) g_free(search->town); - search->town=str; - search->town_hash=destination_town_new(); - search->district_hash=destination_town_new(); - g_hash_table_foreach(search->country_hash, destination_town_search, search); - g_hash_table_foreach(search->town_hash, destination_town_show, search); - } - } - if (widget == entry_street) { - printf("Street: '%s'\n", str); - if (search->street) g_free(search->street); - search->street=str; - search->street_hash=destination_street_new(); - if (search->town_hash) - g_hash_table_foreach(search->town_hash, destination_street_search, search); - if (search->street_hash) - g_hash_table_foreach(search->street_hash, destination_street_show, search); - } - if (widget == entry_number) { - char buffer[strlen(str)+1]; - strcpy(buffer, str); - search->number=str; - dash=index(buffer,'-'); - if (dash) { - *dash++=0; - search->number_low=atoi(buffer); - if (strlen(str)) - search->number_high=atoi(dash); - else - search->number_high=10000; - } else { - if (!strlen(str)) { - search->number_low=0; - search->number_high=10000; - } else { - search->number_low=atoi(str); - search->number_high=atoi(str); - } - } - if (search->street_hash) - g_hash_table_foreach(search->street_hash, destination_street_show_number, search); - } - while (search->count-- > 0) { - gtk_clist_append(GTK_CLIST(listbox), empty); - } - gtk_clist_columns_autosize (GTK_CLIST(listbox)); - gtk_clist_thaw(GTK_CLIST(listbox)); -} - -int destination_address(struct container *co) -{ - GtkWidget *window2, *keyboard, *vbox, *table; - GtkWidget *label_country; - GtkWidget *label_postal, *label_city, *label_district; - GtkWidget *label_street, *label_number; - GtkWidget *hseparator1,*hseparator2; - GtkWidget *button1,*button2; - init_keyboard_stuff((char *) NULL); - int handlerid; - int i; - gchar *text[9]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}; - struct search_param *search=&search_param2; - -#if 0 - if (co->cursor) { - struct coord *c; - struct route_info *rt; - struct street_str *st; - struct block_info *blk; - struct street_name name; - struct town town; - - c=cursor_pos_get(co->cursor); - rt=route_find_nearest_street(co->map_data, c); - st=route_info_get_street(rt); - blk=route_info_get_block(rt); - printf("segid 0x%lx nameid 0x%lx\n", st->segid, st->nameid); - street_name_get_by_id(&name, blk->mdata, st->nameid); - printf("'%s' '%s' %d\n", name.name1, name.name2, name.segment_count); - for (i = 0 ; i < name.segment_count ; i++) { - if (name.segments[i].segid == st->segid) { - printf("found: 0x%x, 0x%x\n", name.segments[i].country, name.segments[i].segid); - town_get_by_id(&town, co->map_data, name.segments[i].country, name.townassoc); - printf("%s/%s\n", town.name, town.district); - } - } - } -#endif - - window2 = gtk_window_new(GTK_WINDOW_TOPLEVEL); - keyboard = build_keyboard(NULL, gettext("/usr/share/gtkeyboard/key/DE.key")); - vbox = gtk_vbox_new(FALSE, 0); - table = gtk_table_new(3, 8, FALSE); - - entry_country = gtk_entry_new(); - label_country = gtk_label_new(gettext("Land")); - entry_postal = gtk_entry_new(); - label_postal = gtk_label_new(gettext("PLZ")); - entry_city = gtk_entry_new(); - label_city = gtk_label_new(gettext("Ort")); - entry_district = gtk_entry_new(); - label_district = gtk_label_new(gettext("Ortsteil/Gemeinde")); - hseparator1 = gtk_vseparator_new(); - entry_street = gtk_entry_new(); - label_street = gtk_label_new(gettext("Strasse")); - entry_number = gtk_entry_new(); - label_number = gtk_label_new(gettext("Nummer")); - listbox = gtk_clist_new(9); - for (i=0 ; i < row_count ; i++) { - gtk_clist_append(GTK_CLIST(listbox), text); - } - gtk_clist_thaw(GTK_CLIST(listbox)); - gtk_clist_columns_autosize (GTK_CLIST(listbox)); - - hseparator2 = gtk_vseparator_new(); - button1 = gtk_button_new_with_label(gettext("Karte")); - button2 = gtk_button_new_with_label(gettext("Ziel")); - - gtk_table_attach(GTK_TABLE(table), label_country, 0, 1, 0, 1, 0, GTK_FILL|GTK_EXPAND, 0, 0); - gtk_table_attach(GTK_TABLE(table), label_postal, 1, 2, 0, 1, 0, GTK_FILL|GTK_EXPAND, 0, 0); - gtk_table_attach(GTK_TABLE(table), label_city, 2, 3, 0, 1, 0, GTK_FILL|GTK_EXPAND, 0, 0); - - gtk_table_attach(GTK_TABLE(table), entry_country, 0, 1, 1, 2, 0, GTK_FILL|GTK_EXPAND, 0, 0); - gtk_table_attach(GTK_TABLE(table), entry_postal, 1, 2, 1, 2, 0, GTK_FILL|GTK_EXPAND, 0, 0); - gtk_table_attach(GTK_TABLE(table), entry_city, 2, 3, 1, 2, 0, GTK_FILL|GTK_EXPAND, 0, 0); - - gtk_table_attach(GTK_TABLE(table), label_district, 0, 1, 2, 3, 0, GTK_FILL|GTK_EXPAND, 0, 0); - gtk_table_attach(GTK_TABLE(table), label_street, 1, 2, 2, 3, 0, GTK_FILL|GTK_EXPAND, 0, 0); - gtk_table_attach(GTK_TABLE(table), label_number, 2, 3, 2, 3, 0, GTK_FILL|GTK_EXPAND, 0, 0); - - gtk_table_attach(GTK_TABLE(table), entry_district, 0, 1, 3, 4, 0, GTK_FILL|GTK_EXPAND, 0, 0); - gtk_table_attach(GTK_TABLE(table), entry_street, 1, 2, 3, 4, 0, GTK_FILL|GTK_EXPAND, 0, 0); - gtk_table_attach(GTK_TABLE(table), entry_number, 2, 3, 3, 4, 0, GTK_FILL|GTK_EXPAND, 0, 0); - - gtk_table_attach(GTK_TABLE(table), listbox, 0, 3, 4, 5, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0); - - gtk_table_attach(GTK_TABLE(table), button1, 0, 1, 5, 6, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0); - gtk_table_attach(GTK_TABLE(table), button2, 2, 3, 5, 6, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0); - - search->map_data=co->map_data; - search->clist=listbox; - g_signal_connect(G_OBJECT(entry_country), "changed", G_CALLBACK(changed), search); - g_signal_connect(G_OBJECT(entry_postal), "changed", G_CALLBACK(changed), search); - g_signal_connect(G_OBJECT(entry_city), "changed", G_CALLBACK(changed), search); - g_signal_connect(G_OBJECT(entry_district), "changed", G_CALLBACK(changed), search); - g_signal_connect(G_OBJECT(entry_street), "changed", G_CALLBACK(changed), search); - g_signal_connect(G_OBJECT(entry_number), "changed", G_CALLBACK(changed), search); - g_signal_connect(G_OBJECT(button1), "clicked", G_CALLBACK(button_map), co); - g_signal_connect(G_OBJECT(button2), "clicked", G_CALLBACK(button_destination), co); - gtk_widget_grab_focus(entry_city); - - gtk_container_add(GTK_CONTAINER(vbox), table); - gtk_container_add(GTK_CONTAINER(vbox), keyboard); - gtk_container_add(GTK_CONTAINER(window2), vbox); - handlerid = gtk_timeout_add(256, (GtkFunction) track_focus, NULL); - - g_signal_connect(G_OBJECT(listbox), "select-row", G_CALLBACK(select_row), NULL); - - gtk_widget_show_all(window2); - - gtk_entry_set_text(GTK_ENTRY(entry_country),gettext("base_country")); - - return 0; -} diff --git a/navit/src/display.c b/navit/src/display.c deleted file mode 100644 index 6b5c218..0000000 --- a/navit/src/display.c +++ /dev/null @@ -1,284 +0,0 @@ -#include -#include -#include -#include -#include -#include "display.h" -#include "graphics.h" - -struct graphics_image *icons; - -static struct graphics_image * -get_icon(struct graphics *gr, char *name) -{ - struct graphics_image *curr=icons; - while (curr) { - if (! strcmp(curr->name, name) && curr->gr == gr) - return curr; - curr=curr->next; - } - curr=gr->image_new(gr, name); - curr->next=icons; - icons=curr; - return curr; -} - -static int -within_dist_point(struct point *p0, struct point *p1, int dist) -{ - if ((p0->x-p1->x)*(p0->x-p1->x) + (p0->y-p1->y)*(p0->y-p1->y) <= dist*dist) { - return 1; - } - return 0; -} - -static int -within_dist_line(struct point *p, struct point *line_p0, struct point *line_p1, int dist) -{ - int vx,vy,wx,wy; - int c1,c2; - struct point line_p; - - vx=line_p1->x-line_p0->x; - vy=line_p1->y-line_p0->y; - wx=p->x-line_p0->x; - wy=p->y-line_p0->y; - - c1=vx*wx+vy*wy; - if ( c1 <= 0 ) - return within_dist_point(p, line_p0, dist); - c2=vx*vx+vy*vy; - if ( c2 <= c1 ) - return within_dist_point(p, line_p1, dist); - - line_p.x=line_p0->x+vx*c1/c2; - line_p.y=line_p0->y+vy*c1/c2; - return within_dist_point(p, &line_p, dist); -} - -static int -within_polygon(struct point *p, struct point *poly_pnt, int count) -{ - int i, j, c = 0; - for (i = 0, j = count-1; i < count; j = i++) { - if ((((poly_pnt[i].y <= p->y) && ( p->y < poly_pnt[j].y )) || - ((poly_pnt[j].y <= p->y) && ( p->y < poly_pnt[i].y))) && - (poly_pnt->x < (poly_pnt[j].x - poly_pnt[i].x) * (p->y - poly_pnt[i].y) / (poly_pnt[j].y - poly_pnt[i].y) + poly_pnt[i].x)) { - c = !c; - } - } - return c; -} - -static int -within_dist_lines(struct point *p, struct point *line_pnt, int count, int dist) -{ - int i; - for (i = 0 ; i < count-1 ; i++) { - if (within_dist_line(p,line_pnt+i,line_pnt+i+1,dist)) { - return 1; - } - } - return 0; -} - -void -display_free(struct display_list **list, int count) -{ - struct display_list *curr,*next; - while (count--) { - curr=*list; - while (curr) { - next=curr->next; - g_free(curr); - curr=next; - } - *list++=NULL; - } -} - -void * -display_add(struct display_list **head, int type, int attr, char *label, int count, struct point *p, void (*info)(struct display_list *list, struct popup_item **item),void *data, int data_size) -{ - struct display_list *new; - int label_len=0; - - if (! data) - data_size=0; - - if (label) - label_len=strlen(label)+1; - new=g_malloc(sizeof(*new)+count*sizeof(*p)+label_len+data_size); - new->type=type; - new->attr=attr; - new->info=info; - if (label) { - new->label=(char *)new+sizeof(*new)+count*sizeof(*p); - strcpy(new->label, label); - } else - new->label=NULL; - new->count=count; - memcpy(new->p, p, count*sizeof(*p)); - if (data_size) { - new->data=(char *)new+sizeof(*new)+count*sizeof(*p)+label_len; - memcpy(new->data, data, data_size); - } else - new->data=NULL; - new->next=*head; - *head=new; - return new->data; -} - -void -display_draw(struct display_list *list, struct graphics *gr, struct graphics_gc *gc_fill, struct graphics_gc *gc_line) -{ - struct graphics_image *icon; - int r=3; - struct point p; - while (list) { - switch (list->type) { - case 0: - gr->draw_polygon(gr, gc_fill, list->p, list->count); - if (gc_line) - gr->draw_lines(gr, gc_line, list->p, list->count); - break; - case 1: - case 2: - gr->draw_lines(gr, gc_fill, list->p, list->count); - break; - case 3: - case 4: - gr->draw_circle(gr, gc_fill, list->p, r); - break; - case 5: - icon=get_icon(gr, list->label); - if (icon) { - p.x=list->p[0].x - icon->width/2; - p.y=list->p[0].y - icon->height/2; - gr->draw_image(gr, gc_fill, &p, icon); - } - else - printf("invalid icon '%s'\n", list->label); - break; - } - list=list->next; - } -} - -void -display_find(struct point *p, struct display_list **in, int in_count, int maxdist, struct display_list **out, int out_count) -{ - int i=0; - struct display_list *curr; - - while (in_count--) { - curr=*in++; - while (curr) { - switch (curr->type) { - case 0: - if (within_polygon(p, curr->p, curr->count) || - within_dist_lines(p, curr->p, curr->count, maxdist)) - { - if (i < out_count) - out[i++]=curr; - } - break; - case 1: - case 2: - if (within_dist_lines(p, curr->p, curr->count, maxdist)) - { - if (i < out_count) - out[i++]=curr; - } - break; - case 3: - case 4: - case 5: - if (within_dist_point(p, curr->p, 8)) - { - if (i < out_count) - out[i++]=curr; - } - break; - } - curr=curr->next; - } - } - if (i < out_count) - out[i]=NULL; -} - - -static void -label_line(struct graphics *gr, struct graphics_gc *fg, struct graphics_gc *bg, struct graphics_font *font, struct point *p, int count, char *label) -{ - int i,x,y,tl; - double dx,dy,l; - struct point p_t; - char *utf8; - - tl=strlen(label)*400; - for (i = 0 ; i < count-1 ; i++) { - dx=p[i+1].x-p[i].x; - dx*=100; - dy=p[i+1].y-p[i].y; - dy*=100; - l=(int)sqrt((float)(dx*dx+dy*dy)); - if (l > tl) { - x=p[i].x; - y=p[i].y; - if (dx < 0) { - dx=-dx; - dy=-dy; - x=p[i+1].x; - y=p[i+1].y; - } - x+=(l-tl)*dx/l/200; - y+=(l-tl)*dy/l/200; - x-=dy*45/l/10; - y+=dx*45/l/10; - p_t.x=x; - p_t.y=y; -#if 0 - printf("display_text: '%s', %d, %d, %d, %d %d\n", label, x, y, dx*0x10000/l, dy*0x10000/l, l); -#endif - if(!g_utf8_validate(label,-1,NULL)){ - gr->draw_text(gr, fg, bg, font, label, &p_t, dx*0x10000/l, dy*0x10000/l); - } else { - utf8=g_convert(label, -1, "utf8", "iso8859-1", NULL, NULL, NULL); - gr->draw_text(gr, fg, bg, font, utf8, &p_t, dx*0x10000/l, dy*0x10000/l); - g_free(utf8); - } - } - } -} - -void -display_labels(struct display_list *list, struct graphics *gr, struct graphics_gc *fg, struct graphics_gc *bg, struct graphics_font *font) -{ - struct point p; - char *utf8; - while (list) { - if (list->label) { - switch (list->type) { - case 1: - case 2: - label_line(gr, fg, bg, font, list->p, list->count, list->label); - break; - case 3: - p.x=list->p[0].x+3; - p.y=list->p[0].y+10; - - if(g_utf8_validate(list->label,-1, NULL)){ - utf8=g_convert(list->label, -1, "utf8", "iso8859-1", NULL, NULL, NULL); - gr->draw_text(gr, fg, bg, font, utf8, &p, 0x10000, 0); - g_free(utf8); - } else { - gr->draw_text(gr, fg, bg, font, list->label, &p, 0x10000, 0); - } - break; - } - } - list=list->next; - } -} diff --git a/navit/src/main.h b/navit/src/main.h deleted file mode 100644 index fbf9d73..0000000 --- a/navit/src/main.h +++ /dev/null @@ -1 +0,0 @@ -extern void *speech_handle; diff --git a/navit/src/map-common.c b/navit/src/map-common.c deleted file mode 100644 index 91d2719..0000000 --- a/navit/src/map-common.c +++ /dev/null @@ -1,442 +0,0 @@ -/* - * This file was generated by orbit-idl-2 - DO NOT EDIT! - */ - -#include -#define ORBIT2_STUBS_API -#define ORBIT_IDL_C_COMMON -#define map_COMMON -#include "map.h" - -static const CORBA_unsigned_long ORBit_zero_int = 0; - -#ifndef ORBIT_IDL_C_IMODULE_map -void -_ORBIT_skel_small_Mappel_Test(POA_Mappel * _o_servant, gpointer _o_retval, - gpointer * _o_args, CORBA_Context _o_ctx, - CORBA_Environment * _o_ev, - void (*_impl_Test) (PortableServer_Servant - _servant, - CORBA_Environment * ev)) -{ - _impl_Test(_o_servant, _o_ev); -} - -void -_ORBIT_skel_small_Map_mapString(POA_Map * _o_servant, gpointer _o_retval, - gpointer * _o_args, CORBA_Context _o_ctx, - CORBA_Environment * _o_ev, - Map(*_impl_mapString) (PortableServer_Servant - _servant, - const CORBA_char * - astring, - CORBA_double * anum, - CORBA_Environment * - ev)) -{ - *(Map *) _o_retval = - _impl_mapString(_o_servant, *(const CORBA_char * *) _o_args[0], - *(CORBA_double * *)_o_args[1], _o_ev); -} - -void -_ORBIT_skel_small_Map_doNothing(POA_Map * _o_servant, gpointer _o_retval, - gpointer * _o_args, CORBA_Context _o_ctx, - CORBA_Environment * _o_ev, - void (*_impl_doNothing) - (PortableServer_Servant _servant, - CORBA_Environment * ev)) -{ - _impl_doNothing(_o_servant, _o_ev); -} - -void -_ORBIT_skel_small_Map_doOneWay(POA_Map * _o_servant, gpointer _o_retval, - gpointer * _o_args, CORBA_Context _o_ctx, - CORBA_Environment * _o_ev, - void (*_impl_doOneWay) (PortableServer_Servant - _servant, - const CORBA_char * - ignore, - CORBA_Environment * - ev)) -{ - _impl_doOneWay(_o_servant, *(const CORBA_char * *) _o_args[0], _o_ev); -} - -void -_ORBIT_skel_small_Map_PlaceFlag(POA_Map * _o_servant, gpointer _o_retval, - gpointer * _o_args, CORBA_Context _o_ctx, - CORBA_Environment * _o_ev, - void (*_impl_PlaceFlag) - (PortableServer_Servant _servant, - CORBA_Environment * ev)) -{ - _impl_PlaceFlag(_o_servant, _o_ev); -} - -void -_ORBIT_skel_small_Map_PointFromCoord(POA_Map * _o_servant, gpointer _o_retval, - gpointer * _o_args, CORBA_Context _o_ctx, - CORBA_Environment * _o_ev, - PointObj(*_impl_PointFromCoord) - (PortableServer_Servant _servant, - const CORBA_char * coord, - CORBA_Environment * ev)) -{ - *(PointObj *) _o_retval = - _impl_PointFromCoord(_o_servant, *(const CORBA_char * *) _o_args[0], - _o_ev); -} - -void -_ORBIT_skel_small_Map_View(POA_Map * _o_servant, gpointer _o_retval, - gpointer * _o_args, CORBA_Context _o_ctx, - CORBA_Environment * _o_ev, - void (*_impl_View) (PortableServer_Servant - _servant, - const PointObj * where, - CORBA_Environment * ev)) -{ - _impl_View(_o_servant, (const PointObj *) _o_args[0], _o_ev); -} - -void -_ORBIT_skel_small_Map_ViewAll(POA_Map * _o_servant, gpointer _o_retval, - gpointer * _o_args, CORBA_Context _o_ctx, - CORBA_Environment * _o_ev, - void (*_impl_ViewAll) (PortableServer_Servant - _servant, - const PointObjSequence * - where, - CORBA_Environment * ev)) -{ - _impl_ViewAll(_o_servant, (const CORBA_sequence_PointObj *) _o_args[0], - _o_ev); -} - -void -_ORBIT_skel_small_Map_Route(POA_Map * _o_servant, gpointer _o_retval, - gpointer * _o_args, CORBA_Context _o_ctx, - CORBA_Environment * _o_ev, - void (*_impl_Route) (PortableServer_Servant - _servant, - const PointObj * src, - const PointObj * dst, - CORBA_Environment * ev)) -{ - _impl_Route(_o_servant, (const PointObj *) _o_args[0], - (const PointObj *) _o_args[1], _o_ev); -} - -void -_ORBIT_skel_small_Map_Get(POA_Map * _o_servant, gpointer _o_retval, - gpointer * _o_args, CORBA_Context _o_ctx, - CORBA_Environment * _o_ev, - Mappel(*_impl_Get) (PortableServer_Servant _servant, - CORBA_Environment * ev)) -{ - *(Mappel *) _o_retval = _impl_Get(_o_servant, _o_ev); -} - -#endif -#if ( (TC_IMPL_TC_PointObj_0 == 'm') \ -&& (TC_IMPL_TC_PointObj_1 == 'a') \ -&& (TC_IMPL_TC_PointObj_2 == 'p') \ -) && !defined(TC_DEF_TC_PointObj) -#define TC_DEF_TC_PointObj 1 -static const char *anon_subnames_array0[] = { "lng", "lat", "height" }; -static const CORBA_TypeCode anon_subtypes_array1[] = - { (CORBA_TypeCode) & TC_CORBA_float_struct, -(CORBA_TypeCode) & TC_CORBA_float_struct, (CORBA_TypeCode) & TC_CORBA_float_struct }; -#ifdef ORBIT_IDL_C_IMODULE_map -static -#endif -const struct CORBA_TypeCode_struct TC_PointObj_struct = { - {&ORBit_TypeCode_epv, ORBIT_REFCOUNT_STATIC}, - CORBA_tk_struct, - 0, - 0, - ORBIT_ALIGNOF_CORBA_FLOAT, - 0, - 3, - (CORBA_TypeCode *) anon_subtypes_array1, - CORBA_OBJECT_NIL, - "PointObj", - "IDL:PointObj:1.0", - (char **) anon_subnames_array0, - NULL, - -1, - 0, - 0, 0 -}; -#endif -#if ( (TC_IMPL_TC_CORBA_sequence_PointObj_0 == 'm') \ -&& (TC_IMPL_TC_CORBA_sequence_PointObj_1 == 'a') \ -&& (TC_IMPL_TC_CORBA_sequence_PointObj_2 == 'p') \ -) && !defined(TC_DEF_TC_CORBA_sequence_PointObj) -#define TC_DEF_TC_CORBA_sequence_PointObj 1 -static const CORBA_TypeCode anon_subtypes_array4[] = - { (CORBA_TypeCode) & TC_PointObj_struct }; -#ifdef ORBIT_IDL_C_IMODULE_map -static -#endif -const struct CORBA_TypeCode_struct TC_CORBA_sequence_PointObj_struct = { - {&ORBit_TypeCode_epv, ORBIT_REFCOUNT_STATIC}, - CORBA_tk_sequence, - 0, - 0, - MAX(ORBIT_ALIGNOF_CORBA_POINTER, - MAX(ORBIT_ALIGNOF_CORBA_LONG, MAX(ORBIT_ALIGNOF_CORBA_STRUCT, 1))), - 0, - 1, - (CORBA_TypeCode *) anon_subtypes_array4, - CORBA_OBJECT_NIL, - NULL, - NULL, - NULL, - NULL, - -1, - 0, - 0, 0 -}; -#endif -#if ( (TC_IMPL_TC_CORBA_sequence_PointObj_0 == 'm') \ -&& (TC_IMPL_TC_CORBA_sequence_PointObj_1 == 'a') \ -&& (TC_IMPL_TC_CORBA_sequence_PointObj_2 == 'p') \ -) && !defined(TC_DEF_TC_CORBA_sequence_PointObj) -#define TC_DEF_TC_CORBA_sequence_PointObj 1 -static const CORBA_TypeCode anon_subtypes_array11[] = - { (CORBA_TypeCode) & TC_PointObj_struct }; -#ifdef ORBIT_IDL_C_IMODULE_map -static -#endif -const struct CORBA_TypeCode_struct TC_CORBA_sequence_PointObj_struct = { - {&ORBit_TypeCode_epv, ORBIT_REFCOUNT_STATIC}, - CORBA_tk_sequence, - 0, - 0, - MAX(ORBIT_ALIGNOF_CORBA_POINTER, - MAX(ORBIT_ALIGNOF_CORBA_LONG, MAX(ORBIT_ALIGNOF_CORBA_STRUCT, 1))), - 0, - 1, - (CORBA_TypeCode *) anon_subtypes_array11, - CORBA_OBJECT_NIL, - NULL, - NULL, - NULL, - NULL, - -1, - 0, - 0, 0 -}; -#endif -#if ( (TC_IMPL_TC_PointObjSequence_0 == 'm') \ -&& (TC_IMPL_TC_PointObjSequence_1 == 'a') \ -&& (TC_IMPL_TC_PointObjSequence_2 == 'p') \ -) && !defined(TC_DEF_TC_PointObjSequence) -#define TC_DEF_TC_PointObjSequence 1 -static const CORBA_TypeCode anon_subtypes_array14[] = - { (CORBA_TypeCode) & TC_CORBA_sequence_PointObj_struct }; -#ifdef ORBIT_IDL_C_IMODULE_map -static -#endif -const struct CORBA_TypeCode_struct TC_PointObjSequence_struct = { - {&ORBit_TypeCode_epv, ORBIT_REFCOUNT_STATIC}, - CORBA_tk_alias, - 0, - 0, - MAX(ORBIT_ALIGNOF_CORBA_POINTER, - MAX(ORBIT_ALIGNOF_CORBA_LONG, MAX(ORBIT_ALIGNOF_CORBA_STRUCT, 1))), - 0, - 1, - (CORBA_TypeCode *) anon_subtypes_array14, - CORBA_OBJECT_NIL, - "PointObjSequence", - "IDL:PointObjSequence:1.0", - NULL, - NULL, - -1, - 0, - 0, 0 -}; -#endif -#if ( (TC_IMPL_TC_Mappel_0 == 'm') \ -&& (TC_IMPL_TC_Mappel_1 == 'a') \ -&& (TC_IMPL_TC_Mappel_2 == 'p') \ -) && !defined(TC_DEF_TC_Mappel) -#define TC_DEF_TC_Mappel 1 -#ifdef ORBIT_IDL_C_IMODULE_map -static -#endif -const struct CORBA_TypeCode_struct TC_Mappel_struct = { - {&ORBit_TypeCode_epv, ORBIT_REFCOUNT_STATIC}, - CORBA_tk_objref, - 0, - 0, - ORBIT_ALIGNOF_CORBA_POINTER, - 0, - 0, - NULL, - CORBA_OBJECT_NIL, - "Mappel", - "IDL:Mappel:1.0", - NULL, - NULL, - -1, - 0, - 0, 0 -}; -#endif -#if ( (TC_IMPL_TC_Map_0 == 'm') \ -&& (TC_IMPL_TC_Map_1 == 'a') \ -&& (TC_IMPL_TC_Map_2 == 'p') \ -) && !defined(TC_DEF_TC_Map) -#define TC_DEF_TC_Map 1 -#ifdef ORBIT_IDL_C_IMODULE_map -static -#endif -const struct CORBA_TypeCode_struct TC_Map_struct = { - {&ORBit_TypeCode_epv, ORBIT_REFCOUNT_STATIC}, - CORBA_tk_objref, - 0, - 0, - ORBIT_ALIGNOF_CORBA_POINTER, - 0, - 0, - NULL, - CORBA_OBJECT_NIL, - "Map", - "IDL:Map:1.0", - NULL, - NULL, - -1, - 0, - 0, 0 -}; -#endif - -#ifndef ORBIT_IDL_C_IMODULE_map -CORBA_unsigned_long Mappel__classid = 0; -#endif - -#ifndef ORBIT_IDL_C_IMODULE_map -CORBA_unsigned_long Map__classid = 0; -#endif - -/* Interface type data */ - -#ifdef ORBIT_IDL_C_IMODULE_map -static -#endif -ORBit_IMethod Mappel__imethods[] = { - { - {0, 0, NULL, FALSE}, - {0, 0, NULL, FALSE}, - {0, 0, NULL, FALSE}, - TC_void, "Test", 4, - 0} -}; -static CORBA_string Mappel__base_itypes[] = { - "IDL:omg.org/CORBA/Object:1.0" -}; - -#ifdef ORBIT_IDL_C_IMODULE_map -static -#endif -ORBit_IInterface Mappel__iinterface = { - TC_Mappel, {1, 1, Mappel__imethods, FALSE}, - {1, 1, Mappel__base_itypes, FALSE} -}; - -static ORBit_IArg Map_mapString__arginfo[] = { - {TC_CORBA_string, ORBit_I_ARG_IN, "astring"}, - {TC_CORBA_double, ORBit_I_ARG_OUT | ORBit_I_COMMON_FIXED_SIZE, "anum"} -}; -static ORBit_IArg Map_doOneWay__arginfo[] = { - {TC_CORBA_string, ORBit_I_ARG_IN, "ignore"} -}; -static ORBit_IArg Map_PointFromCoord__arginfo[] = { - {TC_CORBA_string, ORBit_I_ARG_IN, "coord"} -}; -static ORBit_IArg Map_View__arginfo[] = { - {TC_PointObj, ORBit_I_ARG_IN | ORBit_I_COMMON_FIXED_SIZE, "where"} -}; -static ORBit_IArg Map_ViewAll__arginfo[] = { - {TC_PointObjSequence, ORBit_I_ARG_IN, "where"} -}; -static ORBit_IArg Map_Route__arginfo[] = { - {TC_PointObj, ORBit_I_ARG_IN | ORBit_I_COMMON_FIXED_SIZE, "src"}, - {TC_PointObj, ORBit_I_ARG_IN | ORBit_I_COMMON_FIXED_SIZE, "dst"} -}; - -#ifdef ORBIT_IDL_C_IMODULE_map -static -#endif -ORBit_IMethod Map__imethods[] = { - { - {2, 2, Map_mapString__arginfo, FALSE}, - {0, 0, NULL, FALSE}, - {0, 0, NULL, FALSE}, - TC_Map, "mapString", 9, - 0} - , { - {0, 0, NULL, FALSE}, - {0, 0, NULL, FALSE}, - {0, 0, NULL, FALSE}, - TC_void, "doNothing", 9, - 0} - , { - {1, 1, Map_doOneWay__arginfo, FALSE}, - {0, 0, NULL, FALSE}, - {0, 0, NULL, FALSE}, - TC_void, "doOneWay", 8, - 0 | ORBit_I_METHOD_1_WAY} - , { - {0, 0, NULL, FALSE}, - {0, 0, NULL, FALSE}, - {0, 0, NULL, FALSE}, - TC_void, "PlaceFlag", 9, - 0} - , { - {1, 1, Map_PointFromCoord__arginfo, FALSE}, - {0, 0, NULL, FALSE}, - {0, 0, NULL, FALSE}, - TC_PointObj, "PointFromCoord", 14, - 0 | ORBit_I_COMMON_FIXED_SIZE} - , { - {1, 1, Map_View__arginfo, FALSE}, - {0, 0, NULL, FALSE}, - {0, 0, NULL, FALSE}, - TC_void, "View", 4, - 0} - , { - {1, 1, Map_ViewAll__arginfo, FALSE}, - {0, 0, NULL, FALSE}, - {0, 0, NULL, FALSE}, - TC_void, "ViewAll", 7, - 0} - , { - {2, 2, Map_Route__arginfo, FALSE}, - {0, 0, NULL, FALSE}, - {0, 0, NULL, FALSE}, - TC_void, "Route", 5, - 0} - , { - {0, 0, NULL, FALSE}, - {0, 0, NULL, FALSE}, - {0, 0, NULL, FALSE}, - TC_Mappel, "Get", 3, - 0} -}; -static CORBA_string Map__base_itypes[] = { - "IDL:omg.org/CORBA/Object:1.0" -}; - -#ifdef ORBIT_IDL_C_IMODULE_map -static -#endif -ORBit_IInterface Map__iinterface = { - TC_Map, {9, 9, Map__imethods, FALSE}, - {1, 1, Map__base_itypes, FALSE} -}; diff --git a/navit/src/map-skelimpl.c b/navit/src/map-skelimpl.c deleted file mode 100644 index 890df21..0000000 --- a/navit/src/map-skelimpl.c +++ /dev/null @@ -1,286 +0,0 @@ -/* This is a template file generated by command */ -/* orbit-idl-2 --skeleton-impl map.idl */ -/* User must edit this file, inserting servant */ -/* specific code between markers. */ - -#include "map.h" - -/*** App-specific servant structures ***/ - -typedef struct -{ - POA_Mappel servant; - PortableServer_POA poa; - - /* ------ add private attributes here ------ */ - /* ------ ---------- end ------------ ------ */ -} impl_POA_Mappel; - -typedef struct -{ - POA_Map servant; - PortableServer_POA poa; - - /* ------ add private attributes here ------ */ - /* ------ ---------- end ------------ ------ */ -} impl_POA_Map; - -/*** Implementation stub prototypes ***/ - -static void impl_Mappel__destroy(impl_POA_Mappel * servant, - CORBA_Environment * ev); -static void -impl_Mappel_Test(impl_POA_Mappel * servant, CORBA_Environment * ev); - -static void impl_Map__destroy(impl_POA_Map * servant, CORBA_Environment * ev); -static Map -impl_Map_mapString(impl_POA_Map * servant, - const CORBA_char * astring, - CORBA_double * anum, CORBA_Environment * ev); - -static void -impl_Map_doNothing(impl_POA_Map * servant, CORBA_Environment * ev); - -static void -impl_Map_doOneWay(impl_POA_Map * servant, - const CORBA_char * ignore, CORBA_Environment * ev); - -static void -impl_Map_PlaceFlag(impl_POA_Map * servant, CORBA_Environment * ev); - -static PointObj -impl_Map_PointFromCoord(impl_POA_Map * servant, - const CORBA_char * coord, CORBA_Environment * ev); - -static void -impl_Map_View(impl_POA_Map * servant, - const PointObj * where, CORBA_Environment * ev); - -static void -impl_Map_ViewAll(impl_POA_Map * servant, - const PointObjSequence * where, CORBA_Environment * ev); - -static void -impl_Map_Route(impl_POA_Map * servant, - const PointObj * src, - const PointObj * dst, CORBA_Environment * ev); - -static Mappel impl_Map_Get(impl_POA_Map * servant, CORBA_Environment * ev); - -/*** epv structures ***/ - -static PortableServer_ServantBase__epv impl_Mappel_base_epv = { - NULL, /* _private data */ - (gpointer) & impl_Mappel__destroy, /* finalize routine */ - NULL, /* default_POA routine */ -}; -static POA_Mappel__epv impl_Mappel_epv = { - NULL, /* _private */ - (gpointer) & impl_Mappel_Test, - -}; -static PortableServer_ServantBase__epv impl_Map_base_epv = { - NULL, /* _private data */ - (gpointer) & impl_Map__destroy, /* finalize routine */ - NULL, /* default_POA routine */ -}; -static POA_Map__epv impl_Map_epv = { - NULL, /* _private */ - (gpointer) & impl_Map_mapString, - - (gpointer) & impl_Map_doNothing, - - (gpointer) & impl_Map_doOneWay, - - (gpointer) & impl_Map_PlaceFlag, - - (gpointer) & impl_Map_PointFromCoord, - - (gpointer) & impl_Map_View, - - (gpointer) & impl_Map_ViewAll, - - (gpointer) & impl_Map_Route, - - (gpointer) & impl_Map_Get, - -}; - -/*** vepv structures ***/ - -static POA_Mappel__vepv impl_Mappel_vepv = { - &impl_Mappel_base_epv, - &impl_Mappel_epv, -}; -static POA_Map__vepv impl_Map_vepv = { - &impl_Map_base_epv, - &impl_Map_epv, -}; - -/*** Stub implementations ***/ - -static Mappel -impl_Mappel__create(PortableServer_POA poa, CORBA_Environment * ev) -{ - Mappel retval; - impl_POA_Mappel *newservant; - PortableServer_ObjectId *objid; - - newservant = g_new0(impl_POA_Mappel, 1); - newservant->servant.vepv = &impl_Mappel_vepv; - newservant->poa = - (PortableServer_POA) CORBA_Object_duplicate((CORBA_Object) poa, ev); - POA_Mappel__init((PortableServer_Servant) newservant, ev); - /* Before servant is going to be activated all - * private attributes must be initialized. */ - - /* ------ init private attributes here ------ */ - /* ------ ---------- end ------------- ------ */ - - objid = PortableServer_POA_activate_object(poa, newservant, ev); - CORBA_free(objid); - retval = PortableServer_POA_servant_to_reference(poa, newservant, ev); - - return retval; -} - -static void -impl_Mappel__destroy(impl_POA_Mappel * servant, CORBA_Environment * ev) -{ - CORBA_Object_release((CORBA_Object) servant->poa, ev); - - /* No further remote method calls are delegated to - * servant and you may free your private attributes. */ - /* ------ free private attributes here ------ */ - /* ------ ---------- end ------------- ------ */ - - POA_Mappel__fini((PortableServer_Servant) servant, ev); -} - -static void -impl_Mappel_Test(impl_POA_Mappel * servant, CORBA_Environment * ev) -{ - /* ------ insert method code here ------ */ - /* ------ ---------- end ------------ ------ */ -} - -static Map -impl_Map__create(PortableServer_POA poa, CORBA_Environment * ev) -{ - Map retval; - impl_POA_Map *newservant; - PortableServer_ObjectId *objid; - - newservant = g_new0(impl_POA_Map, 1); - newservant->servant.vepv = &impl_Map_vepv; - newservant->poa = - (PortableServer_POA) CORBA_Object_duplicate((CORBA_Object) poa, ev); - POA_Map__init((PortableServer_Servant) newservant, ev); - /* Before servant is going to be activated all - * private attributes must be initialized. */ - - /* ------ init private attributes here ------ */ - /* ------ ---------- end ------------- ------ */ - - objid = PortableServer_POA_activate_object(poa, newservant, ev); - CORBA_free(objid); - retval = PortableServer_POA_servant_to_reference(poa, newservant, ev); - - return retval; -} - -static void -impl_Map__destroy(impl_POA_Map * servant, CORBA_Environment * ev) -{ - CORBA_Object_release((CORBA_Object) servant->poa, ev); - - /* No further remote method calls are delegated to - * servant and you may free your private attributes. */ - /* ------ free private attributes here ------ */ - /* ------ ---------- end ------------- ------ */ - - POA_Map__fini((PortableServer_Servant) servant, ev); -} - -static Map -impl_Map_mapString(impl_POA_Map * servant, - const CORBA_char * astring, - CORBA_double * anum, CORBA_Environment * ev) -{ - Map retval; - - /* ------ insert method code here ------ */ - /* ------ ---------- end ------------ ------ */ - - return retval; -} - -static void -impl_Map_doNothing(impl_POA_Map * servant, CORBA_Environment * ev) -{ - /* ------ insert method code here ------ */ - /* ------ ---------- end ------------ ------ */ -} - -static void -impl_Map_doOneWay(impl_POA_Map * servant, - const CORBA_char * ignore, CORBA_Environment * ev) -{ - /* ------ insert method code here ------ */ - /* ------ ---------- end ------------ ------ */ -} - -static void -impl_Map_PlaceFlag(impl_POA_Map * servant, CORBA_Environment * ev) -{ - /* ------ insert method code here ------ */ - /* ------ ---------- end ------------ ------ */ -} - -static PointObj -impl_Map_PointFromCoord(impl_POA_Map * servant, - const CORBA_char * coord, CORBA_Environment * ev) -{ - PointObj retval; - - /* ------ insert method code here ------ */ - /* ------ ---------- end ------------ ------ */ - - return retval; -} - -static void -impl_Map_View(impl_POA_Map * servant, - const PointObj * where, CORBA_Environment * ev) -{ - /* ------ insert method code here ------ */ - /* ------ ---------- end ------------ ------ */ -} - -static void -impl_Map_ViewAll(impl_POA_Map * servant, - const PointObjSequence * where, CORBA_Environment * ev) -{ - /* ------ insert method code here ------ */ - /* ------ ---------- end ------------ ------ */ -} - -static void -impl_Map_Route(impl_POA_Map * servant, - const PointObj * src, - const PointObj * dst, CORBA_Environment * ev) -{ - /* ------ insert method code here ------ */ - /* ------ ---------- end ------------ ------ */ -} - -static Mappel -impl_Map_Get(impl_POA_Map * servant, CORBA_Environment * ev) -{ - Mappel retval; - - /* ------ insert method code here ------ */ - /* ------ ---------- end ------------ ------ */ - - return retval; -} diff --git a/navit/src/map-skels.c b/navit/src/map-skels.c deleted file mode 100644 index bcc9925..0000000 --- a/navit/src/map-skels.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * This file was generated by orbit-idl-2 - DO NOT EDIT! - */ - -#include -#define ORBIT2_STUBS_API -#include "map.h" - -static ORBitSmallSkeleton -get_skel_small_Mappel(POA_Mappel * servant, - const char *opname, gpointer * m_data, gpointer * impl) -{ - switch (opname[0]) { - case 'T': - if (strcmp((opname + 1), "est")) - break; - *impl = (gpointer) servant->vepv->Mappel_epv->Test; - *m_data = (gpointer) & Mappel__iinterface.methods._buffer[0]; - return (ORBitSmallSkeleton) _ORBIT_skel_small_Mappel_Test; - break; - default: - break; - } - return NULL; -} - -void -POA_Mappel__init(PortableServer_Servant servant, CORBA_Environment * env) -{ - static PortableServer_ClassInfo class_info = - { NULL, (ORBit_small_impl_finder) & get_skel_small_Mappel, -"IDL:Mappel:1.0", &Mappel__classid, NULL, &Mappel__iinterface }; - PortableServer_ServantBase__init(((PortableServer_ServantBase *) servant), - env); - ORBit_skel_class_register(&class_info, servant, POA_Mappel__fini, - ORBIT_VEPV_OFFSET(POA_Mappel__vepv, Mappel_epv), - (CORBA_unsigned_long) 0); -} - -void -POA_Mappel__fini(PortableServer_Servant servant, CORBA_Environment * env) -{ - PortableServer_ServantBase__fini(servant, env); -} - -static ORBitSmallSkeleton -get_skel_small_Map(POA_Map * servant, - const char *opname, gpointer * m_data, gpointer * impl) -{ - switch (opname[0]) { - case 'G': - if (strcmp((opname + 1), "et")) - break; - *impl = (gpointer) servant->vepv->Map_epv->Get; - *m_data = (gpointer) & Map__iinterface.methods._buffer[8]; - return (ORBitSmallSkeleton) _ORBIT_skel_small_Map_Get; - break; - case 'P': - switch (opname[1]) { - case 'l': - if (strcmp((opname + 2), "aceFlag")) - break; - *impl = (gpointer) servant->vepv->Map_epv->PlaceFlag; - *m_data = (gpointer) & Map__iinterface.methods._buffer[3]; - return (ORBitSmallSkeleton) _ORBIT_skel_small_Map_PlaceFlag; - break; - case 'o': - if (strcmp((opname + 2), "intFromCoord")) - break; - *impl = (gpointer) servant->vepv->Map_epv->PointFromCoord; - *m_data = (gpointer) & Map__iinterface.methods._buffer[4]; - return (ORBitSmallSkeleton) _ORBIT_skel_small_Map_PointFromCoord; - break; - default: - break; - } - break; - case 'R': - if (strcmp((opname + 1), "oute")) - break; - *impl = (gpointer) servant->vepv->Map_epv->Route; - *m_data = (gpointer) & Map__iinterface.methods._buffer[7]; - return (ORBitSmallSkeleton) _ORBIT_skel_small_Map_Route; - break; - case 'V': - switch (opname[1]) { - case 'i': - switch (opname[2]) { - case 'e': - switch (opname[3]) { - case 'w': - switch (opname[4]) { - case '\0': - *impl = (gpointer) servant->vepv->Map_epv->View; - *m_data = - (gpointer) & Map__iinterface.methods. - _buffer[5]; - return (ORBitSmallSkeleton) - _ORBIT_skel_small_Map_View; - break; - case 'A': - if (strcmp((opname + 5), "ll")) - break; - *impl = - (gpointer) servant->vepv->Map_epv->ViewAll; - *m_data = - (gpointer) & Map__iinterface.methods. - _buffer[6]; - return (ORBitSmallSkeleton) - _ORBIT_skel_small_Map_ViewAll; - break; - default: - break; - } - break; - default: - break; - } - break; - default: - break; - } - break; - default: - break; - } - break; - case 'd': - switch (opname[1]) { - case 'o': - switch (opname[2]) { - case 'N': - if (strcmp((opname + 3), "othing")) - break; - *impl = (gpointer) servant->vepv->Map_epv->doNothing; - *m_data = (gpointer) & Map__iinterface.methods._buffer[1]; - return (ORBitSmallSkeleton) _ORBIT_skel_small_Map_doNothing; - break; - case 'O': - if (strcmp((opname + 3), "neWay")) - break; - *impl = (gpointer) servant->vepv->Map_epv->doOneWay; - *m_data = (gpointer) & Map__iinterface.methods._buffer[2]; - return (ORBitSmallSkeleton) _ORBIT_skel_small_Map_doOneWay; - break; - default: - break; - } - break; - default: - break; - } - break; - case 'm': - if (strcmp((opname + 1), "apString")) - break; - *impl = (gpointer) servant->vepv->Map_epv->mapString; - *m_data = (gpointer) & Map__iinterface.methods._buffer[0]; - return (ORBitSmallSkeleton) _ORBIT_skel_small_Map_mapString; - break; - default: - break; - } - return NULL; -} - -void -POA_Map__init(PortableServer_Servant servant, CORBA_Environment * env) -{ - static PortableServer_ClassInfo class_info = - { NULL, (ORBit_small_impl_finder) & get_skel_small_Map, "IDL:Map:1.0", -&Map__classid, NULL, &Map__iinterface }; - PortableServer_ServantBase__init(((PortableServer_ServantBase *) servant), - env); - ORBit_skel_class_register(&class_info, servant, POA_Map__fini, - ORBIT_VEPV_OFFSET(POA_Map__vepv, Map_epv), - (CORBA_unsigned_long) 0); -} - -void -POA_Map__fini(PortableServer_Servant servant, CORBA_Environment * env) -{ - PortableServer_ServantBase__fini(servant, env); -} diff --git a/navit/src/map-stubs.c b/navit/src/map-stubs.c deleted file mode 100644 index fa7d0f3..0000000 --- a/navit/src/map-stubs.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * This file was generated by orbit-idl-2 - DO NOT EDIT! - */ - -#include -#define ORBIT2_STUBS_API -#include "map.h" - -void -Mappel_Test(Mappel _obj, CORBA_Environment * ev) -{ - ORBit_c_stub_invoke(_obj, &Mappel__iinterface.methods, 0, NULL, NULL, NULL, - ev, Mappel__classid, G_STRUCT_OFFSET(POA_Mappel__epv, - Test), - (ORBitSmallSkeleton) _ORBIT_skel_small_Mappel_Test); - -} - -Map -Map_mapString(Map _obj, const CORBA_char * astring, CORBA_double * anum, - CORBA_Environment * ev) -{ - Map _ORBIT_retval; - gpointer _args[2]; - - _args[0] = (gpointer) & astring; - _args[1] = &anum; - ORBit_c_stub_invoke(_obj, &Map__iinterface.methods, 0, &_ORBIT_retval, - _args, NULL, ev, Map__classid, - G_STRUCT_OFFSET(POA_Map__epv, mapString), - (ORBitSmallSkeleton) _ORBIT_skel_small_Map_mapString); - - return _ORBIT_retval; -} - -void -Map_doNothing(Map _obj, CORBA_Environment * ev) -{ - ORBit_c_stub_invoke(_obj, &Map__iinterface.methods, 1, NULL, NULL, NULL, - ev, Map__classid, G_STRUCT_OFFSET(POA_Map__epv, - doNothing), - (ORBitSmallSkeleton) _ORBIT_skel_small_Map_doNothing); - -} - -void -Map_doOneWay(Map _obj, const CORBA_char * ignore, CORBA_Environment * ev) -{ - gpointer _args[1]; - - _args[0] = (gpointer) & ignore; - ORBit_c_stub_invoke(_obj, &Map__iinterface.methods, 2, NULL, _args, NULL, - ev, Map__classid, G_STRUCT_OFFSET(POA_Map__epv, - doOneWay), - (ORBitSmallSkeleton) _ORBIT_skel_small_Map_doOneWay); - -} - -void -Map_PlaceFlag(Map _obj, CORBA_Environment * ev) -{ - ORBit_c_stub_invoke(_obj, &Map__iinterface.methods, 3, NULL, NULL, NULL, - ev, Map__classid, G_STRUCT_OFFSET(POA_Map__epv, - PlaceFlag), - (ORBitSmallSkeleton) _ORBIT_skel_small_Map_PlaceFlag); - -} - -PointObj -Map_PointFromCoord(Map _obj, const CORBA_char * coord, CORBA_Environment * ev) -{ - PointObj _ORBIT_retval; - gpointer _args[1]; - - _args[0] = (gpointer) & coord; - ORBit_c_stub_invoke(_obj, &Map__iinterface.methods, 4, &_ORBIT_retval, - _args, NULL, ev, Map__classid, - G_STRUCT_OFFSET(POA_Map__epv, PointFromCoord), - (ORBitSmallSkeleton) - _ORBIT_skel_small_Map_PointFromCoord); - - return _ORBIT_retval; -} - -void -Map_View(Map _obj, const PointObj * where, CORBA_Environment * ev) -{ - gpointer _args[1]; - - _args[0] = (gpointer) where; - ORBit_c_stub_invoke(_obj, &Map__iinterface.methods, 5, NULL, _args, NULL, - ev, Map__classid, G_STRUCT_OFFSET(POA_Map__epv, View), - (ORBitSmallSkeleton) _ORBIT_skel_small_Map_View); - -} - -void -Map_ViewAll(Map _obj, const PointObjSequence * where, CORBA_Environment * ev) -{ - gpointer _args[1]; - - _args[0] = (gpointer) where; - ORBit_c_stub_invoke(_obj, &Map__iinterface.methods, 6, NULL, _args, NULL, - ev, Map__classid, G_STRUCT_OFFSET(POA_Map__epv, - ViewAll), - (ORBitSmallSkeleton) _ORBIT_skel_small_Map_ViewAll); - -} - -void -Map_Route(Map _obj, const PointObj * src, const PointObj * dst, - CORBA_Environment * ev) -{ - gpointer _args[2]; - - _args[0] = (gpointer) src; - _args[1] = (gpointer) dst; - ORBit_c_stub_invoke(_obj, &Map__iinterface.methods, 7, NULL, _args, NULL, - ev, Map__classid, G_STRUCT_OFFSET(POA_Map__epv, Route), - (ORBitSmallSkeleton) _ORBIT_skel_small_Map_Route); - -} - -Mappel -Map_Get(Map _obj, CORBA_Environment * ev) -{ - Mappel _ORBIT_retval; - - ORBit_c_stub_invoke(_obj, &Map__iinterface.methods, 8, &_ORBIT_retval, - NULL, NULL, ev, Map__classid, - G_STRUCT_OFFSET(POA_Map__epv, Get), - (ORBitSmallSkeleton) _ORBIT_skel_small_Map_Get); - - return _ORBIT_retval; -} diff --git a/navit/src/map.idl b/navit/src/map.idl deleted file mode 100644 index a68c7d5..0000000 --- a/navit/src/map.idl +++ /dev/null @@ -1,25 +0,0 @@ -struct PointObj { - float lng; /* degrees */ - float lat; /* degrees */ - float height; /* meters */ -}; - -typedef sequence PointObjSequence; - -interface Mappel { - void Test(); -}; - -interface Map { - Map mapString (in string astring, - out double anum); - void doNothing (); - oneway void doOneWay (in string ignore); - void PlaceFlag(); - PointObj PointFromCoord(in string coord); - void View(in PointObj where); - void ViewAll(in PointObjSequence where); - void Route(in PointObj src, in PointObj dst); - Mappel Get(); -}; - diff --git a/navit/src/map.ior b/navit/src/map.ior deleted file mode 100644 index cb892ef..0000000 --- a/navit/src/map.ior +++ /dev/null @@ -1 +0,0 @@ -IOR:010f00000c00000049444c3a4d61703a312e3000030000000054424f540000000101020005000000554e495800736f630900000070636d617274696e00005f6d2c0000002f746d702f6f726269742d6d617274696e2f6c696e632d353830642d302d363264393631633861336164360000000000caaedfba58000000010102312c0000002f746d702f6f726269742d6d617274696e2f6c696e632d353830642d302d3632643936316338613361643600000000001c00000000000000ad20380865f02828dd29282828282828010000007c08e43c0100000048000000016c654202000000050000001c00000000000000ad20380865f02828dd29282828282828010000007c08e43c0100000014000000010f000001000105000000000901010000000000 diff --git a/navit/src/poly.c b/navit/src/poly.c deleted file mode 100644 index 4fb8514..0000000 --- a/navit/src/poly.c +++ /dev/null @@ -1,110 +0,0 @@ -#include -#include -#include "coord.h" -#include "map_data.h" -#include "file.h" -#include "block.h" -#include "poly.h" -#include "display.h" -#include "draw_info.h" -#include "data_window.h" -#include "container.h" - -extern struct data_window poly_window; - - -static int -poly_get_hdr(unsigned char **p,struct poly_hdr *poly_hdr) -{ - poly_hdr->addr=*p; - poly_hdr->c=(struct coord *) (*p); - *p+=3*sizeof(struct coord); - poly_hdr->name=(char *)(*p); - while (**p) { - (*p)++; - } - (*p)++; - poly_hdr->order=*(*p)++; - poly_hdr->type=*(*p)++; - poly_hdr->polys=*(u32 *)(*p); (*p)+=sizeof(u32); - poly_hdr->count=(u32 *)(*p); (*p)+=poly_hdr->polys*sizeof(u32); - poly_hdr->count_sum=*(u32 *)(*p); (*p)+=sizeof(u32); - return 0; -} - -static void -poly_draw_segment(struct container *co, struct segment *seg, int disp, unsigned char **p, int limit) -{ - struct poly_hdr poly_hdr; - struct coord *coord; - unsigned int j,k,o; - struct point pnt; - struct param_list param[100]; - int max=20000; - struct point xpoints[max]; - - seg->data[0]=*p; - poly_get_hdr(p, &poly_hdr); - if (poly_hdr.order < limit && is_visible(co->trans, poly_hdr.c)) { - transform(co->trans,&poly_hdr.c[2],&pnt); - for (k = 0 ; k < poly_hdr.polys ; k++) { - assert(poly_hdr.count[k] < max); - for (j = 0 ; j < poly_hdr.count[k] ; j++) { - transform(co->trans, coord_get(p), &xpoints[j]); - } - if (poly_hdr.type < 0x80) { - o=0; - if (poly_hdr.type == 0x1e) - o=1; - else if (poly_hdr.type == 0x2d) - o=2; - else if (poly_hdr.type == 0x32) - o=3; - display_add(&co->disp[disp+o], 0, 0, poly_hdr.name, poly_hdr.count[k], xpoints, NULL, seg, sizeof(*seg)); - - } else { - display_add(&co->disp[disp], 1, 0, poly_hdr.name, poly_hdr.count[k], xpoints, NULL, seg, sizeof(*seg)); - } - if (co->data_window[data_window_type_poly]) - data_window_add(co->data_window[data_window_type_poly], param, poly_get_param(seg, param, 100)); - } - } else - (*p)+=poly_hdr.count_sum*sizeof(*coord); -} - -void -poly_draw_block(struct block_info *blk_inf, unsigned char *p, unsigned char *end, void *data) -{ - struct draw_info *drw_inf=data; - struct segment seg; - int i; - - seg.blk_inf=*blk_inf; - - for (i = 0 ; i < blk_inf->block->count ; i++) - poly_draw_segment(drw_inf->co, &seg, drw_inf->display, &p, drw_inf->limit); -} - - -int -poly_get_param(struct segment *seg, struct param_list *param, int count) -{ - int i=count; - unsigned char *p=seg->data[0]; - struct poly_hdr poly_hdr; - - - param_add_hex("Addr", p-seg->blk_inf.file->begin, ¶m, &count); - poly_get_hdr(&p, &poly_hdr); - param_add_string("Name", poly_hdr.name, ¶m, &count); - param_add_hex("L", poly_hdr.c[0].x, ¶m, &count); - param_add_hex("T", poly_hdr.c[0].y, ¶m, &count); - param_add_hex("R", poly_hdr.c[1].x, ¶m, &count); - param_add_hex("B", poly_hdr.c[1].y, ¶m, &count); - param_add_hex("X", poly_hdr.c[2].x, ¶m, &count); - param_add_hex("Y", poly_hdr.c[2].y, ¶m, &count); - param_add_hex("Order", poly_hdr.order, ¶m, &count); - param_add_hex("Type", poly_hdr.type, ¶m, &count); - param_add_hex("Polys", poly_hdr.polys, ¶m, &count); - return i-count; -} diff --git a/navit/src/poly.h b/navit/src/poly.h deleted file mode 100644 index 9d9dcbf..0000000 --- a/navit/src/poly.h +++ /dev/null @@ -1,13 +0,0 @@ -struct poly_hdr { - unsigned char *addr; - struct coord *c; - char *name; - unsigned char order; - unsigned char type; - u32 polys; - u32 *count; - u32 count_sum; -}; - -void poly_draw_block(struct block_info *blk_inf, unsigned char *p, unsigned char *end, void *data); -int poly_get_param(struct segment *seg, struct param_list *param, int count); diff --git a/navit/src/street.c b/navit/src/street.c deleted file mode 100644 index 1880e12..0000000 --- a/navit/src/street.c +++ /dev/null @@ -1,616 +0,0 @@ -#include -#include -#include -#include -#include "container.h" -#include "coord.h" -#include "map_data.h" -#include "file.h" -#include "block.h" -#include "route.h" -#include "street.h" -#include "street_data.h" -#include "street_name.h" -#include "display.h" -#include "draw_info.h" -#include "data_window.h" -#include "data.h" -#include "tree.h" - - -static void -street_draw_segment(struct container *co, struct segment *seg, unsigned char **pos, unsigned char *end, struct coord *ref, int bytes, int include, int disp) -{ - int j,flags,limit; - struct coord f; - struct coord l[2]; - struct street_str *str=seg->data[0]; - char *label; - struct street_name name; - struct param_list param[100]; - struct route_path_segment *route; - struct display_list **displ=co->disp; - int max=10000; - struct point xpoints[max]; - - flags=0; - j=0; - while (! flags && *pos < end) { - flags=street_get_coord(pos, bytes, ref, &f); - if (! j) { - l[0]=f; - l[1]=f; - } else { - if (include || !flags) { - if (f.x < l[0].x) l[0].x=f.x; - if (f.x > l[1].x) l[1].x=f.x; - if (f.y > l[0].y) l[0].y=f.y; - if (f.y < l[1].y) l[1].y=f.y; - } - } - transform(co->trans, &f, &xpoints[j]); - if (! j) - flags=0; - j++; - assert(j < max); - } - if (! include) - j--; - if (is_visible(co->trans, l) && str->type) { - label=NULL; - if (str->nameid) { - street_name_get_by_id(&name, seg->blk_inf.mdata, str->nameid); - if (name.name2[0]) - label=name.name2; - else - label=name.name1; - } -#if 0 - if (str->nameid && name.townassoc < 0 ) { - char buffer[128]; - sprintf(buffer,"-0x%x", -name.townassoc); - label=g_strdup(buffer); - } -#endif - limit=0; - if (str->limit == 0x30) - limit=1; - if (str->limit == 0x03) - limit=-1; - if (str->type & 0x40) - limit=-limit; - display_add(&displ[disp], 2, limit, label, j, xpoints, NULL, seg, sizeof(*seg)); - if (co->route && (route=route_path_get(co->route, str->segid))) { - if (! route->offset) - display_add(&displ[display_street_route], 2, 0, label, j, xpoints, NULL, NULL, 0); - else if (route->offset > 0) - display_add(&displ[display_street_route], 2, 0, label, route->offset, xpoints, NULL, NULL, 0); - else - display_add(&displ[display_street_route], 2, 0, label, j+route->offset, xpoints-route->offset, NULL, NULL, 0); - } - if (co->data_window[data_window_type_street]) - data_window_add(co->data_window[data_window_type_street], param, street_get_param(seg, param, 100, 0)); - } - *pos-=2*bytes; -} - -static void -street_safety_check(struct street_str *str) -{ -#if 0 - if (!((str->type & 0xf0) == 0x0 || (str->type & 0xf0) == 0x40)) { - printf("str->type=0x%x\n", str->type); - } - assert((str->type & 0xf0) == 0x0 || (str->type & 0xf0) == 0x40); -#endif - assert(str->type != 0xe && str->type != 0x4e && str->type != 0x40); - assert(str->unknown2 == str->unknown3); - assert(str->unknown2 == 0x40 || str->unknown2 == 0x44); -} - -struct street_header_type { - struct street_header *header; - int type_count; - struct street_type *type; -}; - -static void -street_header_type_get(struct block *blk, unsigned char **p_p, struct street_header_type *ret) -{ - unsigned char *p=*p_p; - ret->header=(struct street_header *)p; - p+=sizeof(struct street_header); - ret->type_count=blk->count; - ret->type=(struct street_type *)p; - p+=ret->type_count*sizeof(struct street_type); - assert(ret->header->count == blk->count); - *p_p=p; -} - -static void -street_coord_get_begin(unsigned char **p_p) -{ - unsigned char *p=*p_p; - struct street_str *str; - - str=(struct street_str *)p; - while (str->segid) { - str++; - } - p=(unsigned char *)str; - p+=4; - *p_p=p; -} - -struct street_coord_handle -{ - unsigned char *p; - unsigned char *p_rewind; - unsigned char *next; - unsigned char *end; - int bytes; - int status; - int status_rewind; - struct coord *ref; -}; - -struct street_coord_handle * -street_coord_handle_new(struct block_info *blk_inf, struct street_str *str) -{ - struct street_coord_handle *ret; - unsigned char *p=(unsigned char *)(blk_inf->block); - struct block *blk; - struct street_header_type hdr_type; - struct street_str *str_curr; - int num; - - ret=g_new0(struct street_coord_handle,1); - - ret->end=p; - blk=block_get(&p); - ret->end+=blk->size; - ret->bytes=street_get_bytes(blk); - ret->ref=blk->c; - - street_header_type_get(blk, &p, &hdr_type); - str_curr=(struct street_str *)p; - num=str-str_curr; - street_coord_get_begin(&p); - street_get_coord(&p, ret->bytes, blk->c, NULL); - while (num && str_curr->segid) { - while (! street_get_coord(&p, ret->bytes, blk->c, NULL) && p < ret->end) - ret->p=p; - str_curr++; - num--; - } - ret->status=str[1].segid > 0 ? 0:1; - ret->p_rewind=ret->p; - ret->status_rewind=ret->status; - - return ret; -} - -void -street_coord_handle_rewind(struct street_coord_handle *h) -{ - h->p=h->p_rewind; - h->status=h->status_rewind; -} - -int -street_coord_handle_get(struct street_coord_handle *h, struct coord *c, int count) -{ - unsigned char *n; - int ret=0; - - while (count > 0) { - if (h->p >= h->end) - return ret; - if (h->status >= 4) - return ret; - n=h->p; - if (street_get_coord(&h->p, h->bytes, h->ref, c)) { - h->next=n; - h->status+=2; - if (h->status == 5) - return ret; - } - c++; - ret++; - count--; - } - return ret; -} - -void -street_coord_handle_destroy(struct street_coord_handle *handle) -{ - g_free(handle); -} - -void -street_draw_block(struct block_info *blk_inf, unsigned char *p, unsigned char *end, void *data) -{ - struct street_str *str; - struct street_header_type header_type; - struct street_type *str_type; - int include,count,ncount,bytes,offset; - struct draw_info *drw_inf=data; - struct segment seg; - - seg.blk_inf=*blk_inf; - - street_header_type_get(blk_inf->block, &p, &header_type); - if (header_type.header->order >= drw_inf->limit) - return; - - str_type=header_type.type; - bytes=street_get_bytes(blk_inf->block); - str=(struct street_str *)p; - count=0; - ncount=0; - street_coord_get_begin(&p); - str_type--; - while (str->segid) { - include=1; - if (str[1].segid < 0) { - include=0; - str_type++; - } - seg.data[0]=str; - seg.data[1]=str_type; - seg.data[2]=p; - seg.data[3]=header_type.header; - street_safety_check(str); - offset=0; - if (header_type.header->order < 0x2) - offset=3; - else if (header_type.header->order < 0x4 && str->type != 0x6 && str->type != 0x46) - offset=2; - else if (header_type.header->order < 0x6) - offset=1; - if (str->limit == 0x33) - offset=4; - street_draw_segment(drw_inf->co, &seg, &p, end-4, blk_inf->block->c, bytes, include, drw_inf->display+offset); - str++; - } -} - -void -street_bti_draw_block(struct block_info *blk_inf, unsigned char *p, unsigned char *end, void *data) -{ - struct draw_info *drw_inf=data; - struct street_bti *str; - struct point pnt; - struct param_list param[100]; - struct segment seg; - - while (p < end) { - str=(struct street_bti *)p; - seg.data[0]=str; - p+=sizeof(*str); - if (transform(drw_inf->co->trans, &str->c, &pnt)) { - display_add(&drw_inf->co->disp[display_bti], 4, 0, NULL, 1, &pnt, NULL, &seg, sizeof(seg)); - if (drw_inf->co->data_window[data_window_type_point]) - data_window_add(drw_inf->co->data_window[data_window_type_point], param, street_bti_get_param(&seg, param, 100)); - } - } -} - -void -street_route_draw(struct container *co) -{ - struct route_path_segment *route=NULL; - struct point xpoints[2]; - - if (co->route) - route=route_path_get_all(co->route); - while (route) { - if (!route->segid) { - transform(co->trans, &route->c[0], &xpoints[0]); - transform(co->trans, &route->c[1], &xpoints[1]); - display_add(&co->disp[display_street_route], 2, 0, NULL, 2, xpoints, NULL, NULL, 0); - } - route=route->next; - } -} - -struct street_coord * -street_coord_get(struct block_info *blk_inf, struct street_str *str) -{ - struct block *blk; - unsigned char *p=(unsigned char *)(blk_inf->block),*end,*p_sav; - struct street_header_type hdr_type; - struct street_str *str_curr; - struct coord f,*c; - struct street_coord *ret; - int bytes,num,points,include; - int debug=0; - - end=p; - blk=block_get(&p); - end+=blk->size; - - street_header_type_get(blk, &p, &hdr_type); - str_curr=(struct street_str *)p; - num=str-str_curr; - street_coord_get_begin(&p); - bytes=street_get_bytes(blk); - if (debug) { - printf("num=%d\n", num); - } - street_get_coord(&p, bytes, blk->c, &f); - while (num && str_curr->segid) { - while (! street_get_coord(&p, bytes, blk->c, &f) && p < end); - str_curr++; - num--; - } - include=(str[1].segid > 0); - p_sav=p-2*bytes; - points=1+include; - while (! street_get_coord(&p, bytes, blk->c, &f) && p < end) - points++; - - if (debug) - printf("p=%p points=%d\n",p_sav, points); - p=p_sav; - ret=g_malloc(sizeof(struct street_coord)+points*sizeof(struct coord)); - ret->count=points; - c=ret->c; - while (points) { - street_get_coord(&p, bytes, blk->c, c); - c++; - points--; - } - return ret; -} - -struct street_get_block_param -{ - void *data; - int (*callback)(struct street_str *str, struct street_coord_handle *h, void *data); -}; - -static void -street_get_block_process(struct block_info *blk_inf, unsigned char *p, unsigned char *end, void *data) -{ - struct street_header_type header_type; - struct street_coord_handle h; - struct street_str *str; - int count; - struct street_get_block_param *param=(struct street_get_block_param *)data; - - street_header_type_get(blk_inf->block, &p, &header_type); - - h.bytes=street_get_bytes(blk_inf->block); - h.end=end; - h.ref=blk_inf->block->c; - - str=(struct street_str *)p; - count=0; - street_coord_get_begin(&p); - h.p=p; - - while (str->segid) { - h.status=str[1].segid > 0 ? 0:1; - h.p_rewind=h.p; - h.status_rewind=h.status; - param->callback(str, &h, param->data); - while (! h.next && street_coord_handle_get(&h, NULL, 1)); - h.p=h.next; - str++; - } -} - -void -street_get_block(struct map_data *mdata, struct transformation *t, void (*callback)(void *data), void *data) -{ - struct street_get_block_param param; - - param.callback=callback; - param.data=data; - map_data_foreach(mdata, file_street_str, t, 48, street_get_block_process, ¶m); - -} - -int -street_get_by_id(struct map_data *mdat, int country, int id, struct block_info *res_blk_inf, struct street_str **res_str) -{ - int debug=0; - int res,block,num; - struct map_data *mdat_res; - struct block *blk; - unsigned char *p; - struct street_header_type hdr_type; - struct street_str *str; - - if (debug) - printf("street_get_by_id country 0x%x id %d\n", country, id); - if (tree_search_hv_map(mdat, file_street_str, (id >> 8) | (country << 24), id & 0xff, &res, &mdat_res)) { - if (debug) - printf("not found\n"); - return 1; - } - - block=res >> 12; - num=res & 0xfff; - if (debug) { - printf("block=0x%x\n", block); - printf("num=0x%x\n", num); - } - blk=block_get_byindex(mdat_res->file[file_street_str], block, &p); - res_blk_inf->mdata=mdat_res; - res_blk_inf->file=mdat_res->file[file_street_str]; - res_blk_inf->block=blk; - if (debug) { - printf("blk->count=0x%x\n", blk->count); - } - street_header_type_get(blk, &p, &hdr_type); - str=(struct street_str *)p; - str+=num; - *res_str=str; - return 0; -} - -int -street_get_param(struct segment *seg, struct param_list *param, int count, int verbose) -{ - char buffer[1024]; - int i=count,j; - struct street_str *str=seg->data[0]; - struct street_type *type=seg->data[1]; - struct street_name name; - struct street_name_info name_info; -#if 0 - struct street_name_number_info name_number_info; -#endif - - param_add_hex("Type-Addr", (unsigned char *)type-seg->blk_inf.file->begin, ¶m, &count); - param_add_hex("Order", type->order, ¶m, &count); - param_add_hex("Country", type->country, ¶m, &count); - - param_add_hex("Addr", (unsigned char *)str-seg->blk_inf.file->begin, ¶m, &count); - param_add_hex_sig("Seg-Id", str->segid, ¶m, &count); - param_add_hex("Limit", str->limit, ¶m, &count); - param_add_hex("Unknown2", str->unknown2, ¶m, &count); - param_add_hex("Unknown3", str->unknown3, ¶m, &count); - param_add_hex("Type", str->type, ¶m, &count); - param_add_hex("Name-Id", str->nameid, ¶m, &count); - if (str->segid && str->nameid) { - street_name_get_by_id(&name, seg->blk_inf.mdata, str->nameid); - - param_add_hex("Len", name.len, ¶m, &count); - param_add_hex("Country", name.country, ¶m, &count); - param_add_hex_sig("TownAssoc", name.townassoc, ¶m, &count); - printf("TownAssoc 0x%x\n", name.townassoc+str->segid); - param_add_string("Name1", name.name1, ¶m, &count); - param_add_string("Name2", name.name2, ¶m, &count); - param_add_hex("Segments", name.segment_count, ¶m, &count); - if (verbose) { - for (j = 0 ; j < name.segment_count ; j++) { - sprintf(buffer,"0x%x 0x%x", name.segments[j].country, name.segments[j].segid); - param_add_string("Segment", buffer, ¶m, &count); - } - param_add_hex("Len", name.aux_len, ¶m, &count); - while (street_name_get_info(&name_info, &name)) { - param_add_hex("Len", name_info.len, ¶m, &count); - param_add_hex("Tag", name_info.tag, ¶m, &count); - param_add_hex("Dist", name_info.dist, ¶m, &count); - param_add_hex("Country", name_info.country, ¶m, &count); - param_add_hex("X", name_info.c->x, ¶m, &count); - param_add_hex("Y", name_info.c->y, ¶m, &count); - param_add_dec("First", name_info.first, ¶m, &count); - param_add_dec("Last", name_info.last, ¶m, &count); - param_add_hex("Segments", name_info.segment_count, ¶m, &count); - } -#if 0 - int tag; - int k, segs; - printf("\n"); - printf("Len 0x%x\n",get_u16(&stn)); - tag=*stn++; - printf("Tag 0x%x\n",tag); - if (tag == 0xc0 || tag == 0xd0 || tag == 0xe0) { - printf("DistAssoc 0x%lx\n",get_u32(&stn)); - printf("Country 0x%lx\n",get_u32(&stn)); - printf("X 0x%lx\n",get_u32(&stn)); - printf("Y 0x%lx\n",get_u32(&stn)); - printf("First %ld\n",get_u24(&stn)); - printf("Last %ld\n",get_u24(&stn)); - segs=get_u32(&stn); - printf("Segs 0x%x\n",segs); - for (k = 0 ; k < 0 ; k++) { - printf("SegId 0x%lx\n", get_u32(&stn)); - printf("Country 0x%lx\n",get_u32(&stn)); - } - } else if (tag == 0x8f || tag == 0xaa || tag == 0xab || tag == 0xae || tag == 0xaf || tag == 0x9a || tag == 0x9e || tag == 0x9f) { - printf("X 0x%lx\n",get_u32(&stn)); - printf("Y 0x%lx\n",get_u32(&stn)); - printf("First %ld\n",get_u24(&stn)); - printf("Last %ld\n",get_u24(&stn)); - printf("SegId 0x%lx\n",get_u32(&stn)); - printf("Country 0x%lx\n",get_u32(&stn)); - } else { - printf("Unknown tag 0x%x\n", tag); - break; - } - } -#endif - } - } else { - if (!verbose) { - param_add_string("Len", "", ¶m, &count); - param_add_string("Country", "", ¶m, &count); - param_add_string("TownAssoc", "", ¶m, &count); - param_add_string("Name1", "", ¶m, &count); - param_add_string("Name2", "", ¶m, &count); - param_add_string("Segments", "", ¶m, &count); - } - } - return i-count; -} - -int -street_bti_get_param(struct segment *seg, struct param_list *param, int count) -{ - int i=count; - struct street_bti *str=seg->data[0]; - - param_add_hex("Addr", (unsigned char *)str-seg->blk_inf.file->begin, ¶m, &count); - param_add_hex("Unknown1", str->unknown1, ¶m, &count); - param_add_hex("Segid1", str->segid1, ¶m, &count); - param_add_hex("Country1", str->country1, ¶m, &count); - param_add_hex("Segid2", str->segid2, ¶m, &count); - param_add_hex("Country2", str->country2, ¶m, &count); - param_add_hex("Unknown5", str->unknown5, ¶m, &count); - param_add_hex("X", str->c.x, ¶m, &count); - param_add_hex("Y", str->c.y, ¶m, &count); - - return i-count; -} - -struct street_data * -street_get_data (struct item *item) -{ - struct coord c[1000]; - int count=0; - struct street_data *ret; - struct attr attr; - - while (count < 1000) { - if (!item_coord_get(item, &c[count], 1)) - break; - count++; - } - g_assert(count < 1000); - ret=g_malloc(sizeof(struct street_data)+count*sizeof(struct coord)); - ret->item=*item; - ret->count=count; - if (item_attr_get(item, attr_limit, &attr)) - ret->limit=attr.u.num; - else - ret->limit=0; - memcpy(ret->c, c, count*sizeof(struct coord)); - - return ret; - -} - -struct street_data * -street_data_dup(struct street_data *orig) -{ - struct street_data *ret; - int size=sizeof(struct street_data)+orig->count*sizeof(struct coord); - - ret=g_malloc(size); - memcpy(ret, orig, size); - - return ret; -} - -void -street_data_free(struct street_data *sd) -{ - g_free(sd); -} - diff --git a/navit/src/street_data.h b/navit/src/street_data.h deleted file mode 100644 index 7f3a507..0000000 --- a/navit/src/street_data.h +++ /dev/null @@ -1,62 +0,0 @@ -static inline int street_get_bytes(struct block *blk) -{ - int bytes,dx,dy; - bytes=2; - dx=blk->c[1].x-blk->c[0].x; - dy=blk->c[0].y-blk->c[1].y; - - if (dx > 32767 || dy > 32767) - bytes=3; - if (dx > 8388608 || dy > 8388608) - bytes=4; - - return bytes; -} - -static inline int street_get_coord(unsigned char **pos, int bytes, struct coord *ref, struct coord *f) -{ - unsigned char *p; - int x,y,flags=0; - - p=*pos; - x=*p++; - x|=(*p++) << 8; - if (bytes == 2) { - if ( x > 0x7fff) { - x=0x10000-x; - flags=1; - } - } - else if (bytes == 3) { - x|=(*p++) << 16; - if ( x > 0x7fffff) { - x=0x1000000-x; - flags=1; - } - } else { - x|=(*p++) << 16; - x|=(*p++) << 24; - if (x < 0) { - x=-x; - flags=1; - } - } - y=*p++; - y|=(*p++) << 8; - if (bytes == 3) { - y|=(*p++) << 16; - } else if (bytes == 4) { - y|=(*p++) << 16; - y|=(*p++) << 24; - } - if (f) { - f->x=ref[0].x+x; - f->y=ref[1].y+y; - } -#if 0 - printf("0x%x,0x%x + 0x%x,0x%x = 0x%x,0x%x", x, y, ref[0].x, ref[1].y, f->x, f->y); -#endif - *pos=p; - return flags; -} - diff --git a/navit/src/street_name.c b/navit/src/street_name.c deleted file mode 100644 index 1e8da63..0000000 --- a/navit/src/street_name.c +++ /dev/null @@ -1,260 +0,0 @@ -#include -#include -#include -#include "map_data.h" -#include "street_name.h" -#include "file.h" -#include "block.h" -#include "data.h" -#include "tree.h" - -void -street_name_get_by_id(struct street_name *name, struct map_data *mdat, unsigned long id) -{ - unsigned char *p; - if (id) { - p=mdat->file[file_strname_stn]->begin+id+0x2000; - street_name_get(name, &p); - } -} - -void -street_name_get(struct street_name *name, unsigned char **p) -{ - unsigned char *start=*p; - name->len=get_u16(p); - name->country=get_u16(p); - name->townassoc=get_u32(p); - name->name1=get_string(p); - name->name2=get_string(p); - name->segment_count=get_u32(p); - name->segments=(struct street_name_segment *)(*p); - (*p)+=(sizeof (struct street_name_segment))*name->segment_count; - name->aux_len=name->len-(*p-start); - name->aux_data=*p; - name->tmp_len=name->aux_len; - name->tmp_data=name->aux_data; - (*p)+=name->aux_len; -} - - -struct street_name_index { - unsigned short country; - long town_assoc; - char name[0]; -} __attribute__((packed)); - -struct street_search_priv { - struct street_name_index *search; - int partial; - struct block_offset last_leaf; - struct map_data *last_mdat; - int last_res; -}; - -static int street_name_compare(struct street_name_index *i1, struct street_name_index *i2, int partial) -{ - char c1_u,c2_u; - int ret=0; - int debug=0; - - if (i1->country > i2->country) - ret=2; - if (i1->country < i2->country) - ret=-2; - if (! ret) { - if (debug) - printf("town: %ld vs %ld\n", i1->town_assoc,i2->town_assoc); - if (i1->town_assoc > i2->town_assoc) - ret=2; - if (i1->town_assoc < i2->town_assoc) - ret=-2; - if (! ret) { - char *c1=i1->name; - char *c2=i2->name; - if (debug) - printf("name: '%s' vs '%s'\n", c1, c2); - for (;;) { - c1_u=toupper(*c1); - c2_u=toupper(*c2); - if (c1_u == c2_u && c1) { - c1++; - c2++; - } else { - if (! c1_u && ! c2_u) { - if (debug) - printf("return 0: end of strings\n"); - ret=0; - break; - } - if (c1_u == '\0' && c2_u == '\t') { - if (debug) - printf("return 0: delimiter found\n"); - ret=0; - break; - } - if (c1_u == '\0' && partial) { - ret=-1; - break; - } - if (c1_u > c2_u) { - ret=2; - break; - } - if (c1_u < c2_u) { - ret=-2; - break; - } - } - } - } - } - return ret; -} - -static int -street_name_tree_process(int version, int leaf, unsigned char **s2, struct map_data *mdat, void *data) -{ - int ret; - struct street_search_priv *priv_data=data; - struct block_offset *blk_off; - int debug=0; - - blk_off=(struct block_offset *)(*s2); - if (debug) - printf("0x%lx\n", get_u32(s2)); - else - get_u32(s2); - struct street_name_index *i1=priv_data->search; - struct street_name_index *i2=(struct street_name_index *)(*s2); - - if (debug) { - printf("Country %d %d\n",i1->country, i2->country); - printf("Town_Assoc 0x%lx 0x%lx\n",i1->town_assoc, i2->town_assoc); - printf("Name '%s' '%s'\n",i1->name, i2->name); - printf("Leaf Data 0x%x 0x%x %d\n", blk_off->offset, blk_off->block, sizeof(*blk_off)); - } - *s2+=sizeof(*i2)+strlen(i2->name)+1; - ret=street_name_compare(i1, i2, priv_data->partial); - if (ret <= 0 && leaf == 1 && i1->country == i2->country && priv_data->last_res > 0) { - if (debug) - printf("street_tree_process: file='%s'\n", mdat->file[file_strname_stn]->name); - priv_data->last_leaf=*blk_off; - priv_data->last_mdat=mdat; - priv_data->last_res=ret; - } - if (debug) - printf("ret=%d\n", ret); - return ret; -} - -int -street_name_search(struct map_data *mdat, int country, int town_assoc, const char *name, int partial, int (*func)(struct street_name *name, void *data), void *data) -{ - struct street_search_priv priv; - unsigned char idx_buffer[strlen(name)+1+sizeof(struct street_name_index)]; - struct street_name_index *idx=(struct street_name_index *)idx_buffer; - struct block *blk; - unsigned char *p,*end; - int blk_num,res; - struct street_name str_name; - char buffer2[4096]; - struct street_name_index *idx2=(struct street_name_index *)buffer2; - int ret,debug=0; - - priv.partial=partial; - idx->country=country; - idx->town_assoc=town_assoc; - strcpy(idx->name, name); - priv.search=idx; - priv.last_res=1; - priv.last_mdat=NULL; - - tree_search_map(mdat, file_strname_stn, "b1", street_name_tree_process, &priv); - -#if 0 - if (debug) - printf("street_search_by_name: name='%s' leaf_data=0x%x priv=%p\n",name,priv.last_leaf.data,&priv); -#endif - if (!priv.last_mdat) - return 0; - blk_num=priv.last_leaf.offset; - if (debug) { - printf("block_num 0x%x\n", blk_num); - printf("file %p\n", priv.last_mdat->file[file_strname_stn]); - } - blk=block_get_byindex(priv.last_mdat->file[file_strname_stn], blk_num, &p); - end=(unsigned char *)blk; - end+=blk->size; - - p=(unsigned char *)blk; - p+=12; - if (debug) - printf("p=%p\n",p); - while (p < end) { - street_name_get(&str_name, &p); - idx2->country=str_name.country; - idx2->town_assoc=str_name.townassoc; - strcpy(idx2->name, str_name.name2); - res=street_name_compare(idx,idx2,partial); - if (res == 0 || res == -1) { - if (debug) - printf("Add res=%d '%s' '%s'\n",res,str_name.name1,str_name.name2); - ret=(*func)(&str_name, data); - if (ret) - return 1; - } - if (res < -1) - break; - } - if (debug) - printf("street_search_by_name: %p vs %p\n", p, end); - return 0; -} - - -int -street_name_get_info(struct street_name_info *inf, struct street_name *name) -{ - unsigned char *p=name->tmp_data; - - if (name->tmp_len <= 0) - return 0; - inf->len=get_u16(&p); - inf->tag=*p++; - inf->dist=get_u32(&p); - inf->country=get_u32(&p); - inf->c=coord_get(&p); - inf->first=get_u24(&p); - inf->last=get_u24(&p); - inf->segment_count=get_u32(&p); - inf->segments=(struct street_segment *)p; - p+=sizeof(struct street_name_segment)*inf->segment_count; - inf->aux_len=name->tmp_data+name->tmp_len-p; - inf->aux_data=p; - inf->tmp_len=inf->aux_len; - inf->tmp_data=inf->aux_data; - name->tmp_data+=inf->len; - name->tmp_len-=inf->len; - - return 1; -} - -int -street_name_get_number_info(struct street_name_number_info *num, struct street_name_info *inf) -{ - unsigned char *p=inf->tmp_data; - - if (inf->tmp_len <= 0) - return 0; - num->len=get_u16(&p); - num->tag=*p++; - num->c=coord_get(&p); - num->first=get_u24(&p); - num->last=get_u24(&p); - num->segment=(struct street_name_segment *)p; - inf->tmp_data+=num->len; - inf->tmp_len-=num->len; - - return 1; -} diff --git a/navit/src/street_name.h b/navit/src/street_name.h deleted file mode 100644 index aca17eb..0000000 --- a/navit/src/street_name.h +++ /dev/null @@ -1,52 +0,0 @@ -#include "types.h" -struct street_name_segment { - int segid; - int country; -}; - -struct street_name { - u16 len; - u16 country; - u32 townassoc; - char *name1; - char *name2; - u32 segment_count; - struct street_name_segment *segments; - int aux_len; - unsigned char *aux_data; - int tmp_len; - unsigned char *tmp_data; -}; - - -struct street_name_info { - u16 len; - int tag; - u32 dist; - u32 country; - struct coord *c; - u32 first; - u32 last; - u32 segment_count; - struct street_segment *segments; - int aux_len; - unsigned char *aux_data; - int tmp_len; - unsigned char *tmp_data; -}; - -struct street_name_number_info { - u16 len; - int tag; - struct coord *c; - u32 first; - u32 last; - struct street_name_segment *segment; -}; - -void street_name_get_by_id(struct street_name *name, struct map_data *mdat, unsigned long id); -void street_name_get(struct street_name *name, unsigned char **p); -int street_name_search(struct map_data *mdat, int country, int town_assoc, const char *name, int partial, int (*func)(struct street_name *name, void *data), void *data); -int street_name_get_info(struct street_name_info *inf, struct street_name *name); -int street_name_get_number_info(struct street_name_number_info *num, struct street_name_info *inf); - diff --git a/navit/src/toolbar.h b/navit/src/toolbar.h deleted file mode 100644 index ce2f18d..0000000 --- a/navit/src/toolbar.h +++ /dev/null @@ -1,3 +0,0 @@ -struct toolbar { - struct toolbar_gui *gui; -}; diff --git a/navit/src/town.c b/navit/src/town.c deleted file mode 100644 index da5770b..0000000 --- a/navit/src/town.c +++ /dev/null @@ -1,261 +0,0 @@ -#include -#include -#include -#include "display.h" -#include "coord.h" -#include "data_window.h" -#include "map_data.h" -#include "town.h" -#include "data.h" -#include "tree.h" -#include "block.h" -#include "file.h" -#include "draw_info.h" -#include "container.h" -#include "util.h" - -static void -town_get(struct town *town, unsigned char **p) -{ - town->id=get_u32(p); - town->c=coord_get(p); - town->name=get_string(p); - town->district=get_string(p); - town->postal_code1=get_string(p); - town->order=get_u8(p); - town->country=get_u16(p); - town->type=get_u8(p); - town->unknown2=get_u32(p); - town->size=get_u8(p); - town->street_assoc=get_u32(p); - town->unknown3=get_u8(p); - town->postal_code2=get_string(p); - town->unknown4=get_u32(p); -} - -void -town_draw_block(struct block_info *blk_inf, unsigned char *start, unsigned char *end, void *data) -{ - unsigned char *p=start; - struct town town; - char *s; - struct point pnt; - struct param_list param[100]; - struct segment seg; - struct draw_info *drw_inf=data; - struct data_window *win=drw_inf->co->data_window[data_window_type_town]; - - seg.blk_inf=*blk_inf; - - p+=4; - while (p < end) { - seg.data[0]=p; - town_get(&town, &p); - if (town.order < drw_inf->limit && transform(drw_inf->co->trans, town.c, &pnt)) { - s=town.name; - if (*town.district) - s=town.district; - display_add(&drw_inf->co->disp[drw_inf->display+town.order], 3, 0, s, 1, &pnt, NULL, &seg, sizeof(seg)); - if (win) - data_window_add(win, param, town_get_param(&seg, param, 100)); - } - } -} - -struct town_search_priv { - int country; - const char *name; - int name_len; - int partial; - int leaf; - int (*func)(struct town *, void *data); - void *data; -}; - -static int -town_tree_process(int version, int leaf, unsigned char **s2, struct map_data *mdat, void *data) -{ - int len, cmp, country; - struct block *blk; - struct town_search_priv *priv_data=data; - struct file *f=mdat->file[file_town_twn]; - struct block_offset *blk_off; - struct town town; - unsigned char *p; - char *name; - int ret,i,debug=0; - - country=get_u16(s2); - name=get_string(s2); - if (debug) { - printf("Country: 0x%x ", country); - printf("Town: '%s' ", name); - } - len=get_u32(s2); - - blk_off=(struct block_offset *)(*s2); - *s2+=len*4; - - cmp=priv_data->country-country; - if (! cmp) { - if (leaf == -1) - priv_data->leaf=0; - if (leaf == 1) - priv_data->leaf=1; - - if (debug) { - printf("'%s' vs '%s' version=%d\n", priv_data->name, name, version); - } - if (priv_data->leaf && priv_data->partial) - cmp=strncmp(priv_data->name,name,priv_data->name_len); - else - cmp=strcmp(priv_data->name,name); - } else { - if (debug) { - printf("country mismatch\n"); - } - } - - if (cmp > 0) - return 2; - if (cmp < 0) - return -2; - if (debug) - printf("%s\n", name); - for (i = 0 ; i < len ; i++) { - blk=block_get_byindex(f, blk_off->block, &p); - p=(unsigned char *)blk+blk_off->offset; - town_get(&town, &p); - ret=(*priv_data->func)(&town, priv_data->data); - if (ret) - return 1; - blk_off++; - } - return 0; -} - -static int -town_search_by(struct map_data *mdat, char *ext, int country, const char *search, int partial, int (*func)(struct town *, void *data), void *data) -{ - struct town_search_priv priv_data; - priv_data.country=country; - priv_data.name=search; - priv_data.name_len=strlen(search); - priv_data.partial=partial; - priv_data.leaf=0; - priv_data.func=func; - priv_data.data=data; - - tree_search_map(mdat, file_town_twn, ext, town_tree_process, &priv_data); - - return 0; -} - -int -town_search_by_postal_code(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *, void *data), void *data) -{ - char uname[strlen(name)+1]; - - strtoupper(uname, name); - return town_search_by(mdat, "b1", country, uname, partial, func, data); -} - - -int -town_search_by_name(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *, void *data), void *data) -{ - char uname[strlen(name)+1]; - - strtolower(uname, (char *)name); - return town_search_by(mdat, "b2", country, uname, partial, func, data); -} - -int -town_search_by_district(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *, void *data), void *data) -{ - char uname[strlen(name)+1]; - - strtoupper(uname, name); - return town_search_by(mdat, "b3", country, uname, partial, func, data); -} - -int -town_search_by_name_phon(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *, void *data), void *data) -{ - char uname[strlen(name)+1]; - - strtoupper(uname, name); - return town_search_by(mdat, "b4", country, uname, partial, func, data); -} - -int -town_search_by_district_phon(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *, void *data), void *data) -{ - char uname[strlen(name)+1]; - - strtoupper(uname, name); - return town_search_by(mdat, "b5", country, uname, partial, func, data); -} - - -void -town_get_by_id(struct town *town, struct map_data *mdat, int country, int id) -{ - struct map_data *mdat_res; - struct file *f; - int res,block,offset; - struct block *blk; - unsigned char *p; - int search1,search2; - unsigned long id2=id; - - if (id < 0) - id=-id; - search2 = id2 & 0xff; - search1 = (id2 >> 8) | (country << 24); - printf("country=0x%x id=0x%lx -id=0x%lx search1=0x%x search2=0x%x\n", country, id2, -id2, search1, search2); - return; - tree_search_hv_map(mdat, file_town_twn, search1, search2, &res, &mdat_res); - printf("res=0x%x\n",res); - block=res >> 16; - offset=res & 0xffff; - f=mdat_res->file[file_town_twn]; - printf("file %s block 0x%x offset 0x%x\n", f->name, block, offset); - blk=block_get_byindex(f, block, &p); - p=(unsigned char *)blk+offset; - printf("addr 0x%lx\n", p-f->begin); - town_get(town, &p); -} - -int -town_get_param(struct segment *seg, struct param_list *param, int count) -{ - int i=count; - unsigned char *p; - struct town town; - - p=(unsigned char *)(seg->blk_inf.block); - p+=sizeof(*seg->blk_inf.block); - - param_add_hex("Block Unknown", get_u32(&p), ¶m, &count); - p=seg->data[0]; - param_add_hex("Address", p-seg->blk_inf.file->begin, ¶m, &count); - town_get(&town, &p); - param_add_hex("ID", town.id, ¶m, &count); - param_add_hex_sig("X", town.c->x, ¶m, &count); - param_add_hex_sig("Y", town.c->y, ¶m, &count); - param_add_string("Name", town.name, ¶m, &count); - param_add_string("District", town.district, ¶m, &count); - param_add_string("PostalCode1", town.postal_code1, ¶m, &count); - param_add_hex("Order", town.order, ¶m, &count); - param_add_hex("Country", town.country, ¶m, &count); - param_add_hex("Type", town.type, ¶m, &count); - param_add_hex("Unknown2", town.unknown2, ¶m, &count); - param_add_hex("Size", town.size, ¶m, &count); - param_add_hex("StreetAssoc", town.street_assoc, ¶m, &count); - param_add_hex("Unknown3", town.unknown3, ¶m, &count); - param_add_string("PostalCode2", town.postal_code2, ¶m, &count); - param_add_hex("Unknown4", town.unknown4, ¶m, &count); - - return i-count; -} diff --git a/navit/src/town.h b/navit/src/town.h deleted file mode 100644 index 4651327..0000000 --- a/navit/src/town.h +++ /dev/null @@ -1,34 +0,0 @@ -#include "types.h" - -/*! A town description */ -struct town { - u32 id; /*!< Identifier */ - struct coord *c; /*!< Coordinates */ - char *name; /*!< Name */ - char *district; /*!< District */ - char *postal_code1; /*!< Postal code */ - u8 order; /*!< Order (Importance) */ - u8 type; /*!< Type */ - u16 country; /*!< Country */ - u32 unknown2; /*!< Unknown */ - u8 size; /*!< Size of town */ - u32 street_assoc; /*!< Association to streets */ - u8 unknown3; /*!< Unknown */ - char *postal_code2; /*!< 2nd postal code */ - u32 unknown4; /*!< Unknown */ -}; - -struct block_info; -struct segment; -struct container; -struct param_list; -struct map_data; - -void town_draw_block(struct block_info *blk_inf, unsigned char *start, unsigned char *end, void *data); -int town_get_param(struct segment *seg, struct param_list *param, int count); -int town_search_by_postal_code(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *, void *data), void *data); -int town_search_by_name(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *, void *data), void *data); -int town_search_by_district(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *, void *data), void *data); -int town_search_by_name_phon(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *, void *data), void *data); -int town_search_by_district_phon(struct map_data *mdat, int country, const char *name, int partial, int (*func)(struct town *, void *data), void *data); -void town_get_by_id(struct town *town, struct map_data *mdat, int country, int id); diff --git a/navit/src/tree.c b/navit/src/tree.c deleted file mode 100644 index 781a0f1..0000000 --- a/navit/src/tree.c +++ /dev/null @@ -1,326 +0,0 @@ -#include -#include -#include "file.h" -#include "map_data.h" -#include "data.h" -#include "tree.h" - -struct tree_hdr { - unsigned int addr; - unsigned int size; - unsigned int low; -}; - -struct tree_hdr_h { - unsigned int addr; - unsigned int size; -}; - -struct tree_leaf_h { - unsigned int lower; - unsigned int higher; - unsigned int match; - unsigned int value; -}; - -struct tree_hdr_v { - unsigned int count; - unsigned int next; - unsigned int unknown; -}; - -struct tree_leaf_v { - unsigned char key; - int value; -} __attribute__((packed)); - -int -tree_compare_string(unsigned char *s1, unsigned char **s2_ptr) -{ - unsigned char *s2=*s2_ptr; - char s1_exp, s2_exp; - *s2_ptr+=strlen((char *)s2)+1; - for (;;) { - s1_exp=*s1++; - s2_exp=*s2++; - if (! s1_exp && ! s2_exp) - return 0; - if (s1_exp == 'A' && *s1 == 'E') { s1_exp='Ä'; s1++; } - if (s1_exp == 'O' && *s1 == 'E') { s1_exp='Ö'; s1++; } - if (s1_exp == 'U' && *s1 == 'E') { s1_exp='Ü'; s1++; } - if (s2_exp == 'A' && *s2 == 'E') { s2_exp='Ä'; s2++; } - if (s2_exp == 'O' && *s2 == 'E') { s2_exp='Ö'; s2++; } - if (s2_exp == 'U' && *s2 == 'E') { s2_exp='Ü'; s2++; } - if (s1_exp > s2_exp) - return 2; - if (s1_exp < s2_exp) - return -2; - } -} - -int -tree_compare_string_partial(unsigned char *s1, unsigned char **s2_ptr) -{ - unsigned char *s2=*s2_ptr; - char s1_exp, s2_exp; - *s2_ptr+=strlen((char *)s2)+1; - for (;;) { - s1_exp=*s1++; - s2_exp=*s2++; - if (! s1_exp && ! s2_exp) - return 0; - if (s1_exp == 'A' && *s1 == 'E') { s1_exp='Ä'; s1++; } - if (s1_exp == 'O' && *s1 == 'E') { s1_exp='Ö'; s1++; } - if (s1_exp == 'U' && *s1 == 'E') { s1_exp='Ü'; s1++; } - if (s2_exp == 'A' && *s2 == 'E') { s2_exp='Ä'; s2++; } - if (s2_exp == 'O' && *s2 == 'E') { s2_exp='Ö'; s2++; } - if (s2_exp == 'U' && *s2 == 'E') { s2_exp='Ü'; s2++; } - if (! s1_exp) - return -1; - if (s1_exp > s2_exp) - return 2; - if (s1_exp < s2_exp) - return -2; - } -} - - -static int -tree_search_h(struct file *file, unsigned int search) -{ - unsigned char *p=file->begin,*end; - int last,i=0,debug=0; - struct tree_hdr_h *thdr; - struct tree_leaf_h *tleaf; - - if (debug) { - printf("tree_search_h\n"); - } - while (i++ < 1000) { - thdr=(struct tree_hdr_h *)p; - p+=sizeof(*thdr); - end=p+thdr->size; - if (debug) { - printf("@0x%lx\n", p-file->begin); - } - last=0; - while (p < end) { - tleaf=(struct tree_leaf_h *)p; - p+=sizeof(*tleaf); - if (debug) { - printf("low:0x%x high:0x%x match:0x%x val:0x%x search:0x%x\n", tleaf->lower, tleaf->higher, tleaf->match, tleaf->value, search); - } - if (tleaf->value == search) - return tleaf->match; - if (tleaf->value > search) { - if (debug) - printf("lower\n"); - if (tleaf->lower) - last=tleaf->lower; - break; - } - last=tleaf->higher; - } - if (! last || last == -1) - return 0; - p=file->begin+last; - } - return 0; -} - -static int -tree_search_v(struct file *file, int offset, int search) -{ - unsigned char *p=file->begin+offset; - int i=0,count,debug=0; - struct tree_hdr_v *thdr; - struct tree_leaf_v *tleaf; - while (i++ < 1000) { - thdr=(struct tree_hdr_v *)p; - p+=sizeof(*thdr); - count=thdr->count; - while (count--) { - tleaf=(struct tree_leaf_v *)p; - p+=sizeof(*tleaf); - if (debug) - printf("tree_search_v: 0x%x 0x%x\n", tleaf->key, search); - if (tleaf->key == search) - return tleaf->value; - } - if (! thdr->next) - break; - p=file->begin+thdr->next; - } - return 0; - -} - -/* return values */ -/* 0=Next */ -/* -2=Too low */ -/* 1=Abort */ -/* 2=Too high */ - -static int -tree_search(int version, struct file *file, unsigned char *p, int (*tree_func)(int version, int leaf, unsigned char **, struct map_data *mdat, void *), struct map_data *mdat, void *data, int higher) -{ - unsigned char *end,*psav; - struct tree_hdr *thdr; - int res=1,low; - int high; - int debug=0; - int leaf=0; - int retry=0; - - if (debug) - printf("version %d\n", version); - - thdr=(struct tree_hdr *)p; - p+=sizeof(*thdr); - low=thdr->low; - end=p+thdr->size; - if (debug) - printf("Header: offset 0x%x size %d low 0x%x\n", thdr->addr, thdr->size, thdr->low); - if (higher == -1) - leaf=-1; - if (higher == 1 && low != -1) { - if (debug) - printf("calling first higher tree 0x%x\n",low); - res=tree_search(version,file,low+file->begin,tree_func,mdat,data,1); - if (debug) - printf("returning from first higher tree res=%d\n", res); - } - while (p < end) { - psav=p; - high=get_u32(&p); - if (high == -1) - leaf=1; - res=tree_func(version, leaf, &p, mdat, data); - leaf=0; - if (debug) - printf("result: %d high 0x%x\n", res, high); - if (res == 1) - return res; - if (res < 0) { - if (debug) - printf("calling lower tree 0x%x\n",low); - if (low != -1) { - res=tree_search(version,file,low+file->begin,tree_func,mdat,data,0); - if (debug) - printf("returning from lower tree res=%d\n", res); - if (! res && !retry++ ) { - if (debug) - printf("retrying current leaf\n"); - p=psav; - continue; - } - low=-1; - if (res < 0) - break; - } - else - break; - } - retry=0; - if (! res && high != -1) { - if (debug) - printf("high=0x%x\n", high); - if (debug) - printf("calling higher tree 0x%x\n",high); - res=tree_search(version,file,high+file->begin,tree_func,mdat,data,1); - if (debug) - printf("returning from higer tree res=%d\n", res); - low=-1; - } else { - low=high; - } - } - if (low != -1) - res=tree_search(version,file,low+file->begin,tree_func,mdat,data,0); - - return res; -} - -int -tree_search_map(struct map_data *mdat, int map, char *ext, - int (*tree_func)(int, int, unsigned char **, struct map_data *mdat, void *), void *data) - -{ - struct file *f_dat,*f_idx; - char filename[4096]; - int len, version, ret; - unsigned char *p; - int debug=0; - - while (mdat) { - f_dat=mdat->file[map]; - strcpy(filename, f_dat->name); - len=strlen(filename); - strcpy(filename+len-3,ext); - if (debug) - printf("tree_search_map: filename='%s'\n", filename); - f_idx=file_create(filename); - version=1; - p=f_idx->begin; - if (!strncmp((char *)(p+4),"RootBlock",9)) { - p+=0x1000; - version=2; - } - ret=tree_search(version, f_idx, p, tree_func, mdat, data, -1); - if (debug) - printf("tree_search_map: ret=%d\n", ret); - file_destroy(f_idx); - if (ret == 1) - return 1; - mdat=mdat->next; - } - return 0; -} - -struct tree_search_hv { - struct map_data *mdat; - struct file *f_idx_h; - struct file *f_idx_v; - struct tree_search_hv *next; -}; - -int -tree_search_hv_map(struct map_data *mdat, int map, unsigned int search1, unsigned int search2, int *result, struct map_data **mdat_result) - -{ - struct file *f_dat,*f_idx_h, *f_idx_v; - char filename[4096]; - int h,len,ret=0; - int debug=0; - - if (debug) - printf("tree_search_hv_map(0x%x 0x%x)\n",search1, search2); - while (mdat && !ret) { - f_dat=mdat->file[map]; - strcpy(filename, f_dat->name); - len=strlen(filename); - strcpy(filename+len-3,"h1"); - f_idx_h=file_create(filename); - strcpy(filename+len-3,"v1"); - f_idx_v=file_create(filename); - h=tree_search_h(f_idx_h, search1); - if (debug) - printf("h=0x%x\n", h); - if (h) { - ret=tree_search_v(f_idx_v, h, search2); - if (ret) { - if (debug) - printf("result 0x%x\n", ret); - *result=ret; - *mdat_result=mdat; - file_destroy(f_idx_v); - file_destroy(f_idx_h); - return 0; - } - } - file_destroy(f_idx_v); - file_destroy(f_idx_h); - mdat=mdat->next; - } - return 1; -} -- 2.7.4